update templui components

This commit is contained in:
juancwu 2026-01-18 22:07:40 +00:00
commit 78047c7ee8
52 changed files with 162 additions and 123 deletions

File diff suppressed because one or more lines are too long

1
assets/js/checkbox.min.js vendored Normal file
View file

@ -0,0 +1 @@
(()=>{(function(){"use strict";function o(t){if(!t._tuiCheckbox){t._tuiCheckbox=!0;var e=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"checked");!e||!e.set||Object.defineProperty(t,"checked",{get:e.get,set:function(c){var n=e.get.call(this);e.set.call(this,c),n!==c&&this.dispatchEvent(new Event("change",{bubbles:!0}))},configurable:!0})}}function r(t){var e=document.querySelector('[data-tui-checkbox-group="'+t+'"][data-tui-checkbox-parent]'),c=document.querySelectorAll('[data-tui-checkbox-group="'+t+'"]:not([data-tui-checkbox-parent])');if(!(!e||!c.length)){var n=0;c.forEach(function(i){i.checked&&n++}),e.checked=n===c.length,e.indeterminate=n>0&&n<c.length}}function u(t,e){document.querySelectorAll('[data-tui-checkbox-group="'+t+'"]:not([data-tui-checkbox-parent])').forEach(function(c){c.checked=e})}document.addEventListener("change",function(t){var e=t.target;if(e.matches("[data-tui-checkbox-group]")){var c=e.getAttribute("data-tui-checkbox-group");e.hasAttribute("data-tui-checkbox-parent")?u(c,e.checked):r(c)}});function a(){var t=new Set;document.querySelectorAll("[data-tui-checkbox-group]").forEach(function(e){t.add(e.getAttribute("data-tui-checkbox-group")),o(e)}),t.forEach(r)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a()})();})();

View file

