UNPKG

@gingersnap/toolbox

Version:

A comprehensive Vue 3 component library with Tailwind CSS integration, built with JavaScript

3 lines (2 loc) 29 kB
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("reka-ui"),require("lucide-vue-next")):typeof define=="function"&&define.amd?define(["exports","vue","reka-ui","lucide-vue-next"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.Toolbox={},o.Vue,o.RekaUI,o.LucideVueNext))})(this,function(o,e,g,t){"use strict";const S={class:"px-6 py-4 flex-1 min-h-0 overflow-y-auto"},x={key:1,class:"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 px-6 py-4 border-t border-gray-100 flex-shrink-0 gap-2"},k={__name:"TbModal",props:{show:{type:Boolean,default:!1},allowClose:{type:Boolean,default:!0},closeOnOverlayClick:{type:Boolean,default:!0},size:{type:String,default:"md",validator:r=>["sm","md","lg","xl","full"].includes(r)},variant:{type:String,default:"default",validator:r=>["default","destructive"].includes(r)},title:{type:String,default:""},description:{type:String,default:""},animation:{type:String,default:"scale",validator:r=>["scale","slide","fade"].includes(r)},persistent:{type:Boolean,default:!1}},emits:["update:show","close","open"],setup(r,{emit:m}){const s=r,c=m,p=a=>{c("update:show",a),c(a?"open":"close")},h=e.computed(()=>({sm:"max-w-md",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full mx-4"})[s.size]),b=e.computed(()=>({default:"bg-white border-gray-200",destructive:"bg-white border-danger-muted"})[s.variant]),y=e.computed(()=>({scale:["data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]"].join(" "),slide:["data-[state=closed]:slide-out-to-bottom-full data-[state=open]:slide-in-from-bottom-full"].join(" "),fade:["data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"].join(" ")})[s.animation]),i=e.computed(()=>!s.allowClose||s.persistent||!s.closeOnOverlayClick&&s.allowClose),f=e.computed(()=>s.variant==="destructive"?"border-danger-light bg-danger-light/30":"border-gray-100"),d=e.computed(()=>s.variant==="destructive"?"text-danger":"text-gray-900");return(a,l)=>(e.openBlock(),e.createBlock(e.unref(g.DialogRoot),{open:r.show,"onUpdate:open":p},{default:e.withCtx(()=>[e.createVNode(e.unref(g.DialogPortal),null,{default:e.withCtx(()=>[e.createVNode(e.unref(g.DialogOverlay),{class:"fixed inset-0 z-[9999] bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-200"}),e.createVNode(e.unref(g.DialogContent),{class:e.normalizeClass([h.value,b.value,y.value,"tb-modal-content w-full max-h-[90vh] rounded-base shadow-xl flex flex-col","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","duration-200 border"]),"trap-focus":!0,"disable-outside-pointer-events":i.value,onPointerDownOutside:l[1]||(l[1]=n=>i.value&&n.preventDefault()),onEscapeKeyDown:l[2]||(l[2]=n=>(!r.allowClose||r.persistent)&&n.preventDefault()),role:"dialog","aria-labelledby":r.title?"modal-title":void 0,"aria-describedby":r.description?"modal-description":void 0},{default:e.withCtx(()=>[r.title||r.description||a.$slots.header||a.$slots.title||a.$slots.description?(e.openBlock(),e.createElementBlock("header",{key:0,class:e.normalizeClass(["flex flex-col space-y-1.5 text-center sm:text-left px-6 py-4 border-b flex-shrink-0 relative",f.value])},[r.title||a.$slots.title||a.$slots.header?(e.openBlock(),e.createBlock(e.unref(g.DialogTitle),{key:0,class:e.normalizeClass(["text-lg font-semibold leading-none tracking-tight",d.value]),id:"modal-title"},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"title",{},()=>[e.renderSlot(a.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(r.title),1)])])]),_:3},8,["class"])):e.createCommentVNode("",!0),r.description||a.$slots.description?(e.openBlock(),e.createBlock(e.unref(g.DialogDescription),{key:1,class:"text-sm text-gray-600",id:"modal-description"},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"description",{},()=>[e.createTextVNode(e.toDisplayString(r.description),1)])]),_:3})):e.createCommentVNode("",!0),r.allowClose&&!r.persistent?(e.openBlock(),e.createElementBlock("button",{key:2,onClick:l[0]||(l[0]=n=>p(!1)),class:"absolute right-4 top-4 w-8 h-8 flex items-center justify-center text-gray-400 hover:text-gray-600 rounded-base hover:bg-gray-50 transition-colors opacity-70 hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-muted","aria-label":"Close dialog",type:"button"},[e.createVNode(e.unref(t.X),{size:16})])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",S,[e.renderSlot(a.$slots,"default"),e.renderSlot(a.$slots,"body")]),a.$slots.footer||a.$slots.actions?(e.openBlock(),e.createElementBlock("footer",x,[e.renderSlot(a.$slots,"actions",{},()=>[e.renderSlot(a.$slots,"footer")])])):e.createCommentVNode("",!0)]),_:3},8,["class","disable-outside-pointer-events","aria-labelledby","aria-describedby"])]),_:3})]),_:3},8,["open"]))}},T={class:"flex items-center gap-1 ml-2 flex-shrink-0"},z={key:1,class:"w-4 h-4 border-2 border-gray-300 border-t-primary rounded-full animate-spin","aria-label":"Loading"},j={class:"truncate pr-6"},P={key:0,class:"absolute right-3 flex items-center text-primary"},D={__name:"TbSelect",props:{modelValue:{type:[String,Number],default:null},placeholder:{type:String,default:"Select an option..."},options:{type:Array,required:!0},disabled:{type:Boolean,default:!1},error:{type:Boolean,default:!1},size:{type:String,default:"md",validator:r=>["sm","md","lg"].includes(r)},variant:{type:String,default:"default",validator:r=>["default","ghost","outline"].includes(r)},loading:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1}},emits:["update:modelValue","change","clear"],setup(r,{emit:m}){const s=r,c=m,p=a=>{if(a===null)return;const l=s.options.find(n=>n.value===a)||null;c("update:modelValue",a),c("change",a,l)},h=a=>{a.stopPropagation(),c("update:modelValue",null),c("change",null,null),c("clear")},b=e.computed(()=>s.options.find(a=>a.value===s.modelValue)),y=e.computed(()=>{var a;return((a=b.value)==null?void 0:a.label)||s.placeholder}),i=e.computed(()=>({sm:"px-2 py-1 text-xs",md:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"})[s.size]),f=e.computed(()=>({default:"bg-white border-gray-300 hover:border-gray-400",ghost:"bg-transparent border-transparent hover:bg-gray-50",outline:"bg-transparent border-gray-300 hover:border-primary"})[s.variant]),d=e.computed(()=>["w-full border rounded-base focus:ring-2 transition-colors","flex items-center justify-between","data-[placeholder]:text-gray-500 text-left","focus-visible:outline-none focus-visible:ring-2",i.value,f.value,s.error?"border-danger focus:border-danger focus:ring-danger-muted focus-visible:ring-danger-muted":"focus:border-primary focus:ring-primary-muted focus-visible:ring-primary-muted",s.disabled?"opacity-50 cursor-not-allowed bg-gray-50":"",s.loading?"cursor-wait":""].filter(Boolean).join(" "));return(a,l)=>(e.openBlock(),e.createBlock(e.unref(g.SelectRoot),{"model-value":r.modelValue,"onUpdate:modelValue":p,disabled:r.disabled||r.loading},{default:e.withCtx(()=>[e.createVNode(e.unref(g.SelectTrigger),{class:e.normalizeClass(d.value)},{default:e.withCtx(()=>[e.createVNode(e.unref(g.SelectValue),{placeholder:r.placeholder,class:"text-left truncate flex-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.value),1)]),_:1},8,["placeholder"]),e.createElementVNode("div",T,[r.clearable&&r.modelValue&&!r.disabled&&!r.loading?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",onClick:h,class:"flex items-center justify-center w-4 h-4 text-gray-400 hover:text-gray-600 rounded-sm hover:bg-gray-100 transition-colors","aria-label":"Clear selection"},l[0]||(l[0]=[e.createElementVNode("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"currentColor"},[e.createElementVNode("path",{d:"M9 3L3 9M3 3l6 6",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)]))):e.createCommentVNode("",!0),r.loading?(e.openBlock(),e.createElementBlock("div",z)):(e.openBlock(),e.createBlock(e.unref(g.SelectIcon),{key:2},{default:e.withCtx(()=>[e.createVNode(e.unref(t.ChevronDown),{size:16,class:"text-gray-400 transition-transform duration-200 data-[state=open]:rotate-180"})]),_:1}))])]),_:1},8,["class"]),e.createVNode(e.unref(g.SelectContent),{position:"popper",side:"bottom",align:"start","side-offset":4,class:"bg-white border border-gray-200 rounded-base shadow-base z-50 overflow-hidden min-w-[var(--reka-select-trigger-width)]",style:{width:"var(--reka-select-trigger-width)",maxHeight:"var(--reka-select-content-available-height)"}},{default:e.withCtx(()=>[e.createVNode(e.unref(g.SelectScrollUpButton),{class:"flex items-center justify-center h-6 bg-white text-gray-400 hover:text-gray-600 cursor-default"},{default:e.withCtx(()=>[e.createVNode(e.unref(t.ChevronUp),{size:12})]),_:1}),e.createVNode(e.unref(g.SelectViewport),{class:"max-h-60"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,n=>(e.openBlock(),e.createBlock(e.unref(g.SelectItem),{key:n.value,value:n.value,disabled:n.disabled,class:"relative flex items-center px-3 py-2 text-sm cursor-pointer outline-none select-none data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed data-[highlighted]:bg-primary-light data-[highlighted]:text-primary data-[state=checked]:bg-primary-light data-[state=checked]:text-primary data-[state=checked]:font-medium hover:bg-gray-50 transition-colors"},{default:e.withCtx(()=>[e.createElementVNode("span",j,e.toDisplayString(n.label),1),n.value===r.modelValue?(e.openBlock(),e.createElementBlock("span",P,[e.createVNode(e.unref(t.Check),{size:14})])):e.createCommentVNode("",!0)]),_:2},1032,["value","disabled"]))),128))]),_:1}),e.createVNode(e.unref(g.SelectScrollDownButton),{class:"flex items-center justify-center h-6 bg-white text-gray-400 hover:text-gray-600 cursor-default"},{default:e.withCtx(()=>[e.createVNode(e.unref(t.ChevronDown),{size:12})]),_:1})]),_:1})]),_:1},8,["model-value","disabled"]))}},B=(r,m)=>{const s=r.__vccOpts||r;for(const[c,p]of m)s[c]=p;return s},O={class:"flex items-center space-x-2"},E={key:0},$={key:0,class:"flex items-center","aria-hidden":"true"},A={key:1,class:"text-gray-400 mx-2"},L={class:"flex items-center"},F={class:"flex items-center gap-1"},H=["onClick","aria-current"],M={class:"flex items-center gap-1"},I=["aria-current"],R={class:"flex items-center gap-1"},U=B({__name:"TbBreadcrumb",props:{items:{type:Array,required:!0},separator:{type:String,default:"chevron",validator:r=>["chevron","slash","dash"].includes(r)},size:{type:String,default:"md",validator:r=>["sm","md","lg"].includes(r)},showHome:{type:Boolean,default:!0},homeHref:{type:String,default:"/"},homeTo:{type:[String,Object],default:null},background:{type:Boolean,default:!0}},emits:["click","home-click"],setup(r,{emit:m}){const s=r,c=m,p=(a,l)=>{a.onClick&&a.onClick(),c("click",a,l)},h=()=>{c("home-click")},b=e.computed(()=>({sm:"text-xs px-3 py-1.5",md:"text-sm px-4 py-2",lg:"text-base px-4 py-3"})[s.size]),y=e.computed(()=>s.separator==="chevron"?t.ChevronRight:null),i=e.computed(()=>({slash:"/",dash:"—"})[s.separator]),f=e.computed(()=>["breadcrumb-nav",s.background?"bg-gray-50 border-b border-gray-200":"",b.value].filter(Boolean).join(" ")),d=e.computed(()=>({sm:14,md:16,lg:18})[s.size]);return(a,l)=>(e.openBlock(),e.createElementBlock("nav",{class:e.normalizeClass(f.value),"aria-label":"Breadcrumb"},[e.createElementVNode("ol",O,[r.showHome?(e.openBlock(),e.createElementBlock("li",E,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.homeTo?"router-link":"a"),{to:r.homeTo,href:r.homeTo?void 0:r.homeHref,class:"text-gray-500 hover:text-gray-700 transition-colors focus:outline-none focus:ring-2 focus:ring-primary-muted rounded-sm",onClick:h,"aria-label":"Home"},{default:e.withCtx(()=>[e.createVNode(e.unref(t.Home),{size:d.value},null,8,["size"])]),_:1},8,["to","href"]))])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.items,(n,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w},[r.showHome||w>0?(e.openBlock(),e.createElementBlock("li",$,[y.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y.value),{key:0,size:d.value,class:"text-gray-400 mx-1"},null,8,["size"])):(e.openBlock(),e.createElementBlock("span",A,e.toDisplayString(i.value),1))])):e.createCommentVNode("",!0),e.createElementVNode("li",L,[n.href||n.to?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.to?"router-link":"a"),{key:0,to:n.to,href:n.to?void 0:n.href,class:e.normalizeClass(["transition-colors focus:outline-none focus:ring-2 focus:ring-primary-muted rounded-sm",n.active?"text-gray-900 font-medium cursor-default":"text-gray-600 hover:text-gray-800 font-medium"]),onClick:ce=>!n.active&&p(n,w),"aria-current":n.active?"page":void 0},{default:e.withCtx(()=>[e.createElementVNode("div",F,[n.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{key:0,size:d.value,class:"flex-shrink-0"},null,8,["size"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)])]),_:2},1032,["to","href","class","onClick","aria-current"])):n.onClick?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["transition-colors focus:outline-none focus:ring-2 focus:ring-primary-muted rounded-sm",n.active?"text-gray-900 font-medium cursor-default":"text-gray-600 hover:text-gray-800 font-medium"]),onClick:ce=>!n.active&&p(n,w),"aria-current":n.active?"page":void 0},[e.createElementVNode("div",M,[n.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{key:0,size:d.value,class:"flex-shrink-0"},null,8,["size"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)])],10,H)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass([n.active?"text-gray-900 font-medium":"text-gray-600 font-medium"]),"aria-current":n.active?"page":void 0},[e.createElementVNode("div",R,[n.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{key:0,size:d.value,class:"flex-shrink-0"},null,8,["size"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)])],10,I))])],64))),128))])],2))}},[["__scopeId","data-v-ea141ab9"]]),C=e.ref([]);let q=1;const X={success:4e3,danger:6e3,primary:4e3,secondary:4e3},u=()=>{const r=i=>{const f=`toast-${q++}`,d=i.duration??X[i.type]??4e3,a={id:f,type:i.type,title:i.title,message:i.message,duration:d,createdAt:Date.now(),persistent:i.persistent??!1};return C.value.push(a),d>0&&!a.persistent&&setTimeout(()=>{m(f)},d),f},m=i=>{const f=C.value.findIndex(d=>d.id===i);f>-1&&C.value.splice(f,1)},s=()=>{C.value=[]},c=(i,f={})=>r({type:"success",message:i,...f}),p=(i,f={})=>r({type:"danger",message:i,...f}),h=(i,f={})=>r({type:"primary",message:i,...f}),b=(i,f={})=>r({type:"secondary",message:i,...f}),y=i=>r({type:"primary",...i});return e.reactive({toasts:C.value,addToast:r,removeToast:m,clearAll:s,success:c,danger:p,primary:h,secondary:b,show:y})},_={success:(r,m={})=>u().success(r,m),danger:(r,m={})=>u().danger(r,m),primary:(r,m={})=>u().primary(r,m),secondary:(r,m={})=>u().secondary(r,m),show:r=>u().show(r),remove:r=>u().removeToast(r),clear:()=>u().clearAll()},K={class:"flex items-start space-x-3"},G={class:"flex-1 min-w-0"},J=B({__name:"TbToast",props:{position:{type:String,default:"bottom-right",validator:r=>["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"].includes(r)},maxToasts:{type:Number,default:5},closeButton:{type:Boolean,default:!0},pauseOnHover:{type:Boolean,default:!0}},setup(r){const m=r,{toasts:s,removeToast:c}=u(),p=d=>({success:t.CheckCircle,danger:t.AlertCircle,primary:t.Info,secondary:t.Info})[d]||t.Info,h=d=>{const a="group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-base border p-4 pr-8 shadow-base transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--reka-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--reka-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",l={success:"border-success-muted bg-success-light text-success",danger:"border-danger-muted bg-danger-light text-danger",primary:"border-primary-muted bg-primary-light text-primary",secondary:"border-secondary-muted bg-secondary-light text-secondary"};return`${a} ${l[d]||l.primary}`},b=d=>{const a={success:"text-success",danger:"text-danger",primary:"text-primary",secondary:"text-secondary"};return a[d]||a.primary},y=e.computed(()=>({"top-right":"fixed top-0 right-0 flex max-h-screen w-full flex-col p-4 md:max-w-[420px]","top-left":"fixed top-0 left-0 flex max-h-screen w-full flex-col p-4 md:max-w-[420px]","bottom-right":"fixed bottom-0 right-0 flex max-h-screen w-full flex-col-reverse p-4 md:max-w-[420px]","bottom-left":"fixed bottom-0 left-0 flex max-h-screen w-full flex-col-reverse p-4 md:max-w-[420px]","top-center":"fixed top-0 left-1/2 -translate-x-1/2 flex max-h-screen w-full flex-col p-4 md:max-w-[420px]","bottom-center":"fixed bottom-0 left-1/2 -translate-x-1/2 flex max-h-screen w-full flex-col-reverse p-4 md:max-w-[420px]"})[m.position]),i=e.computed(()=>s.slice(0,m.maxToasts)),f=e.computed(()=>m.position.includes("left")?"left":"right");return(d,a)=>(e.openBlock(),e.createBlock(e.unref(g.ToastProvider),{duration:0,"swipe-direction":f.value},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,l=>(e.openBlock(),e.createBlock(e.unref(g.ToastRoot),{key:l.id,open:!0,type:l.type==="danger"?"foreground":"background",class:e.normalizeClass([h(l.type),r.pauseOnHover?"hover:pause":""]),"onUpdate:open":n=>!n&&e.unref(c)(l.id)},{default:e.withCtx(()=>[e.createElementVNode("div",K,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p(l.type)),{size:20,class:e.normalizeClass([b(l.type),"flex-shrink-0 mt-0.5"])},null,8,["class"])),e.createElementVNode("div",G,[l.title?(e.openBlock(),e.createBlock(e.unref(g.ToastTitle),{key:0,class:"text-sm font-medium mb-1 text-gray-900"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.title),1)]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(e.unref(g.ToastDescription),{class:"text-sm opacity-90 text-gray-700"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.message),1)]),_:2},1024)])]),r.closeButton?(e.openBlock(),e.createBlock(e.unref(g.ToastClose),{key:0,class:"absolute right-2 top-2 rounded-base p-1 text-current hover:bg-current hover:bg-opacity-10 opacity-70 hover:opacity-100 focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-current focus-visible:ring-2 focus-visible:ring-current group-hover:opacity-100 transition-all",onClick:n=>e.unref(c)(l.id),"aria-label":"Close notification"},{default:e.withCtx(()=>[e.createVNode(e.unref(t.X),{size:14})]),_:2},1032,["onClick"])):e.createCommentVNode("",!0)]),_:2},1032,["type","class","onUpdate:open"]))),128)),e.createVNode(e.unref(g.ToastViewport),{class:e.normalizeClass(["z-[10000]",y.value])},null,8,["class"])]),_:1},8,["swipe-direction"]))}},[["__scopeId","data-v-baf5368d"]]),Q={class:"space-y-4"},W={class:"flex items-start space-x-3"},Y={class:"flex-1 min-w-0"},Z={class:"text-gray-900 text-sm leading-5"},v={key:0,class:"text-sm text-danger mt-2"},V={key:1,class:"text-sm text-yellow-700 mt-2"},N={key:2,class:"text-sm text-gray-600 mt-2"},ee={class:"flex justify-end gap-3 w-full"},te=["disabled"],re=["disabled"],oe={key:0,class:"flex items-center"},ae={key:1},ne={__name:"TbConfirmModal",props:{show:{type:Boolean,required:!0},title:{type:String,default:"Confirm Action"},message:{type:String,default:"Are you sure you want to proceed?"},confirmText:{type:String,default:"Confirm"},cancelText:{type:String,default:"Cancel"},variant:{type:String,default:"danger",validator:r=>["danger","warning","info"].includes(r)},loading:{type:Boolean,default:!1},icon:{type:Object,default:null},size:{type:String,default:"sm",validator:r=>["sm","md","lg"].includes(r)}},emits:["update:show","confirm","cancel"],setup(r,{emit:m}){const s=r,c=m,p=l=>{c("update:show",l),l||c("cancel")},h=()=>{c("confirm")},b=()=>{c("update:show",!1),c("cancel")},y=e.computed(()=>s.variant==="danger"?"destructive":"default"),i=e.computed(()=>s.icon?s.icon:{danger:t.AlertTriangle,warning:t.AlertTriangle,info:t.AlertTriangle}[s.variant]),f=e.computed(()=>({danger:"text-danger",warning:"text-yellow-600",info:"text-primary"})[s.variant]),d=e.computed(()=>["px-4 py-2 text-sm font-medium text-white rounded-base transition-colors","focus:outline-none focus:ring-2 focus:ring-offset-2","disabled:opacity-50 disabled:cursor-not-allowed",{danger:"bg-danger hover:bg-danger-hover focus:bg-danger-focus",warning:"bg-yellow-600 hover:bg-yellow-700 focus:bg-yellow-500",info:"bg-primary hover:bg-primary-hover focus:bg-primary-focus"}[s.variant],s.variant==="danger"?"focus:ring-danger-muted":s.variant==="warning"?"focus:ring-yellow-300":"focus:ring-primary-muted"].join(" ")),a=e.computed(()=>({danger:"This action cannot be undone.",warning:"Please proceed with caution.",info:"This will make changes to your data."})[s.variant]);return(l,n)=>(e.openBlock(),e.createBlock(k,{show:r.show,"onUpdate:show":p,size:r.size,variant:y.value,title:r.title,persistent:r.loading,"allow-close":!r.loading},{actions:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createElementVNode("button",{type:"button",onClick:b,disabled:r.loading,class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-base hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-muted transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},e.toDisplayString(r.cancelText),9,te),e.createElementVNode("button",{type:"button",onClick:h,disabled:r.loading,class:e.normalizeClass(d.value)},[r.loading?(e.openBlock(),e.createElementBlock("span",oe,n[0]||(n[0]=[e.createElementVNode("svg",{class:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1),e.createTextVNode(" Processing... ")]))):(e.openBlock(),e.createElementBlock("span",ae,e.toDisplayString(r.confirmText),1))],10,re)])]),default:e.withCtx(()=>[e.createElementVNode("div",Q,[e.createElementVNode("div",W,[e.createElementVNode("div",{class:e.normalizeClass(["flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center",r.variant==="danger"?"bg-danger-light":r.variant==="warning"?"bg-yellow-100":"bg-primary-light"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.value),{size:20,class:e.normalizeClass(f.value)},null,8,["class"]))],2),e.createElementVNode("div",Y,[e.createElementVNode("p",Z,e.toDisplayString(r.message),1),r.variant==="danger"?(e.openBlock(),e.createElementBlock("p",v,e.toDisplayString(a.value),1)):r.variant==="warning"?(e.openBlock(),e.createElementBlock("p",V,e.toDisplayString(a.value),1)):(e.openBlock(),e.createElementBlock("p",N,e.toDisplayString(a.value),1))])])])]),_:1},8,["show","size","variant","title","persistent","allow-close"]))}},se={ChevronDown:t.ChevronDown,ChevronUp:t.ChevronUp,ChevronLeft:t.ChevronLeft,ChevronRight:t.ChevronRight,ChevronsDown:t.ChevronsDown,ChevronsUp:t.ChevronsUp,ArrowLeft:t.ArrowLeft,ArrowRight:t.ArrowRight,ArrowUp:t.ArrowUp,ArrowDown:t.ArrowDown,X:t.X,Plus:t.Plus,Minus:t.Minus,Edit:t.Edit,Trash2:t.Trash2,SquarePlus:t.SquarePlus,Copy:t.Copy,Save:t.Save,RefreshCw:t.RefreshCw,Check:t.Check,CheckCircle:t.CheckCircle,XCircle:t.XCircle,AlertCircle:t.AlertCircle,Info:t.Info,Lock:t.Lock,Unlock:t.Unlock,Search:t.Search,Filter:t.Filter,Download:t.Download,Upload:t.Upload,Menu:t.Menu,MoreVertical:t.MoreVertical,MoreHorizontal:t.MoreHorizontal,Settings:t.Settings,Focus:t.Focus,Locate:t.Locate,Home:t.Home,FileText:t.FileText,Folder:t.Folder,Calendar:t.Calendar,Clock:t.Clock,User:t.User,Heart:t.Heart,Star:t.Star,Bell:t.Bell},le={theme:{extend:{fontFamily:{inter:["Inter","ui-sans-serif","system-ui","sans-serif"],sans:["Inter","ui-sans-serif","system-ui","sans-serif"]},colors:{primary:{DEFAULT:"var(--color-primary)",hover:"var(--color-primary-hover)",focus:"var(--color-primary-focus)",light:"var(--color-primary-light)",muted:"var(--color-primary-muted)"},secondary:{DEFAULT:"var(--color-secondary)",hover:"var(--color-secondary-hover)",focus:"var(--color-secondary-focus)",light:"var(--color-secondary-light)",muted:"var(--color-secondary-muted)"},success:{DEFAULT:"var(--color-success)",hover:"var(--color-success-hover)",focus:"var(--color-success-focus)",light:"var(--color-success-light)",muted:"var(--color-success-muted)"},danger:{DEFAULT:"var(--color-danger)",hover:"var(--color-danger-hover)",focus:"var(--color-danger-focus)",light:"var(--color-danger-light)",muted:"var(--color-danger-muted)"}},borderRadius:{base:"var(--radius-base)"},boxShadow:{base:"var(--shadow-base)"}}},plugins:[]},ie="0.1.0";Object.defineProperty(o,"AlertCircle",{enumerable:!0,get:()=>t.AlertCircle}),Object.defineProperty(o,"ArrowDown",{enumerable:!0,get:()=>t.ArrowDown}),Object.defineProperty(o,"ArrowLeft",{enumerable:!0,get:()=>t.ArrowLeft}),Object.defineProperty(o,"ArrowRight",{enumerable:!0,get:()=>t.ArrowRight}),Object.defineProperty(o,"ArrowUp",{enumerable:!0,get:()=>t.ArrowUp}),Object.defineProperty(o,"Bell",{enumerable:!0,get:()=>t.Bell}),Object.defineProperty(o,"Calendar",{enumerable:!0,get:()=>t.Calendar}),Object.defineProperty(o,"Check",{enumerable:!0,get:()=>t.Check}),Object.defineProperty(o,"CheckCircle",{enumerable:!0,get:()=>t.CheckCircle}),Object.defineProperty(o,"ChevronDown",{enumerable:!0,get:()=>t.ChevronDown}),Object.defineProperty(o,"ChevronLeft",{enumerable:!0,get:()=>t.ChevronLeft}),Object.defineProperty(o,"ChevronRight",{enumerable:!0,get:()=>t.ChevronRight}),Object.defineProperty(o,"ChevronUp",{enumerable:!0,get:()=>t.ChevronUp}),Object.defineProperty(o,"ChevronsDown",{enumerable:!0,get:()=>t.ChevronsDown}),Object.defineProperty(o,"ChevronsUp",{enumerable:!0,get:()=>t.ChevronsUp}),Object.defineProperty(o,"Clock",{enumerable:!0,get:()=>t.Clock}),Object.defineProperty(o,"Copy",{enumerable:!0,get:()=>t.Copy}),Object.defineProperty(o,"Download",{enumerable:!0,get:()=>t.Download}),Object.defineProperty(o,"Edit",{enumerable:!0,get:()=>t.Edit}),Object.defineProperty(o,"FileText",{enumerable:!0,get:()=>t.FileText}),Object.defineProperty(o,"Filter",{enumerable:!0,get:()=>t.Filter}),Object.defineProperty(o,"Focus",{enumerable:!0,get:()=>t.Focus}),Object.defineProperty(o,"Folder",{enumerable:!0,get:()=>t.Folder}),Object.defineProperty(o,"Heart",{enumerable:!0,get:()=>t.Heart}),Object.defineProperty(o,"Home",{enumerable:!0,get:()=>t.Home}),Object.defineProperty(o,"Info",{enumerable:!0,get:()=>t.Info}),Object.defineProperty(o,"Locate",{enumerable:!0,get:()=>t.Locate}),Object.defineProperty(o,"Lock",{enumerable:!0,get:()=>t.Lock}),Object.defineProperty(o,"Menu",{enumerable:!0,get:()=>t.Menu}),Object.defineProperty(o,"Minus",{enumerable:!0,get:()=>t.Minus}),Object.defineProperty(o,"MoreHorizontal",{enumerable:!0,get:()=>t.MoreHorizontal}),Object.defineProperty(o,"MoreVertical",{enumerable:!0,get:()=>t.MoreVertical}),Object.defineProperty(o,"Plus",{enumerable:!0,get:()=>t.Plus}),Object.defineProperty(o,"RefreshCw",{enumerable:!0,get:()=>t.RefreshCw}),Object.defineProperty(o,"Save",{enumerable:!0,get:()=>t.Save}),Object.defineProperty(o,"Search",{enumerable:!0,get:()=>t.Search}),Object.defineProperty(o,"Settings",{enumerable:!0,get:()=>t.Settings}),Object.defineProperty(o,"SquarePlus",{enumerable:!0,get:()=>t.SquarePlus}),Object.defineProperty(o,"Star",{enumerable:!0,get:()=>t.Star}),Object.defineProperty(o,"Trash2",{enumerable:!0,get:()=>t.Trash2}),Object.defineProperty(o,"Unlock",{enumerable:!0,get:()=>t.Unlock}),Object.defineProperty(o,"Upload",{enumerable:!0,get:()=>t.Upload}),Object.defineProperty(o,"User",{enumerable:!0,get:()=>t.User}),Object.defineProperty(o,"X",{enumerable:!0,get:()=>t.X}),Object.defineProperty(o,"XCircle",{enumerable:!0,get:()=>t.XCircle}),o.TbBreadcrumb=U,o.TbConfirmModal=ne,o.TbModal=k,o.TbSelect=D,o.TbToast=J,o.icons=se,o.tailwindPreset=le,o.toast=_,o.useToast=u,o.version=ie,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=toolbox.umd.js.map