@addsign/moje-agenda-shared-lib 2.0.11 → 2.0.13
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/Dialog-4hkwYHTJ.js +424 -0
- package/dist/Dialog-4hkwYHTJ.js.map +1 -0
- package/dist/Dialog-CrRXl-G2.js +424 -0
- package/dist/Dialog-CrRXl-G2.js.map +1 -0
- package/dist/Dialog-D9rsAQnn.js +424 -0
- package/dist/Dialog-D9rsAQnn.js.map +1 -0
- package/dist/Dialog-v5zgZE_G.js +424 -0
- package/dist/Dialog-v5zgZE_G.js.map +1 -0
- package/dist/assets/style.css +192 -0
- package/dist/components/datatable/DataTable.js +2 -1
- package/dist/components/datatable/DataTable.js.map +1 -1
- package/dist/components/datatable/DataTableServer.js +2 -1
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +2 -1
- package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBarServer.js +2 -1
- package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
- package/dist/components/form/FileInput.js +3 -2
- package/dist/components/form/FileInput.js.map +1 -1
- package/dist/components/form/FileInputMultiple.js +5 -3
- package/dist/components/form/FileInputMultiple.js.map +1 -1
- package/dist/components/form/FormField.js +2 -1
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/form/PositionsSelectorSingle.js +2 -1
- package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
- package/dist/components/form/SelectField.js +2 -1
- package/dist/components/form/SelectField.js.map +1 -1
- package/dist/components/layout/CollapsibleSection.d.ts +11 -0
- package/dist/components/layout/CollapsibleSection.js +35 -0
- package/dist/components/layout/CollapsibleSection.js.map +1 -0
- package/dist/components/profiles/ProfileOverview.js +2 -1
- package/dist/components/profiles/ProfileOverview.js.map +1 -1
- package/dist/components/ui/Combobox.js +1 -1
- package/dist/components/ui/DateTimePicker.js +35 -28
- package/dist/components/ui/DateTimePicker.js.map +1 -1
- package/dist/components/ui/Dialog.js +1 -1
- package/dist/components/ui/ScrollArea.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/command.js +2 -2
- package/dist/components/ui/datepicker.js +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/popover.js +7 -314
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/radioGroup.js +1 -1
- package/dist/components/ui/select.js +7 -5
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/sonner.d.ts +5 -0
- package/dist/components/ui/sonner.js +27 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/components/ui/toast.d.ts +15 -0
- package/dist/components/ui/toast.js +742 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/tooltip.js +4 -4
- package/dist/index-B4D9tlF2.js +37 -0
- package/dist/index-B4D9tlF2.js.map +1 -0
- package/dist/index-BIGXjoju.js +1162 -0
- package/dist/index-BIGXjoju.js.map +1 -0
- package/dist/index-BM2wqH4l.js +270 -0
- package/dist/index-BM2wqH4l.js.map +1 -0
- package/dist/index-BkUJPEGE.js +43 -0
- package/dist/index-BkUJPEGE.js.map +1 -0
- package/dist/index-BqfaqJMm.js +43 -0
- package/dist/index-BqfaqJMm.js.map +1 -0
- package/dist/index-BvG0B6Se.js +43 -0
- package/dist/index-BvG0B6Se.js.map +1 -0
- package/dist/index-ByYhNx4V.js +2204 -0
- package/dist/index-ByYhNx4V.js.map +1 -0
- package/dist/index-C1NhngpB.js +2212 -0
- package/dist/index-C1NhngpB.js.map +1 -0
- package/dist/index-C5uX_8yI.js +36 -0
- package/dist/index-C5uX_8yI.js.map +1 -0
- package/dist/index-CEVipgcd.js +234 -0
- package/dist/index-CEVipgcd.js.map +1 -0
- package/dist/index-CFdw_5ue.js +2204 -0
- package/dist/index-CFdw_5ue.js.map +1 -0
- package/dist/index-CQ3u2ZB9.js +28845 -0
- package/dist/index-CQ3u2ZB9.js.map +1 -0
- package/dist/index-CcUZ0rsE.js +2397 -0
- package/dist/index-CcUZ0rsE.js.map +1 -0
- package/dist/index-CmEWEow1.js +304 -0
- package/dist/index-CmEWEow1.js.map +1 -0
- package/dist/index-CwJgIvMz.js +43 -0
- package/dist/index-CwJgIvMz.js.map +1 -0
- package/dist/index-CxRvlMsQ.js +1162 -0
- package/dist/index-CxRvlMsQ.js.map +1 -0
- package/dist/index-Cxv2lY-3.js +234 -0
- package/dist/index-Cxv2lY-3.js.map +1 -0
- package/dist/index-CzU-7Pp-.js +1162 -0
- package/dist/index-CzU-7Pp-.js.map +1 -0
- package/dist/index-D2vw2lEy.js +2266 -0
- package/dist/index-D2vw2lEy.js.map +1 -0
- package/dist/index-D71KqwUL.js +28839 -0
- package/dist/index-D71KqwUL.js.map +1 -0
- package/dist/index-DVCdWg5e.js +36 -0
- package/dist/index-DVCdWg5e.js.map +1 -0
- package/dist/index-DWPKrsrN.js +234 -0
- package/dist/index-DWPKrsrN.js.map +1 -0
- package/dist/index-DiJxz9_S.js +36 -0
- package/dist/index-DiJxz9_S.js.map +1 -0
- package/dist/index-DjS0QG2f.js +28845 -0
- package/dist/index-DjS0QG2f.js.map +1 -0
- package/dist/index-FMLr5tN7.js +19 -0
- package/dist/index-FMLr5tN7.js.map +1 -0
- package/dist/index-GT3w9A2i.js +19 -0
- package/dist/index-GT3w9A2i.js.map +1 -0
- package/dist/index-Gbap2fMl.js +304 -0
- package/dist/index-Gbap2fMl.js.map +1 -0
- package/dist/index-R1AkuSsS.js +2204 -0
- package/dist/index-R1AkuSsS.js.map +1 -0
- package/dist/index-VCw-BbEd.js +36 -0
- package/dist/index-VCw-BbEd.js.map +1 -0
- package/dist/index-WjZKx4Rq.js +2266 -0
- package/dist/index-WjZKx4Rq.js.map +1 -0
- package/dist/index-XoubH6QK.js +19 -0
- package/dist/index-XoubH6QK.js.map +1 -0
- package/dist/index-cAAySw6z.js +19 -0
- package/dist/index-cAAySw6z.js.map +1 -0
- package/dist/index-eb1oES0O.js +234 -0
- package/dist/index-eb1oES0O.js.map +1 -0
- package/dist/index-efRbPAF9.js +304 -0
- package/dist/index-efRbPAF9.js.map +1 -0
- package/dist/index-g4PMBWfd.js +1162 -0
- package/dist/index-g4PMBWfd.js.map +1 -0
- package/dist/index-kx4d2yA2.js +2204 -0
- package/dist/index-kx4d2yA2.js.map +1 -0
- package/dist/index-tDQ16jIS.js +304 -0
- package/dist/index-tDQ16jIS.js.map +1 -0
- package/dist/index-u7IL3f7h.js +28811 -0
- package/dist/index-u7IL3f7h.js.map +1 -0
- package/dist/index.es-CORXX5Cy.js +9594 -0
- package/dist/index.es-CORXX5Cy.js.map +1 -0
- package/dist/jspdf.plugin.autotable-f-NQ-KEg.js +11475 -0
- package/dist/jspdf.plugin.autotable-f-NQ-KEg.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +21 -15
- package/dist/main.js.map +1 -1
- package/dist/popover-BtPiVBn9.js +319 -0
- package/dist/popover-BtPiVBn9.js.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/handleErrors.js +2 -1
- package/dist/utils/handleErrors.js.map +1 -1
- package/lib/components/form/FileInputMultiple.tsx +1 -0
- package/lib/components/layout/CollapsibleSection.tsx +48 -0
- package/lib/components/ui/DateTimePicker.tsx +50 -37
- package/lib/components/ui/sonner.tsx +31 -0
- package/lib/components/ui/toast.tsx +129 -0
- package/lib/main.ts +5 -0
- package/lib/types.ts +1 -0
- package/lib/utils/handleErrors.ts +2 -1
- package/package.json +4 -1
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { a as useCallbackRef, b as composeEventHandlers } from "./index-CDCkSjVs.js";
|
|
3
|
+
import { P as Primitive, d as dispatchDiscreteCustomEvent } from "./index-BqfaqJMm.js";
|
|
4
|
+
import { u as useComposedRefs } from "./index-D9mvqz1C.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
7
|
+
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
const handleKeyDown = (event) => {
|
|
10
|
+
if (event.key === "Escape") {
|
|
11
|
+
onEscapeKeyDown(event);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
15
|
+
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
16
|
+
}, [onEscapeKeyDown, ownerDocument]);
|
|
17
|
+
}
|
|
18
|
+
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
19
|
+
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
20
|
+
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
21
|
+
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
22
|
+
var originalBodyPointerEvents;
|
|
23
|
+
var DismissableLayerContext = React.createContext({
|
|
24
|
+
layers: /* @__PURE__ */ new Set(),
|
|
25
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
26
|
+
branches: /* @__PURE__ */ new Set()
|
|
27
|
+
});
|
|
28
|
+
var DismissableLayer = React.forwardRef(
|
|
29
|
+
(props, forwardedRef) => {
|
|
30
|
+
const {
|
|
31
|
+
disableOutsidePointerEvents = false,
|
|
32
|
+
onEscapeKeyDown,
|
|
33
|
+
onPointerDownOutside,
|
|
34
|
+
onFocusOutside,
|
|
35
|
+
onInteractOutside,
|
|
36
|
+
onDismiss,
|
|
37
|
+
...layerProps
|
|
38
|
+
} = props;
|
|
39
|
+
const context = React.useContext(DismissableLayerContext);
|
|
40
|
+
const [node, setNode] = React.useState(null);
|
|
41
|
+
const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
|
|
42
|
+
const [, force] = React.useState({});
|
|
43
|
+
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
44
|
+
const layers = Array.from(context.layers);
|
|
45
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
46
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
47
|
+
const index = node ? layers.indexOf(node) : -1;
|
|
48
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
49
|
+
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
50
|
+
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
51
|
+
const target = event.target;
|
|
52
|
+
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
53
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch)
|
|
54
|
+
return;
|
|
55
|
+
onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
|
|
56
|
+
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
57
|
+
if (!event.defaultPrevented)
|
|
58
|
+
onDismiss == null ? void 0 : onDismiss();
|
|
59
|
+
}, ownerDocument);
|
|
60
|
+
const focusOutside = useFocusOutside((event) => {
|
|
61
|
+
const target = event.target;
|
|
62
|
+
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
63
|
+
if (isFocusInBranch)
|
|
64
|
+
return;
|
|
65
|
+
onFocusOutside == null ? void 0 : onFocusOutside(event);
|
|
66
|
+
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
67
|
+
if (!event.defaultPrevented)
|
|
68
|
+
onDismiss == null ? void 0 : onDismiss();
|
|
69
|
+
}, ownerDocument);
|
|
70
|
+
useEscapeKeydown((event) => {
|
|
71
|
+
const isHighestLayer = index === context.layers.size - 1;
|
|
72
|
+
if (!isHighestLayer)
|
|
73
|
+
return;
|
|
74
|
+
onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
|
|
75
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
onDismiss();
|
|
78
|
+
}
|
|
79
|
+
}, ownerDocument);
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
if (!node)
|
|
82
|
+
return;
|
|
83
|
+
if (disableOutsidePointerEvents) {
|
|
84
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
85
|
+
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
86
|
+
ownerDocument.body.style.pointerEvents = "none";
|
|
87
|
+
}
|
|
88
|
+
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
89
|
+
}
|
|
90
|
+
context.layers.add(node);
|
|
91
|
+
dispatchUpdate();
|
|
92
|
+
return () => {
|
|
93
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
94
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
return () => {
|
|
100
|
+
if (!node)
|
|
101
|
+
return;
|
|
102
|
+
context.layers.delete(node);
|
|
103
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
104
|
+
dispatchUpdate();
|
|
105
|
+
};
|
|
106
|
+
}, [node, context]);
|
|
107
|
+
React.useEffect(() => {
|
|
108
|
+
const handleUpdate = () => force({});
|
|
109
|
+
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
110
|
+
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
111
|
+
}, []);
|
|
112
|
+
return /* @__PURE__ */ jsx(
|
|
113
|
+
Primitive.div,
|
|
114
|
+
{
|
|
115
|
+
...layerProps,
|
|
116
|
+
ref: composedRefs,
|
|
117
|
+
style: {
|
|
118
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
119
|
+
...props.style
|
|
120
|
+
},
|
|
121
|
+
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
122
|
+
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
123
|
+
onPointerDownCapture: composeEventHandlers(
|
|
124
|
+
props.onPointerDownCapture,
|
|
125
|
+
pointerDownOutside.onPointerDownCapture
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
132
|
+
var BRANCH_NAME = "DismissableLayerBranch";
|
|
133
|
+
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
|
134
|
+
const context = React.useContext(DismissableLayerContext);
|
|
135
|
+
const ref = React.useRef(null);
|
|
136
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
137
|
+
React.useEffect(() => {
|
|
138
|
+
const node = ref.current;
|
|
139
|
+
if (node) {
|
|
140
|
+
context.branches.add(node);
|
|
141
|
+
return () => {
|
|
142
|
+
context.branches.delete(node);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}, [context.branches]);
|
|
146
|
+
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
147
|
+
});
|
|
148
|
+
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
149
|
+
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
150
|
+
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
151
|
+
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
152
|
+
const handleClickRef = React.useRef(() => {
|
|
153
|
+
});
|
|
154
|
+
React.useEffect(() => {
|
|
155
|
+
const handlePointerDown = (event) => {
|
|
156
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
157
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
158
|
+
handleAndDispatchCustomEvent(
|
|
159
|
+
POINTER_DOWN_OUTSIDE,
|
|
160
|
+
handlePointerDownOutside,
|
|
161
|
+
eventDetail,
|
|
162
|
+
{ discrete: true }
|
|
163
|
+
);
|
|
164
|
+
};
|
|
165
|
+
const eventDetail = { originalEvent: event };
|
|
166
|
+
if (event.pointerType === "touch") {
|
|
167
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
168
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
169
|
+
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
170
|
+
} else {
|
|
171
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
172
|
+
}
|
|
173
|
+
} else {
|
|
174
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
175
|
+
}
|
|
176
|
+
isPointerInsideReactTreeRef.current = false;
|
|
177
|
+
};
|
|
178
|
+
const timerId = window.setTimeout(() => {
|
|
179
|
+
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
180
|
+
}, 0);
|
|
181
|
+
return () => {
|
|
182
|
+
window.clearTimeout(timerId);
|
|
183
|
+
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
184
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
185
|
+
};
|
|
186
|
+
}, [ownerDocument, handlePointerDownOutside]);
|
|
187
|
+
return {
|
|
188
|
+
// ensures we check React component tree (not just DOM tree)
|
|
189
|
+
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
193
|
+
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
194
|
+
const isFocusInsideReactTreeRef = React.useRef(false);
|
|
195
|
+
React.useEffect(() => {
|
|
196
|
+
const handleFocus = (event) => {
|
|
197
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
198
|
+
const eventDetail = { originalEvent: event };
|
|
199
|
+
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
200
|
+
discrete: false
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
ownerDocument.addEventListener("focusin", handleFocus);
|
|
205
|
+
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
206
|
+
}, [ownerDocument, handleFocusOutside]);
|
|
207
|
+
return {
|
|
208
|
+
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
209
|
+
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function dispatchUpdate() {
|
|
213
|
+
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
214
|
+
document.dispatchEvent(event);
|
|
215
|
+
}
|
|
216
|
+
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
217
|
+
const target = detail.originalEvent.target;
|
|
218
|
+
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
219
|
+
if (handler)
|
|
220
|
+
target.addEventListener(name, handler, { once: true });
|
|
221
|
+
if (discrete) {
|
|
222
|
+
dispatchDiscreteCustomEvent(target, event);
|
|
223
|
+
} else {
|
|
224
|
+
target.dispatchEvent(event);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
var Root = DismissableLayer;
|
|
228
|
+
var Branch = DismissableLayerBranch;
|
|
229
|
+
export {
|
|
230
|
+
Branch as B,
|
|
231
|
+
DismissableLayer as D,
|
|
232
|
+
Root as R
|
|
233
|
+
};
|
|
234
|
+
//# sourceMappingURL=index-eb1oES0O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-eb1oES0O.js","sources":["../node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs","../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs"],"sourcesContent":["// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\"keydown\", handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener(\"keydown\", handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// packages/react/dismissable-layer/src/DismissableLayer.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive, dispatchDiscreteCustomEvent } from \"@radix-ui/react-primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DISMISSABLE_LAYER_NAME = \"DismissableLayer\";\nvar CONTEXT_UPDATE = \"dismissableLayer.update\";\nvar POINTER_DOWN_OUTSIDE = \"dismissableLayer.pointerDownOutside\";\nvar FOCUS_OUTSIDE = \"dismissableLayer.focusOutside\";\nvar originalBodyPointerEvents;\nvar DismissableLayerContext = React.createContext({\n layers: /* @__PURE__ */ new Set(),\n layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),\n branches: /* @__PURE__ */ new Set()\n});\nvar DismissableLayer = React.forwardRef(\n (props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props;\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n const [, force] = React.useState({});\n const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);\n const index = node ? layers.indexOf(node) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target;\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n onPointerDownOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n const focusOutside = useFocusOutside((event) => {\n const target = event.target;\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n if (isFocusInBranch) return;\n onFocusOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n useEscapeKeydown((event) => {\n const isHighestLayer = index === context.layers.size - 1;\n if (!isHighestLayer) return;\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n }, ownerDocument);\n React.useEffect(() => {\n if (!node) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = \"none\";\n }\n context.layersWithOutsidePointerEventsDisabled.add(node);\n }\n context.layers.add(node);\n dispatchUpdate();\n return () => {\n if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {\n ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;\n }\n };\n }, [node, ownerDocument, disableOutsidePointerEvents, context]);\n React.useEffect(() => {\n return () => {\n if (!node) return;\n context.layers.delete(node);\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n dispatchUpdate();\n };\n }, [node, context]);\n React.useEffect(() => {\n const handleUpdate = () => force({});\n document.addEventListener(CONTEXT_UPDATE, handleUpdate);\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);\n }, []);\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n ...layerProps,\n ref: composedRefs,\n style: {\n pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? \"auto\" : \"none\" : void 0,\n ...props.style\n },\n onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),\n onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),\n onPointerDownCapture: composeEventHandlers(\n props.onPointerDownCapture,\n pointerDownOutside.onPointerDownCapture\n )\n }\n );\n }\n);\nDismissableLayer.displayName = DISMISSABLE_LAYER_NAME;\nvar BRANCH_NAME = \"DismissableLayerBranch\";\nvar DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {\n const context = React.useContext(DismissableLayerContext);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return () => {\n context.branches.delete(node);\n };\n }\n }, [context.branches]);\n return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });\n});\nDismissableLayerBranch.displayName = BRANCH_NAME;\nfunction usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {\n const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);\n const isPointerInsideReactTreeRef = React.useRef(false);\n const handleClickRef = React.useRef(() => {\n });\n React.useEffect(() => {\n const handlePointerDown = (event) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n let handleAndDispatchPointerDownOutsideEvent2 = function() {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true }\n );\n };\n var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;\n const eventDetail = { originalEvent: event };\n if (event.pointerType === \"touch\") {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;\n ownerDocument.addEventListener(\"click\", handleClickRef.current, { once: true });\n } else {\n handleAndDispatchPointerDownOutsideEvent2();\n }\n } else {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n }\n isPointerInsideReactTreeRef.current = false;\n };\n const timerId = window.setTimeout(() => {\n ownerDocument.addEventListener(\"pointerdown\", handlePointerDown);\n }, 0);\n return () => {\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener(\"pointerdown\", handlePointerDown);\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n };\n }, [ownerDocument, handlePointerDownOutside]);\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true\n };\n}\nfunction useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {\n const handleFocusOutside = useCallbackRef(onFocusOutside);\n const isFocusInsideReactTreeRef = React.useRef(false);\n React.useEffect(() => {\n const handleFocus = (event) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event };\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false\n });\n }\n };\n ownerDocument.addEventListener(\"focusin\", handleFocus);\n return () => ownerDocument.removeEventListener(\"focusin\", handleFocus);\n }, [ownerDocument, handleFocusOutside]);\n return {\n onFocusCapture: () => isFocusInsideReactTreeRef.current = true,\n onBlurCapture: () => isFocusInsideReactTreeRef.current = false\n };\n}\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\nfunction handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });\n if (handler) target.addEventListener(name, handler, { once: true });\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event);\n } else {\n target.dispatchEvent(event);\n }\n}\nvar Root = DismissableLayer;\nvar Branch = DismissableLayerBranch;\nexport {\n Branch,\n DismissableLayer,\n DismissableLayerBranch,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;;;AAGA,SAAS,iBAAiB,qBAAqB,gBAAgB,yCAAY,UAAU;AACnF,QAAM,kBAAkB,eAAe,mBAAmB;AAC1D,QAAM,UAAU,MAAM;AACpB,UAAM,gBAAgB,CAAC,UAAU;AAC/B,UAAI,MAAM,QAAQ,UAAU;AAC1B,wBAAgB,KAAK;AAAA,MACtB;AAAA,IACP;AACI,kBAAc,iBAAiB,WAAW,eAAe,EAAE,SAAS,KAAI,CAAE;AAC1E,WAAO,MAAM,cAAc,oBAAoB,WAAW,eAAe,EAAE,SAAS,KAAI,CAAE;AAAA,EAC9F,GAAK,CAAC,iBAAiB,aAAa,CAAC;AACrC;ACJA,IAAI,yBAAyB;AAC7B,IAAI,iBAAiB;AACrB,IAAI,uBAAuB;AAC3B,IAAI,gBAAgB;AACpB,IAAI;AACJ,IAAI,0BAA0B,MAAM,cAAc;AAAA,EAChD,QAAwB,oBAAI,IAAK;AAAA,EACjC,wCAAwD,oBAAI,IAAK;AAAA,EACjE,UAA0B,oBAAI,IAAK;AACrC,CAAC;AACE,IAAC,mBAAmB,MAAM;AAAA,EAC3B,CAAC,OAAO,iBAAiB;AACvB,UAAM;AAAA,MACJ,8BAA8B;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACJ,IAAG;AACJ,UAAM,UAAU,MAAM,WAAW,uBA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AI,CAAE;AAClE,MAAI,UAAU;AACZ,gCAA4B,QAAQ,KAAK;AAAA,EAC7C,OAAS;AACL,WAAO,cAAc,KAAK;AAAA,EAC3B;AACH;AACG,IAAC,OAAO;AACR,IAAC,SAAS;","x_google_ignoreList":[0,1]}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React__default, { forwardRef } from "react";
|
|
3
|
+
import { o as oe } from "./index-u7IL3f7h.js";
|
|
4
|
+
var L = (e, r, s, u, d, m, l, h) => {
|
|
5
|
+
let c = document.documentElement, v = ["light", "dark"];
|
|
6
|
+
function p(i) {
|
|
7
|
+
(Array.isArray(e) ? e : [e]).forEach((y) => {
|
|
8
|
+
let k = y === "class", S = k && m ? d.map((f) => m[f] || f) : d;
|
|
9
|
+
k ? (c.classList.remove(...S), c.classList.add(i)) : c.setAttribute(y, i);
|
|
10
|
+
}), R(i);
|
|
11
|
+
}
|
|
12
|
+
function R(i) {
|
|
13
|
+
h && v.includes(i) && (c.style.colorScheme = i);
|
|
14
|
+
}
|
|
15
|
+
function a() {
|
|
16
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
17
|
+
}
|
|
18
|
+
if (u)
|
|
19
|
+
p(u);
|
|
20
|
+
else
|
|
21
|
+
try {
|
|
22
|
+
let i = localStorage.getItem(r) || s, y = l && i === "system" ? a() : i;
|
|
23
|
+
p(y);
|
|
24
|
+
} catch (i) {
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var E = React.createContext(void 0), N = { setTheme: (e) => {
|
|
28
|
+
}, themes: [] }, z = () => {
|
|
29
|
+
var e;
|
|
30
|
+
return (e = React.useContext(E)) != null ? e : N;
|
|
31
|
+
};
|
|
32
|
+
React.memo(({ forcedTheme: e, storageKey: r, attribute: s, enableSystem: u, enableColorScheme: d, defaultTheme: m, value: l, themes: h, nonce: c, scriptProps: v }) => {
|
|
33
|
+
let p = JSON.stringify([s, r, m, e, h, l, u, d]).slice(1, -1);
|
|
34
|
+
return React.createElement("script", { ...v, suppressHydrationWarning: true, nonce: typeof window == "undefined" ? c : "", dangerouslySetInnerHTML: { __html: `(${L.toString()})(${p})` } });
|
|
35
|
+
});
|
|
36
|
+
var kt = (r) => {
|
|
37
|
+
switch (r) {
|
|
38
|
+
case "success":
|
|
39
|
+
return Vt;
|
|
40
|
+
case "info":
|
|
41
|
+
return Kt;
|
|
42
|
+
case "warning":
|
|
43
|
+
return Ot;
|
|
44
|
+
case "error":
|
|
45
|
+
return Jt;
|
|
46
|
+
default:
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}, Ut = Array(12).fill(0), Dt = ({ visible: r, className: o }) => React__default.createElement("div", { className: ["sonner-loading-wrapper", o].filter(Boolean).join(" "), "data-visible": r }, React__default.createElement("div", { className: "sonner-spinner" }, Ut.map((t, s) => React__default.createElement("div", { className: "sonner-loading-bar", key: `spinner-bar-${s}` })))), Vt = React__default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, React__default.createElement("path", { fillRule: "evenodd", 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", clipRule: "evenodd" })), Ot = React__default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", height: "20", width: "20" }, React__default.createElement("path", { fillRule: "evenodd", 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", clipRule: "evenodd" })), Kt = React__default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, React__default.createElement("path", { fillRule: "evenodd", 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", clipRule: "evenodd" })), Jt = React__default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, React__default.createElement("path", { fillRule: "evenodd", 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", clipRule: "evenodd" })), Ht = React__default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }, React__default.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), React__default.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" }));
|
|
50
|
+
var At = () => {
|
|
51
|
+
let [r, o] = React__default.useState(document.hidden);
|
|
52
|
+
return React__default.useEffect(() => {
|
|
53
|
+
let t = () => {
|
|
54
|
+
o(document.hidden);
|
|
55
|
+
};
|
|
56
|
+
return document.addEventListener("visibilitychange", t), () => window.removeEventListener("visibilitychange", t);
|
|
57
|
+
}, []), r;
|
|
58
|
+
};
|
|
59
|
+
var ft = 1, mt = class {
|
|
60
|
+
constructor() {
|
|
61
|
+
this.subscribe = (o) => (this.subscribers.push(o), () => {
|
|
62
|
+
let t = this.subscribers.indexOf(o);
|
|
63
|
+
this.subscribers.splice(t, 1);
|
|
64
|
+
});
|
|
65
|
+
this.publish = (o) => {
|
|
66
|
+
this.subscribers.forEach((t) => t(o));
|
|
67
|
+
};
|
|
68
|
+
this.addToast = (o) => {
|
|
69
|
+
this.publish(o), this.toasts = [...this.toasts, o];
|
|
70
|
+
};
|
|
71
|
+
this.create = (o) => {
|
|
72
|
+
var P;
|
|
73
|
+
let { message: t, ...s } = o, g = typeof (o == null ? void 0 : o.id) == "number" || ((P = o.id) == null ? void 0 : P.length) > 0 ? o.id : ft++, l = this.toasts.find((h) => h.id === g), E2 = o.dismissible === void 0 ? true : o.dismissible;
|
|
74
|
+
return l ? this.toasts = this.toasts.map((h) => h.id === g ? (this.publish({ ...h, ...o, id: g, title: t }), { ...h, ...o, id: g, dismissible: E2, title: t }) : h) : this.addToast({ title: t, ...s, dismissible: E2, id: g }), g;
|
|
75
|
+
};
|
|
76
|
+
this.dismiss = (o) => (o || this.toasts.forEach((t) => {
|
|
77
|
+
this.subscribers.forEach((s) => s({ id: t.id, dismiss: true }));
|
|
78
|
+
}), this.subscribers.forEach((t) => t({ id: o, dismiss: true })), o);
|
|
79
|
+
this.message = (o, t) => this.create({ ...t, message: o });
|
|
80
|
+
this.error = (o, t) => this.create({ ...t, message: o, type: "error" });
|
|
81
|
+
this.success = (o, t) => this.create({ ...t, type: "success", message: o });
|
|
82
|
+
this.info = (o, t) => this.create({ ...t, type: "info", message: o });
|
|
83
|
+
this.warning = (o, t) => this.create({ ...t, type: "warning", message: o });
|
|
84
|
+
this.loading = (o, t) => this.create({ ...t, type: "loading", message: o });
|
|
85
|
+
this.promise = (o, t) => {
|
|
86
|
+
if (!t)
|
|
87
|
+
return;
|
|
88
|
+
let s;
|
|
89
|
+
t.loading !== void 0 && (s = this.create({ ...t, promise: o, type: "loading", message: t.loading, description: typeof t.description != "function" ? t.description : void 0 }));
|
|
90
|
+
let g = o instanceof Promise ? o : o(), l = s !== void 0, E2, P = g.then(async (c) => {
|
|
91
|
+
if (E2 = ["resolve", c], React__default.isValidElement(c))
|
|
92
|
+
l = false, this.create({ id: s, type: "default", message: c });
|
|
93
|
+
else if (Qt(c) && !c.ok) {
|
|
94
|
+
l = false;
|
|
95
|
+
let k = typeof t.error == "function" ? await t.error(`HTTP error! status: ${c.status}`) : t.error, j = typeof t.description == "function" ? await t.description(`HTTP error! status: ${c.status}`) : t.description;
|
|
96
|
+
this.create({ id: s, type: "error", message: k, description: j });
|
|
97
|
+
} else if (t.success !== void 0) {
|
|
98
|
+
l = false;
|
|
99
|
+
let k = typeof t.success == "function" ? await t.success(c) : t.success, j = typeof t.description == "function" ? await t.description(c) : t.description;
|
|
100
|
+
this.create({ id: s, type: "success", message: k, description: j });
|
|
101
|
+
}
|
|
102
|
+
}).catch(async (c) => {
|
|
103
|
+
if (E2 = ["reject", c], t.error !== void 0) {
|
|
104
|
+
l = false;
|
|
105
|
+
let y = typeof t.error == "function" ? await t.error(c) : t.error, k = typeof t.description == "function" ? await t.description(c) : t.description;
|
|
106
|
+
this.create({ id: s, type: "error", message: y, description: k });
|
|
107
|
+
}
|
|
108
|
+
}).finally(() => {
|
|
109
|
+
var c;
|
|
110
|
+
l && (this.dismiss(s), s = void 0), (c = t.finally) == null || c.call(t);
|
|
111
|
+
}), h = () => new Promise((c, y) => P.then(() => E2[0] === "reject" ? y(E2[1]) : c(E2[1])).catch(y));
|
|
112
|
+
return typeof s != "string" && typeof s != "number" ? { unwrap: h } : Object.assign(s, { unwrap: h });
|
|
113
|
+
};
|
|
114
|
+
this.custom = (o, t) => {
|
|
115
|
+
let s = (t == null ? void 0 : t.id) || ft++;
|
|
116
|
+
return this.create({ jsx: o(s), id: s, ...t }), s;
|
|
117
|
+
};
|
|
118
|
+
this.subscribers = [], this.toasts = [];
|
|
119
|
+
}
|
|
120
|
+
}, T = new mt(), Gt = (r, o) => {
|
|
121
|
+
let t = (o == null ? void 0 : o.id) || ft++;
|
|
122
|
+
return T.addToast({ title: r, ...o, id: t }), t;
|
|
123
|
+
}, Qt = (r) => r && typeof r == "object" && "ok" in r && typeof r.ok == "boolean" && "status" in r && typeof r.status == "number", qt = Gt, Zt = () => T.toasts, te = Object.assign(qt, { success: T.success, info: T.info, warning: T.warning, error: T.error, custom: T.custom, message: T.message, promise: T.promise, dismiss: T.dismiss, loading: T.loading }, { getHistory: Zt });
|
|
124
|
+
function pt(r, { insertAt: o } = {}) {
|
|
125
|
+
if (typeof document == "undefined")
|
|
126
|
+
return;
|
|
127
|
+
let t = document.head || document.getElementsByTagName("head")[0], s = document.createElement("style");
|
|
128
|
+
s.type = "text/css", o === "top" && t.firstChild ? t.insertBefore(s, t.firstChild) : t.appendChild(s), s.styleSheet ? s.styleSheet.cssText = r : s.appendChild(document.createTextNode(r));
|
|
129
|
+
}
|
|
130
|
+
pt(`:where(html[dir="ltr"]),:where([data-sonner-toaster][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(html[dir="rtl"]),:where([data-sonner-toaster][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:none;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:translate(-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:none;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 #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}: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:none;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 #0006}: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)}:where([data-sonner-toast]) :where([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 #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([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) * .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, 0px));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{0%{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],[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],[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],[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],[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:nth-child(1){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)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{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%)}
|
|
131
|
+
`);
|
|
132
|
+
function V(r) {
|
|
133
|
+
return r.label !== void 0;
|
|
134
|
+
}
|
|
135
|
+
var ae = 3, ne = "32px", Lt = 4e3, se = 356, re = 14, ie = 20, le = 200;
|
|
136
|
+
function de(...r) {
|
|
137
|
+
return r.filter(Boolean).join(" ");
|
|
138
|
+
}
|
|
139
|
+
var ce = (r) => {
|
|
140
|
+
var xt, vt, wt, Tt, Rt, St, Et, Nt, Pt, Ct, Bt;
|
|
141
|
+
let { invert: o, toast: t, unstyled: s, interacting: g, setHeights: l, visibleToasts: E2, heights: P, index: h, toasts: c, expanded: y, removeToast: k, defaultRichColors: j, closeButton: O, style: st, cancelButtonStyle: i, actionButtonStyle: K, className: J = "", descriptionClassName: rt = "", duration: _, position: it, gap: lt, loadingIcon: X, expandByDefault: C, classNames: a, icons: N2, closeButtonAriaLabel: G = "Close toast", pauseWhenPageIsHidden: Q, cn: R } = r, [B, q] = React__default.useState(false), [U, dt] = React__default.useState(false), [M, A] = React__default.useState(false), [Z, L2] = React__default.useState(false), [Y, tt] = React__default.useState(false), [d, u] = React__default.useState(0), [b, w] = React__default.useState(0), D = React__default.useRef(t.duration || _ || Lt), f = React__default.useRef(null), H = React__default.useRef(null), et = h === 0, ot = h + 1 <= E2, x = t.type, F = t.dismissible !== false, jt = t.className || "", Yt = t.descriptionClassName || "", at = React__default.useMemo(() => P.findIndex((n) => n.toastId === t.id) || 0, [P, t.id]), Ft = React__default.useMemo(() => {
|
|
142
|
+
var n;
|
|
143
|
+
return (n = t.closeButton) != null ? n : O;
|
|
144
|
+
}, [t.closeButton, O]);
|
|
145
|
+
React__default.useMemo(() => t.duration || _ || Lt, [t.duration, _]);
|
|
146
|
+
let ct = React__default.useRef(0), $ = React__default.useRef(0), gt = React__default.useRef(0), nt = React__default.useRef(null), [ht, $t] = it.split("-"), bt = React__default.useMemo(() => P.reduce((n, m, p) => p >= at ? n : n + m.height, 0), [P, at]), yt = At(), Wt = t.invert || o, ut = x === "loading";
|
|
147
|
+
$.current = React__default.useMemo(() => at * lt + bt, [at, bt]), React__default.useEffect(() => {
|
|
148
|
+
q(true);
|
|
149
|
+
}, []), React__default.useEffect(() => {
|
|
150
|
+
let n = H.current;
|
|
151
|
+
if (n) {
|
|
152
|
+
let m = n.getBoundingClientRect().height;
|
|
153
|
+
return w(m), l((p) => [{ toastId: t.id, height: m, position: t.position }, ...p]), () => l((p) => p.filter((v) => v.toastId !== t.id));
|
|
154
|
+
}
|
|
155
|
+
}, [l, t.id]), React__default.useLayoutEffect(() => {
|
|
156
|
+
if (!B)
|
|
157
|
+
return;
|
|
158
|
+
let n = H.current, m = n.style.height;
|
|
159
|
+
n.style.height = "auto";
|
|
160
|
+
let p = n.getBoundingClientRect().height;
|
|
161
|
+
n.style.height = m, w(p), l((v) => v.find((I) => I.toastId === t.id) ? v.map((I) => I.toastId === t.id ? { ...I, height: p } : I) : [{ toastId: t.id, height: p, position: t.position }, ...v]);
|
|
162
|
+
}, [B, t.title, t.description, l, t.id]);
|
|
163
|
+
let z2 = React__default.useCallback(() => {
|
|
164
|
+
dt(true), u($.current), l((n) => n.filter((m) => m.toastId !== t.id)), setTimeout(() => {
|
|
165
|
+
k(t);
|
|
166
|
+
}, le);
|
|
167
|
+
}, [t, k, l, $]);
|
|
168
|
+
React__default.useEffect(() => {
|
|
169
|
+
if (t.promise && x === "loading" || t.duration === 1 / 0 || t.type === "loading")
|
|
170
|
+
return;
|
|
171
|
+
let n;
|
|
172
|
+
return y || g || Q && yt ? (() => {
|
|
173
|
+
if (gt.current < ct.current) {
|
|
174
|
+
let v = (/* @__PURE__ */ new Date()).getTime() - ct.current;
|
|
175
|
+
D.current = D.current - v;
|
|
176
|
+
}
|
|
177
|
+
gt.current = (/* @__PURE__ */ new Date()).getTime();
|
|
178
|
+
})() : (() => {
|
|
179
|
+
D.current !== 1 / 0 && (ct.current = (/* @__PURE__ */ new Date()).getTime(), n = setTimeout(() => {
|
|
180
|
+
var v;
|
|
181
|
+
(v = t.onAutoClose) == null || v.call(t, t), z2();
|
|
182
|
+
}, D.current));
|
|
183
|
+
})(), () => clearTimeout(n);
|
|
184
|
+
}, [y, g, t, x, Q, yt, z2]), React__default.useEffect(() => {
|
|
185
|
+
t.delete && z2();
|
|
186
|
+
}, [z2, t.delete]);
|
|
187
|
+
function _t() {
|
|
188
|
+
var n, m, p;
|
|
189
|
+
return N2 != null && N2.loading ? React__default.createElement("div", { className: R(a == null ? void 0 : a.loader, (n = t == null ? void 0 : t.classNames) == null ? void 0 : n.loader, "sonner-loader"), "data-visible": x === "loading" }, N2.loading) : X ? React__default.createElement("div", { className: R(a == null ? void 0 : a.loader, (m = t == null ? void 0 : t.classNames) == null ? void 0 : m.loader, "sonner-loader"), "data-visible": x === "loading" }, X) : React__default.createElement(Dt, { className: R(a == null ? void 0 : a.loader, (p = t == null ? void 0 : t.classNames) == null ? void 0 : p.loader), visible: x === "loading" });
|
|
190
|
+
}
|
|
191
|
+
return React__default.createElement("li", { tabIndex: 0, ref: H, className: R(J, jt, a == null ? void 0 : a.toast, (xt = t == null ? void 0 : t.classNames) == null ? void 0 : xt.toast, a == null ? void 0 : a.default, a == null ? void 0 : a[x], (vt = t == null ? void 0 : t.classNames) == null ? void 0 : vt[x]), "data-sonner-toast": "", "data-rich-colors": (wt = t.richColors) != null ? wt : j, "data-styled": !(t.jsx || t.unstyled || s), "data-mounted": B, "data-promise": !!t.promise, "data-swiped": Y, "data-removed": U, "data-visible": ot, "data-y-position": ht, "data-x-position": $t, "data-index": h, "data-front": et, "data-swiping": M, "data-dismissible": F, "data-type": x, "data-invert": Wt, "data-swipe-out": Z, "data-expanded": !!(y || C && B), style: { "--index": h, "--toasts-before": h, "--z-index": c.length - h, "--offset": `${U ? d : $.current}px`, "--initial-height": C ? "auto" : `${b}px`, ...st, ...t.style }, onPointerDown: (n) => {
|
|
192
|
+
ut || !F || (f.current = /* @__PURE__ */ new Date(), u($.current), n.target.setPointerCapture(n.pointerId), n.target.tagName !== "BUTTON" && (A(true), nt.current = { x: n.clientX, y: n.clientY }));
|
|
193
|
+
}, onPointerUp: () => {
|
|
194
|
+
var v, W, I, It;
|
|
195
|
+
if (Z || !F)
|
|
196
|
+
return;
|
|
197
|
+
nt.current = null;
|
|
198
|
+
let n = Number(((v = H.current) == null ? void 0 : v.style.getPropertyValue("--swipe-amount").replace("px", "")) || 0), m = (/* @__PURE__ */ new Date()).getTime() - ((W = f.current) == null ? void 0 : W.getTime()), p = Math.abs(n) / m;
|
|
199
|
+
if (Math.abs(n) >= ie || p > 0.11) {
|
|
200
|
+
u($.current), (I = t.onDismiss) == null || I.call(t, t), z2(), L2(true), tt(false);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
(It = H.current) == null || It.style.setProperty("--swipe-amount", "0px"), A(false);
|
|
204
|
+
}, onPointerMove: (n) => {
|
|
205
|
+
var W, I;
|
|
206
|
+
if (!nt.current || !F)
|
|
207
|
+
return;
|
|
208
|
+
let m = n.clientY - nt.current.y, p = ((W = window.getSelection()) == null ? void 0 : W.toString().length) > 0, v = ht === "top" ? Math.min(0, m) : Math.max(0, m);
|
|
209
|
+
Math.abs(v) > 0 && tt(true), !p && ((I = H.current) == null || I.style.setProperty("--swipe-amount", `${v}px`));
|
|
210
|
+
} }, Ft && !t.jsx ? React__default.createElement("button", { "aria-label": G, "data-disabled": ut, "data-close-button": true, onClick: ut || !F ? () => {
|
|
211
|
+
} : () => {
|
|
212
|
+
var n;
|
|
213
|
+
z2(), (n = t.onDismiss) == null || n.call(t, t);
|
|
214
|
+
}, className: R(a == null ? void 0 : a.closeButton, (Tt = t == null ? void 0 : t.classNames) == null ? void 0 : Tt.closeButton) }, (Rt = N2 == null ? void 0 : N2.close) != null ? Rt : Ht) : null, t.jsx || React__default.isValidElement(t.title) ? t.jsx ? t.jsx : typeof t.title == "function" ? t.title() : t.title : React__default.createElement(React__default.Fragment, null, x || t.icon || t.promise ? React__default.createElement("div", { "data-icon": "", className: R(a == null ? void 0 : a.icon, (St = t == null ? void 0 : t.classNames) == null ? void 0 : St.icon) }, t.promise || t.type === "loading" && !t.icon ? t.icon || _t() : null, t.type !== "loading" ? t.icon || (N2 == null ? void 0 : N2[x]) || kt(x) : null) : null, React__default.createElement("div", { "data-content": "", className: R(a == null ? void 0 : a.content, (Et = t == null ? void 0 : t.classNames) == null ? void 0 : Et.content) }, React__default.createElement("div", { "data-title": "", className: R(a == null ? void 0 : a.title, (Nt = t == null ? void 0 : t.classNames) == null ? void 0 : Nt.title) }, typeof t.title == "function" ? t.title() : t.title), t.description ? React__default.createElement("div", { "data-description": "", className: R(rt, Yt, a == null ? void 0 : a.description, (Pt = t == null ? void 0 : t.classNames) == null ? void 0 : Pt.description) }, typeof t.description == "function" ? t.description() : t.description) : null), React__default.isValidElement(t.cancel) ? t.cancel : t.cancel && V(t.cancel) ? React__default.createElement("button", { "data-button": true, "data-cancel": true, style: t.cancelButtonStyle || i, onClick: (n) => {
|
|
215
|
+
var m, p;
|
|
216
|
+
V(t.cancel) && F && ((p = (m = t.cancel).onClick) == null || p.call(m, n), z2());
|
|
217
|
+
}, className: R(a == null ? void 0 : a.cancelButton, (Ct = t == null ? void 0 : t.classNames) == null ? void 0 : Ct.cancelButton) }, t.cancel.label) : null, React__default.isValidElement(t.action) ? t.action : t.action && V(t.action) ? React__default.createElement("button", { "data-button": true, "data-action": true, style: t.actionButtonStyle || K, onClick: (n) => {
|
|
218
|
+
var m, p;
|
|
219
|
+
V(t.action) && ((p = (m = t.action).onClick) == null || p.call(m, n), !n.defaultPrevented && z2());
|
|
220
|
+
}, className: R(a == null ? void 0 : a.actionButton, (Bt = t == null ? void 0 : t.classNames) == null ? void 0 : Bt.actionButton) }, t.action.label) : null));
|
|
221
|
+
};
|
|
222
|
+
function zt() {
|
|
223
|
+
if (typeof window == "undefined" || typeof document == "undefined")
|
|
224
|
+
return "ltr";
|
|
225
|
+
let r = document.documentElement.getAttribute("dir");
|
|
226
|
+
return r === "auto" || !r ? window.getComputedStyle(document.documentElement).direction : r;
|
|
227
|
+
}
|
|
228
|
+
var Be = forwardRef(function(o, t) {
|
|
229
|
+
let { invert: s, position: g = "bottom-right", hotkey: l = ["altKey", "KeyT"], expand: E2, closeButton: P, className: h, offset: c, theme: y = "light", richColors: k, duration: j, style: O, visibleToasts: st = ae, toastOptions: i, dir: K = zt(), gap: J = re, loadingIcon: rt, icons: _, containerAriaLabel: it = "Notifications", pauseWhenPageIsHidden: lt, cn: X = de } = o, [C, a] = React__default.useState([]), N2 = React__default.useMemo(() => Array.from(new Set([g].concat(C.filter((d) => d.position).map((d) => d.position)))), [C, g]), [G, Q] = React__default.useState([]), [R, B] = React__default.useState(false), [q, U] = React__default.useState(false), [dt, M] = React__default.useState(y !== "system" ? y : typeof window != "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), A = React__default.useRef(null), Z = l.join("+").replace(/Key/g, "").replace(/Digit/g, ""), L2 = React__default.useRef(null), Y = React__default.useRef(false), tt = React__default.useCallback((d) => {
|
|
230
|
+
a((u) => {
|
|
231
|
+
var b;
|
|
232
|
+
return (b = u.find((w) => w.id === d.id)) != null && b.delete || T.dismiss(d.id), u.filter(({ id: w }) => w !== d.id);
|
|
233
|
+
});
|
|
234
|
+
}, []);
|
|
235
|
+
return React__default.useEffect(() => T.subscribe((d) => {
|
|
236
|
+
if (d.dismiss) {
|
|
237
|
+
a((u) => u.map((b) => b.id === d.id ? { ...b, delete: true } : b));
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
setTimeout(() => {
|
|
241
|
+
oe.flushSync(() => {
|
|
242
|
+
a((u) => {
|
|
243
|
+
let b = u.findIndex((w) => w.id === d.id);
|
|
244
|
+
return b !== -1 ? [...u.slice(0, b), { ...u[b], ...d }, ...u.slice(b + 1)] : [d, ...u];
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
}), []), React__default.useEffect(() => {
|
|
249
|
+
if (y !== "system") {
|
|
250
|
+
M(y);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (y === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? M("dark") : M("light")), typeof window == "undefined")
|
|
254
|
+
return;
|
|
255
|
+
let d = window.matchMedia("(prefers-color-scheme: dark)");
|
|
256
|
+
try {
|
|
257
|
+
d.addEventListener("change", ({ matches: u }) => {
|
|
258
|
+
M(u ? "dark" : "light");
|
|
259
|
+
});
|
|
260
|
+
} catch (u) {
|
|
261
|
+
d.addListener(({ matches: b }) => {
|
|
262
|
+
try {
|
|
263
|
+
M(b ? "dark" : "light");
|
|
264
|
+
} catch (w) {
|
|
265
|
+
console.error(w);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}, [y]), React__default.useEffect(() => {
|
|
270
|
+
C.length <= 1 && B(false);
|
|
271
|
+
}, [C]), React__default.useEffect(() => {
|
|
272
|
+
let d = (u) => {
|
|
273
|
+
var w, D;
|
|
274
|
+
l.every((f) => u[f] || u.code === f) && (B(true), (w = A.current) == null || w.focus()), u.code === "Escape" && (document.activeElement === A.current || (D = A.current) != null && D.contains(document.activeElement)) && B(false);
|
|
275
|
+
};
|
|
276
|
+
return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
|
|
277
|
+
}, [l]), React__default.useEffect(() => {
|
|
278
|
+
if (A.current)
|
|
279
|
+
return () => {
|
|
280
|
+
L2.current && (L2.current.focus({ preventScroll: true }), L2.current = null, Y.current = false);
|
|
281
|
+
};
|
|
282
|
+
}, [A.current]), React__default.createElement("section", { "aria-label": `${it} ${Z}`, tabIndex: -1, "aria-live": "polite", "aria-relevant": "additions text", "aria-atomic": "false" }, N2.map((d, u) => {
|
|
283
|
+
var D;
|
|
284
|
+
let [b, w] = d.split("-");
|
|
285
|
+
return C.length ? React__default.createElement("ol", { key: d, dir: K === "auto" ? zt() : K, tabIndex: -1, ref: A, className: h, "data-sonner-toaster": true, "data-theme": dt, "data-y-position": b, "data-lifted": R && C.length > 1 && !E2, "data-x-position": w, style: { "--front-toast-height": `${((D = G[0]) == null ? void 0 : D.height) || 0}px`, "--offset": typeof c == "number" ? `${c}px` : c || ne, "--width": `${se}px`, "--gap": `${J}px`, ...O }, onBlur: (f) => {
|
|
286
|
+
Y.current && !f.currentTarget.contains(f.relatedTarget) && (Y.current = false, L2.current && (L2.current.focus({ preventScroll: true }), L2.current = null));
|
|
287
|
+
}, onFocus: (f) => {
|
|
288
|
+
f.target instanceof HTMLElement && f.target.dataset.dismissible === "false" || Y.current || (Y.current = true, L2.current = f.relatedTarget);
|
|
289
|
+
}, onMouseEnter: () => B(true), onMouseMove: () => B(true), onMouseLeave: () => {
|
|
290
|
+
q || B(false);
|
|
291
|
+
}, onPointerDown: (f) => {
|
|
292
|
+
f.target instanceof HTMLElement && f.target.dataset.dismissible === "false" || U(true);
|
|
293
|
+
}, onPointerUp: () => U(false) }, C.filter((f) => !f.position && u === 0 || f.position === d).map((f, H) => {
|
|
294
|
+
var et, ot;
|
|
295
|
+
return React__default.createElement(ce, { key: f.id, icons: _, index: H, toast: f, defaultRichColors: k, duration: (et = i == null ? void 0 : i.duration) != null ? et : j, className: i == null ? void 0 : i.className, descriptionClassName: i == null ? void 0 : i.descriptionClassName, invert: s, visibleToasts: st, closeButton: (ot = i == null ? void 0 : i.closeButton) != null ? ot : P, interacting: q, position: d, style: i == null ? void 0 : i.style, unstyled: i == null ? void 0 : i.unstyled, classNames: i == null ? void 0 : i.classNames, cancelButtonStyle: i == null ? void 0 : i.cancelButtonStyle, actionButtonStyle: i == null ? void 0 : i.actionButtonStyle, removeToast: tt, toasts: C.filter((x) => x.position == f.position), heights: G.filter((x) => x.position == f.position), setHeights: Q, expandByDefault: E2, gap: J, loadingIcon: rt, expanded: R, pauseWhenPageIsHidden: lt, cn: X });
|
|
296
|
+
})) : null;
|
|
297
|
+
}));
|
|
298
|
+
});
|
|
299
|
+
export {
|
|
300
|
+
Be as B,
|
|
301
|
+
te as t,
|
|
302
|
+
z
|
|
303
|
+
};
|
|
304
|
+
//# sourceMappingURL=index-efRbPAF9.js.map
|