@ -1 +1 @@
(()=>{(function(){"use strict";function i(t){let e=t.closest('[data-tui-collapsible="root"]');if(!e)return;let a=e.getAttribute("data-tui-collapsible-state")==="open",n=a?"closed":"open";e.setAttribute("data-tui-collapsible-state",n),t.setAttribute("aria-expanded",!a)}document.addEventListener("click",t=>{let e=t.target.closest('[data-tui-collapsible="trigger"]');e&&(t.preventDefault(),i(e))}),document.addEventListener("keydown",t=>{if(t.key!==" "&&t.key!=="Enter")return;let e=t.target.closest('[data-tui-collapsible="trigger"]');e&&(t.preventDefault(),i(e))})})();})();
(()=>{(function(){"use strict";function l(t){let e=t.querySelectorAll('[data-tui-collapsible="content"]');for(let n of e)if(n.closest('[data-tui-collapsible="root"]')===t)return n;return null}function i(t){let e=t.closest('[data-tui-collapsible="root"]');if(!e)return;let n=l(e),o=e.getAttribute("data-tui-collapsible-state")==="open",s=o?"closed":"open";e.setAttribute("data-tui-collapsible-state",s),t.setAttribute("aria-expanded",!o),n&&n.classList.toggle("tui-collapsible-open",!o)}function a(){document.querySelectorAll('[data-tui-collapsible="root"]').forEach(t=>{let e=t.getAttribute("data-tui-collapsible-state")==="open",n=l(t);n&&n.classList.toggle("tui-collapsible-open",e)})}document.addEventListener("click",t=>{let e=t.target.closest('[data-tui-collapsible="trigger"]');e&&(t.preventDefault(),i(e))}),document.addEventListener("keydown",t=>{if(t.key!==" "&&t.key!=="Enter")return;let e=t.target.closest('[data-tui-collapsible="trigger"]');e&&(t.preventDefault(),i(e))}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a()})();})();

View file

@ -1 +1 @@
(()=>{(function(){"use strict";function s(t){if(!t)return null;let e=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!e)return null;let a=parseInt(e[1],10),n=parseInt(e[2],10)-1,d=parseInt(e[3],10),r=new Date(Date.UTC(a,n,d));return r.getUTCFullYear()===a&&r.getUTCMonth()===n&&r.getUTCDate()===d?r:null}function l(t,e,a){if(!t||isNaN(t.getTime()))return"";let n={timeZone:"UTC"},d={"locale-short":"short","locale-long":"long","locale-full":"full","locale-medium":"medium"};n.dateStyle=d[e]||"medium";try{return new Intl.DateTimeFormat(a,n).format(t)}catch{let i=t.getUTCFullYear(),c=(t.getUTCMonth()+1).toString().padStart(2,"0"),p=t.getUTCDate().toString().padStart(2,"0");return`${i}-${c}-${p}`}}function o(t){let e=t.id+"-calendar-instance",a=document.getElementById(e),n=document.getElementById(t.id+"-hidden")||t.parentElement?.querySelector("[data-tui-datepicker-hidden-input]"),d=t.querySelector("[data-tui-datepicker-display]");return{calendar:a,hiddenInput:n,display:d}}function u(t){let e=o(t);if(!e.display||!e.hiddenInput)return;let a=t.getAttribute("data-tui-datepicker-display-format")||"locale-medium",n=t.getAttribute("data-tui-datepicker-locale-tag")||"en-US",d=t.getAttribute("data-tui-datepicker-placeholder")||"Select a date";if(e.hiddenInput.value){let r=s(e.hiddenInput.value);if(r){e.display.textContent=l(r,a,n),e.display.classList.remove("text-muted-foreground");return}}e.display.textContent=d,e.display.classList.add("text-muted-foreground")}document.addEventListener("calendar-date-selected",t=>{let e=t.target;if(!e||!e.id.endsWith("-calendar-instance"))return;let a=e.id.replace("-calendar-instance",""),n=document.getElementById(a);if(!n||!n.hasAttribute("data-tui-datepicker"))return;let d=o(n);if(!d.display||!t.detail?.date)return;let r=n.getAttribute("data-tui-datepicker-display-format")||"locale-medium",i=n.getAttribute("data-tui-datepicker-locale-tag")||"en-US";if(d.display.textContent=l(t.detail.date,r,i),d.display.classList.remove("text-muted-foreground"),window.closePopover){let c=n.getAttribute("aria-controls")||n.id+"-content";window.closePopover(c)}}),document.addEventListener("reset",t=>{t.target.matches("form")&&t.target.querySelectorAll('[data-tui-datepicker="true"]').forEach(e=>{let a=o(e);a.hiddenInput&&(a.hiddenInput.value=""),u(e)})}),new MutationObserver(()=>{document.querySelectorAll('[data-tui-datepicker="true"]:not([data-rendered])').forEach(t=>{t.setAttribute("data-rendered","true"),u(t)})}).observe(document.body,{childList:!0,subtree:!0})})();})();
(()=>{(function(){"use strict";function p(t){if(t._tui)return;t._tui=!0;let e=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");e?.set&&Object.defineProperty(t,"value",{get:e.get,set(a){let n=this.value;e.set.call(this,a),n!==a&&this.dispatchEvent(new Event("input",{bubbles:!0}))},configurable:!0})}function m(t){if(!t)return null;let e=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!e)return null;let a=parseInt(e[1],10),n=parseInt(e[2],10)-1,d=parseInt(e[3],10),i=new Date(Date.UTC(a,n,d));return i.getUTCFullYear()===a&&i.getUTCMonth()===n&&i.getUTCDate()===d?i:null}function s(t,e,a){if(!t||isNaN(t.getTime()))return"";let n={timeZone:"UTC"},d={"locale-short":"short","locale-long":"long","locale-full":"full","locale-medium":"medium"};n.dateStyle=d[e]||"medium";try{return new Intl.DateTimeFormat(a,n).format(t)}catch{let u=t.getUTCFullYear(),l=(t.getUTCMonth()+1).toString().padStart(2,"0"),f=t.getUTCDate().toString().padStart(2,"0");return`${u}-${l}-${f}`}}function r(t){let e=t.id+"-calendar-instance",a=document.getElementById(e),n=document.getElementById(t.id+"-hidden")||t.parentElement?.querySelector("[data-tui-datepicker-hidden-input]"),d=t.querySelector("[data-tui-datepicker-display]");return{calendar:a,hiddenInput:n,display:d}}function o(t){let e=r(t);if(!e.display||!e.hiddenInput)return;let a=t.getAttribute("data-tui-datepicker-display-format")||"locale-medium",n=t.getAttribute("data-tui-datepicker-locale-tag")||"en-US",d=t.getAttribute("data-tui-datepicker-placeholder")||"Select a date";if(e.hiddenInput.value){let i=m(e.hiddenInput.value);if(i){e.display.textContent=s(i,a,n),e.display.classList.remove("text-muted-foreground");return}}e.display.textContent=d,e.display.classList.add("text-muted-foreground")}document.addEventListener("calendar-date-selected",t=>{let e=t.target;if(!e||!e.id.endsWith("-calendar-instance"))return;let a=e.id.replace("-calendar-instance",""),n=document.getElementById(a);if(!n||!n.hasAttribute("data-tui-datepicker"))return;let d=r(n);if(!d.display||!t.detail?.date)return;let i=n.getAttribute("data-tui-datepicker-display-format")||"locale-medium",u=n.getAttribute("data-tui-datepicker-locale-tag")||"en-US";if(d.display.textContent=s(t.detail.date,i,u),d.display.classList.remove("text-muted-foreground"),window.closePopover){let l=n.getAttribute("aria-controls")||n.id+"-content";window.closePopover(l)}}),document.addEventListener("input",t=>{if(!t.target.matches("[data-tui-datepicker-hidden-input]"))return;let e=document.getElementById(t.target.id.replace("-hidden",""));e&&o(e)}),document.addEventListener("reset",t=>{t.target.matches("form")&&t.target.querySelectorAll('[data-tui-datepicker="true"]').forEach(e=>{let a=r(e);a.hiddenInput&&(a.hiddenInput.value=""),o(e)})});function c(){document.querySelectorAll('[data-tui-datepicker="true"]').forEach(t=>{let e=r(t);!e.hiddenInput||e.hiddenInput._tui||(p(e.hiddenInput),o(t))})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",c):c(),new MutationObserver(c).observe(document.body,{childList:!0,subtree:!0})})();})();

