@codefast/ui 0.3.16-canary.3 → 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 +60 -0
- package/README.md +27 -16
- 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 +12 -2
- package/dist/components/alert.mjs +15 -6
- 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.mjs +4 -4
- package/dist/components/breadcrumb.d.mts +1 -0
- package/dist/components/breadcrumb.mjs +11 -10
- package/dist/components/button-group.d.mts +1 -1
- package/dist/components/button-group.mjs +6 -7
- package/dist/components/button.d.mts +0 -1
- package/dist/components/button.mjs +7 -7
- package/dist/components/calendar.d.mts +6 -2
- package/dist/components/calendar.mjs +39 -43
- package/dist/components/card.d.mts +4 -2
- package/dist/components/card.mjs +9 -9
- package/dist/components/carousel.d.mts +16 -4
- package/dist/components/carousel.mjs +24 -11
- package/dist/components/chart.d.mts +8 -3
- 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 +2 -20
- package/dist/components/drawer.mjs +17 -25
- package/dist/components/dropdown-menu.d.mts +22 -15
- package/dist/components/dropdown-menu.mjs +41 -37
- package/dist/components/empty.mjs +5 -5
- package/dist/components/field.d.mts +1 -1
- package/dist/components/field.mjs +11 -12
- package/dist/components/form.d.mts +6 -7
- 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 +1 -1
- package/dist/components/input-group.mjs +12 -7
- package/dist/components/input-number.d.mts +3 -1
- package/dist/components/input-number.mjs +49 -27
- 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.mjs +9 -9
- 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 -8
- package/dist/components/navigation-menu.mjs +33 -23
- package/dist/components/pagination.d.mts +6 -0
- package/dist/components/pagination.mjs +26 -11
- package/dist/components/popover.d.mts +40 -7
- package/dist/components/popover.mjs +46 -14
- package/dist/components/progress-circle.d.mts +1 -1
- package/dist/components/progress-circle.mjs +1 -2
- 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 +5 -5
- package/dist/components/scroll-area.mjs +13 -10
- package/dist/components/select.d.mts +14 -14
- package/dist/components/select.mjs +47 -47
- package/dist/components/separator.d.mts +2 -2
- package/dist/components/separator.mjs +3 -4
- package/dist/components/sheet.d.mts +13 -14
- package/dist/components/sheet.mjs +41 -39
- package/dist/components/sidebar.d.mts +2 -3
- package/dist/components/sidebar.mjs +46 -46
- 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 +9 -6
- package/dist/components/toggle-group.mjs +19 -20
- package/dist/components/toggle.d.mts +2 -3
- package/dist/components/toggle.mjs +4 -6
- 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 +15 -13
- package/dist/index.mjs +18 -16
- package/dist/primitives/checkbox-group.d.mts +9 -10
- package/dist/primitives/checkbox-group.mjs +14 -19
- package/dist/primitives/input-number.d.mts +3 -3
- package/dist/primitives/input-number.mjs +3 -5
- package/dist/primitives/input.d.mts +4 -4
- package/dist/primitives/input.mjs +2 -3
- package/dist/primitives/progress-circle.d.mts +3 -3
- package/dist/primitives/progress-circle.mjs +2 -3
- package/dist/variants/alert.d.mts +1 -1
- package/dist/variants/alert.mjs +3 -13
- package/dist/variants/badge.d.mts +6 -4
- package/dist/variants/badge.mjs +7 -34
- package/dist/variants/button-group.d.mts +2 -2
- package/dist/variants/button-group.mjs +3 -14
- package/dist/variants/button.d.mts +12 -10
- package/dist/variants/button.mjs +15 -57
- package/dist/variants/empty.d.mts +1 -1
- package/dist/variants/empty.mjs +2 -7
- package/dist/variants/field.d.mts +3 -3
- package/dist/variants/field.mjs +4 -22
- package/dist/variants/input-group.d.mts +9 -9
- package/dist/variants/input-group.mjs +11 -70
- package/dist/variants/input-number.d.mts +45 -0
- package/dist/variants/input-number.mjs +40 -0
- package/dist/variants/item.d.mts +5 -4
- package/dist/variants/item.mjs +9 -31
- package/dist/variants/navigation-menu.d.mts +1 -1
- package/dist/variants/navigation-menu.mjs +1 -5
- package/dist/variants/progress-circle.d.mts +1 -1
- package/dist/variants/progress-circle.mjs +1 -5
- package/dist/variants/scroll-area.d.mts +2 -2
- package/dist/variants/scroll-area.mjs +3 -8
- package/dist/variants/separator.mjs +6 -6
- package/dist/variants/sheet.d.mts +4 -4
- package/dist/variants/sheet.mjs +5 -38
- package/dist/variants/sidebar.d.mts +4 -4
- package/dist/variants/sidebar.mjs +6 -23
- package/dist/variants/tabs.d.mts +18 -0
- package/dist/variants/tabs.mjs +15 -0
- package/dist/variants/toggle.d.mts +4 -4
- package/dist/variants/toggle.mjs +9 -27
- package/package.json +27 -44
- package/src/components/accordion.tsx +26 -68
- package/src/components/alert-dialog.tsx +70 -86
- package/src/components/alert.tsx +27 -19
- package/src/components/aspect-ratio.tsx +1 -4
- package/src/components/avatar.tsx +99 -12
- package/src/components/badge.tsx +5 -8
- package/src/components/breadcrumb.tsx +18 -24
- package/src/components/button-group.tsx +10 -20
- package/src/components/button.tsx +8 -19
- package/src/components/calendar.tsx +77 -132
- package/src/components/card.tsx +16 -22
- package/src/components/carousel.tsx +38 -56
- package/src/components/chart.tsx +41 -92
- package/src/components/checkbox-cards.tsx +10 -30
- package/src/components/checkbox-group.tsx +5 -28
- package/src/components/checkbox.tsx +5 -26
- package/src/components/collapsible.tsx +1 -4
- package/src/components/command.tsx +52 -65
- package/src/components/context-menu.tsx +46 -125
- package/src/components/dialog.tsx +49 -101
- package/src/components/direction.tsx +32 -0
- package/src/components/drawer.tsx +17 -79
- package/src/components/dropdown-menu.tsx +39 -118
- package/src/components/empty.tsx +6 -20
- package/src/components/field.tsx +19 -52
- package/src/components/form.tsx +19 -61
- package/src/components/hover-card.tsx +4 -27
- package/src/components/input-group.tsx +13 -52
- package/src/components/input-number.tsx +55 -75
- package/src/components/input-otp.tsx +19 -38
- package/src/components/input-password.tsx +5 -29
- package/src/components/input-search.tsx +6 -23
- package/src/components/input.tsx +1 -17
- package/src/components/item.tsx +17 -31
- package/src/components/kbd.tsx +2 -14
- package/src/components/label.tsx +2 -10
- package/src/components/menubar.tsx +34 -125
- package/src/components/native-select.tsx +21 -30
- package/src/components/navigation-menu.tsx +34 -94
- package/src/components/pagination.tsx +28 -34
- package/src/components/popover.tsx +66 -35
- package/src/components/progress-circle.tsx +7 -25
- package/src/components/progress.tsx +3 -16
- package/src/components/radio-cards.tsx +8 -27
- package/src/components/radio-group.tsx +7 -27
- package/src/components/radio.tsx +3 -24
- package/src/components/resizable.tsx +5 -26
- package/src/components/scroll-area.tsx +12 -32
- package/src/components/select.tsx +36 -59
- package/src/components/separator.tsx +4 -18
- package/src/components/sheet.tsx +37 -74
- package/src/components/sidebar.tsx +47 -177
- package/src/components/skeleton.tsx +1 -3
- package/src/components/slider.tsx +7 -36
- package/src/components/sonner.tsx +16 -6
- package/src/components/spinner.tsx +6 -15
- package/src/components/switch.tsx +8 -30
- package/src/components/table.tsx +18 -35
- package/src/components/tabs.tsx +16 -34
- package/src/components/textarea.tsx +1 -15
- package/src/components/toggle-group.tsx +34 -38
- package/src/components/toggle.tsx +4 -13
- package/src/components/tooltip.tsx +11 -37
- 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 -214
- package/src/css/style.css +1 -1
- package/src/hooks/use-animated-value.ts +1 -7
- package/src/hooks/use-copy-to-clipboard.ts +1 -6
- package/src/hooks/use-is-mobile.ts +0 -2
- package/src/hooks/use-media-query.ts +0 -2
- package/src/hooks/use-mutation-observer.ts +0 -3
- package/src/hooks/use-pagination.ts +0 -2
- package/src/index.ts +39 -80
- package/src/primitives/checkbox-group.tsx +25 -39
- package/src/primitives/input-number.tsx +17 -63
- package/src/primitives/input.tsx +8 -24
- package/src/primitives/progress-circle.tsx +13 -43
- package/src/variants/alert.ts +3 -14
- package/src/variants/badge.ts +8 -35
- package/src/variants/button-group.ts +5 -18
- package/src/variants/button.ts +21 -58
- package/src/variants/empty.ts +2 -11
- package/src/variants/field.ts +6 -19
- package/src/variants/input-group.ts +12 -64
- package/src/variants/input-number.ts +65 -0
- package/src/variants/item.ts +10 -32
- package/src/variants/navigation-menu.ts +1 -8
- package/src/variants/progress-circle.ts +1 -2
- package/src/variants/scroll-area.ts +3 -9
- package/src/variants/separator.ts +6 -7
- package/src/variants/sheet.ts +6 -39
- package/src/variants/sidebar.ts +7 -27
- package/src/variants/tabs.ts +34 -0
- package/src/variants/toggle.ts +9 -28
- /package/src/css/{amber.css → themes/amber.css} +0 -0
- /package/src/css/{blue.css → themes/blue.css} +0 -0
- /package/src/css/{cyan.css → themes/cyan.css} +0 -0
- /package/src/css/{emerald.css → themes/emerald.css} +0 -0
- /package/src/css/{fuchsia.css → themes/fuchsia.css} +0 -0
- /package/src/css/{gray.css → themes/gray.css} +0 -0
- /package/src/css/{green.css → themes/green.css} +0 -0
- /package/src/css/{indigo.css → themes/indigo.css} +0 -0
- /package/src/css/{lime.css → themes/lime.css} +0 -0
- /package/src/css/{neutral.css → themes/neutral.css} +0 -0
- /package/src/css/{orange.css → themes/orange.css} +0 -0
- /package/src/css/{pink.css → themes/pink.css} +0 -0
- /package/src/css/{purple.css → themes/purple.css} +0 -0
- /package/src/css/{red.css → themes/red.css} +0 -0
- /package/src/css/{rose.css → themes/rose.css} +0 -0
- /package/src/css/{sky.css → themes/sky.css} +0 -0
- /package/src/css/{slate.css → themes/slate.css} +0 -0
- /package/src/css/{stone.css → themes/stone.css} +0 -0
- /package/src/css/{teal.css → themes/teal.css} +0 -0
- /package/src/css/{violet.css → themes/violet.css} +0 -0
- /package/src/css/{yellow.css → themes/yellow.css} +0 -0
- /package/src/css/{zinc.css → themes/zinc.css} +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { ChevronDownIcon } from "lucide-react";
|
|
2
|
+
import { NavigationMenu as NavigationMenuPrimitive } from "radix-ui";
|
|
1
3
|
import type { ComponentProps, JSX } from "react";
|
|
2
4
|
|
|
3
5
|
import { cn } from "#/lib/utils";
|
|
4
|
-
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
5
|
-
import { ChevronDownIcon } from "lucide-react";
|
|
6
|
-
|
|
7
6
|
import { navigationMenuTriggerVariants } from "#/variants/navigation-menu";
|
|
8
7
|
|
|
9
8
|
/* -----------------------------------------------------------------------------
|
|
@@ -20,18 +19,10 @@ interface NavigationMenuProps extends ComponentProps<typeof NavigationMenuPrimit
|
|
|
20
19
|
/**
|
|
21
20
|
* @since 0.3.16-canary.0
|
|
22
21
|
*/
|
|
23
|
-
function NavigationMenu({
|
|
24
|
-
children,
|
|
25
|
-
className,
|
|
26
|
-
viewport = true,
|
|
27
|
-
...props
|
|
28
|
-
}: NavigationMenuProps): JSX.Element {
|
|
22
|
+
function NavigationMenu({ children, className, viewport = true, ...props }: NavigationMenuProps): JSX.Element {
|
|
29
23
|
return (
|
|
30
24
|
<NavigationMenuPrimitive.Root
|
|
31
|
-
className={cn(
|
|
32
|
-
"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
|
|
33
|
-
className,
|
|
34
|
-
)}
|
|
25
|
+
className={cn("group/navigation-menu relative flex max-w-max flex-1 items-center justify-center", className)}
|
|
35
26
|
data-slot="navigation-menu"
|
|
36
27
|
data-viewport={viewport}
|
|
37
28
|
{...props}
|
|
@@ -54,14 +45,10 @@ type NavigationMenuListProps = ComponentProps<typeof NavigationMenuPrimitive.Lis
|
|
|
54
45
|
/**
|
|
55
46
|
* @since 0.3.16-canary.0
|
|
56
47
|
*/
|
|
57
|
-
function NavigationMenuList({
|
|
58
|
-
children,
|
|
59
|
-
className,
|
|
60
|
-
...props
|
|
61
|
-
}: NavigationMenuListProps): JSX.Element {
|
|
48
|
+
function NavigationMenuList({ children, className, ...props }: NavigationMenuListProps): JSX.Element {
|
|
62
49
|
return (
|
|
63
50
|
<NavigationMenuPrimitive.List
|
|
64
|
-
className={cn("flex flex-1 items-center justify-center gap-
|
|
51
|
+
className={cn("group flex flex-1 list-none items-center justify-center gap-0", className)}
|
|
65
52
|
data-slot="navigation-menu-list"
|
|
66
53
|
{...props}
|
|
67
54
|
>
|
|
@@ -85,11 +72,7 @@ type NavigationMenuItemProps = ComponentProps<typeof NavigationMenuPrimitive.Ite
|
|
|
85
72
|
*/
|
|
86
73
|
function NavigationMenuItem({ className, ...props }: NavigationMenuItemProps): JSX.Element {
|
|
87
74
|
return (
|
|
88
|
-
<NavigationMenuPrimitive.Item
|
|
89
|
-
className={cn("group-data-[viewport=false]/navigation-menu:relative", className)}
|
|
90
|
-
data-slot="navigation-menu-item"
|
|
91
|
-
{...props}
|
|
92
|
-
/>
|
|
75
|
+
<NavigationMenuPrimitive.Item className={cn("relative", className)} data-slot="navigation-menu-item" {...props} />
|
|
93
76
|
);
|
|
94
77
|
}
|
|
95
78
|
|
|
@@ -105,27 +88,17 @@ type NavigationMenuTriggerProps = ComponentProps<typeof NavigationMenuPrimitive.
|
|
|
105
88
|
/**
|
|
106
89
|
* @since 0.3.16-canary.0
|
|
107
90
|
*/
|
|
108
|
-
function NavigationMenuTrigger({
|
|
109
|
-
children,
|
|
110
|
-
className,
|
|
111
|
-
...props
|
|
112
|
-
}: NavigationMenuTriggerProps): JSX.Element {
|
|
91
|
+
function NavigationMenuTrigger({ children, className, ...props }: NavigationMenuTriggerProps): JSX.Element {
|
|
113
92
|
return (
|
|
114
93
|
<NavigationMenuPrimitive.Trigger
|
|
115
|
-
className={navigationMenuTriggerVariants({ className })}
|
|
94
|
+
className={navigationMenuTriggerVariants({ className: ["group", className] })}
|
|
116
95
|
data-slot="navigation-menu-trigger"
|
|
117
96
|
{...props}
|
|
118
97
|
>
|
|
119
|
-
{children}
|
|
98
|
+
{children}{" "}
|
|
120
99
|
<ChevronDownIcon
|
|
121
100
|
aria-hidden="true"
|
|
122
|
-
className=
|
|
123
|
-
"relative top-px",
|
|
124
|
-
"ml-1 size-3",
|
|
125
|
-
"transition-transform duration-300 ease-spring",
|
|
126
|
-
"motion-reduce:transition-none motion-reduce:duration-0",
|
|
127
|
-
"group-data-open/navigation-menu-trigger:rotate-180",
|
|
128
|
-
)}
|
|
101
|
+
className="relative top-px ml-1 size-3 transition duration-300 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-open/navigation-menu-trigger:rotate-180"
|
|
129
102
|
/>
|
|
130
103
|
</NavigationMenuPrimitive.Trigger>
|
|
131
104
|
);
|
|
@@ -147,20 +120,7 @@ function NavigationMenuContent({ className, ...props }: NavigationMenuContentPro
|
|
|
147
120
|
return (
|
|
148
121
|
<NavigationMenuPrimitive.Content
|
|
149
122
|
className={cn(
|
|
150
|
-
"top-0 left-0",
|
|
151
|
-
"w-full",
|
|
152
|
-
"group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-2 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-lg group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:p-1 group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow",
|
|
153
|
-
"group-data-[viewport=true]/navigation-menu:p-2",
|
|
154
|
-
"data-[motion=from-end]:slide-in-from-right-52",
|
|
155
|
-
"data-[motion=from-start]:slide-in-from-left-52",
|
|
156
|
-
"data-[motion=to-end]:slide-out-to-right-52",
|
|
157
|
-
"data-[motion=to-start]:slide-out-to-left-52",
|
|
158
|
-
"ease-snappy data-[motion^=from-]:animate-in data-[motion^=from-]:duration-200 data-[motion^=from-]:fade-in-0",
|
|
159
|
-
"data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out-0",
|
|
160
|
-
"motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
|
|
161
|
-
"md:absolute md:w-auto",
|
|
162
|
-
"group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95",
|
|
163
|
-
"group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95",
|
|
123
|
+
"top-0 left-0 w-full p-2 pr-2.5 ease-snappy group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:ring-foreground/10 group-data-[viewport=false]/navigation-menu:animation-duration-300 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 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:ease-exit data-[motion^=to-]:fade-out **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none md:absolute md:w-auto group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 data-closed:ease-exit group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95",
|
|
164
124
|
className,
|
|
165
125
|
)}
|
|
166
126
|
data-slot="navigation-menu-content"
|
|
@@ -185,20 +145,7 @@ function NavigationMenuLink({ className, ...props }: NavigationMenuLinkProps): J
|
|
|
185
145
|
return (
|
|
186
146
|
<NavigationMenuPrimitive.Link
|
|
187
147
|
className={cn(
|
|
188
|
-
"flex
|
|
189
|
-
"p-2",
|
|
190
|
-
"rounded-sm outline-hidden",
|
|
191
|
-
"text-sm",
|
|
192
|
-
"transition-colors duration-150 ease-snappy",
|
|
193
|
-
"motion-reduce:transition-none motion-reduce:duration-0",
|
|
194
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
195
|
-
"focus:bg-accent focus:text-accent-foreground",
|
|
196
|
-
"data-active:bg-accent/50 data-active:text-accent-foreground",
|
|
197
|
-
"data-active:hover:bg-accent",
|
|
198
|
-
"data-active:focus:bg-accent",
|
|
199
|
-
"data-[variant=destructive]:[&_svg:not([class*='text-'])]:text-destructive/80",
|
|
200
|
-
"[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
201
|
-
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
148
|
+
"flex items-center gap-1.5 rounded-md p-2 text-sm transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 data-[active=true]:bg-muted/50 data-[active=true]:hover:bg-muted data-[active=true]:focus:bg-muted [&_svg:not([class*='size-'])]:size-4",
|
|
202
149
|
className,
|
|
203
150
|
)}
|
|
204
151
|
data-slot="navigation-menu-link"
|
|
@@ -211,23 +158,20 @@ function NavigationMenuLink({ className, ...props }: NavigationMenuLinkProps): J
|
|
|
211
158
|
* Component: NavigationMenuViewport
|
|
212
159
|
* -------------------------------------------------------------------------- */
|
|
213
160
|
|
|
161
|
+
/**
|
|
162
|
+
* @since 0.4.0-canary.4
|
|
163
|
+
*/
|
|
214
164
|
type NavigationMenuViewportProps = ComponentProps<typeof NavigationMenuPrimitive.Viewport>;
|
|
215
165
|
|
|
166
|
+
/**
|
|
167
|
+
* @since 0.4.0-canary.4
|
|
168
|
+
*/
|
|
216
169
|
function NavigationMenuViewport({ className, ...props }: NavigationMenuViewportProps): JSX.Element {
|
|
217
170
|
return (
|
|
218
|
-
<div className=
|
|
171
|
+
<div className="absolute top-full left-0 isolate z-50 flex justify-center">
|
|
219
172
|
<NavigationMenuPrimitive.Viewport
|
|
220
173
|
className={cn(
|
|
221
|
-
"relative",
|
|
222
|
-
"mt-2 min-h-[calc(var(--radix-navigation-menu-viewport-height)+2px)] w-full overflow-hidden",
|
|
223
|
-
"rounded-lg border",
|
|
224
|
-
"bg-popover text-popover-foreground shadow-lg",
|
|
225
|
-
"transition-[width,height] duration-300 ease-snappy",
|
|
226
|
-
"motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
|
|
227
|
-
"sm:min-w-[calc(var(--radix-navigation-menu-viewport-width)+2px)]",
|
|
228
|
-
"data-open:animate-in data-open:fade-in-0 data-open:zoom-in-90",
|
|
229
|
-
"data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
230
|
-
"origin-[top_center]",
|
|
174
|
+
"relative mt-1.5 h-(--radix-navigation-menu-viewport-height) w-full origin-[top_center] overflow-hidden rounded-lg bg-popover text-popover-foreground shadow ring-1 ring-foreground/10 transition-[width,height] duration-100 ease-snappy md:w-(--radix-navigation-menu-viewport-width) data-open:animate-in data-open:animation-duration-100 data-open:zoom-in-90 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-100 data-closed:zoom-out-90",
|
|
231
175
|
className,
|
|
232
176
|
)}
|
|
233
177
|
data-slot="navigation-menu-viewport"
|
|
@@ -241,33 +185,25 @@ function NavigationMenuViewport({ className, ...props }: NavigationMenuViewportP
|
|
|
241
185
|
* Component: NavigationMenuIndicator
|
|
242
186
|
* -------------------------------------------------------------------------- */
|
|
243
187
|
|
|
188
|
+
/**
|
|
189
|
+
* @since 0.4.0-canary.4
|
|
190
|
+
*/
|
|
244
191
|
type NavigationMenuIndicatorProps = ComponentProps<typeof NavigationMenuPrimitive.Indicator>;
|
|
245
192
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}: NavigationMenuIndicatorProps): JSX.Element {
|
|
193
|
+
/**
|
|
194
|
+
* @since 0.4.0-canary.4
|
|
195
|
+
*/
|
|
196
|
+
function NavigationMenuIndicator({ className, ...props }: NavigationMenuIndicatorProps): JSX.Element {
|
|
250
197
|
return (
|
|
251
198
|
<NavigationMenuPrimitive.Indicator
|
|
252
199
|
className={cn(
|
|
253
|
-
"top-full z-
|
|
254
|
-
"ease-snappy data-[state=hidden]:animate-out data-[state=hidden]:fade-out-0",
|
|
255
|
-
"data-[state=visible]:animate-in data-[state=visible]:fade-in-0",
|
|
256
|
-
"motion-reduce:animate-none motion-reduce:transition-none",
|
|
200
|
+
"top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-hidden:animate-out data-hidden:fade-out data-visible:animate-in data-visible:fade-in",
|
|
257
201
|
className,
|
|
258
202
|
)}
|
|
259
203
|
data-slot="navigation-menu-indicator"
|
|
260
204
|
{...props}
|
|
261
205
|
>
|
|
262
|
-
<div
|
|
263
|
-
className={cn(
|
|
264
|
-
"relative top-[60%]",
|
|
265
|
-
"size-2.5",
|
|
266
|
-
"rounded-tl-xs",
|
|
267
|
-
"bg-popover text-popover-foreground",
|
|
268
|
-
"rotate-45",
|
|
269
|
-
)}
|
|
270
|
-
/>
|
|
206
|
+
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
|
|
271
207
|
</NavigationMenuPrimitive.Indicator>
|
|
272
208
|
);
|
|
273
209
|
}
|
|
@@ -279,17 +215,21 @@ function NavigationMenuIndicator({
|
|
|
279
215
|
export {
|
|
280
216
|
NavigationMenu,
|
|
281
217
|
NavigationMenuContent,
|
|
218
|
+
NavigationMenuIndicator,
|
|
282
219
|
NavigationMenuItem,
|
|
283
220
|
NavigationMenuLink,
|
|
284
221
|
NavigationMenuList,
|
|
285
222
|
NavigationMenuTrigger,
|
|
223
|
+
NavigationMenuViewport,
|
|
286
224
|
};
|
|
287
225
|
|
|
288
226
|
export type {
|
|
289
227
|
NavigationMenuContentProps,
|
|
228
|
+
NavigationMenuIndicatorProps,
|
|
290
229
|
NavigationMenuItemProps,
|
|
291
230
|
NavigationMenuLinkProps,
|
|
292
231
|
NavigationMenuListProps,
|
|
293
232
|
NavigationMenuProps,
|
|
294
233
|
NavigationMenuTriggerProps,
|
|
234
|
+
NavigationMenuViewportProps,
|
|
295
235
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
|
|
2
2
|
import type { ComponentProps, JSX } from "react";
|
|
3
3
|
|
|
4
|
+
import type { VariantProps } from "#/lib/utils";
|
|
4
5
|
import { cn } from "#/lib/utils";
|
|
5
|
-
import { ChevronLeftIcon, ChevronRightIcon, EllipsisIcon } from "lucide-react";
|
|
6
|
-
|
|
7
6
|
import { buttonVariants } from "#/variants/button";
|
|
8
7
|
|
|
9
8
|
/* -----------------------------------------------------------------------------
|
|
@@ -22,7 +21,7 @@ function Pagination({ className, ...props }: PaginationProps): JSX.Element {
|
|
|
22
21
|
return (
|
|
23
22
|
<nav
|
|
24
23
|
aria-label="pagination"
|
|
25
|
-
className={cn("flex w-full justify-center",
|
|
24
|
+
className={cn("mx-auto flex w-full justify-center", className)}
|
|
26
25
|
data-slot="pagination"
|
|
27
26
|
{...props}
|
|
28
27
|
/>
|
|
@@ -42,13 +41,7 @@ type PaginationContentProps = ComponentProps<"ul">;
|
|
|
42
41
|
* @since 0.3.16-canary.0
|
|
43
42
|
*/
|
|
44
43
|
function PaginationContent({ className, ...props }: PaginationContentProps): JSX.Element {
|
|
45
|
-
return (
|
|
46
|
-
<ul
|
|
47
|
-
className={cn("flex flex-row items-center gap-1", className)}
|
|
48
|
-
data-slot="pagination-content"
|
|
49
|
-
{...props}
|
|
50
|
-
/>
|
|
51
|
-
);
|
|
44
|
+
return <ul className={cn("flex items-center gap-1", className)} data-slot="pagination-content" {...props} />;
|
|
52
45
|
}
|
|
53
46
|
|
|
54
47
|
/* -----------------------------------------------------------------------------
|
|
@@ -74,25 +67,19 @@ function PaginationItem(props: PaginationItemProps): JSX.Element {
|
|
|
74
67
|
/**
|
|
75
68
|
* @since 0.3.16-canary.0
|
|
76
69
|
*/
|
|
77
|
-
interface PaginationLinkProps
|
|
78
|
-
extends ComponentProps<"a">, Pick<VariantProps<typeof buttonVariants>, "size"> {
|
|
70
|
+
interface PaginationLinkProps extends ComponentProps<"a">, Pick<VariantProps<typeof buttonVariants>, "size"> {
|
|
79
71
|
isActive?: boolean;
|
|
80
72
|
}
|
|
81
73
|
|
|
82
74
|
/**
|
|
83
75
|
* @since 0.3.16-canary.0
|
|
84
76
|
*/
|
|
85
|
-
function PaginationLink({
|
|
86
|
-
children,
|
|
87
|
-
className,
|
|
88
|
-
isActive,
|
|
89
|
-
size = "icon",
|
|
90
|
-
...props
|
|
91
|
-
}: PaginationLinkProps): JSX.Element {
|
|
77
|
+
function PaginationLink({ children, className, isActive, size = "icon", ...props }: PaginationLinkProps): JSX.Element {
|
|
92
78
|
return (
|
|
93
79
|
<a
|
|
94
80
|
aria-current={isActive ? "page" : undefined}
|
|
95
81
|
className={buttonVariants({ className, size, variant: isActive ? "outline" : "ghost" })}
|
|
82
|
+
data-active={isActive}
|
|
96
83
|
data-slot="pagination-link"
|
|
97
84
|
{...props}
|
|
98
85
|
>
|
|
@@ -108,24 +95,25 @@ function PaginationLink({
|
|
|
108
95
|
/**
|
|
109
96
|
* @since 0.3.16-canary.0
|
|
110
97
|
*/
|
|
111
|
-
interface PaginationPreviousProps
|
|
112
|
-
extends ComponentProps<"a">, Pick<VariantProps<typeof buttonVariants>, "size"> {
|
|
98
|
+
interface PaginationPreviousProps extends ComponentProps<"a">, Pick<VariantProps<typeof buttonVariants>, "size"> {
|
|
113
99
|
isActive?: boolean;
|
|
100
|
+
text?: string;
|
|
114
101
|
}
|
|
115
102
|
|
|
116
103
|
/**
|
|
117
104
|
* @since 0.3.16-canary.0
|
|
118
105
|
*/
|
|
119
|
-
function PaginationPrevious({ ...props }: PaginationPreviousProps): JSX.Element {
|
|
106
|
+
function PaginationPrevious({ className, text = "Previous", ...props }: PaginationPreviousProps): JSX.Element {
|
|
120
107
|
return (
|
|
121
108
|
<PaginationLink
|
|
122
109
|
aria-label="Go to previous page"
|
|
110
|
+
className={cn("pl-2!", className)}
|
|
123
111
|
data-slot="pagination-previous"
|
|
124
|
-
size="
|
|
112
|
+
size="default"
|
|
125
113
|
{...props}
|
|
126
114
|
>
|
|
127
|
-
<ChevronLeftIcon className="
|
|
128
|
-
<span>
|
|
115
|
+
<ChevronLeftIcon className="rtl:rotate-180" data-icon="inline-start" />
|
|
116
|
+
<span className="hidden sm:block">{text}</span>
|
|
129
117
|
</PaginationLink>
|
|
130
118
|
);
|
|
131
119
|
}
|
|
@@ -137,19 +125,25 @@ function PaginationPrevious({ ...props }: PaginationPreviousProps): JSX.Element
|
|
|
137
125
|
/**
|
|
138
126
|
* @since 0.3.16-canary.0
|
|
139
127
|
*/
|
|
140
|
-
interface PaginationNextProps
|
|
141
|
-
extends ComponentProps<"a">, Pick<VariantProps<typeof buttonVariants>, "size"> {
|
|
128
|
+
interface PaginationNextProps extends ComponentProps<"a">, Pick<VariantProps<typeof buttonVariants>, "size"> {
|
|
142
129
|
isActive?: boolean;
|
|
130
|
+
text?: string;
|
|
143
131
|
}
|
|
144
132
|
|
|
145
133
|
/**
|
|
146
134
|
* @since 0.3.16-canary.0
|
|
147
135
|
*/
|
|
148
|
-
function PaginationNext({ ...props }: PaginationNextProps): JSX.Element {
|
|
136
|
+
function PaginationNext({ className, text = "Next", ...props }: PaginationNextProps): JSX.Element {
|
|
149
137
|
return (
|
|
150
|
-
<PaginationLink
|
|
151
|
-
|
|
152
|
-
|
|
138
|
+
<PaginationLink
|
|
139
|
+
aria-label="Go to next page"
|
|
140
|
+
className={cn("pr-2!", className)}
|
|
141
|
+
data-slot="pagination-next"
|
|
142
|
+
size="default"
|
|
143
|
+
{...props}
|
|
144
|
+
>
|
|
145
|
+
<span className="hidden sm:block">{text}</span>
|
|
146
|
+
<ChevronRightIcon className="rtl:rotate-180" data-icon="inline-end" />
|
|
153
147
|
</PaginationLink>
|
|
154
148
|
);
|
|
155
149
|
}
|
|
@@ -170,11 +164,11 @@ function PaginationEllipsis({ className, ...props }: PaginationEllipsisProps): J
|
|
|
170
164
|
return (
|
|
171
165
|
<span
|
|
172
166
|
aria-hidden
|
|
173
|
-
className={cn("flex size-
|
|
167
|
+
className={cn("flex size-9 items-center justify-center [&_svg:not([class*='size-'])]:size-4", className)}
|
|
174
168
|
data-slot="pagination-ellipsis"
|
|
175
169
|
{...props}
|
|
176
170
|
>
|
|
177
|
-
<
|
|
171
|
+
<MoreHorizontalIcon />
|
|
178
172
|
<span className="sr-only">More pages</span>
|
|
179
173
|
</span>
|
|
180
174
|
);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
3
2
|
import type { ComponentProps, JSX } from "react";
|
|
4
3
|
|
|
5
4
|
import { cn } from "#/lib/utils";
|
|
6
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
7
5
|
|
|
8
6
|
/* -----------------------------------------------------------------------------
|
|
9
7
|
* Component: Popover
|
|
@@ -65,34 +63,13 @@ type PopoverContentProps = ComponentProps<typeof PopoverPrimitive.Content>;
|
|
|
65
63
|
/**
|
|
66
64
|
* @since 0.3.16-canary.0
|
|
67
65
|
*/
|
|
68
|
-
function PopoverContent({
|
|
69
|
-
align = "center",
|
|
70
|
-
className,
|
|
71
|
-
sideOffset = 4,
|
|
72
|
-
...props
|
|
73
|
-
}: PopoverContentProps): JSX.Element {
|
|
66
|
+
function PopoverContent({ align = "center", className, sideOffset = 4, ...props }: PopoverContentProps): JSX.Element {
|
|
74
67
|
return (
|
|
75
|
-
<PopoverPrimitive.Portal>
|
|
68
|
+
<PopoverPrimitive.Portal data-slot="popover-portal">
|
|
76
69
|
<PopoverPrimitive.Content
|
|
77
70
|
align={align}
|
|
78
71
|
className={cn(
|
|
79
|
-
"z-50",
|
|
80
|
-
"min-w-32 p-4",
|
|
81
|
-
"rounded-lg border",
|
|
82
|
-
"bg-popover shadow-lg outline-hidden",
|
|
83
|
-
"text-popover-foreground",
|
|
84
|
-
"ease-snappy data-open:animate-in data-open:duration-200 data-open:fade-in-0 data-open:zoom-in-95",
|
|
85
|
-
"data-open:data-side-top:slide-in-from-bottom-2",
|
|
86
|
-
"data-open:data-side-right:slide-in-from-left-2",
|
|
87
|
-
"data-open:data-side-bottom:slide-in-from-top-2",
|
|
88
|
-
"data-open:data-side-left:slide-in-from-right-2",
|
|
89
|
-
"data-closed:animate-out data-closed:duration-150 data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
90
|
-
"data-closed:data-side-top:slide-out-to-bottom-2",
|
|
91
|
-
"data-closed:data-side-right:slide-out-to-left-2",
|
|
92
|
-
"data-closed:data-side-bottom:slide-out-to-top-2",
|
|
93
|
-
"data-closed:data-side-left:slide-out-to-right-2",
|
|
94
|
-
"motion-reduce:animate-none motion-reduce:transition-none motion-reduce:duration-0",
|
|
95
|
-
"origin-(--radix-popover-content-transform-origin)",
|
|
72
|
+
"z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden ease-snappy data-open:animate-in data-open:animation-duration-popup-in data-open:fade-in-0 data-open:zoom-in-95 data-open:data-side-top:slide-in-from-bottom-2 data-open:data-side-right:slide-in-from-left-2 data-open:data-side-bottom:slide-in-from-top-2 data-open:data-side-left:slide-in-from-right-2 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-popup-out data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:data-side-top:slide-out-to-bottom-2 data-closed:data-side-right:slide-out-to-left-2 data-closed:data-side-bottom:slide-out-to-top-2 data-closed:data-side-left:slide-out-to-right-2",
|
|
96
73
|
className,
|
|
97
74
|
)}
|
|
98
75
|
data-slot="popover-content"
|
|
@@ -116,24 +93,78 @@ type PopoverArrowProps = ComponentProps<typeof PopoverPrimitive.Arrow>;
|
|
|
116
93
|
* @since 0.3.16-canary.0
|
|
117
94
|
*/
|
|
118
95
|
function PopoverArrow({ className, ...props }: PopoverArrowProps): JSX.Element {
|
|
119
|
-
return (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
96
|
+
return <PopoverPrimitive.Arrow className={cn("fill-popover", className)} data-slot="popover-arrow" {...props} />;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* -----------------------------------------------------------------------------
|
|
100
|
+
* Component: PopoverHeader
|
|
101
|
+
* -------------------------------------------------------------------------- */
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @since 0.3.16-canary.0
|
|
105
|
+
*/
|
|
106
|
+
type PopoverHeaderProps = ComponentProps<"div">;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @since 0.3.16-canary.0
|
|
110
|
+
*/
|
|
111
|
+
function PopoverHeader({ className, ...props }: PopoverHeaderProps): JSX.Element {
|
|
112
|
+
return <div className={cn("flex flex-col gap-1 text-sm", className)} data-slot="popover-header" {...props} />;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* -----------------------------------------------------------------------------
|
|
116
|
+
* Component: PopoverTitle
|
|
117
|
+
* -------------------------------------------------------------------------- */
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @since 0.3.16-canary.0
|
|
121
|
+
*/
|
|
122
|
+
type PopoverTitleProps = ComponentProps<"div">;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @since 0.3.16-canary.0
|
|
126
|
+
*/
|
|
127
|
+
function PopoverTitle({ className, ...props }: PopoverTitleProps): JSX.Element {
|
|
128
|
+
return <div className={cn("font-medium", className)} data-slot="popover-title" {...props} />;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* -----------------------------------------------------------------------------
|
|
132
|
+
* Component: PopoverDescription
|
|
133
|
+
* -------------------------------------------------------------------------- */
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @since 0.3.16-canary.0
|
|
137
|
+
*/
|
|
138
|
+
type PopoverDescriptionProps = ComponentProps<"p">;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @since 0.3.16-canary.0
|
|
142
|
+
*/
|
|
143
|
+
function PopoverDescription({ className, ...props }: PopoverDescriptionProps): JSX.Element {
|
|
144
|
+
return <p className={cn("text-muted-foreground", className)} data-slot="popover-description" {...props} />;
|
|
126
145
|
}
|
|
127
146
|
|
|
128
147
|
/* -----------------------------------------------------------------------------
|
|
129
148
|
* Exports
|
|
130
149
|
* -------------------------------------------------------------------------- */
|
|
131
150
|
|
|
132
|
-
export {
|
|
151
|
+
export {
|
|
152
|
+
Popover,
|
|
153
|
+
PopoverAnchor,
|
|
154
|
+
PopoverArrow,
|
|
155
|
+
PopoverContent,
|
|
156
|
+
PopoverDescription,
|
|
157
|
+
PopoverHeader,
|
|
158
|
+
PopoverTitle,
|
|
159
|
+
PopoverTrigger,
|
|
160
|
+
};
|
|
133
161
|
export type {
|
|
134
162
|
PopoverAnchorProps,
|
|
135
163
|
PopoverArrowProps,
|
|
136
164
|
PopoverContentProps,
|
|
165
|
+
PopoverDescriptionProps,
|
|
166
|
+
PopoverHeaderProps,
|
|
137
167
|
PopoverProps,
|
|
168
|
+
PopoverTitleProps,
|
|
138
169
|
PopoverTriggerProps,
|
|
139
170
|
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { ProgressCircleVariants } from "#/variants/progress-circle";
|
|
4
1
|
import type { ComponentProps, CSSProperties, JSX } from "react";
|
|
5
|
-
|
|
6
2
|
import { useCallback, useMemo } from "react";
|
|
7
3
|
|
|
8
|
-
import { progressCircleVariants } from "#/variants/progress-circle";
|
|
9
|
-
|
|
10
4
|
import { useAnimatedValue } from "#/hooks/use-animated-value";
|
|
11
5
|
import * as ProgressCirclePrimitive from "#/primitives/progress-circle";
|
|
6
|
+
import type { ProgressCircleVariants } from "#/variants/progress-circle";
|
|
7
|
+
import { progressCircleVariants } from "#/variants/progress-circle";
|
|
12
8
|
|
|
13
9
|
/* -------------------------------------------------------------------------------------------------
|
|
14
10
|
* Component: ProgressCircle
|
|
@@ -18,9 +14,7 @@ import * as ProgressCirclePrimitive from "#/primitives/progress-circle";
|
|
|
18
14
|
* @since 0.3.16-canary.0
|
|
19
15
|
*/
|
|
20
16
|
interface ProgressCircleProps
|
|
21
|
-
extends
|
|
22
|
-
Omit<ComponentProps<typeof ProgressCirclePrimitive.Provider>, "children" | "size">,
|
|
23
|
-
ProgressCircleVariants {
|
|
17
|
+
extends Omit<ComponentProps<typeof ProgressCirclePrimitive.Provider>, "children" | "size">, ProgressCircleVariants {
|
|
24
18
|
/**
|
|
25
19
|
* Enables animation effect when value changes
|
|
26
20
|
*/
|
|
@@ -112,10 +106,7 @@ function ProgressCircle({
|
|
|
112
106
|
[strokeWidth, thickness, actualSize],
|
|
113
107
|
);
|
|
114
108
|
|
|
115
|
-
const slots = useMemo(
|
|
116
|
-
() => progressCircleVariants({ size, thickness, variant }),
|
|
117
|
-
[variant, size, thickness],
|
|
118
|
-
);
|
|
109
|
+
const slots = useMemo(() => progressCircleVariants({ size, thickness, variant }), [variant, size, thickness]);
|
|
119
110
|
|
|
120
111
|
const shouldShowLabel = showValue || Boolean(customLabel);
|
|
121
112
|
|
|
@@ -128,19 +119,10 @@ function ProgressCircle({
|
|
|
128
119
|
}, [customLabel, displayValue]);
|
|
129
120
|
|
|
130
121
|
return (
|
|
131
|
-
<ProgressCirclePrimitive.Provider
|
|
132
|
-
|
|
133
|
-
strokeWidth={actualThickness}
|
|
134
|
-
value={value}
|
|
135
|
-
{...props}
|
|
136
|
-
>
|
|
137
|
-
<ProgressCirclePrimitive.Root
|
|
138
|
-
className={slots.root({ className: [className, classNames?.root] })}
|
|
139
|
-
>
|
|
122
|
+
<ProgressCirclePrimitive.Provider size={actualSize} strokeWidth={actualThickness} value={value} {...props}>
|
|
123
|
+
<ProgressCirclePrimitive.Root className={slots.root({ className: [className, classNames?.root] })}>
|
|
140
124
|
<ProgressCirclePrimitive.SVG className={slots.svg({ className: classNames?.svg })}>
|
|
141
|
-
<ProgressCirclePrimitive.Track
|
|
142
|
-
className={slots.track({ className: classNames?.track })}
|
|
143
|
-
/>
|
|
125
|
+
<ProgressCirclePrimitive.Track className={slots.track({ className: classNames?.track })} />
|
|
144
126
|
<ProgressCirclePrimitive.Indicator
|
|
145
127
|
className={slots.indicator({ className: classNames?.indicator })}
|
|
146
128
|
style={
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
3
2
|
import type { ComponentProps, JSX } from "react";
|
|
4
3
|
|
|
5
4
|
import { cn } from "#/lib/utils";
|
|
6
|
-
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
7
5
|
|
|
8
6
|
/* -----------------------------------------------------------------------------
|
|
9
7
|
* Component: Progress
|
|
@@ -20,23 +18,12 @@ type ProgressProps = ComponentProps<typeof ProgressPrimitive.Root>;
|
|
|
20
18
|
function Progress({ className, value, ...props }: ProgressProps): JSX.Element {
|
|
21
19
|
return (
|
|
22
20
|
<ProgressPrimitive.Root
|
|
23
|
-
className={cn(
|
|
24
|
-
"relative",
|
|
25
|
-
"h-2 w-full overflow-hidden",
|
|
26
|
-
"rounded-full",
|
|
27
|
-
"bg-primary/20",
|
|
28
|
-
className,
|
|
29
|
-
)}
|
|
21
|
+
className={cn("relative flex h-1.5 w-full items-center overflow-x-hidden rounded-full bg-muted", className)}
|
|
30
22
|
data-slot="progress"
|
|
31
23
|
{...props}
|
|
32
24
|
>
|
|
33
25
|
<ProgressPrimitive.Indicator
|
|
34
|
-
className=
|
|
35
|
-
"size-full flex-1",
|
|
36
|
-
"bg-primary",
|
|
37
|
-
"transition-[transform] duration-500 ease-gentle",
|
|
38
|
-
"motion-reduce:transition-none motion-reduce:duration-0",
|
|
39
|
-
)}
|
|
26
|
+
className="size-full flex-1 bg-primary transition-all"
|
|
40
27
|
data-slot="progress-indicator"
|
|
41
28
|
style={{
|
|
42
29
|
transform: `translateX(-${(100 - (value ?? 0)).toString()}%)`,
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
3
2
|
import type { ComponentProps, JSX } from "react";
|
|
4
3
|
|
|
5
|
-
import { cn } from "#/lib/utils";
|
|
6
|
-
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
7
|
-
|
|
8
4
|
import { Label } from "#/components/label";
|
|
5
|
+
import { cn } from "#/lib/utils";
|
|
9
6
|
|
|
10
7
|
/* -----------------------------------------------------------------------------
|
|
11
8
|
* Component: RadioCards
|
|
@@ -38,39 +35,23 @@ type RadioCardsItemProps = ComponentProps<typeof RadioGroupPrimitive.Item>;
|
|
|
38
35
|
function RadioCardsItem({ children, className, ...props }: RadioCardsItemProps): JSX.Element {
|
|
39
36
|
return (
|
|
40
37
|
<Label
|
|
41
|
-
className=
|
|
42
|
-
"flex items-start gap-3",
|
|
43
|
-
"p-3",
|
|
44
|
-
"rounded-lg border border-input",
|
|
45
|
-
"transition",
|
|
46
|
-
"hover:not-has-disabled:not-has-aria-checked:bg-secondary",
|
|
47
|
-
"has-focus-visible:border-ring",
|
|
48
|
-
"has-disabled:opacity-50",
|
|
49
|
-
"has-aria-checked:border-primary has-aria-checked:bg-primary/10",
|
|
50
|
-
)}
|
|
38
|
+
className="flex items-start gap-3 rounded-md border border-input p-3 transition has-focus-visible:border-ring has-disabled:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5"
|
|
51
39
|
data-slot="radio-card"
|
|
52
40
|
>
|
|
53
41
|
<RadioGroupPrimitive.Item
|
|
54
42
|
className={cn(
|
|
55
|
-
"peer flex size-4 shrink-0
|
|
56
|
-
"rounded-full border border-input shadow-xs outline-hidden",
|
|
57
|
-
"text-primary-foreground",
|
|
58
|
-
"transition",
|
|
59
|
-
"focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
60
|
-
"focus-visible:not-aria-checked:border-ring",
|
|
61
|
-
"aria-checked:border-primary aria-checked:bg-primary",
|
|
62
|
-
"focus-visible:aria-checked:ring-primary/20",
|
|
63
|
-
"dark:bg-input/30",
|
|
64
|
-
"dark:focus-visible:aria-checked:ring-primary/40",
|
|
43
|
+
"peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
|
|
65
44
|
className,
|
|
66
45
|
)}
|
|
67
46
|
data-slot="radio-card-item"
|
|
68
47
|
{...props}
|
|
69
48
|
>
|
|
70
49
|
<RadioGroupPrimitive.Indicator
|
|
71
|
-
className=
|
|
50
|
+
className="flex size-4 items-center justify-center"
|
|
72
51
|
data-slot="radio-card-indicator"
|
|
73
|
-
|
|
52
|
+
>
|
|
53
|
+
<span className="absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground" />
|
|
54
|
+
</RadioGroupPrimitive.Indicator>
|
|
74
55
|
</RadioGroupPrimitive.Item>
|
|
75
56
|
{children}
|
|
76
57
|
</Label>
|