@arcadeai/design-system 5.0.2 → 5.3.0
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/{clamp-DV0oJUnl.js → CSPContext-_3HefTUC.js} +1 -6
- package/dist/{DialogRoot-xodRxCJ6.js → DialogRoot-DuiSPdsZ.js} +1 -1
- package/dist/{DialogTrigger-BRWKaMYv.js → DialogTrigger-DGGP-2Oc.js} +109 -108
- package/dist/{FloatingPortalLite-e0IaokaG.js → FloatingPortalLite-D5nFwFgJ.js} +1 -1
- package/dist/ReactStore-C3H8e2ha.js +600 -0
- package/dist/{Toggle-waFXW8db.js → Toggle-BdxyK_Ln.js} +1 -1
- package/dist/{accordion-DimUia61.js → accordion-BP9Lgkg8.js} +18 -18
- package/dist/{alert-dialog-BiDZwtP2.js → alert-dialog-1bUE2clB.js} +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/tokens.css +1 -1
- package/dist/assets/variables.css +1 -1
- package/dist/{avatar-B-lhJ-Gz.js → avatar-DbL6b01k.js} +4 -3
- package/dist/{checkbox-CZViOGvt.js → checkbox-DB9O_Iw9.js} +96 -85
- package/dist/clamp-BT4ayAnN.js +6 -0
- package/dist/{collapsible-DlF1q_cg.js → collapsible-DP7Fb-Lu.js} +17 -17
- package/dist/components/index.js +257 -251
- package/dist/components/ui/atoms/accordion.js +1 -1
- package/dist/components/ui/atoms/alert-dialog.js +1 -1
- package/dist/components/ui/atoms/avatar.js +1 -1
- package/dist/components/ui/atoms/checkbox.d.ts +16 -2
- package/dist/components/ui/atoms/checkbox.d.ts.map +1 -1
- package/dist/components/ui/atoms/checkbox.js +2 -2
- package/dist/components/ui/atoms/clear-button.d.ts +13 -0
- package/dist/components/ui/atoms/clear-button.d.ts.map +1 -0
- package/dist/components/ui/atoms/clear-button.js +23 -0
- package/dist/components/ui/atoms/collapsible.js +1 -1
- package/dist/components/ui/atoms/dialog.js +2 -2
- package/dist/components/ui/atoms/dropdown-menu.js +1 -1
- package/dist/components/ui/atoms/hover-card.js +1 -1
- package/dist/components/ui/atoms/icon-tile.d.ts +10 -0
- package/dist/components/ui/atoms/icon-tile.d.ts.map +1 -0
- package/dist/components/ui/atoms/icon-tile.js +25 -0
- package/dist/components/ui/atoms/index.d.ts +3 -1
- package/dist/components/ui/atoms/index.d.ts.map +1 -1
- package/dist/components/ui/atoms/index.js +210 -208
- package/dist/components/ui/atoms/input-group.js +1 -1
- package/dist/components/ui/atoms/input.js +1 -1
- package/dist/components/ui/atoms/mobile-tooltip.js +2 -2
- package/dist/components/ui/atoms/popover.js +1 -1
- package/dist/components/ui/atoms/progress.js +1 -1
- package/dist/components/ui/atoms/radio-group.js +1 -1
- package/dist/components/ui/atoms/scroll-area.js +1 -1
- package/dist/components/ui/atoms/scroll-button.js +1 -1
- package/dist/components/ui/atoms/scroll-to-bottom-button.d.ts +24 -0
- package/dist/components/ui/atoms/scroll-to-bottom-button.d.ts.map +1 -0
- package/dist/components/ui/atoms/scroll-to-bottom-button.js +31 -0
- package/dist/components/ui/atoms/select.js +1 -1
- package/dist/components/ui/atoms/sheet.js +2 -2
- package/dist/components/ui/atoms/sidebar.js +2 -2
- package/dist/components/ui/atoms/slider.js +1 -1
- package/dist/components/ui/atoms/switch.js +1 -1
- package/dist/components/ui/atoms/tabs.js +1 -1
- package/dist/components/ui/atoms/toggle-group.js +1 -1
- package/dist/components/ui/atoms/toggle.js +1 -1
- package/dist/components/ui/atoms/tooltip.js +1 -1
- package/dist/components/ui/blocks/demo.js +4 -4
- package/dist/components/ui/index.js +257 -251
- package/dist/components/ui/molecules/avatar-stack.d.ts +32 -0
- package/dist/components/ui/molecules/avatar-stack.d.ts.map +1 -0
- package/dist/components/ui/molecules/avatar-stack.js +91 -0
- package/dist/components/ui/molecules/callout.d.ts +20 -0
- package/dist/components/ui/molecules/callout.d.ts.map +1 -0
- package/dist/components/ui/molecules/callout.js +39 -0
- package/dist/components/ui/molecules/chat-history-item.js +1 -1
- package/dist/components/ui/molecules/chip-body.d.ts +21 -0
- package/dist/components/ui/molecules/chip-body.d.ts.map +1 -0
- package/dist/components/ui/molecules/chip-body.js +21 -0
- package/dist/components/ui/molecules/client-secret-field.js +1 -1
- package/dist/components/ui/molecules/confirm-popover.js +1 -1
- package/dist/components/ui/molecules/date-time-picker.js +2 -2
- package/dist/components/ui/molecules/filter-chip-group.d.ts +26 -0
- package/dist/components/ui/molecules/filter-chip-group.d.ts.map +1 -0
- package/dist/components/ui/molecules/{mcp-server-picker/category-filter.js → filter-chip-group.js} +8 -7
- package/dist/components/ui/molecules/index.d.ts +14 -6
- package/dist/components/ui/molecules/index.d.ts.map +1 -1
- package/dist/components/ui/molecules/index.js +39 -35
- package/dist/components/ui/molecules/mcp-server-picker/recommended-toolkits-chip.d.ts.map +1 -1
- package/dist/components/ui/molecules/mcp-server-picker/recommended-toolkits-chip.js +18 -15
- package/dist/components/ui/molecules/mcp-server-picker/recommended-tools.js +2 -2
- package/dist/components/ui/molecules/mcp-server-picker/search-scope-tabs.js +1 -1
- package/dist/components/ui/molecules/mcp-server-picker/server-avatar-stack.d.ts +1 -1
- package/dist/components/ui/molecules/mcp-server-picker/server-avatar-stack.d.ts.map +1 -1
- package/dist/components/ui/molecules/mcp-server-picker/server-avatar-stack.js +29 -81
- package/dist/components/ui/molecules/mcp-server-picker/server-card.js +1 -1
- package/dist/components/ui/molecules/mcp-server-picker/tool-card.js +1 -1
- package/dist/components/ui/molecules/mcp-server-picker/tool-recommendations.d.ts +12 -0
- package/dist/components/ui/molecules/mcp-server-picker/tool-recommendations.d.ts.map +1 -0
- package/dist/components/ui/molecules/mcp-server-picker/{tool-search-band.js → tool-recommendations.js} +6 -6
- package/dist/components/ui/molecules/mcp-server-picker/toolkit-avatar.d.ts +6 -6
- package/dist/components/ui/molecules/mcp-server-picker/toolkit-avatar.d.ts.map +1 -1
- package/dist/components/ui/molecules/mcp-server-picker/toolkit-avatar.js +21 -33
- package/dist/components/ui/molecules/mcp-server-picker/toolkit-chip.d.ts.map +1 -1
- package/dist/components/ui/molecules/mcp-server-picker/toolkit-chip.js +19 -22
- package/dist/components/ui/molecules/mcp-server-picker/unoptimized-match-card.js +1 -1
- package/dist/components/ui/molecules/message.js +2 -2
- package/dist/components/ui/molecules/prompt-input.js +1 -1
- package/dist/components/ui/molecules/removable-chip.d.ts.map +1 -0
- package/dist/components/ui/{atoms → molecules}/removable-chip.js +1 -1
- package/dist/components/ui/molecules/requirement-badges.js +1 -1
- package/dist/components/ui/molecules/tool-call-accordion.js +2 -2
- package/dist/components/ui/molecules/tool-card.js +2 -2
- package/dist/components/ui/molecules/toolkit-card.js +1 -1
- package/dist/components/ui/molecules/undo-toast.d.ts +47 -0
- package/dist/components/ui/molecules/undo-toast.d.ts.map +1 -0
- package/dist/components/ui/molecules/undo-toast.js +3 -0
- package/dist/components/ui/molecules/user-nav.js +2 -2
- package/dist/components/ui/organisms/mcp-selection-summary-bar.d.ts.map +1 -1
- package/dist/components/ui/organisms/mcp-selection-summary-bar.js +27 -30
- package/dist/{dropdown-menu-CWWN1cXs.js → dropdown-menu-ecggVuhu.js} +202 -199
- package/dist/{getPseudoElementBounds-D_dlkPnQ.js → getPseudoElementBounds-BOe22aYl.js} +3 -3
- package/dist/{hover-card-GELKDadU.js → hover-card-CGLPPPPP.js} +71 -70
- package/dist/{input-DZfZK6b1.js → input-DZTqcpe-.js} +1 -1
- package/dist/main.js +263 -257
- package/dist/metadata/oauth-providers.d.ts +2 -0
- package/dist/metadata/oauth-providers.d.ts.map +1 -1
- package/dist/metadata/oauth-providers.js +153 -141
- package/dist/{popover-Cne_hQUh.js → popover-CpLkQtT5.js} +129 -128
- package/dist/popupStateMapping-XiLS0Jku.js +643 -0
- package/dist/{progress-D71iUjvg.js → progress-BqG0PtAD.js} +1 -1
- package/dist/{radio-group-CTqA-p0w.js → radio-group-BpMluqfv.js} +8 -7
- package/dist/{safePolygon-os2F06tc.js → safePolygon-DmV1hDsw.js} +35 -34
- package/dist/{scroll-area-C0KbhRES.js → scroll-area-D7iOy7xj.js} +4 -3
- package/dist/{scrollEdges-CHZpP0us.js → scrollEdges-Dck9qFyQ.js} +1 -1
- package/dist/{select-RvAj5g6e.js → select-DFWNXxvZ.js} +179 -176
- package/dist/{slider-Bhn1ogwZ.js → slider-ClXWRpwI.js} +4 -3
- package/dist/{store-C-KXBzZ0.js → store-D7k1qIkZ.js} +23 -22
- package/dist/{switch-D8M0xvzp.js → switch-DlxZDt6o.js} +3 -3
- package/dist/{tabs-ttkDuwww.js → tabs-Cj3LY-7F.js} +9 -8
- package/dist/{toggle-group-CL_MBwuU.js → toggle-group-CmP4iHEJ.js} +1 -1
- package/dist/{tooltip-ZIywOFGf.js → tooltip-BUR7V5Aa.js} +197 -196
- package/dist/{ui-CttBuHXi.js → ui-46pgiw5T.js} +2 -2
- package/dist/undo-toast-Cf4T6ToX.js +898 -0
- package/dist/{useAnchoredPopupScrollLock-a2b_Frjv.js → useAnchoredPopupScrollLock-CnoPUwXv.js} +1 -1
- package/dist/{useAriaLabelledBy-WyUZP7Yf.js → useAriaLabelledBy-DJZioWd6.js} +1 -1
- package/dist/useBaseUiId-CXSJgVcI.js +8 -0
- package/dist/{useCollapsiblePanel-B6XZh6zH.js → useCollapsiblePanel-BPbcE70S.js} +15 -14
- package/dist/{useFocus-DwJfNYN6.js → useFocus-B_SrhX9q.js} +10 -10
- package/dist/{useBaseUiId-voePHgyX.js → useId-Bzr7_bed.js} +1 -6
- package/dist/{useLabelableId-CC2YaILf.js → useLabelableId-9jrDGk5d.js} +1 -1
- package/dist/useOpenChangeComplete-CVIwfcpl.js +80 -0
- package/dist/{useOpenInteractionType-DQhvPqO3.js → useOpenInteractionType-INvHftZi.js} +29 -28
- package/dist/{usePositioner-DkeyI5Le.js → usePositioner-CaLGGc-z.js} +98 -97
- package/dist/useTransitionStatus-CCIoL5RH.js +51 -0
- package/dist/{useTriggerFocusGuards-Qi8iK-AK.js → useTriggerFocusGuards-Dlv8KvSm.js} +7 -7
- package/package.json +1 -1
- package/dist/components/ui/atoms/removable-chip.d.ts.map +0 -1
- package/dist/components/ui/molecules/mcp-server-picker/category-filter-menu.d.ts +0 -31
- package/dist/components/ui/molecules/mcp-server-picker/category-filter-menu.d.ts.map +0 -1
- package/dist/components/ui/molecules/mcp-server-picker/category-filter-menu.js +0 -106
- package/dist/components/ui/molecules/mcp-server-picker/category-filter.d.ts +0 -18
- package/dist/components/ui/molecules/mcp-server-picker/category-filter.d.ts.map +0 -1
- package/dist/components/ui/molecules/mcp-server-picker/tool-search-band.d.ts +0 -12
- package/dist/components/ui/molecules/mcp-server-picker/tool-search-band.d.ts.map +0 -1
- package/dist/popupStateMapping-C8W76brO.js +0 -1221
- package/dist/useOpenChangeComplete-Bs6gnxd9.js +0 -127
- /package/dist/components/ui/{atoms → molecules}/removable-chip.d.ts +0 -0
|
@@ -0,0 +1,898 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "./useIsoLayoutEffect-4LGv3HzC.js";
|
|
3
|
+
import { f as t, t as n, u as r } from "./useRenderElement-BToElZ97.js";
|
|
4
|
+
import { t as i } from "./useStableCallback-CrM0Nb2q.js";
|
|
5
|
+
import { t as a } from "./useId-Bzr7_bed.js";
|
|
6
|
+
import { t as o } from "./useOnMount-Chlmm7JB.js";
|
|
7
|
+
import { a as s, t as c } from "./useOpenChangeComplete-CVIwfcpl.js";
|
|
8
|
+
import { l } from "./floating-ui.utils.dom-5U5b4xPf.js";
|
|
9
|
+
import { t as u } from "./useButton-DjF6Owsn.js";
|
|
10
|
+
import { t as d } from "./addEventListener-BlQH_qk1.js";
|
|
11
|
+
import { t as f } from "./owner-CyZnQOKt.js";
|
|
12
|
+
import { cn as p } from "./lib/utils.js";
|
|
13
|
+
import { E as m, T as h, m as g, o as _, t as v, u as y } from "./ReactStore-C3H8e2ha.js";
|
|
14
|
+
import { n as b, t as x } from "./useTimeout-B0afjWAz.js";
|
|
15
|
+
import { n as S, r as C, t as w } from "./shadowDom-BACsbimN.js";
|
|
16
|
+
import { u as ee } from "./shim-BX-2V17R.js";
|
|
17
|
+
import { t as T } from "./visuallyHidden-Cq5CW65k.js";
|
|
18
|
+
import { t as te } from "./inertValue-BhczR0H5.js";
|
|
19
|
+
import { t as E } from "./FloatingPortalLite-D5nFwFgJ.js";
|
|
20
|
+
import * as D from "react";
|
|
21
|
+
import { useCallback as O } from "react";
|
|
22
|
+
import { jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
23
|
+
import * as ne from "react-dom";
|
|
24
|
+
import { X as re } from "lucide-react";
|
|
25
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/provider/ToastProviderContext.mjs
|
|
26
|
+
var j = /*#__PURE__*/ D.createContext(void 0);
|
|
27
|
+
process.env.NODE_ENV !== "production" && (j.displayName = "ToastContext");
|
|
28
|
+
function ie() {
|
|
29
|
+
let e = D.useContext(j);
|
|
30
|
+
if (!e) throw Error(process.env.NODE_ENV === "production" ? r(73) : "Base UI: useToastManager must be used within <Toast.Provider>.");
|
|
31
|
+
return e;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region ../../node_modules/.bun/@base-ui+utils@0.3.1+fce4ea6354698f9c/node_modules/@base-ui/utils/generateId.mjs
|
|
35
|
+
var ae = 0;
|
|
36
|
+
function M(e) {
|
|
37
|
+
return ae += 1, `${e}-${Math.random().toString(36).slice(2, 6)}-${ae}`;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/utils/resolvePromiseOptions.mjs
|
|
41
|
+
function N(e, t) {
|
|
42
|
+
if (typeof e == "string") return { description: e };
|
|
43
|
+
if (typeof e == "function") {
|
|
44
|
+
let n = e(t);
|
|
45
|
+
return typeof n == "string" ? { description: n } : n;
|
|
46
|
+
}
|
|
47
|
+
return e;
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/store.mjs
|
|
51
|
+
function P(e) {
|
|
52
|
+
let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
|
|
53
|
+
return e.forEach((e, i) => {
|
|
54
|
+
let a = e.transitionStatus === "ending";
|
|
55
|
+
t.set(e.id, {
|
|
56
|
+
value: e,
|
|
57
|
+
domIndex: i,
|
|
58
|
+
visibleIndex: a ? -1 : n,
|
|
59
|
+
offsetY: r
|
|
60
|
+
}), r += e.height || 0, a || (n += 1);
|
|
61
|
+
}), t;
|
|
62
|
+
}
|
|
63
|
+
function F(e, t) {
|
|
64
|
+
let n = 0;
|
|
65
|
+
return e.map((e) => {
|
|
66
|
+
if (e.transitionStatus === "ending") return e;
|
|
67
|
+
let r = n >= t;
|
|
68
|
+
return n += 1, e.limited === r ? e : {
|
|
69
|
+
...e,
|
|
70
|
+
limited: r
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
var I = (e) => e.toastMetadata, L = {
|
|
75
|
+
toasts: _((e) => e.toasts),
|
|
76
|
+
isEmpty: _((e) => e.toasts.length === 0),
|
|
77
|
+
toast: _(I, (e, t) => e.get(t)?.value),
|
|
78
|
+
toastIndex: _(I, (e, t) => e.get(t)?.domIndex ?? -1),
|
|
79
|
+
toastOffsetY: _(I, (e, t) => e.get(t)?.offsetY ?? 0),
|
|
80
|
+
toastVisibleIndex: _(I, (e, t) => e.get(t)?.visibleIndex ?? -1),
|
|
81
|
+
hovering: _((e) => e.hovering),
|
|
82
|
+
focused: _((e) => e.focused),
|
|
83
|
+
expanded: _((e) => e.hovering || e.focused),
|
|
84
|
+
expandedOrOutOfFocus: _((e) => e.hovering || e.focused || !e.isWindowFocused),
|
|
85
|
+
prevFocusElement: _((e) => e.prevFocusElement)
|
|
86
|
+
}, R = class extends v {
|
|
87
|
+
timers = /* @__PURE__ */ new Map();
|
|
88
|
+
areTimersPaused = !1;
|
|
89
|
+
constructor(e) {
|
|
90
|
+
super({
|
|
91
|
+
...e,
|
|
92
|
+
toastMetadata: P(e.toasts)
|
|
93
|
+
}, {}, L);
|
|
94
|
+
}
|
|
95
|
+
setFocused(e) {
|
|
96
|
+
this.set("focused", e);
|
|
97
|
+
}
|
|
98
|
+
setHovering(e) {
|
|
99
|
+
this.set("hovering", e);
|
|
100
|
+
}
|
|
101
|
+
setIsWindowFocused(e) {
|
|
102
|
+
this.set("isWindowFocused", e);
|
|
103
|
+
}
|
|
104
|
+
setPrevFocusElement(e) {
|
|
105
|
+
this.set("prevFocusElement", e);
|
|
106
|
+
}
|
|
107
|
+
setViewport = (e) => {
|
|
108
|
+
this.set("viewport", e);
|
|
109
|
+
};
|
|
110
|
+
syncProviderProps(e) {
|
|
111
|
+
let t = this.state.limit !== e.limit;
|
|
112
|
+
if (this.state.timeout === e.timeout && !t) return;
|
|
113
|
+
let n = {
|
|
114
|
+
timeout: e.timeout,
|
|
115
|
+
limit: e.limit
|
|
116
|
+
};
|
|
117
|
+
if (t) {
|
|
118
|
+
let t = F(this.state.toasts, e.limit);
|
|
119
|
+
n.toasts = t, n.toastMetadata = P(t);
|
|
120
|
+
}
|
|
121
|
+
this.update(n);
|
|
122
|
+
}
|
|
123
|
+
disposeEffect = () => () => {
|
|
124
|
+
this.timers.forEach((e) => {
|
|
125
|
+
e.timeout?.clear();
|
|
126
|
+
}), this.timers.clear();
|
|
127
|
+
};
|
|
128
|
+
removeToast(e, t = {}) {
|
|
129
|
+
let n = L.toastIndex(this.state, e);
|
|
130
|
+
if (n === -1) return;
|
|
131
|
+
let r = this.state.toasts[n];
|
|
132
|
+
t.skipOnRemove || r?.onRemove?.();
|
|
133
|
+
let i = [...this.state.toasts];
|
|
134
|
+
i.splice(n, 1), this.setToasts(i);
|
|
135
|
+
}
|
|
136
|
+
addToast = (e) => {
|
|
137
|
+
let { timeout: t, limit: n } = this.state, r = e.id || M("toast");
|
|
138
|
+
if (e.id) {
|
|
139
|
+
let t = L.toast(this.state, e.id);
|
|
140
|
+
if (t) if (t.transitionStatus === "ending") this.removeToast(e.id, { skipOnRemove: !0 });
|
|
141
|
+
else {
|
|
142
|
+
let { id: t, transitionStatus: n, ...r } = e;
|
|
143
|
+
return this.updateToastInternal(e.id, r, {
|
|
144
|
+
resetTimer: !0,
|
|
145
|
+
markUpdated: !0
|
|
146
|
+
}), e.id;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
let i = {
|
|
150
|
+
...e,
|
|
151
|
+
id: r,
|
|
152
|
+
updateKey: 0,
|
|
153
|
+
transitionStatus: "starting"
|
|
154
|
+
}, a = [i, ...this.state.toasts];
|
|
155
|
+
this.setToasts(F(a, n));
|
|
156
|
+
let o = i.timeout ?? t;
|
|
157
|
+
return i.type !== "loading" && o > 0 && this.scheduleTimer(r, o, () => this.closeToast(r)), L.expandedOrOutOfFocus(this.state) && this.pauseTimers(), r;
|
|
158
|
+
};
|
|
159
|
+
updateToast = (e, t) => {
|
|
160
|
+
this.updateToastInternal(e, t, { markUpdated: !0 });
|
|
161
|
+
};
|
|
162
|
+
updateToastInternal = (e, t, n = {}) => {
|
|
163
|
+
let { timeout: r, toasts: i } = this.state, a = L.toast(this.state, e) ?? null;
|
|
164
|
+
if (!a || a.transitionStatus === "ending") return;
|
|
165
|
+
let o = {
|
|
166
|
+
...a,
|
|
167
|
+
...t,
|
|
168
|
+
...n.markUpdated && { updateKey: (a.updateKey ?? 0) + 1 }
|
|
169
|
+
};
|
|
170
|
+
this.setToasts(i.map((t) => t.id === e ? o : t));
|
|
171
|
+
let s = o.timeout ?? r, c = a?.timeout ?? r, l = Object.hasOwn(t, "timeout"), u = o.transitionStatus !== "ending" && o.type !== "loading" && s > 0, d = this.timers.has(e), f = c !== s, p = a?.type === "loading";
|
|
172
|
+
if (!u && d) {
|
|
173
|
+
this.clearTimer(e);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
u && (!d || f || l || p || n.resetTimer) && (this.clearTimer(e), this.scheduleTimer(e, s, () => this.closeToast(e)), L.expandedOrOutOfFocus(this.state) && this.pauseTimers());
|
|
177
|
+
};
|
|
178
|
+
closeToast = (e) => {
|
|
179
|
+
let t = e === void 0, { limit: n, toasts: r } = this.state, i;
|
|
180
|
+
if (t) i = r, this.clearTimers();
|
|
181
|
+
else {
|
|
182
|
+
let t = L.toast(this.state, e);
|
|
183
|
+
if (!t) return;
|
|
184
|
+
i = [t], this.clearTimer(e);
|
|
185
|
+
}
|
|
186
|
+
let a = F(r.map((n) => t || n.id === e ? {
|
|
187
|
+
...n,
|
|
188
|
+
transitionStatus: "ending",
|
|
189
|
+
height: 0
|
|
190
|
+
} : n), n), o = {
|
|
191
|
+
toasts: a,
|
|
192
|
+
toastMetadata: P(a)
|
|
193
|
+
};
|
|
194
|
+
a.some((e) => e.transitionStatus !== "ending") || (o.hovering = !1, o.focused = !1), this.update(o), i.forEach((e) => {
|
|
195
|
+
e.transitionStatus !== "ending" && e.onClose?.();
|
|
196
|
+
}), this.handleFocusManagement(e);
|
|
197
|
+
};
|
|
198
|
+
promiseToast = (e, t) => {
|
|
199
|
+
let n = N(t.loading), r = this.addToast({
|
|
200
|
+
...n,
|
|
201
|
+
type: "loading"
|
|
202
|
+
}), i = e.then((e) => {
|
|
203
|
+
let n = N(t.success, e);
|
|
204
|
+
return this.updateToast(r, {
|
|
205
|
+
...n,
|
|
206
|
+
type: "success",
|
|
207
|
+
timeout: n.timeout
|
|
208
|
+
}), e;
|
|
209
|
+
}).catch((e) => {
|
|
210
|
+
let n = N(t.error, e);
|
|
211
|
+
return this.updateToast(r, {
|
|
212
|
+
...n,
|
|
213
|
+
type: "error",
|
|
214
|
+
timeout: n.timeout
|
|
215
|
+
}), Promise.reject(e);
|
|
216
|
+
});
|
|
217
|
+
return {}.hasOwnProperty.call(t, "setPromise") && t.setPromise(i), i;
|
|
218
|
+
};
|
|
219
|
+
pauseTimers() {
|
|
220
|
+
this.areTimersPaused || (this.areTimersPaused = !0, this.timers.forEach((e) => {
|
|
221
|
+
if (e.timeout) {
|
|
222
|
+
e.timeout.clear();
|
|
223
|
+
let t = Date.now() - e.start, n = e.delay - t;
|
|
224
|
+
e.remaining = n > 0 ? n : 0;
|
|
225
|
+
}
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
228
|
+
resumeTimers() {
|
|
229
|
+
this.areTimersPaused && (this.areTimersPaused = !1, this.timers.forEach((e, t) => {
|
|
230
|
+
e.remaining = e.remaining > 0 ? e.remaining : e.delay, e.timeout ??= x.create(), e.timeout.start(e.remaining, () => {
|
|
231
|
+
this.handleTimerFired(t), e.callback();
|
|
232
|
+
}), e.start = Date.now();
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
235
|
+
restoreFocusToPrevElement() {
|
|
236
|
+
this.state.prevFocusElement?.focus({ preventScroll: !0 });
|
|
237
|
+
}
|
|
238
|
+
handleDocumentPointerDown = (e) => {
|
|
239
|
+
if (e.pointerType !== "touch") return;
|
|
240
|
+
let t = C(e);
|
|
241
|
+
S(this.state.viewport, t) || (this.resumeTimers(), this.update({
|
|
242
|
+
hovering: !1,
|
|
243
|
+
focused: !1
|
|
244
|
+
}));
|
|
245
|
+
};
|
|
246
|
+
scheduleTimer(e, t, n) {
|
|
247
|
+
let r = Date.now(), i = !L.expandedOrOutOfFocus(this.state), a = i ? x.create() : void 0;
|
|
248
|
+
a?.start(t, () => {
|
|
249
|
+
this.handleTimerFired(e), n();
|
|
250
|
+
}), this.timers.set(e, {
|
|
251
|
+
timeout: a,
|
|
252
|
+
start: i ? r : 0,
|
|
253
|
+
delay: t,
|
|
254
|
+
remaining: t,
|
|
255
|
+
callback: n
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
clearTimers() {
|
|
259
|
+
this.timers.forEach((e) => {
|
|
260
|
+
e.timeout?.clear();
|
|
261
|
+
}), this.timers.clear(), this.areTimersPaused = !1;
|
|
262
|
+
}
|
|
263
|
+
clearTimer(e) {
|
|
264
|
+
this.timers.get(e)?.timeout?.clear(), this.timers.delete(e), this.resetPausedStateIfNoTimersRemain();
|
|
265
|
+
}
|
|
266
|
+
handleTimerFired(e) {
|
|
267
|
+
this.timers.delete(e), this.resetPausedStateIfNoTimersRemain();
|
|
268
|
+
}
|
|
269
|
+
resetPausedStateIfNoTimersRemain() {
|
|
270
|
+
this.timers.size === 0 && (this.areTimersPaused = !1);
|
|
271
|
+
}
|
|
272
|
+
setToasts(e) {
|
|
273
|
+
let t = {
|
|
274
|
+
toasts: e,
|
|
275
|
+
toastMetadata: P(e)
|
|
276
|
+
};
|
|
277
|
+
e.length === 0 && (t.hovering = !1, t.focused = !1), this.update(t);
|
|
278
|
+
}
|
|
279
|
+
handleFocusManagement(e) {
|
|
280
|
+
let t = w(f(this.state.viewport));
|
|
281
|
+
if (!this.state.viewport || !S(this.state.viewport, t) || !ee(t)) return;
|
|
282
|
+
if (e === void 0) {
|
|
283
|
+
this.restoreFocusToPrevElement();
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
let n = L.toasts(this.state), r = L.toastIndex(this.state, e), i = null, a = r + 1;
|
|
287
|
+
for (; a < n.length;) {
|
|
288
|
+
if (n[a].transitionStatus !== "ending") {
|
|
289
|
+
i = n[a];
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
a += 1;
|
|
293
|
+
}
|
|
294
|
+
if (!i) for (a = r - 1; a >= 0;) {
|
|
295
|
+
if (n[a].transitionStatus !== "ending") {
|
|
296
|
+
i = n[a];
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
--a;
|
|
300
|
+
}
|
|
301
|
+
i ? i.ref?.current?.focus() : this.restoreFocusToPrevElement();
|
|
302
|
+
}
|
|
303
|
+
}, z = function(n) {
|
|
304
|
+
let { children: r, timeout: i = 5e3, limit: a = 3, toastManager: s } = n, c = t(() => new R({
|
|
305
|
+
timeout: i,
|
|
306
|
+
limit: a,
|
|
307
|
+
viewport: null,
|
|
308
|
+
toasts: [],
|
|
309
|
+
hovering: !1,
|
|
310
|
+
focused: !1,
|
|
311
|
+
isWindowFocused: !0,
|
|
312
|
+
prevFocusElement: null
|
|
313
|
+
})).current;
|
|
314
|
+
return o(c.disposeEffect), D.useEffect(function() {
|
|
315
|
+
if (s) return s[" subscribe"](({ action: e, options: t }) => {
|
|
316
|
+
let n = t.id;
|
|
317
|
+
e === "promise" && t.promise ? c.promiseToast(t.promise, t) : e === "update" && n ? c.updateToast(n, t) : e === "close" ? c.closeToast(n) : c.addToast(t);
|
|
318
|
+
});
|
|
319
|
+
}, [c, s]), e(() => {
|
|
320
|
+
c.syncProviderProps({
|
|
321
|
+
timeout: i,
|
|
322
|
+
limit: a
|
|
323
|
+
});
|
|
324
|
+
}, [
|
|
325
|
+
c,
|
|
326
|
+
i,
|
|
327
|
+
a
|
|
328
|
+
]), /*#__PURE__*/ k(j.Provider, {
|
|
329
|
+
value: c,
|
|
330
|
+
children: r
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
process.env.NODE_ENV !== "production" && (z.displayName = "ToastProvider");
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/viewport/ToastViewportCssVars.mjs
|
|
336
|
+
var B = /*#__PURE__*/ function(e) {
|
|
337
|
+
return e.frontmostHeight = "--toast-frontmost-height", e;
|
|
338
|
+
}({}), V = /*#__PURE__*/ D.forwardRef(function(e, t) {
|
|
339
|
+
let { render: r, className: i, style: a, children: o, ...s } = e, c = ie(), u = b(), p = D.useRef(!1), g = D.useRef(!1), _ = D.useRef(!1), v = c.useState("isEmpty"), y = c.useState("toasts"), x = c.useState("focused"), te = c.useState("expanded"), E = c.useState("prevFocusElement"), O = y[0]?.height ?? 0, ne = D.useMemo(() => y.some((e) => e.transitionStatus === "ending"), [y]), re = D.useMemo(() => y.filter((e) => e.priority === "high"), [y]);
|
|
340
|
+
D.useEffect(() => {
|
|
341
|
+
let e = c.state.viewport;
|
|
342
|
+
if (!e) return;
|
|
343
|
+
function t(t) {
|
|
344
|
+
v || t.key === "F6" && C(t) !== e && (t.preventDefault(), c.setPrevFocusElement(w(f(e))), e?.focus({ preventScroll: !0 }), c.pauseTimers(), c.setFocused(!0));
|
|
345
|
+
}
|
|
346
|
+
return d(l(e), "keydown", t);
|
|
347
|
+
}, [c, v]), D.useEffect(() => {
|
|
348
|
+
let e = c.state.viewport;
|
|
349
|
+
if (!e || v) return;
|
|
350
|
+
let t = l(e);
|
|
351
|
+
function n(e) {
|
|
352
|
+
C(e) === t && (c.setIsWindowFocused(!1), c.pauseTimers());
|
|
353
|
+
}
|
|
354
|
+
function r(n) {
|
|
355
|
+
if (n.relatedTarget) return;
|
|
356
|
+
let r = C(n), i = w(f(e));
|
|
357
|
+
(r === t || !S(e, r) || !ee(i)) && c.resumeTimers(), u.start(0, () => c.setIsWindowFocused(!0));
|
|
358
|
+
}
|
|
359
|
+
return m(d(t, "blur", n, !0), d(t, "focus", r, !0));
|
|
360
|
+
}, [
|
|
361
|
+
c,
|
|
362
|
+
u,
|
|
363
|
+
v
|
|
364
|
+
]), D.useEffect(() => {
|
|
365
|
+
let e = c.state.viewport;
|
|
366
|
+
if (!(!e || v)) return d(f(e), "pointerdown", c.handleDocumentPointerDown, !0);
|
|
367
|
+
}, [v, c]);
|
|
368
|
+
function j(e) {
|
|
369
|
+
let t = c.state.viewport;
|
|
370
|
+
if (t) if (p.current = !0, e.relatedTarget === t) {
|
|
371
|
+
let e = y.find((e) => e.transitionStatus !== "ending" && !e.limited);
|
|
372
|
+
e ? e.ref?.current?.focus() : c.restoreFocusToPrevElement();
|
|
373
|
+
} else c.restoreFocusToPrevElement();
|
|
374
|
+
}
|
|
375
|
+
function ae(e) {
|
|
376
|
+
e.key === "Tab" && e.shiftKey && C(e.nativeEvent) === c.state.viewport && (e.preventDefault(), c.restoreFocusToPrevElement(), c.resumeTimers());
|
|
377
|
+
}
|
|
378
|
+
function M() {
|
|
379
|
+
c.state.toasts.some((e) => e.transitionStatus === "ending") || _.current || !g.current || (c.state.isWindowFocused && c.resumeTimers(), c.setHovering(!1), g.current = !1);
|
|
380
|
+
}
|
|
381
|
+
D.useEffect(M, [ne, c]);
|
|
382
|
+
function N() {
|
|
383
|
+
c.pauseTimers(), c.setHovering(!0), g.current = !1;
|
|
384
|
+
}
|
|
385
|
+
function P() {
|
|
386
|
+
c.state.isWindowFocused && c.resumeTimers();
|
|
387
|
+
}
|
|
388
|
+
function F() {
|
|
389
|
+
c.state.toasts.some((e) => e.transitionStatus === "ending") || _.current ? g.current = !0 : (P(), c.setHovering(!1));
|
|
390
|
+
}
|
|
391
|
+
function I(e) {
|
|
392
|
+
e.pointerType === "touch" && (_.current = !0);
|
|
393
|
+
}
|
|
394
|
+
function L(e) {
|
|
395
|
+
e.pointerType === "touch" && (_.current = !1, M());
|
|
396
|
+
}
|
|
397
|
+
function R() {
|
|
398
|
+
if (p.current) {
|
|
399
|
+
p.current = !1;
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
x || ee(w(f(c.state.viewport))) && (c.setFocused(!0), c.pauseTimers());
|
|
403
|
+
}
|
|
404
|
+
function z(e) {
|
|
405
|
+
!x || S(c.state.viewport, e.relatedTarget) || (c.setFocused(!1), P());
|
|
406
|
+
}
|
|
407
|
+
let V = {
|
|
408
|
+
tabIndex: -1,
|
|
409
|
+
role: "region",
|
|
410
|
+
"aria-live": "polite",
|
|
411
|
+
"aria-atomic": !1,
|
|
412
|
+
"aria-relevant": "additions text",
|
|
413
|
+
"aria-label": "Notifications",
|
|
414
|
+
onMouseEnter: N,
|
|
415
|
+
onMouseMove: N,
|
|
416
|
+
onMouseLeave: F,
|
|
417
|
+
onFocus: R,
|
|
418
|
+
onBlur: z,
|
|
419
|
+
onKeyDown: ae,
|
|
420
|
+
onClick: R,
|
|
421
|
+
onPointerDown: I,
|
|
422
|
+
onPointerUp: L,
|
|
423
|
+
onPointerCancel: L
|
|
424
|
+
}, oe = { expanded: te }, H = n("div", e, {
|
|
425
|
+
ref: [t, c.setViewport],
|
|
426
|
+
state: oe,
|
|
427
|
+
props: [
|
|
428
|
+
V,
|
|
429
|
+
{ style: { [B.frontmostHeight]: O ? `${O}px` : void 0 } },
|
|
430
|
+
s,
|
|
431
|
+
{ children: /*#__PURE__*/ A(D.Fragment, { children: [
|
|
432
|
+
!v && E && /*#__PURE__*/ k(h, { onFocus: j }),
|
|
433
|
+
o,
|
|
434
|
+
!v && E && /*#__PURE__*/ k(h, { onFocus: j })
|
|
435
|
+
] }) }
|
|
436
|
+
]
|
|
437
|
+
});
|
|
438
|
+
return /*#__PURE__*/ A(D.Fragment, { children: [
|
|
439
|
+
!v && E && /*#__PURE__*/ k(h, { onFocus: j }),
|
|
440
|
+
H,
|
|
441
|
+
!x && re.length > 0 && /*#__PURE__*/ k("div", {
|
|
442
|
+
style: T,
|
|
443
|
+
children: re.map((e) => /*#__PURE__*/ A("div", {
|
|
444
|
+
role: "alert",
|
|
445
|
+
"aria-atomic": !0,
|
|
446
|
+
children: [/*#__PURE__*/ k("div", { children: e.title }), /*#__PURE__*/ k("div", { children: e.description })]
|
|
447
|
+
}, e.id))
|
|
448
|
+
})
|
|
449
|
+
] });
|
|
450
|
+
});
|
|
451
|
+
process.env.NODE_ENV !== "production" && (V.displayName = "ToastViewport");
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/root/ToastRootContext.mjs
|
|
454
|
+
var oe = /*#__PURE__*/ D.createContext(void 0);
|
|
455
|
+
process.env.NODE_ENV !== "production" && (oe.displayName = "ToastRootContext");
|
|
456
|
+
function H() {
|
|
457
|
+
let e = D.useContext(oe);
|
|
458
|
+
if (!e) throw Error(process.env.NODE_ENV === "production" ? r(66) : "Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.");
|
|
459
|
+
return e;
|
|
460
|
+
}
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/root/ToastRootCssVars.mjs
|
|
463
|
+
var U = /*#__PURE__*/ function(e) {
|
|
464
|
+
return e.index = "--toast-index", e.offsetY = "--toast-offset-y", e.height = "--toast-height", e.swipeMovementX = "--toast-swipe-movement-x", e.swipeMovementY = "--toast-swipe-movement-y", e;
|
|
465
|
+
}({});
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/utils/useSwipeDismiss.mjs
|
|
468
|
+
function se(e, t, n) {
|
|
469
|
+
switch (e) {
|
|
470
|
+
case "up": return -n;
|
|
471
|
+
case "down": return n;
|
|
472
|
+
case "left": return -t;
|
|
473
|
+
case "right": return t;
|
|
474
|
+
default: return 0;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function ce(e) {
|
|
478
|
+
let t = l(e).getComputedStyle(e).transform, n = 0, r = 0, i = 1;
|
|
479
|
+
if (t && t !== "none") {
|
|
480
|
+
let e = t.match(/matrix(?:3d)?\(([^)]+)\)/);
|
|
481
|
+
if (e) {
|
|
482
|
+
let t = e[1].split(", ").map(parseFloat);
|
|
483
|
+
t.length === 6 ? (n = t[4], r = t[5], i = Math.sqrt(t[0] * t[0] + t[1] * t[1])) : t.length === 16 && (n = t[12], r = t[13], i = t[0]);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
x: n,
|
|
488
|
+
y: r,
|
|
489
|
+
scale: i
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/root/ToastRoot.mjs
|
|
494
|
+
var le = {
|
|
495
|
+
...s,
|
|
496
|
+
swipeDirection(e) {
|
|
497
|
+
return e ? { "data-swipe-direction": e } : null;
|
|
498
|
+
}
|
|
499
|
+
}, ue = 40, de = 10, W = .5, fe = 1, pe = `${y},${g}`, G = /*#__PURE__*/ D.forwardRef(function(t, r) {
|
|
500
|
+
let { toast: a, render: o, className: s, swipeDirection: l = ["down", "right"], style: u, ...p } = t, m = a.positionerProps?.anchor !== void 0, h = [];
|
|
501
|
+
m || (h = Array.isArray(l) ? l : [l]);
|
|
502
|
+
let g = h.length > 0, _ = ie(), [v, y] = D.useState(void 0), [b, x] = D.useState(!1), [ee, T] = D.useState(!1), [E, O] = D.useState(!1), [A, re] = D.useState({
|
|
503
|
+
x: 0,
|
|
504
|
+
y: 0
|
|
505
|
+
}), [j, ae] = D.useState({
|
|
506
|
+
x: 0,
|
|
507
|
+
y: 0,
|
|
508
|
+
scale: 1
|
|
509
|
+
}), [M, N] = D.useState(), [P, F] = D.useState(), [I, L] = D.useState(null), R = D.useRef(null), z = D.useRef({
|
|
510
|
+
x: 0,
|
|
511
|
+
y: 0
|
|
512
|
+
}), B = D.useRef({
|
|
513
|
+
x: 0,
|
|
514
|
+
y: 0,
|
|
515
|
+
scale: 1
|
|
516
|
+
}), V = D.useRef(void 0), H = D.useRef(0), G = D.useRef(!1), K = D.useRef({
|
|
517
|
+
x: 0,
|
|
518
|
+
y: 0
|
|
519
|
+
}), q = D.useRef(!1), J = D.useRef({
|
|
520
|
+
x: 0,
|
|
521
|
+
y: 0
|
|
522
|
+
}), Y = D.useRef(null), X = D.useRef(null), me = _.useState("toastIndex", a.id), Z = _.useState("toastVisibleIndex", a.id), he = _.useState("toastOffsetY", a.id), ge = _.useState("focused"), _e = _.useState("expanded");
|
|
523
|
+
c({
|
|
524
|
+
open: a.transitionStatus !== "ending",
|
|
525
|
+
ref: R,
|
|
526
|
+
onComplete() {
|
|
527
|
+
a.transitionStatus === "ending" && _.removeToast(a.id);
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
let Q = i((e = !1) => {
|
|
531
|
+
let t = R.current;
|
|
532
|
+
if (!t) return;
|
|
533
|
+
let n = t.style.height;
|
|
534
|
+
t.style.height = "auto";
|
|
535
|
+
let r = t.offsetHeight;
|
|
536
|
+
t.style.height = n;
|
|
537
|
+
function i() {
|
|
538
|
+
_.updateToastInternal(a.id, {
|
|
539
|
+
ref: R,
|
|
540
|
+
height: r,
|
|
541
|
+
...a.transitionStatus === "starting" ? { transitionStatus: void 0 } : {}
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
e ? ne.flushSync(i) : i();
|
|
545
|
+
});
|
|
546
|
+
e(Q, [Q]);
|
|
547
|
+
function ve(e) {
|
|
548
|
+
J.current = e, re(e);
|
|
549
|
+
}
|
|
550
|
+
e(() => () => {
|
|
551
|
+
X.current?.abort();
|
|
552
|
+
}, []);
|
|
553
|
+
function ye(e, t) {
|
|
554
|
+
let n = e, r = t;
|
|
555
|
+
return !h.includes("left") && !h.includes("right") ? n = e > 0 ? e ** W : -(Math.abs(e) ** W) : (!h.includes("right") && e > 0 && (n = e ** W), !h.includes("left") && e < 0 && (n = -(Math.abs(e) ** W))), !h.includes("up") && !h.includes("down") ? r = t > 0 ? t ** W : -(Math.abs(t) ** W) : (!h.includes("down") && t > 0 && (r = t ** W), !h.includes("up") && t < 0 && (r = -(Math.abs(t) ** W))), {
|
|
556
|
+
x: n,
|
|
557
|
+
y: r
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
let be = i((e) => {
|
|
561
|
+
if (e.pointerId !== Y.current) return;
|
|
562
|
+
Y.current = null, X.current?.abort(), X.current = null, x(!1), T(!1), L(null);
|
|
563
|
+
let t = B.current;
|
|
564
|
+
if (e.type === "pointercancel" || G.current) {
|
|
565
|
+
ve({
|
|
566
|
+
x: t.x,
|
|
567
|
+
y: t.y
|
|
568
|
+
}), y(void 0);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
let n = !1, r = J.current, i = r.x - t.x, o = r.y - t.y, s;
|
|
572
|
+
for (let e of h) {
|
|
573
|
+
switch (e) {
|
|
574
|
+
case "right":
|
|
575
|
+
i > ue && (n = !0, s = "right");
|
|
576
|
+
break;
|
|
577
|
+
case "left":
|
|
578
|
+
i < -40 && (n = !0, s = "left");
|
|
579
|
+
break;
|
|
580
|
+
case "down":
|
|
581
|
+
o > ue && (n = !0, s = "down");
|
|
582
|
+
break;
|
|
583
|
+
case "up":
|
|
584
|
+
o < -40 && (n = !0, s = "up");
|
|
585
|
+
break;
|
|
586
|
+
default: break;
|
|
587
|
+
}
|
|
588
|
+
if (n) break;
|
|
589
|
+
}
|
|
590
|
+
n ? (y(s), O(!0), _.closeToast(a.id)) : (ve({
|
|
591
|
+
x: t.x,
|
|
592
|
+
y: t.y
|
|
593
|
+
}), y(void 0));
|
|
594
|
+
});
|
|
595
|
+
function xe(e) {
|
|
596
|
+
if (e.button !== 0) return;
|
|
597
|
+
e.pointerType === "touch" && _.pauseTimers();
|
|
598
|
+
let t = C(e.nativeEvent);
|
|
599
|
+
if (t && t.closest(`button,a,input,textarea,[role="button"],${pe}`)) return;
|
|
600
|
+
if (G.current = !1, V.current = void 0, H.current = 0, Y.current = e.pointerId, z.current = {
|
|
601
|
+
x: e.clientX,
|
|
602
|
+
y: e.clientY
|
|
603
|
+
}, K.current = z.current, R.current) {
|
|
604
|
+
let e = ce(R.current);
|
|
605
|
+
B.current = e, ae(e), ve({
|
|
606
|
+
x: e.x,
|
|
607
|
+
y: e.y
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
_.setHovering(!0), x(!0), T(!1), L(null), q.current = !0;
|
|
611
|
+
let n = R.current;
|
|
612
|
+
if (n) {
|
|
613
|
+
X.current?.abort();
|
|
614
|
+
let t = new AbortController();
|
|
615
|
+
X.current = t;
|
|
616
|
+
let r = f(n);
|
|
617
|
+
r.addEventListener("pointerup", be, { signal: t.signal }), r.addEventListener("pointercancel", be, { signal: t.signal }), n.setPointerCapture?.(e.pointerId);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
function Se(e) {
|
|
621
|
+
if (e.pointerId !== Y.current) return;
|
|
622
|
+
e.preventDefault(), q.current &&= (z.current = {
|
|
623
|
+
x: e.clientX,
|
|
624
|
+
y: e.clientY
|
|
625
|
+
}, !1);
|
|
626
|
+
let { clientY: t, clientX: n, movementX: r, movementY: i } = e;
|
|
627
|
+
(i < 0 && t > K.current.y || i > 0 && t < K.current.y) && (K.current = {
|
|
628
|
+
x: K.current.x,
|
|
629
|
+
y: t
|
|
630
|
+
}), (r < 0 && n > K.current.x || r > 0 && n < K.current.x) && (K.current = {
|
|
631
|
+
x: n,
|
|
632
|
+
y: K.current.y
|
|
633
|
+
});
|
|
634
|
+
let a = n - z.current.x, o = t - z.current.y, s = t - K.current.y, c = n - K.current.x;
|
|
635
|
+
if (!ee && Math.sqrt(a * a + o * o) >= fe && (T(!0), I === null)) {
|
|
636
|
+
let e = h.includes("left") || h.includes("right"), t = h.includes("up") || h.includes("down");
|
|
637
|
+
e && t && L(Math.abs(a) > Math.abs(o) ? "horizontal" : "vertical");
|
|
638
|
+
}
|
|
639
|
+
let l;
|
|
640
|
+
if (!V.current) I === "vertical" ? o > 0 ? l = "down" : o < 0 && (l = "up") : I === "horizontal" ? a > 0 ? l = "right" : a < 0 && (l = "left") : l = Math.abs(a) >= Math.abs(o) ? a > 0 ? "right" : "left" : o > 0 ? "down" : "up", l && h.includes(l) && (V.current = l, H.current = se(l, a, o), y(l));
|
|
641
|
+
else {
|
|
642
|
+
let e = V.current, t = se(e, c, s);
|
|
643
|
+
t > ue ? (G.current = !1, y(e)) : !(h.includes("left") && h.includes("right")) && !(h.includes("up") && h.includes("down")) && H.current - t >= de && (G.current = !0);
|
|
644
|
+
}
|
|
645
|
+
let u = ye(a, o), d = B.current.x, f = B.current.y;
|
|
646
|
+
I === "horizontal" ? (h.includes("left") || h.includes("right")) && (d += u.x) : (I === "vertical" || (h.includes("left") || h.includes("right")) && (d += u.x), (h.includes("up") || h.includes("down")) && (f += u.y)), ve({
|
|
647
|
+
x: d,
|
|
648
|
+
y: f
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
function Ce(e) {
|
|
652
|
+
if (e.key === "Escape") {
|
|
653
|
+
if (!R.current || !S(R.current, w(f(R.current)))) return;
|
|
654
|
+
_.closeToast(a.id);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
D.useEffect(() => {
|
|
658
|
+
if (!g) return;
|
|
659
|
+
let e = R.current;
|
|
660
|
+
if (!e) return;
|
|
661
|
+
function t(t) {
|
|
662
|
+
Y.current === null || !S(e, C(t)) || t.preventDefault();
|
|
663
|
+
}
|
|
664
|
+
return d(e, "touchmove", t, { passive: !1 });
|
|
665
|
+
}, [g]);
|
|
666
|
+
function we() {
|
|
667
|
+
if (!b && A.x === j.x && A.y === j.y && !E) return {
|
|
668
|
+
[U.swipeMovementX]: "0px",
|
|
669
|
+
[U.swipeMovementY]: "0px"
|
|
670
|
+
};
|
|
671
|
+
let e = A.x - j.x, t = A.y - j.y;
|
|
672
|
+
return {
|
|
673
|
+
transition: b ? "none" : void 0,
|
|
674
|
+
transform: b ? `translateX(${A.x}px) translateY(${A.y}px) scale(${j.scale})` : void 0,
|
|
675
|
+
[U.swipeMovementX]: `${e}px`,
|
|
676
|
+
[U.swipeMovementY]: `${t}px`
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
let Te = a.priority === "high", Ee = {
|
|
680
|
+
role: Te ? "alertdialog" : "dialog",
|
|
681
|
+
tabIndex: 0,
|
|
682
|
+
"aria-modal": !1,
|
|
683
|
+
"aria-labelledby": M,
|
|
684
|
+
"aria-describedby": P,
|
|
685
|
+
"aria-hidden": Te && !ge ? !0 : void 0,
|
|
686
|
+
onPointerDown: g ? xe : void 0,
|
|
687
|
+
onPointerMove: g ? Se : void 0,
|
|
688
|
+
onPointerUp: g ? be : void 0,
|
|
689
|
+
onPointerCancel: g ? be : void 0,
|
|
690
|
+
onKeyDown: Ce,
|
|
691
|
+
inert: te(a.limited),
|
|
692
|
+
style: {
|
|
693
|
+
...we(),
|
|
694
|
+
[U.index]: a.transitionStatus === "ending" ? me : Z,
|
|
695
|
+
[U.offsetY]: `${he}px`,
|
|
696
|
+
[U.height]: a.height ? `${a.height}px` : void 0
|
|
697
|
+
}
|
|
698
|
+
}, $ = D.useMemo(() => ({
|
|
699
|
+
rootRef: R,
|
|
700
|
+
toast: a,
|
|
701
|
+
titleId: M,
|
|
702
|
+
setTitleId: N,
|
|
703
|
+
descriptionId: P,
|
|
704
|
+
setDescriptionId: F,
|
|
705
|
+
swiping: b,
|
|
706
|
+
swipeDirection: v,
|
|
707
|
+
recalculateHeight: Q,
|
|
708
|
+
index: me,
|
|
709
|
+
visibleIndex: Z,
|
|
710
|
+
expanded: _e
|
|
711
|
+
}), [
|
|
712
|
+
a,
|
|
713
|
+
M,
|
|
714
|
+
P,
|
|
715
|
+
b,
|
|
716
|
+
v,
|
|
717
|
+
Q,
|
|
718
|
+
me,
|
|
719
|
+
Z,
|
|
720
|
+
_e
|
|
721
|
+
]), De = {
|
|
722
|
+
transitionStatus: a.transitionStatus,
|
|
723
|
+
expanded: _e,
|
|
724
|
+
limited: a.limited || !1,
|
|
725
|
+
type: a.type,
|
|
726
|
+
swiping: $.swiping,
|
|
727
|
+
swipeDirection: $.swipeDirection
|
|
728
|
+
}, Oe = n("div", t, {
|
|
729
|
+
ref: [r, $.rootRef],
|
|
730
|
+
state: De,
|
|
731
|
+
stateAttributesMapping: le,
|
|
732
|
+
props: [Ee, p]
|
|
733
|
+
});
|
|
734
|
+
return /*#__PURE__*/ k(oe.Provider, {
|
|
735
|
+
value: $,
|
|
736
|
+
children: Oe
|
|
737
|
+
});
|
|
738
|
+
});
|
|
739
|
+
process.env.NODE_ENV !== "production" && (G.displayName = "ToastRoot");
|
|
740
|
+
//#endregion
|
|
741
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/title/ToastTitle.mjs
|
|
742
|
+
var K = /*#__PURE__*/ D.forwardRef(function(t, r) {
|
|
743
|
+
let { render: i, className: o, style: s, id: c, children: l, ...u } = t, { toast: d, setTitleId: f } = H(), p = l ?? d.title, m = !!p, h = a(c);
|
|
744
|
+
e(() => {
|
|
745
|
+
if (m) return f(h), () => {
|
|
746
|
+
f(void 0);
|
|
747
|
+
};
|
|
748
|
+
}, [
|
|
749
|
+
m,
|
|
750
|
+
h,
|
|
751
|
+
f
|
|
752
|
+
]);
|
|
753
|
+
let g = n("h2", t, {
|
|
754
|
+
ref: r,
|
|
755
|
+
state: { type: d.type },
|
|
756
|
+
props: {
|
|
757
|
+
...u,
|
|
758
|
+
id: h,
|
|
759
|
+
children: p
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
return m ? g : null;
|
|
763
|
+
});
|
|
764
|
+
process.env.NODE_ENV !== "production" && (K.displayName = "ToastTitle");
|
|
765
|
+
//#endregion
|
|
766
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/close/ToastClose.mjs
|
|
767
|
+
var q = /*#__PURE__*/ D.forwardRef(function(e, t) {
|
|
768
|
+
let { render: r, className: i, style: a, disabled: o, nativeButton: s = !0, ...c } = e, l = ie(), { toast: d } = H(), f = l.useState("expanded"), [p, m] = D.useState(!1), { getButtonProps: h, buttonRef: g } = u({
|
|
769
|
+
disabled: o,
|
|
770
|
+
native: s
|
|
771
|
+
}), _ = { type: d.type };
|
|
772
|
+
return n("button", e, {
|
|
773
|
+
ref: [t, g],
|
|
774
|
+
state: _,
|
|
775
|
+
props: [
|
|
776
|
+
{
|
|
777
|
+
"aria-hidden": !f && !p,
|
|
778
|
+
onClick() {
|
|
779
|
+
l.closeToast(d.id);
|
|
780
|
+
},
|
|
781
|
+
onFocus() {
|
|
782
|
+
m(!0);
|
|
783
|
+
},
|
|
784
|
+
onBlur() {
|
|
785
|
+
m(!1);
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
c,
|
|
789
|
+
h
|
|
790
|
+
]
|
|
791
|
+
});
|
|
792
|
+
});
|
|
793
|
+
process.env.NODE_ENV !== "production" && (q.displayName = "ToastClose");
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/action/ToastAction.mjs
|
|
796
|
+
var J = /*#__PURE__*/ D.forwardRef(function(e, t) {
|
|
797
|
+
let { render: r, className: i, style: a, disabled: o, nativeButton: s = !0, ...c } = e, { toast: l } = H(), d = l.actionProps?.children ?? c.children, f = !!d, { getButtonProps: p, buttonRef: m } = u({
|
|
798
|
+
disabled: o,
|
|
799
|
+
native: s
|
|
800
|
+
}), h = { type: l.type }, g = n("button", e, {
|
|
801
|
+
ref: [t, m],
|
|
802
|
+
state: h,
|
|
803
|
+
props: [
|
|
804
|
+
c,
|
|
805
|
+
l.actionProps,
|
|
806
|
+
p,
|
|
807
|
+
{ children: d }
|
|
808
|
+
]
|
|
809
|
+
});
|
|
810
|
+
return f ? g : null;
|
|
811
|
+
});
|
|
812
|
+
process.env.NODE_ENV !== "production" && (J.displayName = "ToastAction");
|
|
813
|
+
//#endregion
|
|
814
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/portal/ToastPortal.mjs
|
|
815
|
+
var Y = E;
|
|
816
|
+
//#endregion
|
|
817
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.6.0+df7f6a806acd27ca/node_modules/@base-ui/react/toast/useToastManager.mjs
|
|
818
|
+
function X() {
|
|
819
|
+
let e = D.useContext(j);
|
|
820
|
+
if (!e) throw Error(process.env.NODE_ENV === "production" ? r(73) : "Base UI: useToastManager must be used within <Toast.Provider>.");
|
|
821
|
+
let t = e.useState("toasts");
|
|
822
|
+
return D.useMemo(() => ({
|
|
823
|
+
toasts: t,
|
|
824
|
+
add: e.addToast,
|
|
825
|
+
close: e.closeToast,
|
|
826
|
+
update: e.updateToast,
|
|
827
|
+
promise: e.promiseToast
|
|
828
|
+
}), [t, e]);
|
|
829
|
+
}
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region lib/components/ui/molecules/undo-toast.tsx
|
|
832
|
+
var me = 4e3, Z = "mcp-undo-toast";
|
|
833
|
+
function he({ children: e, container: t, className: n, dismissMs: r = me }) {
|
|
834
|
+
return /* @__PURE__ */ A(z, {
|
|
835
|
+
limit: 1,
|
|
836
|
+
timeout: r,
|
|
837
|
+
children: [e, /* @__PURE__ */ k(Y, {
|
|
838
|
+
container: t ?? void 0,
|
|
839
|
+
children: /* @__PURE__ */ k(V, {
|
|
840
|
+
className: p("pointer-events-none absolute inset-x-0 bottom-3 z-20 flex justify-center px-3", n),
|
|
841
|
+
children: /* @__PURE__ */ k(ge, { dismissMs: r })
|
|
842
|
+
})
|
|
843
|
+
})]
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
function ge({ dismissMs: e }) {
|
|
847
|
+
let { toasts: t } = X();
|
|
848
|
+
return t.map((t) => {
|
|
849
|
+
let n = t.data?.icon;
|
|
850
|
+
return /* @__PURE__ */ A(G, {
|
|
851
|
+
className: p("group pointer-events-auto relative flex w-fit max-w-full origin-bottom items-center gap-3 overflow-hidden rounded-lg bg-popover py-2 pr-2 pl-3 text-popover-foreground shadow-[var(--shadow-card-hover)] ring-1 ring-foreground/20 transition-all duration-[var(--duration-slow)] ease-[var(--ease-smooth)] data-[ending-style]:translate-y-2 data-[starting-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[starting-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 motion-reduce:transition-none dark:bg-[color-mix(in_srgb,var(--foreground)_8%,var(--popover))] dark:shadow-md dark:ring-foreground/15"),
|
|
852
|
+
toast: t,
|
|
853
|
+
children: [
|
|
854
|
+
/* @__PURE__ */ A("span", {
|
|
855
|
+
className: "flex min-w-0 items-center gap-2 text-sm",
|
|
856
|
+
children: [n, /* @__PURE__ */ k(K, { className: "truncate font-medium" })]
|
|
857
|
+
}),
|
|
858
|
+
/* @__PURE__ */ k(J, { className: "ds-focus-in shrink-0 cursor-pointer rounded-md bg-primary/20 px-2.5 py-1 font-semibold text-brand-text text-sm transition-colors hover:bg-primary hover:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 active:bg-primary/90 active:text-primary-foreground dark:text-primary dark:active:text-primary-foreground dark:hover:text-primary-foreground" }),
|
|
859
|
+
/* @__PURE__ */ k(q, {
|
|
860
|
+
"aria-label": "Dismiss",
|
|
861
|
+
className: "inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",
|
|
862
|
+
children: /* @__PURE__ */ k(re, { className: "size-3.5" })
|
|
863
|
+
}),
|
|
864
|
+
/* @__PURE__ */ k("span", {
|
|
865
|
+
"aria-hidden": !0,
|
|
866
|
+
className: "pointer-events-none absolute inset-x-0 bottom-0 h-0.5 origin-left bg-primary/40 [animation-fill-mode:forwards] [animation-name:ds-undo-countdown] [animation-timing-function:linear] motion-reduce:hidden dark:bg-primary/50 group-focus-within:[animation-play-state:paused] group-hover:[animation-play-state:paused]",
|
|
867
|
+
style: { animationDuration: `${t.timeout ?? e}ms` }
|
|
868
|
+
}, t.updateKey ?? 0)
|
|
869
|
+
]
|
|
870
|
+
}, t.id);
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
function _e() {
|
|
874
|
+
let { add: e, close: t } = X();
|
|
875
|
+
return {
|
|
876
|
+
show: O(({ message: n, icon: r, actionLabel: i = "Undo", onUndo: a, onDismiss: o, dismissMs: s }) => {
|
|
877
|
+
let c = !1;
|
|
878
|
+
return e({
|
|
879
|
+
id: Z,
|
|
880
|
+
title: n,
|
|
881
|
+
data: { icon: r },
|
|
882
|
+
timeout: s,
|
|
883
|
+
actionProps: {
|
|
884
|
+
children: i,
|
|
885
|
+
onClick: () => {
|
|
886
|
+
a(), c = !0, t(Z);
|
|
887
|
+
}
|
|
888
|
+
},
|
|
889
|
+
onClose: () => {
|
|
890
|
+
c || o?.();
|
|
891
|
+
}
|
|
892
|
+
}), Z;
|
|
893
|
+
}, [e, t]),
|
|
894
|
+
dismiss: O(() => t(Z), [t])
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
//#endregion
|
|
898
|
+
export { _e as n, he as t };
|