@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
|
-
|
|
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"),
|
|
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;
|
package/dist/components/Toast.js
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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: (
|
|
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(
|
|
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(
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
141
|
-
|
|
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: "
|
|
112
|
+
class: u(["kv-toast-stack", K.value])
|
|
150
113
|
}, {
|
|
151
|
-
default:
|
|
152
|
-
(
|
|
153
|
-
key:
|
|
154
|
-
class:
|
|
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":
|
|
122
|
+
"aria-live": o.variant === "error" ? "assertive" : "polite",
|
|
123
|
+
"aria-atomic": "true"
|
|
157
124
|
}, [
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
-
},
|
|
186
|
-
|
|
145
|
+
}, o.componentProps, { class: "kv-toast__custom-content" }), null, 16)) : a("", !0),
|
|
146
|
+
o.action ? (e(), s("button", {
|
|
187
147
|
key: 3,
|
|
188
|
-
|
|
189
|
-
|
|
148
|
+
type: "button",
|
|
149
|
+
class: "kv-toast__action",
|
|
150
|
+
onClick: o.action.onClick
|
|
190
151
|
}, [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
-
|
|
156
|
+
P(o) ? (e(), s("button", {
|
|
199
157
|
key: 1,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
],
|
|
168
|
+
}, 8, ["class"])
|
|
169
|
+
], 10, R)
|
|
226
170
|
]));
|
|
227
171
|
}
|
|
228
|
-
},
|
|
172
|
+
}, uo = /* @__PURE__ */ Q(ao, [["__scopeId", "data-v-dc27cb89"]]);
|
|
229
173
|
export {
|
|
230
|
-
|
|
174
|
+
uo as default
|
|
231
175
|
};
|