@ekkolyth/ui 0.0.2 → 0.1.1
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 +4 -23
- package/dist/index.js +61 -102
- package/dist/next.d.ts +3 -0
- package/dist/next.js +45 -0
- package/dist/providers/next-theme-provider.d.ts +7 -0
- package/dist/providers/next-theme-provider.js +45 -0
- package/dist/providers/tanstack-theme-provider.d.ts +18 -0
- package/dist/providers/tanstack-theme-provider.js +79 -0
- package/dist/tanstack.d.ts +2 -0
- package/dist/tanstack.js +80 -0
- package/package.json +9 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ThemeProviderProps } from 'next-themes';
|
|
3
|
-
export { ThemeProviderProps as NextThemeProviderProps, useTheme as useNextTheme } from 'next-themes';
|
|
4
2
|
import * as React$1 from 'react';
|
|
5
3
|
import { Accordion as Accordion$1, AlertDialog as AlertDialog$1, AspectRatio as AspectRatio$1, Avatar as Avatar$1, Separator as Separator$1, Checkbox as Checkbox$1, Collapsible as Collapsible$1, Dialog as Dialog$1, ContextMenu as ContextMenu$1, DropdownMenu as DropdownMenu$1, Label as Label$1, HoverCard as HoverCard$1, Menubar as Menubar$1, NavigationMenu as NavigationMenu$1, Popover as Popover$1, Progress as Progress$1, RadioGroup as RadioGroup$1, ScrollArea as ScrollArea$1, Select as Select$1, Tooltip as Tooltip$1, Slider as Slider$1, Switch as Switch$1, Tabs as Tabs$1, Toggle as Toggle$1, ToggleGroup as ToggleGroup$1 } from 'radix-ui';
|
|
6
4
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
@@ -16,23 +14,6 @@ import * as ResizablePrimitive from 'react-resizable-panels';
|
|
|
16
14
|
import { ToasterProps } from 'sonner';
|
|
17
15
|
import { ClassValue } from 'clsx';
|
|
18
16
|
|
|
19
|
-
declare function NextThemeProvider({ children, ...props }: React.PropsWithChildren<ThemeProviderProps>): react_jsx_runtime.JSX.Element;
|
|
20
|
-
|
|
21
|
-
type ResolvedTheme = "dark" | "light";
|
|
22
|
-
type Theme = ResolvedTheme | "system";
|
|
23
|
-
interface TanstackThemeProviderProps {
|
|
24
|
-
children: React.ReactNode;
|
|
25
|
-
defaultTheme?: Theme;
|
|
26
|
-
storageKey?: string;
|
|
27
|
-
}
|
|
28
|
-
interface TanstackThemeProviderState {
|
|
29
|
-
theme: Theme;
|
|
30
|
-
resolvedTheme: ResolvedTheme;
|
|
31
|
-
setTheme: (theme: Theme) => void;
|
|
32
|
-
}
|
|
33
|
-
declare function TanstackThemeProvider({ children, defaultTheme, storageKey, }: TanstackThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
34
|
-
declare function useTanstackTheme(): TanstackThemeProviderState;
|
|
35
|
-
|
|
36
17
|
declare function Accordion({ className, ...props }: React$1.ComponentProps<typeof Accordion$1.Root>): react_jsx_runtime.JSX.Element;
|
|
37
18
|
declare function AccordionItem({ className, ...props }: React$1.ComponentProps<typeof Accordion$1.Item>): react_jsx_runtime.JSX.Element;
|
|
38
19
|
declare function AccordionTrigger({ className, children, ...props }: React$1.ComponentProps<typeof Accordion$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
@@ -375,7 +356,7 @@ declare function Item({ className, variant, size, asChild, ...props }: React$1.C
|
|
|
375
356
|
asChild?: boolean;
|
|
376
357
|
}): react_jsx_runtime.JSX.Element;
|
|
377
358
|
declare const itemMediaVariants: (props?: ({
|
|
378
|
-
variant?: "
|
|
359
|
+
variant?: "image" | "default" | "icon" | null | undefined;
|
|
379
360
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
380
361
|
declare function ItemMedia({ className, variant, ...props }: React$1.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>): react_jsx_runtime.JSX.Element;
|
|
381
362
|
declare function ItemContent({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
@@ -465,7 +446,7 @@ declare function SelectValue({ ...props }: React$1.ComponentProps<typeof Select$
|
|
|
465
446
|
declare function SelectTrigger({ className, size, children, ...props }: React$1.ComponentProps<typeof Select$1.Trigger> & {
|
|
466
447
|
size?: "sm" | "default";
|
|
467
448
|
}): react_jsx_runtime.JSX.Element;
|
|
468
|
-
declare function SelectContent({ className, children, position, align, ...props }: React$1.ComponentProps<typeof Select$1.Content>): react_jsx_runtime.JSX.Element;
|
|
449
|
+
declare function SelectContent({ className, children, position, align, side, sideOffset, ...props }: React$1.ComponentProps<typeof Select$1.Content>): react_jsx_runtime.JSX.Element;
|
|
469
450
|
declare function SelectLabel({ className, ...props }: React$1.ComponentProps<typeof Select$1.Label>): react_jsx_runtime.JSX.Element;
|
|
470
451
|
declare function SelectItem({ className, children, ...props }: React$1.ComponentProps<typeof Select$1.Item>): react_jsx_runtime.JSX.Element;
|
|
471
452
|
declare function SelectSeparator({ className, ...props }: React$1.ComponentProps<typeof Select$1.Separator>): react_jsx_runtime.JSX.Element;
|
|
@@ -575,7 +556,7 @@ declare function TableCaption({ className, ...props }: React$1.ComponentProps<"c
|
|
|
575
556
|
|
|
576
557
|
declare function Tabs({ className, orientation, ...props }: React$1.ComponentProps<typeof Tabs$1.Root>): react_jsx_runtime.JSX.Element;
|
|
577
558
|
declare const tabsListVariants: (props?: ({
|
|
578
|
-
variant?: "
|
|
559
|
+
variant?: "line" | "default" | null | undefined;
|
|
579
560
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
580
561
|
declare function TabsList({ className, variant, ...props }: React$1.ComponentProps<typeof Tabs$1.List> & VariantProps<typeof tabsListVariants>): react_jsx_runtime.JSX.Element;
|
|
581
562
|
declare function TabsTrigger({ className, ...props }: React$1.ComponentProps<typeof Tabs$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
@@ -599,4 +580,4 @@ declare function useIsMobile(): boolean;
|
|
|
599
580
|
|
|
600
581
|
declare function cn(...inputs: ClassValue[]): string;
|
|
601
582
|
|
|
602
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport,
|
|
583
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, navigationMenuTriggerStyle, tabsListVariants, toggleVariants, useCarousel, useComboboxAnchor, useIsMobile, useSidebar };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { ThemeProvider, useTheme } from 'next-themes';
|
|
2
|
-
export { useTheme as useNextTheme } from 'next-themes';
|
|
3
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import * as React2 from 'react';
|
|
5
|
-
import { createContext, useState, useEffect, useMemo, use } from 'react';
|
|
6
|
-
import { ScriptOnce } from '@tanstack/react-router';
|
|
7
1
|
import { Accordion as Accordion$1, Slot, AlertDialog as AlertDialog$1, AspectRatio as AspectRatio$1, Avatar as Avatar$1, Separator as Separator$1, Checkbox as Checkbox$1, Collapsible as Collapsible$1, Dialog as Dialog$1, ContextMenu as ContextMenu$1, DropdownMenu as DropdownMenu$1, Label as Label$1, HoverCard as HoverCard$1, Menubar as Menubar$1, NavigationMenu as NavigationMenu$1, Popover as Popover$1, Progress as Progress$1, RadioGroup as RadioGroup$1, ScrollArea as ScrollArea$1, Select as Select$1, Tooltip, Slider as Slider$1, Switch as Switch$1, Tabs as Tabs$1, Toggle as Toggle$1, ToggleGroup as ToggleGroup$1 } from 'radix-ui';
|
|
8
2
|
import { clsx } from 'clsx';
|
|
9
3
|
import { twMerge } from 'tailwind-merge';
|
|
10
4
|
import { ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon, CheckIcon, XIcon, SearchIcon, CircleIcon, Loader2Icon, ChevronUpIcon, MoreHorizontalIcon, MinusIcon, PanelLeftIcon, OctagonXIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon } from 'lucide-react';
|
|
5
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
6
|
import { cva } from 'class-variance-authority';
|
|
7
|
+
import * as React2 from 'react';
|
|
8
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
12
9
|
import { getDefaultClassNames, DayPicker } from 'react-day-picker';
|
|
13
10
|
import useEmblaCarousel from 'embla-carousel-react';
|
|
14
11
|
import * as RechartsPrimitive from 'recharts';
|
|
@@ -50,87 +47,6 @@ var __objRest = (source, exclude) => {
|
|
|
50
47
|
}
|
|
51
48
|
return target;
|
|
52
49
|
};
|
|
53
|
-
function NextThemeProvider(_a) {
|
|
54
|
-
var _b = _a, {
|
|
55
|
-
children
|
|
56
|
-
} = _b, props = __objRest(_b, [
|
|
57
|
-
"children"
|
|
58
|
-
]);
|
|
59
|
-
return /* @__PURE__ */ jsx(ThemeProvider, __spreadProps(__spreadValues({}, props), { children }));
|
|
60
|
-
}
|
|
61
|
-
var initialState = {
|
|
62
|
-
theme: "system",
|
|
63
|
-
resolvedTheme: "light",
|
|
64
|
-
setTheme: () => null
|
|
65
|
-
};
|
|
66
|
-
var TanstackThemeProviderContext = createContext(initialState);
|
|
67
|
-
function FunctionOnce({
|
|
68
|
-
children,
|
|
69
|
-
param
|
|
70
|
-
}) {
|
|
71
|
-
return /* @__PURE__ */ jsx(ScriptOnce, { children: `(${children.toString()})(${JSON.stringify(param)})` });
|
|
72
|
-
}
|
|
73
|
-
function TanstackThemeProvider({
|
|
74
|
-
children,
|
|
75
|
-
defaultTheme = "system",
|
|
76
|
-
storageKey = "ekko-ui.theme"
|
|
77
|
-
}) {
|
|
78
|
-
const [theme, setThemeState] = useState(defaultTheme);
|
|
79
|
-
const [resolvedTheme, setResolvedTheme] = useState("light");
|
|
80
|
-
const [mounted, setMounted] = useState(false);
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
setMounted(true);
|
|
83
|
-
const stored = localStorage.getItem(storageKey);
|
|
84
|
-
if (stored && (stored === "light" || stored === "dark" || stored === "system")) {
|
|
85
|
-
setThemeState(stored);
|
|
86
|
-
}
|
|
87
|
-
}, [storageKey]);
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
const root = window.document.documentElement;
|
|
90
|
-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
91
|
-
function updateTheme() {
|
|
92
|
-
root.classList.remove("light", "dark");
|
|
93
|
-
if (theme === "system") {
|
|
94
|
-
const systemTheme = mediaQuery.matches ? "dark" : "light";
|
|
95
|
-
setResolvedTheme(systemTheme);
|
|
96
|
-
root.classList.add(systemTheme);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
setResolvedTheme(theme);
|
|
100
|
-
root.classList.add(theme);
|
|
101
|
-
}
|
|
102
|
-
mediaQuery.addEventListener("change", updateTheme);
|
|
103
|
-
updateTheme();
|
|
104
|
-
return () => mediaQuery.removeEventListener("change", updateTheme);
|
|
105
|
-
}, [theme]);
|
|
106
|
-
const value = useMemo(
|
|
107
|
-
() => ({
|
|
108
|
-
theme,
|
|
109
|
-
resolvedTheme,
|
|
110
|
-
setTheme: (newTheme) => {
|
|
111
|
-
localStorage.setItem(storageKey, newTheme);
|
|
112
|
-
setThemeState(newTheme);
|
|
113
|
-
}
|
|
114
|
-
}),
|
|
115
|
-
[theme, resolvedTheme, storageKey]
|
|
116
|
-
);
|
|
117
|
-
return /* @__PURE__ */ jsxs(TanstackThemeProviderContext.Provider, { value, children: [
|
|
118
|
-
/* @__PURE__ */ jsx(FunctionOnce, { param: storageKey, children: (storageKey2) => {
|
|
119
|
-
const theme2 = localStorage.getItem(storageKey2);
|
|
120
|
-
if (theme2 === "dark" || (theme2 === null || theme2 === "system") && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
|
121
|
-
document.documentElement.classList.add("dark");
|
|
122
|
-
}
|
|
123
|
-
} }),
|
|
124
|
-
children
|
|
125
|
-
] });
|
|
126
|
-
}
|
|
127
|
-
function useTanstackTheme() {
|
|
128
|
-
const context = use(TanstackThemeProviderContext);
|
|
129
|
-
if (context === void 0) {
|
|
130
|
-
throw new Error("useTanstackTheme must be used within a TanstackThemeProvider");
|
|
131
|
-
}
|
|
132
|
-
return context;
|
|
133
|
-
}
|
|
134
50
|
function cn(...inputs) {
|
|
135
51
|
return twMerge(clsx(inputs));
|
|
136
52
|
}
|
|
@@ -298,7 +214,7 @@ function AlertAction(_a) {
|
|
|
298
214
|
);
|
|
299
215
|
}
|
|
300
216
|
var buttonVariants = cva(
|
|
301
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] **:[svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 **:[svg]:pointer-events-none shrink-0 **:[svg]:shrink-0 outline-none group/button select-none",
|
|
217
|
+
"cursor-pointer focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] **:[svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 **:[svg]:pointer-events-none shrink-0 **:[svg]:shrink-0 outline-none group/button select-none",
|
|
302
218
|
{
|
|
303
219
|
variants: {
|
|
304
220
|
variant: {
|
|
@@ -4478,7 +4394,7 @@ function SelectTrigger(_a) {
|
|
|
4478
4394
|
"data-slot": "select-trigger",
|
|
4479
4395
|
"data-size": size,
|
|
4480
4396
|
className: cn(
|
|
4481
|
-
"border-input data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-[3px] aria-invalid:ring-[3px] data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 **:[svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center **:[svg]:pointer-events-none **:[svg]:shrink-0",
|
|
4397
|
+
"cursor-pointer border-input data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-[3px] aria-invalid:ring-[3px] data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 **:[svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center **:[svg]:pointer-events-none **:[svg]:shrink-0",
|
|
4482
4398
|
className
|
|
4483
4399
|
)
|
|
4484
4400
|
}, props), {
|
|
@@ -4493,13 +4409,17 @@ function SelectContent(_a) {
|
|
|
4493
4409
|
var _b = _a, {
|
|
4494
4410
|
className,
|
|
4495
4411
|
children,
|
|
4496
|
-
position = "
|
|
4497
|
-
align = "center"
|
|
4412
|
+
position = "popper",
|
|
4413
|
+
align = "center",
|
|
4414
|
+
side = "bottom",
|
|
4415
|
+
sideOffset = 4
|
|
4498
4416
|
} = _b, props = __objRest(_b, [
|
|
4499
4417
|
"className",
|
|
4500
4418
|
"children",
|
|
4501
4419
|
"position",
|
|
4502
|
-
"align"
|
|
4420
|
+
"align",
|
|
4421
|
+
"side",
|
|
4422
|
+
"sideOffset"
|
|
4503
4423
|
]);
|
|
4504
4424
|
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsxs(
|
|
4505
4425
|
Select$1.Content,
|
|
@@ -4511,7 +4431,9 @@ function SelectContent(_a) {
|
|
|
4511
4431
|
className
|
|
4512
4432
|
),
|
|
4513
4433
|
position,
|
|
4514
|
-
align
|
|
4434
|
+
align,
|
|
4435
|
+
side,
|
|
4436
|
+
sideOffset
|
|
4515
4437
|
}, props), {
|
|
4516
4438
|
children: [
|
|
4517
4439
|
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
@@ -4561,7 +4483,7 @@ function SelectItem(_a) {
|
|
|
4561
4483
|
__spreadProps(__spreadValues({
|
|
4562
4484
|
"data-slot": "select-item",
|
|
4563
4485
|
className: cn(
|
|
4564
|
-
"focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm **:[svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full
|
|
4486
|
+
"cursor-pointer focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm **:[svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 **:[svg]:pointer-events-none **:[svg]:shrink-0",
|
|
4565
4487
|
className
|
|
4566
4488
|
)
|
|
4567
4489
|
}, props), {
|
|
@@ -5516,13 +5438,55 @@ function Slider(_a) {
|
|
|
5516
5438
|
})
|
|
5517
5439
|
);
|
|
5518
5440
|
}
|
|
5441
|
+
var DARK_THEMES = /* @__PURE__ */ new Set([
|
|
5442
|
+
"dark",
|
|
5443
|
+
"frappe",
|
|
5444
|
+
"macchiato",
|
|
5445
|
+
"mocha",
|
|
5446
|
+
"tokyo-night"
|
|
5447
|
+
]);
|
|
5448
|
+
var LIGHT_THEMES = /* @__PURE__ */ new Set(["light", "latte"]);
|
|
5449
|
+
var getSonnerTheme = (dataTheme) => {
|
|
5450
|
+
if (!dataTheme) {
|
|
5451
|
+
if (typeof window !== "undefined") {
|
|
5452
|
+
const hasDarkClass = document.documentElement.classList.contains("dark") || document.body.classList.contains("dark");
|
|
5453
|
+
if (hasDarkClass) return "dark";
|
|
5454
|
+
const prefersDark = window.matchMedia(
|
|
5455
|
+
"(prefers-color-scheme: dark)"
|
|
5456
|
+
).matches;
|
|
5457
|
+
return prefersDark ? "dark" : "light";
|
|
5458
|
+
}
|
|
5459
|
+
return "dark";
|
|
5460
|
+
}
|
|
5461
|
+
if (DARK_THEMES.has(dataTheme)) return "dark";
|
|
5462
|
+
if (LIGHT_THEMES.has(dataTheme)) return "light";
|
|
5463
|
+
return "dark";
|
|
5464
|
+
};
|
|
5519
5465
|
var Toaster = (_a) => {
|
|
5520
5466
|
var props = __objRest(_a, []);
|
|
5521
|
-
const
|
|
5467
|
+
const [sonnerTheme, setSonnerTheme] = useState(
|
|
5468
|
+
"dark"
|
|
5469
|
+
);
|
|
5470
|
+
useEffect(() => {
|
|
5471
|
+
if (typeof window === "undefined") return;
|
|
5472
|
+
const detectTheme = () => {
|
|
5473
|
+
const dataTheme = document.documentElement.getAttribute("data-theme");
|
|
5474
|
+
return getSonnerTheme(dataTheme);
|
|
5475
|
+
};
|
|
5476
|
+
setSonnerTheme(detectTheme());
|
|
5477
|
+
const observer = new MutationObserver(() => {
|
|
5478
|
+
setSonnerTheme(detectTheme());
|
|
5479
|
+
});
|
|
5480
|
+
observer.observe(document.documentElement, {
|
|
5481
|
+
attributes: true,
|
|
5482
|
+
attributeFilter: ["data-theme", "class"]
|
|
5483
|
+
});
|
|
5484
|
+
return () => observer.disconnect();
|
|
5485
|
+
}, []);
|
|
5522
5486
|
return /* @__PURE__ */ jsx(
|
|
5523
5487
|
Toaster$1,
|
|
5524
5488
|
__spreadValues({
|
|
5525
|
-
theme,
|
|
5489
|
+
theme: sonnerTheme,
|
|
5526
5490
|
className: "toaster group",
|
|
5527
5491
|
icons: {
|
|
5528
5492
|
success: /* @__PURE__ */ jsx(CircleCheckIcon, { className: "size-4" }),
|
|
@@ -5536,11 +5500,6 @@ var Toaster = (_a) => {
|
|
|
5536
5500
|
"--normal-text": "var(--popover-foreground)",
|
|
5537
5501
|
"--normal-border": "var(--border)",
|
|
5538
5502
|
"--border-radius": "var(--radius)"
|
|
5539
|
-
},
|
|
5540
|
-
toastOptions: {
|
|
5541
|
-
classNames: {
|
|
5542
|
-
toast: "cn-toast"
|
|
5543
|
-
}
|
|
5544
5503
|
}
|
|
5545
5504
|
}, props)
|
|
5546
5505
|
);
|
|
@@ -5890,4 +5849,4 @@ function ToggleGroupItem(_a) {
|
|
|
5890
5849
|
);
|
|
5891
5850
|
}
|
|
5892
5851
|
|
|
5893
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport,
|
|
5852
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip2 as Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonGroupVariants, buttonVariants, cn, navigationMenuTriggerStyle, tabsListVariants, toggleVariants, useCarousel, useComboboxAnchor, useIsMobile, useSidebar };
|
package/dist/next.d.ts
ADDED
package/dist/next.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ThemeProvider } from 'next-themes';
|
|
2
|
+
export { useTheme } from 'next-themes';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defProps = Object.defineProperties;
|
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
function NextThemeProvider(_a) {
|
|
37
|
+
var _b = _a, {
|
|
38
|
+
children
|
|
39
|
+
} = _b, props = __objRest(_b, [
|
|
40
|
+
"children"
|
|
41
|
+
]);
|
|
42
|
+
return /* @__PURE__ */ jsx(ThemeProvider, __spreadProps(__spreadValues({}, props), { children }));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { NextThemeProvider as ThemeProvider };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ThemeProviderProps } from 'next-themes';
|
|
3
|
+
export { ThemeProviderProps as NextThemeProviderProps, useTheme as useNextTheme } from 'next-themes';
|
|
4
|
+
|
|
5
|
+
declare function NextThemeProvider({ children, ...props }: React.PropsWithChildren<ThemeProviderProps>): react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export { NextThemeProvider };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ThemeProvider } from 'next-themes';
|
|
2
|
+
export { useTheme as useNextTheme } from 'next-themes';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __defProps = Object.defineProperties;
|
|
7
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
function NextThemeProvider(_a) {
|
|
37
|
+
var _b = _a, {
|
|
38
|
+
children
|
|
39
|
+
} = _b, props = __objRest(_b, [
|
|
40
|
+
"children"
|
|
41
|
+
]);
|
|
42
|
+
return /* @__PURE__ */ jsx(ThemeProvider, __spreadProps(__spreadValues({}, props), { children }));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { NextThemeProvider };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type ResolvedTheme = "dark" | "light";
|
|
4
|
+
type Theme = ResolvedTheme | "system";
|
|
5
|
+
interface TanstackThemeProviderProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
defaultTheme?: Theme;
|
|
8
|
+
storageKey?: string;
|
|
9
|
+
}
|
|
10
|
+
interface TanstackThemeProviderState {
|
|
11
|
+
theme: Theme;
|
|
12
|
+
resolvedTheme: ResolvedTheme;
|
|
13
|
+
setTheme: (theme: Theme) => void;
|
|
14
|
+
}
|
|
15
|
+
declare function TanstackThemeProvider({ children, defaultTheme, storageKey, }: TanstackThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
16
|
+
declare function useTanstackTheme(): TanstackThemeProviderState;
|
|
17
|
+
|
|
18
|
+
export { type ResolvedTheme, TanstackThemeProvider, type Theme, useTanstackTheme };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createContext, useState, useEffect, useMemo, use } from 'react';
|
|
2
|
+
import { ScriptOnce } from '@tanstack/react-router';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var initialState = {
|
|
6
|
+
theme: "system",
|
|
7
|
+
resolvedTheme: "light",
|
|
8
|
+
setTheme: () => null
|
|
9
|
+
};
|
|
10
|
+
var TanstackThemeProviderContext = createContext(initialState);
|
|
11
|
+
function FunctionOnce({
|
|
12
|
+
children,
|
|
13
|
+
param
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsx(ScriptOnce, { children: `(${children.toString()})(${JSON.stringify(param)})` });
|
|
16
|
+
}
|
|
17
|
+
function TanstackThemeProvider({
|
|
18
|
+
children,
|
|
19
|
+
defaultTheme = "system",
|
|
20
|
+
storageKey = "ekko-ui.theme"
|
|
21
|
+
}) {
|
|
22
|
+
const [theme, setThemeState] = useState(defaultTheme);
|
|
23
|
+
const [resolvedTheme, setResolvedTheme] = useState("light");
|
|
24
|
+
const [mounted, setMounted] = useState(false);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setMounted(true);
|
|
27
|
+
const stored = localStorage.getItem(storageKey);
|
|
28
|
+
if (stored && (stored === "light" || stored === "dark" || stored === "system")) {
|
|
29
|
+
setThemeState(stored);
|
|
30
|
+
}
|
|
31
|
+
}, [storageKey]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const root = window.document.documentElement;
|
|
34
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
35
|
+
function updateTheme() {
|
|
36
|
+
root.classList.remove("light", "dark");
|
|
37
|
+
if (theme === "system") {
|
|
38
|
+
const systemTheme = mediaQuery.matches ? "dark" : "light";
|
|
39
|
+
setResolvedTheme(systemTheme);
|
|
40
|
+
root.classList.add(systemTheme);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
setResolvedTheme(theme);
|
|
44
|
+
root.classList.add(theme);
|
|
45
|
+
}
|
|
46
|
+
mediaQuery.addEventListener("change", updateTheme);
|
|
47
|
+
updateTheme();
|
|
48
|
+
return () => mediaQuery.removeEventListener("change", updateTheme);
|
|
49
|
+
}, [theme]);
|
|
50
|
+
const value = useMemo(
|
|
51
|
+
() => ({
|
|
52
|
+
theme,
|
|
53
|
+
resolvedTheme,
|
|
54
|
+
setTheme: (newTheme) => {
|
|
55
|
+
localStorage.setItem(storageKey, newTheme);
|
|
56
|
+
setThemeState(newTheme);
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
[theme, resolvedTheme, storageKey]
|
|
60
|
+
);
|
|
61
|
+
return /* @__PURE__ */ jsxs(TanstackThemeProviderContext.Provider, { value, children: [
|
|
62
|
+
/* @__PURE__ */ jsx(FunctionOnce, { param: storageKey, children: (storageKey2) => {
|
|
63
|
+
const theme2 = localStorage.getItem(storageKey2);
|
|
64
|
+
if (theme2 === "dark" || (theme2 === null || theme2 === "system") && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
|
65
|
+
document.documentElement.classList.add("dark");
|
|
66
|
+
}
|
|
67
|
+
} }),
|
|
68
|
+
children
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
function useTanstackTheme() {
|
|
72
|
+
const context = use(TanstackThemeProviderContext);
|
|
73
|
+
if (context === void 0) {
|
|
74
|
+
throw new Error("useTanstackTheme must be used within a TanstackThemeProvider");
|
|
75
|
+
}
|
|
76
|
+
return context;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { TanstackThemeProvider, useTanstackTheme };
|
package/dist/tanstack.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createContext, useState, useEffect, useMemo, use } from 'react';
|
|
2
|
+
import { ScriptOnce } from '@tanstack/react-router';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/components/theme/providers/tanstack-theme-provider.tsx
|
|
6
|
+
var initialState = {
|
|
7
|
+
theme: "system",
|
|
8
|
+
resolvedTheme: "light",
|
|
9
|
+
setTheme: () => null
|
|
10
|
+
};
|
|
11
|
+
var TanstackThemeProviderContext = createContext(initialState);
|
|
12
|
+
function FunctionOnce({
|
|
13
|
+
children,
|
|
14
|
+
param
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ jsx(ScriptOnce, { children: `(${children.toString()})(${JSON.stringify(param)})` });
|
|
17
|
+
}
|
|
18
|
+
function TanstackThemeProvider({
|
|
19
|
+
children,
|
|
20
|
+
defaultTheme = "system",
|
|
21
|
+
storageKey = "ekko-ui.theme"
|
|
22
|
+
}) {
|
|
23
|
+
const [theme, setThemeState] = useState(defaultTheme);
|
|
24
|
+
const [resolvedTheme, setResolvedTheme] = useState("light");
|
|
25
|
+
const [mounted, setMounted] = useState(false);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setMounted(true);
|
|
28
|
+
const stored = localStorage.getItem(storageKey);
|
|
29
|
+
if (stored && (stored === "light" || stored === "dark" || stored === "system")) {
|
|
30
|
+
setThemeState(stored);
|
|
31
|
+
}
|
|
32
|
+
}, [storageKey]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const root = window.document.documentElement;
|
|
35
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
36
|
+
function updateTheme() {
|
|
37
|
+
root.classList.remove("light", "dark");
|
|
38
|
+
if (theme === "system") {
|
|
39
|
+
const systemTheme = mediaQuery.matches ? "dark" : "light";
|
|
40
|
+
setResolvedTheme(systemTheme);
|
|
41
|
+
root.classList.add(systemTheme);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
setResolvedTheme(theme);
|
|
45
|
+
root.classList.add(theme);
|
|
46
|
+
}
|
|
47
|
+
mediaQuery.addEventListener("change", updateTheme);
|
|
48
|
+
updateTheme();
|
|
49
|
+
return () => mediaQuery.removeEventListener("change", updateTheme);
|
|
50
|
+
}, [theme]);
|
|
51
|
+
const value = useMemo(
|
|
52
|
+
() => ({
|
|
53
|
+
theme,
|
|
54
|
+
resolvedTheme,
|
|
55
|
+
setTheme: (newTheme) => {
|
|
56
|
+
localStorage.setItem(storageKey, newTheme);
|
|
57
|
+
setThemeState(newTheme);
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
60
|
+
[theme, resolvedTheme, storageKey]
|
|
61
|
+
);
|
|
62
|
+
return /* @__PURE__ */ jsxs(TanstackThemeProviderContext.Provider, { value, children: [
|
|
63
|
+
/* @__PURE__ */ jsx(FunctionOnce, { param: storageKey, children: (storageKey2) => {
|
|
64
|
+
const theme2 = localStorage.getItem(storageKey2);
|
|
65
|
+
if (theme2 === "dark" || (theme2 === null || theme2 === "system") && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
|
66
|
+
document.documentElement.classList.add("dark");
|
|
67
|
+
}
|
|
68
|
+
} }),
|
|
69
|
+
children
|
|
70
|
+
] });
|
|
71
|
+
}
|
|
72
|
+
function useTanstackTheme() {
|
|
73
|
+
const context = use(TanstackThemeProviderContext);
|
|
74
|
+
if (context === void 0) {
|
|
75
|
+
throw new Error("useTanstackTheme must be used within a TanstackThemeProvider");
|
|
76
|
+
}
|
|
77
|
+
return context;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { TanstackThemeProvider as ThemeProvider, useTanstackTheme as useTheme };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekkolyth/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Shared UI Library for my personal projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"import": "./dist/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./next": {
|
|
25
|
+
"types": "./dist/next.d.ts",
|
|
26
|
+
"import": "./dist/next.js"
|
|
27
|
+
},
|
|
28
|
+
"./tanstack": {
|
|
29
|
+
"types": "./dist/tanstack.d.ts",
|
|
30
|
+
"import": "./dist/tanstack.js"
|
|
31
|
+
},
|
|
24
32
|
"./providers/next-theme": {
|
|
25
33
|
"types": "./dist/providers/next-theme-provider.d.ts",
|
|
26
34
|
"import": "./dist/providers/next-theme-provider.js"
|