@feedmepos/mf-brand-app-builder 0.5.6 → 0.5.7-alpha
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/App-DsB-0siG.js +98 -0
- package/dist/AssetsSettings-Os6FBGQE.js +217 -0
- package/dist/BuilderView-_Q6690Tr.js +5506 -0
- package/dist/ButtonGroup-B3ba45VA.js +25 -0
- package/dist/CircularProgress-h90pbjU3.js +43 -0
- package/dist/ColorPicker-DAysa9fA.js +22 -0
- package/dist/Icon.vue_vue_type_style_index_0_lang-CVCHCcWR.js +16 -0
- package/dist/ImageUpload-C6GibYZL.js +72 -0
- package/dist/LinkButton-TTOA4H85.js +169 -0
- package/dist/ListRepeater-CB5mXJm1.js +86 -0
- package/dist/ManagementSettings-CPRLKL7g.js +640 -0
- package/dist/Select-CbQFoAzb.js +25 -0
- package/dist/SettingsView-DFAxZPug.js +33 -0
- package/dist/StepperField-DrHM9EDn.js +29 -0
- package/dist/Switch-8mmNQUDo.js +19 -0
- package/dist/TextAlign-BOC8ekaH.js +51 -0
- package/dist/TextDecorators-BJC4umDR.js +53 -0
- package/dist/TextField-BiVH5rLX.js +24 -0
- package/dist/TextStyleList-CuPE80Py.js +68 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/app-Cm2f09Gv.js +4690 -0
- package/dist/app.js +5 -21236
- package/dist/image-D5Lfw4dr.js +41 -0
- package/dist/index-CK6I60_i.js +188 -0
- package/dist/index-CjpUVE5b.js +66 -0
- package/dist/index-DF2wv5QS.js +1729 -0
- package/dist/main-BUI2Mmvv.js +6726 -0
- package/dist/merchant/src/app.d.ts +1 -1
- package/dist/package.json +1 -1
- package/dist/style.css +1 -1
- package/dist/v4-ANoOI1Qw.js +26 -0
- package/dist/vue-sonner-PX6Req0V.js +746 -0
- package/package.json +1 -1
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
import { defineComponent as yt, useAttrs as Jt, ref as p, computed as g, watchEffect as K, nextTick as Qt, watch as Ft, openBlock as d, createElementBlock as v, unref as j, Fragment as _, renderList as gt, mergeProps as ut, createBlock as F, normalizeClass as D, normalizeStyle as pt, withCtx as W, renderSlot as E, createVNode as U, onMounted as _t, onBeforeUnmount as Xt, resolveDynamicComponent as Z, createCommentVNode as N, createElementVNode as O, normalizeProps as Rt, createTextVNode as Vt, toDisplayString as dt } from "vue";
|
|
2
|
+
var Zt = Object.defineProperty, te = (s, a, t) => a in s ? Zt(s, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[a] = t, k = (s, a, t) => te(s, typeof a != "symbol" ? a + "" : a, t);
|
|
3
|
+
function ee(s) {
|
|
4
|
+
if (typeof document > "u") return;
|
|
5
|
+
let a = document.head || document.getElementsByTagName("head")[0], t = document.createElement("style");
|
|
6
|
+
t.type = "text/css", a.appendChild(t), t.styleSheet ? t.styleSheet.cssText = s : t.appendChild(document.createTextNode(s));
|
|
7
|
+
}
|
|
8
|
+
ee(":where([data-sonner-toaster][dir=ltr]),:where(html[dir=ltr]){--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}:where([data-sonner-toaster][dir=rtl]),:where(html[dir=rtl]){--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted=true]){transform:translateY(-10px)}@media (hover:none) and (pointer:coarse){:where([data-sonner-toaster][data-lifted=true]){transform:none}}:where([data-sonner-toaster][data-x-position=right]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position=left]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position=center]){left:50%;transform:translateX(-50%)}:where([data-sonner-toaster][data-y-position=top]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position=bottom]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled=true]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}:where([data-sonner-toast][data-y-position=top]){top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position=bottom]){bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise=true]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme=dark]) :where([data-cancel]){background:rgba(255,255,255,.3)}[data-sonner-toast] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}:where([data-sonner-toast]) :where([data-disabled=true]){cursor:not-allowed}[data-sonner-toast]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping=true])::before{content:'';position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position=top][data-swiping=true])::before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position=bottom][data-swiping=true])::before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping=false][data-removed=true])::before{content:'';position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast])::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted=true]){--y:translateY(0);opacity:1}:where([data-sonner-toast][data-expanded=false][data-front=false]){--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded=false][data-front=false][data-styled=true])>*{opacity:0}:where([data-sonner-toast][data-visible=false]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted=true][data-expanded=true]){--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]){--y:translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]){--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]){--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed=true][data-front=false])::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{from{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;--mobile-offset:16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 91%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 91%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 91%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 100%, 12%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 12%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
|
|
9
|
+
let mt = 0;
|
|
10
|
+
class ae {
|
|
11
|
+
constructor() {
|
|
12
|
+
k(this, "subscribers"), k(this, "toasts"), k(this, "subscribe", (a) => (this.subscribers.push(a), () => {
|
|
13
|
+
const t = this.subscribers.indexOf(a);
|
|
14
|
+
this.subscribers.splice(t, 1);
|
|
15
|
+
})), k(this, "publish", (a) => {
|
|
16
|
+
this.subscribers.forEach((t) => t(a));
|
|
17
|
+
}), k(this, "addToast", (a) => {
|
|
18
|
+
this.publish(a), this.toasts = [...this.toasts, a];
|
|
19
|
+
}), k(this, "create", (a) => {
|
|
20
|
+
var t;
|
|
21
|
+
const { message: i, ...l } = a, y = typeof a.id == "number" || a.id && ((t = a.id) == null ? void 0 : t.length) > 0 ? a.id : mt++, T = this.toasts.find((h) => h.id === y), z = a.dismissible === void 0 ? !0 : a.dismissible;
|
|
22
|
+
return T ? this.toasts = this.toasts.map((h) => h.id === y ? (this.publish({ ...h, ...a, id: y, title: i }), {
|
|
23
|
+
...h,
|
|
24
|
+
...a,
|
|
25
|
+
id: y,
|
|
26
|
+
dismissible: z,
|
|
27
|
+
title: i
|
|
28
|
+
}) : h) : this.addToast({ title: i, ...l, dismissible: z, id: y }), y;
|
|
29
|
+
}), k(this, "dismiss", (a) => (a || this.toasts.forEach((t) => {
|
|
30
|
+
this.subscribers.forEach(
|
|
31
|
+
(i) => i({ id: t.id, dismiss: !0 })
|
|
32
|
+
);
|
|
33
|
+
}), this.subscribers.forEach((t) => t({ id: a, dismiss: !0 })), a)), k(this, "message", (a, t) => this.create({ ...t, message: a, type: "default" })), k(this, "error", (a, t) => this.create({ ...t, type: "error", message: a })), k(this, "success", (a, t) => this.create({ ...t, type: "success", message: a })), k(this, "info", (a, t) => this.create({ ...t, type: "info", message: a })), k(this, "warning", (a, t) => this.create({ ...t, type: "warning", message: a })), k(this, "loading", (a, t) => this.create({ ...t, type: "loading", message: a })), k(this, "promise", (a, t) => {
|
|
34
|
+
if (!t)
|
|
35
|
+
return;
|
|
36
|
+
let i;
|
|
37
|
+
t.loading !== void 0 && (i = this.create({
|
|
38
|
+
...t,
|
|
39
|
+
promise: a,
|
|
40
|
+
type: "loading",
|
|
41
|
+
message: t.loading,
|
|
42
|
+
description: typeof t.description != "function" ? t.description : void 0
|
|
43
|
+
}));
|
|
44
|
+
const l = a instanceof Promise ? a : a();
|
|
45
|
+
let y = i !== void 0, T;
|
|
46
|
+
const z = l.then(async (c) => {
|
|
47
|
+
if (T = ["resolve", c], se(c) && !c.ok) {
|
|
48
|
+
y = !1;
|
|
49
|
+
const f = typeof t.error == "function" ? await t.error(
|
|
50
|
+
`HTTP error! status: ${c.status}`
|
|
51
|
+
) : t.error, b = typeof t.description == "function" ? (
|
|
52
|
+
// @ts-expect-error
|
|
53
|
+
await t.description(`HTTP error! status: ${c.status}`)
|
|
54
|
+
) : t.description;
|
|
55
|
+
this.create({ id: i, type: "error", message: f, description: b });
|
|
56
|
+
} else if (t.success !== void 0) {
|
|
57
|
+
y = !1;
|
|
58
|
+
const f = typeof t.success == "function" ? await t.success(c) : t.success, b = typeof t.description == "function" ? await t.description(c) : t.description;
|
|
59
|
+
this.create({ id: i, type: "success", message: f, description: b });
|
|
60
|
+
}
|
|
61
|
+
}).catch(async (c) => {
|
|
62
|
+
if (T = ["reject", c], t.error !== void 0) {
|
|
63
|
+
y = !1;
|
|
64
|
+
const f = typeof t.error == "function" ? await t.error(c) : t.error, b = typeof t.description == "function" ? await t.description(
|
|
65
|
+
c
|
|
66
|
+
) : t.description;
|
|
67
|
+
this.create({ id: i, type: "error", message: f, description: b });
|
|
68
|
+
}
|
|
69
|
+
}).finally(() => {
|
|
70
|
+
var c;
|
|
71
|
+
y && (this.dismiss(i), i = void 0), (c = t.finally) == null || c.call(t);
|
|
72
|
+
}), h = () => new Promise(
|
|
73
|
+
(c, f) => z.then(
|
|
74
|
+
() => T[0] === "reject" ? f(T[1]) : c(T[1])
|
|
75
|
+
).catch(f)
|
|
76
|
+
);
|
|
77
|
+
return typeof i != "string" && typeof i != "number" ? { unwrap: h } : Object.assign(i, { unwrap: h });
|
|
78
|
+
}), k(this, "custom", (a, t) => {
|
|
79
|
+
const i = (t == null ? void 0 : t.id) || mt++;
|
|
80
|
+
return this.publish({ component: a, id: i, ...t }), i;
|
|
81
|
+
}), this.subscribers = [], this.toasts = [];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const $ = new ae();
|
|
85
|
+
function oe(s, a) {
|
|
86
|
+
const t = (a == null ? void 0 : a.id) || mt++;
|
|
87
|
+
return $.create({
|
|
88
|
+
message: s,
|
|
89
|
+
id: t,
|
|
90
|
+
type: "default",
|
|
91
|
+
...a
|
|
92
|
+
}), t;
|
|
93
|
+
}
|
|
94
|
+
const se = (s) => s && typeof s == "object" && "ok" in s && typeof s.ok == "boolean" && "status" in s && typeof s.status == "number", ne = oe, re = () => $.toasts, We = Object.assign(
|
|
95
|
+
ne,
|
|
96
|
+
{
|
|
97
|
+
success: $.success,
|
|
98
|
+
info: $.info,
|
|
99
|
+
warning: $.warning,
|
|
100
|
+
error: $.error,
|
|
101
|
+
custom: $.custom,
|
|
102
|
+
message: $.message,
|
|
103
|
+
promise: $.promise,
|
|
104
|
+
dismiss: $.dismiss,
|
|
105
|
+
loading: $.loading
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
getHistory: re
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
function ct(s) {
|
|
112
|
+
return s.label !== void 0;
|
|
113
|
+
}
|
|
114
|
+
function ie() {
|
|
115
|
+
const s = p(!1);
|
|
116
|
+
return K(() => {
|
|
117
|
+
const a = () => {
|
|
118
|
+
s.value = document.hidden;
|
|
119
|
+
};
|
|
120
|
+
return document.addEventListener("visibilitychange", a), () => window.removeEventListener("visibilitychange", a);
|
|
121
|
+
}), {
|
|
122
|
+
isDocumentHidden: s
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const le = ["aria-live", "data-rich-colors", "data-styled", "data-mounted", "data-promise", "data-removed", "data-visible", "data-y-position", "data-x-position", "data-index", "data-front", "data-swiping", "data-dismissible", "data-type", "data-invert", "data-swipe-out", "data-expanded"], de = ["aria-label", "data-disabled"], Wt = 4e3, ce = 20, ue = 200, pe = /* @__PURE__ */ yt({
|
|
126
|
+
__name: "Toast",
|
|
127
|
+
props: {
|
|
128
|
+
toast: {},
|
|
129
|
+
toasts: {},
|
|
130
|
+
index: {},
|
|
131
|
+
expanded: { type: Boolean },
|
|
132
|
+
invert: { type: Boolean },
|
|
133
|
+
heights: {},
|
|
134
|
+
gap: {},
|
|
135
|
+
position: {},
|
|
136
|
+
visibleToasts: {},
|
|
137
|
+
expandByDefault: { type: Boolean },
|
|
138
|
+
closeButton: { type: Boolean },
|
|
139
|
+
interacting: { type: Boolean },
|
|
140
|
+
style: {},
|
|
141
|
+
cancelButtonStyle: {},
|
|
142
|
+
actionButtonStyle: {},
|
|
143
|
+
duration: {},
|
|
144
|
+
class: {},
|
|
145
|
+
unstyled: { type: Boolean },
|
|
146
|
+
descriptionClass: {},
|
|
147
|
+
loadingIcon: {},
|
|
148
|
+
classes: {},
|
|
149
|
+
icons: {},
|
|
150
|
+
closeButtonAriaLabel: {},
|
|
151
|
+
pauseWhenPageIsHidden: { type: Boolean },
|
|
152
|
+
cn: { type: Function },
|
|
153
|
+
defaultRichColors: { type: Boolean }
|
|
154
|
+
},
|
|
155
|
+
emits: ["update:heights", "removeToast"],
|
|
156
|
+
setup(s, { emit: a }) {
|
|
157
|
+
const t = s, i = a, l = p(!1), y = p(!1), T = p(!1), z = p(!1), h = p(!1), c = p(0), f = p(0), b = p(
|
|
158
|
+
t.toast.duration || t.duration || Wt
|
|
159
|
+
), I = p(null), B = p(null), vt = g(() => t.index === 0), ht = g(() => t.index + 1 <= t.visibleToasts), S = g(() => t.toast.type), L = g(() => t.toast.dismissible !== !1), ft = g(() => t.toast.class || ""), o = g(() => t.descriptionClass || ""), n = t.toast.style || {}, r = g(
|
|
160
|
+
() => t.heights.findIndex((e) => e.toastId === t.toast.id) || 0
|
|
161
|
+
), w = g(() => t.toast.closeButton ?? t.closeButton);
|
|
162
|
+
g(
|
|
163
|
+
() => t.toast.duration || t.duration || Wt
|
|
164
|
+
);
|
|
165
|
+
const P = p(0), Y = p(0), A = p(null), q = g(() => t.position.split("-")), G = g(() => q.value[0]), et = g(() => q.value[1]), at = g(() => typeof t.toast.title != "string"), ot = g(
|
|
166
|
+
() => typeof t.toast.description != "string"
|
|
167
|
+
), st = g(() => t.heights.reduce((e, u, x) => x >= r.value ? e : e + u.height, 0)), nt = ie(), rt = g(() => t.toast.invert || t.invert), R = g(() => S.value === "loading"), H = g(() => r.value * t.gap + st.value || 0);
|
|
168
|
+
_t(() => {
|
|
169
|
+
if (!l.value) return;
|
|
170
|
+
const e = B.value, u = e == null ? void 0 : e.style.height;
|
|
171
|
+
e.style.height = "auto";
|
|
172
|
+
const x = e.getBoundingClientRect().height;
|
|
173
|
+
e.style.height = u, f.value = x;
|
|
174
|
+
let C;
|
|
175
|
+
t.heights.find(
|
|
176
|
+
(m) => m.toastId === t.toast.id
|
|
177
|
+
) ? C = t.heights.map(
|
|
178
|
+
(m) => m.toastId === t.toast.id ? { ...m, height: x } : m
|
|
179
|
+
) : C = [
|
|
180
|
+
{
|
|
181
|
+
toastId: t.toast.id,
|
|
182
|
+
height: x,
|
|
183
|
+
position: t.toast.position
|
|
184
|
+
},
|
|
185
|
+
...t.heights
|
|
186
|
+
], i("update:heights", C);
|
|
187
|
+
});
|
|
188
|
+
function V() {
|
|
189
|
+
y.value = !0, c.value = H.value;
|
|
190
|
+
const e = t.heights.filter(
|
|
191
|
+
(u) => u.toastId !== t.toast.id
|
|
192
|
+
);
|
|
193
|
+
i("update:heights", e), setTimeout(() => {
|
|
194
|
+
i("removeToast", t.toast);
|
|
195
|
+
}, ue);
|
|
196
|
+
}
|
|
197
|
+
function bt() {
|
|
198
|
+
var e, u;
|
|
199
|
+
if (R.value || !L.value)
|
|
200
|
+
return {};
|
|
201
|
+
V(), (u = (e = t.toast).onDismiss) == null || u.call(e, t.toast);
|
|
202
|
+
}
|
|
203
|
+
function Kt(e) {
|
|
204
|
+
R.value || !L.value || (I.value = /* @__PURE__ */ new Date(), c.value = H.value, e.target.setPointerCapture(e.pointerId), e.target.tagName !== "BUTTON" && (T.value = !0, A.value = { x: e.clientX, y: e.clientY }));
|
|
205
|
+
}
|
|
206
|
+
function qt() {
|
|
207
|
+
var e, u, x, C, m;
|
|
208
|
+
if (z.value || !L) return;
|
|
209
|
+
A.value = null;
|
|
210
|
+
const M = Number(
|
|
211
|
+
((e = B.value) == null ? void 0 : e.style.getPropertyValue("--swipe-amount").replace("px", "")) || 0
|
|
212
|
+
), it = (/* @__PURE__ */ new Date()).getTime() - ((u = I.value) == null ? void 0 : u.getTime()), lt = Math.abs(M) / it;
|
|
213
|
+
if (Math.abs(M) >= ce || lt > 0.11) {
|
|
214
|
+
c.value = H.value, (C = (x = t.toast).onDismiss) == null || C.call(x, t.toast), V(), z.value = !0, h.value = !1;
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
(m = B.value) == null || m.style.setProperty("--swipe-amount", "0px"), T.value = !1;
|
|
218
|
+
}
|
|
219
|
+
function Gt(e) {
|
|
220
|
+
var u, x;
|
|
221
|
+
if (!A.value || !L.value) return;
|
|
222
|
+
const C = e.clientY - A.value.y, m = ((u = window.getSelection()) == null ? void 0 : u.toString().length) > 0, M = G.value === "top" ? Math.min(0, C) : Math.max(0, C);
|
|
223
|
+
Math.abs(M) > 0 && (h.value = !0), !m && ((x = B.value) == null || x.style.setProperty("--swipe-amount", `${M}px`));
|
|
224
|
+
}
|
|
225
|
+
return K((e) => {
|
|
226
|
+
if (t.toast.promise && S.value === "loading" || t.toast.duration === 1 / 0 || t.toast.type === "loading")
|
|
227
|
+
return;
|
|
228
|
+
let u;
|
|
229
|
+
const x = () => {
|
|
230
|
+
if (Y.value < P.value) {
|
|
231
|
+
const m = (/* @__PURE__ */ new Date()).getTime() - P.value;
|
|
232
|
+
b.value = b.value - m;
|
|
233
|
+
}
|
|
234
|
+
Y.value = (/* @__PURE__ */ new Date()).getTime();
|
|
235
|
+
}, C = () => {
|
|
236
|
+
b.value !== 1 / 0 && (P.value = (/* @__PURE__ */ new Date()).getTime(), u = setTimeout(() => {
|
|
237
|
+
var m, M;
|
|
238
|
+
(M = (m = t.toast).onAutoClose) == null || M.call(m, t.toast), V();
|
|
239
|
+
}, b.value));
|
|
240
|
+
};
|
|
241
|
+
t.expanded || t.interacting || t.pauseWhenPageIsHidden && nt ? x() : C(), e(() => {
|
|
242
|
+
clearTimeout(u);
|
|
243
|
+
});
|
|
244
|
+
}), Ft(
|
|
245
|
+
() => t.toast.delete,
|
|
246
|
+
() => {
|
|
247
|
+
t.toast.delete && V();
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
deep: !0
|
|
251
|
+
}
|
|
252
|
+
), _t(() => {
|
|
253
|
+
if (l.value = !0, B.value) {
|
|
254
|
+
const e = B.value.getBoundingClientRect().height;
|
|
255
|
+
f.value = e;
|
|
256
|
+
const u = [
|
|
257
|
+
{ toastId: t.toast.id, height: e, position: t.toast.position },
|
|
258
|
+
...t.heights
|
|
259
|
+
];
|
|
260
|
+
i("update:heights", u);
|
|
261
|
+
}
|
|
262
|
+
}), Xt(() => {
|
|
263
|
+
if (B.value) {
|
|
264
|
+
const e = t.heights.filter(
|
|
265
|
+
(u) => u.toastId !== t.toast.id
|
|
266
|
+
);
|
|
267
|
+
i("update:heights", e);
|
|
268
|
+
}
|
|
269
|
+
}), (e, u) => {
|
|
270
|
+
var x, C, m, M, it, lt, wt, xt, kt, Bt, Ct, Tt, St, Pt, $t, zt, Et, Mt, It, Yt, Ht, At, Dt, Ot, Lt, jt, Nt;
|
|
271
|
+
return d(), v("li", {
|
|
272
|
+
ref_key: "toastRef",
|
|
273
|
+
ref: B,
|
|
274
|
+
"aria-live": e.toast.important ? "assertive" : "polite",
|
|
275
|
+
"aria-atomic": "true",
|
|
276
|
+
role: "status",
|
|
277
|
+
tabindex: "0",
|
|
278
|
+
"data-sonner-toast": "true",
|
|
279
|
+
class: D(
|
|
280
|
+
e.cn(
|
|
281
|
+
t.class,
|
|
282
|
+
ft.value,
|
|
283
|
+
(x = e.classes) == null ? void 0 : x.toast,
|
|
284
|
+
(C = e.toast.classes) == null ? void 0 : C.toast,
|
|
285
|
+
// @ts-ignore
|
|
286
|
+
(m = e.classes) == null ? void 0 : m[S.value],
|
|
287
|
+
// @ts-ignore
|
|
288
|
+
(it = (M = e.toast) == null ? void 0 : M.classes) == null ? void 0 : it[S.value]
|
|
289
|
+
)
|
|
290
|
+
),
|
|
291
|
+
"data-rich-colors": e.toast.richColors ?? e.defaultRichColors,
|
|
292
|
+
"data-styled": !(e.toast.component || (lt = e.toast) != null && lt.unstyled || e.unstyled),
|
|
293
|
+
"data-mounted": l.value,
|
|
294
|
+
"data-promise": !!e.toast.promise,
|
|
295
|
+
"data-removed": y.value,
|
|
296
|
+
"data-visible": ht.value,
|
|
297
|
+
"data-y-position": G.value,
|
|
298
|
+
"data-x-position": et.value,
|
|
299
|
+
"data-index": e.index,
|
|
300
|
+
"data-front": vt.value,
|
|
301
|
+
"data-swiping": T.value,
|
|
302
|
+
"data-dismissible": L.value,
|
|
303
|
+
"data-type": S.value,
|
|
304
|
+
"data-invert": rt.value,
|
|
305
|
+
"data-swipe-out": z.value,
|
|
306
|
+
"data-expanded": !!(e.expanded || e.expandByDefault && l.value),
|
|
307
|
+
style: pt({
|
|
308
|
+
"--index": e.index,
|
|
309
|
+
"--toasts-before": e.index,
|
|
310
|
+
"--z-index": e.toasts.length - e.index,
|
|
311
|
+
"--offset": `${y.value ? c.value : H.value}px`,
|
|
312
|
+
"--initial-height": e.expandByDefault ? "auto" : `${f.value}px`,
|
|
313
|
+
...e.style,
|
|
314
|
+
...j(n)
|
|
315
|
+
}),
|
|
316
|
+
onPointerdown: Kt,
|
|
317
|
+
onPointerup: qt,
|
|
318
|
+
onPointermove: Gt
|
|
319
|
+
}, [
|
|
320
|
+
w.value && !e.toast.component ? (d(), v("button", {
|
|
321
|
+
key: 0,
|
|
322
|
+
"aria-label": e.closeButtonAriaLabel || "Close toast",
|
|
323
|
+
"data-disabled": R.value,
|
|
324
|
+
"data-close-button": "true",
|
|
325
|
+
class: D(e.cn((wt = e.classes) == null ? void 0 : wt.closeButton, (kt = (xt = e.toast) == null ? void 0 : xt.classes) == null ? void 0 : kt.closeButton)),
|
|
326
|
+
onClick: bt
|
|
327
|
+
}, [
|
|
328
|
+
(Bt = e.icons) != null && Bt.close ? (d(), F(Z((Ct = e.icons) == null ? void 0 : Ct.close), { key: 0 })) : E(e.$slots, "close-icon", { key: 1 })
|
|
329
|
+
], 10, de)) : N("", !0),
|
|
330
|
+
e.toast.component ? (d(), F(Z(e.toast.component), ut({ key: 1 }, e.toast.componentProps, { onCloseToast: bt }), null, 16)) : (d(), v(_, { key: 2 }, [
|
|
331
|
+
S.value !== "default" || e.toast.icon || e.toast.promise ? (d(), v("div", {
|
|
332
|
+
key: 0,
|
|
333
|
+
"data-icon": "",
|
|
334
|
+
class: D(e.cn((Tt = e.classes) == null ? void 0 : Tt.icon, (Pt = (St = e.toast) == null ? void 0 : St.classes) == null ? void 0 : Pt.icon))
|
|
335
|
+
}, [
|
|
336
|
+
(e.toast.promise || S.value === "loading") && !e.toast.icon ? E(e.$slots, "loading-icon", { key: 0 }) : N("", !0),
|
|
337
|
+
e.toast.icon ? (d(), F(Z(e.toast.icon), { key: 1 })) : (d(), v(_, { key: 2 }, [
|
|
338
|
+
S.value === "success" ? E(e.$slots, "success-icon", { key: 0 }) : S.value === "error" ? E(e.$slots, "error-icon", { key: 1 }) : S.value === "warning" ? E(e.$slots, "warning-icon", { key: 2 }) : S.value === "info" ? E(e.$slots, "info-icon", { key: 3 }) : N("", !0)
|
|
339
|
+
], 64))
|
|
340
|
+
], 2)) : N("", !0),
|
|
341
|
+
O("div", {
|
|
342
|
+
"data-content": "",
|
|
343
|
+
class: D(e.cn(($t = e.classes) == null ? void 0 : $t.content, (Et = (zt = e.toast) == null ? void 0 : zt.classes) == null ? void 0 : Et.content))
|
|
344
|
+
}, [
|
|
345
|
+
O("div", {
|
|
346
|
+
"data-title": "",
|
|
347
|
+
class: D(e.cn((Mt = e.classes) == null ? void 0 : Mt.title, (It = e.toast.classes) == null ? void 0 : It.title))
|
|
348
|
+
}, [
|
|
349
|
+
at.value ? (d(), F(Z(e.toast.title), Rt(ut({ key: 0 }, e.toast.componentProps)), null, 16)) : (d(), v(_, { key: 1 }, [
|
|
350
|
+
Vt(dt(e.toast.title), 1)
|
|
351
|
+
], 64))
|
|
352
|
+
], 2),
|
|
353
|
+
e.toast.description ? (d(), v("div", {
|
|
354
|
+
key: 0,
|
|
355
|
+
"data-description": "",
|
|
356
|
+
class: D(
|
|
357
|
+
e.cn(
|
|
358
|
+
e.descriptionClass,
|
|
359
|
+
o.value,
|
|
360
|
+
(Yt = e.classes) == null ? void 0 : Yt.description,
|
|
361
|
+
(Ht = e.toast.classes) == null ? void 0 : Ht.description
|
|
362
|
+
)
|
|
363
|
+
)
|
|
364
|
+
}, [
|
|
365
|
+
ot.value ? (d(), F(Z(e.toast.description), Rt(ut({ key: 0 }, e.toast.componentProps)), null, 16)) : (d(), v(_, { key: 1 }, [
|
|
366
|
+
Vt(dt(e.toast.description), 1)
|
|
367
|
+
], 64))
|
|
368
|
+
], 2)) : N("", !0)
|
|
369
|
+
], 2),
|
|
370
|
+
e.toast.cancel ? (d(), v("button", {
|
|
371
|
+
key: 1,
|
|
372
|
+
style: pt(e.toast.cancelButtonStyle || e.cancelButtonStyle),
|
|
373
|
+
class: D(e.cn((At = e.classes) == null ? void 0 : At.cancelButton, (Dt = e.toast.classes) == null ? void 0 : Dt.cancelButton)),
|
|
374
|
+
"data-button": "",
|
|
375
|
+
"data-cancel": "",
|
|
376
|
+
onClick: u[0] || (u[0] = (J) => {
|
|
377
|
+
var Q, X;
|
|
378
|
+
j(ct)(e.toast.cancel) && L.value && ((X = (Q = e.toast.cancel).onClick) == null || X.call(Q, J), V());
|
|
379
|
+
})
|
|
380
|
+
}, dt(j(ct)(e.toast.cancel) ? (Ot = e.toast.cancel) == null ? void 0 : Ot.label : e.toast.cancel), 7)) : N("", !0),
|
|
381
|
+
e.toast.action ? (d(), v("button", {
|
|
382
|
+
key: 2,
|
|
383
|
+
style: pt(e.toast.actionButtonStyle || e.actionButtonStyle),
|
|
384
|
+
class: D(e.cn((Lt = e.classes) == null ? void 0 : Lt.actionButton, (jt = e.toast.classes) == null ? void 0 : jt.actionButton)),
|
|
385
|
+
"data-button": "",
|
|
386
|
+
"data-action": "",
|
|
387
|
+
onClick: u[1] || (u[1] = (J) => {
|
|
388
|
+
var Q, X;
|
|
389
|
+
j(ct)(e.toast.action) && (J.defaultPrevented || ((X = (Q = e.toast.action).onClick) == null || X.call(Q, J), !J.defaultPrevented && V()));
|
|
390
|
+
})
|
|
391
|
+
}, dt(j(ct)(e.toast.action) ? (Nt = e.toast.action) == null ? void 0 : Nt.label : e.toast.action), 7)) : N("", !0)
|
|
392
|
+
], 64))
|
|
393
|
+
], 46, le);
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
}), tt = (s, a) => {
|
|
397
|
+
const t = s.__vccOpts || s;
|
|
398
|
+
for (const [i, l] of a)
|
|
399
|
+
t[i] = l;
|
|
400
|
+
return t;
|
|
401
|
+
}, ve = {}, he = {
|
|
402
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
403
|
+
width: "12",
|
|
404
|
+
height: "12",
|
|
405
|
+
viewBox: "0 0 24 24",
|
|
406
|
+
fill: "none",
|
|
407
|
+
stroke: "currentColor",
|
|
408
|
+
"stoke-width": "1.5",
|
|
409
|
+
"stroke-linecap": "round",
|
|
410
|
+
"stroke-linejoin": "round"
|
|
411
|
+
};
|
|
412
|
+
function fe(s, a) {
|
|
413
|
+
return d(), v("svg", he, a[0] || (a[0] = [
|
|
414
|
+
O("line", {
|
|
415
|
+
x1: "18",
|
|
416
|
+
y1: "6",
|
|
417
|
+
x2: "6",
|
|
418
|
+
y2: "18"
|
|
419
|
+
}, null, -1),
|
|
420
|
+
O("line", {
|
|
421
|
+
x1: "6",
|
|
422
|
+
y1: "6",
|
|
423
|
+
x2: "18",
|
|
424
|
+
y2: "18"
|
|
425
|
+
}, null, -1)
|
|
426
|
+
]));
|
|
427
|
+
}
|
|
428
|
+
const ge = /* @__PURE__ */ tt(ve, [["render", fe]]), me = ["data-visible"], ye = { class: "sonner-spinner" }, be = /* @__PURE__ */ yt({
|
|
429
|
+
__name: "Loader",
|
|
430
|
+
props: {
|
|
431
|
+
visible: { type: Boolean }
|
|
432
|
+
},
|
|
433
|
+
setup(s) {
|
|
434
|
+
const a = Array(12).fill(0);
|
|
435
|
+
return (t, i) => (d(), v("div", {
|
|
436
|
+
class: "sonner-loading-wrapper",
|
|
437
|
+
"data-visible": t.visible
|
|
438
|
+
}, [
|
|
439
|
+
O("div", ye, [
|
|
440
|
+
(d(!0), v(_, null, gt(j(a), (l) => (d(), v("div", {
|
|
441
|
+
key: `spinner-bar-${l}`,
|
|
442
|
+
class: "sonner-loading-bar"
|
|
443
|
+
}))), 128))
|
|
444
|
+
])
|
|
445
|
+
], 8, me));
|
|
446
|
+
}
|
|
447
|
+
}), we = {}, xe = {
|
|
448
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
449
|
+
viewBox: "0 0 20 20",
|
|
450
|
+
fill: "currentColor",
|
|
451
|
+
height: "20",
|
|
452
|
+
width: "20"
|
|
453
|
+
};
|
|
454
|
+
function ke(s, a) {
|
|
455
|
+
return d(), v("svg", xe, a[0] || (a[0] = [
|
|
456
|
+
O("path", {
|
|
457
|
+
"fill-rule": "evenodd",
|
|
458
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
459
|
+
"clip-rule": "evenodd"
|
|
460
|
+
}, null, -1)
|
|
461
|
+
]));
|
|
462
|
+
}
|
|
463
|
+
const Be = /* @__PURE__ */ tt(we, [["render", ke]]), Ce = {}, Te = {
|
|
464
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
465
|
+
viewBox: "0 0 20 20",
|
|
466
|
+
fill: "currentColor",
|
|
467
|
+
height: "20",
|
|
468
|
+
width: "20"
|
|
469
|
+
};
|
|
470
|
+
function Se(s, a) {
|
|
471
|
+
return d(), v("svg", Te, a[0] || (a[0] = [
|
|
472
|
+
O("path", {
|
|
473
|
+
"fill-rule": "evenodd",
|
|
474
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
475
|
+
"clip-rule": "evenodd"
|
|
476
|
+
}, null, -1)
|
|
477
|
+
]));
|
|
478
|
+
}
|
|
479
|
+
const Pe = /* @__PURE__ */ tt(Ce, [["render", Se]]), $e = {}, ze = {
|
|
480
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
481
|
+
viewBox: "0 0 24 24",
|
|
482
|
+
fill: "currentColor",
|
|
483
|
+
height: "20",
|
|
484
|
+
width: "20"
|
|
485
|
+
};
|
|
486
|
+
function Ee(s, a) {
|
|
487
|
+
return d(), v("svg", ze, a[0] || (a[0] = [
|
|
488
|
+
O("path", {
|
|
489
|
+
"fill-rule": "evenodd",
|
|
490
|
+
d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
491
|
+
"clip-rule": "evenodd"
|
|
492
|
+
}, null, -1)
|
|
493
|
+
]));
|
|
494
|
+
}
|
|
495
|
+
const Me = /* @__PURE__ */ tt($e, [["render", Ee]]), Ie = {}, Ye = {
|
|
496
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
497
|
+
viewBox: "0 0 20 20",
|
|
498
|
+
fill: "currentColor",
|
|
499
|
+
height: "20",
|
|
500
|
+
width: "20"
|
|
501
|
+
};
|
|
502
|
+
function He(s, a) {
|
|
503
|
+
return d(), v("svg", Ye, a[0] || (a[0] = [
|
|
504
|
+
O("path", {
|
|
505
|
+
"fill-rule": "evenodd",
|
|
506
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
|
|
507
|
+
"clip-rule": "evenodd"
|
|
508
|
+
}, null, -1)
|
|
509
|
+
]));
|
|
510
|
+
}
|
|
511
|
+
const Ae = /* @__PURE__ */ tt(Ie, [["render", He]]), De = ["aria-label"], Oe = ["dir", "data-theme", "data-rich-colors", "data-y-position", "data-x-position", "data-lifted"], Le = 3, Ut = "32px", je = 356, Ne = 14, _e = typeof window < "u" && typeof document < "u";
|
|
512
|
+
function Re(...s) {
|
|
513
|
+
return s.filter(Boolean).join(" ");
|
|
514
|
+
}
|
|
515
|
+
const Ue = /* @__PURE__ */ yt({
|
|
516
|
+
name: "Toaster",
|
|
517
|
+
inheritAttrs: !1,
|
|
518
|
+
__name: "Toaster",
|
|
519
|
+
props: {
|
|
520
|
+
invert: { type: Boolean, default: !1 },
|
|
521
|
+
theme: { default: "light" },
|
|
522
|
+
position: { default: "bottom-right" },
|
|
523
|
+
hotkey: { default: () => ["altKey", "KeyT"] },
|
|
524
|
+
richColors: { type: Boolean, default: !1 },
|
|
525
|
+
expand: { type: Boolean, default: !1 },
|
|
526
|
+
duration: {},
|
|
527
|
+
gap: { default: Ne },
|
|
528
|
+
visibleToasts: { default: Le },
|
|
529
|
+
closeButton: { type: Boolean, default: !1 },
|
|
530
|
+
toastOptions: { default: () => ({}) },
|
|
531
|
+
class: { default: "" },
|
|
532
|
+
style: { default: () => ({}) },
|
|
533
|
+
offset: { default: Ut },
|
|
534
|
+
dir: { default: "auto" },
|
|
535
|
+
icons: {},
|
|
536
|
+
containerAriaLabel: { default: "Notifications" },
|
|
537
|
+
pauseWhenPageIsHidden: { type: Boolean, default: !1 },
|
|
538
|
+
cn: { type: Function, default: Re }
|
|
539
|
+
},
|
|
540
|
+
setup(s) {
|
|
541
|
+
const a = s;
|
|
542
|
+
function t() {
|
|
543
|
+
if (typeof window > "u" || typeof document > "u") return "ltr";
|
|
544
|
+
const o = document.documentElement.getAttribute("dir");
|
|
545
|
+
return o === "auto" || !o ? window.getComputedStyle(document.documentElement).direction : o;
|
|
546
|
+
}
|
|
547
|
+
const i = Jt(), l = p([]), y = g(() => (o, n) => l.value.filter(
|
|
548
|
+
(r) => !r.position && n === 0 || r.position === o
|
|
549
|
+
)), T = g(() => {
|
|
550
|
+
const o = l.value.filter((n) => n.position).map((n) => n.position);
|
|
551
|
+
return o.length > 0 ? Array.from(new Set([a.position].concat(o))) : [a.position];
|
|
552
|
+
}), z = p([]), h = p(!1), c = p(!1), f = p(
|
|
553
|
+
a.theme !== "system" ? a.theme : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"
|
|
554
|
+
), b = p(null), I = p(null), B = p(!1), vt = a.hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
555
|
+
function ht(o) {
|
|
556
|
+
var n;
|
|
557
|
+
(n = l.value.find((r) => r.id === o.id)) != null && n.delete || $.dismiss(o.id), l.value = l.value.filter(({ id: r }) => r !== o.id);
|
|
558
|
+
}
|
|
559
|
+
function S(o) {
|
|
560
|
+
var n, r;
|
|
561
|
+
B.value && !((r = (n = o.currentTarget) == null ? void 0 : n.contains) != null && r.call(n, o.relatedTarget)) && (B.value = !1, I.value && (I.value.focus({ preventScroll: !0 }), I.value = null));
|
|
562
|
+
}
|
|
563
|
+
function L(o) {
|
|
564
|
+
o.target instanceof HTMLElement && o.target.dataset.dismissible === "false" || B.value || (B.value = !0, I.value = o.relatedTarget);
|
|
565
|
+
}
|
|
566
|
+
function ft(o) {
|
|
567
|
+
o.target && o.target instanceof HTMLElement && o.target.dataset.dismissible === "false" || (c.value = !0);
|
|
568
|
+
}
|
|
569
|
+
return K((o) => {
|
|
570
|
+
const n = $.subscribe((r) => {
|
|
571
|
+
if (r.dismiss) {
|
|
572
|
+
l.value = l.value.map(
|
|
573
|
+
(w) => w.id === r.id ? { ...w, delete: !0 } : w
|
|
574
|
+
);
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
Qt(() => {
|
|
578
|
+
const w = l.value.findIndex(
|
|
579
|
+
(P) => P.id === r.id
|
|
580
|
+
);
|
|
581
|
+
w !== -1 ? l.value = [
|
|
582
|
+
...l.value.slice(0, w),
|
|
583
|
+
{ ...l.value[w], ...r },
|
|
584
|
+
...l.value.slice(w + 1)
|
|
585
|
+
] : l.value = [r, ...l.value];
|
|
586
|
+
});
|
|
587
|
+
});
|
|
588
|
+
o(n);
|
|
589
|
+
}), Ft(
|
|
590
|
+
() => a.theme,
|
|
591
|
+
(o) => {
|
|
592
|
+
if (o !== "system") {
|
|
593
|
+
f.value = o;
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
if (o === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? f.value = "dark" : f.value = "light"), typeof window > "u") return;
|
|
597
|
+
const n = window.matchMedia("(prefers-color-scheme: dark)");
|
|
598
|
+
try {
|
|
599
|
+
n.addEventListener("change", ({ matches: r }) => {
|
|
600
|
+
r ? f.value = "dark" : f.value = "light";
|
|
601
|
+
});
|
|
602
|
+
} catch {
|
|
603
|
+
n.addListener(({ matches: r }) => {
|
|
604
|
+
try {
|
|
605
|
+
r ? f.value = "dark" : f.value = "light";
|
|
606
|
+
} catch (w) {
|
|
607
|
+
console.error(w);
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
), K(() => {
|
|
613
|
+
b.value && I.value && (I.value.focus({ preventScroll: !0 }), I.value = null, B.value = !1);
|
|
614
|
+
}), K(() => {
|
|
615
|
+
l.value.length <= 1 && (h.value = !1);
|
|
616
|
+
}), K((o) => {
|
|
617
|
+
function n(r) {
|
|
618
|
+
const w = a.hotkey.every(
|
|
619
|
+
(A) => r[A] || r.code === A
|
|
620
|
+
), P = Array.isArray(b.value) ? b.value[0] : b.value;
|
|
621
|
+
w && (h.value = !0, P == null || P.focus());
|
|
622
|
+
const Y = document.activeElement === b.value || (P == null ? void 0 : P.contains(document.activeElement));
|
|
623
|
+
r.code === "Escape" && Y && (h.value = !1);
|
|
624
|
+
}
|
|
625
|
+
_e && (document.addEventListener("keydown", n), o(() => {
|
|
626
|
+
document.removeEventListener("keydown", n);
|
|
627
|
+
}));
|
|
628
|
+
}), (o, n) => (d(), v("section", {
|
|
629
|
+
"aria-label": `${o.containerAriaLabel} ${j(vt)}`,
|
|
630
|
+
tabIndex: -1,
|
|
631
|
+
"aria-live": "polite",
|
|
632
|
+
"aria-relevant": "additions text",
|
|
633
|
+
"aria-atomic": "false"
|
|
634
|
+
}, [
|
|
635
|
+
(d(!0), v(_, null, gt(T.value, (r, w) => {
|
|
636
|
+
var P;
|
|
637
|
+
return d(), v("ol", ut({
|
|
638
|
+
key: r,
|
|
639
|
+
ref_for: !0,
|
|
640
|
+
ref_key: "listRef",
|
|
641
|
+
ref: b,
|
|
642
|
+
"data-sonner-toaster": "",
|
|
643
|
+
class: a.class,
|
|
644
|
+
dir: o.dir === "auto" ? t() : o.dir,
|
|
645
|
+
tabIndex: -1,
|
|
646
|
+
"data-theme": o.theme,
|
|
647
|
+
"data-rich-colors": o.richColors,
|
|
648
|
+
"data-y-position": r.split("-")[0],
|
|
649
|
+
"data-x-position": r.split("-")[1],
|
|
650
|
+
"data-lifted": h.value && l.value.length > 1 && !o.expand,
|
|
651
|
+
style: {
|
|
652
|
+
"--front-toast-height": `${(P = z.value[0]) == null ? void 0 : P.height}px`,
|
|
653
|
+
"--offset": typeof o.offset == "number" ? `${o.offset}px` : o.offset || Ut,
|
|
654
|
+
"--width": `${je}px`,
|
|
655
|
+
"--gap": `${o.gap}px`,
|
|
656
|
+
...o.style,
|
|
657
|
+
...j(i).style
|
|
658
|
+
}
|
|
659
|
+
}, o.$attrs, {
|
|
660
|
+
onBlur: S,
|
|
661
|
+
onFocus: L,
|
|
662
|
+
onMouseenter: n[1] || (n[1] = () => h.value = !0),
|
|
663
|
+
onMousemove: n[2] || (n[2] = () => h.value = !0),
|
|
664
|
+
onMouseleave: n[3] || (n[3] = () => {
|
|
665
|
+
c.value || (h.value = !1);
|
|
666
|
+
}),
|
|
667
|
+
onPointerdown: ft,
|
|
668
|
+
onPointerup: n[4] || (n[4] = () => c.value = !1)
|
|
669
|
+
}), [
|
|
670
|
+
(d(!0), v(_, null, gt(y.value(r, w), (Y, A) => {
|
|
671
|
+
var q, G, et, at, ot, st, nt, rt, R;
|
|
672
|
+
return d(), F(pe, {
|
|
673
|
+
key: Y.id,
|
|
674
|
+
heights: z.value.filter((H) => H.position === Y.position),
|
|
675
|
+
icons: o.icons,
|
|
676
|
+
index: A,
|
|
677
|
+
toast: Y,
|
|
678
|
+
defaultRichColors: o.richColors,
|
|
679
|
+
duration: ((q = o.toastOptions) == null ? void 0 : q.duration) ?? o.duration,
|
|
680
|
+
class: D(((G = o.toastOptions) == null ? void 0 : G.class) ?? ""),
|
|
681
|
+
descriptionClass: (et = o.toastOptions) == null ? void 0 : et.descriptionClass,
|
|
682
|
+
invert: o.invert,
|
|
683
|
+
visibleToasts: o.visibleToasts,
|
|
684
|
+
closeButton: ((at = o.toastOptions) == null ? void 0 : at.closeButton) ?? o.closeButton,
|
|
685
|
+
interacting: c.value,
|
|
686
|
+
position: r,
|
|
687
|
+
style: pt((ot = o.toastOptions) == null ? void 0 : ot.style),
|
|
688
|
+
unstyled: (st = o.toastOptions) == null ? void 0 : st.unstyled,
|
|
689
|
+
classes: (nt = o.toastOptions) == null ? void 0 : nt.classes,
|
|
690
|
+
cancelButtonStyle: (rt = o.toastOptions) == null ? void 0 : rt.cancelButtonStyle,
|
|
691
|
+
actionButtonStyle: (R = o.toastOptions) == null ? void 0 : R.actionButtonStyle,
|
|
692
|
+
toasts: l.value.filter((H) => H.position === Y.position),
|
|
693
|
+
expandByDefault: o.expand,
|
|
694
|
+
gap: o.gap,
|
|
695
|
+
expanded: h.value,
|
|
696
|
+
pauseWhenPageIsHidden: o.pauseWhenPageIsHidden,
|
|
697
|
+
cn: o.cn,
|
|
698
|
+
"onUpdate:heights": n[0] || (n[0] = (H) => {
|
|
699
|
+
z.value = H;
|
|
700
|
+
}),
|
|
701
|
+
onRemoveToast: ht
|
|
702
|
+
}, {
|
|
703
|
+
"close-icon": W(() => [
|
|
704
|
+
E(o.$slots, "close-icon", {}, () => [
|
|
705
|
+
U(ge)
|
|
706
|
+
])
|
|
707
|
+
]),
|
|
708
|
+
"loading-icon": W(() => [
|
|
709
|
+
E(o.$slots, "loading-icon", {}, () => [
|
|
710
|
+
U(be, {
|
|
711
|
+
visible: Y.type === "loading"
|
|
712
|
+
}, null, 8, ["visible"])
|
|
713
|
+
])
|
|
714
|
+
]),
|
|
715
|
+
"success-icon": W(() => [
|
|
716
|
+
E(o.$slots, "success-icon", {}, () => [
|
|
717
|
+
U(Be)
|
|
718
|
+
])
|
|
719
|
+
]),
|
|
720
|
+
"error-icon": W(() => [
|
|
721
|
+
E(o.$slots, "error-icon", {}, () => [
|
|
722
|
+
U(Ae)
|
|
723
|
+
])
|
|
724
|
+
]),
|
|
725
|
+
"warning-icon": W(() => [
|
|
726
|
+
E(o.$slots, "warning-icon", {}, () => [
|
|
727
|
+
U(Me)
|
|
728
|
+
])
|
|
729
|
+
]),
|
|
730
|
+
"info-icon": W(() => [
|
|
731
|
+
E(o.$slots, "info-icon", {}, () => [
|
|
732
|
+
U(Pe)
|
|
733
|
+
])
|
|
734
|
+
]),
|
|
735
|
+
_: 2
|
|
736
|
+
}, 1032, ["heights", "icons", "index", "toast", "defaultRichColors", "duration", "class", "descriptionClass", "invert", "visibleToasts", "closeButton", "interacting", "position", "style", "unstyled", "classes", "cancelButtonStyle", "actionButtonStyle", "toasts", "expandByDefault", "gap", "expanded", "pauseWhenPageIsHidden", "cn"]);
|
|
737
|
+
}), 128))
|
|
738
|
+
], 16, Oe);
|
|
739
|
+
}), 128))
|
|
740
|
+
], 8, De));
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
export {
|
|
744
|
+
We as K,
|
|
745
|
+
Ue as V
|
|
746
|
+
};
|