@conscia-labs/design-system 0.4.0 → 1.0.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/README.md +140 -26
- package/dist/card-DmBKqvj_.d.ts +49 -0
- package/dist/chunk-3UTRMJLB.js +3754 -0
- package/dist/chunk-3UTRMJLB.js.map +1 -0
- package/dist/chunk-UVKRO5ER.js +13 -0
- package/dist/chunk-UVKRO5ER.js.map +1 -0
- package/dist/{chunk-KYH7IZ3Z.js → chunk-WEI3PU4A.js} +668 -390
- package/dist/chunk-WEI3PU4A.js.map +1 -0
- package/dist/chunk-YAJUTCGD.js +26719 -0
- package/dist/chunk-YAJUTCGD.js.map +1 -0
- package/dist/foundation/index.js +1 -0
- package/dist/foundation.css +146 -172
- package/dist/index.d.ts +16 -14
- package/dist/index.js +97 -6
- package/dist/patterns/index.d.ts +54 -14
- package/dist/patterns/index.js +7 -2
- package/dist/primitives/index.d.ts +206 -82
- package/dist/primitives/index.js +92 -5
- package/dist/standalone.css +1 -1
- package/dist/styles.css +146 -172
- package/dist/utils/index.js +1 -0
- package/package.json +8 -16
- package/dist/card-BFUHJgV-.d.ts +0 -24
- package/dist/chunk-C44RGLGF.js +0 -723
- package/dist/chunk-C44RGLGF.js.map +0 -1
- package/dist/chunk-KYH7IZ3Z.js.map +0 -1
- package/dist/chunk-RAGHGWLB.js +0 -957
- package/dist/chunk-RAGHGWLB.js.map +0 -1
|
@@ -0,0 +1,3754 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BASE_UI_SWIPE_IGNORE_SELECTOR,
|
|
3
|
+
BasePopupHandle,
|
|
4
|
+
Button,
|
|
5
|
+
CLICK_TRIGGER_IDENTIFIER,
|
|
6
|
+
COMPOSITE_KEYS,
|
|
7
|
+
Card,
|
|
8
|
+
CardContent,
|
|
9
|
+
CardDescription,
|
|
10
|
+
CardFooter,
|
|
11
|
+
CardHeader,
|
|
12
|
+
CardTitle,
|
|
13
|
+
Checkbox,
|
|
14
|
+
EMPTY_OBJECT,
|
|
15
|
+
FOCUSABLE_POPUP_PROPS,
|
|
16
|
+
FloatingFocusManager,
|
|
17
|
+
FloatingNode,
|
|
18
|
+
FloatingPortal,
|
|
19
|
+
FloatingPortalLite,
|
|
20
|
+
FloatingTree,
|
|
21
|
+
FocusGuard,
|
|
22
|
+
IconButton,
|
|
23
|
+
Input,
|
|
24
|
+
InternalBackdrop,
|
|
25
|
+
LEGACY_SWIPE_IGNORE_SELECTOR,
|
|
26
|
+
NOOP,
|
|
27
|
+
NullStore,
|
|
28
|
+
PATIENT_CLICK_THRESHOLD,
|
|
29
|
+
POPUP_COLLISION_AVOIDANCE,
|
|
30
|
+
PopupHandleAttachment,
|
|
31
|
+
PopupTriggerMap,
|
|
32
|
+
ReactStore,
|
|
33
|
+
Select,
|
|
34
|
+
SelectContent,
|
|
35
|
+
SelectGroup,
|
|
36
|
+
SelectItem,
|
|
37
|
+
SelectTrigger,
|
|
38
|
+
SelectValue,
|
|
39
|
+
Table,
|
|
40
|
+
TableBody,
|
|
41
|
+
TableCell,
|
|
42
|
+
TableHead,
|
|
43
|
+
TableHeader,
|
|
44
|
+
TableRow,
|
|
45
|
+
Timeout,
|
|
46
|
+
activeElement,
|
|
47
|
+
addEventListener,
|
|
48
|
+
attachPreventUnmountOnClose,
|
|
49
|
+
contains,
|
|
50
|
+
createChangeEventDetails,
|
|
51
|
+
createDefaultInitialFocus,
|
|
52
|
+
createInitialPopupStoreState,
|
|
53
|
+
createPopupFloatingRootContext,
|
|
54
|
+
dispatchClickWithModifiers,
|
|
55
|
+
fieldValidityMapping,
|
|
56
|
+
getDisabledMountTransitionStyles,
|
|
57
|
+
getDisplacement,
|
|
58
|
+
getElementTransform,
|
|
59
|
+
getTarget,
|
|
60
|
+
getWindow,
|
|
61
|
+
index_parts_exports,
|
|
62
|
+
inertValue,
|
|
63
|
+
isElement,
|
|
64
|
+
isHTMLElement,
|
|
65
|
+
matchesFocusVisible,
|
|
66
|
+
mergeCleanups,
|
|
67
|
+
ownerDocument,
|
|
68
|
+
popupStateMapping,
|
|
69
|
+
popupStoreSelectors,
|
|
70
|
+
popupTransitionStateMapping,
|
|
71
|
+
popupViewportStateMapping,
|
|
72
|
+
pressableTriggerOpenStateMapping,
|
|
73
|
+
reason_parts_exports,
|
|
74
|
+
safePolygon,
|
|
75
|
+
setPopupOpenState,
|
|
76
|
+
transitionStatusMapping,
|
|
77
|
+
triggerOpenStateMapping,
|
|
78
|
+
useAnchorPositioning,
|
|
79
|
+
useAnchoredPopupScrollLock,
|
|
80
|
+
useAnimationsFinished,
|
|
81
|
+
useAriaLabelledBy,
|
|
82
|
+
useBaseUiId,
|
|
83
|
+
useButton,
|
|
84
|
+
useClick,
|
|
85
|
+
useControlled,
|
|
86
|
+
useDismiss,
|
|
87
|
+
useFieldRootContext,
|
|
88
|
+
useFloatingNodeId,
|
|
89
|
+
useFloatingRootContext,
|
|
90
|
+
useFormContext,
|
|
91
|
+
useHoverFloatingInteraction,
|
|
92
|
+
useHoverReferenceInteraction,
|
|
93
|
+
useId,
|
|
94
|
+
useImplicitActiveTrigger,
|
|
95
|
+
useIsoLayoutEffect,
|
|
96
|
+
useLabelableContext,
|
|
97
|
+
useLabelableId,
|
|
98
|
+
useMergedRefs,
|
|
99
|
+
useOnMount,
|
|
100
|
+
useOpenChangeComplete,
|
|
101
|
+
useOpenMethodTriggerProps,
|
|
102
|
+
useOpenStateTransitions,
|
|
103
|
+
usePopupHandleStore,
|
|
104
|
+
usePopupInteractionProps,
|
|
105
|
+
usePopupRootStore,
|
|
106
|
+
usePopupRootSync,
|
|
107
|
+
usePopupViewport,
|
|
108
|
+
usePositioner,
|
|
109
|
+
useRefWithInit,
|
|
110
|
+
useRegisterFieldControl,
|
|
111
|
+
useRenderElement,
|
|
112
|
+
useStableCallback,
|
|
113
|
+
useTimeout,
|
|
114
|
+
useToolbarRootContext,
|
|
115
|
+
useTriggerDataForwarding,
|
|
116
|
+
useTriggerFocusGuards,
|
|
117
|
+
useValueChanged,
|
|
118
|
+
visuallyHidden,
|
|
119
|
+
visuallyHiddenInput
|
|
120
|
+
} from "./chunk-YAJUTCGD.js";
|
|
121
|
+
import {
|
|
122
|
+
cn
|
|
123
|
+
} from "./chunk-JU5DQXFC.js";
|
|
124
|
+
import {
|
|
125
|
+
__export,
|
|
126
|
+
__publicField
|
|
127
|
+
} from "./chunk-UVKRO5ER.js";
|
|
128
|
+
|
|
129
|
+
// src/primitives/alert.tsx
|
|
130
|
+
import * as React from "react";
|
|
131
|
+
import { cva } from "class-variance-authority";
|
|
132
|
+
import { jsx } from "react/jsx-runtime";
|
|
133
|
+
var AlertContext = React.createContext(null);
|
|
134
|
+
var alertVariants = cva(
|
|
135
|
+
"relative grid w-full grid-cols-[auto_1fr] items-start gap-x-3 rounded-[var(--ds-radius-surface)] border px-4 py-3.5 text-sm [&>svg]:mt-0.5 [&>svg]:size-5",
|
|
136
|
+
{
|
|
137
|
+
variants: {
|
|
138
|
+
variant: {
|
|
139
|
+
default: "border-border-default bg-surface text-text-primary",
|
|
140
|
+
information: "border-information-border bg-information-background text-information-foreground",
|
|
141
|
+
success: "border-success-border bg-success-background text-success-foreground",
|
|
142
|
+
warning: "border-warning-border bg-warning-background text-warning-foreground",
|
|
143
|
+
danger: "border-danger-border bg-danger-background text-danger-foreground"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
defaultVariants: {
|
|
147
|
+
variant: "default"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
function Alert({
|
|
152
|
+
children,
|
|
153
|
+
className,
|
|
154
|
+
variant,
|
|
155
|
+
role = "group",
|
|
156
|
+
"aria-labelledby": ariaLabelledby,
|
|
157
|
+
"aria-describedby": ariaDescribedby,
|
|
158
|
+
...props
|
|
159
|
+
}) {
|
|
160
|
+
const baseId = React.useId();
|
|
161
|
+
const titleId = `${baseId}-title`;
|
|
162
|
+
const descriptionId = `${baseId}-description`;
|
|
163
|
+
const [registeredTitleId, setRegisteredTitleId] = React.useState();
|
|
164
|
+
const [registeredDescriptionId, setRegisteredDescriptionId] = React.useState();
|
|
165
|
+
const registerTitle = React.useCallback((id) => setRegisteredTitleId(id), []);
|
|
166
|
+
const registerDescription = React.useCallback((id) => setRegisteredDescriptionId(id), []);
|
|
167
|
+
return /* @__PURE__ */ jsx(AlertContext.Provider, { value: { titleId, descriptionId, hasTitle: Boolean(registeredTitleId), hasDescription: Boolean(registeredDescriptionId), registerTitle, registerDescription }, children: /* @__PURE__ */ jsx(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
"data-slot": "alert",
|
|
171
|
+
role,
|
|
172
|
+
"aria-labelledby": ariaLabelledby ?? registeredTitleId,
|
|
173
|
+
"aria-describedby": ariaDescribedby ?? registeredDescriptionId,
|
|
174
|
+
className: cn(alertVariants({ variant }), className),
|
|
175
|
+
...props,
|
|
176
|
+
children
|
|
177
|
+
}
|
|
178
|
+
) });
|
|
179
|
+
}
|
|
180
|
+
function AlertTitle({ className, ...props }) {
|
|
181
|
+
const context = React.useContext(AlertContext);
|
|
182
|
+
const id = props.id ?? context?.titleId;
|
|
183
|
+
React.useEffect(() => {
|
|
184
|
+
if (id) context?.registerTitle(id);
|
|
185
|
+
}, [context, id]);
|
|
186
|
+
return /* @__PURE__ */ jsx(
|
|
187
|
+
"div",
|
|
188
|
+
{
|
|
189
|
+
"data-slot": "alert-title",
|
|
190
|
+
id,
|
|
191
|
+
className: cn("font-medium leading-5", className),
|
|
192
|
+
...props
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
function AlertDescription({ className, ...props }) {
|
|
197
|
+
const context = React.useContext(AlertContext);
|
|
198
|
+
const id = props.id ?? context?.descriptionId;
|
|
199
|
+
React.useEffect(() => {
|
|
200
|
+
if (id) context?.registerDescription(id);
|
|
201
|
+
}, [context, id]);
|
|
202
|
+
return /* @__PURE__ */ jsx(
|
|
203
|
+
"div",
|
|
204
|
+
{
|
|
205
|
+
"data-slot": "alert-description",
|
|
206
|
+
id,
|
|
207
|
+
className: cn("col-start-2 mt-0.5 text-sm leading-5 opacity-80", className),
|
|
208
|
+
...props
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// src/primitives/avatar.tsx
|
|
214
|
+
import * as React2 from "react";
|
|
215
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
216
|
+
var useAvatarEffect = typeof window === "undefined" ? React2.useEffect : React2.useLayoutEffect;
|
|
217
|
+
var AvatarContext = React2.createContext(null);
|
|
218
|
+
function useAvatarContext() {
|
|
219
|
+
const context = React2.useContext(AvatarContext);
|
|
220
|
+
if (!context) {
|
|
221
|
+
throw new Error("AvatarImage and AvatarFallback must be used inside Avatar.");
|
|
222
|
+
}
|
|
223
|
+
return context;
|
|
224
|
+
}
|
|
225
|
+
function Avatar({
|
|
226
|
+
children,
|
|
227
|
+
className,
|
|
228
|
+
...props
|
|
229
|
+
}) {
|
|
230
|
+
const [status, setStatus] = React2.useState("idle");
|
|
231
|
+
return /* @__PURE__ */ jsx2(AvatarContext.Provider, { value: { status, setStatus }, children: /* @__PURE__ */ jsx2("div", { "data-slot": "avatar", className: cn("relative flex size-8 shrink-0 overflow-hidden rounded-full", className), ...props, children }) });
|
|
232
|
+
}
|
|
233
|
+
function AvatarImage({
|
|
234
|
+
alt = "",
|
|
235
|
+
className,
|
|
236
|
+
onError,
|
|
237
|
+
onLoad,
|
|
238
|
+
src,
|
|
239
|
+
...props
|
|
240
|
+
}) {
|
|
241
|
+
const { status, setStatus } = useAvatarContext();
|
|
242
|
+
useAvatarEffect(() => {
|
|
243
|
+
setStatus(src ? "loading" : "error");
|
|
244
|
+
}, [src, setStatus]);
|
|
245
|
+
return (
|
|
246
|
+
// The library must use a framework-neutral image element rather than Next's Image component.
|
|
247
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
248
|
+
/* @__PURE__ */ jsx2(
|
|
249
|
+
"img",
|
|
250
|
+
{
|
|
251
|
+
"data-slot": "avatar-image",
|
|
252
|
+
className: cn("aspect-square size-full", status === "loaded" ? "" : "hidden", className),
|
|
253
|
+
alt,
|
|
254
|
+
src,
|
|
255
|
+
...props,
|
|
256
|
+
onLoad: (event) => {
|
|
257
|
+
setStatus("loaded");
|
|
258
|
+
onLoad?.(event);
|
|
259
|
+
},
|
|
260
|
+
onError: (event) => {
|
|
261
|
+
setStatus("error");
|
|
262
|
+
onError?.(event);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
function AvatarFallback({
|
|
269
|
+
className,
|
|
270
|
+
...props
|
|
271
|
+
}) {
|
|
272
|
+
const { status } = useAvatarContext();
|
|
273
|
+
return /* @__PURE__ */ jsx2("div", { "data-slot": "avatar-fallback", className: cn("flex size-full items-center justify-center rounded-full bg-surface-muted text-xs font-medium text-text-supporting", status === "loaded" ? "hidden" : "", className), ...props });
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// src/primitives/avatar-group.tsx
|
|
277
|
+
import * as React3 from "react";
|
|
278
|
+
import { jsxs } from "react/jsx-runtime";
|
|
279
|
+
function AvatarGroup({
|
|
280
|
+
children,
|
|
281
|
+
className,
|
|
282
|
+
max,
|
|
283
|
+
size = "default",
|
|
284
|
+
total,
|
|
285
|
+
...props
|
|
286
|
+
}) {
|
|
287
|
+
const avatars = React3.Children.toArray(children);
|
|
288
|
+
const visibleCount = max === void 0 ? avatars.length : Math.max(0, Math.floor(max));
|
|
289
|
+
const visibleAvatars = avatars.slice(0, visibleCount);
|
|
290
|
+
const totalCount = Math.max(avatars.length, total ?? avatars.length);
|
|
291
|
+
const overflowCount = Math.max(0, totalCount - visibleAvatars.length);
|
|
292
|
+
return /* @__PURE__ */ jsxs(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
"data-slot": "avatar-group",
|
|
296
|
+
"data-size": size,
|
|
297
|
+
className: cn(
|
|
298
|
+
"flex items-center [&>[data-slot=avatar]]:relative [&>[data-slot=avatar]]:z-0 [&>[data-slot=avatar]]:shrink-0 [&>[data-slot=avatar]]:ring-2 [&>[data-slot=avatar]]:ring-canvas [&>[data-slot=avatar]]:transition-[margin,z-index] hover:[&>[data-slot=avatar]]:z-10 data-[size=default]:gap-0 data-[size=default]:[&>[data-slot=avatar]]:-ml-2 data-[size=default]:[&>[data-slot=avatar]]:size-8 data-[size=lg]:gap-0 data-[size=lg]:[&>[data-slot=avatar]]:-ml-2.5 data-[size=lg]:[&>[data-slot=avatar]]:size-10 data-[size=sm]:gap-0 data-[size=sm]:[&>[data-slot=avatar]]:-ml-1.5 data-[size=sm]:[&>[data-slot=avatar]]:size-6 [&>[data-slot=avatar]:first-child]:ml-0",
|
|
299
|
+
className
|
|
300
|
+
),
|
|
301
|
+
role: "group",
|
|
302
|
+
...props,
|
|
303
|
+
children: [
|
|
304
|
+
visibleAvatars,
|
|
305
|
+
overflowCount > 0 ? /* @__PURE__ */ jsxs(
|
|
306
|
+
"span",
|
|
307
|
+
{
|
|
308
|
+
"data-slot": "avatar-group-overflow",
|
|
309
|
+
className: "relative z-0 inline-flex shrink-0 items-center justify-center rounded-full border-2 border-canvas bg-surface-muted font-medium text-text-supporting data-[size=default]:-ml-2 data-[size=default]:size-8 data-[size=default]:text-xs data-[size=lg]:-ml-2.5 data-[size=lg]:size-10 data-[size=lg]:text-sm data-[size=sm]:-ml-1.5 data-[size=sm]:size-6 data-[size=sm]:text-[0.625rem]",
|
|
310
|
+
"aria-label": `${overflowCount} more ${overflowCount === 1 ? "avatar" : "avatars"}`,
|
|
311
|
+
title: `${overflowCount} more ${overflowCount === 1 ? "avatar" : "avatars"}`,
|
|
312
|
+
children: [
|
|
313
|
+
"+",
|
|
314
|
+
overflowCount
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
) : null
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// src/primitives/badge.tsx
|
|
324
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
325
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
326
|
+
var badgeVariants = cva2(
|
|
327
|
+
"inline-flex items-center rounded-md border px-1.5 py-0.5 text-[var(--ds-metadata)] font-medium leading-4 transition-colors",
|
|
328
|
+
{
|
|
329
|
+
variants: {
|
|
330
|
+
variant: {
|
|
331
|
+
default: "border-action bg-action text-action-foreground",
|
|
332
|
+
accent: "border-selection-border bg-selection-background text-selection-foreground",
|
|
333
|
+
secondary: "border-neutral-border bg-neutral-background text-neutral-foreground",
|
|
334
|
+
neutral: "border-neutral-border bg-neutral-background text-neutral-foreground",
|
|
335
|
+
outline: "border-border-default text-text-primary",
|
|
336
|
+
information: "border-information-border bg-information-background text-information-foreground",
|
|
337
|
+
info: "border-information-border bg-information-background text-information-foreground",
|
|
338
|
+
success: "border-success-border bg-success-background text-success-foreground",
|
|
339
|
+
warning: "border-warning-border bg-warning-background text-warning-foreground",
|
|
340
|
+
danger: "border-danger-border bg-danger-background text-danger-foreground",
|
|
341
|
+
destructive: "border-danger-border bg-danger-background text-danger-foreground"
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
defaultVariants: {
|
|
345
|
+
variant: "neutral"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
);
|
|
349
|
+
function Badge({
|
|
350
|
+
className,
|
|
351
|
+
variant,
|
|
352
|
+
...props
|
|
353
|
+
}) {
|
|
354
|
+
return /* @__PURE__ */ jsx3("span", { "data-slot": "badge", className: cn(badgeVariants({ variant, className })), ...props });
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// src/primitives/brand-icon.tsx
|
|
358
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
359
|
+
var CONSCIA_SYMBOL_PATH = [
|
|
360
|
+
"M171.225 63.8139L173.637 66.1116L203.794 34.4551L201.382 32.1575L171.225 63.8139Z",
|
|
361
|
+
"M184.012 78.9693L185.769 81.8487L223.091 59.076L221.334 56.1966L184.012 78.9693Z",
|
|
362
|
+
"M192.436 96.8858L193.417 100.222L235.362 87.8847L234.381 84.5488L192.436 96.8858Z",
|
|
363
|
+
"M195.949 116.334L196.037 119.987L239.746 118.926L239.657 115.273L195.949 116.334Z",
|
|
364
|
+
"M194.341 135.989L193.42 139.796L235.913 150.084L236.835 146.277L194.341 135.989Z",
|
|
365
|
+
"M187.759 154.526L185.708 158.285L224.091 179.221L226.142 175.461L187.759 154.526Z",
|
|
366
|
+
"M176.683 170.712L173.394 174.165L205.05 204.322L208.34 200.868L176.683 170.712Z",
|
|
367
|
+
"M161.899 183.49L157.288 186.304L180.06 223.626L184.672 220.812L161.899 183.49Z",
|
|
368
|
+
"M144.425 192.058L138.472 193.809L150.809 235.754L156.762 234.003L144.425 192.058Z",
|
|
369
|
+
"M125.438 195.913L118.244 196.088L119.305 239.796L126.499 239.622L125.438 195.913Z",
|
|
370
|
+
"M106.176 194.873L98.0421 192.903L87.754 235.397L95.8882 237.366L106.176 194.873Z",
|
|
371
|
+
"M87.8408 189.056L79.3505 184.425L58.4147 222.808L66.905 227.439L87.8408 189.056Z",
|
|
372
|
+
"M71.5444 178.838L63.5819 171.253L33.4252 202.91L41.3878 210.495L71.5444 178.838Z",
|
|
373
|
+
"M58.2896 164.821L51.9185 154.379L14.5961 177.152L20.9672 187.593L58.2896 164.821Z",
|
|
374
|
+
"M48.9443 147.836L45.1912 135.075L3.24659 147.412L6.99972 160.173L48.9443 147.836Z",
|
|
375
|
+
"M44.1724 128.938L43.8283 114.759L0.119827 115.82L0.463868 129.998L44.1724 128.938Z",
|
|
376
|
+
"M44.3613 109.352L47.8648 94.8809L5.37116 84.5928L1.86766 99.0635L44.3613 109.352Z",
|
|
377
|
+
"M49.563 90.3812L56.9571 76.825L18.5742 55.8893L11.18 69.4455L49.563 90.3812Z",
|
|
378
|
+
"M59.4839 73.314L70.4267 61.8269L38.7702 31.6703L27.8274 43.1574L59.4839 73.314Z",
|
|
379
|
+
"M73.4951 59.3251L87.307 50.8976L64.5343 13.5752L50.7224 22.0027L73.4951 59.3251Z",
|
|
380
|
+
"M90.6772 49.3891L106.414 44.7604L94.0775 2.81575L78.3402 7.44453L90.6772 49.3891Z",
|
|
381
|
+
"M109.88 44.2086L126.426 43.8071L125.366 0.098614L108.82 0.500089L109.88 44.2086Z",
|
|
382
|
+
"M129.802 44.1632L145.967 48.0768L156.255 5.58318L140.09 1.66954L129.802 44.1632Z",
|
|
383
|
+
"M149.087 49.2798L163.709 57.2553L184.645 18.8723L170.023 10.8969L149.087 49.2798Z",
|
|
384
|
+
"M152.448 160.384L141.06 167.332L154.089 188.685L165.477 181.736L152.448 160.384Z",
|
|
385
|
+
"M140.881 167.41L128.103 171.168L135.161 195.165L147.939 191.407L140.881 167.41Z",
|
|
386
|
+
"M127.834 171.202L114.653 171.522L115.26 196.528L128.441 196.209L127.834 171.202Z",
|
|
387
|
+
"M114.192 171.456L101.624 168.413L95.738 192.724L108.306 195.767L114.192 171.456Z",
|
|
388
|
+
"M100.907 168.109L89.889 162.1L77.9114 184.059L88.9296 190.069L100.907 168.109Z",
|
|
389
|
+
"M88.9224 161.353L80.2035 153.047L62.9505 171.158L71.6694 179.464L88.9224 161.353Z",
|
|
390
|
+
"M79.1143 151.631L73.1721 141.893L51.8195 154.921L57.7617 164.66L79.1143 151.631Z",
|
|
391
|
+
"M72.2163 139.615L69.2075 129.385L45.2105 136.444L48.2193 146.673L72.2163 139.615Z",
|
|
392
|
+
"M68.7593 126.163L68.5209 116.339L43.5147 116.946L43.7531 126.77L68.7593 126.163Z",
|
|
393
|
+
"M69.0161 112.256L71.1176 103.576L46.8064 97.6899L44.7049 106.37L69.0161 112.256Z",
|
|
394
|
+
"M72.979 98.9209L76.8146 91.8888L54.8552 79.9112L51.0196 86.9432L72.979 98.9209Z",
|
|
395
|
+
"M80.3506 87.1414L85.2494 81.999L67.1383 64.746L62.2395 69.8884L80.3506 87.1414Z",
|
|
396
|
+
"M90.5762 77.7753L95.9023 74.5255L82.8738 53.1729L77.5476 56.4227L90.5762 77.7753Z",
|
|
397
|
+
"M102.889 71.4875L108.114 69.9508L101.056 45.9537L95.831 47.4905L102.889 71.4875Z",
|
|
398
|
+
"M116.381 68.7043L121.119 68.5894L120.513 43.5832L115.775 43.6981L116.381 68.7043Z",
|
|
399
|
+
"M130.08 69.5886L134.092 70.56L139.978 46.2488L135.966 45.2775L130.08 69.5886Z",
|
|
400
|
+
"M143.01 74.0389L146.183 75.7697L158.161 53.8103L154.988 52.0795L143.01 74.0389Z",
|
|
401
|
+
"M154.273 81.705L156.588 83.9108L173.841 65.7997L171.526 63.5939L154.273 81.705Z",
|
|
402
|
+
"M163.102 92.0197L164.599 94.4735L185.952 81.445L184.455 78.9911L163.102 92.0197Z",
|
|
403
|
+
"M168.91 104.243L169.655 106.775L193.652 99.7164L192.907 97.1844L168.91 104.243Z",
|
|
404
|
+
"M171.325 117.515L171.386 120.001L196.392 119.394L196.331 116.909L171.325 117.515Z",
|
|
405
|
+
"M170.21 130.922L169.644 133.264L193.955 139.15L194.522 136.808L170.21 130.922Z",
|
|
406
|
+
"M165.673 143.549L164.523 145.658L186.482 157.636L187.633 155.527L165.673 143.549Z",
|
|
407
|
+
"M158.032 154.558L156.355 156.318L174.467 173.571L176.143 171.811L158.032 154.558Z"
|
|
408
|
+
].join(" ");
|
|
409
|
+
function BrandIcon({
|
|
410
|
+
"aria-label": ariaLabel,
|
|
411
|
+
className,
|
|
412
|
+
...props
|
|
413
|
+
}) {
|
|
414
|
+
return /* @__PURE__ */ jsx4(
|
|
415
|
+
"svg",
|
|
416
|
+
{
|
|
417
|
+
"data-slot": "brand-icon",
|
|
418
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
419
|
+
width: "240",
|
|
420
|
+
height: "240",
|
|
421
|
+
viewBox: "0 0 240 240",
|
|
422
|
+
fill: "none",
|
|
423
|
+
focusable: "false",
|
|
424
|
+
role: ariaLabel ? "img" : void 0,
|
|
425
|
+
"aria-hidden": ariaLabel ? void 0 : true,
|
|
426
|
+
"aria-label": ariaLabel,
|
|
427
|
+
className: cn("size-6 shrink-0 text-text-primary dark:text-white", className),
|
|
428
|
+
...props,
|
|
429
|
+
children: /* @__PURE__ */ jsx4("path", { d: CONSCIA_SYMBOL_PATH, fill: "currentColor" })
|
|
430
|
+
}
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// src/primitives/brand-wordmark.tsx
|
|
435
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
436
|
+
var CONSCIA_WORDMARK_PATH = [
|
|
437
|
+
"M485.154 47.9722V40.929H495.867V90.529H485.154V83.3866C481.086 89.041 475.333 91.8186 467.794 91.8186C460.949 91.8186 455.195 89.3386 450.334 84.2794C445.474 79.2202 443.093 72.9706 443.093 65.729C443.093 58.3882 445.474 52.2378 450.334 47.1786C455.195 42.1194 460.949 39.6394 467.794 39.6394C475.333 39.6394 481.086 42.417 485.154 47.9722ZM458.27 77.137C461.246 80.113 465.016 81.601 469.48 81.601C473.944 81.601 477.714 80.113 480.69 77.137C483.666 74.0618 485.154 70.2922 485.154 65.729C485.154 61.1658 483.666 57.3962 480.69 54.4202C477.714 51.345 473.944 49.857 469.48 49.857C465.016 49.857 461.246 51.345 458.27 54.4202C455.294 57.3962 453.806 61.1658 453.806 65.729C453.806 70.2922 455.294 74.0618 458.27 77.137Z",
|
|
438
|
+
"M436.308 31.5049C433.63 34.1833 429.463 34.1833 426.686 31.5049C424.007 28.7273 424.007 24.5609 426.686 21.8825C429.364 19.1049 433.729 19.1049 436.407 21.8825C439.086 24.5609 439.086 28.7273 436.308 31.5049ZM436.903 90.5288H426.19V40.9289H436.903V90.5288Z",
|
|
439
|
+
"M399.598 91.8186C392.158 91.8186 385.909 89.3386 380.85 84.2794C375.89 79.2202 373.41 73.0698 373.41 65.729C373.41 58.289 375.89 52.1386 380.85 47.1786C385.909 42.1194 392.158 39.6394 399.598 39.6394C409.221 39.6394 417.752 44.5994 421.72 52.4362L412.494 57.793C410.213 53.0314 405.451 50.1546 399.499 50.1546C395.134 50.1546 391.464 51.6426 388.488 54.6186C385.611 57.5946 384.123 61.265 384.123 65.729C384.123 70.193 385.611 73.8634 388.488 76.8394C391.464 79.8154 395.134 81.3034 399.499 81.3034C405.352 81.3034 410.312 78.3274 412.693 73.665L421.918 78.9226C417.653 86.8586 409.221 91.8186 399.598 91.8186Z",
|
|
440
|
+
"M344.816 54.6186C344.816 57.8922 348.982 59.5786 354.141 61.0666C361.779 62.753 371.699 65.9274 371.501 76.5418C371.501 81.3034 369.616 85.073 365.945 87.7514C362.275 90.4298 357.712 91.8186 352.157 91.8186C342.336 91.8186 335.094 87.4538 331.92 80.2122L341.146 74.8554C342.832 79.617 346.502 81.9978 352.157 81.9978C357.811 81.9978 360.589 80.113 360.589 76.4426C360.589 73.2682 356.422 71.3834 351.165 70.0938C343.725 68.209 333.706 65.233 333.904 54.817C333.904 50.2538 335.59 46.5834 339.062 43.8058C342.534 41.0282 346.899 39.6394 352.058 39.6394C360.291 39.6394 366.937 43.5082 370.409 49.9562L361.382 55.0154C359.696 51.2458 356.522 49.361 352.058 49.361C347.99 49.361 344.816 51.1466 344.816 54.6186Z",
|
|
441
|
+
"M308.082 39.6394C319.49 39.6394 327.129 47.377 327.129 60.0746V90.529H316.415V61.1658C316.415 53.7258 312.149 49.6586 305.305 49.6586C297.765 49.6586 292.706 54.321 292.706 63.9434V90.529H281.993V40.929H292.706V47.2778C295.98 42.2186 301.039 39.6394 308.082 39.6394Z",
|
|
442
|
+
"M249.588 91.8186C242.347 91.8186 236.097 89.3386 231.038 84.2794C225.979 79.2202 223.399 73.0698 223.399 65.729C223.399 58.3882 225.979 52.2378 231.038 47.1786C236.097 42.1194 242.347 39.6394 249.588 39.6394C256.929 39.6394 263.079 42.1194 268.139 47.1786C273.198 52.2378 275.777 58.3882 275.777 65.729C275.777 73.0698 273.198 79.2202 268.139 84.2794C263.079 89.3386 256.929 91.8186 249.588 91.8186ZM238.577 76.9386C241.553 79.9146 245.223 81.4026 249.588 81.4026C253.953 81.4026 257.623 79.9146 260.599 76.9386C263.575 73.9626 265.063 70.193 265.063 65.729C265.063 61.265 263.575 57.4954 260.599 54.5194C257.623 51.5434 253.953 50.0554 249.588 50.0554C245.223 50.0554 241.553 51.5434 238.577 54.5194C235.601 57.4954 234.113 61.265 234.113 65.729C234.113 70.193 235.601 73.9626 238.577 76.9386Z",
|
|
443
|
+
"M191.106 91.8184C180.69 91.8184 171.96 88.3464 165.116 81.5017C158.271 74.5577 154.799 66.0265 154.799 55.8089C154.799 45.5913 158.271 37.0601 165.116 30.2153C171.96 23.2713 180.69 19.7993 191.106 19.7993C203.704 19.7993 215.013 26.1481 220.965 36.3657L211.045 42.1193C207.375 35.2745 199.836 30.9097 191.106 30.9097C183.666 30.9097 177.714 33.2905 173.052 37.9529C168.488 42.6153 166.207 48.5673 166.207 55.8089C166.207 63.0505 168.488 69.0025 173.052 73.6649C177.714 78.3273 183.666 80.7081 191.106 80.7081C199.836 80.7081 207.474 76.3433 211.045 69.4985L220.965 75.1529C218.088 80.2121 213.922 84.2793 208.565 87.3544C203.308 90.3304 197.455 91.8184 191.106 91.8184Z",
|
|
444
|
+
"M80.3374 30.1243L81.463 31.1965L95.536 16.4235L94.4105 15.3512L80.3374 30.1243Z",
|
|
445
|
+
"M86.3032 37.1965L87.1231 38.5402L104.54 27.913L103.72 26.5693L86.3032 37.1965Z",
|
|
446
|
+
"M90.2339 45.5579L90.6918 47.1146L110.266 41.3573L109.808 39.8006L90.2339 45.5579Z",
|
|
447
|
+
"M91.8765 54.6333L91.9179 56.3381L112.315 55.8431L112.274 54.1384L91.8765 54.6333Z",
|
|
448
|
+
"M91.1245 63.8054L90.6944 65.582L110.525 70.3832L110.955 68.6065L91.1245 63.8054Z",
|
|
449
|
+
"M88.0532 72.4561L87.0963 74.2104L105.008 83.9804L105.965 82.2261L88.0532 72.4561Z",
|
|
450
|
+
"M82.8853 80.0098L81.3501 81.6213L96.1232 95.6944L97.6583 94.0829L82.8853 80.0098Z",
|
|
451
|
+
"M75.9854 85.9727L73.8334 87.2857L84.4606 104.703L86.6126 103.39L75.9854 85.9727Z",
|
|
452
|
+
"M67.8301 89.9714L65.0521 90.7885L70.8094 110.363L73.5873 109.546L67.8301 89.9714Z",
|
|
453
|
+
"M58.9707 91.7705L55.6136 91.852L56.1085 112.249L59.4656 112.168L58.9707 91.7705Z",
|
|
454
|
+
"M49.9814 91.2849L46.1855 90.3659L41.3844 110.196L45.1803 111.115L49.9814 91.2849Z",
|
|
455
|
+
"M41.4253 88.5703L37.4631 86.4092L27.6931 104.321L31.6553 106.482L41.4253 88.5703Z",
|
|
456
|
+
"M33.8188 83.8022L30.103 80.2624L16.0299 95.0355L19.7458 98.5753L33.8188 83.8022Z",
|
|
457
|
+
"M27.6348 77.2605L24.6616 72.3878L7.24451 83.015L10.2177 87.8878L27.6348 77.2605Z",
|
|
458
|
+
"M23.271 69.334L21.5195 63.3792L1.94538 69.1364L3.69684 75.0912L23.271 69.334Z",
|
|
459
|
+
"M21.0474 60.5151L20.8868 53.8985L0.489511 54.3934L0.650063 61.0101L21.0474 60.5151Z",
|
|
460
|
+
"M21.1338 51.3752L22.7688 44.6222L2.93837 39.8211L1.30341 46.5741L21.1338 51.3752Z",
|
|
461
|
+
"M23.5605 42.522L27.0111 36.1957L9.09909 26.4258L5.6485 32.752L23.5605 42.522Z",
|
|
462
|
+
"M28.1909 34.5574L33.2976 29.1967L18.5246 15.1236L13.4179 20.4843L28.1909 34.5574Z",
|
|
463
|
+
"M34.7305 28.0295L41.176 24.0967L30.5488 6.67961L24.1032 10.6124L34.7305 28.0295Z",
|
|
464
|
+
"M42.749 23.3923L50.0931 21.2323L44.3358 1.65808L36.9918 3.81818L42.749 23.3923Z",
|
|
465
|
+
"M51.7109 20.9749L59.4323 20.7875L58.9373 0.390197L51.216 0.577552L51.7109 20.9749Z",
|
|
466
|
+
"M61.0078 20.9536L68.5512 22.78L73.3523 2.9496L65.8089 1.12323L61.0078 20.9536Z",
|
|
467
|
+
"M70.0063 23.3413L76.83 27.0632L86.6 9.15115L79.7764 5.42926L70.0063 23.3413Z",
|
|
468
|
+
"M71.5737 75.1902L66.2594 78.4328L72.3393 88.3974L77.6537 85.1547L71.5737 75.1902Z",
|
|
469
|
+
"M66.1782 78.4688L60.2153 80.2226L63.5091 91.4212L69.472 89.6674L66.1782 78.4688Z",
|
|
470
|
+
"M60.0874 80.2388L53.9362 80.388L54.2193 92.0576L60.3706 91.9083L60.0874 80.2388Z",
|
|
471
|
+
"M53.7231 80.3569L47.8581 78.937L45.1113 90.2822L50.9764 91.7021L53.7231 80.3569Z",
|
|
472
|
+
"M47.5229 78.7954L42.3811 75.9908L36.7916 86.2386L41.9334 89.0431L47.5229 78.7954Z",
|
|
473
|
+
"M41.9287 75.6421L37.8599 71.7661L29.8085 80.2179L33.8773 84.0939L41.9287 75.6421Z",
|
|
474
|
+
"M37.3511 71.1057L34.578 66.561L24.6135 72.641L27.3865 77.1857L37.3511 71.1057Z",
|
|
475
|
+
"M34.1333 65.498L32.7292 60.7242L21.5306 64.0181L22.9347 68.7918L34.1333 65.498Z",
|
|
476
|
+
"M32.52 59.2202L32.4088 54.6358L20.7392 54.9189L20.8505 59.5034L32.52 59.2202Z",
|
|
477
|
+
"M32.6411 52.7302L33.6218 48.6797L22.2766 45.9329L21.2959 49.9834L32.6411 52.7302Z",
|
|
478
|
+
"M34.4888 46.5073L36.2787 43.2257L26.031 37.6361L24.241 40.9178L34.4888 46.5073Z",
|
|
479
|
+
"M37.9297 41.0103L40.2158 38.6105L31.7639 30.5591L29.4779 32.9589L37.9297 41.0103Z",
|
|
480
|
+
"M42.7012 36.6394L45.1867 35.1228L39.1067 25.1583L36.6212 26.6749L42.7012 36.6394Z",
|
|
481
|
+
"M48.4478 33.7051L50.8861 32.9879L47.5923 21.7893L45.1539 22.5064L48.4478 33.7051Z",
|
|
482
|
+
"M54.7437 32.4062L56.9548 32.3526L56.6716 20.683L54.4605 20.7367L54.7437 32.4062Z",
|
|
483
|
+
"M61.1377 32.8188L63.01 33.2721L65.7568 21.9269L63.8845 21.4736L61.1377 32.8188Z",
|
|
484
|
+
"M67.1694 34.8958L68.6503 35.7035L74.2398 25.4557L72.759 24.648L67.1694 34.8958Z",
|
|
485
|
+
"M72.4282 38.4731L73.5088 39.5025L81.5602 31.0507L80.4796 30.0213L72.4282 38.4731Z",
|
|
486
|
+
"M76.5459 43.2869L77.2446 44.432L87.2092 38.352L86.5104 37.2069L76.5459 43.2869Z",
|
|
487
|
+
"M79.2554 48.9905L79.6029 50.1721L90.8015 46.8783L90.454 45.6967L79.2554 48.9905Z",
|
|
488
|
+
"M80.3833 55.1848L80.4114 56.3446L92.081 56.0615L92.0528 54.9017L80.3833 55.1848Z",
|
|
489
|
+
"M79.8657 61.4412L79.6012 62.5339L90.9464 65.2807L91.2109 64.188L79.8657 61.4412Z",
|
|
490
|
+
"M77.7466 67.3337L77.2096 68.3182L87.4573 73.9077L87.9943 72.9233L77.7466 67.3337Z",
|
|
491
|
+
"M74.1807 72.4714L73.3984 73.2926L81.8502 81.344L82.6325 80.5228L74.1807 72.4714Z"
|
|
492
|
+
].join(" ");
|
|
493
|
+
function BrandWordmark({
|
|
494
|
+
"aria-label": ariaLabel,
|
|
495
|
+
className,
|
|
496
|
+
...props
|
|
497
|
+
}) {
|
|
498
|
+
return /* @__PURE__ */ jsx5(
|
|
499
|
+
"svg",
|
|
500
|
+
{
|
|
501
|
+
"data-slot": "brand-wordmark",
|
|
502
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
503
|
+
width: "496",
|
|
504
|
+
height: "113",
|
|
505
|
+
viewBox: "0 0 496 113",
|
|
506
|
+
fill: "none",
|
|
507
|
+
focusable: "false",
|
|
508
|
+
role: ariaLabel ? "img" : void 0,
|
|
509
|
+
"aria-hidden": ariaLabel ? void 0 : true,
|
|
510
|
+
"aria-label": ariaLabel,
|
|
511
|
+
className: cn(
|
|
512
|
+
"h-auto w-36 shrink-0 text-text-primary dark:text-white",
|
|
513
|
+
className
|
|
514
|
+
),
|
|
515
|
+
...props,
|
|
516
|
+
children: /* @__PURE__ */ jsx5("path", { d: CONSCIA_WORDMARK_PATH, fill: "currentColor" })
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/switch/index.parts.mjs
|
|
522
|
+
var index_parts_exports2 = {};
|
|
523
|
+
__export(index_parts_exports2, {
|
|
524
|
+
Root: () => SwitchRoot,
|
|
525
|
+
Thumb: () => SwitchThumb
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/switch/root/SwitchRoot.mjs
|
|
529
|
+
import * as React5 from "react";
|
|
530
|
+
|
|
531
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/switch/root/SwitchRootContext.mjs
|
|
532
|
+
import * as React4 from "react";
|
|
533
|
+
var SwitchRootContext = /* @__PURE__ */ React4.createContext(void 0);
|
|
534
|
+
if (true) SwitchRootContext.displayName = "SwitchRootContext";
|
|
535
|
+
function useSwitchRootContext() {
|
|
536
|
+
const context = React4.useContext(SwitchRootContext);
|
|
537
|
+
if (context === void 0) {
|
|
538
|
+
throw new Error(true ? "Base UI: SwitchRootContext is missing. Switch parts must be placed within <Switch.Root>." : formatErrorMessage_default(63));
|
|
539
|
+
}
|
|
540
|
+
return context;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/switch/stateAttributesMapping.mjs
|
|
544
|
+
var stateAttributesMapping = {
|
|
545
|
+
...fieldValidityMapping,
|
|
546
|
+
checked(value) {
|
|
547
|
+
if (value) {
|
|
548
|
+
return {
|
|
549
|
+
"data-checked": ""
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
return {
|
|
553
|
+
"data-unchecked": ""
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/switch/root/SwitchRoot.mjs
|
|
559
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
560
|
+
var SwitchRoot = /* @__PURE__ */ React5.forwardRef(function SwitchRoot2(componentProps, forwardedRef) {
|
|
561
|
+
const {
|
|
562
|
+
checked: checkedProp,
|
|
563
|
+
className,
|
|
564
|
+
defaultChecked,
|
|
565
|
+
"aria-labelledby": ariaLabelledByProp,
|
|
566
|
+
form,
|
|
567
|
+
id: idProp,
|
|
568
|
+
inputRef: externalInputRef,
|
|
569
|
+
name: nameProp,
|
|
570
|
+
nativeButton = false,
|
|
571
|
+
onCheckedChange,
|
|
572
|
+
readOnly = false,
|
|
573
|
+
required = false,
|
|
574
|
+
disabled: disabledProp = false,
|
|
575
|
+
render,
|
|
576
|
+
uncheckedValue,
|
|
577
|
+
value,
|
|
578
|
+
style,
|
|
579
|
+
...elementProps
|
|
580
|
+
} = componentProps;
|
|
581
|
+
const {
|
|
582
|
+
clearErrors
|
|
583
|
+
} = useFormContext();
|
|
584
|
+
const {
|
|
585
|
+
state: fieldState,
|
|
586
|
+
setTouched,
|
|
587
|
+
setDirty,
|
|
588
|
+
validityData,
|
|
589
|
+
setFilled,
|
|
590
|
+
setFocused,
|
|
591
|
+
validationMode,
|
|
592
|
+
disabled: fieldDisabled,
|
|
593
|
+
name: fieldName,
|
|
594
|
+
validation
|
|
595
|
+
} = useFieldRootContext();
|
|
596
|
+
const {
|
|
597
|
+
labelId
|
|
598
|
+
} = useLabelableContext();
|
|
599
|
+
const disabled = fieldDisabled || disabledProp;
|
|
600
|
+
const name = fieldName ?? nameProp;
|
|
601
|
+
const inputRef = React5.useRef(null);
|
|
602
|
+
const handleInputRef = useMergedRefs(inputRef, externalInputRef, validation.inputRef);
|
|
603
|
+
const switchRef = React5.useRef(null);
|
|
604
|
+
const id = useBaseUiId();
|
|
605
|
+
const controlId = useLabelableId({
|
|
606
|
+
id: idProp,
|
|
607
|
+
implicit: false,
|
|
608
|
+
controlRef: switchRef
|
|
609
|
+
});
|
|
610
|
+
const hiddenInputId = nativeButton ? void 0 : controlId;
|
|
611
|
+
const [checked, setCheckedState] = useControlled({
|
|
612
|
+
controlled: checkedProp,
|
|
613
|
+
default: Boolean(defaultChecked),
|
|
614
|
+
name: "Switch",
|
|
615
|
+
state: "checked"
|
|
616
|
+
});
|
|
617
|
+
useRegisterFieldControl(switchRef, id, checked, void 0, !disabled, nameProp);
|
|
618
|
+
useIsoLayoutEffect(() => {
|
|
619
|
+
if (inputRef.current) {
|
|
620
|
+
setFilled(inputRef.current.checked);
|
|
621
|
+
}
|
|
622
|
+
}, [setFilled]);
|
|
623
|
+
useValueChanged(checked, () => {
|
|
624
|
+
clearErrors(name);
|
|
625
|
+
setDirty(checked !== validityData.initialValue);
|
|
626
|
+
setFilled(checked);
|
|
627
|
+
validation.change(checked);
|
|
628
|
+
});
|
|
629
|
+
const {
|
|
630
|
+
getButtonProps,
|
|
631
|
+
buttonRef
|
|
632
|
+
} = useButton({
|
|
633
|
+
disabled,
|
|
634
|
+
native: nativeButton
|
|
635
|
+
});
|
|
636
|
+
const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, inputRef, !nativeButton, hiddenInputId);
|
|
637
|
+
const rootProps = {
|
|
638
|
+
id: nativeButton ? controlId : id,
|
|
639
|
+
role: "switch",
|
|
640
|
+
"aria-checked": checked,
|
|
641
|
+
"aria-readonly": readOnly || void 0,
|
|
642
|
+
"aria-required": required || void 0,
|
|
643
|
+
"aria-labelledby": ariaLabelledBy,
|
|
644
|
+
onFocus() {
|
|
645
|
+
if (!disabled) {
|
|
646
|
+
setFocused(true);
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
onBlur() {
|
|
650
|
+
const element2 = inputRef.current;
|
|
651
|
+
if (!element2 || disabled) {
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
setTouched(true);
|
|
655
|
+
setFocused(false);
|
|
656
|
+
if (validationMode === "onBlur") {
|
|
657
|
+
validation.commit(element2.checked);
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
onClick(event) {
|
|
661
|
+
if (readOnly || disabled) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
event.preventDefault();
|
|
665
|
+
const input = inputRef.current;
|
|
666
|
+
if (!input) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
dispatchClickWithModifiers(input, event);
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
const inputProps = {
|
|
673
|
+
...validation.getValidationProps(disabled),
|
|
674
|
+
checked,
|
|
675
|
+
disabled,
|
|
676
|
+
form,
|
|
677
|
+
id: hiddenInputId,
|
|
678
|
+
name,
|
|
679
|
+
required,
|
|
680
|
+
style: name ? visuallyHiddenInput : visuallyHidden,
|
|
681
|
+
tabIndex: -1,
|
|
682
|
+
type: "checkbox",
|
|
683
|
+
"aria-hidden": true,
|
|
684
|
+
ref: handleInputRef,
|
|
685
|
+
onChange(event) {
|
|
686
|
+
if (event.nativeEvent.defaultPrevented) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
if (readOnly) {
|
|
690
|
+
event.preventDefault();
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
const nextChecked = event.currentTarget.checked;
|
|
694
|
+
const eventDetails = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent);
|
|
695
|
+
onCheckedChange?.(nextChecked, eventDetails);
|
|
696
|
+
if (eventDetails.isCanceled) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
setCheckedState(nextChecked);
|
|
700
|
+
},
|
|
701
|
+
onClick(event) {
|
|
702
|
+
event.stopPropagation();
|
|
703
|
+
},
|
|
704
|
+
onFocus() {
|
|
705
|
+
switchRef.current?.focus();
|
|
706
|
+
},
|
|
707
|
+
// React <19 sets an empty value if `undefined` is passed explicitly
|
|
708
|
+
// To avoid this, we only set the value if it's defined
|
|
709
|
+
...value !== void 0 ? {
|
|
710
|
+
value
|
|
711
|
+
} : EMPTY_OBJECT
|
|
712
|
+
};
|
|
713
|
+
const state = React5.useMemo(() => ({
|
|
714
|
+
...fieldState,
|
|
715
|
+
checked,
|
|
716
|
+
disabled,
|
|
717
|
+
readOnly,
|
|
718
|
+
required
|
|
719
|
+
}), [fieldState, checked, disabled, readOnly, required]);
|
|
720
|
+
const element = useRenderElement("span", componentProps, {
|
|
721
|
+
state,
|
|
722
|
+
ref: [forwardedRef, switchRef, buttonRef],
|
|
723
|
+
props: [rootProps, elementProps, getButtonProps, (props) => validation.getValidationProps(disabled, props)],
|
|
724
|
+
stateAttributesMapping
|
|
725
|
+
});
|
|
726
|
+
return /* @__PURE__ */ _jsxs(SwitchRootContext.Provider, {
|
|
727
|
+
value: state,
|
|
728
|
+
children: [element, !checked && name && uncheckedValue !== void 0 && /* @__PURE__ */ _jsx("input", {
|
|
729
|
+
type: "hidden",
|
|
730
|
+
form,
|
|
731
|
+
name,
|
|
732
|
+
value: uncheckedValue,
|
|
733
|
+
disabled
|
|
734
|
+
}), /* @__PURE__ */ _jsx("input", {
|
|
735
|
+
...inputProps,
|
|
736
|
+
suppressHydrationWarning: true
|
|
737
|
+
})]
|
|
738
|
+
});
|
|
739
|
+
});
|
|
740
|
+
if (true) SwitchRoot.displayName = "SwitchRoot";
|
|
741
|
+
|
|
742
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/switch/thumb/SwitchThumb.mjs
|
|
743
|
+
import * as React6 from "react";
|
|
744
|
+
var SwitchThumb = /* @__PURE__ */ React6.forwardRef(function SwitchThumb2(componentProps, forwardedRef) {
|
|
745
|
+
const {
|
|
746
|
+
render,
|
|
747
|
+
className,
|
|
748
|
+
style,
|
|
749
|
+
...elementProps
|
|
750
|
+
} = componentProps;
|
|
751
|
+
const state = useSwitchRootContext();
|
|
752
|
+
return useRenderElement("span", componentProps, {
|
|
753
|
+
state,
|
|
754
|
+
ref: forwardedRef,
|
|
755
|
+
stateAttributesMapping,
|
|
756
|
+
props: elementProps
|
|
757
|
+
});
|
|
758
|
+
});
|
|
759
|
+
if (true) SwitchThumb.displayName = "SwitchThumb";
|
|
760
|
+
|
|
761
|
+
// src/primitives/switch.tsx
|
|
762
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
763
|
+
function Switch({ className, size = "default", ...props }) {
|
|
764
|
+
return /* @__PURE__ */ jsx6(index_parts_exports2.Root, { "data-slot": "switch", "data-size": size, className: cn("peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-focus focus-visible:ring-[3px] focus-visible:ring-focus/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-checked:bg-action data-unchecked:bg-control-border", className), ...props, children: /* @__PURE__ */ jsx6(index_parts_exports2.Thumb, { "data-slot": "switch-thumb", className: "pointer-events-none block rounded-full bg-canvas transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-checked:translate-x-[calc(100%-2px)] data-unchecked:translate-x-0" }) });
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// src/primitives/textarea.tsx
|
|
768
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
769
|
+
function Textarea({ className, ...props }) {
|
|
770
|
+
return /* @__PURE__ */ jsx7(
|
|
771
|
+
"textarea",
|
|
772
|
+
{
|
|
773
|
+
"data-slot": "textarea",
|
|
774
|
+
className: cn("ds-type-control min-h-28 w-full rounded-[var(--ds-field-control-radius)] border border-control-border bg-surface-control px-[var(--ds-field-control-padding-x)] py-3 outline-none transition-colors placeholder:text-text-supporting focus-visible:border-focus focus-visible:ring-[3px] focus-visible:ring-focus/50 aria-invalid:border-danger aria-invalid:ring-danger/20 dark:aria-invalid:ring-danger/40 disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
775
|
+
...props
|
|
776
|
+
}
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// src/primitives/compat.tsx
|
|
781
|
+
import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
782
|
+
var ConsciaButton = Button;
|
|
783
|
+
var ConsciaIconButton = IconButton;
|
|
784
|
+
var ConsciaCard = Card;
|
|
785
|
+
var ConsciaCardContent = CardContent;
|
|
786
|
+
var ConsciaCardDescription = CardDescription;
|
|
787
|
+
function ConsciaCardHeader({
|
|
788
|
+
actionRight,
|
|
789
|
+
className,
|
|
790
|
+
children,
|
|
791
|
+
...props
|
|
792
|
+
}) {
|
|
793
|
+
if (!actionRight) {
|
|
794
|
+
return /* @__PURE__ */ jsx8(CardHeader, { className, ...props, children });
|
|
795
|
+
}
|
|
796
|
+
return /* @__PURE__ */ jsxs2(
|
|
797
|
+
CardHeader,
|
|
798
|
+
{
|
|
799
|
+
className: cn(
|
|
800
|
+
"grid grid-cols-[minmax(0,1fr)_auto] items-start gap-4",
|
|
801
|
+
className
|
|
802
|
+
),
|
|
803
|
+
...props,
|
|
804
|
+
children: [
|
|
805
|
+
/* @__PURE__ */ jsx8("div", { className: "grid gap-2", children }),
|
|
806
|
+
/* @__PURE__ */ jsx8("div", { className: "justify-self-end", children: actionRight })
|
|
807
|
+
]
|
|
808
|
+
}
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
var ConsciaCardTitle = CardTitle;
|
|
812
|
+
var ConsciaCardFooter = CardFooter;
|
|
813
|
+
var ConsciaCheckbox = Checkbox;
|
|
814
|
+
var ConsciaInput = Input;
|
|
815
|
+
var ConsciaSwitch = Switch;
|
|
816
|
+
var ConsciaTextarea = Textarea;
|
|
817
|
+
var ConsciaSelect = Select;
|
|
818
|
+
var ConsciaSelectContent = SelectContent;
|
|
819
|
+
var ConsciaSelectGroup = SelectGroup;
|
|
820
|
+
var ConsciaSelectItem = SelectItem;
|
|
821
|
+
var ConsciaSelectTrigger = SelectTrigger;
|
|
822
|
+
var ConsciaSelectValue = SelectValue;
|
|
823
|
+
var ConsciaTable = Table;
|
|
824
|
+
var ConsciaTableBody = TableBody;
|
|
825
|
+
var ConsciaTableCell = TableCell;
|
|
826
|
+
var ConsciaTableHeader = TableHeader;
|
|
827
|
+
var ConsciaTableHead = TableHead;
|
|
828
|
+
var ConsciaTableRow = TableRow;
|
|
829
|
+
|
|
830
|
+
// src/primitives/field.tsx
|
|
831
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
832
|
+
function Field({
|
|
833
|
+
className,
|
|
834
|
+
...props
|
|
835
|
+
}) {
|
|
836
|
+
return /* @__PURE__ */ jsx9(
|
|
837
|
+
"div",
|
|
838
|
+
{
|
|
839
|
+
"data-slot": "field",
|
|
840
|
+
className: cn("grid gap-[var(--ds-field-label-gap)]", className),
|
|
841
|
+
...props
|
|
842
|
+
}
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
function FieldGroup({
|
|
846
|
+
className,
|
|
847
|
+
...props
|
|
848
|
+
}) {
|
|
849
|
+
return /* @__PURE__ */ jsx9(
|
|
850
|
+
"div",
|
|
851
|
+
{
|
|
852
|
+
"data-slot": "field-group",
|
|
853
|
+
className: cn("grid gap-[var(--ds-field-gap)]", className),
|
|
854
|
+
...props
|
|
855
|
+
}
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
function FieldLabel({
|
|
859
|
+
className,
|
|
860
|
+
...props
|
|
861
|
+
}) {
|
|
862
|
+
return /* @__PURE__ */ jsx9(
|
|
863
|
+
"label",
|
|
864
|
+
{
|
|
865
|
+
"data-slot": "field-label",
|
|
866
|
+
className: cn("ds-type-label text-text-primary", className),
|
|
867
|
+
...props
|
|
868
|
+
}
|
|
869
|
+
);
|
|
870
|
+
}
|
|
871
|
+
function FieldDescription({
|
|
872
|
+
className,
|
|
873
|
+
...props
|
|
874
|
+
}) {
|
|
875
|
+
return /* @__PURE__ */ jsx9(
|
|
876
|
+
"p",
|
|
877
|
+
{
|
|
878
|
+
"data-slot": "field-description",
|
|
879
|
+
className: cn("ds-type-metadata mt-[var(--ds-field-message-gap)] text-text-supporting", className),
|
|
880
|
+
...props
|
|
881
|
+
}
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
function FieldError({
|
|
885
|
+
className,
|
|
886
|
+
...props
|
|
887
|
+
}) {
|
|
888
|
+
return /* @__PURE__ */ jsx9(
|
|
889
|
+
"p",
|
|
890
|
+
{
|
|
891
|
+
"data-slot": "field-error",
|
|
892
|
+
className: cn("ds-type-metadata mt-[var(--ds-field-message-gap)] font-medium text-danger-foreground", className),
|
|
893
|
+
...props
|
|
894
|
+
}
|
|
895
|
+
);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
// src/primitives/filter-chip.tsx
|
|
899
|
+
import { XIcon } from "lucide-react";
|
|
900
|
+
import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
901
|
+
function FilterChip({
|
|
902
|
+
className,
|
|
903
|
+
label,
|
|
904
|
+
onRemove,
|
|
905
|
+
removeLabel,
|
|
906
|
+
value,
|
|
907
|
+
...props
|
|
908
|
+
}) {
|
|
909
|
+
const fallbackRemoveLabel = typeof label === "string" ? `Remove ${label} filter` : "Remove filter";
|
|
910
|
+
return /* @__PURE__ */ jsxs3(
|
|
911
|
+
"div",
|
|
912
|
+
{
|
|
913
|
+
"data-slot": "filter-chip",
|
|
914
|
+
className: cn(
|
|
915
|
+
"inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-border-default bg-surface-muted px-2 py-1 text-sm text-text-primary",
|
|
916
|
+
className
|
|
917
|
+
),
|
|
918
|
+
...props,
|
|
919
|
+
children: [
|
|
920
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0 text-text-supporting", children: label }),
|
|
921
|
+
value !== void 0 ? /* @__PURE__ */ jsx10("span", { className: "min-w-0 truncate font-medium", children: value }) : null,
|
|
922
|
+
onRemove ? /* @__PURE__ */ jsx10(
|
|
923
|
+
IconButton,
|
|
924
|
+
{
|
|
925
|
+
type: "button",
|
|
926
|
+
size: "sm",
|
|
927
|
+
variant: "ghost",
|
|
928
|
+
"aria-label": removeLabel ?? fallbackRemoveLabel,
|
|
929
|
+
onClick: onRemove,
|
|
930
|
+
className: "-mr-1 size-5 rounded-full text-text-supporting hover:bg-surface-control-hover hover:text-text-primary",
|
|
931
|
+
children: /* @__PURE__ */ jsx10(XIcon, { "aria-hidden": "true", className: "size-3" })
|
|
932
|
+
}
|
|
933
|
+
) : null
|
|
934
|
+
]
|
|
935
|
+
}
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// src/primitives/form-select.tsx
|
|
940
|
+
import * as React7 from "react";
|
|
941
|
+
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
942
|
+
var emptyValue = "__conscia_empty_select_value__";
|
|
943
|
+
function toSelectValue(value) {
|
|
944
|
+
if (value === void 0) {
|
|
945
|
+
return void 0;
|
|
946
|
+
}
|
|
947
|
+
return value === "" ? emptyValue : value;
|
|
948
|
+
}
|
|
949
|
+
function fromSelectValue(value) {
|
|
950
|
+
return value === emptyValue ? "" : value;
|
|
951
|
+
}
|
|
952
|
+
function FormSelect({
|
|
953
|
+
name,
|
|
954
|
+
id,
|
|
955
|
+
value,
|
|
956
|
+
defaultValue,
|
|
957
|
+
required,
|
|
958
|
+
disabled,
|
|
959
|
+
placeholder,
|
|
960
|
+
options,
|
|
961
|
+
className,
|
|
962
|
+
triggerClassName,
|
|
963
|
+
contentClassName,
|
|
964
|
+
onValueChange,
|
|
965
|
+
onClick,
|
|
966
|
+
"aria-label": ariaLabel
|
|
967
|
+
}) {
|
|
968
|
+
const [internalValue, setInternalValue] = React7.useState(defaultValue ?? "");
|
|
969
|
+
const currentValue = value ?? internalValue;
|
|
970
|
+
function handleValueChange(nextValue) {
|
|
971
|
+
const actualValue = fromSelectValue(nextValue);
|
|
972
|
+
if (value === void 0) {
|
|
973
|
+
setInternalValue(actualValue);
|
|
974
|
+
}
|
|
975
|
+
onValueChange?.(actualValue);
|
|
976
|
+
}
|
|
977
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("min-w-0", className), onClick, children: /* @__PURE__ */ jsxs4(
|
|
978
|
+
Select,
|
|
979
|
+
{
|
|
980
|
+
name,
|
|
981
|
+
value: toSelectValue(currentValue),
|
|
982
|
+
required,
|
|
983
|
+
disabled,
|
|
984
|
+
onValueChange: handleValueChange,
|
|
985
|
+
children: [
|
|
986
|
+
/* @__PURE__ */ jsx11(SelectTrigger, { id, "aria-label": ariaLabel, className: triggerClassName, children: /* @__PURE__ */ jsx11(SelectValue, { placeholder }) }),
|
|
987
|
+
/* @__PURE__ */ jsx11(SelectContent, { className: contentClassName, children: /* @__PURE__ */ jsx11(SelectGroup, { children: options.map((option) => /* @__PURE__ */ jsx11(
|
|
988
|
+
SelectItem,
|
|
989
|
+
{
|
|
990
|
+
value: toSelectValue(option.value) ?? emptyValue,
|
|
991
|
+
disabled: option.disabled,
|
|
992
|
+
children: option.label
|
|
993
|
+
},
|
|
994
|
+
option.value
|
|
995
|
+
)) }) })
|
|
996
|
+
]
|
|
997
|
+
}
|
|
998
|
+
) });
|
|
999
|
+
}
|
|
1000
|
+
var ConsciaFormSelect = FormSelect;
|
|
1001
|
+
|
|
1002
|
+
// src/primitives/label.tsx
|
|
1003
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1004
|
+
function Label({
|
|
1005
|
+
className,
|
|
1006
|
+
...props
|
|
1007
|
+
}) {
|
|
1008
|
+
return /* @__PURE__ */ jsx12("label", { "data-slot": "label", className: cn("ds-type-label flex items-center gap-2 text-text-primary select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className), ...props });
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/index.parts.mjs
|
|
1012
|
+
var index_parts_exports3 = {};
|
|
1013
|
+
__export(index_parts_exports3, {
|
|
1014
|
+
Arrow: () => PopoverArrow,
|
|
1015
|
+
Backdrop: () => PopoverBackdrop,
|
|
1016
|
+
Close: () => PopoverClose,
|
|
1017
|
+
Description: () => PopoverDescription,
|
|
1018
|
+
Handle: () => PopoverHandle,
|
|
1019
|
+
Popup: () => PopoverPopup,
|
|
1020
|
+
Portal: () => PopoverPortal,
|
|
1021
|
+
Positioner: () => PopoverPositioner,
|
|
1022
|
+
Root: () => PopoverRoot,
|
|
1023
|
+
Title: () => PopoverTitle,
|
|
1024
|
+
Trigger: () => PopoverTrigger,
|
|
1025
|
+
Viewport: () => PopoverViewport,
|
|
1026
|
+
createHandle: () => createPopoverHandle
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/root/PopoverRoot.mjs
|
|
1030
|
+
import * as React10 from "react";
|
|
1031
|
+
|
|
1032
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/root/PopoverRootContext.mjs
|
|
1033
|
+
import * as React8 from "react";
|
|
1034
|
+
var PopoverRootContext = /* @__PURE__ */ React8.createContext(void 0);
|
|
1035
|
+
if (true) PopoverRootContext.displayName = "PopoverRootContext";
|
|
1036
|
+
function usePopoverRootContext(optional) {
|
|
1037
|
+
const context = React8.useContext(PopoverRootContext);
|
|
1038
|
+
if (context === void 0 && !optional) {
|
|
1039
|
+
throw new Error(true ? "Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>." : formatErrorMessage_default(47));
|
|
1040
|
+
}
|
|
1041
|
+
return context;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/store/PopoverStore.mjs
|
|
1045
|
+
import * as React9 from "react";
|
|
1046
|
+
import * as ReactDOM from "react-dom";
|
|
1047
|
+
var selectors = {
|
|
1048
|
+
...popupStoreSelectors,
|
|
1049
|
+
disabled: (state) => state.disabled,
|
|
1050
|
+
instantType: (state) => state.instantType,
|
|
1051
|
+
openMethod: (state) => state.openMethod,
|
|
1052
|
+
openChangeReason: (state) => state.openChangeReason,
|
|
1053
|
+
modal: (state) => state.modal,
|
|
1054
|
+
focusManagerModal: (state) => state.focusManagerModal,
|
|
1055
|
+
stickIfOpen: (state) => state.stickIfOpen,
|
|
1056
|
+
titleElementId: (state) => state.titleElementId,
|
|
1057
|
+
descriptionElementId: (state) => state.descriptionElementId,
|
|
1058
|
+
openOnHover: (state) => state.openOnHover,
|
|
1059
|
+
closeDelay: (state) => state.closeDelay,
|
|
1060
|
+
adaptiveOrigin: (state) => state.adaptiveOrigin
|
|
1061
|
+
};
|
|
1062
|
+
var PopoverStore = class extends ReactStore {
|
|
1063
|
+
constructor(initialState, floatingId, nested) {
|
|
1064
|
+
const triggerElements = new PopupTriggerMap();
|
|
1065
|
+
super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors);
|
|
1066
|
+
__publicField(this, "setOpen", (nextOpen, eventDetails) => {
|
|
1067
|
+
const isHover = eventDetails.reason === reason_parts_exports.triggerHover;
|
|
1068
|
+
const isKeyboardClick = eventDetails.reason === reason_parts_exports.triggerPress && eventDetails.event.detail === 0;
|
|
1069
|
+
const isDismissClose = !nextOpen && (eventDetails.reason === reason_parts_exports.escapeKey || eventDetails.reason == null);
|
|
1070
|
+
const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
|
|
1071
|
+
const activeTriggerId = this.select("activeTriggerId");
|
|
1072
|
+
if (!nextOpen && eventDetails.reason === reason_parts_exports.closePress && eventDetails.trigger == null && activeTriggerId != null) {
|
|
1073
|
+
eventDetails.trigger = this.context.triggerElements.getById(activeTriggerId) ?? this.select("activeTriggerElement") ?? void 0;
|
|
1074
|
+
}
|
|
1075
|
+
this.context.onOpenChange?.(nextOpen, eventDetails);
|
|
1076
|
+
if (eventDetails.isCanceled) {
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
1080
|
+
const changeState = () => {
|
|
1081
|
+
const updatedState = {
|
|
1082
|
+
open: nextOpen,
|
|
1083
|
+
openChangeReason: eventDetails.reason
|
|
1084
|
+
};
|
|
1085
|
+
setPopupOpenState(updatedState, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
|
|
1086
|
+
this.update(updatedState);
|
|
1087
|
+
};
|
|
1088
|
+
if (isHover) {
|
|
1089
|
+
this.set("stickIfOpen", true);
|
|
1090
|
+
this.context.stickIfOpenTimeout.start(PATIENT_CLICK_THRESHOLD, () => {
|
|
1091
|
+
this.set("stickIfOpen", false);
|
|
1092
|
+
});
|
|
1093
|
+
ReactDOM.flushSync(changeState);
|
|
1094
|
+
} else {
|
|
1095
|
+
changeState();
|
|
1096
|
+
}
|
|
1097
|
+
let instantType;
|
|
1098
|
+
if (isKeyboardClick) {
|
|
1099
|
+
instantType = "click";
|
|
1100
|
+
} else if (isDismissClose) {
|
|
1101
|
+
instantType = "dismiss";
|
|
1102
|
+
} else if (eventDetails.reason === reason_parts_exports.focusOut) {
|
|
1103
|
+
instantType = "focus";
|
|
1104
|
+
}
|
|
1105
|
+
this.set("instantType", instantType);
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
function createNullPopoverStore() {
|
|
1110
|
+
const triggerElements = new PopupTriggerMap();
|
|
1111
|
+
const store = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors);
|
|
1112
|
+
return Object.assign(store, {
|
|
1113
|
+
setOpen: NOOP
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
function createInitialState(initialState, triggerElements, floatingId, nested = false) {
|
|
1117
|
+
const state = {
|
|
1118
|
+
...createInitialPopupStoreState(),
|
|
1119
|
+
disabled: false,
|
|
1120
|
+
modal: false,
|
|
1121
|
+
focusManagerModal: false,
|
|
1122
|
+
instantType: void 0,
|
|
1123
|
+
openMethod: null,
|
|
1124
|
+
openChangeReason: null,
|
|
1125
|
+
titleElementId: void 0,
|
|
1126
|
+
descriptionElementId: void 0,
|
|
1127
|
+
stickIfOpen: true,
|
|
1128
|
+
openOnHover: false,
|
|
1129
|
+
closeDelay: 0,
|
|
1130
|
+
adaptiveOrigin: void 0,
|
|
1131
|
+
...initialState
|
|
1132
|
+
};
|
|
1133
|
+
if (state.open && initialState?.mounted === void 0) {
|
|
1134
|
+
state.mounted = true;
|
|
1135
|
+
}
|
|
1136
|
+
state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
|
|
1137
|
+
return state;
|
|
1138
|
+
}
|
|
1139
|
+
function createInitialContext(triggerElements) {
|
|
1140
|
+
return {
|
|
1141
|
+
popupRef: /* @__PURE__ */ React9.createRef(),
|
|
1142
|
+
onOpenChange: void 0,
|
|
1143
|
+
onOpenChangeComplete: void 0,
|
|
1144
|
+
triggerFocusTargetRef: /* @__PURE__ */ React9.createRef(),
|
|
1145
|
+
beforeContentFocusGuardRef: /* @__PURE__ */ React9.createRef(),
|
|
1146
|
+
stickIfOpenTimeout: new Timeout(),
|
|
1147
|
+
triggerElements
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/root/PopoverRoot.mjs
|
|
1152
|
+
import { jsx as _jsx2, jsxs as _jsxs2 } from "react/jsx-runtime";
|
|
1153
|
+
function PopoverRootComponent({
|
|
1154
|
+
props
|
|
1155
|
+
}) {
|
|
1156
|
+
const {
|
|
1157
|
+
children,
|
|
1158
|
+
open: openProp,
|
|
1159
|
+
defaultOpen = false,
|
|
1160
|
+
onOpenChange,
|
|
1161
|
+
onOpenChangeComplete,
|
|
1162
|
+
modal = false,
|
|
1163
|
+
handle,
|
|
1164
|
+
triggerId: triggerIdProp,
|
|
1165
|
+
defaultTriggerId: defaultTriggerIdProp = null
|
|
1166
|
+
} = props;
|
|
1167
|
+
const store = usePopoverRootStore(handle, {
|
|
1168
|
+
modal,
|
|
1169
|
+
open: defaultOpen,
|
|
1170
|
+
openProp,
|
|
1171
|
+
activeTriggerId: defaultTriggerIdProp,
|
|
1172
|
+
triggerIdProp
|
|
1173
|
+
});
|
|
1174
|
+
store.useControlledProp("openProp", openProp);
|
|
1175
|
+
store.useControlledProp("triggerIdProp", triggerIdProp);
|
|
1176
|
+
const open = store.useState("open");
|
|
1177
|
+
const mounted = store.useState("mounted");
|
|
1178
|
+
const payload = store.useState("payload");
|
|
1179
|
+
store.useContextCallback("onOpenChange", onOpenChange);
|
|
1180
|
+
store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
|
|
1181
|
+
usePopupRootSync(store, open);
|
|
1182
|
+
useImplicitActiveTrigger(store);
|
|
1183
|
+
const {
|
|
1184
|
+
forceUnmount
|
|
1185
|
+
} = useOpenStateTransitions(open, store, () => {
|
|
1186
|
+
store.update({
|
|
1187
|
+
stickIfOpen: true,
|
|
1188
|
+
openChangeReason: null
|
|
1189
|
+
});
|
|
1190
|
+
});
|
|
1191
|
+
store.useSyncedValues({
|
|
1192
|
+
modal
|
|
1193
|
+
});
|
|
1194
|
+
React10.useEffect(() => {
|
|
1195
|
+
if (!open) {
|
|
1196
|
+
store.context.stickIfOpenTimeout.clear();
|
|
1197
|
+
}
|
|
1198
|
+
}, [store, open]);
|
|
1199
|
+
React10.useImperativeHandle(props.actionsRef, () => ({
|
|
1200
|
+
unmount: forceUnmount,
|
|
1201
|
+
close: () => store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction))
|
|
1202
|
+
}), [forceUnmount, store]);
|
|
1203
|
+
const shouldRenderInteractions = open || mounted;
|
|
1204
|
+
return /* @__PURE__ */ _jsxs2(PopoverRootContext.Provider, {
|
|
1205
|
+
value: store,
|
|
1206
|
+
children: [handle && /* @__PURE__ */ _jsx2(PopupHandleAttachment, {
|
|
1207
|
+
handle,
|
|
1208
|
+
store
|
|
1209
|
+
}), shouldRenderInteractions && /* @__PURE__ */ _jsx2(PopoverInteractions, {
|
|
1210
|
+
store,
|
|
1211
|
+
modal
|
|
1212
|
+
}), typeof children === "function" ? children({
|
|
1213
|
+
payload
|
|
1214
|
+
}) : children]
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
function PopoverRoot(props) {
|
|
1218
|
+
if (usePopoverRootContext(true)) {
|
|
1219
|
+
return /* @__PURE__ */ _jsx2(PopoverRootComponent, {
|
|
1220
|
+
props
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
return /* @__PURE__ */ _jsx2(FloatingTree, {
|
|
1224
|
+
children: /* @__PURE__ */ _jsx2(PopoverRootComponent, {
|
|
1225
|
+
props
|
|
1226
|
+
})
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
function usePopoverRootStore(handle, initialState) {
|
|
1230
|
+
const store = usePopupRootStore((floatingId, nested) => new PopoverStore(initialState, floatingId, nested));
|
|
1231
|
+
React10.useEffect(() => store.context.stickIfOpenTimeout.disposeEffect(), [store]);
|
|
1232
|
+
return store;
|
|
1233
|
+
}
|
|
1234
|
+
function PopoverInteractions({
|
|
1235
|
+
store,
|
|
1236
|
+
modal
|
|
1237
|
+
}) {
|
|
1238
|
+
const floatingRootContext = store.useState("floatingRootContext");
|
|
1239
|
+
const dismiss = useDismiss(floatingRootContext, {
|
|
1240
|
+
outsidePressEvent: {
|
|
1241
|
+
// Ensure `aria-hidden` on outside elements is removed immediately
|
|
1242
|
+
// on outside press when trapping focus.
|
|
1243
|
+
mouse: modal === "trap-focus" ? "sloppy" : "intentional",
|
|
1244
|
+
touch: "sloppy"
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
const triggerProps = dismiss.reference;
|
|
1248
|
+
const popupProps = dismiss.floating;
|
|
1249
|
+
usePopupInteractionProps(store, {
|
|
1250
|
+
activeTriggerProps: triggerProps,
|
|
1251
|
+
inactiveTriggerProps: triggerProps,
|
|
1252
|
+
popupProps
|
|
1253
|
+
});
|
|
1254
|
+
return null;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/trigger/PopoverTrigger.mjs
|
|
1258
|
+
import * as React11 from "react";
|
|
1259
|
+
|
|
1260
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/utils/constants.mjs
|
|
1261
|
+
var OPEN_DELAY = 300;
|
|
1262
|
+
|
|
1263
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/trigger/PopoverTrigger.mjs
|
|
1264
|
+
import { jsx as _jsx3, jsxs as _jsxs3 } from "react/jsx-runtime";
|
|
1265
|
+
var PopoverTrigger = /* @__PURE__ */ React11.forwardRef(function PopoverTrigger2(componentProps, forwardedRef) {
|
|
1266
|
+
const {
|
|
1267
|
+
render,
|
|
1268
|
+
className,
|
|
1269
|
+
style,
|
|
1270
|
+
disabled = false,
|
|
1271
|
+
nativeButton = true,
|
|
1272
|
+
handle,
|
|
1273
|
+
payload,
|
|
1274
|
+
openOnHover = false,
|
|
1275
|
+
delay = OPEN_DELAY,
|
|
1276
|
+
closeDelay = 0,
|
|
1277
|
+
id: idProp,
|
|
1278
|
+
...elementProps
|
|
1279
|
+
} = componentProps;
|
|
1280
|
+
const rootStore = usePopoverRootContext(true);
|
|
1281
|
+
const handleStore = usePopupHandleStore(handle);
|
|
1282
|
+
const store = handleStore ?? rootStore;
|
|
1283
|
+
if (!store) {
|
|
1284
|
+
throw new Error(true ? "Base UI: <Popover.Trigger> must be either used within a <Popover.Root> component or provided with a handle." : formatErrorMessage_default(74));
|
|
1285
|
+
}
|
|
1286
|
+
const thisTriggerId = useBaseUiId(idProp);
|
|
1287
|
+
const isTriggerActive = store.useState("isTriggerActive", thisTriggerId);
|
|
1288
|
+
const floatingContext = store.useState("floatingRootContext");
|
|
1289
|
+
const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
|
|
1290
|
+
const popupId = store.useState("triggerPopupId", thisTriggerId);
|
|
1291
|
+
const triggerElementRef = React11.useRef(null);
|
|
1292
|
+
const {
|
|
1293
|
+
registerTrigger,
|
|
1294
|
+
isMountedByThisTrigger
|
|
1295
|
+
} = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
|
|
1296
|
+
payload,
|
|
1297
|
+
disabled,
|
|
1298
|
+
openOnHover,
|
|
1299
|
+
closeDelay
|
|
1300
|
+
});
|
|
1301
|
+
const openReason = store.useState("openChangeReason");
|
|
1302
|
+
const stickIfOpen = store.useState("stickIfOpen");
|
|
1303
|
+
const openMethod = store.useState("openMethod");
|
|
1304
|
+
const focusManagerModal = store.useState("focusManagerModal");
|
|
1305
|
+
const hoverProps = useHoverReferenceInteraction(floatingContext, {
|
|
1306
|
+
enabled: !disabled && openOnHover && (openMethod !== "touch" || openReason !== reason_parts_exports.triggerPress),
|
|
1307
|
+
mouseOnly: true,
|
|
1308
|
+
move: false,
|
|
1309
|
+
handleClose: safePolygon(),
|
|
1310
|
+
restMs: delay,
|
|
1311
|
+
delay: {
|
|
1312
|
+
close: closeDelay
|
|
1313
|
+
},
|
|
1314
|
+
triggerElementRef,
|
|
1315
|
+
isActiveTrigger: isTriggerActive,
|
|
1316
|
+
isClosing: () => store.select("transitionStatus") === "ending"
|
|
1317
|
+
});
|
|
1318
|
+
const click = useClick(floatingContext, {
|
|
1319
|
+
stickIfOpen
|
|
1320
|
+
});
|
|
1321
|
+
const interactionTypeProps = useOpenMethodTriggerProps(() => store.select("open"), (interactionType) => {
|
|
1322
|
+
store.set("openMethod", interactionType);
|
|
1323
|
+
});
|
|
1324
|
+
const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
|
|
1325
|
+
const {
|
|
1326
|
+
getButtonProps,
|
|
1327
|
+
buttonRef
|
|
1328
|
+
} = useButton({
|
|
1329
|
+
disabled,
|
|
1330
|
+
native: nativeButton
|
|
1331
|
+
});
|
|
1332
|
+
const stateAttributesMapping2 = {
|
|
1333
|
+
open(value) {
|
|
1334
|
+
if (value && openReason === reason_parts_exports.triggerPress) {
|
|
1335
|
+
return pressableTriggerOpenStateMapping.open(value);
|
|
1336
|
+
}
|
|
1337
|
+
return triggerOpenStateMapping.open(value);
|
|
1338
|
+
}
|
|
1339
|
+
};
|
|
1340
|
+
const {
|
|
1341
|
+
preFocusGuardRef,
|
|
1342
|
+
handlePreFocusGuardFocus,
|
|
1343
|
+
handleFocusTargetFocus
|
|
1344
|
+
} = useTriggerFocusGuards(store, triggerElementRef);
|
|
1345
|
+
const state = {
|
|
1346
|
+
disabled,
|
|
1347
|
+
open: isOpenedByThisTrigger
|
|
1348
|
+
};
|
|
1349
|
+
const element = useRenderElement("button", componentProps, {
|
|
1350
|
+
state,
|
|
1351
|
+
ref: [buttonRef, forwardedRef, registerTrigger, triggerElementRef],
|
|
1352
|
+
props: [click.reference, hoverProps, rootTriggerProps, interactionTypeProps, {
|
|
1353
|
+
[CLICK_TRIGGER_IDENTIFIER]: "",
|
|
1354
|
+
id: thisTriggerId,
|
|
1355
|
+
"aria-haspopup": "dialog",
|
|
1356
|
+
"aria-expanded": isOpenedByThisTrigger,
|
|
1357
|
+
"aria-controls": popupId
|
|
1358
|
+
}, elementProps, getButtonProps],
|
|
1359
|
+
stateAttributesMapping: stateAttributesMapping2
|
|
1360
|
+
});
|
|
1361
|
+
const keyedElement = /* @__PURE__ */ _jsx3(React11.Fragment, {
|
|
1362
|
+
children: element
|
|
1363
|
+
}, thisTriggerId);
|
|
1364
|
+
if (isMountedByThisTrigger && !focusManagerModal) {
|
|
1365
|
+
return /* @__PURE__ */ _jsxs3(React11.Fragment, {
|
|
1366
|
+
children: [/* @__PURE__ */ _jsx3(FocusGuard, {
|
|
1367
|
+
ref: preFocusGuardRef,
|
|
1368
|
+
onFocus: handlePreFocusGuardFocus
|
|
1369
|
+
}), keyedElement, /* @__PURE__ */ _jsx3(FocusGuard, {
|
|
1370
|
+
ref: store.context.triggerFocusTargetRef,
|
|
1371
|
+
onFocus: handleFocusTargetFocus
|
|
1372
|
+
})]
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
return keyedElement;
|
|
1376
|
+
});
|
|
1377
|
+
if (true) PopoverTrigger.displayName = "PopoverTrigger";
|
|
1378
|
+
|
|
1379
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/portal/PopoverPortal.mjs
|
|
1380
|
+
import * as React13 from "react";
|
|
1381
|
+
|
|
1382
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/portal/PopoverPortalContext.mjs
|
|
1383
|
+
import * as React12 from "react";
|
|
1384
|
+
var PopoverPortalContext = /* @__PURE__ */ React12.createContext(void 0);
|
|
1385
|
+
if (true) PopoverPortalContext.displayName = "PopoverPortalContext";
|
|
1386
|
+
function usePopoverPortalContext() {
|
|
1387
|
+
const value = React12.useContext(PopoverPortalContext);
|
|
1388
|
+
if (value === void 0) {
|
|
1389
|
+
throw new Error(true ? "Base UI: <Popover.Portal> is missing." : formatErrorMessage_default(45));
|
|
1390
|
+
}
|
|
1391
|
+
return value;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/portal/PopoverPortal.mjs
|
|
1395
|
+
import { jsx as _jsx4 } from "react/jsx-runtime";
|
|
1396
|
+
var PopoverPortal = /* @__PURE__ */ React13.forwardRef(function PopoverPortal2(props, forwardedRef) {
|
|
1397
|
+
const {
|
|
1398
|
+
keepMounted = false,
|
|
1399
|
+
...portalProps
|
|
1400
|
+
} = props;
|
|
1401
|
+
const store = usePopoverRootContext();
|
|
1402
|
+
const mounted = store.useState("mounted");
|
|
1403
|
+
const shouldRender = mounted || keepMounted;
|
|
1404
|
+
if (!shouldRender) {
|
|
1405
|
+
return null;
|
|
1406
|
+
}
|
|
1407
|
+
return /* @__PURE__ */ _jsx4(PopoverPortalContext.Provider, {
|
|
1408
|
+
value: keepMounted,
|
|
1409
|
+
children: /* @__PURE__ */ _jsx4(FloatingPortal, {
|
|
1410
|
+
ref: forwardedRef,
|
|
1411
|
+
...portalProps
|
|
1412
|
+
})
|
|
1413
|
+
});
|
|
1414
|
+
});
|
|
1415
|
+
if (true) PopoverPortal.displayName = "PopoverPortal";
|
|
1416
|
+
|
|
1417
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/positioner/PopoverPositioner.mjs
|
|
1418
|
+
import * as React15 from "react";
|
|
1419
|
+
|
|
1420
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/positioner/PopoverPositionerContext.mjs
|
|
1421
|
+
import * as React14 from "react";
|
|
1422
|
+
var PopoverPositionerContext = /* @__PURE__ */ React14.createContext(void 0);
|
|
1423
|
+
if (true) PopoverPositionerContext.displayName = "PopoverPositionerContext";
|
|
1424
|
+
function usePopoverPositionerContext() {
|
|
1425
|
+
const context = React14.useContext(PopoverPositionerContext);
|
|
1426
|
+
if (!context) {
|
|
1427
|
+
throw new Error(true ? "Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>." : formatErrorMessage_default(46));
|
|
1428
|
+
}
|
|
1429
|
+
return context;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/positioner/PopoverPositioner.mjs
|
|
1433
|
+
import { jsx as _jsx5, jsxs as _jsxs4 } from "react/jsx-runtime";
|
|
1434
|
+
var PopoverPositioner = /* @__PURE__ */ React15.forwardRef(function PopoverPositioner2(componentProps, forwardedRef) {
|
|
1435
|
+
const {
|
|
1436
|
+
render,
|
|
1437
|
+
className,
|
|
1438
|
+
style,
|
|
1439
|
+
anchor,
|
|
1440
|
+
// `useAnchorPositioning` applies the same defaults to the undefined values; the names
|
|
1441
|
+
// remain destructured to exclude the props from `elementProps`.
|
|
1442
|
+
positionMethod,
|
|
1443
|
+
side,
|
|
1444
|
+
align,
|
|
1445
|
+
sideOffset,
|
|
1446
|
+
alignOffset,
|
|
1447
|
+
collisionBoundary = "clipping-ancestors",
|
|
1448
|
+
collisionPadding,
|
|
1449
|
+
arrowPadding,
|
|
1450
|
+
sticky,
|
|
1451
|
+
disableAnchorTracking = false,
|
|
1452
|
+
collisionAvoidance = POPUP_COLLISION_AVOIDANCE,
|
|
1453
|
+
...elementProps
|
|
1454
|
+
} = componentProps;
|
|
1455
|
+
const store = usePopoverRootContext();
|
|
1456
|
+
const keepMounted = usePopoverPortalContext();
|
|
1457
|
+
const nodeId = useFloatingNodeId();
|
|
1458
|
+
const floatingRootContext = store.useState("floatingRootContext");
|
|
1459
|
+
const mounted = store.useState("mounted");
|
|
1460
|
+
const open = store.useState("open");
|
|
1461
|
+
const openReason = store.useState("openChangeReason");
|
|
1462
|
+
const triggerElement = store.useState("activeTriggerElement");
|
|
1463
|
+
const modal = store.useState("modal");
|
|
1464
|
+
const openMethod = store.useState("openMethod");
|
|
1465
|
+
const positionerElement = store.useState("positionerElement");
|
|
1466
|
+
const instantType = store.useState("instantType");
|
|
1467
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
1468
|
+
const adaptiveOrigin = store.useState("adaptiveOrigin");
|
|
1469
|
+
const prevTriggerElementRef = React15.useRef(null);
|
|
1470
|
+
const runOnceAnimationsFinish = useAnimationsFinished(positionerElement);
|
|
1471
|
+
const positioning = useAnchorPositioning({
|
|
1472
|
+
anchor,
|
|
1473
|
+
floatingRootContext,
|
|
1474
|
+
positionMethod,
|
|
1475
|
+
mounted,
|
|
1476
|
+
side,
|
|
1477
|
+
sideOffset,
|
|
1478
|
+
align,
|
|
1479
|
+
alignOffset,
|
|
1480
|
+
arrowPadding,
|
|
1481
|
+
collisionBoundary,
|
|
1482
|
+
collisionPadding,
|
|
1483
|
+
sticky,
|
|
1484
|
+
disableAnchorTracking,
|
|
1485
|
+
keepMounted,
|
|
1486
|
+
nodeId,
|
|
1487
|
+
collisionAvoidance,
|
|
1488
|
+
adaptiveOrigin
|
|
1489
|
+
});
|
|
1490
|
+
const domReference = floatingRootContext.useState("domReferenceElement");
|
|
1491
|
+
useIsoLayoutEffect(() => {
|
|
1492
|
+
const currentTriggerElement = domReference;
|
|
1493
|
+
const prevTriggerElement = prevTriggerElementRef.current;
|
|
1494
|
+
if (currentTriggerElement) {
|
|
1495
|
+
prevTriggerElementRef.current = currentTriggerElement;
|
|
1496
|
+
}
|
|
1497
|
+
if (prevTriggerElement && currentTriggerElement && currentTriggerElement !== prevTriggerElement) {
|
|
1498
|
+
store.set("instantType", void 0);
|
|
1499
|
+
const ac = new AbortController();
|
|
1500
|
+
runOnceAnimationsFinish(() => {
|
|
1501
|
+
store.set("instantType", "trigger-change");
|
|
1502
|
+
}, ac.signal);
|
|
1503
|
+
return () => {
|
|
1504
|
+
ac.abort();
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
return void 0;
|
|
1508
|
+
}, [domReference, runOnceAnimationsFinish, store]);
|
|
1509
|
+
const trueModalNonHover = modal === true && openReason !== reason_parts_exports.triggerHover;
|
|
1510
|
+
useAnchoredPopupScrollLock(open && trueModalNonHover, openMethod === "touch", positionerElement, triggerElement);
|
|
1511
|
+
const setPositionerElement = store.useStateSetter("positionerElement");
|
|
1512
|
+
const state = {
|
|
1513
|
+
open,
|
|
1514
|
+
side: positioning.side,
|
|
1515
|
+
align: positioning.align,
|
|
1516
|
+
anchorHidden: positioning.anchorHidden,
|
|
1517
|
+
instant: instantType
|
|
1518
|
+
};
|
|
1519
|
+
const element = usePositioner(componentProps, state, {
|
|
1520
|
+
styles: positioning.positionerStyles,
|
|
1521
|
+
transitionStatus,
|
|
1522
|
+
props: elementProps,
|
|
1523
|
+
refs: [forwardedRef, setPositionerElement],
|
|
1524
|
+
hidden: !mounted,
|
|
1525
|
+
inert: !open
|
|
1526
|
+
});
|
|
1527
|
+
return /* @__PURE__ */ _jsxs4(PopoverPositionerContext.Provider, {
|
|
1528
|
+
value: positioning,
|
|
1529
|
+
children: [mounted && trueModalNonHover && /* @__PURE__ */ _jsx5(InternalBackdrop, {
|
|
1530
|
+
inert: inertValue(!open),
|
|
1531
|
+
cutout: triggerElement
|
|
1532
|
+
}), /* @__PURE__ */ _jsx5(FloatingNode, {
|
|
1533
|
+
id: nodeId,
|
|
1534
|
+
children: element
|
|
1535
|
+
})]
|
|
1536
|
+
});
|
|
1537
|
+
});
|
|
1538
|
+
if (true) PopoverPositioner.displayName = "PopoverPositioner";
|
|
1539
|
+
|
|
1540
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/popup/PopoverPopup.mjs
|
|
1541
|
+
import * as React17 from "react";
|
|
1542
|
+
|
|
1543
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/utils/closePart.mjs
|
|
1544
|
+
import * as React16 from "react";
|
|
1545
|
+
var ClosePartContext = /* @__PURE__ */ React16.createContext(void 0);
|
|
1546
|
+
if (true) ClosePartContext.displayName = "ClosePartContext";
|
|
1547
|
+
function useClosePartCount() {
|
|
1548
|
+
const [closePartCount, setClosePartCount] = React16.useState(0);
|
|
1549
|
+
const register = useStableCallback(() => {
|
|
1550
|
+
setClosePartCount((count) => count + 1);
|
|
1551
|
+
return () => {
|
|
1552
|
+
setClosePartCount((count) => Math.max(0, count - 1));
|
|
1553
|
+
};
|
|
1554
|
+
});
|
|
1555
|
+
const context = React16.useMemo(() => ({
|
|
1556
|
+
register
|
|
1557
|
+
}), [register]);
|
|
1558
|
+
return {
|
|
1559
|
+
context,
|
|
1560
|
+
hasClosePart: closePartCount > 0
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
function useClosePartRegistration() {
|
|
1564
|
+
const context = React16.useContext(ClosePartContext);
|
|
1565
|
+
useIsoLayoutEffect(() => {
|
|
1566
|
+
return context?.register();
|
|
1567
|
+
}, [context]);
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/popup/PopoverPopup.mjs
|
|
1571
|
+
import { jsx as _jsx6 } from "react/jsx-runtime";
|
|
1572
|
+
var PopoverPopup = /* @__PURE__ */ React17.forwardRef(function PopoverPopup2(componentProps, forwardedRef) {
|
|
1573
|
+
const {
|
|
1574
|
+
render,
|
|
1575
|
+
className,
|
|
1576
|
+
style,
|
|
1577
|
+
initialFocus,
|
|
1578
|
+
finalFocus,
|
|
1579
|
+
...elementProps
|
|
1580
|
+
} = componentProps;
|
|
1581
|
+
const store = usePopoverRootContext();
|
|
1582
|
+
const positioner = usePopoverPositionerContext();
|
|
1583
|
+
const insideToolbar = useToolbarRootContext(true) != null;
|
|
1584
|
+
const {
|
|
1585
|
+
context: closePartContext,
|
|
1586
|
+
hasClosePart
|
|
1587
|
+
} = useClosePartCount();
|
|
1588
|
+
const open = store.useState("open");
|
|
1589
|
+
const openMethod = store.useState("openMethod");
|
|
1590
|
+
const instantType = store.useState("instantType");
|
|
1591
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
1592
|
+
const popupProps = store.useState("popupProps");
|
|
1593
|
+
const titleId = store.useState("titleElementId");
|
|
1594
|
+
const descriptionId = store.useState("descriptionElementId");
|
|
1595
|
+
const modal = store.useState("modal");
|
|
1596
|
+
const mounted = store.useState("mounted");
|
|
1597
|
+
const openReason = store.useState("openChangeReason");
|
|
1598
|
+
const activeTriggerElement = store.useState("activeTriggerElement");
|
|
1599
|
+
const floatingContext = store.useState("floatingRootContext");
|
|
1600
|
+
const floatingId = floatingContext.useState("floatingId");
|
|
1601
|
+
const disabled = store.useState("disabled");
|
|
1602
|
+
const openOnHover = store.useState("openOnHover");
|
|
1603
|
+
const closeDelay = store.useState("closeDelay");
|
|
1604
|
+
useOpenChangeComplete({
|
|
1605
|
+
open,
|
|
1606
|
+
ref: store.context.popupRef,
|
|
1607
|
+
onComplete() {
|
|
1608
|
+
if (open) {
|
|
1609
|
+
store.context.onOpenChangeComplete?.(true);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1613
|
+
useHoverFloatingInteraction(floatingContext, {
|
|
1614
|
+
enabled: openOnHover && !disabled,
|
|
1615
|
+
closeDelay
|
|
1616
|
+
});
|
|
1617
|
+
const resolvedInitialFocus = initialFocus === void 0 ? createDefaultInitialFocus(store.context.popupRef) : initialFocus;
|
|
1618
|
+
const focusManagerModal = modal !== false && hasClosePart;
|
|
1619
|
+
store.useSyncedValue("focusManagerModal", focusManagerModal);
|
|
1620
|
+
const setPopupElement = store.useStateSetter("popupElement");
|
|
1621
|
+
const state = {
|
|
1622
|
+
open,
|
|
1623
|
+
side: positioner.side,
|
|
1624
|
+
align: positioner.align,
|
|
1625
|
+
instant: instantType,
|
|
1626
|
+
transitionStatus
|
|
1627
|
+
};
|
|
1628
|
+
const element = useRenderElement("div", componentProps, {
|
|
1629
|
+
state,
|
|
1630
|
+
ref: [forwardedRef, store.context.popupRef, setPopupElement],
|
|
1631
|
+
props: [popupProps, {
|
|
1632
|
+
id: floatingId,
|
|
1633
|
+
role: "dialog",
|
|
1634
|
+
...FOCUSABLE_POPUP_PROPS,
|
|
1635
|
+
"aria-labelledby": titleId,
|
|
1636
|
+
"aria-describedby": descriptionId,
|
|
1637
|
+
onKeyDown(event) {
|
|
1638
|
+
if (insideToolbar && COMPOSITE_KEYS.has(event.key)) {
|
|
1639
|
+
event.stopPropagation();
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
}, getDisabledMountTransitionStyles(transitionStatus), elementProps],
|
|
1643
|
+
stateAttributesMapping: popupTransitionStateMapping
|
|
1644
|
+
});
|
|
1645
|
+
return /* @__PURE__ */ _jsx6(FloatingFocusManager, {
|
|
1646
|
+
context: floatingContext,
|
|
1647
|
+
openInteractionType: openMethod,
|
|
1648
|
+
modal: focusManagerModal,
|
|
1649
|
+
disabled: !mounted || openReason === reason_parts_exports.triggerHover,
|
|
1650
|
+
initialFocus: resolvedInitialFocus,
|
|
1651
|
+
returnFocus: finalFocus,
|
|
1652
|
+
restoreFocus: "popup",
|
|
1653
|
+
previousFocusableElement: isHTMLElement(activeTriggerElement) ? activeTriggerElement : void 0,
|
|
1654
|
+
nextFocusableElement: store.context.triggerFocusTargetRef,
|
|
1655
|
+
beforeContentFocusGuardRef: store.context.beforeContentFocusGuardRef,
|
|
1656
|
+
children: /* @__PURE__ */ _jsx6(ClosePartContext.Provider, {
|
|
1657
|
+
value: closePartContext,
|
|
1658
|
+
children: element
|
|
1659
|
+
})
|
|
1660
|
+
});
|
|
1661
|
+
});
|
|
1662
|
+
if (true) PopoverPopup.displayName = "PopoverPopup";
|
|
1663
|
+
|
|
1664
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/arrow/PopoverArrow.mjs
|
|
1665
|
+
import * as React18 from "react";
|
|
1666
|
+
var PopoverArrow = /* @__PURE__ */ React18.forwardRef(function PopoverArrow2(componentProps, forwardedRef) {
|
|
1667
|
+
const {
|
|
1668
|
+
render,
|
|
1669
|
+
className,
|
|
1670
|
+
style,
|
|
1671
|
+
...elementProps
|
|
1672
|
+
} = componentProps;
|
|
1673
|
+
const store = usePopoverRootContext();
|
|
1674
|
+
const open = store.useState("open");
|
|
1675
|
+
const {
|
|
1676
|
+
arrowRef,
|
|
1677
|
+
side,
|
|
1678
|
+
align,
|
|
1679
|
+
arrowUncentered,
|
|
1680
|
+
arrowStyles
|
|
1681
|
+
} = usePopoverPositionerContext();
|
|
1682
|
+
const state = {
|
|
1683
|
+
open,
|
|
1684
|
+
side,
|
|
1685
|
+
align,
|
|
1686
|
+
uncentered: arrowUncentered
|
|
1687
|
+
};
|
|
1688
|
+
const element = useRenderElement("div", componentProps, {
|
|
1689
|
+
state,
|
|
1690
|
+
ref: [forwardedRef, arrowRef],
|
|
1691
|
+
props: [{
|
|
1692
|
+
style: arrowStyles,
|
|
1693
|
+
"aria-hidden": true
|
|
1694
|
+
}, elementProps],
|
|
1695
|
+
stateAttributesMapping: popupStateMapping
|
|
1696
|
+
});
|
|
1697
|
+
return element;
|
|
1698
|
+
});
|
|
1699
|
+
if (true) PopoverArrow.displayName = "PopoverArrow";
|
|
1700
|
+
|
|
1701
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/backdrop/PopoverBackdrop.mjs
|
|
1702
|
+
import * as React19 from "react";
|
|
1703
|
+
var PopoverBackdrop = /* @__PURE__ */ React19.forwardRef(function PopoverBackdrop2(props, forwardedRef) {
|
|
1704
|
+
const {
|
|
1705
|
+
render,
|
|
1706
|
+
className,
|
|
1707
|
+
style,
|
|
1708
|
+
...elementProps
|
|
1709
|
+
} = props;
|
|
1710
|
+
const store = usePopoverRootContext();
|
|
1711
|
+
const open = store.useState("open");
|
|
1712
|
+
const mounted = store.useState("mounted");
|
|
1713
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
1714
|
+
const openReason = store.useState("openChangeReason");
|
|
1715
|
+
const state = {
|
|
1716
|
+
open,
|
|
1717
|
+
transitionStatus
|
|
1718
|
+
};
|
|
1719
|
+
const element = useRenderElement("div", props, {
|
|
1720
|
+
state,
|
|
1721
|
+
ref: forwardedRef,
|
|
1722
|
+
props: [{
|
|
1723
|
+
role: "presentation",
|
|
1724
|
+
hidden: !mounted,
|
|
1725
|
+
style: {
|
|
1726
|
+
pointerEvents: openReason === reason_parts_exports.triggerHover ? "none" : void 0,
|
|
1727
|
+
userSelect: "none",
|
|
1728
|
+
WebkitUserSelect: "none"
|
|
1729
|
+
}
|
|
1730
|
+
}, elementProps],
|
|
1731
|
+
stateAttributesMapping: popupTransitionStateMapping
|
|
1732
|
+
});
|
|
1733
|
+
return element;
|
|
1734
|
+
});
|
|
1735
|
+
if (true) PopoverBackdrop.displayName = "PopoverBackdrop";
|
|
1736
|
+
|
|
1737
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/title/PopoverTitle.mjs
|
|
1738
|
+
import * as React20 from "react";
|
|
1739
|
+
var PopoverTitle = /* @__PURE__ */ React20.forwardRef(function PopoverTitle2(componentProps, forwardedRef) {
|
|
1740
|
+
const {
|
|
1741
|
+
render,
|
|
1742
|
+
className,
|
|
1743
|
+
style,
|
|
1744
|
+
...elementProps
|
|
1745
|
+
} = componentProps;
|
|
1746
|
+
const store = usePopoverRootContext();
|
|
1747
|
+
const id = useBaseUiId(elementProps.id);
|
|
1748
|
+
store.useSyncedValueWithCleanup("titleElementId", id);
|
|
1749
|
+
const element = useRenderElement("h2", componentProps, {
|
|
1750
|
+
ref: forwardedRef,
|
|
1751
|
+
props: [{
|
|
1752
|
+
id
|
|
1753
|
+
}, elementProps]
|
|
1754
|
+
});
|
|
1755
|
+
return element;
|
|
1756
|
+
});
|
|
1757
|
+
if (true) PopoverTitle.displayName = "PopoverTitle";
|
|
1758
|
+
|
|
1759
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/description/PopoverDescription.mjs
|
|
1760
|
+
import * as React21 from "react";
|
|
1761
|
+
var PopoverDescription = /* @__PURE__ */ React21.forwardRef(function PopoverDescription2(componentProps, forwardedRef) {
|
|
1762
|
+
const {
|
|
1763
|
+
render,
|
|
1764
|
+
className,
|
|
1765
|
+
style,
|
|
1766
|
+
...elementProps
|
|
1767
|
+
} = componentProps;
|
|
1768
|
+
const store = usePopoverRootContext();
|
|
1769
|
+
const id = useBaseUiId(elementProps.id);
|
|
1770
|
+
store.useSyncedValueWithCleanup("descriptionElementId", id);
|
|
1771
|
+
const element = useRenderElement("p", componentProps, {
|
|
1772
|
+
ref: forwardedRef,
|
|
1773
|
+
props: [{
|
|
1774
|
+
id
|
|
1775
|
+
}, elementProps]
|
|
1776
|
+
});
|
|
1777
|
+
return element;
|
|
1778
|
+
});
|
|
1779
|
+
if (true) PopoverDescription.displayName = "PopoverDescription";
|
|
1780
|
+
|
|
1781
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/close/PopoverClose.mjs
|
|
1782
|
+
import * as React22 from "react";
|
|
1783
|
+
var PopoverClose = /* @__PURE__ */ React22.forwardRef(function PopoverClose2(componentProps, forwardedRef) {
|
|
1784
|
+
const {
|
|
1785
|
+
render,
|
|
1786
|
+
className,
|
|
1787
|
+
style,
|
|
1788
|
+
disabled = false,
|
|
1789
|
+
nativeButton = true,
|
|
1790
|
+
...elementProps
|
|
1791
|
+
} = componentProps;
|
|
1792
|
+
const {
|
|
1793
|
+
buttonRef,
|
|
1794
|
+
getButtonProps
|
|
1795
|
+
} = useButton({
|
|
1796
|
+
disabled,
|
|
1797
|
+
focusableWhenDisabled: false,
|
|
1798
|
+
native: nativeButton
|
|
1799
|
+
});
|
|
1800
|
+
const store = usePopoverRootContext();
|
|
1801
|
+
useClosePartRegistration();
|
|
1802
|
+
const element = useRenderElement("button", componentProps, {
|
|
1803
|
+
ref: [forwardedRef, buttonRef],
|
|
1804
|
+
props: [{
|
|
1805
|
+
onClick(event) {
|
|
1806
|
+
store.setOpen(false, createChangeEventDetails(reason_parts_exports.closePress, event.nativeEvent));
|
|
1807
|
+
}
|
|
1808
|
+
}, elementProps, getButtonProps]
|
|
1809
|
+
});
|
|
1810
|
+
return element;
|
|
1811
|
+
});
|
|
1812
|
+
if (true) PopoverClose.displayName = "PopoverClose";
|
|
1813
|
+
|
|
1814
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/viewport/PopoverViewport.mjs
|
|
1815
|
+
import * as React23 from "react";
|
|
1816
|
+
var PopoverViewport = /* @__PURE__ */ React23.forwardRef(function PopoverViewport2(componentProps, forwardedRef) {
|
|
1817
|
+
const {
|
|
1818
|
+
render,
|
|
1819
|
+
className,
|
|
1820
|
+
style,
|
|
1821
|
+
children,
|
|
1822
|
+
...elementProps
|
|
1823
|
+
} = componentProps;
|
|
1824
|
+
const store = usePopoverRootContext();
|
|
1825
|
+
const {
|
|
1826
|
+
side
|
|
1827
|
+
} = usePopoverPositionerContext();
|
|
1828
|
+
const instantType = store.useState("instantType");
|
|
1829
|
+
const {
|
|
1830
|
+
children: childrenToRender,
|
|
1831
|
+
state: viewportState
|
|
1832
|
+
} = usePopupViewport({
|
|
1833
|
+
store,
|
|
1834
|
+
side,
|
|
1835
|
+
children
|
|
1836
|
+
});
|
|
1837
|
+
const state = {
|
|
1838
|
+
activationDirection: viewportState.activationDirection,
|
|
1839
|
+
transitioning: viewportState.transitioning,
|
|
1840
|
+
instant: instantType
|
|
1841
|
+
};
|
|
1842
|
+
return useRenderElement("div", componentProps, {
|
|
1843
|
+
state,
|
|
1844
|
+
ref: forwardedRef,
|
|
1845
|
+
props: [elementProps, {
|
|
1846
|
+
children: childrenToRender
|
|
1847
|
+
}],
|
|
1848
|
+
stateAttributesMapping: popupViewportStateMapping
|
|
1849
|
+
});
|
|
1850
|
+
});
|
|
1851
|
+
if (true) PopoverViewport.displayName = "PopoverViewport";
|
|
1852
|
+
|
|
1853
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/popover/store/PopoverHandle.mjs
|
|
1854
|
+
var PopoverHandle = class extends BasePopupHandle {
|
|
1855
|
+
constructor() {
|
|
1856
|
+
super(createNullPopoverStore(), "Popover");
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* Opens the popover and associates it with the trigger with the given id.
|
|
1860
|
+
*
|
|
1861
|
+
* This method should only be called in an event handler or an effect (not during rendering).
|
|
1862
|
+
*
|
|
1863
|
+
* @param triggerId ID of the trigger to associate with the popover. The trigger must be a matching
|
|
1864
|
+
* `Popover.Trigger` with this handle passed as a prop.
|
|
1865
|
+
*/
|
|
1866
|
+
open(triggerId) {
|
|
1867
|
+
this.openByTrigger(triggerId);
|
|
1868
|
+
}
|
|
1869
|
+
/**
|
|
1870
|
+
* Closes the popover.
|
|
1871
|
+
*
|
|
1872
|
+
* This method should only be called in an event handler or an effect (not during rendering).
|
|
1873
|
+
*/
|
|
1874
|
+
close() {
|
|
1875
|
+
this.closePopup();
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Whether the popover is currently open. Returns `false` while no root is attached to the handle.
|
|
1879
|
+
*/
|
|
1880
|
+
get isOpen() {
|
|
1881
|
+
return this.attachedStore?.select("open") ?? false;
|
|
1882
|
+
}
|
|
1883
|
+
};
|
|
1884
|
+
function createPopoverHandle() {
|
|
1885
|
+
return new PopoverHandle();
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
// src/primitives/popover.tsx
|
|
1889
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1890
|
+
function Popover({ ...props }) {
|
|
1891
|
+
return /* @__PURE__ */ jsx13(index_parts_exports3.Root, { "data-slot": "popover", ...props });
|
|
1892
|
+
}
|
|
1893
|
+
function PopoverTrigger3({ ...props }) {
|
|
1894
|
+
return /* @__PURE__ */ jsx13(index_parts_exports3.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
1895
|
+
}
|
|
1896
|
+
function PopoverPortal3({ ...props }) {
|
|
1897
|
+
return /* @__PURE__ */ jsx13(index_parts_exports3.Portal, { "data-slot": "popover-portal", ...props });
|
|
1898
|
+
}
|
|
1899
|
+
function PopoverPositioner3({ className, ...props }) {
|
|
1900
|
+
return /* @__PURE__ */ jsx13(index_parts_exports3.Positioner, { "data-slot": "popover-positioner", className, ...props });
|
|
1901
|
+
}
|
|
1902
|
+
function PopoverContent({ className, children, ...props }) {
|
|
1903
|
+
return /* @__PURE__ */ jsx13(PopoverPortal3, { children: /* @__PURE__ */ jsx13(PopoverPositioner3, { children: /* @__PURE__ */ jsx13(index_parts_exports3.Popup, { "data-slot": "popover-content", className: cn("z-50 w-72 rounded-md border bg-surface-floating p-4 text-text-primary shadow-[var(--ds-shadow-floating)] outline-none data-open:animate-in data-closed:animate-out", className), ...props, children }) }) });
|
|
1904
|
+
}
|
|
1905
|
+
function PopoverArrow3({ ...props }) {
|
|
1906
|
+
return /* @__PURE__ */ jsx13(index_parts_exports3.Arrow, { "data-slot": "popover-arrow", ...props });
|
|
1907
|
+
}
|
|
1908
|
+
function PopoverTitle3({ className, ...props }) {
|
|
1909
|
+
return /* @__PURE__ */ jsx13(index_parts_exports3.Title, { "data-slot": "popover-title", className: cn("font-semibold", className), ...props });
|
|
1910
|
+
}
|
|
1911
|
+
function PopoverDescription3({ className, ...props }) {
|
|
1912
|
+
return /* @__PURE__ */ jsx13(index_parts_exports3.Description, { "data-slot": "popover-description", className: cn("text-sm text-text-supporting", className), ...props });
|
|
1913
|
+
}
|
|
1914
|
+
function PopoverClose3({ ...props }) {
|
|
1915
|
+
return /* @__PURE__ */ jsx13(index_parts_exports3.Close, { "data-slot": "popover-close", ...props });
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
// src/primitives/searchable-select.tsx
|
|
1919
|
+
import * as React24 from "react";
|
|
1920
|
+
import { Check, ChevronsUpDown, X } from "lucide-react";
|
|
1921
|
+
import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1922
|
+
function SearchableSelect({ id, name, value = "", options, onValueChange, placeholder = "Select an option", searchPlaceholder = "Search...", emptyMessage = "No matching options.", disabled = false, clearable = false, clearLabel = "Clear selection", optionsLabel, className, "aria-label": ariaLabel }) {
|
|
1923
|
+
const selected = options.find((option) => option.value === value) ?? null;
|
|
1924
|
+
const items = React24.useMemo(() => options.map((option) => option.value), [options]);
|
|
1925
|
+
const [open, setOpen] = React24.useState(false);
|
|
1926
|
+
const [inputValue, setInputValue] = React24.useState(selected?.label ?? "");
|
|
1927
|
+
const inputRef = React24.useRef(null);
|
|
1928
|
+
React24.useLayoutEffect(() => {
|
|
1929
|
+
if (!open && inputRef.current) inputRef.current.value = selected?.label ?? "";
|
|
1930
|
+
}, [open, selected?.label]);
|
|
1931
|
+
return /* @__PURE__ */ jsx14("div", { "data-slot": "searchable-select", className: cn("relative min-w-0", className), children: /* @__PURE__ */ jsxs5(index_parts_exports.Root, { items, autoHighlight: true, open, onOpenChange: (nextOpen) => {
|
|
1932
|
+
setOpen(nextOpen);
|
|
1933
|
+
if (!nextOpen) setInputValue(selected?.label ?? "");
|
|
1934
|
+
}, value, inputValue: open ? inputValue : selected?.label ?? "", onInputValueChange: setInputValue, onValueChange: (next) => {
|
|
1935
|
+
const nextOption = options.find((option) => option.value === next);
|
|
1936
|
+
setInputValue(nextOption?.label ?? "");
|
|
1937
|
+
onValueChange(next ?? "");
|
|
1938
|
+
}, itemToStringLabel: (item) => options.find((option) => option.value === item)?.label ?? "", itemToStringValue: (item) => item ?? "", name, disabled, children: [
|
|
1939
|
+
/* @__PURE__ */ jsxs5(index_parts_exports.InputGroup, { className: "relative flex items-center", children: [
|
|
1940
|
+
/* @__PURE__ */ jsx14(index_parts_exports.Input, { ref: inputRef, id, "aria-label": ariaLabel, placeholder: searchPlaceholder, onKeyDown: (event) => {
|
|
1941
|
+
if (event.key === "Enter" && open) {
|
|
1942
|
+
const matches = options.filter((option) => !option.disabled && option.label.toLowerCase().includes(inputValue.toLowerCase()));
|
|
1943
|
+
const match = matches.at(-1);
|
|
1944
|
+
if (match && match.value !== value) {
|
|
1945
|
+
event.preventDefault();
|
|
1946
|
+
setOpen(false);
|
|
1947
|
+
onValueChange(match.value);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
}, className: "ds-type-control h-[var(--ds-field-control-height)] w-full rounded-[var(--ds-field-control-radius)] border border-control-border bg-surface-control px-3 pr-16 outline-none focus-visible:border-focus focus-visible:ring-[3px] focus-visible:ring-focus/50 disabled:cursor-not-allowed disabled:opacity-50" }),
|
|
1951
|
+
clearable && selected ? /* @__PURE__ */ jsx14(IconButton, { type: "button", size: "sm", variant: "ghost", "aria-label": clearLabel, onClick: () => onValueChange(""), className: "absolute right-7", children: /* @__PURE__ */ jsx14(X, { className: "size-4" }) }) : null,
|
|
1952
|
+
/* @__PURE__ */ jsx14(index_parts_exports.Trigger, { "aria-label": ariaLabel ?? placeholder, className: "absolute right-1 inline-flex size-8 items-center justify-center rounded-sm text-text-supporting outline-none focus-visible:ring-2 focus-visible:ring-focus", children: /* @__PURE__ */ jsx14(ChevronsUpDown, { className: "size-4" }) })
|
|
1953
|
+
] }),
|
|
1954
|
+
/* @__PURE__ */ jsx14(index_parts_exports.Portal, { children: /* @__PURE__ */ jsx14(index_parts_exports.Positioner, { className: "z-50 w-[var(--anchor-width)]", children: /* @__PURE__ */ jsxs5(index_parts_exports.Popup, { className: "mt-1 max-h-72 overflow-auto rounded-md border bg-surface-floating p-1 text-text-primary shadow-[var(--ds-shadow-floating)] outline-none", children: [
|
|
1955
|
+
/* @__PURE__ */ jsx14(index_parts_exports.Empty, { className: "px-2 py-3 text-sm text-text-supporting", children: emptyMessage }),
|
|
1956
|
+
/* @__PURE__ */ jsx14(index_parts_exports.List, { "aria-label": optionsLabel ?? "Options", children: (optionValue) => {
|
|
1957
|
+
const option = options.find((candidate) => candidate.value === optionValue);
|
|
1958
|
+
if (!option) return null;
|
|
1959
|
+
return /* @__PURE__ */ jsxs5(index_parts_exports.Item, { value: option.value, disabled: option.disabled, className: "ds-type-menu-item data-highlighted:bg-surface-muted relative flex cursor-default items-start gap-2 rounded-sm px-2 py-2 pr-8 outline-none data-disabled:pointer-events-none data-disabled:opacity-50", children: [
|
|
1960
|
+
/* @__PURE__ */ jsx14("span", { className: "mt-0.5 flex size-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx14(index_parts_exports.ItemIndicator, { children: /* @__PURE__ */ jsx14(Check, { className: "size-4" }) }) }),
|
|
1961
|
+
/* @__PURE__ */ jsxs5("span", { className: "min-w-0", children: [
|
|
1962
|
+
/* @__PURE__ */ jsx14("span", { className: "block truncate text-sm", children: option.label }),
|
|
1963
|
+
option.description ? /* @__PURE__ */ jsx14("span", { className: "block truncate text-xs text-text-supporting", children: option.description }) : null
|
|
1964
|
+
] })
|
|
1965
|
+
] }, option.value);
|
|
1966
|
+
} })
|
|
1967
|
+
] }) }) })
|
|
1968
|
+
] }) });
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
// src/primitives/spinner.tsx
|
|
1972
|
+
import { LoaderCircle } from "lucide-react";
|
|
1973
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1974
|
+
function Spinner({
|
|
1975
|
+
"aria-label": ariaLabel,
|
|
1976
|
+
className,
|
|
1977
|
+
label,
|
|
1978
|
+
size = "default",
|
|
1979
|
+
...props
|
|
1980
|
+
}) {
|
|
1981
|
+
const accessibleLabel = ariaLabel ?? label;
|
|
1982
|
+
return /* @__PURE__ */ jsx15(
|
|
1983
|
+
"span",
|
|
1984
|
+
{
|
|
1985
|
+
"data-slot": "spinner",
|
|
1986
|
+
"data-size": size,
|
|
1987
|
+
className: cn(
|
|
1988
|
+
"inline-flex shrink-0 animate-spin items-center justify-center text-current motion-reduce:animate-none data-[size=default]:size-4 data-[size=lg]:size-5 data-[size=sm]:size-3.5",
|
|
1989
|
+
className
|
|
1990
|
+
),
|
|
1991
|
+
role: accessibleLabel ? "status" : void 0,
|
|
1992
|
+
"aria-hidden": accessibleLabel ? void 0 : true,
|
|
1993
|
+
"aria-label": accessibleLabel,
|
|
1994
|
+
...props,
|
|
1995
|
+
children: /* @__PURE__ */ jsx15(LoaderCircle, { "aria-hidden": "true", className: "size-full" })
|
|
1996
|
+
}
|
|
1997
|
+
);
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
// src/primitives/toast.tsx
|
|
2001
|
+
import * as React41 from "react";
|
|
2002
|
+
|
|
2003
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/index.parts.mjs
|
|
2004
|
+
var index_parts_exports4 = {};
|
|
2005
|
+
__export(index_parts_exports4, {
|
|
2006
|
+
Action: () => ToastAction,
|
|
2007
|
+
Arrow: () => ToastArrow,
|
|
2008
|
+
Close: () => ToastClose,
|
|
2009
|
+
Content: () => ToastContent,
|
|
2010
|
+
Description: () => ToastDescription,
|
|
2011
|
+
Portal: () => ToastPortal,
|
|
2012
|
+
Positioner: () => ToastPositioner,
|
|
2013
|
+
Provider: () => ToastProvider,
|
|
2014
|
+
Root: () => ToastRoot,
|
|
2015
|
+
Title: () => ToastTitle,
|
|
2016
|
+
Viewport: () => ToastViewport,
|
|
2017
|
+
createToastManager: () => createToastManager,
|
|
2018
|
+
useToastManager: () => useToastManager
|
|
2019
|
+
});
|
|
2020
|
+
|
|
2021
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/provider/ToastProvider.mjs
|
|
2022
|
+
import * as React26 from "react";
|
|
2023
|
+
|
|
2024
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/provider/ToastProviderContext.mjs
|
|
2025
|
+
import * as React25 from "react";
|
|
2026
|
+
var ToastContext = /* @__PURE__ */ React25.createContext(void 0);
|
|
2027
|
+
if (true) ToastContext.displayName = "ToastContext";
|
|
2028
|
+
function useToastProviderContext() {
|
|
2029
|
+
const context = React25.useContext(ToastContext);
|
|
2030
|
+
if (!context) {
|
|
2031
|
+
throw new Error(true ? "Base UI: useToastManager must be used within <Toast.Provider>." : formatErrorMessage_default(73));
|
|
2032
|
+
}
|
|
2033
|
+
return context;
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
// node_modules/.pnpm/@base-ui+utils@0.3.2_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/utils/generateId.mjs
|
|
2037
|
+
var counter = 0;
|
|
2038
|
+
function generateId(prefix) {
|
|
2039
|
+
counter += 1;
|
|
2040
|
+
return `${prefix}-${Math.random().toString(36).slice(2, 6)}-${counter}`;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/utils/resolvePromiseOptions.mjs
|
|
2044
|
+
function resolvePromiseOptions(options, result) {
|
|
2045
|
+
if (typeof options === "string") {
|
|
2046
|
+
return {
|
|
2047
|
+
description: options
|
|
2048
|
+
};
|
|
2049
|
+
}
|
|
2050
|
+
if (typeof options === "function") {
|
|
2051
|
+
const resolvedOptions = options(result);
|
|
2052
|
+
return typeof resolvedOptions === "string" ? {
|
|
2053
|
+
description: resolvedOptions
|
|
2054
|
+
} : resolvedOptions;
|
|
2055
|
+
}
|
|
2056
|
+
return options;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/store.mjs
|
|
2060
|
+
function createToastMetadata(toasts) {
|
|
2061
|
+
const metadata = /* @__PURE__ */ new Map();
|
|
2062
|
+
let visibleIndex = 0;
|
|
2063
|
+
let offsetY = 0;
|
|
2064
|
+
toasts.forEach((toast, toastIndex) => {
|
|
2065
|
+
const isEnding = toast.transitionStatus === "ending";
|
|
2066
|
+
metadata.set(toast.id, {
|
|
2067
|
+
value: toast,
|
|
2068
|
+
domIndex: toastIndex,
|
|
2069
|
+
visibleIndex: isEnding ? -1 : visibleIndex,
|
|
2070
|
+
offsetY
|
|
2071
|
+
});
|
|
2072
|
+
offsetY += toast.height || 0;
|
|
2073
|
+
if (!isEnding) {
|
|
2074
|
+
visibleIndex += 1;
|
|
2075
|
+
}
|
|
2076
|
+
});
|
|
2077
|
+
return metadata;
|
|
2078
|
+
}
|
|
2079
|
+
function applyLimited(toasts, limit) {
|
|
2080
|
+
let activeIndex = 0;
|
|
2081
|
+
return toasts.map((toast) => {
|
|
2082
|
+
if (toast.transitionStatus === "ending") {
|
|
2083
|
+
return toast;
|
|
2084
|
+
}
|
|
2085
|
+
const limited = activeIndex >= limit;
|
|
2086
|
+
activeIndex += 1;
|
|
2087
|
+
return toast.limited === limited ? toast : {
|
|
2088
|
+
...toast,
|
|
2089
|
+
limited
|
|
2090
|
+
};
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2093
|
+
var selectors2 = {
|
|
2094
|
+
toasts: (state) => state.toasts,
|
|
2095
|
+
isEmpty: (state) => state.toasts.length === 0,
|
|
2096
|
+
toast: (state, id) => state.toastMetadata.get(id)?.value,
|
|
2097
|
+
toastIndex: (state, id) => state.toastMetadata.get(id)?.domIndex ?? -1,
|
|
2098
|
+
toastOffsetY: (state, id) => state.toastMetadata.get(id)?.offsetY ?? 0,
|
|
2099
|
+
toastVisibleIndex: (state, id) => state.toastMetadata.get(id)?.visibleIndex ?? -1,
|
|
2100
|
+
focused: (state) => state.focused,
|
|
2101
|
+
expanded: (state) => state.hovering || state.focused,
|
|
2102
|
+
expandedOrOutOfFocus: (state) => state.hovering || state.focused || !state.isWindowFocused,
|
|
2103
|
+
prevFocusElement: (state) => state.prevFocusElement
|
|
2104
|
+
};
|
|
2105
|
+
var ToastStore = class extends ReactStore {
|
|
2106
|
+
constructor(initialState) {
|
|
2107
|
+
super({
|
|
2108
|
+
...initialState,
|
|
2109
|
+
toastMetadata: createToastMetadata(initialState.toasts)
|
|
2110
|
+
}, {}, selectors2);
|
|
2111
|
+
__publicField(this, "timers", /* @__PURE__ */ new Map());
|
|
2112
|
+
__publicField(this, "areTimersPaused", false);
|
|
2113
|
+
__publicField(this, "setViewport", (viewport) => {
|
|
2114
|
+
this.set("viewport", viewport);
|
|
2115
|
+
});
|
|
2116
|
+
__publicField(this, "disposeEffect", () => {
|
|
2117
|
+
return () => {
|
|
2118
|
+
this.timers.forEach((timer) => {
|
|
2119
|
+
timer.timeout?.clear();
|
|
2120
|
+
});
|
|
2121
|
+
this.timers.clear();
|
|
2122
|
+
};
|
|
2123
|
+
});
|
|
2124
|
+
__publicField(this, "addToast", (toast) => {
|
|
2125
|
+
const {
|
|
2126
|
+
timeout,
|
|
2127
|
+
limit
|
|
2128
|
+
} = this.state;
|
|
2129
|
+
const id = toast.id || generateId("toast");
|
|
2130
|
+
if (toast.id) {
|
|
2131
|
+
const existingToast = selectors2.toast(this.state, toast.id);
|
|
2132
|
+
if (existingToast) {
|
|
2133
|
+
if (existingToast.transitionStatus === "ending") {
|
|
2134
|
+
this.removeToast(toast.id, true);
|
|
2135
|
+
} else {
|
|
2136
|
+
const {
|
|
2137
|
+
id: ignoredId,
|
|
2138
|
+
transitionStatus: ignoredTransitionStatus,
|
|
2139
|
+
...updates
|
|
2140
|
+
} = toast;
|
|
2141
|
+
this.updateToastInternal(toast.id, updates, true, true);
|
|
2142
|
+
return toast.id;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
const toastToAdd = {
|
|
2147
|
+
...toast,
|
|
2148
|
+
id,
|
|
2149
|
+
updateKey: 0,
|
|
2150
|
+
transitionStatus: "starting"
|
|
2151
|
+
};
|
|
2152
|
+
const updatedToasts = [toastToAdd, ...this.state.toasts];
|
|
2153
|
+
this.setToasts(applyLimited(updatedToasts, limit));
|
|
2154
|
+
const duration = toastToAdd.timeout ?? timeout;
|
|
2155
|
+
if (toastToAdd.type !== "loading" && duration > 0) {
|
|
2156
|
+
this.scheduleTimer(id, duration, () => this.closeToast(id));
|
|
2157
|
+
}
|
|
2158
|
+
if (selectors2.expandedOrOutOfFocus(this.state)) {
|
|
2159
|
+
this.pauseTimers();
|
|
2160
|
+
}
|
|
2161
|
+
return id;
|
|
2162
|
+
});
|
|
2163
|
+
__publicField(this, "updateToast", (id, updates) => {
|
|
2164
|
+
this.updateToastInternal(id, updates, false, true);
|
|
2165
|
+
});
|
|
2166
|
+
__publicField(this, "updateToastInternal", (id, updates, resetTimer = false, markUpdated = false) => {
|
|
2167
|
+
const {
|
|
2168
|
+
timeout,
|
|
2169
|
+
toasts
|
|
2170
|
+
} = this.state;
|
|
2171
|
+
const prevToast = selectors2.toast(this.state, id);
|
|
2172
|
+
if (!prevToast) {
|
|
2173
|
+
return;
|
|
2174
|
+
}
|
|
2175
|
+
if (prevToast.transitionStatus === "ending") {
|
|
2176
|
+
return;
|
|
2177
|
+
}
|
|
2178
|
+
const nextToast = {
|
|
2179
|
+
...prevToast,
|
|
2180
|
+
...updates,
|
|
2181
|
+
...markUpdated && {
|
|
2182
|
+
updateKey: prevToast.updateKey + 1
|
|
2183
|
+
}
|
|
2184
|
+
};
|
|
2185
|
+
this.setToasts(toasts.map((toast) => toast.id === id ? nextToast : toast));
|
|
2186
|
+
const nextTimeout = nextToast.timeout ?? timeout;
|
|
2187
|
+
const prevTimeout = prevToast.timeout ?? timeout;
|
|
2188
|
+
const timeoutUpdated = Object.hasOwn(updates, "timeout");
|
|
2189
|
+
const shouldHaveTimer = nextToast.transitionStatus !== "ending" && nextToast.type !== "loading" && nextTimeout > 0;
|
|
2190
|
+
const hasTimer = this.timers.has(id);
|
|
2191
|
+
const timeoutChanged = prevTimeout !== nextTimeout;
|
|
2192
|
+
const wasLoading = prevToast.type === "loading";
|
|
2193
|
+
if (!shouldHaveTimer && hasTimer) {
|
|
2194
|
+
this.clearTimer(id);
|
|
2195
|
+
return;
|
|
2196
|
+
}
|
|
2197
|
+
if (shouldHaveTimer && (!hasTimer || timeoutChanged || timeoutUpdated || wasLoading || resetTimer)) {
|
|
2198
|
+
this.clearTimer(id);
|
|
2199
|
+
this.scheduleTimer(id, nextTimeout, () => this.closeToast(id));
|
|
2200
|
+
if (selectors2.expandedOrOutOfFocus(this.state)) {
|
|
2201
|
+
this.pauseTimers();
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
});
|
|
2205
|
+
__publicField(this, "closeToast", (toastId) => {
|
|
2206
|
+
const closeAll = toastId === void 0;
|
|
2207
|
+
const {
|
|
2208
|
+
limit,
|
|
2209
|
+
toasts
|
|
2210
|
+
} = this.state;
|
|
2211
|
+
let toastsToClose;
|
|
2212
|
+
if (closeAll) {
|
|
2213
|
+
toastsToClose = toasts;
|
|
2214
|
+
this.clearTimers();
|
|
2215
|
+
} else {
|
|
2216
|
+
const toast = selectors2.toast(this.state, toastId);
|
|
2217
|
+
if (!toast) {
|
|
2218
|
+
return;
|
|
2219
|
+
}
|
|
2220
|
+
toastsToClose = [toast];
|
|
2221
|
+
this.clearTimer(toastId);
|
|
2222
|
+
}
|
|
2223
|
+
const endingToasts = toasts.map((item) => closeAll || item.id === toastId ? {
|
|
2224
|
+
...item,
|
|
2225
|
+
transitionStatus: "ending",
|
|
2226
|
+
height: 0
|
|
2227
|
+
} : item);
|
|
2228
|
+
const newToasts = applyLimited(endingToasts, limit);
|
|
2229
|
+
this.setToasts(newToasts, !newToasts.some((toast) => toast.transitionStatus !== "ending"));
|
|
2230
|
+
toastsToClose.forEach((toast) => {
|
|
2231
|
+
if (toast.transitionStatus !== "ending") {
|
|
2232
|
+
toast.onClose?.();
|
|
2233
|
+
}
|
|
2234
|
+
});
|
|
2235
|
+
this.handleFocusManagement(toastId);
|
|
2236
|
+
});
|
|
2237
|
+
__publicField(this, "promiseToast", (promiseValue, options) => {
|
|
2238
|
+
const loadingOptions = resolvePromiseOptions(options.loading);
|
|
2239
|
+
const id = this.addToast({
|
|
2240
|
+
...loadingOptions,
|
|
2241
|
+
type: "loading"
|
|
2242
|
+
});
|
|
2243
|
+
const handledPromise = promiseValue.then((result) => {
|
|
2244
|
+
const successOptions = resolvePromiseOptions(options.success, result);
|
|
2245
|
+
this.updateToast(id, {
|
|
2246
|
+
...successOptions,
|
|
2247
|
+
type: "success",
|
|
2248
|
+
timeout: successOptions.timeout
|
|
2249
|
+
});
|
|
2250
|
+
return result;
|
|
2251
|
+
}).catch((error) => {
|
|
2252
|
+
const errorOptions = resolvePromiseOptions(options.error, error);
|
|
2253
|
+
this.updateToast(id, {
|
|
2254
|
+
...errorOptions,
|
|
2255
|
+
type: "error",
|
|
2256
|
+
timeout: errorOptions.timeout
|
|
2257
|
+
});
|
|
2258
|
+
return Promise.reject(error);
|
|
2259
|
+
});
|
|
2260
|
+
if ({}.hasOwnProperty.call(options, "setPromise")) {
|
|
2261
|
+
options.setPromise(handledPromise);
|
|
2262
|
+
}
|
|
2263
|
+
return handledPromise;
|
|
2264
|
+
});
|
|
2265
|
+
__publicField(this, "handleDocumentPointerDown", (event) => {
|
|
2266
|
+
if (event.pointerType !== "touch") {
|
|
2267
|
+
return;
|
|
2268
|
+
}
|
|
2269
|
+
const target = getTarget(event);
|
|
2270
|
+
if (contains(this.state.viewport, target)) {
|
|
2271
|
+
return;
|
|
2272
|
+
}
|
|
2273
|
+
this.resumeTimers();
|
|
2274
|
+
this.update({
|
|
2275
|
+
hovering: false,
|
|
2276
|
+
focused: false
|
|
2277
|
+
});
|
|
2278
|
+
});
|
|
2279
|
+
}
|
|
2280
|
+
syncProviderProps(timeout, limit) {
|
|
2281
|
+
const limitChanged = this.state.limit !== limit;
|
|
2282
|
+
if (this.state.timeout === timeout && !limitChanged) {
|
|
2283
|
+
return;
|
|
2284
|
+
}
|
|
2285
|
+
const updates = {
|
|
2286
|
+
timeout,
|
|
2287
|
+
limit
|
|
2288
|
+
};
|
|
2289
|
+
if (limitChanged) {
|
|
2290
|
+
const newToasts = applyLimited(this.state.toasts, limit);
|
|
2291
|
+
updates.toasts = newToasts;
|
|
2292
|
+
updates.toastMetadata = createToastMetadata(newToasts);
|
|
2293
|
+
}
|
|
2294
|
+
this.update(updates);
|
|
2295
|
+
}
|
|
2296
|
+
removeToast(toastId, skipOnRemove = false) {
|
|
2297
|
+
const index = selectors2.toastIndex(this.state, toastId);
|
|
2298
|
+
if (index === -1) {
|
|
2299
|
+
return;
|
|
2300
|
+
}
|
|
2301
|
+
const toast = this.state.toasts[index];
|
|
2302
|
+
if (!skipOnRemove) {
|
|
2303
|
+
toast?.onRemove?.();
|
|
2304
|
+
}
|
|
2305
|
+
const newToasts = [...this.state.toasts];
|
|
2306
|
+
newToasts.splice(index, 1);
|
|
2307
|
+
this.setToasts(newToasts);
|
|
2308
|
+
}
|
|
2309
|
+
pauseTimers() {
|
|
2310
|
+
if (this.areTimersPaused) {
|
|
2311
|
+
return;
|
|
2312
|
+
}
|
|
2313
|
+
this.areTimersPaused = true;
|
|
2314
|
+
this.timers.forEach((timer) => {
|
|
2315
|
+
if (timer.timeout) {
|
|
2316
|
+
timer.timeout.clear();
|
|
2317
|
+
timer.remaining = Math.max(timer.remaining - (Date.now() - timer.start), 0);
|
|
2318
|
+
}
|
|
2319
|
+
});
|
|
2320
|
+
}
|
|
2321
|
+
resumeTimers() {
|
|
2322
|
+
if (!this.areTimersPaused) {
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2325
|
+
this.areTimersPaused = false;
|
|
2326
|
+
this.timers.forEach((timer, id) => {
|
|
2327
|
+
timer.remaining = timer.remaining > 0 ? timer.remaining : timer.delay;
|
|
2328
|
+
timer.timeout ?? (timer.timeout = Timeout.create());
|
|
2329
|
+
timer.timeout.start(timer.remaining, () => {
|
|
2330
|
+
this.handleTimerFired(id);
|
|
2331
|
+
timer.callback();
|
|
2332
|
+
});
|
|
2333
|
+
timer.start = Date.now();
|
|
2334
|
+
});
|
|
2335
|
+
}
|
|
2336
|
+
restoreFocusToPrevElement() {
|
|
2337
|
+
this.state.prevFocusElement?.focus({
|
|
2338
|
+
preventScroll: true
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
scheduleTimer(id, delay, callback) {
|
|
2342
|
+
const start = Date.now();
|
|
2343
|
+
const shouldStartActive = !selectors2.expandedOrOutOfFocus(this.state);
|
|
2344
|
+
const currentTimeout = shouldStartActive ? Timeout.create() : void 0;
|
|
2345
|
+
currentTimeout?.start(delay, () => {
|
|
2346
|
+
this.handleTimerFired(id);
|
|
2347
|
+
callback();
|
|
2348
|
+
});
|
|
2349
|
+
this.timers.set(id, {
|
|
2350
|
+
timeout: currentTimeout,
|
|
2351
|
+
start,
|
|
2352
|
+
delay,
|
|
2353
|
+
remaining: delay,
|
|
2354
|
+
callback
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2357
|
+
clearTimers() {
|
|
2358
|
+
this.timers.forEach((timer) => {
|
|
2359
|
+
timer.timeout?.clear();
|
|
2360
|
+
});
|
|
2361
|
+
this.timers.clear();
|
|
2362
|
+
this.areTimersPaused = false;
|
|
2363
|
+
}
|
|
2364
|
+
clearTimer(id) {
|
|
2365
|
+
const timer = this.timers.get(id);
|
|
2366
|
+
timer?.timeout?.clear();
|
|
2367
|
+
this.timers.delete(id);
|
|
2368
|
+
this.resetPausedStateIfNoTimersRemain();
|
|
2369
|
+
}
|
|
2370
|
+
handleTimerFired(id) {
|
|
2371
|
+
this.timers.delete(id);
|
|
2372
|
+
this.resetPausedStateIfNoTimersRemain();
|
|
2373
|
+
}
|
|
2374
|
+
resetPausedStateIfNoTimersRemain() {
|
|
2375
|
+
if (this.timers.size === 0) {
|
|
2376
|
+
this.areTimersPaused = false;
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
setToasts(newToasts, clearInteraction = newToasts.length === 0) {
|
|
2380
|
+
const updates = {
|
|
2381
|
+
toasts: newToasts,
|
|
2382
|
+
toastMetadata: createToastMetadata(newToasts)
|
|
2383
|
+
};
|
|
2384
|
+
if (clearInteraction) {
|
|
2385
|
+
updates.hovering = false;
|
|
2386
|
+
updates.focused = false;
|
|
2387
|
+
}
|
|
2388
|
+
this.update(updates);
|
|
2389
|
+
}
|
|
2390
|
+
handleFocusManagement(toastId) {
|
|
2391
|
+
const activeEl = activeElement(ownerDocument(this.state.viewport));
|
|
2392
|
+
if (!this.state.viewport || !contains(this.state.viewport, activeEl) || !matchesFocusVisible(activeEl)) {
|
|
2393
|
+
return;
|
|
2394
|
+
}
|
|
2395
|
+
if (toastId === void 0) {
|
|
2396
|
+
this.restoreFocusToPrevElement();
|
|
2397
|
+
return;
|
|
2398
|
+
}
|
|
2399
|
+
const toasts = selectors2.toasts(this.state);
|
|
2400
|
+
const currentIndex = selectors2.toastIndex(this.state, toastId);
|
|
2401
|
+
const scan = (from, step) => {
|
|
2402
|
+
for (let index = from; index >= 0 && index < toasts.length; index += step) {
|
|
2403
|
+
if (toasts[index].transitionStatus !== "ending") {
|
|
2404
|
+
return toasts[index];
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
return null;
|
|
2408
|
+
};
|
|
2409
|
+
const nextToast = scan(currentIndex + 1, 1) ?? scan(currentIndex - 1, -1);
|
|
2410
|
+
if (nextToast) {
|
|
2411
|
+
nextToast.ref?.current?.focus();
|
|
2412
|
+
} else {
|
|
2413
|
+
this.restoreFocusToPrevElement();
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
};
|
|
2417
|
+
|
|
2418
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/provider/ToastProvider.mjs
|
|
2419
|
+
import { jsx as _jsx7, jsxs as _jsxs5 } from "react/jsx-runtime";
|
|
2420
|
+
var ToastProvider = function ToastProvider2(props) {
|
|
2421
|
+
const {
|
|
2422
|
+
children,
|
|
2423
|
+
timeout = 5e3,
|
|
2424
|
+
limit = 3,
|
|
2425
|
+
toastManager
|
|
2426
|
+
} = props;
|
|
2427
|
+
const store = useRefWithInit(() => new ToastStore({
|
|
2428
|
+
timeout,
|
|
2429
|
+
limit,
|
|
2430
|
+
viewport: null,
|
|
2431
|
+
toasts: [],
|
|
2432
|
+
hovering: false,
|
|
2433
|
+
focused: false,
|
|
2434
|
+
isWindowFocused: true,
|
|
2435
|
+
prevFocusElement: null
|
|
2436
|
+
})).current;
|
|
2437
|
+
useOnMount(store.disposeEffect);
|
|
2438
|
+
React26.useEffect(function subscribeToToastManager() {
|
|
2439
|
+
if (!toastManager) {
|
|
2440
|
+
return void 0;
|
|
2441
|
+
}
|
|
2442
|
+
const unsubscribe = toastManager[" subscribe"](({
|
|
2443
|
+
action,
|
|
2444
|
+
options
|
|
2445
|
+
}) => {
|
|
2446
|
+
const id = options.id;
|
|
2447
|
+
if (action === "promise" && options.promise) {
|
|
2448
|
+
store.promiseToast(options.promise, options);
|
|
2449
|
+
} else if (action === "update" && id) {
|
|
2450
|
+
store.updateToast(id, options);
|
|
2451
|
+
} else if (action === "close") {
|
|
2452
|
+
store.closeToast(id);
|
|
2453
|
+
} else {
|
|
2454
|
+
store.addToast(options);
|
|
2455
|
+
}
|
|
2456
|
+
});
|
|
2457
|
+
return unsubscribe;
|
|
2458
|
+
}, [store, toastManager]);
|
|
2459
|
+
return /* @__PURE__ */ _jsxs5(ToastContext.Provider, {
|
|
2460
|
+
value: store,
|
|
2461
|
+
children: [/* @__PURE__ */ _jsx7(ToastProviderPropsSynchronizer, {
|
|
2462
|
+
store,
|
|
2463
|
+
timeout,
|
|
2464
|
+
limit
|
|
2465
|
+
}), children]
|
|
2466
|
+
});
|
|
2467
|
+
};
|
|
2468
|
+
if (true) ToastProvider.displayName = "ToastProvider";
|
|
2469
|
+
function ToastProviderPropsSynchronizer(props) {
|
|
2470
|
+
const {
|
|
2471
|
+
store,
|
|
2472
|
+
timeout,
|
|
2473
|
+
limit
|
|
2474
|
+
} = props;
|
|
2475
|
+
useIsoLayoutEffect(() => {
|
|
2476
|
+
store.syncProviderProps(timeout, limit);
|
|
2477
|
+
}, [store, timeout, limit]);
|
|
2478
|
+
return null;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/viewport/ToastViewport.mjs
|
|
2482
|
+
import * as React27 from "react";
|
|
2483
|
+
import { jsx as _jsx8, jsxs as _jsxs6 } from "react/jsx-runtime";
|
|
2484
|
+
var ToastViewport = /* @__PURE__ */ React27.forwardRef(function ToastViewport2(componentProps, forwardedRef) {
|
|
2485
|
+
const {
|
|
2486
|
+
render,
|
|
2487
|
+
className,
|
|
2488
|
+
style,
|
|
2489
|
+
children,
|
|
2490
|
+
...elementProps
|
|
2491
|
+
} = componentProps;
|
|
2492
|
+
const store = useToastProviderContext();
|
|
2493
|
+
const windowFocusTimeout = useTimeout();
|
|
2494
|
+
const handlingFocusGuardRef = React27.useRef(false);
|
|
2495
|
+
const markedReadyForMouseLeaveRef = React27.useRef(false);
|
|
2496
|
+
const touchActiveRef = React27.useRef(false);
|
|
2497
|
+
const isEmpty = store.useState("isEmpty");
|
|
2498
|
+
const toasts = store.useState("toasts");
|
|
2499
|
+
const focused = store.useState("focused");
|
|
2500
|
+
const expanded = store.useState("expanded");
|
|
2501
|
+
const prevFocusElement = store.useState("prevFocusElement");
|
|
2502
|
+
const frontmostHeight = toasts[0]?.height;
|
|
2503
|
+
const hasTransitioningToasts = toasts.some((toast) => toast.transitionStatus === "ending");
|
|
2504
|
+
const highPriorityToasts = toasts.filter((toast) => toast.priority === "high");
|
|
2505
|
+
React27.useEffect(() => {
|
|
2506
|
+
const viewport = store.state.viewport;
|
|
2507
|
+
if (!viewport || isEmpty) {
|
|
2508
|
+
return void 0;
|
|
2509
|
+
}
|
|
2510
|
+
const win = getWindow(viewport);
|
|
2511
|
+
const doc = ownerDocument(viewport);
|
|
2512
|
+
function handleGlobalKeyDown(event) {
|
|
2513
|
+
if (event.key === "F6" && getTarget(event) !== viewport) {
|
|
2514
|
+
event.preventDefault();
|
|
2515
|
+
store.set("prevFocusElement", activeElement(doc));
|
|
2516
|
+
viewport?.focus({
|
|
2517
|
+
preventScroll: true
|
|
2518
|
+
});
|
|
2519
|
+
store.pauseTimers();
|
|
2520
|
+
store.set("focused", true);
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
function handleWindowBlur(event) {
|
|
2524
|
+
if (getTarget(event) !== win) {
|
|
2525
|
+
return;
|
|
2526
|
+
}
|
|
2527
|
+
store.set("isWindowFocused", false);
|
|
2528
|
+
store.pauseTimers();
|
|
2529
|
+
}
|
|
2530
|
+
function handleWindowFocus(event) {
|
|
2531
|
+
if (event.relatedTarget) {
|
|
2532
|
+
return;
|
|
2533
|
+
}
|
|
2534
|
+
const target = getTarget(event);
|
|
2535
|
+
const activeEl = activeElement(ownerDocument(viewport));
|
|
2536
|
+
if (target === win || !contains(viewport, target) || !matchesFocusVisible(activeEl)) {
|
|
2537
|
+
store.resumeTimers();
|
|
2538
|
+
}
|
|
2539
|
+
windowFocusTimeout.start(0, () => store.set("isWindowFocused", true));
|
|
2540
|
+
}
|
|
2541
|
+
return mergeCleanups(addEventListener(win, "keydown", handleGlobalKeyDown), addEventListener(win, "blur", handleWindowBlur, true), addEventListener(win, "focus", handleWindowFocus, true), addEventListener(doc, "pointerdown", store.handleDocumentPointerDown, true));
|
|
2542
|
+
}, [store, windowFocusTimeout, isEmpty]);
|
|
2543
|
+
function handleFocusGuard(event) {
|
|
2544
|
+
handlingFocusGuardRef.current = true;
|
|
2545
|
+
const firstFocusableToast = event.relatedTarget === store.state.viewport ? toasts.find((toast) => toast.transitionStatus !== "ending" && !toast.limited) : void 0;
|
|
2546
|
+
if (firstFocusableToast) {
|
|
2547
|
+
firstFocusableToast.ref?.current?.focus();
|
|
2548
|
+
} else {
|
|
2549
|
+
store.restoreFocusToPrevElement();
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
function handleKeyDown(event) {
|
|
2553
|
+
if (event.key === "Tab" && event.shiftKey && getTarget(event.nativeEvent) === store.state.viewport) {
|
|
2554
|
+
event.preventDefault();
|
|
2555
|
+
store.restoreFocusToPrevElement();
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
function flushMouseLeave() {
|
|
2559
|
+
const hasEndingToasts = store.state.toasts.some((toast) => toast.transitionStatus === "ending");
|
|
2560
|
+
if (hasEndingToasts || touchActiveRef.current || !markedReadyForMouseLeaveRef.current) {
|
|
2561
|
+
return;
|
|
2562
|
+
}
|
|
2563
|
+
if (store.state.isWindowFocused) {
|
|
2564
|
+
store.resumeTimers();
|
|
2565
|
+
}
|
|
2566
|
+
store.set("hovering", false);
|
|
2567
|
+
markedReadyForMouseLeaveRef.current = false;
|
|
2568
|
+
}
|
|
2569
|
+
React27.useEffect(flushMouseLeave, [hasTransitioningToasts, store]);
|
|
2570
|
+
function handleMouseEnter() {
|
|
2571
|
+
store.pauseTimers();
|
|
2572
|
+
store.set("hovering", true);
|
|
2573
|
+
markedReadyForMouseLeaveRef.current = false;
|
|
2574
|
+
}
|
|
2575
|
+
function resumeTimersIfWindowFocused() {
|
|
2576
|
+
if (store.state.isWindowFocused) {
|
|
2577
|
+
store.resumeTimers();
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
function handleMouseLeave() {
|
|
2581
|
+
markedReadyForMouseLeaveRef.current = true;
|
|
2582
|
+
flushMouseLeave();
|
|
2583
|
+
}
|
|
2584
|
+
function handlePointerDown(event) {
|
|
2585
|
+
if (event.pointerType === "touch") {
|
|
2586
|
+
touchActiveRef.current = true;
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
function handlePointerEnd(event) {
|
|
2590
|
+
if (event.pointerType !== "touch") {
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
touchActiveRef.current = false;
|
|
2594
|
+
flushMouseLeave();
|
|
2595
|
+
}
|
|
2596
|
+
function handleFocus() {
|
|
2597
|
+
if (handlingFocusGuardRef.current) {
|
|
2598
|
+
handlingFocusGuardRef.current = false;
|
|
2599
|
+
return;
|
|
2600
|
+
}
|
|
2601
|
+
if (focused) {
|
|
2602
|
+
return;
|
|
2603
|
+
}
|
|
2604
|
+
if (matchesFocusVisible(activeElement(ownerDocument(store.state.viewport)))) {
|
|
2605
|
+
store.set("focused", true);
|
|
2606
|
+
store.pauseTimers();
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
function handleBlur(event) {
|
|
2610
|
+
if (!focused || contains(store.state.viewport, event.relatedTarget)) {
|
|
2611
|
+
return;
|
|
2612
|
+
}
|
|
2613
|
+
store.set("focused", false);
|
|
2614
|
+
resumeTimersIfWindowFocused();
|
|
2615
|
+
}
|
|
2616
|
+
const defaultProps = {
|
|
2617
|
+
tabIndex: -1,
|
|
2618
|
+
role: "region",
|
|
2619
|
+
"aria-live": "polite",
|
|
2620
|
+
"aria-atomic": false,
|
|
2621
|
+
"aria-relevant": "additions text",
|
|
2622
|
+
"aria-label": "Notifications",
|
|
2623
|
+
onMouseEnter: handleMouseEnter,
|
|
2624
|
+
onMouseMove: handleMouseEnter,
|
|
2625
|
+
onMouseLeave: handleMouseLeave,
|
|
2626
|
+
onFocus: handleFocus,
|
|
2627
|
+
onBlur: handleBlur,
|
|
2628
|
+
onKeyDown: handleKeyDown,
|
|
2629
|
+
onClick: handleFocus,
|
|
2630
|
+
onPointerDown: handlePointerDown,
|
|
2631
|
+
onPointerUp: handlePointerEnd,
|
|
2632
|
+
onPointerCancel: handlePointerEnd,
|
|
2633
|
+
style: {
|
|
2634
|
+
["--toast-frontmost-height"]: frontmostHeight ? `${frontmostHeight}px` : void 0
|
|
2635
|
+
}
|
|
2636
|
+
};
|
|
2637
|
+
const state = {
|
|
2638
|
+
expanded
|
|
2639
|
+
};
|
|
2640
|
+
const focusGuard = !isEmpty && prevFocusElement && /* @__PURE__ */ _jsx8(FocusGuard, {
|
|
2641
|
+
onFocus: handleFocusGuard
|
|
2642
|
+
});
|
|
2643
|
+
const element = useRenderElement("div", componentProps, {
|
|
2644
|
+
ref: [forwardedRef, store.setViewport],
|
|
2645
|
+
state,
|
|
2646
|
+
props: [defaultProps, elementProps, {
|
|
2647
|
+
children: /* @__PURE__ */ _jsxs6(React27.Fragment, {
|
|
2648
|
+
children: [focusGuard, children, focusGuard]
|
|
2649
|
+
})
|
|
2650
|
+
}]
|
|
2651
|
+
});
|
|
2652
|
+
return /* @__PURE__ */ _jsxs6(React27.Fragment, {
|
|
2653
|
+
children: [focusGuard, element, !focused && highPriorityToasts.length > 0 && /* @__PURE__ */ _jsx8("div", {
|
|
2654
|
+
style: visuallyHidden,
|
|
2655
|
+
children: highPriorityToasts.map((toast) => /* @__PURE__ */ _jsxs6("div", {
|
|
2656
|
+
role: "alert",
|
|
2657
|
+
"aria-atomic": true,
|
|
2658
|
+
children: [/* @__PURE__ */ _jsx8("div", {
|
|
2659
|
+
children: toast.title
|
|
2660
|
+
}), /* @__PURE__ */ _jsx8("div", {
|
|
2661
|
+
children: toast.description
|
|
2662
|
+
})]
|
|
2663
|
+
}, toast.id))
|
|
2664
|
+
})]
|
|
2665
|
+
});
|
|
2666
|
+
});
|
|
2667
|
+
if (true) ToastViewport.displayName = "ToastViewport";
|
|
2668
|
+
|
|
2669
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/root/ToastRoot.mjs
|
|
2670
|
+
import * as React29 from "react";
|
|
2671
|
+
import * as ReactDOM2 from "react-dom";
|
|
2672
|
+
|
|
2673
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/root/ToastRootContext.mjs
|
|
2674
|
+
import * as React28 from "react";
|
|
2675
|
+
var ToastRootContext = /* @__PURE__ */ React28.createContext(void 0);
|
|
2676
|
+
if (true) ToastRootContext.displayName = "ToastRootContext";
|
|
2677
|
+
function useToastRootContext() {
|
|
2678
|
+
const context = React28.useContext(ToastRootContext);
|
|
2679
|
+
if (!context) {
|
|
2680
|
+
throw new Error(true ? "Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>." : formatErrorMessage_default(66));
|
|
2681
|
+
}
|
|
2682
|
+
return context;
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/root/ToastRoot.mjs
|
|
2686
|
+
import { jsx as _jsx9 } from "react/jsx-runtime";
|
|
2687
|
+
var toastRootStateAttributesMapping = {
|
|
2688
|
+
...transitionStatusMapping,
|
|
2689
|
+
swipeDirection(value) {
|
|
2690
|
+
return value ? {
|
|
2691
|
+
"data-swipe-direction": value
|
|
2692
|
+
} : null;
|
|
2693
|
+
}
|
|
2694
|
+
};
|
|
2695
|
+
var SWIPE_THRESHOLD = 40;
|
|
2696
|
+
var REVERSE_CANCEL_THRESHOLD = 10;
|
|
2697
|
+
var OPPOSITE_DIRECTION_DAMPING_FACTOR = 0.5;
|
|
2698
|
+
var MIN_DRAG_THRESHOLD = 1;
|
|
2699
|
+
var TOAST_SWIPE_IGNORE_SELECTOR = `${BASE_UI_SWIPE_IGNORE_SELECTOR},${LEGACY_SWIPE_IGNORE_SELECTOR}`;
|
|
2700
|
+
var ToastRoot = /* @__PURE__ */ React29.forwardRef(function ToastRoot2(componentProps, forwardedRef) {
|
|
2701
|
+
const {
|
|
2702
|
+
toast,
|
|
2703
|
+
render,
|
|
2704
|
+
className,
|
|
2705
|
+
swipeDirection = ["down", "right"],
|
|
2706
|
+
style,
|
|
2707
|
+
...elementProps
|
|
2708
|
+
} = componentProps;
|
|
2709
|
+
const isAnchored = toast.positionerProps?.anchor !== void 0;
|
|
2710
|
+
let swipeDirections = [];
|
|
2711
|
+
if (!isAnchored) {
|
|
2712
|
+
swipeDirections = Array.isArray(swipeDirection) ? swipeDirection : [swipeDirection];
|
|
2713
|
+
}
|
|
2714
|
+
const swipeEnabled = swipeDirections.length > 0;
|
|
2715
|
+
const store = useToastProviderContext();
|
|
2716
|
+
const [currentSwipeDirection, setCurrentSwipeDirection] = React29.useState(void 0);
|
|
2717
|
+
const [isSwiping, setIsSwiping] = React29.useState(false);
|
|
2718
|
+
const [isRealSwipe, setIsRealSwipe] = React29.useState(false);
|
|
2719
|
+
const [dragOffset, setDragOffset] = React29.useState({
|
|
2720
|
+
x: 0,
|
|
2721
|
+
y: 0
|
|
2722
|
+
});
|
|
2723
|
+
const [initialTransform, setInitialTransform] = React29.useState({
|
|
2724
|
+
x: 0,
|
|
2725
|
+
y: 0,
|
|
2726
|
+
scale: 1
|
|
2727
|
+
});
|
|
2728
|
+
const [titleId, setTitleId] = React29.useState();
|
|
2729
|
+
const [descriptionId, setDescriptionId] = React29.useState();
|
|
2730
|
+
const [lockedDirection, setLockedDirection] = React29.useState(null);
|
|
2731
|
+
const rootRef = React29.useRef(null);
|
|
2732
|
+
const lastToastIdRef = React29.useRef(void 0);
|
|
2733
|
+
const dragStartPosRef = React29.useRef({
|
|
2734
|
+
x: 0,
|
|
2735
|
+
y: 0
|
|
2736
|
+
});
|
|
2737
|
+
const initialTransformRef = React29.useRef({
|
|
2738
|
+
x: 0,
|
|
2739
|
+
y: 0,
|
|
2740
|
+
scale: 1
|
|
2741
|
+
});
|
|
2742
|
+
const intendedSwipeDirectionRef = React29.useRef(void 0);
|
|
2743
|
+
const maxSwipeDisplacementRef = React29.useRef(0);
|
|
2744
|
+
const cancelledSwipeRef = React29.useRef(false);
|
|
2745
|
+
const swipeCancelBaselineRef = React29.useRef({
|
|
2746
|
+
x: 0,
|
|
2747
|
+
y: 0
|
|
2748
|
+
});
|
|
2749
|
+
const isFirstPointerMoveRef = React29.useRef(false);
|
|
2750
|
+
const dragOffsetRef = React29.useRef({
|
|
2751
|
+
x: 0,
|
|
2752
|
+
y: 0
|
|
2753
|
+
});
|
|
2754
|
+
const activePointerIdRef = React29.useRef(null);
|
|
2755
|
+
const dragAbortControllerRef = React29.useRef(null);
|
|
2756
|
+
const domIndex = store.useState("toastIndex", toast.id);
|
|
2757
|
+
const visibleIndex = store.useState("toastVisibleIndex", toast.id);
|
|
2758
|
+
const offsetY = store.useState("toastOffsetY", toast.id);
|
|
2759
|
+
const focused = store.useState("focused");
|
|
2760
|
+
const expanded = store.useState("expanded");
|
|
2761
|
+
useOpenChangeComplete({
|
|
2762
|
+
open: toast.transitionStatus !== "ending",
|
|
2763
|
+
ref: rootRef,
|
|
2764
|
+
onComplete() {
|
|
2765
|
+
if (toast.transitionStatus === "ending") {
|
|
2766
|
+
store.removeToast(toast.id);
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
});
|
|
2770
|
+
const recalculateHeight = useStableCallback((flushSync3 = false) => {
|
|
2771
|
+
const element2 = rootRef.current;
|
|
2772
|
+
if (!element2) {
|
|
2773
|
+
return;
|
|
2774
|
+
}
|
|
2775
|
+
const previousHeight = element2.style.height;
|
|
2776
|
+
element2.style.height = "auto";
|
|
2777
|
+
const height = element2.offsetHeight;
|
|
2778
|
+
element2.style.height = previousHeight;
|
|
2779
|
+
function update() {
|
|
2780
|
+
store.updateToastInternal(toast.id, {
|
|
2781
|
+
ref: rootRef,
|
|
2782
|
+
height,
|
|
2783
|
+
transitionStatus: void 0
|
|
2784
|
+
});
|
|
2785
|
+
}
|
|
2786
|
+
if (flushSync3) {
|
|
2787
|
+
ReactDOM2.flushSync(update);
|
|
2788
|
+
} else {
|
|
2789
|
+
update();
|
|
2790
|
+
}
|
|
2791
|
+
});
|
|
2792
|
+
useIsoLayoutEffect(() => {
|
|
2793
|
+
const previousToastId = lastToastIdRef.current;
|
|
2794
|
+
if (toast.transitionStatus !== "starting" && previousToastId === toast.id) {
|
|
2795
|
+
return;
|
|
2796
|
+
}
|
|
2797
|
+
if (previousToastId !== void 0) {
|
|
2798
|
+
setCurrentSwipeDirection(void 0);
|
|
2799
|
+
setInitialTransform({
|
|
2800
|
+
x: 0,
|
|
2801
|
+
y: 0,
|
|
2802
|
+
scale: 1
|
|
2803
|
+
});
|
|
2804
|
+
setResolvedDragOffset({
|
|
2805
|
+
x: 0,
|
|
2806
|
+
y: 0
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
lastToastIdRef.current = toast.id;
|
|
2810
|
+
recalculateHeight();
|
|
2811
|
+
}, [recalculateHeight, toast.id, toast.transitionStatus]);
|
|
2812
|
+
function setResolvedDragOffset(nextDragOffset) {
|
|
2813
|
+
dragOffsetRef.current = nextDragOffset;
|
|
2814
|
+
setDragOffset(nextDragOffset);
|
|
2815
|
+
}
|
|
2816
|
+
useIsoLayoutEffect(() => {
|
|
2817
|
+
return () => {
|
|
2818
|
+
dragAbortControllerRef.current?.abort();
|
|
2819
|
+
};
|
|
2820
|
+
}, []);
|
|
2821
|
+
function applyDirectionalDamping(deltaX, deltaY) {
|
|
2822
|
+
const damp = (delta) => delta > 0 ? delta ** OPPOSITE_DIRECTION_DAMPING_FACTOR : -(Math.abs(delta) ** OPPOSITE_DIRECTION_DAMPING_FACTOR);
|
|
2823
|
+
const dampX = deltaX > 0 && !swipeDirections.includes("right") || deltaX < 0 && !swipeDirections.includes("left");
|
|
2824
|
+
const dampY = deltaY > 0 && !swipeDirections.includes("down") || deltaY < 0 && !swipeDirections.includes("up");
|
|
2825
|
+
return {
|
|
2826
|
+
x: dampX ? damp(deltaX) : deltaX,
|
|
2827
|
+
y: dampY ? damp(deltaY) : deltaY
|
|
2828
|
+
};
|
|
2829
|
+
}
|
|
2830
|
+
const handleSwipeEnd = useStableCallback((event) => {
|
|
2831
|
+
if (event.pointerId !== activePointerIdRef.current) {
|
|
2832
|
+
return;
|
|
2833
|
+
}
|
|
2834
|
+
activePointerIdRef.current = null;
|
|
2835
|
+
dragAbortControllerRef.current?.abort();
|
|
2836
|
+
dragAbortControllerRef.current = null;
|
|
2837
|
+
setIsSwiping(false);
|
|
2838
|
+
setIsRealSwipe(false);
|
|
2839
|
+
setLockedDirection(null);
|
|
2840
|
+
const resolvedInitialTransform = initialTransformRef.current;
|
|
2841
|
+
if (event.type === "pointercancel" || cancelledSwipeRef.current) {
|
|
2842
|
+
setResolvedDragOffset({
|
|
2843
|
+
x: resolvedInitialTransform.x,
|
|
2844
|
+
y: resolvedInitialTransform.y
|
|
2845
|
+
});
|
|
2846
|
+
setCurrentSwipeDirection(void 0);
|
|
2847
|
+
return;
|
|
2848
|
+
}
|
|
2849
|
+
const resolvedDragOffset = dragOffsetRef.current;
|
|
2850
|
+
const deltaX = resolvedDragOffset.x - resolvedInitialTransform.x;
|
|
2851
|
+
const deltaY = resolvedDragOffset.y - resolvedInitialTransform.y;
|
|
2852
|
+
let dismissDirection;
|
|
2853
|
+
for (const direction of swipeDirections) {
|
|
2854
|
+
if (getDisplacement(direction, deltaX, deltaY) > SWIPE_THRESHOLD) {
|
|
2855
|
+
dismissDirection = direction;
|
|
2856
|
+
break;
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
if (dismissDirection) {
|
|
2860
|
+
setCurrentSwipeDirection(dismissDirection);
|
|
2861
|
+
store.closeToast(toast.id);
|
|
2862
|
+
} else {
|
|
2863
|
+
setResolvedDragOffset({
|
|
2864
|
+
x: resolvedInitialTransform.x,
|
|
2865
|
+
y: resolvedInitialTransform.y
|
|
2866
|
+
});
|
|
2867
|
+
setCurrentSwipeDirection(void 0);
|
|
2868
|
+
}
|
|
2869
|
+
});
|
|
2870
|
+
function handlePointerDown(event) {
|
|
2871
|
+
if (event.button !== 0) {
|
|
2872
|
+
return;
|
|
2873
|
+
}
|
|
2874
|
+
if (event.pointerType === "touch") {
|
|
2875
|
+
store.pauseTimers();
|
|
2876
|
+
}
|
|
2877
|
+
const target = getTarget(event.nativeEvent);
|
|
2878
|
+
const isInteractiveElement = target?.closest(`button,a,input,textarea,[role="button"],${TOAST_SWIPE_IGNORE_SELECTOR}`);
|
|
2879
|
+
if (isInteractiveElement) {
|
|
2880
|
+
return;
|
|
2881
|
+
}
|
|
2882
|
+
cancelledSwipeRef.current = false;
|
|
2883
|
+
intendedSwipeDirectionRef.current = void 0;
|
|
2884
|
+
maxSwipeDisplacementRef.current = 0;
|
|
2885
|
+
activePointerIdRef.current = event.pointerId;
|
|
2886
|
+
dragStartPosRef.current = {
|
|
2887
|
+
x: event.clientX,
|
|
2888
|
+
y: event.clientY
|
|
2889
|
+
};
|
|
2890
|
+
swipeCancelBaselineRef.current = dragStartPosRef.current;
|
|
2891
|
+
const element2 = event.currentTarget;
|
|
2892
|
+
const transform = getElementTransform(element2);
|
|
2893
|
+
initialTransformRef.current = transform;
|
|
2894
|
+
setInitialTransform(transform);
|
|
2895
|
+
setResolvedDragOffset({
|
|
2896
|
+
x: transform.x,
|
|
2897
|
+
y: transform.y
|
|
2898
|
+
});
|
|
2899
|
+
store.set("hovering", true);
|
|
2900
|
+
setIsSwiping(true);
|
|
2901
|
+
setIsRealSwipe(false);
|
|
2902
|
+
setLockedDirection(null);
|
|
2903
|
+
isFirstPointerMoveRef.current = true;
|
|
2904
|
+
dragAbortControllerRef.current?.abort();
|
|
2905
|
+
const dragAbortController = new AbortController();
|
|
2906
|
+
dragAbortControllerRef.current = dragAbortController;
|
|
2907
|
+
const doc = ownerDocument(element2);
|
|
2908
|
+
doc.addEventListener("pointerup", handleSwipeEnd, {
|
|
2909
|
+
signal: dragAbortController.signal
|
|
2910
|
+
});
|
|
2911
|
+
doc.addEventListener("pointercancel", handleSwipeEnd, {
|
|
2912
|
+
signal: dragAbortController.signal
|
|
2913
|
+
});
|
|
2914
|
+
element2.setPointerCapture?.(event.pointerId);
|
|
2915
|
+
}
|
|
2916
|
+
function handlePointerMove(event) {
|
|
2917
|
+
if (event.pointerId !== activePointerIdRef.current) {
|
|
2918
|
+
return;
|
|
2919
|
+
}
|
|
2920
|
+
event.preventDefault();
|
|
2921
|
+
if (isFirstPointerMoveRef.current) {
|
|
2922
|
+
dragStartPosRef.current = {
|
|
2923
|
+
x: event.clientX,
|
|
2924
|
+
y: event.clientY
|
|
2925
|
+
};
|
|
2926
|
+
isFirstPointerMoveRef.current = false;
|
|
2927
|
+
}
|
|
2928
|
+
const {
|
|
2929
|
+
clientY,
|
|
2930
|
+
clientX,
|
|
2931
|
+
movementX,
|
|
2932
|
+
movementY
|
|
2933
|
+
} = event;
|
|
2934
|
+
if (movementY < 0 && clientY > swipeCancelBaselineRef.current.y || movementY > 0 && clientY < swipeCancelBaselineRef.current.y) {
|
|
2935
|
+
swipeCancelBaselineRef.current = {
|
|
2936
|
+
x: swipeCancelBaselineRef.current.x,
|
|
2937
|
+
y: clientY
|
|
2938
|
+
};
|
|
2939
|
+
}
|
|
2940
|
+
if (movementX < 0 && clientX > swipeCancelBaselineRef.current.x || movementX > 0 && clientX < swipeCancelBaselineRef.current.x) {
|
|
2941
|
+
swipeCancelBaselineRef.current = {
|
|
2942
|
+
x: clientX,
|
|
2943
|
+
y: swipeCancelBaselineRef.current.y
|
|
2944
|
+
};
|
|
2945
|
+
}
|
|
2946
|
+
const deltaX = clientX - dragStartPosRef.current.x;
|
|
2947
|
+
const deltaY = clientY - dragStartPosRef.current.y;
|
|
2948
|
+
const cancelDeltaY = clientY - swipeCancelBaselineRef.current.y;
|
|
2949
|
+
const cancelDeltaX = clientX - swipeCancelBaselineRef.current.x;
|
|
2950
|
+
let resolvedLockedDirection = lockedDirection;
|
|
2951
|
+
if (!isRealSwipe) {
|
|
2952
|
+
const movementDistance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
2953
|
+
if (movementDistance >= MIN_DRAG_THRESHOLD) {
|
|
2954
|
+
setIsRealSwipe(true);
|
|
2955
|
+
const hasHorizontal = swipeDirections.includes("left") || swipeDirections.includes("right");
|
|
2956
|
+
const hasVertical = swipeDirections.includes("up") || swipeDirections.includes("down");
|
|
2957
|
+
if (hasHorizontal && hasVertical) {
|
|
2958
|
+
const absX = Math.abs(deltaX);
|
|
2959
|
+
const absY = Math.abs(deltaY);
|
|
2960
|
+
resolvedLockedDirection = absX > absY ? "horizontal" : "vertical";
|
|
2961
|
+
setLockedDirection(resolvedLockedDirection);
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
let candidate;
|
|
2966
|
+
if (!intendedSwipeDirectionRef.current) {
|
|
2967
|
+
if (resolvedLockedDirection === "vertical") {
|
|
2968
|
+
if (deltaY > 0) {
|
|
2969
|
+
candidate = "down";
|
|
2970
|
+
} else if (deltaY < 0) {
|
|
2971
|
+
candidate = "up";
|
|
2972
|
+
}
|
|
2973
|
+
} else if (resolvedLockedDirection === "horizontal") {
|
|
2974
|
+
if (deltaX > 0) {
|
|
2975
|
+
candidate = "right";
|
|
2976
|
+
} else if (deltaX < 0) {
|
|
2977
|
+
candidate = "left";
|
|
2978
|
+
}
|
|
2979
|
+
} else if (Math.abs(deltaX) >= Math.abs(deltaY)) {
|
|
2980
|
+
candidate = deltaX > 0 ? "right" : "left";
|
|
2981
|
+
} else {
|
|
2982
|
+
candidate = deltaY > 0 ? "down" : "up";
|
|
2983
|
+
}
|
|
2984
|
+
if (candidate && swipeDirections.includes(candidate)) {
|
|
2985
|
+
intendedSwipeDirectionRef.current = candidate;
|
|
2986
|
+
maxSwipeDisplacementRef.current = getDisplacement(candidate, deltaX, deltaY);
|
|
2987
|
+
setCurrentSwipeDirection(candidate);
|
|
2988
|
+
}
|
|
2989
|
+
} else {
|
|
2990
|
+
const direction = intendedSwipeDirectionRef.current;
|
|
2991
|
+
const currentDisplacement = getDisplacement(direction, cancelDeltaX, cancelDeltaY);
|
|
2992
|
+
if (currentDisplacement > SWIPE_THRESHOLD) {
|
|
2993
|
+
cancelledSwipeRef.current = false;
|
|
2994
|
+
setCurrentSwipeDirection(direction);
|
|
2995
|
+
} else if (!(swipeDirections.includes("left") && swipeDirections.includes("right")) && !(swipeDirections.includes("up") && swipeDirections.includes("down")) && maxSwipeDisplacementRef.current - currentDisplacement >= REVERSE_CANCEL_THRESHOLD) {
|
|
2996
|
+
cancelledSwipeRef.current = true;
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
const dampedDelta = applyDirectionalDamping(deltaX, deltaY);
|
|
3000
|
+
let newOffsetX = initialTransformRef.current.x;
|
|
3001
|
+
let newOffsetY = initialTransformRef.current.y;
|
|
3002
|
+
const hasHorizontalDir = swipeDirections.includes("left") || swipeDirections.includes("right");
|
|
3003
|
+
const hasVerticalDir = swipeDirections.includes("up") || swipeDirections.includes("down");
|
|
3004
|
+
if (resolvedLockedDirection !== "vertical" && hasHorizontalDir) {
|
|
3005
|
+
newOffsetX += dampedDelta.x;
|
|
3006
|
+
}
|
|
3007
|
+
if (resolvedLockedDirection !== "horizontal" && hasVerticalDir) {
|
|
3008
|
+
newOffsetY += dampedDelta.y;
|
|
3009
|
+
}
|
|
3010
|
+
setResolvedDragOffset({
|
|
3011
|
+
x: newOffsetX,
|
|
3012
|
+
y: newOffsetY
|
|
3013
|
+
});
|
|
3014
|
+
}
|
|
3015
|
+
function handleKeyDown(event) {
|
|
3016
|
+
if (event.key === "Escape") {
|
|
3017
|
+
if (!rootRef.current || !contains(rootRef.current, activeElement(ownerDocument(rootRef.current)))) {
|
|
3018
|
+
return;
|
|
3019
|
+
}
|
|
3020
|
+
store.closeToast(toast.id);
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
React29.useEffect(() => {
|
|
3024
|
+
const element2 = rootRef.current;
|
|
3025
|
+
if (!swipeEnabled || !element2) {
|
|
3026
|
+
return void 0;
|
|
3027
|
+
}
|
|
3028
|
+
function preventDefaultTouchStart(event) {
|
|
3029
|
+
if (activePointerIdRef.current === null || !contains(element2, getTarget(event))) {
|
|
3030
|
+
return;
|
|
3031
|
+
}
|
|
3032
|
+
event.preventDefault();
|
|
3033
|
+
}
|
|
3034
|
+
return addEventListener(element2, "touchmove", preventDefaultTouchStart, {
|
|
3035
|
+
passive: false
|
|
3036
|
+
});
|
|
3037
|
+
}, [swipeEnabled]);
|
|
3038
|
+
function getDragStyles() {
|
|
3039
|
+
const deltaX = dragOffset.x - initialTransform.x;
|
|
3040
|
+
const deltaY = dragOffset.y - initialTransform.y;
|
|
3041
|
+
return {
|
|
3042
|
+
transition: isSwiping ? "none" : void 0,
|
|
3043
|
+
// While swiping, freeze the element at its current visual transform so it doesn't snap to the
|
|
3044
|
+
// end position.
|
|
3045
|
+
transform: isSwiping ? `translateX(${dragOffset.x}px) translateY(${dragOffset.y}px) scale(${initialTransform.scale})` : void 0,
|
|
3046
|
+
["--toast-swipe-movement-x"]: `${deltaX}px`,
|
|
3047
|
+
["--toast-swipe-movement-y"]: `${deltaY}px`
|
|
3048
|
+
};
|
|
3049
|
+
}
|
|
3050
|
+
const isHighPriority = toast.priority === "high";
|
|
3051
|
+
const defaultProps = {
|
|
3052
|
+
role: isHighPriority ? "alertdialog" : "dialog",
|
|
3053
|
+
tabIndex: 0,
|
|
3054
|
+
"aria-modal": false,
|
|
3055
|
+
"aria-labelledby": titleId,
|
|
3056
|
+
"aria-describedby": descriptionId,
|
|
3057
|
+
"aria-hidden": isHighPriority && !focused ? true : void 0,
|
|
3058
|
+
onPointerDown: swipeEnabled ? handlePointerDown : void 0,
|
|
3059
|
+
onPointerMove: swipeEnabled ? handlePointerMove : void 0,
|
|
3060
|
+
onPointerUp: swipeEnabled ? handleSwipeEnd : void 0,
|
|
3061
|
+
onPointerCancel: swipeEnabled ? handleSwipeEnd : void 0,
|
|
3062
|
+
onKeyDown: handleKeyDown,
|
|
3063
|
+
inert: inertValue(toast.limited),
|
|
3064
|
+
style: {
|
|
3065
|
+
...getDragStyles(),
|
|
3066
|
+
["--toast-index"]: toast.transitionStatus === "ending" ? domIndex : visibleIndex,
|
|
3067
|
+
["--toast-offset-y"]: `${offsetY}px`,
|
|
3068
|
+
["--toast-height"]: toast.height ? `${toast.height}px` : void 0
|
|
3069
|
+
}
|
|
3070
|
+
};
|
|
3071
|
+
const toastRoot = React29.useMemo(() => ({
|
|
3072
|
+
toast,
|
|
3073
|
+
setTitleId,
|
|
3074
|
+
setDescriptionId,
|
|
3075
|
+
recalculateHeight,
|
|
3076
|
+
visibleIndex,
|
|
3077
|
+
expanded
|
|
3078
|
+
}), [toast, setTitleId, setDescriptionId, recalculateHeight, visibleIndex, expanded]);
|
|
3079
|
+
const state = {
|
|
3080
|
+
transitionStatus: toast.transitionStatus,
|
|
3081
|
+
expanded,
|
|
3082
|
+
limited: toast.limited || false,
|
|
3083
|
+
type: toast.type,
|
|
3084
|
+
swiping: isSwiping,
|
|
3085
|
+
swipeDirection: currentSwipeDirection
|
|
3086
|
+
};
|
|
3087
|
+
const element = useRenderElement("div", componentProps, {
|
|
3088
|
+
ref: [forwardedRef, rootRef],
|
|
3089
|
+
state,
|
|
3090
|
+
stateAttributesMapping: toastRootStateAttributesMapping,
|
|
3091
|
+
props: [defaultProps, elementProps]
|
|
3092
|
+
});
|
|
3093
|
+
return /* @__PURE__ */ _jsx9(ToastRootContext.Provider, {
|
|
3094
|
+
value: toastRoot,
|
|
3095
|
+
children: element
|
|
3096
|
+
});
|
|
3097
|
+
});
|
|
3098
|
+
if (true) ToastRoot.displayName = "ToastRoot";
|
|
3099
|
+
|
|
3100
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/content/ToastContent.mjs
|
|
3101
|
+
import * as React30 from "react";
|
|
3102
|
+
var ToastContent = /* @__PURE__ */ React30.forwardRef(function ToastContent2(componentProps, forwardedRef) {
|
|
3103
|
+
const {
|
|
3104
|
+
render,
|
|
3105
|
+
className,
|
|
3106
|
+
style,
|
|
3107
|
+
...elementProps
|
|
3108
|
+
} = componentProps;
|
|
3109
|
+
const {
|
|
3110
|
+
visibleIndex,
|
|
3111
|
+
expanded,
|
|
3112
|
+
recalculateHeight
|
|
3113
|
+
} = useToastRootContext();
|
|
3114
|
+
const contentRef = React30.useRef(null);
|
|
3115
|
+
useIsoLayoutEffect(() => {
|
|
3116
|
+
recalculateHeight();
|
|
3117
|
+
const node = contentRef.current;
|
|
3118
|
+
if (!node || typeof ResizeObserver !== "function" || typeof MutationObserver !== "function") {
|
|
3119
|
+
return void 0;
|
|
3120
|
+
}
|
|
3121
|
+
const resizeObserver = new ResizeObserver(() => recalculateHeight(true));
|
|
3122
|
+
const mutationObserver = new MutationObserver(() => recalculateHeight(true));
|
|
3123
|
+
resizeObserver.observe(node);
|
|
3124
|
+
mutationObserver.observe(node, {
|
|
3125
|
+
childList: true,
|
|
3126
|
+
subtree: true,
|
|
3127
|
+
characterData: true
|
|
3128
|
+
});
|
|
3129
|
+
return () => {
|
|
3130
|
+
resizeObserver.disconnect();
|
|
3131
|
+
mutationObserver.disconnect();
|
|
3132
|
+
};
|
|
3133
|
+
}, [recalculateHeight]);
|
|
3134
|
+
const behind = visibleIndex > 0;
|
|
3135
|
+
const state = {
|
|
3136
|
+
expanded,
|
|
3137
|
+
behind
|
|
3138
|
+
};
|
|
3139
|
+
return useRenderElement("div", componentProps, {
|
|
3140
|
+
ref: [forwardedRef, contentRef],
|
|
3141
|
+
state,
|
|
3142
|
+
props: elementProps
|
|
3143
|
+
});
|
|
3144
|
+
});
|
|
3145
|
+
if (true) ToastContent.displayName = "ToastContent";
|
|
3146
|
+
|
|
3147
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/description/ToastDescription.mjs
|
|
3148
|
+
import * as React32 from "react";
|
|
3149
|
+
|
|
3150
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/utils/isRenderableNode.mjs
|
|
3151
|
+
import * as React31 from "react";
|
|
3152
|
+
function isRenderableNode(node) {
|
|
3153
|
+
if (node == null || typeof node === "boolean" || node === "") {
|
|
3154
|
+
return false;
|
|
3155
|
+
}
|
|
3156
|
+
if (Array.isArray(node)) {
|
|
3157
|
+
return node.some(isRenderableNode);
|
|
3158
|
+
}
|
|
3159
|
+
return true;
|
|
3160
|
+
}
|
|
3161
|
+
function hasRenderableChildren(element) {
|
|
3162
|
+
return /* @__PURE__ */ React31.isValidElement(element) && isRenderableNode(element.props.children);
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/utils/useToastLabelPart.mjs
|
|
3166
|
+
function useToastLabelPart(idProp, childrenProp, part) {
|
|
3167
|
+
const {
|
|
3168
|
+
toast,
|
|
3169
|
+
setTitleId,
|
|
3170
|
+
setDescriptionId
|
|
3171
|
+
} = useToastRootContext();
|
|
3172
|
+
const setId = part === "title" ? setTitleId : setDescriptionId;
|
|
3173
|
+
const children = childrenProp ?? (part === "title" ? toast.title : toast.description);
|
|
3174
|
+
const id = useId(idProp);
|
|
3175
|
+
return {
|
|
3176
|
+
id,
|
|
3177
|
+
children,
|
|
3178
|
+
type: toast.type,
|
|
3179
|
+
setId
|
|
3180
|
+
};
|
|
3181
|
+
}
|
|
3182
|
+
function useToastLabelElement(element, id, setId) {
|
|
3183
|
+
const shouldRender = hasRenderableChildren(element);
|
|
3184
|
+
useIsoLayoutEffect(() => {
|
|
3185
|
+
if (!shouldRender) {
|
|
3186
|
+
return void 0;
|
|
3187
|
+
}
|
|
3188
|
+
setId(id);
|
|
3189
|
+
return () => {
|
|
3190
|
+
setId((currentId) => currentId === id ? void 0 : currentId);
|
|
3191
|
+
};
|
|
3192
|
+
}, [shouldRender, id, setId]);
|
|
3193
|
+
return shouldRender ? element : null;
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/description/ToastDescription.mjs
|
|
3197
|
+
var ToastDescription = /* @__PURE__ */ React32.forwardRef(function ToastDescription2(componentProps, forwardedRef) {
|
|
3198
|
+
const {
|
|
3199
|
+
render,
|
|
3200
|
+
className,
|
|
3201
|
+
style,
|
|
3202
|
+
id: idProp,
|
|
3203
|
+
children: childrenProp,
|
|
3204
|
+
...elementProps
|
|
3205
|
+
} = componentProps;
|
|
3206
|
+
const {
|
|
3207
|
+
id,
|
|
3208
|
+
children,
|
|
3209
|
+
type,
|
|
3210
|
+
setId
|
|
3211
|
+
} = useToastLabelPart(idProp, childrenProp, "description");
|
|
3212
|
+
const state = {
|
|
3213
|
+
type
|
|
3214
|
+
};
|
|
3215
|
+
const element = useRenderElement("p", componentProps, {
|
|
3216
|
+
ref: forwardedRef,
|
|
3217
|
+
state,
|
|
3218
|
+
props: {
|
|
3219
|
+
...elementProps,
|
|
3220
|
+
id,
|
|
3221
|
+
children
|
|
3222
|
+
}
|
|
3223
|
+
});
|
|
3224
|
+
return useToastLabelElement(element, id, setId);
|
|
3225
|
+
});
|
|
3226
|
+
if (true) ToastDescription.displayName = "ToastDescription";
|
|
3227
|
+
|
|
3228
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/title/ToastTitle.mjs
|
|
3229
|
+
import * as React33 from "react";
|
|
3230
|
+
var ToastTitle = /* @__PURE__ */ React33.forwardRef(function ToastTitle2(componentProps, forwardedRef) {
|
|
3231
|
+
const {
|
|
3232
|
+
render,
|
|
3233
|
+
className,
|
|
3234
|
+
style,
|
|
3235
|
+
id: idProp,
|
|
3236
|
+
children: childrenProp,
|
|
3237
|
+
...elementProps
|
|
3238
|
+
} = componentProps;
|
|
3239
|
+
const {
|
|
3240
|
+
id,
|
|
3241
|
+
children,
|
|
3242
|
+
type,
|
|
3243
|
+
setId
|
|
3244
|
+
} = useToastLabelPart(idProp, childrenProp, "title");
|
|
3245
|
+
const state = {
|
|
3246
|
+
type
|
|
3247
|
+
};
|
|
3248
|
+
const element = useRenderElement("h2", componentProps, {
|
|
3249
|
+
ref: forwardedRef,
|
|
3250
|
+
state,
|
|
3251
|
+
props: {
|
|
3252
|
+
...elementProps,
|
|
3253
|
+
id,
|
|
3254
|
+
children
|
|
3255
|
+
}
|
|
3256
|
+
});
|
|
3257
|
+
return useToastLabelElement(element, id, setId);
|
|
3258
|
+
});
|
|
3259
|
+
if (true) ToastTitle.displayName = "ToastTitle";
|
|
3260
|
+
|
|
3261
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/close/ToastClose.mjs
|
|
3262
|
+
import * as React34 from "react";
|
|
3263
|
+
var ToastClose = /* @__PURE__ */ React34.forwardRef(function ToastClose2(componentProps, forwardedRef) {
|
|
3264
|
+
const {
|
|
3265
|
+
render,
|
|
3266
|
+
className,
|
|
3267
|
+
style,
|
|
3268
|
+
disabled,
|
|
3269
|
+
nativeButton = true,
|
|
3270
|
+
...elementProps
|
|
3271
|
+
} = componentProps;
|
|
3272
|
+
const store = useToastProviderContext();
|
|
3273
|
+
const {
|
|
3274
|
+
toast,
|
|
3275
|
+
expanded
|
|
3276
|
+
} = useToastRootContext();
|
|
3277
|
+
const [hasFocus, setHasFocus] = React34.useState(false);
|
|
3278
|
+
const {
|
|
3279
|
+
getButtonProps,
|
|
3280
|
+
buttonRef
|
|
3281
|
+
} = useButton({
|
|
3282
|
+
disabled,
|
|
3283
|
+
native: nativeButton
|
|
3284
|
+
});
|
|
3285
|
+
const state = {
|
|
3286
|
+
type: toast.type
|
|
3287
|
+
};
|
|
3288
|
+
return useRenderElement("button", componentProps, {
|
|
3289
|
+
ref: [forwardedRef, buttonRef],
|
|
3290
|
+
state,
|
|
3291
|
+
props: [{
|
|
3292
|
+
"aria-hidden": !expanded && !hasFocus,
|
|
3293
|
+
onClick() {
|
|
3294
|
+
store.closeToast(toast.id);
|
|
3295
|
+
},
|
|
3296
|
+
onFocus() {
|
|
3297
|
+
setHasFocus(true);
|
|
3298
|
+
},
|
|
3299
|
+
onBlur() {
|
|
3300
|
+
setHasFocus(false);
|
|
3301
|
+
}
|
|
3302
|
+
}, elementProps, getButtonProps]
|
|
3303
|
+
});
|
|
3304
|
+
});
|
|
3305
|
+
if (true) ToastClose.displayName = "ToastClose";
|
|
3306
|
+
|
|
3307
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/action/ToastAction.mjs
|
|
3308
|
+
import * as React35 from "react";
|
|
3309
|
+
var ToastAction = /* @__PURE__ */ React35.forwardRef(function ToastAction2(componentProps, forwardedRef) {
|
|
3310
|
+
const {
|
|
3311
|
+
render,
|
|
3312
|
+
className,
|
|
3313
|
+
style,
|
|
3314
|
+
disabled,
|
|
3315
|
+
nativeButton = true,
|
|
3316
|
+
...elementProps
|
|
3317
|
+
} = componentProps;
|
|
3318
|
+
const {
|
|
3319
|
+
toast
|
|
3320
|
+
} = useToastRootContext();
|
|
3321
|
+
const computedChildren = toast.actionProps?.children ?? elementProps.children;
|
|
3322
|
+
const {
|
|
3323
|
+
getButtonProps,
|
|
3324
|
+
buttonRef
|
|
3325
|
+
} = useButton({
|
|
3326
|
+
disabled,
|
|
3327
|
+
native: nativeButton
|
|
3328
|
+
});
|
|
3329
|
+
const state = {
|
|
3330
|
+
type: toast.type
|
|
3331
|
+
};
|
|
3332
|
+
const element = useRenderElement("button", componentProps, {
|
|
3333
|
+
ref: [forwardedRef, buttonRef],
|
|
3334
|
+
state,
|
|
3335
|
+
props: [elementProps, toast.actionProps, getButtonProps, {
|
|
3336
|
+
children: computedChildren
|
|
3337
|
+
}]
|
|
3338
|
+
});
|
|
3339
|
+
return hasRenderableChildren(element) ? element : null;
|
|
3340
|
+
});
|
|
3341
|
+
if (true) ToastAction.displayName = "ToastAction";
|
|
3342
|
+
|
|
3343
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/portal/ToastPortal.mjs
|
|
3344
|
+
import * as React36 from "react";
|
|
3345
|
+
import { jsx as _jsx10 } from "react/jsx-runtime";
|
|
3346
|
+
var ToastPortal = /* @__PURE__ */ React36.forwardRef(function ToastPortal2(props, forwardedRef) {
|
|
3347
|
+
return /* @__PURE__ */ _jsx10(FloatingPortalLite, {
|
|
3348
|
+
ref: forwardedRef,
|
|
3349
|
+
...props
|
|
3350
|
+
});
|
|
3351
|
+
});
|
|
3352
|
+
if (true) ToastPortal.displayName = "ToastPortal";
|
|
3353
|
+
|
|
3354
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/positioner/ToastPositioner.mjs
|
|
3355
|
+
import * as React38 from "react";
|
|
3356
|
+
|
|
3357
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/positioner/ToastPositionerContext.mjs
|
|
3358
|
+
import * as React37 from "react";
|
|
3359
|
+
var ToastPositionerContext = /* @__PURE__ */ React37.createContext(void 0);
|
|
3360
|
+
if (true) ToastPositionerContext.displayName = "ToastPositionerContext";
|
|
3361
|
+
function useToastPositionerContext() {
|
|
3362
|
+
const context = React37.useContext(ToastPositionerContext);
|
|
3363
|
+
if (context === void 0) {
|
|
3364
|
+
throw new Error(true ? "Base UI: ToastPositionerContext is missing. ToastPositioner parts must be placed within <Toast.Positioner>." : formatErrorMessage_default(84));
|
|
3365
|
+
}
|
|
3366
|
+
return context;
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/positioner/ToastPositioner.mjs
|
|
3370
|
+
import { jsx as _jsx11 } from "react/jsx-runtime";
|
|
3371
|
+
var ToastPositioner = /* @__PURE__ */ React38.forwardRef(function ToastPositioner2(componentProps, forwardedRef) {
|
|
3372
|
+
const {
|
|
3373
|
+
toast,
|
|
3374
|
+
...props
|
|
3375
|
+
} = componentProps;
|
|
3376
|
+
const store = useToastProviderContext();
|
|
3377
|
+
const positionerProps = toast.positionerProps ?? EMPTY_OBJECT;
|
|
3378
|
+
const {
|
|
3379
|
+
render,
|
|
3380
|
+
className,
|
|
3381
|
+
anchor: anchorProp = positionerProps.anchor,
|
|
3382
|
+
positionMethod = positionerProps.positionMethod ?? "absolute",
|
|
3383
|
+
side = positionerProps.side ?? "top",
|
|
3384
|
+
align = positionerProps.align ?? "center",
|
|
3385
|
+
sideOffset = positionerProps.sideOffset ?? 0,
|
|
3386
|
+
alignOffset = positionerProps.alignOffset ?? 0,
|
|
3387
|
+
collisionBoundary = positionerProps.collisionBoundary ?? "clipping-ancestors",
|
|
3388
|
+
collisionPadding = positionerProps.collisionPadding ?? 5,
|
|
3389
|
+
arrowPadding = positionerProps.arrowPadding ?? 5,
|
|
3390
|
+
sticky = positionerProps.sticky ?? false,
|
|
3391
|
+
disableAnchorTracking = positionerProps.disableAnchorTracking ?? false,
|
|
3392
|
+
collisionAvoidance = positionerProps.collisionAvoidance ?? POPUP_COLLISION_AVOIDANCE,
|
|
3393
|
+
style,
|
|
3394
|
+
...elementProps
|
|
3395
|
+
} = props;
|
|
3396
|
+
const [positionerElement, setPositionerElement] = React38.useState(null);
|
|
3397
|
+
const domIndex = store.useState("toastIndex", toast.id);
|
|
3398
|
+
const visibleIndex = store.useState("toastVisibleIndex", toast.id);
|
|
3399
|
+
const anchor = isElement(anchorProp) ? anchorProp : null;
|
|
3400
|
+
const floatingRootContext = useFloatingRootContext({
|
|
3401
|
+
open: true,
|
|
3402
|
+
onOpenChange: NOOP,
|
|
3403
|
+
elements: {
|
|
3404
|
+
floating: positionerElement,
|
|
3405
|
+
reference: anchor
|
|
3406
|
+
}
|
|
3407
|
+
});
|
|
3408
|
+
const positioning = useAnchorPositioning({
|
|
3409
|
+
anchor,
|
|
3410
|
+
positionMethod,
|
|
3411
|
+
floatingRootContext,
|
|
3412
|
+
mounted: true,
|
|
3413
|
+
side,
|
|
3414
|
+
sideOffset,
|
|
3415
|
+
align,
|
|
3416
|
+
alignOffset,
|
|
3417
|
+
collisionBoundary,
|
|
3418
|
+
collisionPadding,
|
|
3419
|
+
sticky,
|
|
3420
|
+
arrowPadding,
|
|
3421
|
+
disableAnchorTracking,
|
|
3422
|
+
keepMounted: true,
|
|
3423
|
+
collisionAvoidance
|
|
3424
|
+
});
|
|
3425
|
+
const state = {
|
|
3426
|
+
side: positioning.side,
|
|
3427
|
+
align: positioning.align,
|
|
3428
|
+
anchorHidden: positioning.anchorHidden
|
|
3429
|
+
};
|
|
3430
|
+
const element = usePositioner(componentProps, state, {
|
|
3431
|
+
styles: {
|
|
3432
|
+
...positioning.positionerStyles,
|
|
3433
|
+
["--toast-index"]: toast.transitionStatus === "ending" ? domIndex : visibleIndex
|
|
3434
|
+
},
|
|
3435
|
+
transitionStatus: toast.transitionStatus,
|
|
3436
|
+
props: elementProps,
|
|
3437
|
+
refs: [forwardedRef, setPositionerElement]
|
|
3438
|
+
});
|
|
3439
|
+
return /* @__PURE__ */ _jsx11(ToastPositionerContext.Provider, {
|
|
3440
|
+
value: positioning,
|
|
3441
|
+
children: element
|
|
3442
|
+
});
|
|
3443
|
+
});
|
|
3444
|
+
if (true) ToastPositioner.displayName = "ToastPositioner";
|
|
3445
|
+
|
|
3446
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/arrow/ToastArrow.mjs
|
|
3447
|
+
import * as React39 from "react";
|
|
3448
|
+
var ToastArrow = /* @__PURE__ */ React39.forwardRef(function ToastArrow2(componentProps, forwardedRef) {
|
|
3449
|
+
const {
|
|
3450
|
+
className,
|
|
3451
|
+
render,
|
|
3452
|
+
style,
|
|
3453
|
+
...elementProps
|
|
3454
|
+
} = componentProps;
|
|
3455
|
+
const {
|
|
3456
|
+
arrowRef,
|
|
3457
|
+
side,
|
|
3458
|
+
align,
|
|
3459
|
+
arrowUncentered,
|
|
3460
|
+
arrowStyles
|
|
3461
|
+
} = useToastPositionerContext();
|
|
3462
|
+
const state = {
|
|
3463
|
+
side,
|
|
3464
|
+
align,
|
|
3465
|
+
uncentered: arrowUncentered
|
|
3466
|
+
};
|
|
3467
|
+
return useRenderElement("div", componentProps, {
|
|
3468
|
+
state,
|
|
3469
|
+
ref: [forwardedRef, arrowRef],
|
|
3470
|
+
props: [{
|
|
3471
|
+
style: arrowStyles,
|
|
3472
|
+
"aria-hidden": true
|
|
3473
|
+
}, elementProps]
|
|
3474
|
+
});
|
|
3475
|
+
});
|
|
3476
|
+
if (true) ToastArrow.displayName = "ToastArrow";
|
|
3477
|
+
|
|
3478
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/useToastManager.mjs
|
|
3479
|
+
import * as React40 from "react";
|
|
3480
|
+
function useToastManager() {
|
|
3481
|
+
const store = useToastProviderContext();
|
|
3482
|
+
const toasts = store.useState("toasts");
|
|
3483
|
+
return React40.useMemo(() => ({
|
|
3484
|
+
toasts,
|
|
3485
|
+
add: store.addToast,
|
|
3486
|
+
close: store.closeToast,
|
|
3487
|
+
update: store.updateToast,
|
|
3488
|
+
promise: store.promiseToast
|
|
3489
|
+
}), [toasts, store]);
|
|
3490
|
+
}
|
|
3491
|
+
|
|
3492
|
+
// node_modules/.pnpm/@base-ui+react@1.7.0_@types+react@19.2.17_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/@base-ui/react/toast/createToastManager.mjs
|
|
3493
|
+
function createToastManager() {
|
|
3494
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
3495
|
+
function emit(data) {
|
|
3496
|
+
listeners.forEach((listener) => listener(data));
|
|
3497
|
+
}
|
|
3498
|
+
return {
|
|
3499
|
+
// This should be private aside from ToastProvider needing to access it.
|
|
3500
|
+
// https://x.com/drosenwasser/status/1816947740032872664
|
|
3501
|
+
" subscribe": function subscribe(listener) {
|
|
3502
|
+
listeners.add(listener);
|
|
3503
|
+
return () => {
|
|
3504
|
+
listeners.delete(listener);
|
|
3505
|
+
};
|
|
3506
|
+
},
|
|
3507
|
+
add(options) {
|
|
3508
|
+
const id = options.id || generateId("toast");
|
|
3509
|
+
const toastToAdd = {
|
|
3510
|
+
...options,
|
|
3511
|
+
id,
|
|
3512
|
+
transitionStatus: "starting"
|
|
3513
|
+
};
|
|
3514
|
+
emit({
|
|
3515
|
+
action: "add",
|
|
3516
|
+
options: toastToAdd
|
|
3517
|
+
});
|
|
3518
|
+
return id;
|
|
3519
|
+
},
|
|
3520
|
+
close(id) {
|
|
3521
|
+
emit({
|
|
3522
|
+
action: "close",
|
|
3523
|
+
options: {
|
|
3524
|
+
id
|
|
3525
|
+
}
|
|
3526
|
+
});
|
|
3527
|
+
},
|
|
3528
|
+
update(id, updates) {
|
|
3529
|
+
emit({
|
|
3530
|
+
action: "update",
|
|
3531
|
+
options: {
|
|
3532
|
+
...updates,
|
|
3533
|
+
id
|
|
3534
|
+
}
|
|
3535
|
+
});
|
|
3536
|
+
},
|
|
3537
|
+
promise(promiseValue, options) {
|
|
3538
|
+
let handledPromise = promiseValue;
|
|
3539
|
+
emit({
|
|
3540
|
+
action: "promise",
|
|
3541
|
+
options: {
|
|
3542
|
+
...options,
|
|
3543
|
+
promise: promiseValue,
|
|
3544
|
+
setPromise(promise) {
|
|
3545
|
+
handledPromise = promise;
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
});
|
|
3549
|
+
return handledPromise;
|
|
3550
|
+
}
|
|
3551
|
+
};
|
|
3552
|
+
}
|
|
3553
|
+
|
|
3554
|
+
// src/primitives/toast.tsx
|
|
3555
|
+
import { XIcon as XIcon2 } from "lucide-react";
|
|
3556
|
+
import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3557
|
+
function toBaseToastOptions(options) {
|
|
3558
|
+
const { action, variant, ...rest } = options;
|
|
3559
|
+
return {
|
|
3560
|
+
...rest,
|
|
3561
|
+
...variant !== void 0 ? { type: variant, data: { variant } } : {},
|
|
3562
|
+
...action !== void 0 ? {
|
|
3563
|
+
actionProps: {
|
|
3564
|
+
children: action.label,
|
|
3565
|
+
onClick: action.onClick
|
|
3566
|
+
}
|
|
3567
|
+
} : {}
|
|
3568
|
+
};
|
|
3569
|
+
}
|
|
3570
|
+
function toBasePromiseOption(option) {
|
|
3571
|
+
return typeof option === "string" ? option : toBaseToastOptions(option);
|
|
3572
|
+
}
|
|
3573
|
+
function ToastProvider3({ children, limit = 3, timeout = 5e3 }) {
|
|
3574
|
+
return /* @__PURE__ */ jsx16(index_parts_exports4.Provider, { limit, timeout, children });
|
|
3575
|
+
}
|
|
3576
|
+
function useToast() {
|
|
3577
|
+
const manager = index_parts_exports4.useToastManager();
|
|
3578
|
+
return React41.useMemo(
|
|
3579
|
+
() => ({
|
|
3580
|
+
add(options) {
|
|
3581
|
+
const variant = options.variant ?? "default";
|
|
3582
|
+
return manager.add({
|
|
3583
|
+
...toBaseToastOptions({ ...options, variant }),
|
|
3584
|
+
id: options.id
|
|
3585
|
+
});
|
|
3586
|
+
},
|
|
3587
|
+
close(id) {
|
|
3588
|
+
manager.close(id);
|
|
3589
|
+
},
|
|
3590
|
+
update(id, options) {
|
|
3591
|
+
manager.update(id, toBaseToastOptions(options));
|
|
3592
|
+
},
|
|
3593
|
+
promise(promise, options) {
|
|
3594
|
+
return manager.promise(promise, {
|
|
3595
|
+
loading: toBasePromiseOption(options.loading),
|
|
3596
|
+
success: (result) => {
|
|
3597
|
+
const next = typeof options.success === "function" ? options.success(result) : options.success;
|
|
3598
|
+
return toBasePromiseOption(next);
|
|
3599
|
+
},
|
|
3600
|
+
error: (error) => {
|
|
3601
|
+
const next = typeof options.error === "function" ? options.error(error) : options.error;
|
|
3602
|
+
return toBasePromiseOption(next);
|
|
3603
|
+
}
|
|
3604
|
+
});
|
|
3605
|
+
}
|
|
3606
|
+
}),
|
|
3607
|
+
[manager]
|
|
3608
|
+
);
|
|
3609
|
+
}
|
|
3610
|
+
function ToastViewport3({ className, placement = "bottom-end", ...props }) {
|
|
3611
|
+
const { toasts } = index_parts_exports4.useToastManager();
|
|
3612
|
+
return /* @__PURE__ */ jsx16(index_parts_exports4.Portal, { children: /* @__PURE__ */ jsx16(
|
|
3613
|
+
index_parts_exports4.Viewport,
|
|
3614
|
+
{
|
|
3615
|
+
"data-slot": "toast-viewport",
|
|
3616
|
+
className: cn(
|
|
3617
|
+
"pointer-events-none fixed z-[100] flex w-[min(24rem,calc(100vw-2rem))] max-w-[calc(100vw-2rem)] flex-col gap-2 p-4 outline-none",
|
|
3618
|
+
placement === "bottom-end" && "right-0 bottom-0 items-end",
|
|
3619
|
+
placement === "bottom-start" && "bottom-0 left-0 items-start",
|
|
3620
|
+
placement === "top-end" && "top-0 right-0 items-end",
|
|
3621
|
+
placement === "top-start" && "top-0 left-0 items-start",
|
|
3622
|
+
className
|
|
3623
|
+
),
|
|
3624
|
+
...props,
|
|
3625
|
+
children: toasts.map((toast) => /* @__PURE__ */ jsx16(Toast, { toast }, toast.id))
|
|
3626
|
+
}
|
|
3627
|
+
) });
|
|
3628
|
+
}
|
|
3629
|
+
function Toast({
|
|
3630
|
+
children,
|
|
3631
|
+
className,
|
|
3632
|
+
toast,
|
|
3633
|
+
...props
|
|
3634
|
+
}) {
|
|
3635
|
+
const variant = toast.data?.variant ?? toast.type ?? "default";
|
|
3636
|
+
return /* @__PURE__ */ jsx16(
|
|
3637
|
+
index_parts_exports4.Root,
|
|
3638
|
+
{
|
|
3639
|
+
toast,
|
|
3640
|
+
"data-slot": "toast",
|
|
3641
|
+
"data-variant": variant,
|
|
3642
|
+
className: cn(
|
|
3643
|
+
"pointer-events-auto relative grid w-full grid-cols-[minmax(0,1fr)_auto] gap-3 rounded-[var(--ds-radius-surface)] border bg-surface p-4 text-sm text-text-primary shadow-[var(--ds-shadow-floating)] outline-none data-ending:animate-out data-starting:animate-in data-[variant=error]:border-danger-border data-[variant=error]:bg-danger-background data-[variant=error]:text-danger-foreground data-[variant=information]:border-information-border data-[variant=information]:bg-information-background data-[variant=information]:text-information-foreground data-[variant=success]:border-success-border data-[variant=success]:bg-success-background data-[variant=success]:text-success-foreground data-[variant=warning]:border-warning-border data-[variant=warning]:bg-warning-background data-[variant=warning]:text-warning-foreground",
|
|
3644
|
+
className
|
|
3645
|
+
),
|
|
3646
|
+
...props,
|
|
3647
|
+
children: children ?? /* @__PURE__ */ jsxs6(ToastContent3, { children: [
|
|
3648
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
|
|
3649
|
+
/* @__PURE__ */ jsx16(ToastTitle3, {}),
|
|
3650
|
+
/* @__PURE__ */ jsx16(ToastDescription3, {})
|
|
3651
|
+
] }),
|
|
3652
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-1", children: [
|
|
3653
|
+
/* @__PURE__ */ jsx16(ToastAction3, {}),
|
|
3654
|
+
/* @__PURE__ */ jsx16(ToastClose3, {})
|
|
3655
|
+
] })
|
|
3656
|
+
] })
|
|
3657
|
+
}
|
|
3658
|
+
);
|
|
3659
|
+
}
|
|
3660
|
+
function ToastContent3({ className, ...props }) {
|
|
3661
|
+
return /* @__PURE__ */ jsx16(index_parts_exports4.Content, { "data-slot": "toast-content", className: cn("contents", className), ...props });
|
|
3662
|
+
}
|
|
3663
|
+
function ToastTitle3({ className, ...props }) {
|
|
3664
|
+
return /* @__PURE__ */ jsx16(index_parts_exports4.Title, { "data-slot": "toast-title", className: cn("font-semibold", className), ...props });
|
|
3665
|
+
}
|
|
3666
|
+
function ToastDescription3({ className, ...props }) {
|
|
3667
|
+
return /* @__PURE__ */ jsx16(index_parts_exports4.Description, { "data-slot": "toast-description", className: cn("mt-1 text-text-supporting", className), ...props });
|
|
3668
|
+
}
|
|
3669
|
+
function ToastAction3({ className, ...props }) {
|
|
3670
|
+
return /* @__PURE__ */ jsx16(index_parts_exports4.Action, { "data-slot": "toast-action", className: cn("rounded px-2 py-1 text-xs font-medium text-text-link outline-none hover:bg-surface-muted focus-visible:ring-2 focus-visible:ring-focus", className), ...props });
|
|
3671
|
+
}
|
|
3672
|
+
function ToastClose3({ "aria-label": ariaLabel = "Dismiss notification", children, className, ...props }) {
|
|
3673
|
+
return /* @__PURE__ */ jsx16(
|
|
3674
|
+
index_parts_exports4.Close,
|
|
3675
|
+
{
|
|
3676
|
+
"data-slot": "toast-close",
|
|
3677
|
+
"aria-label": ariaLabel,
|
|
3678
|
+
className: cn("rounded p-1 text-text-supporting outline-none hover:bg-surface-muted hover:text-text-primary focus-visible:ring-2 focus-visible:ring-focus", className),
|
|
3679
|
+
...props,
|
|
3680
|
+
children: children ?? /* @__PURE__ */ jsx16(XIcon2, { "aria-hidden": "true", className: "size-4" })
|
|
3681
|
+
}
|
|
3682
|
+
);
|
|
3683
|
+
}
|
|
3684
|
+
|
|
3685
|
+
export {
|
|
3686
|
+
alertVariants,
|
|
3687
|
+
Alert,
|
|
3688
|
+
AlertTitle,
|
|
3689
|
+
AlertDescription,
|
|
3690
|
+
Avatar,
|
|
3691
|
+
AvatarImage,
|
|
3692
|
+
AvatarFallback,
|
|
3693
|
+
AvatarGroup,
|
|
3694
|
+
badgeVariants,
|
|
3695
|
+
Badge,
|
|
3696
|
+
BrandIcon,
|
|
3697
|
+
BrandWordmark,
|
|
3698
|
+
Switch,
|
|
3699
|
+
Textarea,
|
|
3700
|
+
ConsciaButton,
|
|
3701
|
+
ConsciaIconButton,
|
|
3702
|
+
ConsciaCard,
|
|
3703
|
+
ConsciaCardContent,
|
|
3704
|
+
ConsciaCardDescription,
|
|
3705
|
+
ConsciaCardHeader,
|
|
3706
|
+
ConsciaCardTitle,
|
|
3707
|
+
ConsciaCardFooter,
|
|
3708
|
+
ConsciaCheckbox,
|
|
3709
|
+
ConsciaInput,
|
|
3710
|
+
ConsciaSwitch,
|
|
3711
|
+
ConsciaTextarea,
|
|
3712
|
+
ConsciaSelect,
|
|
3713
|
+
ConsciaSelectContent,
|
|
3714
|
+
ConsciaSelectGroup,
|
|
3715
|
+
ConsciaSelectItem,
|
|
3716
|
+
ConsciaSelectTrigger,
|
|
3717
|
+
ConsciaSelectValue,
|
|
3718
|
+
ConsciaTable,
|
|
3719
|
+
ConsciaTableBody,
|
|
3720
|
+
ConsciaTableCell,
|
|
3721
|
+
ConsciaTableHeader,
|
|
3722
|
+
ConsciaTableHead,
|
|
3723
|
+
ConsciaTableRow,
|
|
3724
|
+
Field,
|
|
3725
|
+
FieldGroup,
|
|
3726
|
+
FieldLabel,
|
|
3727
|
+
FieldDescription,
|
|
3728
|
+
FieldError,
|
|
3729
|
+
FilterChip,
|
|
3730
|
+
FormSelect,
|
|
3731
|
+
ConsciaFormSelect,
|
|
3732
|
+
Label,
|
|
3733
|
+
Popover,
|
|
3734
|
+
PopoverTrigger3 as PopoverTrigger,
|
|
3735
|
+
PopoverPortal3 as PopoverPortal,
|
|
3736
|
+
PopoverPositioner3 as PopoverPositioner,
|
|
3737
|
+
PopoverContent,
|
|
3738
|
+
PopoverArrow3 as PopoverArrow,
|
|
3739
|
+
PopoverTitle3 as PopoverTitle,
|
|
3740
|
+
PopoverDescription3 as PopoverDescription,
|
|
3741
|
+
PopoverClose3 as PopoverClose,
|
|
3742
|
+
SearchableSelect,
|
|
3743
|
+
Spinner,
|
|
3744
|
+
ToastProvider3 as ToastProvider,
|
|
3745
|
+
useToast,
|
|
3746
|
+
ToastViewport3 as ToastViewport,
|
|
3747
|
+
Toast,
|
|
3748
|
+
ToastContent3 as ToastContent,
|
|
3749
|
+
ToastTitle3 as ToastTitle,
|
|
3750
|
+
ToastDescription3 as ToastDescription,
|
|
3751
|
+
ToastAction3 as ToastAction,
|
|
3752
|
+
ToastClose3 as ToastClose
|
|
3753
|
+
};
|
|
3754
|
+
//# sourceMappingURL=chunk-3UTRMJLB.js.map
|