@sonamu-kit/react-components 0.1.0 → 0.1.2
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/components/index.d.ts +65 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/alert-dialog.d.ts +20 -0
- package/dist/components/ui/alert.d.ts +8 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/async-select.d.ts +36 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/breadcrumb.d.ts +19 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/calendar.d.ts +5 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/carousel.d.ts +18 -0
- package/dist/components/ui/checkbox.d.ts +8 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/combobox.d.ts +20 -0
- package/dist/components/ui/command.d.ts +80 -0
- package/dist/components/ui/common-modal.d.ts +28 -0
- package/dist/components/ui/context-menu.d.ts +27 -0
- package/dist/components/ui/date-input.d.ts +7 -0
- package/dist/components/ui/date-picker.d.ts +26 -0
- package/dist/components/ui/date-selector-multiple.d.ts +38 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/drawer.d.ts +22 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/form.d.ts +23 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/image-uploader.d.ts +14 -0
- package/dist/components/ui/input-otp.d.ts +34 -0
- package/dist/components/ui/input.d.ts +7 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/menubar.d.ts +28 -0
- package/dist/components/ui/month-picker-multiple.d.ts +41 -0
- package/dist/components/ui/multi-image-uploader.d.ts +15 -0
- package/dist/components/ui/multi-select.d.ts +229 -0
- package/dist/components/ui/navigation-menu.d.ts +12 -0
- package/dist/components/ui/pagination.d.ts +10 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/resizable.d.ts +23 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +20 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/sheet.d.ts +25 -0
- package/dist/components/ui/sidebar.d.ts +69 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/slider.d.ts +8 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/switch.d.ts +8 -0
- package/dist/components/ui/table.d.ts +24 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/textarea.d.ts +7 -0
- package/dist/components/ui/toast.d.ts +15 -0
- package/dist/components/ui/toaster.d.ts +1 -0
- package/dist/components/ui/toggle-group.d.ts +12 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-toast.d.ts +44 -0
- package/dist/index.d.ts +3 -0
- package/dist/lib/caster.d.ts +3 -0
- package/dist/lib/helpers.d.ts +72 -0
- package/dist/lib/index.d.ts +6 -0
- package/{src/lib/lazy-upload.ts → dist/lib/lazy-upload.d.ts} +1 -12
- package/dist/lib/use-mobile.d.ts +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/react-components.es.js +28375 -0
- package/package.json +105 -76
- package/COMPONENTS_LIST.md +0 -106
- package/COMPONENTS_STATUS.md +0 -114
- package/HELPERS_GUIDE.md +0 -489
- package/MIGRATION_PLAN.md +0 -404
- package/SETUP_GUIDE.md +0 -125
- package/components.json +0 -21
- package/postcss.config.js +0 -6
- package/src/components/index.ts +0 -315
- package/src/components/ui/accordion.tsx +0 -54
- package/src/components/ui/alert-dialog.tsx +0 -115
- package/src/components/ui/alert.tsx +0 -49
- package/src/components/ui/aspect-ratio.tsx +0 -5
- package/src/components/ui/async-select.tsx +0 -186
- package/src/components/ui/avatar.tsx +0 -45
- package/src/components/ui/badge.tsx +0 -38
- package/src/components/ui/breadcrumb.tsx +0 -102
- package/src/components/ui/button.tsx +0 -54
- package/src/components/ui/calendar.tsx +0 -193
- package/src/components/ui/card.tsx +0 -65
- package/src/components/ui/carousel.tsx +0 -243
- package/src/components/ui/checkbox.tsx +0 -67
- package/src/components/ui/collapsible.tsx +0 -9
- package/src/components/ui/combobox.tsx +0 -135
- package/src/components/ui/command.tsx +0 -143
- package/src/components/ui/common-modal.tsx +0 -95
- package/src/components/ui/context-menu.tsx +0 -189
- package/src/components/ui/date-picker.tsx +0 -112
- package/src/components/ui/date-selector-multiple.tsx +0 -197
- package/src/components/ui/dialog.tsx +0 -104
- package/src/components/ui/drawer.tsx +0 -100
- package/src/components/ui/dropdown-menu.tsx +0 -189
- package/src/components/ui/form.tsx +0 -171
- package/src/components/ui/hover-card.tsx +0 -27
- package/src/components/ui/image-uploader.tsx +0 -251
- package/src/components/ui/input-otp.tsx +0 -69
- package/src/components/ui/input.tsx +0 -38
- package/src/components/ui/label.tsx +0 -19
- package/src/components/ui/menubar.tsx +0 -231
- package/src/components/ui/month-picker-multiple.tsx +0 -351
- package/src/components/ui/multi-image-uploader.tsx +0 -283
- package/src/components/ui/multi-select.tsx +0 -1143
- package/src/components/ui/navigation-menu.tsx +0 -120
- package/src/components/ui/pagination.tsx +0 -72
- package/src/components/ui/popover.tsx +0 -42
- package/src/components/ui/progress.tsx +0 -25
- package/src/components/ui/radio-group.tsx +0 -38
- package/src/components/ui/resizable.tsx +0 -42
- package/src/components/ui/scroll-area.tsx +0 -46
- package/src/components/ui/select.tsx +0 -235
- package/src/components/ui/separator.tsx +0 -24
- package/src/components/ui/sheet.tsx +0 -119
- package/src/components/ui/sidebar.tsx +0 -683
- package/src/components/ui/skeleton.tsx +0 -7
- package/src/components/ui/slider.tsx +0 -57
- package/src/components/ui/sonner.tsx +0 -39
- package/src/components/ui/switch.tsx +0 -63
- package/src/components/ui/table.tsx +0 -94
- package/src/components/ui/tabs.tsx +0 -53
- package/src/components/ui/textarea.tsx +0 -34
- package/src/components/ui/toast.tsx +0 -122
- package/src/components/ui/toaster.tsx +0 -29
- package/src/components/ui/toggle-group.tsx +0 -55
- package/src/components/ui/toggle.tsx +0 -41
- package/src/components/ui/tooltip.tsx +0 -28
- package/src/hooks/index.ts +0 -2
- package/src/hooks/use-toast.ts +0 -189
- package/src/icons.d.ts +0 -1
- package/src/index.ts +0 -4
- package/src/lib/caster.ts +0 -66
- package/src/lib/helpers.ts +0 -394
- package/src/lib/index.ts +0 -31
- package/src/lib/use-mobile.ts +0 -19
- package/src/lib/utils.ts +0 -6
- package/src/styles/globals.css +0 -658
- package/tailwind.config.ts +0 -8
- package/tsconfig.json +0 -31
- package/tsconfig.node.json +0 -11
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
2
|
-
import { cva } from "class-variance-authority";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import ChevronDownIcon from "~icons/lucide/chevron-down";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils";
|
|
7
|
-
|
|
8
|
-
const NavigationMenu = React.forwardRef<
|
|
9
|
-
React.ElementRef<typeof NavigationMenuPrimitive.Root>,
|
|
10
|
-
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
|
|
11
|
-
>(({ className, children, ...props }, ref) => (
|
|
12
|
-
<NavigationMenuPrimitive.Root
|
|
13
|
-
ref={ref}
|
|
14
|
-
className={cn("relative z-10 flex max-w-max flex-1 items-center justify-center", className)}
|
|
15
|
-
{...props}
|
|
16
|
-
>
|
|
17
|
-
{children}
|
|
18
|
-
<NavigationMenuViewport />
|
|
19
|
-
</NavigationMenuPrimitive.Root>
|
|
20
|
-
));
|
|
21
|
-
NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName;
|
|
22
|
-
|
|
23
|
-
const NavigationMenuList = React.forwardRef<
|
|
24
|
-
React.ElementRef<typeof NavigationMenuPrimitive.List>,
|
|
25
|
-
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
|
|
26
|
-
>(({ className, ...props }, ref) => (
|
|
27
|
-
<NavigationMenuPrimitive.List
|
|
28
|
-
ref={ref}
|
|
29
|
-
className={cn("group flex flex-1 list-none items-center justify-center space-x-1", className)}
|
|
30
|
-
{...props}
|
|
31
|
-
/>
|
|
32
|
-
));
|
|
33
|
-
NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName;
|
|
34
|
-
|
|
35
|
-
const NavigationMenuItem = NavigationMenuPrimitive.Item;
|
|
36
|
-
|
|
37
|
-
const navigationMenuTriggerStyle = cva(
|
|
38
|
-
"group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=open]:text-accent-foreground data-[state=open]:bg-accent/50 data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent",
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const NavigationMenuTrigger = React.forwardRef<
|
|
42
|
-
React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
|
|
43
|
-
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
|
|
44
|
-
>(({ className, children, ...props }, ref) => (
|
|
45
|
-
<NavigationMenuPrimitive.Trigger
|
|
46
|
-
ref={ref}
|
|
47
|
-
className={cn(navigationMenuTriggerStyle(), "group", className)}
|
|
48
|
-
{...props}
|
|
49
|
-
>
|
|
50
|
-
{children}{" "}
|
|
51
|
-
<ChevronDownIcon
|
|
52
|
-
className="relative top-px ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180"
|
|
53
|
-
aria-hidden="true"
|
|
54
|
-
/>
|
|
55
|
-
</NavigationMenuPrimitive.Trigger>
|
|
56
|
-
));
|
|
57
|
-
NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName;
|
|
58
|
-
|
|
59
|
-
const NavigationMenuContent = React.forwardRef<
|
|
60
|
-
React.ElementRef<typeof NavigationMenuPrimitive.Content>,
|
|
61
|
-
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
|
|
62
|
-
>(({ className, ...props }, ref) => (
|
|
63
|
-
<NavigationMenuPrimitive.Content
|
|
64
|
-
ref={ref}
|
|
65
|
-
className={cn(
|
|
66
|
-
"left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",
|
|
67
|
-
className,
|
|
68
|
-
)}
|
|
69
|
-
{...props}
|
|
70
|
-
/>
|
|
71
|
-
));
|
|
72
|
-
NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName;
|
|
73
|
-
|
|
74
|
-
const NavigationMenuLink = NavigationMenuPrimitive.Link;
|
|
75
|
-
|
|
76
|
-
const NavigationMenuViewport = React.forwardRef<
|
|
77
|
-
React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
|
|
78
|
-
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
|
|
79
|
-
>(({ className, ...props }, ref) => (
|
|
80
|
-
<div className={cn("absolute left-0 top-full flex justify-center")}>
|
|
81
|
-
<NavigationMenuPrimitive.Viewport
|
|
82
|
-
className={cn(
|
|
83
|
-
"origin-top-center relative mt-1.5 h-(--radix-navigation-menu-viewport-height) w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-(--radix-navigation-menu-viewport-width)",
|
|
84
|
-
className,
|
|
85
|
-
)}
|
|
86
|
-
ref={ref}
|
|
87
|
-
{...props}
|
|
88
|
-
/>
|
|
89
|
-
</div>
|
|
90
|
-
));
|
|
91
|
-
NavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName;
|
|
92
|
-
|
|
93
|
-
const NavigationMenuIndicator = React.forwardRef<
|
|
94
|
-
React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
|
|
95
|
-
React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
|
|
96
|
-
>(({ className, ...props }, ref) => (
|
|
97
|
-
<NavigationMenuPrimitive.Indicator
|
|
98
|
-
ref={ref}
|
|
99
|
-
className={cn(
|
|
100
|
-
"top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
|
|
101
|
-
className,
|
|
102
|
-
)}
|
|
103
|
-
{...props}
|
|
104
|
-
>
|
|
105
|
-
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
|
|
106
|
-
</NavigationMenuPrimitive.Indicator>
|
|
107
|
-
));
|
|
108
|
-
NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName;
|
|
109
|
-
|
|
110
|
-
export {
|
|
111
|
-
navigationMenuTriggerStyle,
|
|
112
|
-
NavigationMenu,
|
|
113
|
-
NavigationMenuList,
|
|
114
|
-
NavigationMenuItem,
|
|
115
|
-
NavigationMenuContent,
|
|
116
|
-
NavigationMenuTrigger,
|
|
117
|
-
NavigationMenuLink,
|
|
118
|
-
NavigationMenuIndicator,
|
|
119
|
-
NavigationMenuViewport,
|
|
120
|
-
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { cn } from "../../lib/utils";
|
|
3
|
-
import { Button } from "./button";
|
|
4
|
-
|
|
5
|
-
export interface PaginationProps {
|
|
6
|
-
value: number;
|
|
7
|
-
onValueChange: (page: number) => void;
|
|
8
|
-
total: number;
|
|
9
|
-
itemsPerPage: number;
|
|
10
|
-
className?: string;
|
|
11
|
-
maxVisible?: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const Pagination = React.forwardRef<HTMLDivElement, PaginationProps>(
|
|
15
|
-
({ value, onValueChange, total, itemsPerPage, className, maxVisible = 6 }, ref) => {
|
|
16
|
-
const totalPages = Math.ceil(total / itemsPerPage);
|
|
17
|
-
const currentPage = value;
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div ref={ref} className={cn("flex items-center justify-between pt-6", className)}>
|
|
21
|
-
<div className="text-xs text-muted-foreground">
|
|
22
|
-
Showing {(currentPage - 1) * itemsPerPage + 1}-
|
|
23
|
-
{Math.min(currentPage * itemsPerPage, total)} of {total} results
|
|
24
|
-
</div>
|
|
25
|
-
<div className="flex items-center gap-2">
|
|
26
|
-
<Button
|
|
27
|
-
variant="outline"
|
|
28
|
-
size="sm"
|
|
29
|
-
className="h-8 px-3 text-xs"
|
|
30
|
-
disabled={currentPage === 1}
|
|
31
|
-
onClick={() => onValueChange(currentPage - 1)}
|
|
32
|
-
>
|
|
33
|
-
Previous
|
|
34
|
-
</Button>
|
|
35
|
-
<div className="flex items-center gap-1">
|
|
36
|
-
{(() => {
|
|
37
|
-
let startPage = Math.max(1, currentPage - Math.floor(maxVisible / 2));
|
|
38
|
-
const endPage = Math.min(totalPages, startPage + maxVisible - 1);
|
|
39
|
-
if (endPage - startPage + 1 < maxVisible) {
|
|
40
|
-
startPage = Math.max(1, endPage - maxVisible + 1);
|
|
41
|
-
}
|
|
42
|
-
return Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i).map(
|
|
43
|
-
(page) => (
|
|
44
|
-
<Button
|
|
45
|
-
key={page}
|
|
46
|
-
variant="outline"
|
|
47
|
-
size="sm"
|
|
48
|
-
className={`h-8 w-8 text-xs ${page === currentPage ? "bg-primary text-primary-foreground" : ""}`}
|
|
49
|
-
onClick={() => onValueChange(page)}
|
|
50
|
-
>
|
|
51
|
-
{page}
|
|
52
|
-
</Button>
|
|
53
|
-
),
|
|
54
|
-
);
|
|
55
|
-
})()}
|
|
56
|
-
</div>
|
|
57
|
-
<Button
|
|
58
|
-
variant="outline"
|
|
59
|
-
size="sm"
|
|
60
|
-
className="h-8 px-3 text-xs"
|
|
61
|
-
disabled={currentPage === totalPages}
|
|
62
|
-
onClick={() => onValueChange(currentPage + 1)}
|
|
63
|
-
>
|
|
64
|
-
Next
|
|
65
|
-
</Button>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
},
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
Pagination.displayName = "Pagination";
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
-
import type * as React from "react";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils";
|
|
7
|
-
|
|
8
|
-
function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
9
|
-
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
13
|
-
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function PopoverContent({
|
|
17
|
-
className,
|
|
18
|
-
align = "center",
|
|
19
|
-
sideOffset = 4,
|
|
20
|
-
...props
|
|
21
|
-
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
22
|
-
return (
|
|
23
|
-
<PopoverPrimitive.Portal>
|
|
24
|
-
<PopoverPrimitive.Content
|
|
25
|
-
data-slot="popover-content"
|
|
26
|
-
align={align}
|
|
27
|
-
sideOffset={sideOffset}
|
|
28
|
-
className={cn(
|
|
29
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
30
|
-
className,
|
|
31
|
-
)}
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
</PopoverPrimitive.Portal>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
39
|
-
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils";
|
|
7
|
-
|
|
8
|
-
const Progress = React.forwardRef<
|
|
9
|
-
React.ElementRef<typeof ProgressPrimitive.Root>,
|
|
10
|
-
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
|
|
11
|
-
>(({ className, value, ...props }, ref) => (
|
|
12
|
-
<ProgressPrimitive.Root
|
|
13
|
-
ref={ref}
|
|
14
|
-
className={cn("relative h-4 w-full overflow-hidden rounded-full bg-secondary", className)}
|
|
15
|
-
{...props}
|
|
16
|
-
>
|
|
17
|
-
<ProgressPrimitive.Indicator
|
|
18
|
-
className="h-full w-full flex-1 bg-primary transition-all"
|
|
19
|
-
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
|
20
|
-
/>
|
|
21
|
-
</ProgressPrimitive.Root>
|
|
22
|
-
));
|
|
23
|
-
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
24
|
-
|
|
25
|
-
export { Progress };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import CircleIcon from "~icons/lucide/circle";
|
|
6
|
-
|
|
7
|
-
import { cn } from "../../lib/utils";
|
|
8
|
-
|
|
9
|
-
const RadioGroup = React.forwardRef<
|
|
10
|
-
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
|
11
|
-
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
|
|
12
|
-
>(({ className, ...props }, ref) => {
|
|
13
|
-
return <RadioGroupPrimitive.Root className={cn("grid gap-2", className)} {...props} ref={ref} />;
|
|
14
|
-
});
|
|
15
|
-
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
16
|
-
|
|
17
|
-
const RadioGroupItem = React.forwardRef<
|
|
18
|
-
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
|
19
|
-
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
|
|
20
|
-
>(({ className, ...props }, ref) => {
|
|
21
|
-
return (
|
|
22
|
-
<RadioGroupPrimitive.Item
|
|
23
|
-
ref={ref}
|
|
24
|
-
className={cn(
|
|
25
|
-
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
26
|
-
className,
|
|
27
|
-
)}
|
|
28
|
-
{...props}
|
|
29
|
-
>
|
|
30
|
-
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
|
31
|
-
<CircleIcon className="h-2.5 w-2.5 fill-current text-current" />
|
|
32
|
-
</RadioGroupPrimitive.Indicator>
|
|
33
|
-
</RadioGroupPrimitive.Item>
|
|
34
|
-
);
|
|
35
|
-
});
|
|
36
|
-
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
37
|
-
|
|
38
|
-
export { RadioGroup, RadioGroupItem };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as ResizablePrimitive from "react-resizable-panels";
|
|
4
|
-
import GripVerticalIcon from "~icons/lucide/grip-vertical";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils";
|
|
7
|
-
|
|
8
|
-
const ResizablePanelGroup = ({
|
|
9
|
-
className,
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (
|
|
12
|
-
<ResizablePrimitive.PanelGroup
|
|
13
|
-
className={cn("flex h-full w-full data-[panel-group-direction=vertical]:flex-col", className)}
|
|
14
|
-
{...props}
|
|
15
|
-
/>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const ResizablePanel = ResizablePrimitive.Panel;
|
|
19
|
-
|
|
20
|
-
const ResizableHandle = ({
|
|
21
|
-
withHandle,
|
|
22
|
-
className,
|
|
23
|
-
...props
|
|
24
|
-
}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
|
|
25
|
-
withHandle?: boolean;
|
|
26
|
-
}) => (
|
|
27
|
-
<ResizablePrimitive.PanelResizeHandle
|
|
28
|
-
className={cn(
|
|
29
|
-
"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
|
|
30
|
-
className,
|
|
31
|
-
)}
|
|
32
|
-
{...props}
|
|
33
|
-
>
|
|
34
|
-
{withHandle && (
|
|
35
|
-
<div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border">
|
|
36
|
-
<GripVerticalIcon className="h-2.5 w-2.5" />
|
|
37
|
-
</div>
|
|
38
|
-
)}
|
|
39
|
-
</ResizablePrimitive.PanelResizeHandle>
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
export { ResizablePanelGroup, ResizablePanel, ResizableHandle };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
|
|
6
|
-
import { cn } from "../../lib/utils";
|
|
7
|
-
|
|
8
|
-
const ScrollArea = React.forwardRef<
|
|
9
|
-
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
10
|
-
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
11
|
-
>(({ className, children, ...props }, ref) => (
|
|
12
|
-
<ScrollAreaPrimitive.Root
|
|
13
|
-
ref={ref}
|
|
14
|
-
className={cn("relative overflow-hidden", className)}
|
|
15
|
-
{...props}
|
|
16
|
-
>
|
|
17
|
-
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
|
|
18
|
-
{children}
|
|
19
|
-
</ScrollAreaPrimitive.Viewport>
|
|
20
|
-
<ScrollBar />
|
|
21
|
-
<ScrollAreaPrimitive.Corner />
|
|
22
|
-
</ScrollAreaPrimitive.Root>
|
|
23
|
-
));
|
|
24
|
-
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
25
|
-
|
|
26
|
-
const ScrollBar = React.forwardRef<
|
|
27
|
-
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
28
|
-
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
29
|
-
>(({ className, orientation = "vertical", ...props }, ref) => (
|
|
30
|
-
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
31
|
-
ref={ref}
|
|
32
|
-
orientation={orientation}
|
|
33
|
-
className={cn(
|
|
34
|
-
"flex touch-none select-none transition-colors",
|
|
35
|
-
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-px",
|
|
36
|
-
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-px",
|
|
37
|
-
className,
|
|
38
|
-
)}
|
|
39
|
-
{...props}
|
|
40
|
-
>
|
|
41
|
-
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
|
|
42
|
-
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
43
|
-
));
|
|
44
|
-
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
45
|
-
|
|
46
|
-
export { ScrollArea, ScrollBar };
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import CheckIcon from "~icons/lucide/check";
|
|
4
|
-
import ChevronDownIcon from "~icons/lucide/chevron-down";
|
|
5
|
-
import ChevronUpIcon from "~icons/lucide/chevron-up";
|
|
6
|
-
import XCircleIcon from "~icons/lucide/x-circle";
|
|
7
|
-
import type { Override } from "../../lib/helpers";
|
|
8
|
-
import { cn } from "../../lib/utils";
|
|
9
|
-
|
|
10
|
-
type SelectProps = Override<
|
|
11
|
-
React.ComponentProps<typeof SelectPrimitive.Root>,
|
|
12
|
-
{
|
|
13
|
-
name?: string;
|
|
14
|
-
onValueChange?: (value: string | undefined | null) => void;
|
|
15
|
-
onBlur?: React.FocusEventHandler<HTMLSelectElement>;
|
|
16
|
-
clearable?: boolean;
|
|
17
|
-
}
|
|
18
|
-
>;
|
|
19
|
-
|
|
20
|
-
// Context for passing clearable state to SelectTrigger
|
|
21
|
-
type SelectContextValue = {
|
|
22
|
-
clearable?: boolean;
|
|
23
|
-
hasValue?: boolean;
|
|
24
|
-
onClear?: () => void;
|
|
25
|
-
};
|
|
26
|
-
const SelectContext = React.createContext<SelectContextValue>({});
|
|
27
|
-
|
|
28
|
-
const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
|
|
29
|
-
({ name, value, defaultValue, onValueChange, onBlur, clearable, children, ...props }, ref) => {
|
|
30
|
-
const selectRef = React.useRef<HTMLSelectElement>(null);
|
|
31
|
-
|
|
32
|
-
// biome-ignore lint/style/noNonNullAssertion: useImperativeHandle은 ref가 할당된 후 실행되므로 안전함
|
|
33
|
-
React.useImperativeHandle(ref, () => selectRef.current!);
|
|
34
|
-
|
|
35
|
-
const handleValueChange = (newValue: string) => {
|
|
36
|
-
onValueChange?.(newValue);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const handleClear = () => {
|
|
40
|
-
onValueChange?.(undefined);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const hasValue = Boolean(value);
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<SelectContext.Provider value={{ clearable, hasValue, onClear: handleClear }}>
|
|
47
|
-
<select
|
|
48
|
-
ref={selectRef}
|
|
49
|
-
name={name}
|
|
50
|
-
defaultValue={defaultValue}
|
|
51
|
-
onBlur={onBlur}
|
|
52
|
-
className="sr-only"
|
|
53
|
-
tabIndex={-1}
|
|
54
|
-
aria-hidden="true"
|
|
55
|
-
>
|
|
56
|
-
<option value={value || defaultValue || ""} />
|
|
57
|
-
</select>
|
|
58
|
-
<SelectPrimitive.Root
|
|
59
|
-
value={value}
|
|
60
|
-
defaultValue={defaultValue}
|
|
61
|
-
onValueChange={handleValueChange}
|
|
62
|
-
{...props}
|
|
63
|
-
>
|
|
64
|
-
{children}
|
|
65
|
-
</SelectPrimitive.Root>
|
|
66
|
-
</SelectContext.Provider>
|
|
67
|
-
);
|
|
68
|
-
},
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
Select.displayName = "Select";
|
|
72
|
-
|
|
73
|
-
const SelectGroup = SelectPrimitive.Group;
|
|
74
|
-
|
|
75
|
-
const SelectValue = SelectPrimitive.Value;
|
|
76
|
-
|
|
77
|
-
const SelectTrigger = React.forwardRef<
|
|
78
|
-
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
79
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
80
|
-
>(({ className, children, ...props }, ref) => {
|
|
81
|
-
const { clearable, hasValue, onClear } = React.useContext(SelectContext);
|
|
82
|
-
|
|
83
|
-
const handleClear = (e: React.PointerEvent | React.MouseEvent) => {
|
|
84
|
-
// Radix UI에서 클릭 이벤트가 Trigger로 전파되는 것을 방지
|
|
85
|
-
e.preventDefault();
|
|
86
|
-
e.stopPropagation();
|
|
87
|
-
onClear?.();
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<SelectPrimitive.Trigger
|
|
92
|
-
ref={ref}
|
|
93
|
-
className={cn(
|
|
94
|
-
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
95
|
-
className,
|
|
96
|
-
)}
|
|
97
|
-
{...props}
|
|
98
|
-
>
|
|
99
|
-
<span className="flex-1 truncate text-left">{children}</span>
|
|
100
|
-
<div className="flex items-center gap-1 shrink-0 pl-2">
|
|
101
|
-
{clearable && hasValue && (
|
|
102
|
-
<XCircleIcon
|
|
103
|
-
className="h-4 w-4 cursor-pointer opacity-50 hover:opacity-100 transition-opacity"
|
|
104
|
-
onPointerDownCapture={handleClear}
|
|
105
|
-
onMouseDownCapture={handleClear}
|
|
106
|
-
/>
|
|
107
|
-
)}
|
|
108
|
-
<SelectPrimitive.Icon asChild>
|
|
109
|
-
<ChevronDownIcon className="h-4 w-4 opacity-50" />
|
|
110
|
-
</SelectPrimitive.Icon>
|
|
111
|
-
</div>
|
|
112
|
-
</SelectPrimitive.Trigger>
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
116
|
-
|
|
117
|
-
const SelectScrollUpButton = React.forwardRef<
|
|
118
|
-
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
119
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
120
|
-
>(({ className, ...props }, ref) => (
|
|
121
|
-
<SelectPrimitive.ScrollUpButton
|
|
122
|
-
ref={ref}
|
|
123
|
-
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
124
|
-
{...props}
|
|
125
|
-
>
|
|
126
|
-
<ChevronUpIcon className="h-4 w-4" />
|
|
127
|
-
</SelectPrimitive.ScrollUpButton>
|
|
128
|
-
));
|
|
129
|
-
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
130
|
-
|
|
131
|
-
const SelectScrollDownButton = React.forwardRef<
|
|
132
|
-
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
133
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
134
|
-
>(({ className, ...props }, ref) => (
|
|
135
|
-
<SelectPrimitive.ScrollDownButton
|
|
136
|
-
ref={ref}
|
|
137
|
-
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
138
|
-
{...props}
|
|
139
|
-
>
|
|
140
|
-
<ChevronDownIcon className="h-4 w-4" />
|
|
141
|
-
</SelectPrimitive.ScrollDownButton>
|
|
142
|
-
));
|
|
143
|
-
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
144
|
-
|
|
145
|
-
const SelectContent = React.forwardRef<
|
|
146
|
-
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
147
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
148
|
-
>(({ className, children, position = "popper", ...props }, ref) => (
|
|
149
|
-
<SelectPrimitive.Portal>
|
|
150
|
-
<SelectPrimitive.Content
|
|
151
|
-
ref={ref}
|
|
152
|
-
className={cn(
|
|
153
|
-
"relative z-50 max-h-[--radix-select-content-available-height] min-w-32 overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
|
|
154
|
-
position === "popper" &&
|
|
155
|
-
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
156
|
-
className,
|
|
157
|
-
)}
|
|
158
|
-
position={position}
|
|
159
|
-
{...props}
|
|
160
|
-
>
|
|
161
|
-
<SelectScrollUpButton />
|
|
162
|
-
<SelectPrimitive.Viewport
|
|
163
|
-
className={cn(
|
|
164
|
-
"p-1",
|
|
165
|
-
position === "popper" &&
|
|
166
|
-
"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)",
|
|
167
|
-
)}
|
|
168
|
-
>
|
|
169
|
-
{children}
|
|
170
|
-
</SelectPrimitive.Viewport>
|
|
171
|
-
<SelectScrollDownButton />
|
|
172
|
-
</SelectPrimitive.Content>
|
|
173
|
-
</SelectPrimitive.Portal>
|
|
174
|
-
));
|
|
175
|
-
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
176
|
-
|
|
177
|
-
const SelectLabel = React.forwardRef<
|
|
178
|
-
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
179
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
180
|
-
>(({ className, ...props }, ref) => (
|
|
181
|
-
<SelectPrimitive.Label
|
|
182
|
-
ref={ref}
|
|
183
|
-
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
|
184
|
-
{...props}
|
|
185
|
-
/>
|
|
186
|
-
));
|
|
187
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
188
|
-
|
|
189
|
-
const SelectItem = React.forwardRef<
|
|
190
|
-
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
191
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
192
|
-
>(({ className, children, ...props }, ref) => (
|
|
193
|
-
<SelectPrimitive.Item
|
|
194
|
-
ref={ref}
|
|
195
|
-
className={cn(
|
|
196
|
-
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
197
|
-
className,
|
|
198
|
-
)}
|
|
199
|
-
{...props}
|
|
200
|
-
>
|
|
201
|
-
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
202
|
-
<SelectPrimitive.ItemIndicator>
|
|
203
|
-
<CheckIcon className="h-4 w-4" />
|
|
204
|
-
</SelectPrimitive.ItemIndicator>
|
|
205
|
-
</span>
|
|
206
|
-
|
|
207
|
-
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
208
|
-
</SelectPrimitive.Item>
|
|
209
|
-
));
|
|
210
|
-
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
211
|
-
|
|
212
|
-
const SelectSeparator = React.forwardRef<
|
|
213
|
-
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
214
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
215
|
-
>(({ className, ...props }, ref) => (
|
|
216
|
-
<SelectPrimitive.Separator
|
|
217
|
-
ref={ref}
|
|
218
|
-
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
|
219
|
-
{...props}
|
|
220
|
-
/>
|
|
221
|
-
));
|
|
222
|
-
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
223
|
-
|
|
224
|
-
export {
|
|
225
|
-
Select,
|
|
226
|
-
SelectGroup,
|
|
227
|
-
SelectValue,
|
|
228
|
-
SelectTrigger,
|
|
229
|
-
SelectContent,
|
|
230
|
-
SelectLabel,
|
|
231
|
-
SelectItem,
|
|
232
|
-
SelectSeparator,
|
|
233
|
-
SelectScrollUpButton,
|
|
234
|
-
SelectScrollDownButton,
|
|
235
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
|
|
4
|
-
import { cn } from "../../lib/utils";
|
|
5
|
-
|
|
6
|
-
const Separator = React.forwardRef<
|
|
7
|
-
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
-
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
-
>(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (
|
|
10
|
-
<SeparatorPrimitive.Root
|
|
11
|
-
ref={ref}
|
|
12
|
-
decorative={decorative}
|
|
13
|
-
orientation={orientation}
|
|
14
|
-
className={cn(
|
|
15
|
-
"shrink-0 bg-border",
|
|
16
|
-
orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
|
|
17
|
-
className,
|
|
18
|
-
)}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
));
|
|
22
|
-
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
23
|
-
|
|
24
|
-
export { Separator };
|