@codefast/ui 0.3.16-canary.2 → 0.4.0-canary.4
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 +81 -0
- package/README.md +28 -17
- package/dist/components/accordion.d.mts +7 -22
- package/dist/components/accordion.mjs +26 -29
- package/dist/components/alert-dialog.d.mts +27 -26
- package/dist/components/alert-dialog.mjs +53 -45
- package/dist/components/alert.d.mts +14 -14
- package/dist/components/alert.mjs +17 -28
- package/dist/components/aspect-ratio.d.mts +2 -2
- package/dist/components/aspect-ratio.mjs +2 -3
- package/dist/components/avatar.d.mts +41 -5
- package/dist/components/avatar.mjs +40 -10
- package/dist/components/badge.d.mts +3 -15
- package/dist/components/badge.mjs +6 -48
- package/dist/components/breadcrumb.d.mts +1 -0
- package/dist/components/breadcrumb.mjs +11 -10
- package/dist/components/button-group.d.mts +3 -13
- package/dist/components/button-group.mjs +9 -31
- package/dist/components/button.d.mts +3 -26
- package/dist/components/button.mjs +9 -79
- package/dist/components/calendar.d.mts +6 -2
- package/dist/components/calendar.mjs +41 -44
- package/dist/components/card.d.mts +4 -2
- package/dist/components/card.mjs +9 -9
- package/dist/components/carousel.d.mts +16 -5
- package/dist/components/carousel.mjs +24 -11
- package/dist/components/chart.d.mts +9 -6
- package/dist/components/chart.mjs +21 -15
- package/dist/components/checkbox-cards.mjs +4 -4
- package/dist/components/checkbox-group.mjs +3 -4
- package/dist/components/checkbox.d.mts +2 -2
- package/dist/components/checkbox.mjs +6 -7
- package/dist/components/collapsible.d.mts +4 -4
- package/dist/components/collapsible.mjs +4 -5
- package/dist/components/command.d.mts +11 -1
- package/dist/components/command.mjs +35 -32
- package/dist/components/context-menu.d.mts +22 -15
- package/dist/components/context-menu.mjs +44 -39
- package/dist/components/dialog.d.mts +19 -23
- package/dist/components/dialog.mjs +48 -47
- package/dist/components/direction.d.mts +24 -0
- package/dist/components/direction.mjs +18 -0
- package/dist/components/drawer.d.mts +3 -21
- package/dist/components/drawer.mjs +19 -27
- package/dist/components/dropdown-menu.d.mts +22 -15
- package/dist/components/dropdown-menu.mjs +41 -37
- package/dist/components/empty.d.mts +3 -13
- package/dist/components/empty.mjs +8 -23
- package/dist/components/field.d.mts +3 -14
- package/dist/components/field.mjs +14 -44
- package/dist/components/form.d.mts +7 -10
- package/dist/components/form.mjs +6 -7
- package/dist/components/hover-card.d.mts +5 -5
- package/dist/components/hover-card.mjs +14 -12
- package/dist/components/input-group.d.mts +4 -31
- package/dist/components/input-group.mjs +14 -96
- package/dist/components/input-number.d.mts +3 -1
- package/dist/components/input-number.mjs +50 -28
- package/dist/components/input-otp.mjs +9 -7
- package/dist/components/input-password.mjs +1 -4
- package/dist/components/input-search.mjs +3 -5
- package/dist/components/input.mjs +1 -2
- package/dist/components/item.d.mts +4 -29
- package/dist/components/item.mjs +12 -65
- package/dist/components/kbd.mjs +1 -1
- package/dist/components/label.d.mts +2 -2
- package/dist/components/label.mjs +3 -4
- package/dist/components/menubar.d.mts +22 -16
- package/dist/components/menubar.mjs +54 -47
- package/dist/components/native-select.d.mts +5 -1
- package/dist/components/native-select.mjs +9 -6
- package/dist/components/navigation-menu.d.mts +30 -13
- package/dist/components/navigation-menu.mjs +35 -32
- package/dist/components/pagination.d.mts +7 -1
- package/dist/components/pagination.mjs +27 -12
- package/dist/components/popover.d.mts +40 -7
- package/dist/components/popover.mjs +46 -14
- package/dist/components/progress-circle.d.mts +3 -47
- package/dist/components/progress-circle.mjs +2 -48
- package/dist/components/progress.d.mts +2 -2
- package/dist/components/progress.mjs +5 -6
- package/dist/components/radio-cards.d.mts +3 -3
- package/dist/components/radio-cards.mjs +11 -11
- package/dist/components/radio-group.d.mts +3 -3
- package/dist/components/radio-group.mjs +9 -9
- package/dist/components/radio.mjs +2 -3
- package/dist/components/resizable.mjs +3 -8
- package/dist/components/scroll-area.d.mts +8 -24
- package/dist/components/scroll-area.mjs +16 -70
- package/dist/components/select.d.mts +14 -14
- package/dist/components/select.mjs +47 -47
- package/dist/components/separator.d.mts +4 -19
- package/dist/components/separator.mjs +6 -27
- package/dist/components/sheet.d.mts +18 -31
- package/dist/components/sheet.mjs +46 -87
- package/dist/components/sidebar.d.mts +3 -19
- package/dist/components/sidebar.mjs +48 -84
- package/dist/components/skeleton.mjs +1 -1
- package/dist/components/slider.d.mts +2 -2
- package/dist/components/slider.mjs +9 -11
- package/dist/components/sonner.mjs +11 -3
- package/dist/components/spinner.mjs +6 -7
- package/dist/components/switch.d.mts +5 -2
- package/dist/components/switch.mjs +7 -7
- package/dist/components/table.mjs +10 -10
- package/dist/components/tabs.d.mts +8 -5
- package/dist/components/tabs.mjs +18 -12
- package/dist/components/textarea.mjs +1 -1
- package/dist/components/toggle-group.d.mts +11 -7
- package/dist/components/toggle-group.mjs +20 -21
- package/dist/components/toggle.d.mts +4 -24
- package/dist/components/toggle.mjs +6 -45
- package/dist/components/tooltip.d.mts +7 -6
- package/dist/components/tooltip.mjs +19 -17
- package/dist/hooks/use-animated-value.mjs +0 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +0 -1
- package/dist/hooks/use-is-mobile.mjs +0 -1
- package/dist/hooks/use-media-query.mjs +0 -1
- package/dist/hooks/use-mutation-observer.mjs +0 -1
- package/dist/hooks/use-pagination.mjs +0 -1
- package/dist/index.d.mts +38 -21
- package/dist/index.mjs +40 -23
- package/dist/lib/utils.d.mts +1 -12
- package/dist/lib/utils.mjs +1 -9
- package/dist/primitives/checkbox-group.d.mts +9 -11
- package/dist/primitives/checkbox-group.mjs +14 -19
- package/dist/primitives/input-number.d.mts +3 -4
- package/dist/primitives/input-number.mjs +3 -5
- package/dist/primitives/input.d.mts +4 -5
- package/dist/primitives/input.mjs +2 -3
- package/dist/primitives/progress-circle.d.mts +3 -4
- package/dist/primitives/progress-circle.mjs +2 -3
- package/dist/variants/alert.d.mts +18 -0
- package/dist/variants/alert.mjs +15 -0
- package/dist/variants/badge.d.mts +22 -0
- package/dist/variants/badge.mjs +19 -0
- package/dist/variants/button-group.d.mts +18 -0
- package/dist/variants/button-group.mjs +15 -0
- package/dist/variants/button.d.mts +32 -0
- package/dist/variants/button.mjs +34 -0
- package/dist/variants/empty.d.mts +18 -0
- package/dist/variants/empty.mjs +15 -0
- package/dist/variants/field.d.mts +19 -0
- package/dist/variants/field.mjs +16 -0
- package/dist/variants/input-group.d.mts +43 -0
- package/dist/variants/input-group.mjs +34 -0
- package/dist/variants/input-number.d.mts +45 -0
- package/dist/variants/input-number.mjs +40 -0
- package/dist/variants/item.d.mts +38 -0
- package/dist/variants/item.mjs +38 -0
- package/dist/variants/navigation-menu.d.mts +13 -0
- package/dist/variants/navigation-menu.mjs +8 -0
- package/dist/variants/progress-circle.d.mts +52 -0
- package/dist/variants/progress-circle.mjs +45 -0
- package/dist/variants/scroll-area.d.mts +24 -0
- package/dist/variants/scroll-area.mjs +58 -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 +17 -0
- package/dist/variants/sidebar.d.mts +23 -0
- package/dist/variants/sidebar.mjs +25 -0
- package/dist/variants/tabs.d.mts +18 -0
- package/dist/variants/tabs.mjs +15 -0
- package/dist/variants/toggle.d.mts +23 -0
- package/dist/variants/toggle.mjs +25 -0
- package/package.json +186 -55
- package/src/components/accordion.tsx +114 -0
- package/src/components/alert-dialog.tsx +298 -0
- package/src/components/alert.tsx +94 -0
- package/src/components/aspect-ratio.tsx +25 -0
- package/src/components/avatar.tsx +171 -0
- package/src/components/badge.tsx +35 -0
- package/src/components/breadcrumb.tsx +191 -0
- package/src/components/button-group.tsx +97 -0
- package/src/components/button.tsx +55 -0
- package/src/components/calendar.tsx +222 -0
- package/src/components/card.tsx +169 -0
- package/src/components/carousel.tsx +349 -0
- package/src/components/chart.tsx +536 -0
- package/src/components/checkbox-cards.tsx +72 -0
- package/src/components/checkbox-group.tsx +60 -0
- package/src/components/checkbox.tsx +44 -0
- package/src/components/collapsible.tsx +57 -0
- package/src/components/command.tsx +298 -0
- package/src/components/context-menu.tsx +410 -0
- package/src/components/dialog.tsx +243 -0
- package/src/components/direction.tsx +32 -0
- package/src/components/drawer.tsx +209 -0
- package/src/components/dropdown-menu.tsx +419 -0
- package/src/components/empty.tsx +155 -0
- package/src/components/field.tsx +329 -0
- package/src/components/form.tsx +258 -0
- package/src/components/hover-card.tsx +93 -0
- package/src/components/input-group.tsx +185 -0
- package/src/components/input-number.tsx +141 -0
- package/src/components/input-otp.tsx +132 -0
- package/src/components/input-password.tsx +50 -0
- package/src/components/input-search.tsx +81 -0
- package/src/components/input.tsx +36 -0
- package/src/components/item.tsx +266 -0
- package/src/components/kbd.tsx +47 -0
- package/src/components/label.tsx +36 -0
- package/src/components/menubar.tsx +440 -0
- package/src/components/native-select.tsx +87 -0
- package/src/components/navigation-menu.tsx +235 -0
- package/src/components/pagination.tsx +198 -0
- package/src/components/popover.tsx +170 -0
- package/src/components/progress-circle.tsx +185 -0
- package/src/components/progress.tsx +41 -0
- package/src/components/radio-cards.tsx +66 -0
- package/src/components/radio-group.tsx +59 -0
- package/src/components/radio.tsx +40 -0
- package/src/components/resizable.tsx +78 -0
- package/src/components/scroll-area.tsx +95 -0
- package/src/components/select.tsx +296 -0
- package/src/components/separator.tsx +60 -0
- package/src/components/sheet.tsx +241 -0
- package/src/components/sidebar.tsx +926 -0
- package/src/components/skeleton.tsx +35 -0
- package/src/components/slider.tsx +66 -0
- package/src/components/sonner.tsx +57 -0
- package/src/components/spinner.tsx +66 -0
- package/src/components/switch.tsx +44 -0
- package/src/components/table.tsx +183 -0
- package/src/components/tabs.tsx +110 -0
- package/src/components/textarea.tsx +35 -0
- package/src/components/toggle-group.tsx +137 -0
- package/src/components/toggle.tsx +30 -0
- package/src/components/tooltip.tsx +115 -0
- package/src/css/foundation/base.css +50 -0
- package/src/css/foundation/motion.css +36 -0
- package/src/css/foundation/source.css +3 -0
- package/src/css/foundation/tokens.css +71 -0
- package/src/css/foundation/variants.css +113 -0
- package/src/css/preset.css +5 -195
- package/src/css/style.css +1 -1
- package/src/css/{amber.css → themes/amber.css} +59 -22
- package/src/css/{blue.css → themes/blue.css} +59 -22
- package/src/css/{cyan.css → themes/cyan.css} +59 -22
- package/src/css/{emerald.css → themes/emerald.css} +59 -22
- package/src/css/{fuchsia.css → themes/fuchsia.css} +59 -22
- package/src/css/{gray.css → themes/gray.css} +59 -22
- package/src/css/{green.css → themes/green.css} +59 -22
- package/src/css/{indigo.css → themes/indigo.css} +59 -22
- package/src/css/{lime.css → themes/lime.css} +59 -22
- package/src/css/{neutral.css → themes/neutral.css} +59 -22
- package/src/css/{orange.css → themes/orange.css} +59 -22
- package/src/css/{pink.css → themes/pink.css} +59 -22
- package/src/css/{purple.css → themes/purple.css} +59 -22
- package/src/css/{red.css → themes/red.css} +59 -22
- package/src/css/{rose.css → themes/rose.css} +59 -22
- package/src/css/{sky.css → themes/sky.css} +59 -22
- package/src/css/{slate.css → themes/slate.css} +59 -22
- package/src/css/{stone.css → themes/stone.css} +59 -22
- package/src/css/{teal.css → themes/teal.css} +59 -22
- package/src/css/{violet.css → themes/violet.css} +59 -22
- package/src/css/{yellow.css → themes/yellow.css} +59 -22
- package/src/css/{zinc.css → themes/zinc.css} +59 -22
- package/src/hooks/use-animated-value.ts +91 -0
- package/src/hooks/use-copy-to-clipboard.ts +58 -0
- package/src/hooks/use-is-mobile.ts +25 -0
- package/src/hooks/use-media-query.ts +69 -0
- package/src/hooks/use-mutation-observer.ts +51 -0
- package/src/hooks/use-pagination.ts +164 -0
- package/src/index.ts +679 -0
- package/src/lib/utils.ts +5 -0
- package/src/primitives/checkbox-group.tsx +346 -0
- package/src/primitives/input-number.tsx +967 -0
- package/src/primitives/input.tsx +227 -0
- package/src/primitives/progress-circle.tsx +507 -0
- package/src/variants/alert.ts +34 -0
- package/src/variants/badge.ts +39 -0
- package/src/variants/button-group.ts +36 -0
- package/src/variants/button.ts +56 -0
- package/src/variants/empty.ts +34 -0
- package/src/variants/field.ts +37 -0
- package/src/variants/input-group.ts +80 -0
- package/src/variants/input-number.ts +65 -0
- package/src/variants/item.ts +68 -0
- package/src/variants/navigation-menu.ts +25 -0
- package/src/variants/progress-circle.ts +46 -0
- package/src/variants/scroll-area.ts +73 -0
- package/src/variants/separator.ts +40 -0
- package/src/variants/sheet.ts +37 -0
- package/src/variants/sidebar.ts +41 -0
- package/src/variants/tabs.ts +34 -0
- package/src/variants/toggle.ts +40 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts +0 -6
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Slot } from "radix-ui";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import type { BadgeVariants } from "#/variants/badge";
|
|
5
|
+
import { badgeVariants } from "#/variants/badge";
|
|
6
|
+
|
|
7
|
+
/* -----------------------------------------------------------------------------
|
|
8
|
+
* Component: Badge
|
|
9
|
+
* -------------------------------------------------------------------------- */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @since 0.3.16-canary.0
|
|
13
|
+
*/
|
|
14
|
+
interface BadgeProps extends ComponentProps<"span">, BadgeVariants {
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @since 0.3.16-canary.0
|
|
20
|
+
*/
|
|
21
|
+
function Badge({ asChild = false, className, variant = "default", ...props }: BadgeProps): JSX.Element {
|
|
22
|
+
const Component = asChild ? Slot.Root : "span";
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Component className={badgeVariants({ className, variant })} data-slot="badge" data-variant={variant} {...props} />
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* -----------------------------------------------------------------------------
|
|
30
|
+
* Exports
|
|
31
|
+
* -------------------------------------------------------------------------- */
|
|
32
|
+
|
|
33
|
+
export { Badge };
|
|
34
|
+
|
|
35
|
+
export type { BadgeProps };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
|
|
2
|
+
import { Slot } from "radix-ui";
|
|
3
|
+
import type { ComponentProps, JSX, ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
import { cn } from "#/lib/utils";
|
|
6
|
+
|
|
7
|
+
/* -----------------------------------------------------------------------------
|
|
8
|
+
* Component: Breadcrumb
|
|
9
|
+
* -------------------------------------------------------------------------- */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @since 0.3.16-canary.0
|
|
13
|
+
*/
|
|
14
|
+
interface BreadcrumbProps extends ComponentProps<"nav"> {
|
|
15
|
+
separator?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @since 0.3.16-canary.0
|
|
20
|
+
*/
|
|
21
|
+
function Breadcrumb({ ...props }: BreadcrumbProps): JSX.Element {
|
|
22
|
+
return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* -----------------------------------------------------------------------------
|
|
26
|
+
* Component: BreadcrumbList
|
|
27
|
+
* -------------------------------------------------------------------------- */
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @since 0.3.16-canary.0
|
|
31
|
+
*/
|
|
32
|
+
type BreadcrumbListProps = ComponentProps<"ol">;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @since 0.3.16-canary.0
|
|
36
|
+
*/
|
|
37
|
+
function BreadcrumbList({ className, ...props }: BreadcrumbListProps): JSX.Element {
|
|
38
|
+
return (
|
|
39
|
+
<ol
|
|
40
|
+
className={cn(
|
|
41
|
+
"flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground sm:gap-2.5",
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
data-slot="breadcrumb-list"
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* -----------------------------------------------------------------------------
|
|
51
|
+
* Component: BreadcrumbItem
|
|
52
|
+
* -------------------------------------------------------------------------- */
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @since 0.3.16-canary.0
|
|
56
|
+
*/
|
|
57
|
+
type BreadcrumbItemProps = ComponentProps<"li">;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @since 0.3.16-canary.0
|
|
61
|
+
*/
|
|
62
|
+
function BreadcrumbItem({ className, ...props }: BreadcrumbItemProps): JSX.Element {
|
|
63
|
+
return <li className={cn("inline-flex items-center gap-1.5", className)} data-slot="breadcrumb-item" {...props} />;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* -----------------------------------------------------------------------------
|
|
67
|
+
* Component: BreadcrumbLink
|
|
68
|
+
* -------------------------------------------------------------------------- */
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @since 0.3.16-canary.0
|
|
72
|
+
*/
|
|
73
|
+
interface BreadcrumbLinkProps extends ComponentProps<"a"> {
|
|
74
|
+
asChild?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @since 0.3.16-canary.0
|
|
79
|
+
*/
|
|
80
|
+
function BreadcrumbLink({ asChild, className, ...props }: BreadcrumbLinkProps): JSX.Element {
|
|
81
|
+
const Component = asChild ? Slot.Root : "a";
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Component
|
|
85
|
+
className={cn("transition-colors hover:text-foreground", className)}
|
|
86
|
+
data-slot="breadcrumb-link"
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* -----------------------------------------------------------------------------
|
|
93
|
+
* Component: BreadcrumbPage
|
|
94
|
+
* -------------------------------------------------------------------------- */
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @since 0.3.16-canary.0
|
|
98
|
+
*/
|
|
99
|
+
type BreadcrumbPageProps = ComponentProps<"span">;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @since 0.3.16-canary.0
|
|
103
|
+
*/
|
|
104
|
+
function BreadcrumbPage({ className, ...props }: BreadcrumbPageProps): JSX.Element {
|
|
105
|
+
return (
|
|
106
|
+
<span
|
|
107
|
+
aria-current="page"
|
|
108
|
+
aria-disabled="true"
|
|
109
|
+
className={cn("font-normal text-foreground", className)}
|
|
110
|
+
data-slot="breadcrumb-page"
|
|
111
|
+
role="link"
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* -----------------------------------------------------------------------------
|
|
118
|
+
* Component: BreadcrumbSeparator
|
|
119
|
+
* -------------------------------------------------------------------------- */
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @since 0.3.16-canary.0
|
|
123
|
+
*/
|
|
124
|
+
type BreadcrumbSeparatorProps = ComponentProps<"li">;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @since 0.3.16-canary.0
|
|
128
|
+
*/
|
|
129
|
+
function BreadcrumbSeparator({ children, className, ...props }: BreadcrumbSeparatorProps): JSX.Element {
|
|
130
|
+
return (
|
|
131
|
+
<li
|
|
132
|
+
aria-hidden="true"
|
|
133
|
+
className={cn("[&>svg]:size-3.5", className)}
|
|
134
|
+
data-slot="breadcrumb-separator"
|
|
135
|
+
role="presentation"
|
|
136
|
+
{...props}
|
|
137
|
+
>
|
|
138
|
+
{children ?? <ChevronRightIcon className="rtl:rotate-180" />}
|
|
139
|
+
</li>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* -----------------------------------------------------------------------------
|
|
144
|
+
* Component: BreadcrumbEllipsis
|
|
145
|
+
* -------------------------------------------------------------------------- */
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @since 0.3.16-canary.0
|
|
149
|
+
*/
|
|
150
|
+
type BreadcrumbEllipsisProps = ComponentProps<"span">;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @since 0.3.16-canary.0
|
|
154
|
+
*/
|
|
155
|
+
function BreadcrumbEllipsis({ className, ...props }: BreadcrumbEllipsisProps): JSX.Element {
|
|
156
|
+
return (
|
|
157
|
+
<span
|
|
158
|
+
aria-hidden="true"
|
|
159
|
+
className={cn("flex size-5 items-center justify-center [&>svg]:size-4", className)}
|
|
160
|
+
data-slot="breadcrumb-ellipsis"
|
|
161
|
+
role="presentation"
|
|
162
|
+
{...props}
|
|
163
|
+
>
|
|
164
|
+
<MoreHorizontalIcon />
|
|
165
|
+
<span className="sr-only">More</span>
|
|
166
|
+
</span>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* -----------------------------------------------------------------------------
|
|
171
|
+
* Exports
|
|
172
|
+
* -------------------------------------------------------------------------- */
|
|
173
|
+
|
|
174
|
+
export {
|
|
175
|
+
Breadcrumb,
|
|
176
|
+
BreadcrumbEllipsis,
|
|
177
|
+
BreadcrumbItem,
|
|
178
|
+
BreadcrumbLink,
|
|
179
|
+
BreadcrumbList,
|
|
180
|
+
BreadcrumbPage,
|
|
181
|
+
BreadcrumbSeparator,
|
|
182
|
+
};
|
|
183
|
+
export type {
|
|
184
|
+
BreadcrumbEllipsisProps,
|
|
185
|
+
BreadcrumbItemProps,
|
|
186
|
+
BreadcrumbLinkProps,
|
|
187
|
+
BreadcrumbListProps,
|
|
188
|
+
BreadcrumbPageProps,
|
|
189
|
+
BreadcrumbProps,
|
|
190
|
+
BreadcrumbSeparatorProps,
|
|
191
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Slot } from "radix-ui";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import { Separator } from "#/components/separator";
|
|
5
|
+
import { cn } from "#/lib/utils";
|
|
6
|
+
import type { ButtonGroupVariants } from "#/variants/button-group";
|
|
7
|
+
import { buttonGroupVariants } from "#/variants/button-group";
|
|
8
|
+
|
|
9
|
+
/* -----------------------------------------------------------------------------
|
|
10
|
+
* Component: ButtonGroup
|
|
11
|
+
* -------------------------------------------------------------------------- */
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @since 0.3.16-canary.0
|
|
15
|
+
*/
|
|
16
|
+
type ButtonGroupProps = ComponentProps<"div"> & ButtonGroupVariants;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @since 0.3.16-canary.0
|
|
20
|
+
*/
|
|
21
|
+
function ButtonGroup({ className, orientation, ...props }: ButtonGroupProps): JSX.Element {
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
className={buttonGroupVariants({ orientation, className })}
|
|
25
|
+
data-orientation={orientation}
|
|
26
|
+
data-slot="button-group"
|
|
27
|
+
role="group"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* -----------------------------------------------------------------------------
|
|
34
|
+
* Component: ButtonGroupText
|
|
35
|
+
* -------------------------------------------------------------------------- */
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @since 0.3.16-canary.0
|
|
39
|
+
*/
|
|
40
|
+
interface ButtonGroupTextProps extends ComponentProps<"div"> {
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @since 0.3.16-canary.0
|
|
46
|
+
*/
|
|
47
|
+
function ButtonGroupText({ asChild = false, className, ...props }: ButtonGroupTextProps): JSX.Element {
|
|
48
|
+
const Component = asChild ? Slot.Root : "div";
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Component
|
|
52
|
+
className={cn(
|
|
53
|
+
"flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
54
|
+
className,
|
|
55
|
+
)}
|
|
56
|
+
{...props}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* -----------------------------------------------------------------------------
|
|
62
|
+
* Component: ButtonGroupSeparator
|
|
63
|
+
* -------------------------------------------------------------------------- */
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @since 0.3.16-canary.0
|
|
67
|
+
*/
|
|
68
|
+
type ButtonGroupSeparatorProps = ComponentProps<typeof Separator>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @since 0.3.16-canary.0
|
|
72
|
+
*/
|
|
73
|
+
function ButtonGroupSeparator({
|
|
74
|
+
className,
|
|
75
|
+
orientation = "vertical",
|
|
76
|
+
...props
|
|
77
|
+
}: ButtonGroupSeparatorProps): JSX.Element {
|
|
78
|
+
return (
|
|
79
|
+
<Separator
|
|
80
|
+
className={cn(
|
|
81
|
+
"relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto",
|
|
82
|
+
className,
|
|
83
|
+
)}
|
|
84
|
+
data-slot="button-group-separator"
|
|
85
|
+
orientation={orientation}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* -----------------------------------------------------------------------------
|
|
92
|
+
* Exports
|
|
93
|
+
* -------------------------------------------------------------------------- */
|
|
94
|
+
|
|
95
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText };
|
|
96
|
+
|
|
97
|
+
export type { ButtonGroupProps, ButtonGroupSeparatorProps, ButtonGroupTextProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Slot } from "radix-ui";
|
|
2
|
+
import type { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
import type { ButtonVariants } from "#/variants/button";
|
|
5
|
+
import { buttonVariants } from "#/variants/button";
|
|
6
|
+
|
|
7
|
+
/* -----------------------------------------------------------------------------
|
|
8
|
+
* Component: Button
|
|
9
|
+
* -------------------------------------------------------------------------- */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @since 0.3.16-canary.0
|
|
13
|
+
*/
|
|
14
|
+
type ButtonProps = ComponentProps<"button"> &
|
|
15
|
+
ButtonVariants & {
|
|
16
|
+
asChild?: boolean;
|
|
17
|
+
type?: ComponentProps<"button">["type"];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.3.16-canary.0
|
|
22
|
+
*/
|
|
23
|
+
function Button({ asChild = false, className, size, type = "button", variant, ...props }: ButtonProps): JSX.Element {
|
|
24
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
25
|
+
|
|
26
|
+
if (asChild) {
|
|
27
|
+
return (
|
|
28
|
+
<Comp
|
|
29
|
+
className={buttonVariants({ className, size, variant })}
|
|
30
|
+
data-size={size}
|
|
31
|
+
data-slot="button"
|
|
32
|
+
data-variant={variant}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<button
|
|
40
|
+
className={buttonVariants({ className, size, variant })}
|
|
41
|
+
data-size={size}
|
|
42
|
+
data-slot="button"
|
|
43
|
+
data-variant={variant}
|
|
44
|
+
type={type}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* -----------------------------------------------------------------------------
|
|
51
|
+
* Exports
|
|
52
|
+
* -------------------------------------------------------------------------- */
|
|
53
|
+
|
|
54
|
+
export { Button };
|
|
55
|
+
export type { ButtonProps };
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { Chevron, DayButton, Locale, Root, WeekNumber } from "@daypicker/react";
|
|
2
|
+
import { DayPicker, getDefaultClassNames } from "@daypicker/react";
|
|
3
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
4
|
+
import type { ComponentProps, JSX } from "react";
|
|
5
|
+
import { useEffect, useRef } from "react";
|
|
6
|
+
|
|
7
|
+
import { Button } from "#/components/button";
|
|
8
|
+
import { cn } from "#/lib/utils";
|
|
9
|
+
import { buttonVariants } from "#/variants/button";
|
|
10
|
+
|
|
11
|
+
/* -----------------------------------------------------------------------------
|
|
12
|
+
* Component: Calendar
|
|
13
|
+
* -------------------------------------------------------------------------- */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @since 0.3.16-canary.0
|
|
17
|
+
*/
|
|
18
|
+
type CalendarProps = ComponentProps<typeof DayPicker> & {
|
|
19
|
+
buttonVariant?: ComponentProps<typeof Button>["variant"];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @since 0.3.16-canary.0
|
|
24
|
+
*/
|
|
25
|
+
function Calendar({
|
|
26
|
+
buttonVariant = "ghost",
|
|
27
|
+
captionLayout = "label",
|
|
28
|
+
className,
|
|
29
|
+
classNames,
|
|
30
|
+
components,
|
|
31
|
+
formatters,
|
|
32
|
+
locale,
|
|
33
|
+
showOutsideDays = true,
|
|
34
|
+
...props
|
|
35
|
+
}: CalendarProps): JSX.Element {
|
|
36
|
+
const defaultClassNames = getDefaultClassNames();
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<DayPicker
|
|
40
|
+
captionLayout={captionLayout}
|
|
41
|
+
className={cn(
|
|
42
|
+
"group/calendar bg-background p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
|
|
43
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
44
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
45
|
+
className,
|
|
46
|
+
)}
|
|
47
|
+
classNames={{
|
|
48
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
49
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
50
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
51
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
52
|
+
button_previous: cn(
|
|
53
|
+
buttonVariants({ variant: buttonVariant }),
|
|
54
|
+
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
55
|
+
defaultClassNames.button_previous,
|
|
56
|
+
),
|
|
57
|
+
button_next: cn(
|
|
58
|
+
buttonVariants({ variant: buttonVariant }),
|
|
59
|
+
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
60
|
+
defaultClassNames.button_next,
|
|
61
|
+
),
|
|
62
|
+
month_caption: cn(
|
|
63
|
+
"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
|
|
64
|
+
defaultClassNames.month_caption,
|
|
65
|
+
),
|
|
66
|
+
dropdowns: cn(
|
|
67
|
+
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
68
|
+
defaultClassNames.dropdowns,
|
|
69
|
+
),
|
|
70
|
+
dropdown_root: cn(
|
|
71
|
+
"relative rounded-(--cell-radius) border border-input shadow-xs has-focus:border-ring has-focus:ring-3 has-focus:ring-ring/50",
|
|
72
|
+
defaultClassNames.dropdown_root,
|
|
73
|
+
),
|
|
74
|
+
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
75
|
+
caption_label: cn(
|
|
76
|
+
"font-medium select-none",
|
|
77
|
+
captionLayout === "label"
|
|
78
|
+
? "text-sm"
|
|
79
|
+
: "flex h-8 items-center gap-1 rounded-(--cell-radius) pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
80
|
+
defaultClassNames.caption_label,
|
|
81
|
+
),
|
|
82
|
+
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
83
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
84
|
+
weekday: cn(
|
|
85
|
+
"flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",
|
|
86
|
+
defaultClassNames.weekday,
|
|
87
|
+
),
|
|
88
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
89
|
+
week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
|
|
90
|
+
week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
|
|
91
|
+
day: cn(
|
|
92
|
+
"group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
|
|
93
|
+
props.showWeekNumber
|
|
94
|
+
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)"
|
|
95
|
+
: "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
|
|
96
|
+
defaultClassNames.day,
|
|
97
|
+
),
|
|
98
|
+
range_start: cn(
|
|
99
|
+
"relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
|
|
100
|
+
defaultClassNames.range_start,
|
|
101
|
+
),
|
|
102
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
103
|
+
range_end: cn(
|
|
104
|
+
"relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
|
|
105
|
+
defaultClassNames.range_end,
|
|
106
|
+
),
|
|
107
|
+
today: cn(
|
|
108
|
+
"rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
|
|
109
|
+
defaultClassNames.today,
|
|
110
|
+
),
|
|
111
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
112
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
113
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
114
|
+
...classNames,
|
|
115
|
+
}}
|
|
116
|
+
components={{
|
|
117
|
+
Chevron: CalendarChevron,
|
|
118
|
+
DayButton: (dayButtonProps) => <CalendarDayButton locale={locale} {...dayButtonProps} />,
|
|
119
|
+
Root: CalendarRoot,
|
|
120
|
+
WeekNumber: CalendarWeekNumber,
|
|
121
|
+
...components,
|
|
122
|
+
}}
|
|
123
|
+
formatters={{
|
|
124
|
+
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
125
|
+
...formatters,
|
|
126
|
+
}}
|
|
127
|
+
locale={locale}
|
|
128
|
+
showOutsideDays={showOutsideDays}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* -----------------------------------------------------------------------------
|
|
135
|
+
* Component: CalendarChevron (internal)
|
|
136
|
+
* -------------------------------------------------------------------------- */
|
|
137
|
+
|
|
138
|
+
function CalendarChevron({ className, orientation, ...props }: ComponentProps<typeof Chevron>): JSX.Element {
|
|
139
|
+
if (orientation === "left") {
|
|
140
|
+
return <ChevronLeftIcon className={cn("size-4 rtl:rotate-180", className)} {...props} />;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (orientation === "right") {
|
|
144
|
+
return <ChevronRightIcon className={cn("size-4 rtl:rotate-180", className)} {...props} />;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return <ChevronDownIcon className={cn("size-4", className)} {...props} />;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* -----------------------------------------------------------------------------
|
|
151
|
+
* Component: CalendarRoot (internal)
|
|
152
|
+
* -------------------------------------------------------------------------- */
|
|
153
|
+
|
|
154
|
+
function CalendarRoot({ rootRef, ...props }: ComponentProps<typeof Root>): JSX.Element {
|
|
155
|
+
return <div ref={rootRef} data-slot="calendar" {...props} />;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* -----------------------------------------------------------------------------
|
|
159
|
+
* Component: CalendarWeekNumber (internal)
|
|
160
|
+
* -------------------------------------------------------------------------- */
|
|
161
|
+
|
|
162
|
+
function CalendarWeekNumber({ children, ...props }: ComponentProps<typeof WeekNumber>): JSX.Element {
|
|
163
|
+
return (
|
|
164
|
+
<td {...props}>
|
|
165
|
+
<div className="flex size-(--cell-size) items-center justify-center text-center">{children}</div>
|
|
166
|
+
</td>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* -----------------------------------------------------------------------------
|
|
171
|
+
* Component: CalendarDayButton
|
|
172
|
+
* -------------------------------------------------------------------------- */
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @since 0.3.16-canary.0
|
|
176
|
+
*/
|
|
177
|
+
type CalendarDayButtonProps = ComponentProps<typeof DayButton> & {
|
|
178
|
+
locale?: Partial<Locale>;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @since 0.3.16-canary.0
|
|
183
|
+
*/
|
|
184
|
+
function CalendarDayButton({ className, day, locale, modifiers, ...props }: CalendarDayButtonProps): JSX.Element {
|
|
185
|
+
const defaultClassNames = getDefaultClassNames();
|
|
186
|
+
|
|
187
|
+
const ref = useRef<HTMLButtonElement>(null);
|
|
188
|
+
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
if (modifiers.focused) {
|
|
191
|
+
ref.current?.focus();
|
|
192
|
+
}
|
|
193
|
+
}, [modifiers.focused]);
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<Button
|
|
197
|
+
ref={ref}
|
|
198
|
+
className={cn(
|
|
199
|
+
"relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-focused/day:relative group-data-focused/day:z-10 group-data-focused/day:border-ring group-data-focused/day:ring-3 group-data-focused/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70",
|
|
200
|
+
defaultClassNames.day,
|
|
201
|
+
className,
|
|
202
|
+
)}
|
|
203
|
+
data-day={day.date.toLocaleDateString(locale?.code)}
|
|
204
|
+
data-range-end={modifiers.range_end}
|
|
205
|
+
data-range-middle={modifiers.range_middle}
|
|
206
|
+
data-range-start={modifiers.range_start}
|
|
207
|
+
data-selected-single={
|
|
208
|
+
modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle
|
|
209
|
+
}
|
|
210
|
+
size="icon"
|
|
211
|
+
variant="ghost"
|
|
212
|
+
{...props}
|
|
213
|
+
/>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* -----------------------------------------------------------------------------
|
|
218
|
+
* Exports
|
|
219
|
+
* -------------------------------------------------------------------------- */
|
|
220
|
+
|
|
221
|
+
export { Calendar, CalendarDayButton };
|
|
222
|
+
export type { CalendarDayButtonProps, CalendarProps };
|