@olwiba/ui 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +23 -1
- package/dist/index.js +211 -116
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/app/UpdateBanner.tsx +130 -0
- package/src/index.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { cn } from './chunk-AMWLSHD6.js';
|
|
2
2
|
export { MdxContent, cn } from './chunk-AMWLSHD6.js';
|
|
3
|
-
import * as
|
|
3
|
+
import * as React34 from 'react';
|
|
4
4
|
import { useRef, useEffect, useState } from 'react';
|
|
5
5
|
import { Button as Button$1, Card as Card$1, Input as Input$1, Textarea as Textarea$1, Checkbox as Checkbox$1, Switch as Switch$1, useIsMobile, UIVariantProvider, Badge as Badge$1, cn as cn$1, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Avatar, AvatarImage, AvatarFallback, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, Dialog, DialogTrigger, Progress, useUIVariant, Separator, Accordion, AccordionItem, AccordionTrigger, AccordionContent, Label, Sheet, SheetTrigger, SheetContent, StatusIndicator, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandSeparator, CommandGroup, CommandItem, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, ContextMenu as ContextMenu$1, ContextMenuTrigger, ContextMenuContent, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, CommandShortcut, Popover, PopoverTrigger, PopoverContent, Spinner, SidebarProvider, SidebarInset, CardHeader, CardTitle, CardDescription, CardContent, InputOTP, InputOTPGroup, InputOTPSlot, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose, ContextMenuSeparator, ContextMenuLabel, ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent, ContextMenuItem, ContextMenuShortcut, Sidebar, SidebarHeader, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarFooter, SidebarTrigger, useSidebar, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup } from '@olwiba/cn';
|
|
6
6
|
export { CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Enchanted } from '@olwiba/cn';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import { Search, ArrowUp, ArrowDown, ArrowUpDown, ChevronLeft, ChevronRight, MoreHorizontal, UserPlus, Download, CreditCard, Check, Loader2, ArrowLeft, ArrowUpRight, X,
|
|
8
|
+
import { Search, ArrowUp, ArrowDown, ArrowUpDown, ChevronLeft, ChevronRight, MoreHorizontal, UserPlus, Download, CreditCard, Check, Loader2, ArrowLeft, ArrowUpRight, X, Sparkles, RefreshCw, ArrowRight, Minus, Quote, Star, Twitter, Github, Linkedin, Mail, MessageSquare, ChevronDown, Send, Menu, UploadCloud, File, CheckCircle2, AlertCircle, Bell, Inbox, Activity, TrendingUp, TrendingDown, Sun, Moon, Palette, AlertTriangle, Rocket, Info, Layers, LayoutGrid, ShieldCheck, Building2, MoreVerticalIcon, CreditCardIcon, BellIcon, LogOutIcon } from 'lucide-react';
|
|
9
9
|
import { useReactTable, getPaginationRowModel, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
10
10
|
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
11
11
|
import { sortableKeyboardCoordinates, SortableContext, rectSortingStrategy, horizontalListSortingStrategy, verticalListSortingStrategy, arrayMove, useSortable } from '@dnd-kit/sortable';
|
|
@@ -13,7 +13,7 @@ import { CSS } from '@dnd-kit/utilities';
|
|
|
13
13
|
import { PieChart, Pie, Cell, BarChart, XAxis, YAxis, Bar, AreaChart, Area, LineChart, Line, ResponsiveContainer, Tooltip as Tooltip$1, CartesianGrid } from 'recharts';
|
|
14
14
|
import { toast } from 'sonner';
|
|
15
15
|
|
|
16
|
-
var OlwibaUIContext =
|
|
16
|
+
var OlwibaUIContext = React34.createContext({
|
|
17
17
|
isMobile: false,
|
|
18
18
|
mode: "default",
|
|
19
19
|
setMode: () => {
|
|
@@ -22,17 +22,17 @@ var OlwibaUIContext = React33.createContext({
|
|
|
22
22
|
function OlwibaUIProvider({ children, isMobile: isMobileProp, mode: initialMode = "default" }) {
|
|
23
23
|
const detectedMobile = useIsMobile();
|
|
24
24
|
const isMobile = isMobileProp ?? detectedMobile;
|
|
25
|
-
const [mode, setMode] =
|
|
25
|
+
const [mode, setMode] = React34.useState(initialMode);
|
|
26
26
|
const variant = mode !== "default" ? mode : void 0;
|
|
27
27
|
return /* @__PURE__ */ jsx(OlwibaUIContext.Provider, { value: { isMobile, mode, setMode }, children: /* @__PURE__ */ jsx(UIVariantProvider, { mode: variant, children }) });
|
|
28
28
|
}
|
|
29
29
|
function useOlwibaUI() {
|
|
30
|
-
return
|
|
30
|
+
return React34.useContext(OlwibaUIContext);
|
|
31
31
|
}
|
|
32
32
|
function useUIMode() {
|
|
33
|
-
return
|
|
33
|
+
return React34.useContext(OlwibaUIContext).mode;
|
|
34
34
|
}
|
|
35
|
-
var Button =
|
|
35
|
+
var Button = React34.forwardRef(
|
|
36
36
|
({ mode, ...props }, ref) => {
|
|
37
37
|
const ctxMode = useUIMode();
|
|
38
38
|
const resolvedMode = mode ?? (ctxMode !== "default" ? ctxMode : void 0);
|
|
@@ -40,7 +40,7 @@ var Button = React33.forwardRef(
|
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
42
|
Button.displayName = "Button";
|
|
43
|
-
var Card =
|
|
43
|
+
var Card = React34.forwardRef(
|
|
44
44
|
({ mode, ...props }, ref) => {
|
|
45
45
|
const ctxMode = useUIMode();
|
|
46
46
|
const resolvedMode = mode ?? (ctxMode !== "default" ? ctxMode : void 0);
|
|
@@ -51,7 +51,7 @@ Card.displayName = "Card";
|
|
|
51
51
|
function Badge(props) {
|
|
52
52
|
return /* @__PURE__ */ jsx(Badge$1, { ...props });
|
|
53
53
|
}
|
|
54
|
-
var Input =
|
|
54
|
+
var Input = React34.forwardRef(
|
|
55
55
|
({ mode, ...props }, ref) => {
|
|
56
56
|
const ctxMode = useUIMode();
|
|
57
57
|
const resolvedMode = mode ?? (ctxMode !== "default" ? ctxMode : void 0);
|
|
@@ -59,7 +59,7 @@ var Input = React33.forwardRef(
|
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
61
|
Input.displayName = "Input";
|
|
62
|
-
var Textarea =
|
|
62
|
+
var Textarea = React34.forwardRef(
|
|
63
63
|
({ mode, ...props }, ref) => {
|
|
64
64
|
const ctxMode = useUIMode();
|
|
65
65
|
const resolvedMode = mode ?? (ctxMode !== "default" ? ctxMode : void 0);
|
|
@@ -67,13 +67,13 @@ var Textarea = React33.forwardRef(
|
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
69
|
Textarea.displayName = "Textarea";
|
|
70
|
-
var Checkbox =
|
|
70
|
+
var Checkbox = React34.forwardRef(({ mode, ...props }, ref) => {
|
|
71
71
|
const ctxMode = useUIMode();
|
|
72
72
|
const resolvedMode = mode ?? (ctxMode !== "default" ? ctxMode : void 0);
|
|
73
73
|
return /* @__PURE__ */ jsx(Checkbox$1, { mode: resolvedMode, ...props, ref });
|
|
74
74
|
});
|
|
75
75
|
Checkbox.displayName = "Checkbox";
|
|
76
|
-
var Switch =
|
|
76
|
+
var Switch = React34.forwardRef(({ mode: _mode, ...props }, ref) => {
|
|
77
77
|
return /* @__PURE__ */ jsx(Switch$1, { ...props, ref });
|
|
78
78
|
});
|
|
79
79
|
Switch.displayName = "Switch";
|
|
@@ -530,7 +530,7 @@ function DefaultForm({
|
|
|
530
530
|
const isForgotPassword = mode === "forgot-password";
|
|
531
531
|
const isResetPassword = mode === "reset-password";
|
|
532
532
|
const isVerify = mode === "verify";
|
|
533
|
-
const [code, setCode] =
|
|
533
|
+
const [code, setCode] = React34.useState("");
|
|
534
534
|
const hasPrefill = !!(defaultEmail || defaultPassword);
|
|
535
535
|
const prefillStyle = (active) => active ? { animation: "auth-prefill 1.6s ease-out 0.35s 1 both" } : void 0;
|
|
536
536
|
const copy = authCopy[mode];
|
|
@@ -690,10 +690,10 @@ function DataTable({
|
|
|
690
690
|
emptyMessage = "No results.",
|
|
691
691
|
className
|
|
692
692
|
}) {
|
|
693
|
-
const [sorting, setSorting] =
|
|
694
|
-
const [rowSelection, setRowSelection] =
|
|
695
|
-
const [globalFilter, setGlobalFilter] =
|
|
696
|
-
const allColumns =
|
|
693
|
+
const [sorting, setSorting] = React34.useState([]);
|
|
694
|
+
const [rowSelection, setRowSelection] = React34.useState({});
|
|
695
|
+
const [globalFilter, setGlobalFilter] = React34.useState("");
|
|
696
|
+
const allColumns = React34.useMemo(
|
|
697
697
|
() => selectable ? [selectColumn, ...columns] : columns,
|
|
698
698
|
[selectable, columns]
|
|
699
699
|
);
|
|
@@ -715,7 +715,7 @@ function DataTable({
|
|
|
715
715
|
initialState: pageSize > 0 ? { pagination: { pageSize } } : void 0,
|
|
716
716
|
enableRowSelection: selectable
|
|
717
717
|
});
|
|
718
|
-
|
|
718
|
+
React34.useEffect(() => {
|
|
719
719
|
if (!onSelectionChange) return;
|
|
720
720
|
onSelectionChange(table.getSelectedRowModel().rows.map((r) => r.original));
|
|
721
721
|
}, [rowSelection]);
|
|
@@ -795,8 +795,8 @@ function DataTable({
|
|
|
795
795
|
] });
|
|
796
796
|
}
|
|
797
797
|
function InviteDialog({ roles, onInvite, onClose }) {
|
|
798
|
-
const [email, setEmail] =
|
|
799
|
-
const [role, setRole] =
|
|
798
|
+
const [email, setEmail] = React34.useState("");
|
|
799
|
+
const [role, setRole] = React34.useState(roles[roles.length - 1] ?? roles[0]);
|
|
800
800
|
return /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs(
|
|
801
801
|
"form",
|
|
802
802
|
{
|
|
@@ -840,8 +840,8 @@ function TeamMembersPanel({
|
|
|
840
840
|
title = "Team members",
|
|
841
841
|
description = "Manage who has access to this workspace."
|
|
842
842
|
}) {
|
|
843
|
-
const [inviteOpen, setInviteOpen] =
|
|
844
|
-
const columns =
|
|
843
|
+
const [inviteOpen, setInviteOpen] = React34.useState(false);
|
|
844
|
+
const columns = React34.useMemo(() => [
|
|
845
845
|
{
|
|
846
846
|
accessorKey: "name",
|
|
847
847
|
header: "Name",
|
|
@@ -910,7 +910,7 @@ function BillingPanel({
|
|
|
910
910
|
onUpdatePaymentMethod,
|
|
911
911
|
className
|
|
912
912
|
}) {
|
|
913
|
-
const invoiceColumns =
|
|
913
|
+
const invoiceColumns = React34.useMemo(() => [
|
|
914
914
|
{ accessorKey: "date", header: "Date", enableSorting: false },
|
|
915
915
|
{ accessorKey: "amount", header: "Amount", enableSorting: false },
|
|
916
916
|
{
|
|
@@ -989,9 +989,9 @@ function OnboardingWizard({
|
|
|
989
989
|
completeLabel = "Finish",
|
|
990
990
|
className
|
|
991
991
|
}) {
|
|
992
|
-
const [internalStep, setInternalStep] =
|
|
993
|
-
const [error, setError] =
|
|
994
|
-
const [pending, setPending] =
|
|
992
|
+
const [internalStep, setInternalStep] = React34.useState(0);
|
|
993
|
+
const [error, setError] = React34.useState(null);
|
|
994
|
+
const [pending, setPending] = React34.useState(false);
|
|
995
995
|
const index = stepProp ?? internalStep;
|
|
996
996
|
const current = steps[index];
|
|
997
997
|
const isLast = index === steps.length - 1;
|
|
@@ -1308,6 +1308,101 @@ function UpgradePrompt({
|
|
|
1308
1308
|
}
|
|
1309
1309
|
);
|
|
1310
1310
|
}
|
|
1311
|
+
function UpdateBanner({
|
|
1312
|
+
currentVersion,
|
|
1313
|
+
fetchVersion,
|
|
1314
|
+
intervalMs = 5 * 60 * 1e3,
|
|
1315
|
+
forceShow = false,
|
|
1316
|
+
onRefresh,
|
|
1317
|
+
message = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1318
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: "App update available!" }),
|
|
1319
|
+
" Refresh to get the latest features and improvements."
|
|
1320
|
+
] }),
|
|
1321
|
+
buttonLabel = "Refresh now",
|
|
1322
|
+
className
|
|
1323
|
+
}) {
|
|
1324
|
+
const [show, setShow] = React34.useState(forceShow);
|
|
1325
|
+
const [entered, setEntered] = React34.useState(false);
|
|
1326
|
+
const [refreshing, setRefreshing] = React34.useState(false);
|
|
1327
|
+
React34.useEffect(() => {
|
|
1328
|
+
if (forceShow) {
|
|
1329
|
+
setShow(true);
|
|
1330
|
+
return;
|
|
1331
|
+
}
|
|
1332
|
+
setShow(false);
|
|
1333
|
+
let cancelled = false;
|
|
1334
|
+
const check = async () => {
|
|
1335
|
+
try {
|
|
1336
|
+
const server = await fetchVersion();
|
|
1337
|
+
if (!cancelled && server.version && server.version !== currentVersion) {
|
|
1338
|
+
setShow(true);
|
|
1339
|
+
}
|
|
1340
|
+
} catch {
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1343
|
+
void check();
|
|
1344
|
+
const id = setInterval(check, intervalMs);
|
|
1345
|
+
return () => {
|
|
1346
|
+
cancelled = true;
|
|
1347
|
+
clearInterval(id);
|
|
1348
|
+
};
|
|
1349
|
+
}, [currentVersion, fetchVersion, forceShow, intervalMs]);
|
|
1350
|
+
React34.useEffect(() => {
|
|
1351
|
+
if (!show) {
|
|
1352
|
+
setEntered(false);
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1355
|
+
const id = requestAnimationFrame(() => setEntered(true));
|
|
1356
|
+
return () => cancelAnimationFrame(id);
|
|
1357
|
+
}, [show]);
|
|
1358
|
+
const handleRefresh = () => {
|
|
1359
|
+
setRefreshing(true);
|
|
1360
|
+
setTimeout(() => {
|
|
1361
|
+
if (onRefresh) {
|
|
1362
|
+
onRefresh();
|
|
1363
|
+
setRefreshing(false);
|
|
1364
|
+
if (forceShow) setShow(false);
|
|
1365
|
+
} else {
|
|
1366
|
+
window.location.reload();
|
|
1367
|
+
}
|
|
1368
|
+
}, 400);
|
|
1369
|
+
};
|
|
1370
|
+
if (!show) return null;
|
|
1371
|
+
return /* @__PURE__ */ jsx("div", { className: "pointer-events-none fixed inset-x-0 top-4 z-50 flex justify-center px-4", children: /* @__PURE__ */ jsx(
|
|
1372
|
+
"div",
|
|
1373
|
+
{
|
|
1374
|
+
className: cn$1(
|
|
1375
|
+
"pointer-events-auto transition-all duration-500 ease-out",
|
|
1376
|
+
entered ? "translate-y-0 opacity-100" : "-translate-y-24 opacity-0"
|
|
1377
|
+
),
|
|
1378
|
+
children: /* @__PURE__ */ jsx(
|
|
1379
|
+
Card$1,
|
|
1380
|
+
{
|
|
1381
|
+
className: cn$1(
|
|
1382
|
+
"max-w-3xl border-amber-300/60 bg-amber-50 dark:border-amber-700/60 dark:bg-amber-950",
|
|
1383
|
+
className
|
|
1384
|
+
),
|
|
1385
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-6 p-4", children: [
|
|
1386
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
1387
|
+
/* @__PURE__ */ jsx(Sparkles, { className: "size-5 shrink-0 text-amber-600 dark:text-amber-400", "aria-hidden": "true" }),
|
|
1388
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-amber-800 dark:text-amber-200", children: message })
|
|
1389
|
+
] }),
|
|
1390
|
+
/* @__PURE__ */ jsx(
|
|
1391
|
+
Button$1,
|
|
1392
|
+
{
|
|
1393
|
+
onClick: handleRefresh,
|
|
1394
|
+
disabled: refreshing,
|
|
1395
|
+
size: "sm",
|
|
1396
|
+
className: "shrink-0 bg-amber-600 text-white hover:bg-amber-700 dark:bg-amber-600 dark:hover:bg-amber-700",
|
|
1397
|
+
children: refreshing ? /* @__PURE__ */ jsx(RefreshCw, { className: "size-4 animate-spin" }) : buttonLabel
|
|
1398
|
+
}
|
|
1399
|
+
)
|
|
1400
|
+
] })
|
|
1401
|
+
}
|
|
1402
|
+
)
|
|
1403
|
+
}
|
|
1404
|
+
) });
|
|
1405
|
+
}
|
|
1311
1406
|
var translateMap = {
|
|
1312
1407
|
up: "translate-y-6",
|
|
1313
1408
|
down: "-translate-y-6",
|
|
@@ -1325,9 +1420,9 @@ function FadeIn({
|
|
|
1325
1420
|
style,
|
|
1326
1421
|
...props
|
|
1327
1422
|
}) {
|
|
1328
|
-
const ref =
|
|
1329
|
-
const [visible, setVisible] =
|
|
1330
|
-
|
|
1423
|
+
const ref = React34.useRef(null);
|
|
1424
|
+
const [visible, setVisible] = React34.useState(false);
|
|
1425
|
+
React34.useEffect(() => {
|
|
1331
1426
|
const el = ref.current;
|
|
1332
1427
|
if (!el) return;
|
|
1333
1428
|
const observer = new IntersectionObserver(
|
|
@@ -1522,16 +1617,16 @@ function Carousel({
|
|
|
1522
1617
|
className
|
|
1523
1618
|
}) {
|
|
1524
1619
|
const mode = useUIVariant();
|
|
1525
|
-
const trackRef =
|
|
1526
|
-
const [canPrev, setCanPrev] =
|
|
1527
|
-
const [canNext, setCanNext] =
|
|
1528
|
-
const updateScrollState =
|
|
1620
|
+
const trackRef = React34.useRef(null);
|
|
1621
|
+
const [canPrev, setCanPrev] = React34.useState(false);
|
|
1622
|
+
const [canNext, setCanNext] = React34.useState(true);
|
|
1623
|
+
const updateScrollState = React34.useCallback(() => {
|
|
1529
1624
|
const track = trackRef.current;
|
|
1530
1625
|
if (!track) return;
|
|
1531
1626
|
setCanPrev(track.scrollLeft > 8);
|
|
1532
1627
|
setCanNext(track.scrollLeft < track.scrollWidth - track.clientWidth - 8);
|
|
1533
1628
|
}, []);
|
|
1534
|
-
|
|
1629
|
+
React34.useEffect(() => {
|
|
1535
1630
|
const track = trackRef.current;
|
|
1536
1631
|
if (!track) return;
|
|
1537
1632
|
updateScrollState();
|
|
@@ -1588,7 +1683,7 @@ function Carousel({
|
|
|
1588
1683
|
role: "region",
|
|
1589
1684
|
"aria-label": ariaLabel,
|
|
1590
1685
|
className: "flex snap-x snap-mandatory gap-6 overflow-x-auto pb-4 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
1591
|
-
children:
|
|
1686
|
+
children: React34.Children.map(
|
|
1592
1687
|
children,
|
|
1593
1688
|
(child) => child == null ? null : /* @__PURE__ */ jsx("div", { "data-carousel-item": true, className: cn$1("shrink-0 snap-start", itemClassName), children: child })
|
|
1594
1689
|
)
|
|
@@ -1613,9 +1708,9 @@ function StaggerChildren({
|
|
|
1613
1708
|
className,
|
|
1614
1709
|
...props
|
|
1615
1710
|
}) {
|
|
1616
|
-
const ref =
|
|
1617
|
-
const [visible, setVisible] =
|
|
1618
|
-
|
|
1711
|
+
const ref = React34.useRef(null);
|
|
1712
|
+
const [visible, setVisible] = React34.useState(false);
|
|
1713
|
+
React34.useEffect(() => {
|
|
1619
1714
|
const el = ref.current;
|
|
1620
1715
|
if (!el) return;
|
|
1621
1716
|
const observer = new IntersectionObserver(
|
|
@@ -1633,7 +1728,7 @@ function StaggerChildren({
|
|
|
1633
1728
|
return () => observer.disconnect();
|
|
1634
1729
|
}, [once]);
|
|
1635
1730
|
const [tx, ty] = translateMap2[direction];
|
|
1636
|
-
return /* @__PURE__ */ jsx("div", { ref, className: cn$1(className), ...props, children:
|
|
1731
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn$1(className), ...props, children: React34.Children.map(children, (child, i) => /* @__PURE__ */ jsx(
|
|
1637
1732
|
"div",
|
|
1638
1733
|
{
|
|
1639
1734
|
className: "h-full",
|
|
@@ -1775,7 +1870,7 @@ function StepsSection({
|
|
|
1775
1870
|
/* @__PURE__ */ jsx("div", { className: "mt-12", children: resolvedGroups.map((group, groupIndex) => {
|
|
1776
1871
|
const startNumber = nextNumber;
|
|
1777
1872
|
nextNumber += group.steps.length;
|
|
1778
|
-
return /* @__PURE__ */ jsxs(
|
|
1873
|
+
return /* @__PURE__ */ jsxs(React34.Fragment, { children: [
|
|
1779
1874
|
/* @__PURE__ */ jsx("div", { className: cn$1(groupIndex > 0 && "mt-10"), children: /* @__PURE__ */ jsx(TimelineGroup, { steps: group.steps, startNumber, fadeIn: groupIndex > 0 }) }),
|
|
1780
1875
|
group.after && /* @__PURE__ */ jsx("div", { className: "mt-16", children: group.after })
|
|
1781
1876
|
] }, groupIndex);
|
|
@@ -1945,9 +2040,9 @@ function FeatureMarqueeSection({
|
|
|
1945
2040
|
] });
|
|
1946
2041
|
}
|
|
1947
2042
|
function useIntersectionObserver(options) {
|
|
1948
|
-
const ref =
|
|
1949
|
-
const [isIntersecting, setIsIntersecting] =
|
|
1950
|
-
|
|
2043
|
+
const ref = React34.useRef(null);
|
|
2044
|
+
const [isIntersecting, setIsIntersecting] = React34.useState(false);
|
|
2045
|
+
React34.useEffect(() => {
|
|
1951
2046
|
const el = ref.current;
|
|
1952
2047
|
if (!el) return;
|
|
1953
2048
|
const observer = new IntersectionObserver(([entry]) => {
|
|
@@ -1969,8 +2064,8 @@ function ShowcaseCta({
|
|
|
1969
2064
|
sectionClasses
|
|
1970
2065
|
}) {
|
|
1971
2066
|
const [ref, intersecting] = useIntersectionObserver({ threshold: 0.15 });
|
|
1972
|
-
const [visible, setVisible] =
|
|
1973
|
-
|
|
2067
|
+
const [visible, setVisible] = React34.useState(false);
|
|
2068
|
+
React34.useEffect(() => {
|
|
1974
2069
|
if (intersecting) setVisible(true);
|
|
1975
2070
|
}, [intersecting]);
|
|
1976
2071
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2147,8 +2242,8 @@ function CountdownTimer({
|
|
|
2147
2242
|
className,
|
|
2148
2243
|
compact = false
|
|
2149
2244
|
}) {
|
|
2150
|
-
const [timeLeft, setTimeLeft] =
|
|
2151
|
-
|
|
2245
|
+
const [timeLeft, setTimeLeft] = React34.useState(() => getTimeLeft(deadline));
|
|
2246
|
+
React34.useEffect(() => {
|
|
2152
2247
|
setTimeLeft(getTimeLeft(deadline));
|
|
2153
2248
|
const id = setInterval(() => setTimeLeft(getTimeLeft(deadline)), 1e3);
|
|
2154
2249
|
return () => clearInterval(id);
|
|
@@ -2174,7 +2269,7 @@ function CountdownTimer({
|
|
|
2174
2269
|
];
|
|
2175
2270
|
return /* @__PURE__ */ jsxs("div", { className: cn$1("flex items-center justify-center gap-2 text-sm", className), children: [
|
|
2176
2271
|
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
|
|
2177
|
-
/* @__PURE__ */ jsx("span", { className: "flex items-center gap-1 font-mono font-semibold tabular-nums", children: units.map(({ value, unit }, i) => /* @__PURE__ */ jsxs(
|
|
2272
|
+
/* @__PURE__ */ jsx("span", { className: "flex items-center gap-1 font-mono font-semibold tabular-nums", children: units.map(({ value, unit }, i) => /* @__PURE__ */ jsxs(React34.Fragment, { children: [
|
|
2178
2273
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
2179
2274
|
String(value).padStart(2, "0"),
|
|
2180
2275
|
/* @__PURE__ */ jsx("span", { className: "font-normal text-muted-foreground", children: unit })
|
|
@@ -2199,7 +2294,7 @@ function PricingSection({
|
|
|
2199
2294
|
highlightedBadgeLabel = "Founding member",
|
|
2200
2295
|
renderPlanFooter
|
|
2201
2296
|
}) {
|
|
2202
|
-
const [annual, setAnnual] =
|
|
2297
|
+
const [annual, setAnnual] = React34.useState(false);
|
|
2203
2298
|
const isOneTime = mode === "one-time";
|
|
2204
2299
|
const uiMode = useUIVariant();
|
|
2205
2300
|
const sectionClasses = cn$1(
|
|
@@ -2468,10 +2563,10 @@ function CountUp({
|
|
|
2468
2563
|
className,
|
|
2469
2564
|
...props
|
|
2470
2565
|
}) {
|
|
2471
|
-
const ref =
|
|
2472
|
-
const [value, setValue] =
|
|
2473
|
-
const hasStarted =
|
|
2474
|
-
|
|
2566
|
+
const ref = React34.useRef(null);
|
|
2567
|
+
const [value, setValue] = React34.useState(from);
|
|
2568
|
+
const hasStarted = React34.useRef(false);
|
|
2569
|
+
React34.useEffect(() => {
|
|
2475
2570
|
const el = ref.current;
|
|
2476
2571
|
if (!el) return;
|
|
2477
2572
|
const observer = new IntersectionObserver(
|
|
@@ -2564,8 +2659,8 @@ function NewsletterSection({
|
|
|
2564
2659
|
successDescription = defaults.successDescription,
|
|
2565
2660
|
onSubscribe
|
|
2566
2661
|
} = {}) {
|
|
2567
|
-
const [email, setEmail] =
|
|
2568
|
-
const [submitted, setSubmitted] =
|
|
2662
|
+
const [email, setEmail] = React34.useState("");
|
|
2663
|
+
const [submitted, setSubmitted] = React34.useState(false);
|
|
2569
2664
|
const mode = useUIVariant();
|
|
2570
2665
|
const sectionClasses = cn$1(
|
|
2571
2666
|
"overflow-hidden bg-card",
|
|
@@ -2656,7 +2751,7 @@ function ContactSection({
|
|
|
2656
2751
|
sendAnotherLabel = defaults2.sendAnotherLabel,
|
|
2657
2752
|
onSubmit
|
|
2658
2753
|
} = {}) {
|
|
2659
|
-
const [submitted, setSubmitted] =
|
|
2754
|
+
const [submitted, setSubmitted] = React34.useState(false);
|
|
2660
2755
|
const mode = useUIVariant();
|
|
2661
2756
|
const sectionClasses = cn$1(
|
|
2662
2757
|
"overflow-hidden bg-card",
|
|
@@ -2954,7 +3049,7 @@ function Navbar({
|
|
|
2954
3049
|
controls,
|
|
2955
3050
|
renderLink = defaultRenderLink7
|
|
2956
3051
|
}) {
|
|
2957
|
-
const [open, setOpen] =
|
|
3052
|
+
const [open, setOpen] = React34.useState(false);
|
|
2958
3053
|
const brandHref = brand.href ?? "/";
|
|
2959
3054
|
const hasRightContent = controls?.length || cta?.primary || cta?.secondary;
|
|
2960
3055
|
return /* @__PURE__ */ jsx("section", { className: "overflow-hidden rounded-2xl border bg-card", children: /* @__PURE__ */ jsxs("nav", { className: "grid h-16 grid-cols-[1fr_auto_1fr] items-center px-6", children: [
|
|
@@ -2971,7 +3066,7 @@ function Navbar({
|
|
|
2971
3066
|
children: link.label
|
|
2972
3067
|
}) }, link.label)) }),
|
|
2973
3068
|
hasRightContent && /* @__PURE__ */ jsxs("div", { className: "hidden items-center justify-end gap-2 md:flex", children: [
|
|
2974
|
-
controls?.map((control, i) => /* @__PURE__ */ jsx(
|
|
3069
|
+
controls?.map((control, i) => /* @__PURE__ */ jsx(React34.Fragment, { children: control }, i)),
|
|
2975
3070
|
(cta?.secondary || cta?.primary) && controls?.length ? /* @__PURE__ */ jsx("div", { className: "mx-1 h-4 w-px bg-border" }) : null,
|
|
2976
3071
|
cta?.secondary && renderLink({
|
|
2977
3072
|
href: cta.secondary.href,
|
|
@@ -2995,7 +3090,7 @@ function Navbar({
|
|
|
2995
3090
|
/* @__PURE__ */ jsx("span", { children: brand.name })
|
|
2996
3091
|
] })
|
|
2997
3092
|
}) }) }),
|
|
2998
|
-
controls?.length ? /* @__PURE__ */ jsx("div", { className: "mb-4 flex w-full items-center justify-between gap-1", children: controls.map((control, i) => /* @__PURE__ */ jsx(
|
|
3093
|
+
controls?.length ? /* @__PURE__ */ jsx("div", { className: "mb-4 flex w-full items-center justify-between gap-1", children: controls.map((control, i) => /* @__PURE__ */ jsx(React34.Fragment, { children: control }, i)) }) : null,
|
|
2999
3094
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
3000
3095
|
/* @__PURE__ */ jsx("nav", { className: "mt-4 flex flex-col gap-1", children: navLinks.map((link) => /* @__PURE__ */ jsx("span", { onClick: () => setOpen(false), children: renderLink({
|
|
3001
3096
|
href: link.href,
|
|
@@ -3144,7 +3239,7 @@ function LogoStrip({
|
|
|
3144
3239
|
] });
|
|
3145
3240
|
}
|
|
3146
3241
|
function GridUnderlay({ variant, size = 24, className, ...props }) {
|
|
3147
|
-
const id =
|
|
3242
|
+
const id = React34.useId();
|
|
3148
3243
|
const pattern = variant === "dots" ? /* @__PURE__ */ jsx("circle", { cx: size / 2, cy: size / 2, r: 1, fill: "currentColor" }) : variant === "lines" ? /* @__PURE__ */ jsx("path", { d: `M ${size} 0 L 0 0 0 ${size}`, fill: "none", stroke: "currentColor", strokeWidth: 0.5 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3149
3244
|
/* @__PURE__ */ jsx("line", { x1: size / 2, y1: 0, x2: size / 2, y2: size, stroke: "currentColor", strokeWidth: 0.5 }),
|
|
3150
3245
|
/* @__PURE__ */ jsx("line", { x1: 0, y1: size / 2, x2: size, y2: size / 2, stroke: "currentColor", strokeWidth: 0.5 })
|
|
@@ -3172,9 +3267,9 @@ function GlowUnderlay({
|
|
|
3172
3267
|
style,
|
|
3173
3268
|
...props
|
|
3174
3269
|
}) {
|
|
3175
|
-
const [pos, setPos] =
|
|
3176
|
-
const containerRef =
|
|
3177
|
-
|
|
3270
|
+
const [pos, setPos] = React34.useState({ x: "50%", y: "50%" });
|
|
3271
|
+
const containerRef = React34.useRef(null);
|
|
3272
|
+
React34.useEffect(() => {
|
|
3178
3273
|
if (!followCursor) return;
|
|
3179
3274
|
const handleMouseMove = (e) => {
|
|
3180
3275
|
const el = containerRef.current;
|
|
@@ -3313,8 +3408,8 @@ function PageTransition({
|
|
|
3313
3408
|
style,
|
|
3314
3409
|
...props
|
|
3315
3410
|
}) {
|
|
3316
|
-
const [mounted, setMounted] =
|
|
3317
|
-
|
|
3411
|
+
const [mounted, setMounted] = React34.useState(false);
|
|
3412
|
+
React34.useEffect(() => {
|
|
3318
3413
|
const id = requestAnimationFrame(() => setMounted(true));
|
|
3319
3414
|
return () => cancelAnimationFrame(id);
|
|
3320
3415
|
}, []);
|
|
@@ -3389,7 +3484,7 @@ function Sortable({
|
|
|
3389
3484
|
if (oldIndex === -1 || newIndex === -1) return;
|
|
3390
3485
|
onReorder(arrayMove(items, oldIndex, newIndex));
|
|
3391
3486
|
};
|
|
3392
|
-
const childArray =
|
|
3487
|
+
const childArray = React34.Children.toArray(children);
|
|
3393
3488
|
return /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsx(SortableContext, { items, strategy: strategies[direction], children: /* @__PURE__ */ jsx("div", { className: cn$1(containerClasses[direction], className), children: childArray.map(
|
|
3394
3489
|
(child, i) => items[i] === void 0 ? null : /* @__PURE__ */ jsx(SortableItem, { id: items[i], disabled, className: itemClassName, children: child }, items[i])
|
|
3395
3490
|
) }) }) });
|
|
@@ -3401,8 +3496,8 @@ function Spotlight({
|
|
|
3401
3496
|
triggerClassName,
|
|
3402
3497
|
shortcut = "\u2318K"
|
|
3403
3498
|
}) {
|
|
3404
|
-
const [open, setOpen] =
|
|
3405
|
-
|
|
3499
|
+
const [open, setOpen] = React34.useState(false);
|
|
3500
|
+
React34.useEffect(() => {
|
|
3406
3501
|
const down = (e) => {
|
|
3407
3502
|
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
|
3408
3503
|
e.preventDefault();
|
|
@@ -3432,7 +3527,7 @@ function Spotlight({
|
|
|
3432
3527
|
/* @__PURE__ */ jsx(CommandInput, { placeholder }),
|
|
3433
3528
|
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
3434
3529
|
/* @__PURE__ */ jsx(CommandEmpty, { children: "No results found." }),
|
|
3435
|
-
groups.map((group, i) => /* @__PURE__ */ jsxs(
|
|
3530
|
+
groups.map((group, i) => /* @__PURE__ */ jsxs(React34.Fragment, { children: [
|
|
3436
3531
|
i > 0 && /* @__PURE__ */ jsx(CommandSeparator, {}),
|
|
3437
3532
|
/* @__PURE__ */ jsx(CommandGroup, { heading: group.heading, children: group.items.map((item) => /* @__PURE__ */ jsxs(
|
|
3438
3533
|
CommandItem,
|
|
@@ -3457,8 +3552,8 @@ function Spotlight({
|
|
|
3457
3552
|
var BASE = 40;
|
|
3458
3553
|
var MAGNIFY_RADIUS = 80;
|
|
3459
3554
|
function Dock({ items, iconSize = BASE, magnification = 1.7, className, ...props }) {
|
|
3460
|
-
const [mouseX, setMouseX] =
|
|
3461
|
-
const containerRef =
|
|
3555
|
+
const [mouseX, setMouseX] = React34.useState(null);
|
|
3556
|
+
const containerRef = React34.useRef(null);
|
|
3462
3557
|
function getScale(index) {
|
|
3463
3558
|
if (mouseX === null || !containerRef.current) return 1;
|
|
3464
3559
|
const container = containerRef.current;
|
|
@@ -3557,7 +3652,7 @@ function ConfirmDialog({ isOpen, options, handleConfirm, handleCancel, destructi
|
|
|
3557
3652
|
] }) });
|
|
3558
3653
|
}
|
|
3559
3654
|
function RegisterHotkeys({ hotkeys }) {
|
|
3560
|
-
|
|
3655
|
+
React34.useEffect(() => {
|
|
3561
3656
|
const handleKeyDown = (event) => {
|
|
3562
3657
|
for (const hotkey of hotkeys) {
|
|
3563
3658
|
const matches = event.key.toLowerCase() === hotkey.key.toLowerCase() && !!event.ctrlKey === !!hotkey.ctrl && !!event.metaKey === !!hotkey.meta && !!event.shiftKey === !!hotkey.shift && !!event.altKey === !!hotkey.alt;
|
|
@@ -3574,10 +3669,10 @@ function RegisterHotkeys({ hotkeys }) {
|
|
|
3574
3669
|
return null;
|
|
3575
3670
|
}
|
|
3576
3671
|
function useControlledOpen(defaultOpen = false) {
|
|
3577
|
-
const [isOpen, setIsOpen] =
|
|
3578
|
-
const open =
|
|
3579
|
-
const close =
|
|
3580
|
-
const toggle =
|
|
3672
|
+
const [isOpen, setIsOpen] = React34.useState(defaultOpen);
|
|
3673
|
+
const open = React34.useCallback(() => setIsOpen(true), []);
|
|
3674
|
+
const close = React34.useCallback(() => setIsOpen(false), []);
|
|
3675
|
+
const toggle = React34.useCallback(() => setIsOpen((prev) => !prev), []);
|
|
3581
3676
|
return { isOpen, open, close, toggle, setIsOpen };
|
|
3582
3677
|
}
|
|
3583
3678
|
function CommandMenu({
|
|
@@ -3590,7 +3685,7 @@ function CommandMenu({
|
|
|
3590
3685
|
}) {
|
|
3591
3686
|
const internal = useControlledOpen(false);
|
|
3592
3687
|
const isOpen = openProp ?? internal.isOpen;
|
|
3593
|
-
const setOpen =
|
|
3688
|
+
const setOpen = React34.useCallback(
|
|
3594
3689
|
(next) => {
|
|
3595
3690
|
if (openProp === void 0) internal.setIsOpen(next);
|
|
3596
3691
|
onOpenChange?.(next);
|
|
@@ -3615,7 +3710,7 @@ function CommandMenu({
|
|
|
3615
3710
|
/* @__PURE__ */ jsx(CommandInput, { placeholder }),
|
|
3616
3711
|
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
3617
3712
|
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }),
|
|
3618
|
-
groups.map((group, i) => /* @__PURE__ */ jsxs(
|
|
3713
|
+
groups.map((group, i) => /* @__PURE__ */ jsxs(React34.Fragment, { children: [
|
|
3619
3714
|
i > 0 && /* @__PURE__ */ jsx(CommandSeparator, {}),
|
|
3620
3715
|
/* @__PURE__ */ jsx(CommandGroup, { heading: group.heading, children: group.items.map((item) => /* @__PURE__ */ jsxs(
|
|
3621
3716
|
CommandItem,
|
|
@@ -3807,20 +3902,20 @@ function FileUpload({
|
|
|
3807
3902
|
hint,
|
|
3808
3903
|
className
|
|
3809
3904
|
}) {
|
|
3810
|
-
const [internalFiles, setInternalFiles] =
|
|
3811
|
-
const [isDragging, setIsDragging] =
|
|
3812
|
-
const [validationError, setValidationError] =
|
|
3813
|
-
const inputRef =
|
|
3814
|
-
const dragDepth =
|
|
3905
|
+
const [internalFiles, setInternalFiles] = React34.useState(defaultFiles ?? []);
|
|
3906
|
+
const [isDragging, setIsDragging] = React34.useState(false);
|
|
3907
|
+
const [validationError, setValidationError] = React34.useState(null);
|
|
3908
|
+
const inputRef = React34.useRef(null);
|
|
3909
|
+
const dragDepth = React34.useRef(0);
|
|
3815
3910
|
const files = filesProp ?? internalFiles;
|
|
3816
|
-
const setFiles =
|
|
3911
|
+
const setFiles = React34.useCallback(
|
|
3817
3912
|
(next) => {
|
|
3818
3913
|
if (!filesProp) setInternalFiles(next);
|
|
3819
3914
|
onFilesChange?.(next);
|
|
3820
3915
|
},
|
|
3821
3916
|
[filesProp, onFilesChange]
|
|
3822
3917
|
);
|
|
3823
|
-
const acceptList =
|
|
3918
|
+
const acceptList = React34.useMemo(
|
|
3824
3919
|
() => accept?.split(",").map((a) => a.trim().toLowerCase()).filter(Boolean) ?? [],
|
|
3825
3920
|
[accept]
|
|
3826
3921
|
);
|
|
@@ -4487,7 +4582,7 @@ function PageHeader({
|
|
|
4487
4582
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1 pb-6", className), children: [
|
|
4488
4583
|
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "mb-2 flex items-center gap-1 text-sm text-muted-foreground", children: breadcrumbs.map((crumb, i) => {
|
|
4489
4584
|
const isLast = i === breadcrumbs.length - 1;
|
|
4490
|
-
return /* @__PURE__ */ jsxs(
|
|
4585
|
+
return /* @__PURE__ */ jsxs(React34.Fragment, { children: [
|
|
4491
4586
|
i > 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0" }),
|
|
4492
4587
|
isLast || !crumb.href ? /* @__PURE__ */ jsx("span", { className: cn(isLast && "text-foreground font-medium"), children: crumb.label }) : renderLink({
|
|
4493
4588
|
href: crumb.href,
|
|
@@ -4523,7 +4618,7 @@ function PageHeader({
|
|
|
4523
4618
|
] });
|
|
4524
4619
|
}
|
|
4525
4620
|
function Suspensed({ children, fallback }) {
|
|
4526
|
-
return /* @__PURE__ */ jsx(
|
|
4621
|
+
return /* @__PURE__ */ jsx(React34.Suspense, { fallback: fallback ?? /* @__PURE__ */ jsx(Spinner, {}), children });
|
|
4527
4622
|
}
|
|
4528
4623
|
function getInitialTheme() {
|
|
4529
4624
|
if (typeof document === "undefined") return "dark";
|
|
@@ -4531,7 +4626,7 @@ function getInitialTheme() {
|
|
|
4531
4626
|
return stored ?? (document.documentElement.classList.contains("dark") ? "dark" : "light");
|
|
4532
4627
|
}
|
|
4533
4628
|
function ThemeSwitchMinimal() {
|
|
4534
|
-
const [theme, setThemeState] =
|
|
4629
|
+
const [theme, setThemeState] = React34.useState(getInitialTheme);
|
|
4535
4630
|
const toggle = () => {
|
|
4536
4631
|
const next = theme === "dark" ? "light" : "dark";
|
|
4537
4632
|
setThemeState(next);
|
|
@@ -4657,9 +4752,9 @@ function getInitialColorName() {
|
|
|
4657
4752
|
return localStorage.getItem(STORAGE_KEY) ?? "emerald";
|
|
4658
4753
|
}
|
|
4659
4754
|
function BrandColorSwitchMinimal() {
|
|
4660
|
-
const [active, setActive] =
|
|
4661
|
-
const [open, setOpen] =
|
|
4662
|
-
|
|
4755
|
+
const [active, setActive] = React34.useState(getInitialColorName);
|
|
4756
|
+
const [open, setOpen] = React34.useState(false);
|
|
4757
|
+
React34.useEffect(() => {
|
|
4663
4758
|
const saved = localStorage.getItem(STORAGE_KEY) ?? "emerald";
|
|
4664
4759
|
const color = BRAND_COLORS.find((c) => c.name === saved);
|
|
4665
4760
|
if (color) applyColor(color);
|
|
@@ -4720,7 +4815,7 @@ function BrandColorSwitchMinimal() {
|
|
|
4720
4815
|
] });
|
|
4721
4816
|
}
|
|
4722
4817
|
function ThemeColorUpdater({ colorTheme }) {
|
|
4723
|
-
|
|
4818
|
+
React34.useEffect(() => {
|
|
4724
4819
|
if (colorTheme) {
|
|
4725
4820
|
document.documentElement.setAttribute("data-theme", colorTheme);
|
|
4726
4821
|
} else {
|
|
@@ -4730,7 +4825,7 @@ function ThemeColorUpdater({ colorTheme }) {
|
|
|
4730
4825
|
return null;
|
|
4731
4826
|
}
|
|
4732
4827
|
function VersionBanner({ version, message, className, onDismiss }) {
|
|
4733
|
-
const [dismissed, setDismissed] =
|
|
4828
|
+
const [dismissed, setDismissed] = React34.useState(false);
|
|
4734
4829
|
if (dismissed) return null;
|
|
4735
4830
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between gap-4 bg-primary/10 px-4 py-2 text-sm", className), children: [
|
|
4736
4831
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -4987,29 +5082,29 @@ function useMounted() {
|
|
|
4987
5082
|
return mounted;
|
|
4988
5083
|
}
|
|
4989
5084
|
function useConfirm() {
|
|
4990
|
-
const [isOpen, setIsOpen] =
|
|
4991
|
-
const [options, setOptions] =
|
|
4992
|
-
const resolveRef =
|
|
4993
|
-
const confirm =
|
|
5085
|
+
const [isOpen, setIsOpen] = React34.useState(false);
|
|
5086
|
+
const [options, setOptions] = React34.useState({});
|
|
5087
|
+
const resolveRef = React34.useRef(null);
|
|
5088
|
+
const confirm = React34.useCallback((opts = {}) => {
|
|
4994
5089
|
setOptions(opts);
|
|
4995
5090
|
setIsOpen(true);
|
|
4996
5091
|
return new Promise((resolve) => {
|
|
4997
5092
|
resolveRef.current = resolve;
|
|
4998
5093
|
});
|
|
4999
5094
|
}, []);
|
|
5000
|
-
const handleConfirm =
|
|
5095
|
+
const handleConfirm = React34.useCallback(() => {
|
|
5001
5096
|
resolveRef.current?.(true);
|
|
5002
5097
|
setIsOpen(false);
|
|
5003
5098
|
}, []);
|
|
5004
|
-
const handleCancel =
|
|
5099
|
+
const handleCancel = React34.useCallback(() => {
|
|
5005
5100
|
resolveRef.current?.(false);
|
|
5006
5101
|
setIsOpen(false);
|
|
5007
5102
|
}, []);
|
|
5008
5103
|
return { confirm, isOpen, options, handleConfirm, handleCancel };
|
|
5009
5104
|
}
|
|
5010
5105
|
function useScrolledPast(threshold) {
|
|
5011
|
-
const [scrolledPast, setScrolledPast] =
|
|
5012
|
-
|
|
5106
|
+
const [scrolledPast, setScrolledPast] = React34.useState(false);
|
|
5107
|
+
React34.useEffect(() => {
|
|
5013
5108
|
const handleScroll = () => {
|
|
5014
5109
|
setScrolledPast(window.scrollY > threshold);
|
|
5015
5110
|
};
|
|
@@ -5020,28 +5115,28 @@ function useScrolledPast(threshold) {
|
|
|
5020
5115
|
return scrolledPast;
|
|
5021
5116
|
}
|
|
5022
5117
|
function useCopyToClipboard() {
|
|
5023
|
-
const [copied, setCopied] =
|
|
5024
|
-
const timeoutRef =
|
|
5025
|
-
const copy =
|
|
5118
|
+
const [copied, setCopied] = React34.useState(false);
|
|
5119
|
+
const timeoutRef = React34.useRef(void 0);
|
|
5120
|
+
const copy = React34.useCallback((text) => {
|
|
5026
5121
|
navigator.clipboard.writeText(text).then(() => {
|
|
5027
5122
|
setCopied(true);
|
|
5028
5123
|
clearTimeout(timeoutRef.current);
|
|
5029
5124
|
timeoutRef.current = setTimeout(() => setCopied(false), 2e3);
|
|
5030
5125
|
});
|
|
5031
5126
|
}, []);
|
|
5032
|
-
|
|
5127
|
+
React34.useEffect(() => () => clearTimeout(timeoutRef.current), []);
|
|
5033
5128
|
return [copied, copy];
|
|
5034
5129
|
}
|
|
5035
5130
|
function useDebounce(value, delay) {
|
|
5036
|
-
const [debounced, setDebounced] =
|
|
5037
|
-
|
|
5131
|
+
const [debounced, setDebounced] = React34.useState(value);
|
|
5132
|
+
React34.useEffect(() => {
|
|
5038
5133
|
const timer = setTimeout(() => setDebounced(value), delay);
|
|
5039
5134
|
return () => clearTimeout(timer);
|
|
5040
5135
|
}, [value, delay]);
|
|
5041
5136
|
return debounced;
|
|
5042
5137
|
}
|
|
5043
5138
|
function useLocalStorage(key, initialValue) {
|
|
5044
|
-
const [storedValue, setStoredValue] =
|
|
5139
|
+
const [storedValue, setStoredValue] = React34.useState(() => {
|
|
5045
5140
|
if (typeof window === "undefined") return initialValue;
|
|
5046
5141
|
try {
|
|
5047
5142
|
const item = window.localStorage.getItem(key);
|
|
@@ -5050,7 +5145,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
5050
5145
|
return initialValue;
|
|
5051
5146
|
}
|
|
5052
5147
|
});
|
|
5053
|
-
const setValue =
|
|
5148
|
+
const setValue = React34.useCallback(
|
|
5054
5149
|
(value) => {
|
|
5055
5150
|
try {
|
|
5056
5151
|
setStoredValue(value);
|
|
@@ -5065,11 +5160,11 @@ function useLocalStorage(key, initialValue) {
|
|
|
5065
5160
|
return [storedValue, setValue];
|
|
5066
5161
|
}
|
|
5067
5162
|
function useMediaQuery(query) {
|
|
5068
|
-
const [matches, setMatches] =
|
|
5163
|
+
const [matches, setMatches] = React34.useState(() => {
|
|
5069
5164
|
if (typeof window === "undefined") return false;
|
|
5070
5165
|
return window.matchMedia(query).matches;
|
|
5071
5166
|
});
|
|
5072
|
-
|
|
5167
|
+
React34.useEffect(() => {
|
|
5073
5168
|
if (typeof window === "undefined") return;
|
|
5074
5169
|
const mql = window.matchMedia(query);
|
|
5075
5170
|
setMatches(mql.matches);
|
|
@@ -5080,18 +5175,18 @@ function useMediaQuery(query) {
|
|
|
5080
5175
|
return matches;
|
|
5081
5176
|
}
|
|
5082
5177
|
function usePagination(total, pageSize) {
|
|
5083
|
-
const [page, setPage] =
|
|
5178
|
+
const [page, setPage] = React34.useState(1);
|
|
5084
5179
|
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
5085
5180
|
const offset = (page - 1) * pageSize;
|
|
5086
|
-
const goTo =
|
|
5181
|
+
const goTo = React34.useCallback(
|
|
5087
5182
|
(p) => setPage(Math.min(Math.max(1, p), totalPages)),
|
|
5088
5183
|
[totalPages]
|
|
5089
5184
|
);
|
|
5090
|
-
const next =
|
|
5091
|
-
const prev =
|
|
5185
|
+
const next = React34.useCallback(() => goTo(page + 1), [page, goTo]);
|
|
5186
|
+
const prev = React34.useCallback(() => goTo(page - 1), [page, goTo]);
|
|
5092
5187
|
return { page, pageSize, totalPages, offset, hasPrev: page > 1, hasNext: page < totalPages, goTo, next, prev };
|
|
5093
5188
|
}
|
|
5094
5189
|
|
|
5095
|
-
export { ActivityFeed, AnimatedPill, AppContent, AppGrid, AppGridCell, AppScreen, AppShell, AuthSection, Badge, BillingPanel, BrandColorSwitchMinimal, Button, Card, Carousel, ChangelogCard, ChangelogList, Chart, Checkbox, CommandMenu, ComparisonSection, ConfirmDialog, ContactSection, ContextMenu, CountUp, CountdownTimer, CtaSection, DataTable, DevBanner, Dock, EmptyState, ErrorPage, FadeIn, FaqSection, FeatureCard, FeatureMarqueeSection, FeaturesSection, FileUpload, FlowBracket, FlowConnector, Footer, FullPageSpinner, GlassCard, Grid, GridItem, GroupedFeaturesSection, HeroSection, ImageCard, Input, LogoStrip, ModeSwitchMinimal, Navbar, NewsletterSection, NotificationToast, NotificationsPopover, OlwibaUIProvider, OnboardingWizard, Overlay, PageHeader, PageTransition, PhoneFrame, PostCard, PostList, PricingCard, PricingSection, PublicPageFrame, QualificationSection, RegisterHotkeys, RootErrorFallback, Section, SectionTitle, SettingsSection, Sortable, Spotlight, Stack, StaggerChildren, StatCard, StatsSection, StepsSection, Suspensed, Switch, TeamMembersPanel, TeamSection, TechStackSection, TestimonialCard, TestimonialsSection, Textarea, ThemeColorUpdater, ThemeSwitchMinimal, Underlay, UpgradePrompt, VersionBanner, marketingSectionSpacing, notify, useConfirm, useControlledOpen, useCopyToClipboard, useDebounce, useIntersectionObserver, useLocalStorage, useMediaQuery, useMounted, useOlwibaUI, usePagination, useScrolledPast, useUIMode };
|
|
5190
|
+
export { ActivityFeed, AnimatedPill, AppContent, AppGrid, AppGridCell, AppScreen, AppShell, AuthSection, Badge, BillingPanel, BrandColorSwitchMinimal, Button, Card, Carousel, ChangelogCard, ChangelogList, Chart, Checkbox, CommandMenu, ComparisonSection, ConfirmDialog, ContactSection, ContextMenu, CountUp, CountdownTimer, CtaSection, DataTable, DevBanner, Dock, EmptyState, ErrorPage, FadeIn, FaqSection, FeatureCard, FeatureMarqueeSection, FeaturesSection, FileUpload, FlowBracket, FlowConnector, Footer, FullPageSpinner, GlassCard, Grid, GridItem, GroupedFeaturesSection, HeroSection, ImageCard, Input, LogoStrip, ModeSwitchMinimal, Navbar, NewsletterSection, NotificationToast, NotificationsPopover, OlwibaUIProvider, OnboardingWizard, Overlay, PageHeader, PageTransition, PhoneFrame, PostCard, PostList, PricingCard, PricingSection, PublicPageFrame, QualificationSection, RegisterHotkeys, RootErrorFallback, Section, SectionTitle, SettingsSection, Sortable, Spotlight, Stack, StaggerChildren, StatCard, StatsSection, StepsSection, Suspensed, Switch, TeamMembersPanel, TeamSection, TechStackSection, TestimonialCard, TestimonialsSection, Textarea, ThemeColorUpdater, ThemeSwitchMinimal, Underlay, UpdateBanner, UpgradePrompt, VersionBanner, marketingSectionSpacing, notify, useConfirm, useControlledOpen, useCopyToClipboard, useDebounce, useIntersectionObserver, useLocalStorage, useMediaQuery, useMounted, useOlwibaUI, usePagination, useScrolledPast, useUIMode };
|
|
5096
5191
|
//# sourceMappingURL=index.js.map
|
|
5097
5192
|
//# sourceMappingURL=index.js.map
|