@gspa/ui 0.2.0 → 0.3.1

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.
@@ -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"),T=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__title"},z={key:1,class:"kv-toast__message"},j=["onClick"],A=["onClick"],P={key:2,class:"kv-toast__progress-track","aria-hidden":"true"},K={__name:"Toast",props:{position:{type:String,default:"top-right",validator:a=>["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"].includes(a)},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(a){const c=a,{toasts:d,dismiss:u}=T.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"}]]),s={default:k,info:_,success:h,warning:v,error:m,loading:y},r=t=>s[t.variant]?t.variant:"default",g=t=>s[r(t)],b=t=>typeof t.icon=="string",C=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),x=e.computed(()=>`kv-toast-region--${c.position}`),E=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",x.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",E.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,[b(o)?(e.openBlock(),e.createBlock(M.default,{key:0,icon:o.icon,"aria-hidden":"true"},null,8,["icon"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(C(o)),{key:1}))])):e.createCommentVNode("",!0),e.createElementVNode("div",$,[o.title?(e.openBlock(),e.createElementBlock("p",q,e.toDisplayString(o.title),1)):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,j)):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,A)):e.createCommentVNode("",!0),o.duration&&o.duration>0?(e.openBlock(),e.createElementBlock("span",P,[e.createElementVNode("span",{class:"kv-toast__progress",style:e.normalizeStyle({animationDuration:`${o.duration}ms`})},null,4)])):e.createCommentVNode("",!0)],10,S))),128))]),_:1},8,["class"])],10,D)]))}},W=w._export_sfc(K,[["__scopeId","data-v-3876a110"]]);exports.default=W;
@@ -1,26 +1,34 @@
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 = {
1
+ import { computed as l, createBlock as c, openBlock as e, Teleport as P, createElementVNode as d, normalizeClass as p, createVNode as u, TransitionGroup as W, withCtx as F, createElementBlock as s, Fragment as G, renderList as Z, createCommentVNode as i, resolveDynamicComponent as g, toDisplayString as _, mergeProps as q, createTextVNode as H, unref as h, normalizeStyle as J, h as b } from "vue";
2
+ import { useToaster as O } from "../lib/toast.js";
3
+ import Q from "./Icon.js";
4
+ import { _ as R } from "../_plugin-vue_export-helper-CHgC5LLL.js";
5
+ const U = ["data-expanded", "data-hotkey"], X = ["aria-live"], Y = {
6
+ key: 0,
7
+ class: "kv-toast__icon"
8
+ }, I = { class: "kv-toast__content" }, oo = {
9
+ key: 0,
10
+ class: "kv-toast__title"
11
+ }, to = {
12
+ key: 1,
13
+ class: "kv-toast__message"
14
+ }, eo = ["onClick"], no = ["onClick"], so = {
8
15
  key: 2,
9
- class: "absolute bottom-0 left-0 right-0 h-0.5 overflow-hidden"
10
- }, ne = {
16
+ class: "kv-toast__progress-track",
17
+ "aria-hidden": "true"
18
+ }, ao = {
11
19
  __name: "Toast",
12
20
  props: {
13
21
  position: {
14
22
  type: String,
15
23
  default: "top-right",
16
- validator: (c) => [
24
+ validator: (r) => [
17
25
  "top-left",
18
26
  "top-center",
19
27
  "top-right",
20
28
  "bottom-left",
21
29
  "bottom-center",
22
30
  "bottom-right"
23
- ].includes(c)
31
+ ].includes(r)
24
32
  },
25
33
  hotkey: {
26
34
  type: Array,
@@ -43,189 +51,125 @@ const ee = ["aria-live"], te = { class: "flex-1 min-w-0 pt-0.5" }, re = ["onClic
43
51
  default: !0
44
52
  }
45
53
  },
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" }
54
+ setup(r) {
55
+ const a = r, { toasts: m, dismiss: C } = O(), x = l(() => m.value.slice(0, a.visibleToasts)), n = (t, f) => ({
56
+ name: `Toast${t}Icon`,
57
+ render() {
58
+ return b("svg", {
59
+ "data-toast-icon": t.toLowerCase(),
60
+ viewBox: "0 0 24 24",
61
+ fill: "none",
62
+ stroke: "currentColor",
63
+ "stroke-width": 1.9,
64
+ "stroke-linecap": "round",
65
+ "stroke-linejoin": "round",
66
+ "aria-hidden": "true"
67
+ }, f.map(([o, y]) => b(o, y)));
72
68
  }
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
- ))
69
+ }), T = n("default", [
70
+ ["path", { d: "M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9" }],
71
+ ["path", { d: "M10 21h4" }]
72
+ ]), B = n("info", [
73
+ ["circle", { cx: "12", cy: "12", r: "9" }],
74
+ ["path", { d: "M12 11v5" }],
75
+ ["path", { d: "M12 8h.01" }]
76
+ ]), w = n("success", [
77
+ ["circle", { cx: "12", cy: "12", r: "9" }],
78
+ ["path", { d: "m8.5 12 2.3 2.3 4.9-5" }]
79
+ ]), M = n("warning", [
80
+ ["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" }],
81
+ ["path", { d: "M12 9v4" }],
82
+ ["path", { d: "M12 16.5h.01" }]
83
+ ]), N = n("error", [
84
+ ["circle", { cx: "12", cy: "12", r: "9" }],
85
+ ["path", { d: "m9 9 6 6" }],
86
+ ["path", { d: "m15 9-6 6" }]
87
+ ]), D = n("loading", [
88
+ ["path", { d: "M21 12a9 9 0 1 1-2.64-6.36" }]
89
+ ]), $ = n("close", [
90
+ ["path", { d: "m7.5 7.5 9 9" }],
91
+ ["path", { d: "m16.5 7.5-9 9" }]
92
+ ]), L = n("arrow", [
93
+ ["path", { d: "M5 12h14" }],
94
+ ["path", { d: "m14 7 5 5-5 5" }]
95
+ ]), k = {
96
+ default: T,
97
+ info: B,
98
+ success: w,
99
+ warning: M,
100
+ error: N,
101
+ loading: D
102
+ }, v = (t) => k[t.variant] ? t.variant : "default", S = (t) => k[v(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, j = (t) => t.dismissible !== !1 && (t.closeButton || a.closeButton || t.dismissible), z = l(() => `kv-toast-region--${a.position}`), K = l(() => a.position.startsWith("bottom-") ? "kv-toast-stack--bottom" : "");
103
+ return (t, f) => (e(), c(P, { to: "body" }, [
104
+ d("section", {
105
+ class: p(["kv-toast-region", z.value]),
106
+ "aria-label": "Notifications",
107
+ "data-expanded": a.expand,
108
+ "data-hotkey": a.hotkey.join("+")
139
109
  }, [
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",
110
+ u(W, {
111
+ name: "kv-toast",
148
112
  tag: "div",
149
- class: "w-full space-y-3"
113
+ class: p(["kv-toast-stack", K.value])
150
114
  }, {
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)),
115
+ default: F(() => [
116
+ (e(!0), s(G, null, Z(x.value, (o) => (e(), s("article", {
117
+ key: o.id,
118
+ class: p(["kv-toast", [
119
+ `kv-toast--${v(o)}`,
120
+ { "kv-toast--subtle": !a.richColors }
121
+ ]]),
155
122
  role: "alert",
156
- "aria-live": e.variant === "error" ? "assertive" : "polite"
123
+ "aria-live": o.variant === "error" ? "assertive" : "polite",
124
+ "aria-atomic": "true"
157
125
  }, [
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", {
126
+ E(o) ? (e(), s("span", Y, [
127
+ V(o) ? (e(), c(Q, {
175
128
  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({
129
+ icon: o.icon,
130
+ "aria-hidden": "true"
131
+ }, null, 8, ["icon"])) : (e(), c(g(A(o)), { key: 1 }))
132
+ ])) : i("", !0),
133
+ d("div", I, [
134
+ o.title ? (e(), s("p", oo, _(o.title), 1)) : i("", !0),
135
+ o.message || o.description ? (e(), s("p", to, _(o.message || o.description), 1)) : i("", !0),
136
+ o.component ? (e(), c(g(o.component), q({
183
137
  key: 2,
184
138
  ref_for: !0
185
- }, e.componentProps, { class: "mt-3" }), null, 16)) : a("", !0),
186
- e.action ? (r(), s("button", {
139
+ }, o.componentProps, { class: "kv-toast__custom-content" }), null, 16)) : i("", !0),
140
+ o.action ? (e(), s("button", {
187
141
  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
142
+ type: "button",
143
+ class: "kv-toast__action",
144
+ onClick: o.action.onClick
190
145
  }, [
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)
146
+ H(_(o.action.label) + " ", 1),
147
+ u(h(L))
148
+ ], 8, eo)) : i("", !0)
197
149
  ]),
198
- F(e) ? (r(), s("button", {
150
+ j(o) ? (e(), s("button", {
199
151
  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)
152
+ type: "button",
153
+ class: "kv-toast__close",
154
+ "aria-label": "Dismiss notification",
155
+ onClick: (y) => h(C)(o.id)
206
156
  }, [
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))
157
+ u(h($))
158
+ ], 8, no)) : i("", !0),
159
+ o.duration && o.duration > 0 ? (e(), s("span", so, [
160
+ d("span", {
161
+ class: "kv-toast__progress",
162
+ style: J({ animationDuration: `${o.duration}ms` })
163
+ }, null, 4)
164
+ ])) : i("", !0)
165
+ ], 10, X))), 128))
222
166
  ]),
223
167
  _: 1
224
- })
225
- ], 2)
168
+ }, 8, ["class"])
169
+ ], 10, U)
226
170
  ]));
227
171
  }
228
- }, fe = /* @__PURE__ */ Z(ne, [["__scopeId", "data-v-8acde4d1"]]);
172
+ }, po = /* @__PURE__ */ R(ao, [["__scopeId", "data-v-3876a110"]]);
229
173
  export {
230
- fe as default
174
+ po as default
231
175
  };