BbvIyG5y.js
6.68 KB
import{T as z,aE as B,U as I,V,aF as F,y as P,o as s,k as h,w as C,c,Y as n,g as r,n as g,e as x,x as d,aG as T,S as N,N as j,P as E,s as p,p as O,$ as U,l as k,t as q,a0 as w,aH as A}from"./BtEn9SvP.js";const R={slots:{root:"relative flex rounded-lg",spotlight:"absolute inset-0 rounded-[inherit] pointer-events-none bg-default/90",container:"relative flex flex-col flex-1 lg:grid gap-x-8 gap-y-4 p-4 sm:p-6",wrapper:"flex flex-col flex-1 items-start",header:"mb-4",body:"flex-1",footer:"pt-4 mt-auto",leading:"inline-flex items-center mb-2.5",leadingIcon:"size-5 shrink-0 text-primary",title:"text-base text-pretty font-semibold text-highlighted",description:"text-[15px] text-pretty"},variants:{orientation:{horizontal:{container:"lg:grid-cols-2 lg:items-center"},vertical:{container:""}},reverse:{true:{wrapper:"order-last"}},variant:{solid:{root:"bg-inverted text-inverted",title:"text-inverted",description:"text-dimmed"},outline:{root:"bg-default ring ring-default",description:"text-muted"},soft:{root:"bg-elevated/50",description:"text-toned"},subtle:{root:"bg-elevated/50 ring ring-default",description:"text-toned"},ghost:{description:"text-muted"},naked:{container:"p-0 sm:p-0",description:"text-muted"}},to:{true:{root:["has-focus-visible:ring-2 has-focus-visible:ring-primary","transition"]}},title:{true:{description:"mt-1"}},highlight:{true:{root:"ring-2"}},highlightColor:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""},spotlight:{true:{root:"[--spotlight-size:400px] before:absolute before:-inset-px before:pointer-events-none before:rounded-[inherit] before:bg-[radial-gradient(var(--spotlight-size)_var(--spotlight-size)_at_calc(var(--spotlight-x,0px))_calc(var(--spotlight-y,0px)),var(--spotlight-color),transparent_70%)]"}},spotlightColor:{primary:"",secondary:"",success:"",info:"",warning:"",error:"",neutral:""}},compoundVariants:[{variant:"solid",to:!0,class:{root:"hover:bg-inverted/90"}},{variant:"outline",to:!0,class:{root:"hover:bg-elevated/50"}},{variant:"soft",to:!0,class:{root:"hover:bg-elevated"}},{variant:"subtle",to:!0,class:{root:"hover:bg-elevated"}},{variant:"subtle",to:!0,highlight:!1,class:{root:"hover:ring-accented"}},{variant:"ghost",to:!0,class:{root:"hover:bg-elevated/50"}},{highlightColor:"primary",highlight:!0,class:{root:"ring-primary"}},{highlightColor:"secondary",highlight:!0,class:{root:"ring-secondary"}},{highlightColor:"success",highlight:!0,class:{root:"ring-success"}},{highlightColor:"info",highlight:!0,class:{root:"ring-info"}},{highlightColor:"warning",highlight:!0,class:{root:"ring-warning"}},{highlightColor:"error",highlight:!0,class:{root:"ring-error"}},{highlightColor:"neutral",highlight:!0,class:{root:"ring-inverted"}},{spotlightColor:"primary",spotlight:!0,class:{root:"[--spotlight-color:var(--ui-primary)]"}},{spotlightColor:"secondary",spotlight:!0,class:{root:"[--spotlight-color:var(--ui-secondary)]"}},{spotlightColor:"success",spotlight:!0,class:{root:"[--spotlight-color:var(--ui-success)]"}},{spotlightColor:"info",spotlight:!0,class:{root:"[--spotlight-color:var(--ui-info)]"}},{spotlightColor:"warning",spotlight:!0,class:{root:"[--spotlight-color:var(--ui-warning)]"}},{spotlightColor:"error",spotlight:!0,class:{root:"[--spotlight-color:var(--ui-error)]"}},{spotlightColor:"neutral",spotlight:!0,class:{root:"[--spotlight-color:var(--ui-bg-inverted)]"}}],defaultVariants:{variant:"outline",highlightColor:"primary",spotlightColor:"primary"}},D=Object.assign({inheritAttrs:!1},{__name:"UPageCard",props:{as:{type:null,required:!1},icon:{type:null,required:!1},title:{type:String,required:!1},description:{type:String,required:!1},orientation:{type:null,required:!1,default:"vertical"},reverse:{type:Boolean,required:!1},highlight:{type:Boolean,required:!1},highlightColor:{type:null,required:!1},spotlight:{type:Boolean,required:!1},spotlightColor:{type:null,required:!1},variant:{type:null,required:!1},to:{type:null,required:!1},target:{type:[String,Object,null],required:!1},onClick:{type:Function,required:!1},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(t){const o=t,e=z(),v=O(),u=B(),$=I(),l=V("pageCard",o),{elementX:f,elementY:y}=F(v,{eventFilter:u.eventFilter}),m=p(()=>o.spotlight&&(f.value!==0||y.value!==0));P(()=>o.spotlight,a=>{a?u.resume():u.pause()},{immediate:!0});const i=p(()=>w({extend:w(R),...$.ui?.pageCard||{}})({orientation:o.orientation,reverse:o.reverse,variant:o.variant,to:!!o.to||!!o.onClick,title:!!o.title||!!e.title,highlight:o.highlight,highlightColor:o.highlightColor,spotlight:m.value,spotlightColor:o.spotlightColor})),S=p(()=>(e.title&&A(e.title())||o.title||"Card link").trim());return(a,b)=>(s(),h(r(E),{ref_key:"cardRef",ref:v,as:t.as,"data-orientation":t.orientation,"data-slot":"root",class:n(i.value.root({class:[r(l)?.root,o.class]})),style:j(m.value&&{"--spotlight-x":`${r(f)}px`,"--spotlight-y":`${r(y)}px`}),onClick:t.onClick},{default:C(()=>[o.spotlight?(s(),c("div",{key:0,"data-slot":"spotlight",class:n(i.value.spotlight({class:r(l)?.spotlight}))},null,2)):g("",!0),x("div",{"data-slot":"container",class:n(i.value.container({class:r(l)?.container}))},[e.header||t.icon||e.leading||e.body||t.title||e.title||t.description||e.description||e.footer?(s(),c("div",{key:0,"data-slot":"wrapper",class:n(i.value.wrapper({class:r(l)?.wrapper}))},[e.header?(s(),c("div",{key:0,"data-slot":"header",class:n(i.value.header({class:r(l)?.header}))},[d(a.$slots,"header")],2)):g("",!0),t.icon||e.leading?(s(),c("div",{key:1,"data-slot":"leading",class:n(i.value.leading({class:r(l)?.leading}))},[d(a.$slots,"leading",{ui:i.value},()=>[t.icon?(s(),h(U,{key:0,name:t.icon,"data-slot":"leadingIcon",class:n(i.value.leadingIcon({class:r(l)?.leadingIcon}))},null,8,["name","class"])):g("",!0)])],2)):g("",!0),e.body||t.title||e.title||t.description||e.description?(s(),c("div",{key:2,"data-slot":"body",class:n(i.value.body({class:r(l)?.body}))},[d(a.$slots,"body",{},()=>[t.title||e.title?(s(),c("div",{key:0,"data-slot":"title",class:n(i.value.title({class:r(l)?.title}))},[d(a.$slots,"title",{},()=>[k(q(t.title),1)])],2)):g("",!0),t.description||e.description?(s(),c("div",{key:1,"data-slot":"description",class:n(i.value.description({class:r(l)?.description}))},[d(a.$slots,"description",{},()=>[k(q(t.description),1)])],2)):g("",!0)])],2)):g("",!0),e.footer?(s(),c("div",{key:3,"data-slot":"footer",class:n(i.value.footer({class:r(l)?.footer}))},[d(a.$slots,"footer")],2)):g("",!0)],2)):g("",!0),d(a.$slots,"default")],2),t.to?(s(),h(T,N({key:1,"aria-label":S.value},{to:t.to,target:t.target,...a.$attrs},{class:"focus:outline-none peer",raw:""}),{default:C(()=>[...b[0]||(b[0]=[x("span",{class:"absolute inset-0","aria-hidden":"true"},null,-1)])]),_:1},16,["aria-label"])):g("",!0)]),_:3},8,["as","data-orientation","class","style","onClick"]))}});export{D as _};