@gspa/ui 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Toast.css CHANGED
@@ -1 +1 @@
1
- @keyframes toast-progress-8acde4d1{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.animate-toast-progress[data-v-8acde4d1]{animation:toast-progress-8acde4d1 linear forwards}
1
+ .kv-toast-region[data-v-dc27cb89]{position:fixed;z-index:10000;width:min(408px,100vw);max-height:100dvh;padding:16px;box-sizing:border-box;pointer-events:none}.kv-toast-region--top-left[data-v-dc27cb89]{top:0;left:0}.kv-toast-region--top-center[data-v-dc27cb89]{top:0;left:50%;transform:translate(-50%)}.kv-toast-region--top-right[data-v-dc27cb89]{top:0;right:0}.kv-toast-region--bottom-left[data-v-dc27cb89]{bottom:0;left:0}.kv-toast-region--bottom-center[data-v-dc27cb89]{bottom:0;left:50%;transform:translate(-50%)}.kv-toast-region--bottom-right[data-v-dc27cb89]{right:0;bottom:0}.kv-toast-stack[data-v-dc27cb89]{display:flex;width:100%;flex-direction:column;gap:10px}.kv-toast-stack--bottom[data-v-dc27cb89]{flex-direction:column-reverse}.kv-toast[data-v-dc27cb89]{--toast-accent: var(--ui-primary, #173866);--toast-soft: var(--ui-primary-soft, #e6edf7);position:relative;display:grid;grid-template-columns:34px minmax(0,1fr) 28px;align-items:start;gap:10px;width:100%;min-height:58px;padding:12px 10px 13px 12px;overflow:hidden;box-sizing:border-box;color:var(--ui-text, #172033);background:var(--ui-surface, #ffffff);border:1px solid var(--ui-border, #dce3ed);border-radius:14px;box-shadow:0 12px 30px #0f172a24,0 2px 8px #0f172a12;pointer-events:auto;transition:transform .18s ease,box-shadow .18s ease}.kv-toast[data-v-dc27cb89]:before{position:absolute;top:12px;bottom:12px;left:0;width:3px;background:var(--toast-accent);border-radius:0 3px 3px 0;content:""}.kv-toast[data-v-dc27cb89]:hover{transform:translateY(-1px);box-shadow:0 16px 38px #0f172a2b,0 3px 10px #0f172a14}.kv-toast--info[data-v-dc27cb89]{--toast-accent: var(--ui-cyber, #176b87);--toast-soft: var(--ui-cyber-soft, #e0f2f7)}.kv-toast--success[data-v-dc27cb89]{--toast-accent: var(--ui-success, #14745d);--toast-soft: var(--ui-success-soft, #def3eb)}.kv-toast--warning[data-v-dc27cb89]{--toast-accent: var(--ui-warning, #a96008);--toast-soft: var(--ui-warning-soft, #fff0d6)}.kv-toast--error[data-v-dc27cb89]{--toast-accent: var(--ui-danger, #b4233c);--toast-soft: var(--ui-danger-soft, #fde7eb)}.kv-toast--subtle[data-v-dc27cb89]:before{opacity:.65}.kv-toast__icon[data-v-dc27cb89]{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;color:var(--toast-accent);background:var(--toast-soft);border-radius:10px}.kv-toast__icon[data-v-dc27cb89] svg{display:block;width:19px;height:19px}.kv-toast--loading .kv-toast__icon[data-v-dc27cb89] svg{animation:kv-toast-spin-dc27cb89 .9s linear infinite}.kv-toast__content[data-v-dc27cb89]{min-width:0;padding:1px 0}.kv-toast__heading[data-v-dc27cb89]{display:flex;align-items:center;gap:7px;min-width:0}.kv-toast__title[data-v-dc27cb89],.kv-toast__message[data-v-dc27cb89]{padding:0;margin:0;font-family:inherit}.kv-toast__title[data-v-dc27cb89]{min-width:0;overflow-wrap:anywhere;color:var(--ui-text, #172033);font-size:.875rem;font-weight:650;line-height:1.35;letter-spacing:-.006em}.kv-toast__status[data-v-dc27cb89]{display:inline-flex;flex:none;align-items:center;min-height:18px;padding:1px 5px;color:var(--toast-accent);font-size:.625rem;font-weight:750;line-height:1;letter-spacing:.03em;background:var(--toast-soft);border-radius:5px}.kv-toast__message[data-v-dc27cb89]{margin-top:3px;overflow-wrap:anywhere;color:var(--ui-text-muted, #5b687a);font-size:.8125rem;font-weight:400;line-height:1.45}.kv-toast__custom-content[data-v-dc27cb89]{margin-top:9px}.kv-toast__action[data-v-dc27cb89]{display:inline-flex;align-items:center;gap:5px;min-height:26px;padding:3px 7px;margin:9px 0 0 -7px;color:var(--toast-accent);font:inherit;font-size:.775rem;font-weight:650;line-height:1;background:transparent;border:0;border-radius:7px;cursor:pointer}.kv-toast__action[data-v-dc27cb89]:hover{background:var(--toast-soft)}.kv-toast__action[data-v-dc27cb89] svg{width:13px;height:13px;transition:transform .15s ease}.kv-toast__action[data-v-dc27cb89]:hover svg{transform:translate(2px)}.kv-toast__close[data-v-dc27cb89]{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;color:var(--ui-text-soft, #78869a);background:transparent;border:0;border-radius:8px;cursor:pointer;transition:color .15s ease,background .15s ease}.kv-toast__close[data-v-dc27cb89]:hover{color:var(--ui-text, #172033);background:var(--ui-surface-muted, #f0f3f8)}.kv-toast__close[data-v-dc27cb89]:focus-visible,.kv-toast__action[data-v-dc27cb89]:focus-visible{outline:2px solid var(--ui-ring, var(--ui-primary, #173866));outline-offset:2px}.kv-toast__close[data-v-dc27cb89] svg{width:16px;height:16px}.kv-toast-enter-active[data-v-dc27cb89],.kv-toast-leave-active[data-v-dc27cb89],.kv-toast-move[data-v-dc27cb89]{transition:opacity .22s ease,transform .26s cubic-bezier(.16,1,.3,1)}.kv-toast-enter-from[data-v-dc27cb89],.kv-toast-leave-to[data-v-dc27cb89]{opacity:0;transform:translateY(-8px) scale(.98)}@keyframes kv-toast-spin-dc27cb89{to{transform:rotate(360deg)}}@media (max-width: 480px){.kv-toast-region[data-v-dc27cb89]{width:100vw;padding:10px}.kv-toast[data-v-dc27cb89]{border-radius:12px}}@media (prefers-reduced-motion: reduce){.kv-toast[data-v-dc27cb89],.kv-toast-enter-active[data-v-dc27cb89],.kv-toast-leave-active[data-v-dc27cb89],.kv-toast-move[data-v-dc27cb89],.kv-toast__action[data-v-dc27cb89] svg{transition-duration:.01ms}.kv-toast--loading .kv-toast__icon[data-v-dc27cb89] svg{animation-duration:1.8s}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),S=require("class-variance-authority"),o=require("../utils/cn.cjs"),q=require("../lib/toast.cjs"),s=require("./Icon.cjs"),I=require("../_plugin-vue_export-helper-BHFhmbuH.cjs"),P=["aria-live"],j={class:"flex-1 min-w-0 pt-0.5"},A=["onClick"],$=["onClick"],K={key:2,class:"absolute bottom-0 left-0 right-0 h-0.5 overflow-hidden"},L={__name:"Toast",props:{position:{type:String,default:"top-right",validator:i=>["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"].includes(i)},hotkey:{type:Array,default:()=>["altKey","KeyT"]},richColors:{type:Boolean,default:!0},expand:{type:Boolean,default:!1},visibleToasts:{type:Number,default:3},closeButton:{type:Boolean,default:!0}},setup(i){const n=i,{toasts:p,dismiss:v}=q.useToaster(),x=e.computed(()=>p.value.slice(0,n.visibleToasts)),w={"top-left":"top-0 left-0 flex-col items-start","top-center":"top-0 left-1/2 -translate-x-1/2 flex-col items-center","top-right":"top-0 right-0 flex-col items-end","bottom-left":"bottom-0 left-0 flex-col-reverse items-start","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 flex-col-reverse items-center","bottom-right":"bottom-0 right-0 flex-col-reverse items-end"},b=e.computed(()=>o.cn(w[n.position])),k=S.cva("group pointer-events-auto relative flex w-full items-start gap-3 overflow-hidden rounded-xl border p-4 transition-all duration-200 hover:-translate-y-0.5",{variants:{variant:{default:"ui-surface ui-border-strong ui-text shadow-lg shadow-black/5 dark:shadow-black/30",info:"border-blue-700 bg-blue-700 ui-text-inverse shadow-lg shadow-blue-900/25",success:"border-green-700 bg-green-700 ui-text-inverse shadow-lg shadow-green-900/25",warning:"border-amber-600 bg-amber-600 ui-text-inverse shadow-lg shadow-amber-900/25",error:"border-red-700 bg-red-700 ui-text-inverse shadow-lg shadow-red-900/25",loading:"ui-surface ui-border-strong ui-text shadow-lg shadow-black/5 dark:shadow-black/30"}},defaultVariants:{variant:"default"}}),y=r=>o.cn(k({variant:r.variant})),l={default:"bell",info:"info",success:"check-circle",warning:"triangle-exclamation",error:"circle-xmark",loading:"loader-circle"},c={default:"ui-primary",info:"text-white",success:"text-white",warning:"text-white",error:"text-white",loading:"ui-primary"},u={default:"ui-surface-muted border ui-border",info:"bg-white/15 ring-1 ring-white/25",success:"bg-white/15 ring-1 ring-white/25",warning:"bg-white/15 ring-1 ring-white/25",error:"bg-white/15 ring-1 ring-white/25",loading:"ui-surface-muted border ui-border"},d={default:"bg-(--ui-primary)",info:"bg-white/70",success:"bg-white/70",warning:"bg-white/70",error:"bg-white/70",loading:"bg-(--ui-primary)"},h={default:"ui-primary hover:text-(--ui-primary-strong) underline-offset-4 hover:underline",info:"text-white/90 hover:text-white underline-offset-4 hover:underline",success:"text-white/90 hover:text-white underline-offset-4 hover:underline",warning:"text-white/90 hover:text-white underline-offset-4 hover:underline",error:"text-white/90 hover:text-white underline-offset-4 hover:underline",loading:"ui-primary hover:text-(--ui-primary-strong) underline-offset-4 hover:underline"},m={default:"ui-text",info:"text-white",success:"text-white",warning:"text-white",error:"text-white",loading:"ui-text"},f={default:"ui-text-muted",info:"text-white/90",success:"text-white/90",warning:"text-white/90",error:"text-white/90",loading:"ui-text-muted"},g={default:"ui-text-soft hover:bg-black/5 dark:hover:bg-white/10 hover:text-(--ui-text)",info:"text-white/80 hover:text-white hover:bg-white/15",success:"text-white/80 hover:text-white hover:bg-white/15",warning:"text-white/80 hover:text-white hover:bg-white/15",error:"text-white/80 hover:text-white hover:bg-white/15",loading:"ui-text hover:bg-black/5 dark:hover:bg-white/5 hover:text-(--ui-text)"},C=r=>r.icon||l[r.variant]||l.default,B=r=>{const a=c[r.variant]||c.default;return r.variant==="loading"?`${a} animate-spin`:a},_=r=>u[r.variant]||u.default,V=r=>d[r.variant]||d.default,N=r=>h[r.variant]||h.default,T=r=>m[r.variant]||m.default,z=r=>f[r.variant]||f.default,E=r=>g[r.variant]||g.default,M=r=>r.icon!==!1,D=r=>r.dismissible!==!1&&(r.closeButton||n.closeButton||r.dismissible);return(r,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(o.cn)(b.value,"fixed z-[10000] flex max-h-screen w-full p-4 md:max-w-[420px] pointer-events-none"))},[e.createVNode(e.TransitionGroup,{"enter-active-class":"transition-all duration-400 ease-[cubic-bezier(0.16,1,0.3,1)]","enter-from-class":"transform translate-x-full opacity-0 scale-90","enter-to-class":"transform translate-x-0 opacity-100 scale-100","leave-active-class":"transition-all duration-300 ease-[cubic-bezier(0.4,0,1,1)]","leave-from-class":"transform translate-x-0 opacity-100 scale-100","leave-to-class":"transform translate-x-full opacity-0 scale-90","move-class":"transition-all duration-300 ease-out",tag:"div",class:"w-full space-y-3"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,t=>(e.openBlock(),e.createElementBlock("div",{key:t.id,class:e.normalizeClass(y(t)),role:"alert","aria-live":t.variant==="error"?"assertive":"polite"},[M(t)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(o.cn)("relative flex h-10 w-10 shrink-0 items-center justify-center rounded-lg transition-all duration-300",_(t)))},[e.createVNode(s.default,{icon:C(t),class:e.normalizeClass(e.unref(o.cn)("h-5 w-5 transition-transform duration-300 group-hover:scale-110",B(t)))},null,8,["icon","class"])],2)):e.createCommentVNode("",!0),e.createElementVNode("div",j,[t.title?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(o.cn)("text-md font-semibold leading-tight mb-1",T(t)))},e.toDisplayString(t.title),3)):e.createCommentVNode("",!0),t.message||t.description?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(o.cn)("text-md leading-relaxed",z(t)))},e.toDisplayString(t.message||t.description),3)):e.createCommentVNode("",!0),t.component?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component),e.mergeProps({key:2,ref_for:!0},t.componentProps,{class:"mt-3"}),null,16)):e.createCommentVNode("",!0),t.action?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["mt-3 inline-flex items-center gap-1.5 text-sm font-medium transition-colors",N(t)]),onClick:t.action.onClick},[e.createTextVNode(e.toDisplayString(t.action.label)+" ",1),e.createVNode(s.default,{icon:"arrow-right",class:"h-3 w-3 transition-transform duration-200 group-hover:translate-x-0.5"})],10,A)):e.createCommentVNode("",!0)]),D(t)?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(e.unref(o.cn)("absolute right-2 top-2 flex h-7 w-7 shrink-0 items-center justify-center rounded-md opacity-70 transition-all hover:opacity-100 focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-(--ui-ring)",E(t))),"aria-label":"Dismiss",onClick:G=>e.unref(v)(t.id)},[e.createVNode(s.default,{icon:"x",class:"h-4 w-4"})],10,$)):e.createCommentVNode("",!0),t.duration&&t.duration>0?(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("div",{class:e.normalizeClass(e.unref(o.cn)("h-full origin-left animate-toast-progress",V(t))),style:e.normalizeStyle({animationDuration:`${t.duration}ms`})},null,6)])):e.createCommentVNode("",!0)],10,P))),128))]),_:1})],2)]))}},F=I._export_sfc(L,[["__scopeId","data-v-8acde4d1"]]);exports.default=F;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),E=require("../lib/toast.cjs"),M=require("./Icon.cjs"),w=require("../_plugin-vue_export-helper-BHFhmbuH.cjs"),D=["data-expanded","data-hotkey"],S=["aria-live"],L={key:0,class:"kv-toast__icon"},$={class:"kv-toast__content"},q={key:0,class:"kv-toast__heading"},P={key:0,class:"kv-toast__title"},j=["aria-label"],z={key:1,class:"kv-toast__message"},A=["onClick"],H=["onClick"],K={__name:"Toast",props:{position:{type:String,default:"top-right",validator:s=>["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"].includes(s)},hotkey:{type:Array,default:()=>["altKey","KeyT"]},richColors:{type:Boolean,default:!0},expand:{type:Boolean,default:!1},visibleToasts:{type:Number,default:3},closeButton:{type:Boolean,default:!0}},setup(s){const c=s,{toasts:d,dismiss:u}=E.useToaster(),p=e.computed(()=>d.value.slice(0,c.visibleToasts)),n=(t,i)=>({name:`Toast${t}Icon`,render(){return e.h("svg",{"data-toast-icon":t.toLowerCase(),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":1.9,"stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},i.map(([o,l])=>e.h(o,l)))}}),k=n("default",[["path",{d:"M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9"}],["path",{d:"M10 21h4"}]]),_=n("info",[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"M12 11v5"}],["path",{d:"M12 8h.01"}]]),h=n("success",[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"m8.5 12 2.3 2.3 4.9-5"}]]),v=n("warning",[["path",{d:"M10.3 4.1 2.7 17.2A1.8 1.8 0 0 0 4.3 20h15.4a1.8 1.8 0 0 0 1.6-2.8L13.7 4.1a2 2 0 0 0-3.4 0Z"}],["path",{d:"M12 9v4"}],["path",{d:"M12 16.5h.01"}]]),m=n("error",[["circle",{cx:"12",cy:"12",r:"9"}],["path",{d:"m9 9 6 6"}],["path",{d:"m15 9-6 6"}]]),y=n("loading",[["path",{d:"M21 12a9 9 0 1 1-2.64-6.36"}]]),f=n("close",[["path",{d:"m7.5 7.5 9 9"}],["path",{d:"m16.5 7.5-9 9"}]]),B=n("arrow",[["path",{d:"M5 12h14"}],["path",{d:"m14 7 5 5-5 5"}]]),a={default:k,info:_,success:h,warning:v,error:m,loading:y},r=t=>a[t.variant]?t.variant:"default",g=t=>a[r(t)],C=t=>typeof t.icon=="string",b=t=>t.icon&&typeof t.icon!="string"&&t.icon!==!0?t.icon:g(t),N=t=>t.icon!==!1,V=t=>t.dismissible!==!1&&(t.closeButton||c.closeButton||t.dismissible),T=e.computed(()=>`kv-toast-region--${c.position}`),x=e.computed(()=>c.position.startsWith("bottom-")?"kv-toast-stack--bottom":"");return(t,i)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createElementVNode("section",{class:e.normalizeClass(["kv-toast-region",T.value]),"aria-label":"Notifications","data-expanded":c.expand,"data-hotkey":c.hotkey.join("+")},[e.createVNode(e.TransitionGroup,{name:"kv-toast",tag:"div",class:e.normalizeClass(["kv-toast-stack",x.value])},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,o=>(e.openBlock(),e.createElementBlock("article",{key:o.id,class:e.normalizeClass(["kv-toast",[`kv-toast--${r(o)}`,{"kv-toast--subtle":!c.richColors}]]),role:"alert","aria-live":o.variant==="error"?"assertive":"polite","aria-atomic":"true"},[N(o)?(e.openBlock(),e.createElementBlock("span",L,[C(o)?(e.openBlock(),e.createBlock(M.default,{key:0,icon:o.icon,"aria-hidden":"true"},null,8,["icon"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b(o)),{key:1}))])):e.createCommentVNode("",!0),e.createElementVNode("div",$,[o.title||o.statusCode?(e.openBlock(),e.createElementBlock("div",q,[o.title?(e.openBlock(),e.createElementBlock("p",P,e.toDisplayString(o.title),1)):e.createCommentVNode("",!0),o.statusCode?(e.openBlock(),e.createElementBlock("span",{key:1,class:"kv-toast__status","aria-label":`HTTP status ${o.statusCode}`},e.toDisplayString(o.statusCode),9,j)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),o.message||o.description?(e.openBlock(),e.createElementBlock("p",z,e.toDisplayString(o.message||o.description),1)):e.createCommentVNode("",!0),o.component?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.component),e.mergeProps({key:2,ref_for:!0},o.componentProps,{class:"kv-toast__custom-content"}),null,16)):e.createCommentVNode("",!0),o.action?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",class:"kv-toast__action",onClick:o.action.onClick},[e.createTextVNode(e.toDisplayString(o.action.label)+" ",1),e.createVNode(e.unref(B))],8,A)):e.createCommentVNode("",!0)]),V(o)?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"kv-toast__close","aria-label":"Dismiss notification",onClick:l=>e.unref(u)(o.id)},[e.createVNode(e.unref(f))],8,H)):e.createCommentVNode("",!0)],10,S))),128))]),_:1},8,["class"])],10,D)]))}},W=w._export_sfc(K,[["__scopeId","data-v-dc27cb89"]]);exports.default=W;
@@ -1,26 +1,33 @@
1
- import { computed as _, createBlock as C, openBlock as r, Teleport as G, createElementVNode as h, normalizeClass as i, unref as n, createVNode as l, TransitionGroup as q, withCtx as H, createElementBlock as s, Fragment as J, renderList as O, createCommentVNode as a, toDisplayString as f, resolveDynamicComponent as Q, mergeProps as R, createTextVNode as U, normalizeStyle as W } from "vue";
2
- import { cva as X } from "class-variance-authority";
3
- import { cn as o } from "../utils/cn.js";
4
- import { useToaster as Y } from "../lib/toast.js";
5
- import g from "./Icon.js";
6
- import { _ as Z } from "../_plugin-vue_export-helper-CHgC5LLL.js";
7
- const ee = ["aria-live"], te = { class: "flex-1 min-w-0 pt-0.5" }, re = ["onClick"], ie = ["onClick"], oe = {
8
- key: 2,
9
- class: "absolute bottom-0 left-0 right-0 h-0.5 overflow-hidden"
10
- }, ne = {
1
+ import { computed as d, createBlock as i, openBlock as e, Teleport as W, createElementVNode as y, normalizeClass as u, createVNode as p, TransitionGroup as z, withCtx as F, createElementBlock as s, Fragment as G, renderList as H, createCommentVNode as a, resolveDynamicComponent as b, toDisplayString as r, mergeProps as Z, createTextVNode as q, unref as _, h as g } from "vue";
2
+ import { useToaster as J } from "../lib/toast.js";
3
+ import O from "./Icon.js";
4
+ import { _ as Q } from "../_plugin-vue_export-helper-CHgC5LLL.js";
5
+ const R = ["data-expanded", "data-hotkey"], U = ["aria-live"], X = {
6
+ key: 0,
7
+ class: "kv-toast__icon"
8
+ }, Y = { class: "kv-toast__content" }, I = {
9
+ key: 0,
10
+ class: "kv-toast__heading"
11
+ }, oo = {
12
+ key: 0,
13
+ class: "kv-toast__title"
14
+ }, to = ["aria-label"], eo = {
15
+ key: 1,
16
+ class: "kv-toast__message"
17
+ }, so = ["onClick"], no = ["onClick"], ao = {
11
18
  __name: "Toast",
12
19
  props: {
13
20
  position: {
14
21
  type: String,
15
22
  default: "top-right",
16
- validator: (c) => [
23
+ validator: (l) => [
17
24
  "top-left",
18
25
  "top-center",
19
26
  "top-right",
20
27
  "bottom-left",
21
28
  "bottom-center",
22
29
  "bottom-right"
23
- ].includes(c)
30
+ ].includes(l)
24
31
  },
25
32
  hotkey: {
26
33
  type: Array,
@@ -43,189 +50,126 @@ const ee = ["aria-live"], te = { class: "flex-1 min-w-0 pt-0.5" }, re = ["onClic
43
50
  default: !0
44
51
  }
45
52
  },
46
- setup(c) {
47
- const u = c, { toasts: B, dismiss: T } = Y(), M = _(
48
- () => B.value.slice(0, u.visibleToasts)
49
- ), N = {
50
- "top-left": "top-0 left-0 flex-col items-start",
51
- "top-center": "top-0 left-1/2 -translate-x-1/2 flex-col items-center",
52
- "top-right": "top-0 right-0 flex-col items-end",
53
- "bottom-left": "bottom-0 left-0 flex-col-reverse items-start",
54
- "bottom-center": "bottom-0 left-1/2 -translate-x-1/2 flex-col-reverse items-center",
55
- "bottom-right": "bottom-0 right-0 flex-col-reverse items-end"
56
- }, V = _(
57
- () => o(N[u.position])
58
- ), z = X(
59
- "group pointer-events-auto relative flex w-full items-start gap-3 overflow-hidden rounded-xl border p-4 transition-all duration-200 hover:-translate-y-0.5",
60
- {
61
- variants: {
62
- variant: {
63
- default: "ui-surface ui-border-strong ui-text shadow-lg shadow-black/5 dark:shadow-black/30",
64
- info: "border-blue-700 bg-blue-700 ui-text-inverse shadow-lg shadow-blue-900/25",
65
- success: "border-green-700 bg-green-700 ui-text-inverse shadow-lg shadow-green-900/25",
66
- warning: "border-amber-600 bg-amber-600 ui-text-inverse shadow-lg shadow-amber-900/25",
67
- error: "border-red-700 bg-red-700 ui-text-inverse shadow-lg shadow-red-900/25",
68
- loading: "ui-surface ui-border-strong ui-text shadow-lg shadow-black/5 dark:shadow-black/30"
69
- }
70
- },
71
- defaultVariants: { variant: "default" }
53
+ setup(l) {
54
+ const c = l, { toasts: C, dismiss: m } = J(), x = d(() => C.value.slice(0, c.visibleToasts)), n = (t, v) => ({
55
+ name: `Toast${t}Icon`,
56
+ render() {
57
+ return g("svg", {
58
+ "data-toast-icon": t.toLowerCase(),
59
+ viewBox: "0 0 24 24",
60
+ fill: "none",
61
+ stroke: "currentColor",
62
+ "stroke-width": 1.9,
63
+ "stroke-linecap": "round",
64
+ "stroke-linejoin": "round",
65
+ "aria-hidden": "true"
66
+ }, v.map(([o, f]) => g(o, f)));
72
67
  }
73
- ), D = (t) => o(z({ variant: t.variant })), m = {
74
- default: "bell",
75
- info: "info",
76
- success: "check-circle",
77
- warning: "triangle-exclamation",
78
- error: "circle-xmark",
79
- loading: "loader-circle"
80
- }, p = {
81
- default: "ui-primary",
82
- info: "text-white",
83
- success: "text-white",
84
- warning: "text-white",
85
- error: "text-white",
86
- loading: "ui-primary"
87
- }, v = {
88
- default: "ui-surface-muted border ui-border",
89
- info: "bg-white/15 ring-1 ring-white/25",
90
- success: "bg-white/15 ring-1 ring-white/25",
91
- warning: "bg-white/15 ring-1 ring-white/25",
92
- error: "bg-white/15 ring-1 ring-white/25",
93
- loading: "ui-surface-muted border ui-border"
94
- }, x = {
95
- default: "bg-(--ui-primary)",
96
- info: "bg-white/70",
97
- success: "bg-white/70",
98
- warning: "bg-white/70",
99
- error: "bg-white/70",
100
- loading: "bg-(--ui-primary)"
101
- }, w = {
102
- default: "ui-primary hover:text-(--ui-primary-strong) underline-offset-4 hover:underline",
103
- info: "text-white/90 hover:text-white underline-offset-4 hover:underline",
104
- success: "text-white/90 hover:text-white underline-offset-4 hover:underline",
105
- warning: "text-white/90 hover:text-white underline-offset-4 hover:underline",
106
- error: "text-white/90 hover:text-white underline-offset-4 hover:underline",
107
- loading: "ui-primary hover:text-(--ui-primary-strong) underline-offset-4 hover:underline"
108
- }, b = {
109
- default: "ui-text",
110
- info: "text-white",
111
- success: "text-white",
112
- warning: "text-white",
113
- error: "text-white",
114
- loading: "ui-text"
115
- }, y = {
116
- default: "ui-text-muted",
117
- info: "text-white/90",
118
- success: "text-white/90",
119
- warning: "text-white/90",
120
- error: "text-white/90",
121
- loading: "ui-text-muted"
122
- }, k = {
123
- default: "ui-text-soft hover:bg-black/5 dark:hover:bg-white/10 hover:text-(--ui-text)",
124
- info: "text-white/80 hover:text-white hover:bg-white/15",
125
- success: "text-white/80 hover:text-white hover:bg-white/15",
126
- warning: "text-white/80 hover:text-white hover:bg-white/15",
127
- error: "text-white/80 hover:text-white hover:bg-white/15",
128
- loading: "ui-text hover:bg-black/5 dark:hover:bg-white/5 hover:text-(--ui-text)"
129
- }, I = (t) => t.icon || m[t.variant] || m.default, $ = (t) => {
130
- const d = p[t.variant] || p.default;
131
- return t.variant === "loading" ? `${d} animate-spin` : d;
132
- }, P = (t) => v[t.variant] || v.default, S = (t) => x[t.variant] || x.default, j = (t) => w[t.variant] || w.default, A = (t) => b[t.variant] || b.default, E = (t) => y[t.variant] || y.default, K = (t) => k[t.variant] || k.default, L = (t) => t.icon !== !1, F = (t) => t.dismissible !== !1 && (t.closeButton || u.closeButton || t.dismissible);
133
- return (t, d) => (r(), C(G, { to: "body" }, [
134
- h("div", {
135
- class: i(n(o)(
136
- V.value,
137
- "fixed z-[10000] flex max-h-screen w-full p-4 md:max-w-[420px] pointer-events-none"
138
- ))
68
+ }), T = n("default", [
69
+ ["path", { d: "M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9" }],
70
+ ["path", { d: "M10 21h4" }]
71
+ ]), B = n("info", [
72
+ ["circle", { cx: "12", cy: "12", r: "9" }],
73
+ ["path", { d: "M12 11v5" }],
74
+ ["path", { d: "M12 8h.01" }]
75
+ ]), w = n("success", [
76
+ ["circle", { cx: "12", cy: "12", r: "9" }],
77
+ ["path", { d: "m8.5 12 2.3 2.3 4.9-5" }]
78
+ ]), M = n("warning", [
79
+ ["path", { d: "M10.3 4.1 2.7 17.2A1.8 1.8 0 0 0 4.3 20h15.4a1.8 1.8 0 0 0 1.6-2.8L13.7 4.1a2 2 0 0 0-3.4 0Z" }],
80
+ ["path", { d: "M12 9v4" }],
81
+ ["path", { d: "M12 16.5h.01" }]
82
+ ]), N = n("error", [
83
+ ["circle", { cx: "12", cy: "12", r: "9" }],
84
+ ["path", { d: "m9 9 6 6" }],
85
+ ["path", { d: "m15 9-6 6" }]
86
+ ]), $ = n("loading", [
87
+ ["path", { d: "M21 12a9 9 0 1 1-2.64-6.36" }]
88
+ ]), D = n("close", [
89
+ ["path", { d: "m7.5 7.5 9 9" }],
90
+ ["path", { d: "m16.5 7.5-9 9" }]
91
+ ]), L = n("arrow", [
92
+ ["path", { d: "M5 12h14" }],
93
+ ["path", { d: "m14 7 5 5-5 5" }]
94
+ ]), h = {
95
+ default: T,
96
+ info: B,
97
+ success: w,
98
+ warning: M,
99
+ error: N,
100
+ loading: $
101
+ }, k = (t) => h[t.variant] ? t.variant : "default", S = (t) => h[k(t)], V = (t) => typeof t.icon == "string", A = (t) => t.icon && typeof t.icon != "string" && t.icon !== !0 ? t.icon : S(t), E = (t) => t.icon !== !1, P = (t) => t.dismissible !== !1 && (t.closeButton || c.closeButton || t.dismissible), j = d(() => `kv-toast-region--${c.position}`), K = d(() => c.position.startsWith("bottom-") ? "kv-toast-stack--bottom" : "");
102
+ return (t, v) => (e(), i(W, { to: "body" }, [
103
+ y("section", {
104
+ class: u(["kv-toast-region", j.value]),
105
+ "aria-label": "Notifications",
106
+ "data-expanded": c.expand,
107
+ "data-hotkey": c.hotkey.join("+")
139
108
  }, [
140
- l(q, {
141
- "enter-active-class": "transition-all duration-400 ease-[cubic-bezier(0.16,1,0.3,1)]",
142
- "enter-from-class": "transform translate-x-full opacity-0 scale-90",
143
- "enter-to-class": "transform translate-x-0 opacity-100 scale-100",
144
- "leave-active-class": "transition-all duration-300 ease-[cubic-bezier(0.4,0,1,1)]",
145
- "leave-from-class": "transform translate-x-0 opacity-100 scale-100",
146
- "leave-to-class": "transform translate-x-full opacity-0 scale-90",
147
- "move-class": "transition-all duration-300 ease-out",
109
+ p(z, {
110
+ name: "kv-toast",
148
111
  tag: "div",
149
- class: "w-full space-y-3"
112
+ class: u(["kv-toast-stack", K.value])
150
113
  }, {
151
- default: H(() => [
152
- (r(!0), s(J, null, O(M.value, (e) => (r(), s("div", {
153
- key: e.id,
154
- class: i(D(e)),
114
+ default: F(() => [
115
+ (e(!0), s(G, null, H(x.value, (o) => (e(), s("article", {
116
+ key: o.id,
117
+ class: u(["kv-toast", [
118
+ `kv-toast--${k(o)}`,
119
+ { "kv-toast--subtle": !c.richColors }
120
+ ]]),
155
121
  role: "alert",
156
- "aria-live": e.variant === "error" ? "assertive" : "polite"
122
+ "aria-live": o.variant === "error" ? "assertive" : "polite",
123
+ "aria-atomic": "true"
157
124
  }, [
158
- L(e) ? (r(), s("div", {
159
- key: 0,
160
- class: i(n(o)(
161
- "relative flex h-10 w-10 shrink-0 items-center justify-center rounded-lg transition-all duration-300",
162
- P(e)
163
- ))
164
- }, [
165
- l(g, {
166
- icon: I(e),
167
- class: i(n(o)(
168
- "h-5 w-5 transition-transform duration-300 group-hover:scale-110",
169
- $(e)
170
- ))
171
- }, null, 8, ["icon", "class"])
172
- ], 2)) : a("", !0),
173
- h("div", te, [
174
- e.title ? (r(), s("div", {
125
+ E(o) ? (e(), s("span", X, [
126
+ V(o) ? (e(), i(O, {
175
127
  key: 0,
176
- class: i(n(o)("text-md font-semibold leading-tight mb-1", A(e)))
177
- }, f(e.title), 3)) : a("", !0),
178
- e.message || e.description ? (r(), s("div", {
179
- key: 1,
180
- class: i(n(o)("text-md leading-relaxed", E(e)))
181
- }, f(e.message || e.description), 3)) : a("", !0),
182
- e.component ? (r(), C(Q(e.component), R({
128
+ icon: o.icon,
129
+ "aria-hidden": "true"
130
+ }, null, 8, ["icon"])) : (e(), i(b(A(o)), { key: 1 }))
131
+ ])) : a("", !0),
132
+ y("div", Y, [
133
+ o.title || o.statusCode ? (e(), s("div", I, [
134
+ o.title ? (e(), s("p", oo, r(o.title), 1)) : a("", !0),
135
+ o.statusCode ? (e(), s("span", {
136
+ key: 1,
137
+ class: "kv-toast__status",
138
+ "aria-label": `HTTP status ${o.statusCode}`
139
+ }, r(o.statusCode), 9, to)) : a("", !0)
140
+ ])) : a("", !0),
141
+ o.message || o.description ? (e(), s("p", eo, r(o.message || o.description), 1)) : a("", !0),
142
+ o.component ? (e(), i(b(o.component), Z({
183
143
  key: 2,
184
144
  ref_for: !0
185
- }, e.componentProps, { class: "mt-3" }), null, 16)) : a("", !0),
186
- e.action ? (r(), s("button", {
145
+ }, o.componentProps, { class: "kv-toast__custom-content" }), null, 16)) : a("", !0),
146
+ o.action ? (e(), s("button", {
187
147
  key: 3,
188
- class: i(["mt-3 inline-flex items-center gap-1.5 text-sm font-medium transition-colors", j(e)]),
189
- onClick: e.action.onClick
148
+ type: "button",
149
+ class: "kv-toast__action",
150
+ onClick: o.action.onClick
190
151
  }, [
191
- U(f(e.action.label) + " ", 1),
192
- l(g, {
193
- icon: "arrow-right",
194
- class: "h-3 w-3 transition-transform duration-200 group-hover:translate-x-0.5"
195
- })
196
- ], 10, re)) : a("", !0)
152
+ q(r(o.action.label) + " ", 1),
153
+ p(_(L))
154
+ ], 8, so)) : a("", !0)
197
155
  ]),
198
- F(e) ? (r(), s("button", {
156
+ P(o) ? (e(), s("button", {
199
157
  key: 1,
200
- class: i(n(o)(
201
- "absolute right-2 top-2 flex h-7 w-7 shrink-0 items-center justify-center rounded-md opacity-70 transition-all hover:opacity-100 focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-(--ui-ring)",
202
- K(e)
203
- )),
204
- "aria-label": "Dismiss",
205
- onClick: (se) => n(T)(e.id)
158
+ type: "button",
159
+ class: "kv-toast__close",
160
+ "aria-label": "Dismiss notification",
161
+ onClick: (f) => _(m)(o.id)
206
162
  }, [
207
- l(g, {
208
- icon: "x",
209
- class: "h-4 w-4"
210
- })
211
- ], 10, ie)) : a("", !0),
212
- e.duration && e.duration > 0 ? (r(), s("div", oe, [
213
- h("div", {
214
- class: i(n(o)(
215
- "h-full origin-left animate-toast-progress",
216
- S(e)
217
- )),
218
- style: W({ animationDuration: `${e.duration}ms` })
219
- }, null, 6)
220
- ])) : a("", !0)
221
- ], 10, ee))), 128))
163
+ p(_(D))
164
+ ], 8, no)) : a("", !0)
165
+ ], 10, U))), 128))
222
166
  ]),
223
167
  _: 1
224
- })
225
- ], 2)
168
+ }, 8, ["class"])
169
+ ], 10, R)
226
170
  ]));
227
171
  }
228
- }, fe = /* @__PURE__ */ Z(ne, [["__scopeId", "data-v-8acde4d1"]]);
172
+ }, uo = /* @__PURE__ */ Q(ao, [["__scopeId", "data-v-dc27cb89"]]);
229
173
  export {
230
- fe as default
174
+ uo as default
231
175
  };