View file

@ -1 +1 @@
(()=>{(function(){"use strict";function u(t){return{value:parseFloat(t.getAttribute("data-tui-rating-initial-value"))||0,precision:parseFloat(t.getAttribute("data-tui-rating-precision"))||1,readonly:t.getAttribute("data-tui-rating-readonly")==="true",name:t.getAttribute("data-tui-rating-name")||"",onlyInteger:t.getAttribute("data-tui-rating-onlyinteger")==="true"}}function d(t){return parseFloat(t.getAttribute("data-tui-rating-current"))||parseFloat(t.getAttribute("data-tui-rating-initial-value"))||0}function l(t,a){t.setAttribute("data-tui-rating-current",a);let e=t.querySelector("[data-tui-rating-input]");e&&(e.value=a.toFixed(2),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))}function c(t,a){let e=d(t),r=a>0?a:e;t.querySelectorAll("[data-tui-rating-item]").forEach(i=>{let o=parseInt(i.getAttribute("data-tui-rating-value"),10);if(isNaN(o))return;let s=i.querySelector("[data-tui-rating-item-foreground]");if(!s)return;let n=o<=Math.floor(r),f=!n&&o-1<r&&r<o,p=f?(r-Math.floor(r))*100:0;s.style.width=n?"100%":f?`${p}%`:"0%"})}function g(t){let a=0;return t.querySelectorAll("[data-tui-rating-item]").forEach(e=>{let r=parseInt(e.getAttribute("data-tui-rating-value"),10);!isNaN(r)&&r>a&&(a=r)}),Math.max(1,a)}document.addEventListener("click",t=>{let a=t.target.closest("[data-tui-rating-item]");if(!a)return;let e=a.closest("[data-tui-rating-component]");if(!e)return;let r=u(e);if(r.readonly)return;let i=parseInt(a.getAttribute("data-tui-rating-value"),10);if(isNaN(i))return;let o=d(e),s=g(e),n=i;r.onlyInteger?n=Math.round(n):o===n&&n%1===0?n=Math.max(0,n-r.precision):n=Math.round(n/r.precision)*r.precision,n=Math.max(0,Math.min(s,n)),l(e,n),c(e,0),e.dispatchEvent(new CustomEvent("rating-change",{bubbles:!0,detail:{name:r.name,value:n,maxValue:s}}))}),document.addEventListener("mouseover",t=>{let a=t.target.closest("[data-tui-rating-item]");if(!a)return;let e=a.closest("[data-tui-rating-component]");if(!e||u(e).readonly)return;let r=parseInt(a.getAttribute("data-tui-rating-value"),10);isNaN(r)||c(e,r)}),document.addEventListener("mouseout",t=>{let a=t.target.closest("[data-tui-rating-component]");!a||u(a).readonly||a.contains(t.relatedTarget)||c(a,0)}),document.addEventListener("reset",t=>{t.target.matches("form")&&t.target.querySelectorAll("[data-tui-rating-component]").forEach(a=>{let e=u(a);l(a,e.value),c(a,0)})}),new MutationObserver(()=>{document.querySelectorAll("[data-tui-rating-component]").forEach(t=>{if(!t.hasAttribute("data-tui-rating-current")){let e=u(t),r=g(t),i=Math.max(0,Math.min(r,e.value));l(t,Math.round(i/e.precision)*e.precision)}c(t,0),u(t).readonly&&(t.style.cursor="default",t.querySelectorAll("[data-tui-rating-item]").forEach(e=>{e.style.cursor="default"}))})}).observe(document.body,{childList:!0,subtree:!0})})();})();
(()=>{(function(){"use strict";function h(t){if(t._tui)return;t._tui=!0;let e=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");e?.set&&Object.defineProperty(t,"value",{get:e.get,set(a){let n=this.value;e.set.call(this,a),n!==a&&this.dispatchEvent(new Event("input",{bubbles:!0}))},configurable:!0})}function o(t){return{value:parseFloat(t.getAttribute("data-tui-rating-initial-value"))||0,precision:parseFloat(t.getAttribute("data-tui-rating-precision"))||1,readonly:t.getAttribute("data-tui-rating-readonly")==="true",name:t.getAttribute("data-tui-rating-name")||"",onlyInteger:t.getAttribute("data-tui-rating-onlyinteger")==="true"}}function f(t){return parseFloat(t.getAttribute("data-tui-rating-current"))||parseFloat(t.getAttribute("data-tui-rating-initial-value"))||0}function d(t,e){t.setAttribute("data-tui-rating-current",e);let a=t.querySelector("[data-tui-rating-hidden-input]");a&&(a.value=e.toFixed(2),a.dispatchEvent(new Event("input",{bubbles:!0})),a.dispatchEvent(new Event("change",{bubbles:!0})))}function c(t,e){let a=f(t),n=e>0?e:a;t.querySelectorAll("[data-tui-rating-item]").forEach(u=>{let r=parseInt(u.getAttribute("data-tui-rating-value"),10);if(isNaN(r))return;let s=u.querySelector("[data-tui-rating-item-foreground]");if(!s)return;let i=r<=Math.floor(n),p=!i&&r-1<n&&n<r,m=p?(n-Math.floor(n))*100:0;s.style.width=i?"100%":p?`${m}%`:"0%"})}function l(t){let e=0;return t.querySelectorAll("[data-tui-rating-item]").forEach(a=>{let n=parseInt(a.getAttribute("data-tui-rating-value"),10);!isNaN(n)&&n>e&&(e=n)}),Math.max(1,e)}document.addEventListener("click",t=>{let e=t.target.closest("[data-tui-rating-item]");if(!e)return;let a=e.closest("[data-tui-rating-component]");if(!a)return;let n=o(a);if(n.readonly)return;let u=parseInt(e.getAttribute("data-tui-rating-value"),10);if(isNaN(u))return;let r=f(a),s=l(a),i=u;n.onlyInteger?i=Math.round(i):r===i&&i%1===0?i=Math.max(0,i-n.precision):i=Math.round(i/n.precision)*n.precision,i=Math.max(0,Math.min(s,i)),d(a,i),c(a,0),a.dispatchEvent(new CustomEvent("rating-change",{bubbles:!0,detail:{name:n.name,value:i,maxValue:s}}))}),document.addEventListener("mouseover",t=>{let e=t.target.closest("[data-tui-rating-item]");if(!e)return;let a=e.closest("[data-tui-rating-component]");if(!a||o(a).readonly)return;let n=parseInt(e.getAttribute("data-tui-rating-value"),10);isNaN(n)||c(a,n)}),document.addEventListener("mouseout",t=>{let e=t.target.closest("[data-tui-rating-component]");!e||o(e).readonly||e.contains(t.relatedTarget)||c(e,0)}),document.addEventListener("input",t=>{if(!t.target.matches("[data-tui-rating-hidden-input]"))return;let e=t.target.closest("[data-tui-rating-component]");if(e){let a=parseFloat(t.target.value)||0,n=o(e),u=l(e),r=Math.max(0,Math.min(u,a));e.setAttribute("data-tui-rating-current",r),c(e,0)}}),document.addEventListener("reset",t=>{t.target.matches("form")&&t.target.querySelectorAll("[data-tui-rating-component]").forEach(e=>{let a=o(e);d(e,a.value),c(e,0)})});function g(){document.querySelectorAll("[data-tui-rating-component]").forEach(t=>{let e=t.querySelector("[data-tui-rating-hidden-input]");if(e&&!e._tui&&h(e),!t.hasAttribute("data-tui-rating-current")){let n=o(t),u=l(t),r=Math.max(0,Math.min(u,n.value));d(t,Math.round(r/n.precision)*n.precision)}c(t,0),o(t).readonly&&(t.style.cursor="default",t.querySelectorAll("[data-tui-rating-item]").forEach(n=>{n.style.cursor="default"}))})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",g):g(),new MutationObserver(g).observe(document.body,{childList:!0,subtree:!0})})();})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
// templui component accordion - version: v0.101.0 installed by templui v0.101.0
// templui component accordion - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/accordion
package accordion

