@codefast/ui 0.3.16-canary.2 → 0.3.16-canary.3
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/CHANGELOG.md +21 -0
- package/README.md +1 -1
- package/dist/components/accordion.mjs +2 -2
- package/dist/components/alert-dialog.d.mts +1 -1
- package/dist/components/alert-dialog.mjs +4 -4
- package/dist/components/alert.d.mts +3 -13
- package/dist/components/alert.mjs +3 -23
- package/dist/components/badge.d.mts +3 -15
- package/dist/components/badge.mjs +2 -44
- package/dist/components/breadcrumb.mjs +1 -1
- package/dist/components/button-group.d.mts +3 -13
- package/dist/components/button-group.mjs +3 -24
- package/dist/components/button.d.mts +3 -25
- package/dist/components/button.mjs +2 -72
- package/dist/components/calendar.mjs +2 -1
- package/dist/components/carousel.d.mts +1 -2
- package/dist/components/chart.d.mts +2 -4
- package/dist/components/checkbox.mjs +2 -2
- package/dist/components/context-menu.mjs +2 -2
- package/dist/components/dialog.d.mts +1 -1
- package/dist/components/dialog.mjs +4 -4
- package/dist/components/drawer.d.mts +1 -1
- package/dist/components/drawer.mjs +2 -2
- package/dist/components/dropdown-menu.mjs +2 -2
- package/dist/components/empty.d.mts +3 -13
- package/dist/components/empty.mjs +3 -18
- package/dist/components/field.d.mts +3 -14
- package/dist/components/field.mjs +3 -32
- package/dist/components/form.d.mts +2 -4
- package/dist/components/hover-card.mjs +1 -1
- package/dist/components/input-group.d.mts +4 -31
- package/dist/components/input-group.mjs +3 -90
- package/dist/components/input-number.mjs +4 -4
- package/dist/components/input-otp.mjs +2 -2
- package/dist/components/input.mjs +1 -1
- package/dist/components/item.d.mts +4 -29
- package/dist/components/item.mjs +3 -56
- package/dist/components/menubar.mjs +2 -2
- package/dist/components/native-select.mjs +1 -1
- package/dist/components/navigation-menu.d.mts +1 -6
- package/dist/components/navigation-menu.mjs +8 -15
- package/dist/components/pagination.d.mts +1 -1
- package/dist/components/pagination.mjs +1 -1
- package/dist/components/popover.mjs +1 -1
- package/dist/components/progress-circle.d.mts +3 -47
- package/dist/components/progress-circle.mjs +2 -47
- package/dist/components/progress.mjs +1 -1
- package/dist/components/radio-group.mjs +1 -1
- package/dist/components/radio.mjs +1 -1
- package/dist/components/scroll-area.d.mts +3 -19
- package/dist/components/scroll-area.mjs +4 -61
- package/dist/components/select.d.mts +1 -1
- package/dist/components/select.mjs +3 -3
- package/dist/components/separator.d.mts +3 -18
- package/dist/components/separator.mjs +3 -23
- package/dist/components/sheet.d.mts +6 -18
- package/dist/components/sheet.mjs +6 -49
- package/dist/components/sidebar.d.mts +4 -19
- package/dist/components/sidebar.mjs +10 -46
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.mjs +1 -1
- package/dist/components/spinner.mjs +1 -1
- package/dist/components/switch.mjs +2 -2
- package/dist/components/table.mjs +1 -1
- package/dist/components/tabs.mjs +1 -1
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +3 -2
- package/dist/components/toggle-group.mjs +1 -1
- package/dist/components/toggle.d.mts +2 -21
- package/dist/components/toggle.mjs +2 -39
- package/dist/components/tooltip.mjs +1 -1
- package/dist/index.d.mts +31 -16
- package/dist/index.mjs +30 -15
- package/dist/lib/utils.d.mts +1 -12
- package/dist/lib/utils.mjs +1 -9
- package/dist/primitives/checkbox-group.d.mts +1 -2
- package/dist/primitives/input-number.d.mts +1 -2
- package/dist/primitives/input.d.mts +1 -2
- package/dist/primitives/progress-circle.d.mts +1 -2
- package/dist/variants/alert.d.mts +18 -0
- package/dist/variants/alert.mjs +25 -0
- package/dist/variants/badge.d.mts +20 -0
- package/dist/variants/badge.mjs +46 -0
- package/dist/variants/button-group.d.mts +18 -0
- package/dist/variants/button-group.mjs +26 -0
- package/dist/variants/button.d.mts +30 -0
- package/dist/variants/button.mjs +76 -0
- package/dist/variants/empty.d.mts +18 -0
- package/dist/variants/empty.mjs +20 -0
- package/dist/variants/field.d.mts +19 -0
- package/dist/variants/field.mjs +34 -0
- package/dist/variants/input-group.d.mts +43 -0
- package/dist/variants/input-group.mjs +93 -0
- package/dist/variants/item.d.mts +37 -0
- package/dist/variants/item.mjs +60 -0
- package/dist/variants/navigation-menu.d.mts +13 -0
- package/dist/variants/navigation-menu.mjs +12 -0
- package/dist/variants/progress-circle.d.mts +52 -0
- package/dist/variants/progress-circle.mjs +49 -0
- package/dist/variants/scroll-area.d.mts +24 -0
- package/dist/variants/scroll-area.mjs +63 -0
- package/dist/variants/separator.d.mts +23 -0
- package/dist/variants/separator.mjs +25 -0
- package/dist/variants/sheet.d.mts +20 -0
- package/dist/variants/sheet.mjs +50 -0
- package/dist/variants/sidebar.d.mts +23 -0
- package/dist/variants/sidebar.mjs +42 -0
- package/dist/variants/toggle.d.mts +23 -0
- package/dist/variants/toggle.mjs +43 -0
- package/package.json +168 -20
- package/src/components/accordion.tsx +156 -0
- package/src/components/alert-dialog.tsx +314 -0
- package/src/components/alert.tsx +86 -0
- package/src/components/aspect-ratio.tsx +28 -0
- package/src/components/avatar.tsx +84 -0
- package/src/components/badge.tsx +38 -0
- package/src/components/breadcrumb.tsx +197 -0
- package/src/components/button-group.tsx +107 -0
- package/src/components/button.tsx +66 -0
- package/src/components/calendar.tsx +277 -0
- package/src/components/card.tsx +175 -0
- package/src/components/carousel.tsx +367 -0
- package/src/components/chart.tsx +587 -0
- package/src/components/checkbox-cards.tsx +92 -0
- package/src/components/checkbox-group.tsx +83 -0
- package/src/components/checkbox.tsx +65 -0
- package/src/components/collapsible.tsx +60 -0
- package/src/components/command.tsx +311 -0
- package/src/components/context-menu.tsx +489 -0
- package/src/components/dialog.tsx +295 -0
- package/src/components/drawer.tsx +271 -0
- package/src/components/dropdown-menu.tsx +498 -0
- package/src/components/empty.tsx +169 -0
- package/src/components/field.tsx +362 -0
- package/src/components/form.tsx +300 -0
- package/src/components/hover-card.tsx +116 -0
- package/src/components/input-group.tsx +224 -0
- package/src/components/input-number.tsx +161 -0
- package/src/components/input-otp.tsx +151 -0
- package/src/components/input-password.tsx +74 -0
- package/src/components/input-search.tsx +98 -0
- package/src/components/input.tsx +52 -0
- package/src/components/item.tsx +280 -0
- package/src/components/kbd.tsx +59 -0
- package/src/components/label.tsx +44 -0
- package/src/components/menubar.tsx +531 -0
- package/src/components/native-select.tsx +96 -0
- package/src/components/navigation-menu.tsx +295 -0
- package/src/components/pagination.tsx +204 -0
- package/src/components/popover.tsx +139 -0
- package/src/components/progress-circle.tsx +203 -0
- package/src/components/progress.tsx +54 -0
- package/src/components/radio-cards.tsx +85 -0
- package/src/components/radio-group.tsx +79 -0
- package/src/components/radio.tsx +61 -0
- package/src/components/resizable.tsx +99 -0
- package/src/components/scroll-area.tsx +115 -0
- package/src/components/select.tsx +319 -0
- package/src/components/separator.tsx +74 -0
- package/src/components/sheet.tsx +278 -0
- package/src/components/sidebar.tsx +1056 -0
- package/src/components/skeleton.tsx +37 -0
- package/src/components/slider.tsx +95 -0
- package/src/components/sonner.tsx +47 -0
- package/src/components/spinner.tsx +75 -0
- package/src/components/switch.tsx +66 -0
- package/src/components/table.tsx +200 -0
- package/src/components/tabs.tsx +128 -0
- package/src/components/textarea.tsx +49 -0
- package/src/components/toggle-group.tsx +141 -0
- package/src/components/toggle.tsx +39 -0
- package/src/components/tooltip.tsx +141 -0
- package/src/css/amber.css +59 -22
- package/src/css/blue.css +59 -22
- package/src/css/cyan.css +59 -22
- package/src/css/emerald.css +59 -22
- package/src/css/fuchsia.css +59 -22
- package/src/css/gray.css +59 -22
- package/src/css/green.css +59 -22
- package/src/css/indigo.css +59 -22
- package/src/css/lime.css +59 -22
- package/src/css/neutral.css +59 -22
- package/src/css/orange.css +59 -22
- package/src/css/pink.css +59 -22
- package/src/css/preset.css +32 -13
- package/src/css/purple.css +59 -22
- package/src/css/red.css +59 -22
- package/src/css/rose.css +59 -22
- package/src/css/sky.css +59 -22
- package/src/css/slate.css +59 -22
- package/src/css/stone.css +59 -22
- package/src/css/teal.css +59 -22
- package/src/css/violet.css +59 -22
- package/src/css/yellow.css +59 -22
- package/src/css/zinc.css +59 -22
- package/src/hooks/use-animated-value.ts +97 -0
- package/src/hooks/use-copy-to-clipboard.ts +63 -0
- package/src/hooks/use-is-mobile.ts +27 -0
- package/src/hooks/use-media-query.ts +71 -0
- package/src/hooks/use-mutation-observer.ts +54 -0
- package/src/hooks/use-pagination.ts +166 -0
- package/src/index.ts +720 -0
- package/src/lib/utils.ts +5 -0
- package/src/primitives/checkbox-group.tsx +360 -0
- package/src/primitives/input-number.tsx +1013 -0
- package/src/primitives/input.tsx +243 -0
- package/src/primitives/progress-circle.tsx +537 -0
- package/src/variants/alert.ts +45 -0
- package/src/variants/badge.ts +66 -0
- package/src/variants/button-group.ts +49 -0
- package/src/variants/button.ts +93 -0
- package/src/variants/empty.ts +43 -0
- package/src/variants/field.ts +50 -0
- package/src/variants/input-group.ts +132 -0
- package/src/variants/item.ts +90 -0
- package/src/variants/navigation-menu.ts +32 -0
- package/src/variants/progress-circle.ts +47 -0
- package/src/variants/scroll-area.ts +79 -0
- package/src/variants/separator.ts +41 -0
- package/src/variants/sheet.ts +70 -0
- package/src/variants/sidebar.ts +61 -0
- package/src/variants/toggle.ts +59 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, JSX } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "#/lib/utils";
|
|
6
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
7
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
8
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
9
|
+
|
|
10
|
+
/* -----------------------------------------------------------------------------
|
|
11
|
+
* Component: Accordion
|
|
12
|
+
* -------------------------------------------------------------------------- */
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @since 0.3.16-canary.0
|
|
16
|
+
*/
|
|
17
|
+
type AccordionProps = ComponentProps<typeof AccordionPrimitive.Root>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @since 0.3.16-canary.0
|
|
21
|
+
*/
|
|
22
|
+
function Accordion({ ...props }: AccordionProps): JSX.Element {
|
|
23
|
+
return <AccordionPrimitive.Root data-slot="accordion" {...props} />;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* -----------------------------------------------------------------------------
|
|
27
|
+
* Component: AccordionItem
|
|
28
|
+
* -------------------------------------------------------------------------- */
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @since 0.3.16-canary.0
|
|
32
|
+
*/
|
|
33
|
+
type AccordionItemProps = ComponentProps<typeof AccordionPrimitive.Item>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @since 0.3.16-canary.0
|
|
37
|
+
*/
|
|
38
|
+
function AccordionItem({ className, ...props }: AccordionItemProps): JSX.Element {
|
|
39
|
+
return (
|
|
40
|
+
<AccordionPrimitive.Item
|
|
41
|
+
className={cn("border-b", "last:border-b-0", className)}
|
|
42
|
+
data-slot="accordion-item"
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* -----------------------------------------------------------------------------
|
|
49
|
+
* Component: AccordionIcon
|
|
50
|
+
* -------------------------------------------------------------------------- */
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @since 0.3.16-canary.0
|
|
54
|
+
*/
|
|
55
|
+
interface AccordionIconProps extends ComponentProps<typeof Slot> {
|
|
56
|
+
asChild?: boolean;
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @since 0.3.16-canary.0
|
|
62
|
+
*/
|
|
63
|
+
function AccordionIcon({ asChild, className, ...props }: AccordionIconProps): JSX.Element {
|
|
64
|
+
const Component = (asChild ? Slot : ChevronDownIcon) as typeof Slot;
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Component
|
|
68
|
+
aria-hidden
|
|
69
|
+
className={cn(
|
|
70
|
+
"size-4 shrink-0 text-muted-foreground",
|
|
71
|
+
"translate-y-0.5 transition-transform duration-300 ease-spring",
|
|
72
|
+
"motion-reduce:transition-none motion-reduce:duration-0",
|
|
73
|
+
className,
|
|
74
|
+
)}
|
|
75
|
+
data-slot="accordion-icon"
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* -----------------------------------------------------------------------------
|
|
82
|
+
* Component: AccordionTrigger
|
|
83
|
+
* -------------------------------------------------------------------------- */
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @since 0.3.16-canary.0
|
|
87
|
+
*/
|
|
88
|
+
type AccordionTriggerProps = ComponentProps<typeof AccordionPrimitive.Trigger>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @since 0.3.16-canary.0
|
|
92
|
+
*/
|
|
93
|
+
function AccordionTrigger({ children, className, ...props }: AccordionTriggerProps): JSX.Element {
|
|
94
|
+
return (
|
|
95
|
+
<AccordionPrimitive.Header className="flex" data-slot="accordion-trigger-wrapper">
|
|
96
|
+
<AccordionPrimitive.Trigger
|
|
97
|
+
className={cn(
|
|
98
|
+
"group/accordion-trigger flex grow items-start justify-between gap-4 py-4",
|
|
99
|
+
"rounded-md outline-hidden",
|
|
100
|
+
"text-left text-sm font-medium",
|
|
101
|
+
"hover:not-disabled:underline",
|
|
102
|
+
"focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
103
|
+
"disabled:opacity-50",
|
|
104
|
+
"[&[data-state=open]>svg]:rotate-180",
|
|
105
|
+
className,
|
|
106
|
+
)}
|
|
107
|
+
data-slot="accordion-trigger"
|
|
108
|
+
{...props}
|
|
109
|
+
>
|
|
110
|
+
{children}
|
|
111
|
+
</AccordionPrimitive.Trigger>
|
|
112
|
+
</AccordionPrimitive.Header>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* -----------------------------------------------------------------------------
|
|
117
|
+
* Component: AccordionContent
|
|
118
|
+
* -------------------------------------------------------------------------- */
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @since 0.3.16-canary.0
|
|
122
|
+
*/
|
|
123
|
+
type AccordionContentProps = ComponentProps<typeof AccordionPrimitive.Content>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @since 0.3.16-canary.0
|
|
127
|
+
*/
|
|
128
|
+
function AccordionContent({ children, className, ...props }: AccordionContentProps): JSX.Element {
|
|
129
|
+
return (
|
|
130
|
+
<AccordionPrimitive.Content
|
|
131
|
+
className={cn(
|
|
132
|
+
"overflow-hidden",
|
|
133
|
+
"data-open:animate-collapsible-down data-open:ease-snappy",
|
|
134
|
+
"data-closed:animate-collapsible-up data-closed:ease-snappy",
|
|
135
|
+
"motion-reduce:animate-none motion-reduce:transition-none",
|
|
136
|
+
)}
|
|
137
|
+
data-slot="accordion-content"
|
|
138
|
+
{...props}
|
|
139
|
+
>
|
|
140
|
+
<div className={cn("pt-0 pb-4", "text-sm", className)}>{children}</div>
|
|
141
|
+
</AccordionPrimitive.Content>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* -----------------------------------------------------------------------------
|
|
146
|
+
* Exports
|
|
147
|
+
* -------------------------------------------------------------------------- */
|
|
148
|
+
|
|
149
|
+
export { Accordion, AccordionContent, AccordionIcon, AccordionItem, AccordionTrigger };
|
|
150
|
+
export type {
|
|
151
|
+
AccordionContentProps,
|
|
152
|
+
AccordionIconProps,
|
|
153
|
+
AccordionItemProps,
|
|
154
|
+
AccordionProps,
|
|
155
|
+
AccordionTriggerProps,
|
|
156
|
+
};
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { VariantProps } from "#/lib/utils";
|
|
4
|
+
import type { ComponentProps, JSX } from "react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "#/lib/utils";
|
|
7
|
+
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
8
|
+
|
|
9
|
+
import { buttonVariants } from "#/variants/button";
|
|
10
|
+
|
|
11
|
+
/* -----------------------------------------------------------------------------
|
|
12
|
+
* Component: AlertDialog
|
|
13
|
+
* -------------------------------------------------------------------------- */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.3.16-canary.0
|
|
17
|
+
*/
|
|
18
|
+
type AlertDialogProps = ComponentProps<typeof AlertDialogPrimitive.Root>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
23
|
+
function AlertDialog({ ...props }: AlertDialogProps): JSX.Element {
|
|
24
|
+
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* -----------------------------------------------------------------------------
|
|
28
|
+
* Component: AlertDialogTrigger
|
|
29
|
+
* -------------------------------------------------------------------------- */
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.3.16-canary.0
|
|
33
|
+
*/
|
|
34
|
+
type AlertDialogTriggerProps = ComponentProps<typeof AlertDialogPrimitive.Trigger>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @since 0.3.16-canary.0
|
|
38
|
+
*/
|
|
39
|
+
function AlertDialogTrigger({ ...props }: AlertDialogTriggerProps): JSX.Element {
|
|
40
|
+
return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* -----------------------------------------------------------------------------
|
|
44
|
+
* Component: AlertDialogContent
|
|
45
|
+
* -------------------------------------------------------------------------- */
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @since 0.3.16-canary.0
|
|
49
|
+
*/
|
|
50
|
+
interface AlertDialogContentProps extends ComponentProps<typeof AlertDialogPrimitive.Content> {
|
|
51
|
+
classNames?: {
|
|
52
|
+
content?: string;
|
|
53
|
+
overlay?: string;
|
|
54
|
+
wrapper?: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @since 0.3.16-canary.0
|
|
60
|
+
*/
|
|
61
|
+
function AlertDialogContent({
|
|
62
|
+
children,
|
|
63
|
+
className,
|
|
64
|
+
classNames,
|
|
65
|
+
...props
|
|
66
|
+
}: AlertDialogContentProps): JSX.Element {
|
|
67
|
+
return (
|
|
68
|
+
<AlertDialogPrimitive.Portal>
|
|
69
|
+
<AlertDialogPrimitive.Overlay
|
|
70
|
+
className={cn(
|
|
71
|
+
"fixed inset-0 z-50",
|
|
72
|
+
"bg-black/50",
|
|
73
|
+
"ease-ui data-open:animate-in data-open:fade-in-0",
|
|
74
|
+
"data-closed:animate-out data-closed:fade-out-0",
|
|
75
|
+
"motion-reduce:animate-none motion-reduce:transition-none",
|
|
76
|
+
classNames?.overlay,
|
|
77
|
+
)}
|
|
78
|
+
data-slot="alert-dialog-overlay"
|
|
79
|
+
/>
|
|
80
|
+
<AlertDialogPrimitive.Content
|
|
81
|
+
className={cn(
|
|
82
|
+
"fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center overflow-auto p-8",
|
|
83
|
+
"sm:grid-rows-[1fr_auto_3fr] sm:p-4",
|
|
84
|
+
"ease-ui data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
|
|
85
|
+
"data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
86
|
+
"motion-reduce:animate-none motion-reduce:transition-none",
|
|
87
|
+
classNames?.wrapper,
|
|
88
|
+
)}
|
|
89
|
+
data-slot="alert-dialog-content-wrapper"
|
|
90
|
+
{...props}
|
|
91
|
+
>
|
|
92
|
+
<div
|
|
93
|
+
className={cn(
|
|
94
|
+
"relative row-start-2 flex w-full max-w-lg flex-col",
|
|
95
|
+
"rounded-2xl border",
|
|
96
|
+
"bg-popover text-popover-foreground shadow-lg",
|
|
97
|
+
classNames?.content,
|
|
98
|
+
className,
|
|
99
|
+
)}
|
|
100
|
+
data-slot="alert-dialog-content"
|
|
101
|
+
>
|
|
102
|
+
{children}
|
|
103
|
+
</div>
|
|
104
|
+
</AlertDialogPrimitive.Content>
|
|
105
|
+
</AlertDialogPrimitive.Portal>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* -----------------------------------------------------------------------------
|
|
110
|
+
* Component: AlertDialogHeader
|
|
111
|
+
* -------------------------------------------------------------------------- */
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @since 0.3.16-canary.0
|
|
115
|
+
*/
|
|
116
|
+
type AlertDialogHeaderProps = ComponentProps<"div">;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @since 0.3.16-canary.0
|
|
120
|
+
*/
|
|
121
|
+
function AlertDialogHeader({ className, ...props }: AlertDialogHeaderProps): JSX.Element {
|
|
122
|
+
return (
|
|
123
|
+
<div
|
|
124
|
+
className={cn(
|
|
125
|
+
"flex shrink-0 flex-col gap-1.5 px-6 pt-6 pb-4 text-center",
|
|
126
|
+
"sm:text-left",
|
|
127
|
+
className,
|
|
128
|
+
)}
|
|
129
|
+
data-slot="alert-dialog-header"
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* -----------------------------------------------------------------------------
|
|
136
|
+
* Component: DialogBody
|
|
137
|
+
* -------------------------------------------------------------------------- */
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @since 0.3.16-canary.0
|
|
141
|
+
*/
|
|
142
|
+
type AlertDialogBodyProps = ComponentProps<"div">;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @since 0.3.16-canary.0
|
|
146
|
+
*/
|
|
147
|
+
function AlertDialogBody({ className, ...props }: AlertDialogBodyProps): JSX.Element {
|
|
148
|
+
return (
|
|
149
|
+
<main
|
|
150
|
+
className={cn("overflow-auto", "px-6 py-2", className)}
|
|
151
|
+
data-slot="alert-dialog-body"
|
|
152
|
+
{...props}
|
|
153
|
+
/>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* -----------------------------------------------------------------------------
|
|
158
|
+
* Component: AlertDialogFooter
|
|
159
|
+
* -------------------------------------------------------------------------- */
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @since 0.3.16-canary.0
|
|
163
|
+
*/
|
|
164
|
+
type AlertDialogFooterProps = ComponentProps<"div">;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @since 0.3.16-canary.0
|
|
168
|
+
*/
|
|
169
|
+
function AlertDialogFooter({ className, ...props }: AlertDialogFooterProps): JSX.Element {
|
|
170
|
+
return (
|
|
171
|
+
<div
|
|
172
|
+
className={cn(
|
|
173
|
+
"flex shrink-0 flex-col-reverse gap-2 px-6 pt-4 pb-6",
|
|
174
|
+
"sm:flex-row sm:justify-end",
|
|
175
|
+
className,
|
|
176
|
+
)}
|
|
177
|
+
data-slot="alert-dialog-footer"
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* -----------------------------------------------------------------------------
|
|
184
|
+
* Component: AlertDialogTitle
|
|
185
|
+
* -------------------------------------------------------------------------- */
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @since 0.3.16-canary.0
|
|
189
|
+
*/
|
|
190
|
+
type AlertDialogTitleProps = ComponentProps<typeof AlertDialogPrimitive.Title>;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @since 0.3.16-canary.0
|
|
194
|
+
*/
|
|
195
|
+
function AlertDialogTitle({ className, ...props }: AlertDialogTitleProps): JSX.Element {
|
|
196
|
+
return (
|
|
197
|
+
<AlertDialogPrimitive.Title
|
|
198
|
+
className={cn("text-lg leading-none font-semibold tracking-tight", className)}
|
|
199
|
+
data-slot="alert-dialog-title"
|
|
200
|
+
{...props}
|
|
201
|
+
/>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* -----------------------------------------------------------------------------
|
|
206
|
+
* Component: AlertDialogDescription
|
|
207
|
+
* -------------------------------------------------------------------------- */
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* @since 0.3.16-canary.0
|
|
211
|
+
*/
|
|
212
|
+
type AlertDialogDescriptionProps = ComponentProps<typeof AlertDialogPrimitive.Description>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* @since 0.3.16-canary.0
|
|
216
|
+
*/
|
|
217
|
+
function AlertDialogDescription({ className, ...props }: AlertDialogDescriptionProps): JSX.Element {
|
|
218
|
+
return (
|
|
219
|
+
<AlertDialogPrimitive.Description
|
|
220
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
221
|
+
data-slot="alert-dialog-description"
|
|
222
|
+
{...props}
|
|
223
|
+
/>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* -----------------------------------------------------------------------------
|
|
228
|
+
* Component: AlertDialogAction
|
|
229
|
+
* -------------------------------------------------------------------------- */
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @since 0.3.16-canary.0
|
|
233
|
+
*/
|
|
234
|
+
interface AlertDialogActionProps extends ComponentProps<typeof AlertDialogPrimitive.Action> {
|
|
235
|
+
size?: VariantProps<typeof buttonVariants>["size"];
|
|
236
|
+
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @since 0.3.16-canary.0
|
|
241
|
+
*/
|
|
242
|
+
function AlertDialogAction({
|
|
243
|
+
className,
|
|
244
|
+
size,
|
|
245
|
+
variant,
|
|
246
|
+
...props
|
|
247
|
+
}: AlertDialogActionProps): JSX.Element {
|
|
248
|
+
return (
|
|
249
|
+
<AlertDialogPrimitive.Action
|
|
250
|
+
className={buttonVariants({ className, size, variant })}
|
|
251
|
+
data-slot="alert-dialog-action"
|
|
252
|
+
{...props}
|
|
253
|
+
/>
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* -----------------------------------------------------------------------------
|
|
258
|
+
* Component: AlertDialogCancel
|
|
259
|
+
* -------------------------------------------------------------------------- */
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @since 0.3.16-canary.0
|
|
263
|
+
*/
|
|
264
|
+
interface AlertDialogCancelProps extends ComponentProps<typeof AlertDialogPrimitive.Cancel> {
|
|
265
|
+
size?: VariantProps<typeof buttonVariants>["size"];
|
|
266
|
+
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* @since 0.3.16-canary.0
|
|
271
|
+
*/
|
|
272
|
+
function AlertDialogCancel({
|
|
273
|
+
className,
|
|
274
|
+
size,
|
|
275
|
+
variant,
|
|
276
|
+
...props
|
|
277
|
+
}: AlertDialogCancelProps): JSX.Element {
|
|
278
|
+
return (
|
|
279
|
+
<AlertDialogPrimitive.Cancel
|
|
280
|
+
className={buttonVariants({ className, size, variant })}
|
|
281
|
+
data-slot="alert-dialog-cancel"
|
|
282
|
+
{...props}
|
|
283
|
+
/>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* -----------------------------------------------------------------------------
|
|
288
|
+
* Exports
|
|
289
|
+
* -------------------------------------------------------------------------- */
|
|
290
|
+
|
|
291
|
+
export {
|
|
292
|
+
AlertDialog,
|
|
293
|
+
AlertDialogAction,
|
|
294
|
+
AlertDialogBody,
|
|
295
|
+
AlertDialogCancel,
|
|
296
|
+
AlertDialogContent,
|
|
297
|
+
AlertDialogDescription,
|
|
298
|
+
AlertDialogFooter,
|
|
299
|
+
AlertDialogHeader,
|
|
300
|
+
AlertDialogTitle,
|
|
301
|
+
AlertDialogTrigger,
|
|
302
|
+
};
|
|
303
|
+
export type {
|
|
304
|
+
AlertDialogActionProps,
|
|
305
|
+
AlertDialogBodyProps,
|
|
306
|
+
AlertDialogCancelProps,
|
|
307
|
+
AlertDialogContentProps,
|
|
308
|
+
AlertDialogDescriptionProps,
|
|
309
|
+
AlertDialogFooterProps,
|
|
310
|
+
AlertDialogHeaderProps,
|
|
311
|
+
AlertDialogProps,
|
|
312
|
+
AlertDialogTitleProps,
|
|
313
|
+
AlertDialogTriggerProps,
|
|
314
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { AlertVariants } from "#/variants/alert";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "#/lib/utils";
|
|
5
|
+
|
|
6
|
+
import { alertVariants } from "#/variants/alert";
|
|
7
|
+
|
|
8
|
+
/* -----------------------------------------------------------------------------
|
|
9
|
+
* Component: Alert
|
|
10
|
+
* -------------------------------------------------------------------------- */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @since 0.3.16-canary.0
|
|
14
|
+
*/
|
|
15
|
+
interface AlertProps extends ComponentProps<"div">, AlertVariants {}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @since 0.3.16-canary.0
|
|
19
|
+
*/
|
|
20
|
+
function Alert({ className, variant, ...props }: AlertProps): JSX.Element {
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
className={alertVariants({ className, variant })}
|
|
24
|
+
data-slot="alert"
|
|
25
|
+
role="alert"
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* -----------------------------------------------------------------------------
|
|
32
|
+
* Component: AlertTitle
|
|
33
|
+
* -------------------------------------------------------------------------- */
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @since 0.3.16-canary.0
|
|
37
|
+
*/
|
|
38
|
+
type AlertTitleProps = ComponentProps<"div">;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @since 0.3.16-canary.0
|
|
42
|
+
*/
|
|
43
|
+
function AlertTitle({ children, className, ...props }: AlertTitleProps): JSX.Element {
|
|
44
|
+
return (
|
|
45
|
+
<div
|
|
46
|
+
className={cn("col-start-2 min-h-4", "line-clamp-1 font-medium tracking-tight", className)}
|
|
47
|
+
data-slot="alert-title"
|
|
48
|
+
{...props}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* -----------------------------------------------------------------------------
|
|
56
|
+
* Component: AlertDescription
|
|
57
|
+
* -------------------------------------------------------------------------- */
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @since 0.3.16-canary.0
|
|
61
|
+
*/
|
|
62
|
+
type AlertDescriptionProps = ComponentProps<"div">;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @since 0.3.16-canary.0
|
|
66
|
+
*/
|
|
67
|
+
function AlertDescription({ className, ...props }: AlertDescriptionProps): JSX.Element {
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
className={cn(
|
|
71
|
+
"col-start-2 grid justify-items-start gap-1 text-sm text-muted-foreground",
|
|
72
|
+
"[&_p]:leading-relaxed",
|
|
73
|
+
className,
|
|
74
|
+
)}
|
|
75
|
+
data-slot="alert-description"
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* -----------------------------------------------------------------------------
|
|
82
|
+
* Exports
|
|
83
|
+
* -------------------------------------------------------------------------- */
|
|
84
|
+
|
|
85
|
+
export { Alert, AlertDescription, AlertTitle };
|
|
86
|
+
export type { AlertDescriptionProps, AlertProps, AlertTitleProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, JSX } from "react";
|
|
4
|
+
|
|
5
|
+
import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
|
|
6
|
+
|
|
7
|
+
/* -----------------------------------------------------------------------------
|
|
8
|
+
* Component: AspectRatio
|
|
9
|
+
* -------------------------------------------------------------------------- */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @since 0.3.16-canary.0
|
|
13
|
+
*/
|
|
14
|
+
type AspectRatioProps = ComponentProps<typeof AspectRatioPrimitive.Root>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @since 0.3.16-canary.0
|
|
18
|
+
*/
|
|
19
|
+
function AspectRatio({ ...props }: AspectRatioProps): JSX.Element {
|
|
20
|
+
return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* -----------------------------------------------------------------------------
|
|
24
|
+
* Exports
|
|
25
|
+
* -------------------------------------------------------------------------- */
|
|
26
|
+
|
|
27
|
+
export { AspectRatio };
|
|
28
|
+
export type { AspectRatioProps };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, JSX } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "#/lib/utils";
|
|
6
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
7
|
+
|
|
8
|
+
/* -----------------------------------------------------------------------------
|
|
9
|
+
* Component: Avatar
|
|
10
|
+
* -------------------------------------------------------------------------- */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @since 0.3.16-canary.0
|
|
14
|
+
*/
|
|
15
|
+
type AvatarProps = ComponentProps<typeof AvatarPrimitive.Root>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @since 0.3.16-canary.0
|
|
19
|
+
*/
|
|
20
|
+
function Avatar({ className, ...props }: AvatarProps): JSX.Element {
|
|
21
|
+
return (
|
|
22
|
+
<AvatarPrimitive.Root
|
|
23
|
+
className={cn("relative flex size-8 shrink-0 overflow-hidden", "rounded-full", className)}
|
|
24
|
+
data-slot="avatar"
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* -----------------------------------------------------------------------------
|
|
31
|
+
* Component: AvatarImage
|
|
32
|
+
* -------------------------------------------------------------------------- */
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @since 0.3.16-canary.0
|
|
36
|
+
*/
|
|
37
|
+
type AvatarImageProps = ComponentProps<typeof AvatarPrimitive.Image>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @since 0.3.16-canary.0
|
|
41
|
+
*/
|
|
42
|
+
function AvatarImage({ className, ...props }: AvatarImageProps): JSX.Element {
|
|
43
|
+
return (
|
|
44
|
+
<AvatarPrimitive.Image
|
|
45
|
+
className={cn("aspect-square size-full", className)}
|
|
46
|
+
data-slot="avatar-image"
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* -----------------------------------------------------------------------------
|
|
53
|
+
* Component: AvatarFallback
|
|
54
|
+
* -------------------------------------------------------------------------- */
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @since 0.3.16-canary.0
|
|
58
|
+
*/
|
|
59
|
+
type AvatarFallbackProps = ComponentProps<typeof AvatarPrimitive.Fallback>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @since 0.3.16-canary.0
|
|
63
|
+
*/
|
|
64
|
+
function AvatarFallback({ className, ...props }: AvatarFallbackProps): JSX.Element {
|
|
65
|
+
return (
|
|
66
|
+
<AvatarPrimitive.Fallback
|
|
67
|
+
className={cn(
|
|
68
|
+
"flex size-full items-center justify-center",
|
|
69
|
+
"rounded-full",
|
|
70
|
+
"bg-muted",
|
|
71
|
+
className,
|
|
72
|
+
)}
|
|
73
|
+
data-slot="avatar-fallback"
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* -----------------------------------------------------------------------------
|
|
80
|
+
* Exports
|
|
81
|
+
* -------------------------------------------------------------------------- */
|
|
82
|
+
|
|
83
|
+
export { Avatar, AvatarFallback, AvatarImage };
|
|
84
|
+
export type { AvatarFallbackProps, AvatarImageProps, AvatarProps };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { BadgeVariants } from "#/variants/badge";
|
|
4
|
+
import type { ComponentProps, JSX } from "react";
|
|
5
|
+
|
|
6
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
7
|
+
|
|
8
|
+
import { badgeVariants } from "#/variants/badge";
|
|
9
|
+
|
|
10
|
+
/* -----------------------------------------------------------------------------
|
|
11
|
+
* Component: Badge
|
|
12
|
+
* -------------------------------------------------------------------------- */
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @since 0.3.16-canary.0
|
|
16
|
+
*/
|
|
17
|
+
interface BadgeProps extends ComponentProps<"span">, BadgeVariants {
|
|
18
|
+
asChild?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @since 0.3.16-canary.0
|
|
23
|
+
*/
|
|
24
|
+
function Badge({ asChild, className, variant, ...props }: BadgeProps): JSX.Element {
|
|
25
|
+
const Component = asChild ? Slot : "span";
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Component className={badgeVariants({ className, variant })} data-slot="badge" {...props} />
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* -----------------------------------------------------------------------------
|
|
33
|
+
* Exports
|
|
34
|
+
* -------------------------------------------------------------------------- */
|
|
35
|
+
|
|
36
|
+
export { Badge };
|
|
37
|
+
|
|
38
|
+
export type { BadgeProps };
|