View file

@ -1,4 +1,4 @@
// templui component alert - version: v0.101.0 installed by templui v0.101.0
// templui component alert - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/alert
package alert

View file

@ -1,4 +1,4 @@
// templui component aspectratio - version: v0.101.0 installed by templui v0.101.0
// templui component aspectratio - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/aspect-ratio
package aspectratio

View file

@ -1,4 +1,4 @@
// templui component avatar - version: v0.101.0 installed by templui v0.101.0
// templui component avatar - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/avatar
package avatar
@ -93,5 +93,5 @@ templ Fallback(props ...FallbackProps) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/avatar.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/avatar.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component badge - version: v0.101.0 installed by templui v0.101.0
// templui component badge - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/badge
package badge

View file

@ -1,4 +1,4 @@
// templui component breadcrumb - version: v0.101.0 installed by templui v0.101.0
// templui component breadcrumb - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/breadcrumb
package breadcrumb

View file

@ -1,4 +1,4 @@
// templui component button - version: v0.101.0 installed by templui v0.101.0
// templui component button - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/button
package button
@ -116,7 +116,7 @@ templ Button(props ...Props) {
func (b Props) variantClasses() string {
switch b.Variant {
case VariantDestructive:
return "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60"
return "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60"
case VariantOutline:
return "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50"
case VariantSecondary:

View file

@ -1,4 +1,4 @@
// templui component calendar - version: v0.101.0 installed by templui v0.101.0
// templui component calendar - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/calendar
package calendar
@ -136,11 +136,12 @@ templ Calendar(props ...Props) {
</button>
<div class="flex gap-2 flex-1 min-w-0">
<!-- Month Select -->
<!-- Add bg-card to fix rendering in dark mode Chrome -->
<div class="relative flex-1 has-[:focus]:border-ring border border-input shadow-xs has-[:focus]:ring-ring/50 has-[:focus]:ring-[3px] rounded-md">
<select
id={ p.ID + "-month-select" }
data-tui-calendar-month-select
class="absolute inset-0 opacity-0 cursor-pointer w-full"
class="absolute inset-0 opacity-0 cursor-pointer w-full bg-card"
aria-label="Choose the Month"
>
for i := 0; i < 12; i++ {
@ -155,11 +156,12 @@ templ Calendar(props ...Props) {
</span>
</div>
<!-- Year Select -->
<!-- Add bg-card to fix rendering in dark mode Chrome -->
<div class="relative flex-1 has-[:focus]:border-ring border border-input shadow-xs has-[:focus]:ring-ring/50 has-[:focus]:ring-[3px] rounded-md">
<select
id={ p.ID + "-year-select" }
data-tui-calendar-year-select
class="absolute inset-0 opacity-0 cursor-pointer w-full"
class="absolute inset-0 opacity-0 cursor-pointer w-full bg-card"
aria-label="Choose the Year"
>
for year := 2100; year >= 1900; year-- {
@ -191,5 +193,5 @@ templ Calendar(props ...Props) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/calendar.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/calendar.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component card - version: v0.101.0 installed by templui v0.101.0
// templui component card - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/card
package card

View file

@ -1,4 +1,4 @@
// templui component carousel - version: v0.101.0 installed by templui v0.101.0
// templui component carousel - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/carousel
package carousel
@ -207,5 +207,5 @@ templ Indicators(props ...IndicatorsProps) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/carousel.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/carousel.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component chart - version: v0.101.0 installed by templui v0.101.0
// templui component chart - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/charts
package chart
@ -48,6 +48,9 @@ type Config struct {
ShowYGrid bool `json:"showYGrid"`
Horizontal bool `json:"horizontal"`
Stacked bool `json:"stacked"`
YMin *float64 `json:"yMin,omitempty"`
YMax *float64 `json:"yMax,omitempty"`
BeginAtZero *bool `json:"beginAtZero,omitempty"`
}
type Props struct {
@ -64,6 +67,9 @@ type Props struct {
ShowYGrid bool
Horizontal bool
Stacked bool
YMin *float64
YMax *float64
BeginAtZero *bool
Class string
Attributes templ.Attributes
}
@ -103,11 +109,14 @@ templ Chart(props ...Props) {
ShowYGrid: p.ShowYGrid,
Horizontal: p.Horizontal,
Stacked: p.Stacked,
YMin: p.YMin,
YMax: p.YMax,
BeginAtZero: p.BeginAtZero,
}
}}
@templ.JSONScript(dataId, chartConfig)
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/chart.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/chart.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component checkbox - version: v0.101.0 installed by templui v0.101.0
// templui component checkbox - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/checkbox
package checkbox
@ -15,6 +15,8 @@ type Props struct {
Value string
Disabled bool
Checked bool
Group string
GroupParent bool
Form string
Icon templ.Component
}
@ -42,6 +44,12 @@ templ Checkbox(props ...Props) {
if p.Form != "" {
form={ p.Form }
}
if p.Group != "" {
data-tui-checkbox-group={ p.Group }
}
if p.GroupParent {
data-tui-checkbox-parent="true"
}
type="checkbox"
class={
utils.TwMerge(
@ -49,6 +57,7 @@ templ Checkbox(props ...Props) {
"focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:border-ring",
"disabled:cursor-not-allowed disabled:opacity-50",
"checked:bg-primary checked:text-primary-foreground checked:border-primary",
"indeterminate:bg-primary indeterminate:text-primary-foreground indeterminate:border-primary",
"appearance-none cursor-pointer transition-shadow",
"relative",
p.Class,
@ -57,7 +66,7 @@ templ Checkbox(props ...Props) {
{ p.Attributes... }
/>
<div
class="absolute left-0 top-0 h-4 w-4 pointer-events-none flex items-center justify-center text-primary-foreground opacity-0 peer-checked:opacity-100"
class="absolute inset-0 pointer-events-none flex items-center justify-center text-primary-foreground opacity-0 peer-checked:opacity-100"
>
if p.Icon != nil {
@p.Icon
@ -65,5 +74,14 @@ templ Checkbox(props ...Props) {
@icon.Check(icon.Props{Size: 14})
}
</div>
<div
class="absolute inset-0 pointer-events-none flex items-center justify-center text-primary-foreground opacity-0 peer-indeterminate:opacity-100"
>
@icon.Minus(icon.Props{Size: 14})
</div>
</div>
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/checkbox.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component code - version: v0.101.0 installed by templui v0.101.0
// templui component code - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/code
package code
@ -52,5 +52,5 @@ templ Code(props ...Props) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/code.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/code.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component collapsible - version: v0.101.0 installed by templui v0.101.0
// templui component collapsible - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/collapsible
package collapsible
@ -69,7 +69,7 @@ templ Content(props ...ContentProps) {
id={ p.ID }
}
class={ utils.TwMerge(
"grid grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out [[data-tui-collapsible-state=open]_&]:grid-rows-[1fr]",
"grid grid-rows-[0fr] transition-[grid-template-rows] duration-200 ease-out [&.tui-collapsible-open]:grid-rows-[1fr]",
p.Class,
) }
data-tui-collapsible="content"
@ -82,5 +82,5 @@ templ Content(props ...ContentProps) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/collapsible.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/collapsible.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component copybutton - version: v0.101.0 installed by templui v0.101.0
// templui component copybutton - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/copy-button
package copybutton
@ -44,5 +44,5 @@ templ CopyButton(props Props) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/copybutton.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/copybutton.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component datepicker - version: v0.101.0 installed by templui v0.101.0
// templui component datepicker - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/date-picker
package datepicker
@ -154,5 +154,5 @@ templ DatePicker(props ...Props) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/datepicker.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/datepicker.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component dialog - version: v0.101.0 installed by templui v0.101.0
// templui component dialog - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/dialog
package dialog
@ -328,5 +328,5 @@ templ Description(props ...DescriptionProps) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/dialog.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/dialog.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component dropdown - version: v0.101.0 installed by templui v0.101.0
// templui component dropdown - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/dropdown
package dropdown
@ -387,5 +387,5 @@ templ SubContent(props ...SubContentProps) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/dropdown.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/dropdown.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component form - version: v0.101.0 installed by templui v0.101.0
// templui component form - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/form
package form

View file

@ -1,4 +1,4 @@
// templui component icon - version: v0.101.0 installed by templui v0.101.0
// templui component icon - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/icon
package icon

View file

@ -1,4 +1,4 @@
// templui component icon - version: v0.101.0 installed by templui v0.101.0
// templui component icon - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/icon
package icon

View file

@ -1,7 +1,6 @@
// templui component icon - version: v0.101.0 installed by templui v0.101.0
// templui component icon - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/icon
package icon
// This file is auto generated
// Using Lucide icons version 0.544.0
var AlarmClockOff = Icon("alarm-clock-off")

View file

@ -1,4 +1,4 @@
// templui component input - version: v0.101.0 installed by templui v0.101.0
// templui component input - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/input
package input
@ -126,5 +126,5 @@ templ Input(props ...Props) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/input.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/input.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component inputotp - version: v0.101.0 installed by templui v0.101.0
// templui component inputotp - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/input-otp
package inputotp
@ -177,5 +177,5 @@ templ Separator(props ...SeparatorProps) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/inputotp.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/inputotp.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component label - version: v0.101.0 installed by templui v0.101.0
// templui component label - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/label
package label
@ -39,5 +39,5 @@ templ Label(props ...Props) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/label.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/label.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component pagination - version: v0.101.0 installed by templui v0.101.0
// templui component pagination - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/pagination
package pagination

View file

@ -1,4 +1,4 @@
// templui component popover - version: v0.101.0 installed by templui v0.101.0
// templui component popover - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/popover
package popover
@ -131,5 +131,5 @@ templ Content(props ...ContentProps) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/popover.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/popover.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component progress - version: v0.101.0 installed by templui v0.101.0
// templui component progress - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/progress
package progress
@ -123,5 +123,5 @@ func variantClasses(variant Variant) string {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/progress.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/progress.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component radio - version: v0.101.0 installed by templui v0.101.0
// templui component radio - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/radio
package radio

View file

@ -1,4 +1,4 @@
// templui component rating - version: v0.101.0 installed by templui v0.101.0
// templui component rating - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/rating
package rating
@ -78,7 +78,7 @@ templ Rating(props ...Props) {
if p.Form != "" {
form={ p.Form }
}
data-tui-rating-input
data-tui-rating-hidden-input
/>
}
</div>
@ -189,5 +189,5 @@ func (p *Props) setDefaults() {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/rating.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/rating.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component selectbox - version: v0.101.0 installed by templui v0.101.0
// templui component selectbox - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/select-box
package selectbox
@ -156,6 +156,7 @@ templ Trigger(props ...TriggerProps) {
if p.Form != "" {
form={ p.Form }
}
data-tui-selectbox-hidden-input
{ p.Attributes... }
/>
{ children... }
@ -321,5 +322,5 @@ templ Item(props ...ItemProps) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/selectbox.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/selectbox.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component separator - version: v0.101.0 installed by templui v0.101.0
// templui component separator - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/separator
package separator

View file

@ -1,4 +1,4 @@
// templui component sheet - version: v0.101.0 installed by templui v0.101.0
// templui component sheet - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/sheet
package sheet

View file

@ -1,4 +1,4 @@
// templui component sidebar - version: v0.101.0 installed by templui v0.101.0
// templui component sidebar - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/sidebar
package sidebar
@ -749,5 +749,5 @@ templ Separator(props ...SeparatorProps) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/sidebar.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/sidebar.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component skeleton - version: v0.101.0 installed by templui v0.101.0
// templui component skeleton - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/skeleton
package skeleton

View file

@ -1,4 +1,4 @@
// templui component slider - version: v0.101.0 installed by templui v0.101.0
// templui component slider - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/slider
package slider
@ -117,5 +117,5 @@ templ Value(props ...ValueProps) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/slider.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/slider.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component switch - version: v0.101.0 installed by templui v0.101.0
// templui component switch - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/switch
package switchcomp

View file

@ -1,4 +1,4 @@
// templui component table - version: v0.101.0 installed by templui v0.101.0
// templui component table - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/table
package table
@ -58,7 +58,6 @@ templ Table(props ...Props) {
if len(props) > 0 {
{{ p = props[0] }}
}
<div class="relative w-full overflow-auto">
<table
if p.ID != "" {
id={ p.ID }
@ -68,7 +67,6 @@ templ Table(props ...Props) {
>
{ children... }
</table>
</div>
}
templ Header(props ...HeaderProps) {

View file

@ -1,4 +1,4 @@
// templui component tabs - version: v0.101.0 installed by templui v0.101.0
// templui component tabs - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/tabs
package tabs
@ -159,5 +159,5 @@ func IDFromContext(ctx context.Context) string {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/tabs.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/tabs.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component tagsinput - version: v0.101.0 installed by templui v0.101.0
// templui component tagsinput - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/tags-input
package tagsinput
@ -26,9 +26,6 @@ templ TagsInput(props ...Props) {
if len(props) > 0 {
{{ p = props[0] }}
}
if p.ID == "" {
{{ p.ID = utils.RandomID() }}
}
<div
id={ p.ID + "-container" }
class={
@ -93,5 +90,5 @@ templ TagsInput(props ...Props) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/tagsinput.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/tagsinput.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component textarea - version: v0.101.0 installed by templui v0.101.0
// templui component textarea - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/textarea
package textarea
@ -81,5 +81,5 @@ templ Textarea(props ...Props) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/textarea.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/textarea.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component timepicker - version: v0.101.0 installed by templui v0.101.0
// templui component timepicker - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/time-picker
package timepicker
@ -246,5 +246,5 @@ templ TimePicker(props ...Props) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/timepicker.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/timepicker.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component toast - version: v0.101.0 installed by templui v0.101.0
// templui component toast - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/toast
package toast
@ -149,5 +149,5 @@ templ Toast(props ...Props) {
}
templ Script() {
<script defer nonce={ templ.GetNonce(ctx) } src={ "/assets/js/toast.min.js?v=" + utils.ScriptVersion }></script>
<script defer nonce={ templ.GetNonce(ctx) } src={ utils.ScriptURL("/assets/js/toast.min.js") }></script>
}

View file

@ -1,4 +1,4 @@
// templui component tooltip - version: v0.101.0 installed by templui v0.101.0
// templui component tooltip - version: v1.2.0 installed by templui v1.2.0
// 📚 Documentation: https://templui.io/docs/components/tooltip
package tooltip

View file

@ -58,3 +58,17 @@ func RandomID() string {
// ScriptVersion is a timestamp generated at app start for cache busting.
// Used in Script() templates to append ?v=<timestamp> to script URLs.
var ScriptVersion = fmt.Sprintf("%d", time.Now().Unix())
// ScriptURL generates cache-busted script URLs.
// Override this to use custom cache busting (CDN, content hashing, etc.)
//
// Example override in your app:
//
// func init() {
// utils.ScriptURL = func(path string) string {
// return myAssetManifest.GetURL(path)
// }
// }
var ScriptURL = func(path string) string {
return path + "?v=" + ScriptVersion
}