@codefast/ui 0.3.16-canary.3 → 0.4.0-canary.5
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 +112 -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 +25 -12
- package/dist/components/chart.d.mts +8 -3
- package/dist/components/chart.mjs +21 -15
- package/dist/components/checkbox-cards.mjs +6 -6
- package/dist/components/checkbox-group.mjs +6 -7
- package/dist/components/checkbox.d.mts +2 -2
- package/dist/components/checkbox.mjs +8 -9
- 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 +40 -58
- package/src/components/chart.tsx +41 -92
- package/src/components/checkbox-cards.tsx +11 -30
- package/src/components/checkbox-group.tsx +6 -28
- package/src/components/checkbox.tsx +6 -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 +37 -60
- 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 +74 -0
- package/src/css/foundation/motion.css +69 -0
- package/src/css/foundation/source.css +10 -0
- package/src/css/foundation/tokens.css +107 -0
- package/src/css/foundation/variants.css +121 -0
- package/src/css/preset.css +13 -214
- package/src/css/style.css +9 -1
- package/src/css/{amber.css → themes/amber.css} +29 -0
- package/src/css/{blue.css → themes/blue.css} +29 -0
- package/src/css/{cyan.css → themes/cyan.css} +29 -0
- package/src/css/{emerald.css → themes/emerald.css} +29 -0
- package/src/css/{fuchsia.css → themes/fuchsia.css} +29 -0
- package/src/css/{gray.css → themes/gray.css} +29 -0
- package/src/css/{green.css → themes/green.css} +29 -0
- package/src/css/{indigo.css → themes/indigo.css} +29 -0
- package/src/css/{lime.css → themes/lime.css} +29 -0
- package/src/css/{neutral.css → themes/neutral.css} +29 -0
- package/src/css/{orange.css → themes/orange.css} +29 -0
- package/src/css/{pink.css → themes/pink.css} +29 -0
- package/src/css/{purple.css → themes/purple.css} +29 -0
- package/src/css/{red.css → themes/red.css} +29 -0
- package/src/css/{rose.css → themes/rose.css} +29 -0
- package/src/css/{sky.css → themes/sky.css} +29 -0
- package/src/css/{slate.css → themes/slate.css} +29 -0
- package/src/css/{stone.css → themes/stone.css} +29 -0
- package/src/css/{teal.css → themes/teal.css} +29 -0
- package/src/css/{violet.css → themes/violet.css} +29 -0
- package/src/css/{yellow.css → themes/yellow.css} +29 -0
- package/src/css/{zinc.css → themes/zinc.css} +29 -0
- 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
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { ButtonGroupVariants } from "#/variants/button-group";
|
|
1
|
+
import { Slot } from "radix-ui";
|
|
4
2
|
import type { ComponentProps, JSX } from "react";
|
|
5
3
|
|
|
4
|
+
import { Separator } from "#/components/separator";
|
|
6
5
|
import { cn } from "#/lib/utils";
|
|
7
|
-
|
|
6
|
+
import type { ButtonGroupVariants } from "#/variants/button-group";
|
|
8
7
|
import { buttonGroupVariants } from "#/variants/button-group";
|
|
9
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
10
|
-
|
|
11
|
-
import { Separator } from "#/components/separator";
|
|
12
8
|
|
|
13
9
|
/* -----------------------------------------------------------------------------
|
|
14
10
|
* Component: ButtonGroup
|
|
@@ -48,22 +44,13 @@ interface ButtonGroupTextProps extends ComponentProps<"div"> {
|
|
|
48
44
|
/**
|
|
49
45
|
* @since 0.3.16-canary.0
|
|
50
46
|
*/
|
|
51
|
-
function ButtonGroupText({
|
|
52
|
-
|
|
53
|
-
className,
|
|
54
|
-
...props
|
|
55
|
-
}: ButtonGroupTextProps): JSX.Element {
|
|
56
|
-
const Component = asChild ? Slot : "div";
|
|
47
|
+
function ButtonGroupText({ asChild = false, className, ...props }: ButtonGroupTextProps): JSX.Element {
|
|
48
|
+
const Component = asChild ? Slot.Root : "div";
|
|
57
49
|
|
|
58
50
|
return (
|
|
59
51
|
<Component
|
|
60
52
|
className={cn(
|
|
61
|
-
"flex items-center gap-2",
|
|
62
|
-
"px-4",
|
|
63
|
-
"rounded-lg border",
|
|
64
|
-
"bg-muted shadow-xs",
|
|
65
|
-
"text-sm font-medium",
|
|
66
|
-
"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
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",
|
|
67
54
|
className,
|
|
68
55
|
)}
|
|
69
56
|
{...props}
|
|
@@ -90,7 +77,10 @@ function ButtonGroupSeparator({
|
|
|
90
77
|
}: ButtonGroupSeparatorProps): JSX.Element {
|
|
91
78
|
return (
|
|
92
79
|
<Separator
|
|
93
|
-
className={cn(
|
|
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
|
+
)}
|
|
94
84
|
data-slot="button-group-separator"
|
|
95
85
|
orientation={orientation}
|
|
96
86
|
{...props}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Slot } from "radix-ui";
|
|
2
2
|
import type { ComponentProps, JSX } from "react";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import type { ButtonVariants } from "#/variants/button";
|
|
6
5
|
import { buttonVariants } from "#/variants/button";
|
|
7
6
|
|
|
8
7
|
/* -----------------------------------------------------------------------------
|
|
@@ -21,40 +20,30 @@ type ButtonProps = ComponentProps<"button"> &
|
|
|
21
20
|
/**
|
|
22
21
|
* @since 0.3.16-canary.0
|
|
23
22
|
*/
|
|
24
|
-
function Button({
|
|
25
|
-
|
|
26
|
-
children,
|
|
27
|
-
className,
|
|
28
|
-
size,
|
|
29
|
-
type = "button",
|
|
30
|
-
variant,
|
|
31
|
-
...props
|
|
32
|
-
}: ButtonProps): JSX.Element {
|
|
33
|
-
const Comp = asChild ? Slot : "button";
|
|
23
|
+
function Button({ asChild = false, className, size, type = "button", variant, ...props }: ButtonProps): JSX.Element {
|
|
24
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
34
25
|
|
|
35
26
|
if (asChild) {
|
|
36
27
|
return (
|
|
37
28
|
<Comp
|
|
38
29
|
className={buttonVariants({ className, size, variant })}
|
|
30
|
+
data-size={size}
|
|
39
31
|
data-slot="button"
|
|
40
32
|
data-variant={variant}
|
|
41
33
|
{...props}
|
|
42
|
-
|
|
43
|
-
{children}
|
|
44
|
-
</Comp>
|
|
34
|
+
/>
|
|
45
35
|
);
|
|
46
36
|
}
|
|
47
37
|
|
|
48
38
|
return (
|
|
49
39
|
<button
|
|
50
40
|
className={buttonVariants({ className, size, variant })}
|
|
41
|
+
data-size={size}
|
|
51
42
|
data-slot="button"
|
|
52
43
|
data-variant={variant}
|
|
53
44
|
type={type}
|
|
54
45
|
{...props}
|
|
55
|
-
|
|
56
|
-
{children}
|
|
57
|
-
</button>
|
|
46
|
+
/>
|
|
58
47
|
);
|
|
59
48
|
}
|
|
60
49
|
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { ComponentProps, JSX } from "react";
|
|
4
|
-
import type { Chevron, DayButton, Root, WeekNumber } from "react-day-picker";
|
|
5
|
-
|
|
6
|
-
import { cn } from "#/lib/utils";
|
|
1
|
+
import type { Chevron, DayButton, Locale, Root, WeekNumber } from "@daypicker/react";
|
|
2
|
+
import { DayPicker, getDefaultClassNames } from "@daypicker/react";
|
|
7
3
|
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
4
|
+
import type { ComponentProps, JSX } from "react";
|
|
8
5
|
import { useEffect, useRef } from "react";
|
|
9
|
-
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
10
6
|
|
|
11
7
|
import { Button } from "#/components/button";
|
|
8
|
+
import { cn } from "#/lib/utils";
|
|
12
9
|
import { buttonVariants } from "#/variants/button";
|
|
13
10
|
|
|
14
11
|
/* -----------------------------------------------------------------------------
|
|
@@ -32,6 +29,7 @@ function Calendar({
|
|
|
32
29
|
classNames,
|
|
33
30
|
components,
|
|
34
31
|
formatters,
|
|
32
|
+
locale,
|
|
35
33
|
showOutsideDays = true,
|
|
36
34
|
...props
|
|
37
35
|
}: CalendarProps): JSX.Element {
|
|
@@ -41,123 +39,92 @@ function Calendar({
|
|
|
41
39
|
<DayPicker
|
|
42
40
|
captionLayout={captionLayout}
|
|
43
41
|
className={cn(
|
|
44
|
-
"group/calendar",
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"in-data-[slot=card-content]:bg-transparent",
|
|
48
|
-
"in-data-[slot=popover-content]:bg-transparent",
|
|
49
|
-
"rtl:**:[.rdp-button_next>svg]:rotate-180",
|
|
50
|
-
"rtl:**:[.rdp-button_previous>svg]:rotate-180",
|
|
51
|
-
"[--cell-size:--spacing(8)]",
|
|
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`,
|
|
52
45
|
className,
|
|
53
46
|
)}
|
|
54
47
|
classNames={{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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),
|
|
69
75
|
caption_label: cn(
|
|
70
|
-
"font-medium",
|
|
71
|
-
"select-none",
|
|
76
|
+
"font-medium select-none",
|
|
72
77
|
captionLayout === "label"
|
|
73
78
|
? "text-sm"
|
|
74
|
-
: "flex h-8 items-center gap-1 rounded-
|
|
79
|
+
: "flex h-8 items-center gap-1 rounded-(--cell-radius) ps-2 pe-1 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
75
80
|
defaultClassNames.caption_label,
|
|
76
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),
|
|
77
91
|
day: cn(
|
|
78
|
-
"group/day relative",
|
|
79
|
-
"aspect-square h-full w-full p-0 text-center",
|
|
80
|
-
"select-none",
|
|
81
|
-
"[&:last-child[data-selected=true]_button]:rounded-r-md",
|
|
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-e-(--cell-radius)",
|
|
82
93
|
props.showWeekNumber
|
|
83
|
-
? "[&:nth-child(2)[data-selected=true]_button]:rounded-
|
|
84
|
-
: "[&:first-child[data-selected=true]_button]:rounded-
|
|
94
|
+
? "[&:nth-child(2)[data-selected=true]_button]:rounded-s-(--cell-radius)"
|
|
95
|
+
: "[&:first-child[data-selected=true]_button]:rounded-s-(--cell-radius)",
|
|
85
96
|
defaultClassNames.day,
|
|
86
97
|
),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"relative",
|
|
91
|
-
"rounded-md border border-input shadow-xs",
|
|
92
|
-
"has-focus:border-ring has-focus:ring-3 has-focus:ring-ring/50",
|
|
93
|
-
defaultClassNames.dropdown_root,
|
|
94
|
-
),
|
|
95
|
-
dropdowns: cn(
|
|
96
|
-
"flex h-(--cell-size) w-full items-center justify-center gap-1.5",
|
|
97
|
-
"text-sm font-medium",
|
|
98
|
-
defaultClassNames.dropdowns,
|
|
98
|
+
range_start: cn(
|
|
99
|
+
"relative isolate z-0 rounded-s-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:end-0 after:w-4 after:bg-muted",
|
|
100
|
+
defaultClassNames.range_start,
|
|
99
101
|
),
|
|
100
|
-
hidden: cn("invisible", defaultClassNames.hidden),
|
|
101
|
-
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
102
|
-
month_caption: cn(
|
|
103
|
-
"flex h-(--cell-size) w-full items-center justify-center",
|
|
104
|
-
"px-(--cell-size)",
|
|
105
|
-
defaultClassNames.month_caption,
|
|
106
|
-
),
|
|
107
|
-
months: cn("relative flex flex-col gap-4", "md:flex-row", defaultClassNames.months),
|
|
108
|
-
nav: cn(
|
|
109
|
-
"absolute flex w-full items-center justify-between gap-1",
|
|
110
|
-
"inset-x-0 top-0",
|
|
111
|
-
defaultClassNames.nav,
|
|
112
|
-
),
|
|
113
|
-
outside: cn(
|
|
114
|
-
"text-muted-foreground",
|
|
115
|
-
"aria-selected:text-muted-foreground",
|
|
116
|
-
defaultClassNames.outside,
|
|
117
|
-
),
|
|
118
|
-
range_end: cn("rounded-r-md", "bg-accent", defaultClassNames.range_end),
|
|
119
102
|
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
103
|
+
range_end: cn(
|
|
104
|
+
"relative isolate z-0 rounded-e-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:start-0 after:w-4 after:bg-muted",
|
|
105
|
+
defaultClassNames.range_end,
|
|
106
|
+
),
|
|
123
107
|
today: cn(
|
|
124
|
-
"rounded-
|
|
125
|
-
"bg-accent text-accent-foreground",
|
|
126
|
-
"data-selected:rounded-none",
|
|
108
|
+
"rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
|
|
127
109
|
defaultClassNames.today,
|
|
128
110
|
),
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
"select-none",
|
|
133
|
-
defaultClassNames.week_number,
|
|
134
|
-
),
|
|
135
|
-
week_number_header: cn(
|
|
136
|
-
"w-(--cell-size)",
|
|
137
|
-
"select-none",
|
|
138
|
-
defaultClassNames.week_number_header,
|
|
139
|
-
),
|
|
140
|
-
weekday: cn(
|
|
141
|
-
"flex-1",
|
|
142
|
-
"rounded-md",
|
|
143
|
-
"text-[0.8rem] font-normal text-muted-foreground",
|
|
144
|
-
"select-none",
|
|
145
|
-
defaultClassNames.weekday,
|
|
146
|
-
),
|
|
147
|
-
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
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),
|
|
148
114
|
...classNames,
|
|
149
115
|
}}
|
|
150
116
|
components={{
|
|
151
117
|
Chevron: CalendarChevron,
|
|
152
|
-
DayButton: CalendarDayButton
|
|
118
|
+
DayButton: (dayButtonProps) => <CalendarDayButton locale={locale} {...dayButtonProps} />,
|
|
153
119
|
Root: CalendarRoot,
|
|
154
120
|
WeekNumber: CalendarWeekNumber,
|
|
155
121
|
...components,
|
|
156
122
|
}}
|
|
157
123
|
formatters={{
|
|
158
|
-
formatMonthDropdown: (date) => date.toLocaleString(
|
|
124
|
+
formatMonthDropdown: (date) => date.toLocaleString(locale?.code, { month: "short" }),
|
|
159
125
|
...formatters,
|
|
160
126
|
}}
|
|
127
|
+
locale={locale}
|
|
161
128
|
showOutsideDays={showOutsideDays}
|
|
162
129
|
{...props}
|
|
163
130
|
/>
|
|
@@ -168,17 +135,13 @@ function Calendar({
|
|
|
168
135
|
* Component: CalendarChevron (internal)
|
|
169
136
|
* -------------------------------------------------------------------------- */
|
|
170
137
|
|
|
171
|
-
function CalendarChevron({
|
|
172
|
-
className,
|
|
173
|
-
orientation,
|
|
174
|
-
...props
|
|
175
|
-
}: ComponentProps<typeof Chevron>): JSX.Element {
|
|
138
|
+
function CalendarChevron({ className, orientation, ...props }: ComponentProps<typeof Chevron>): JSX.Element {
|
|
176
139
|
if (orientation === "left") {
|
|
177
|
-
return <ChevronLeftIcon className={cn("size-4", className)} {...props} />;
|
|
140
|
+
return <ChevronLeftIcon className={cn("size-4 rtl:rotate-180", className)} {...props} />;
|
|
178
141
|
}
|
|
179
142
|
|
|
180
143
|
if (orientation === "right") {
|
|
181
|
-
return <ChevronRightIcon className={cn("size-4", className)} {...props} />;
|
|
144
|
+
return <ChevronRightIcon className={cn("size-4 rtl:rotate-180", className)} {...props} />;
|
|
182
145
|
}
|
|
183
146
|
|
|
184
147
|
return <ChevronDownIcon className={cn("size-4", className)} {...props} />;
|
|
@@ -188,23 +151,18 @@ function CalendarChevron({
|
|
|
188
151
|
* Component: CalendarRoot (internal)
|
|
189
152
|
* -------------------------------------------------------------------------- */
|
|
190
153
|
|
|
191
|
-
function CalendarRoot({
|
|
192
|
-
return <div ref={rootRef}
|
|
154
|
+
function CalendarRoot({ rootRef, ...props }: ComponentProps<typeof Root>): JSX.Element {
|
|
155
|
+
return <div ref={rootRef} data-slot="calendar" {...props} />;
|
|
193
156
|
}
|
|
194
157
|
|
|
195
158
|
/* -----------------------------------------------------------------------------
|
|
196
159
|
* Component: CalendarWeekNumber (internal)
|
|
197
160
|
* -------------------------------------------------------------------------- */
|
|
198
161
|
|
|
199
|
-
function CalendarWeekNumber({
|
|
200
|
-
children,
|
|
201
|
-
...props
|
|
202
|
-
}: ComponentProps<typeof WeekNumber>): JSX.Element {
|
|
162
|
+
function CalendarWeekNumber({ children, ...props }: ComponentProps<typeof WeekNumber>): JSX.Element {
|
|
203
163
|
return (
|
|
204
164
|
<td {...props}>
|
|
205
|
-
<div className=
|
|
206
|
-
{children}
|
|
207
|
-
</div>
|
|
165
|
+
<div className="flex size-(--cell-size) items-center justify-center text-center">{children}</div>
|
|
208
166
|
</td>
|
|
209
167
|
);
|
|
210
168
|
}
|
|
@@ -216,17 +174,14 @@ function CalendarWeekNumber({
|
|
|
216
174
|
/**
|
|
217
175
|
* @since 0.3.16-canary.0
|
|
218
176
|
*/
|
|
219
|
-
type CalendarDayButtonProps = ComponentProps<typeof DayButton
|
|
177
|
+
type CalendarDayButtonProps = ComponentProps<typeof DayButton> & {
|
|
178
|
+
locale?: Partial<Locale>;
|
|
179
|
+
};
|
|
220
180
|
|
|
221
181
|
/**
|
|
222
182
|
* @since 0.3.16-canary.0
|
|
223
183
|
*/
|
|
224
|
-
function CalendarDayButton({
|
|
225
|
-
className,
|
|
226
|
-
day,
|
|
227
|
-
modifiers,
|
|
228
|
-
...props
|
|
229
|
-
}: CalendarDayButtonProps): JSX.Element {
|
|
184
|
+
function CalendarDayButton({ className, day, locale, modifiers, ...props }: CalendarDayButtonProps): JSX.Element {
|
|
230
185
|
const defaultClassNames = getDefaultClassNames();
|
|
231
186
|
|
|
232
187
|
const ref = useRef<HTMLButtonElement>(null);
|
|
@@ -241,26 +196,16 @@ function CalendarDayButton({
|
|
|
241
196
|
<Button
|
|
242
197
|
ref={ref}
|
|
243
198
|
className={cn(
|
|
244
|
-
"flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal",
|
|
245
|
-
"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",
|
|
246
|
-
"data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground",
|
|
247
|
-
"data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground",
|
|
248
|
-
"data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground",
|
|
249
|
-
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground",
|
|
250
|
-
"dark:hover:text-accent-foreground",
|
|
251
|
-
"[&>span]:text-xs [&>span]:opacity-70",
|
|
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-e-(--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-s-(--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",
|
|
252
200
|
defaultClassNames.day,
|
|
253
201
|
className,
|
|
254
202
|
)}
|
|
255
|
-
data-day={day.date.toLocaleDateString()}
|
|
203
|
+
data-day={day.date.toLocaleDateString(locale?.code)}
|
|
256
204
|
data-range-end={modifiers.range_end}
|
|
257
205
|
data-range-middle={modifiers.range_middle}
|
|
258
206
|
data-range-start={modifiers.range_start}
|
|
259
207
|
data-selected-single={
|
|
260
|
-
modifiers.selected &&
|
|
261
|
-
!modifiers.range_start &&
|
|
262
|
-
!modifiers.range_end &&
|
|
263
|
-
!modifiers.range_middle
|
|
208
|
+
modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle
|
|
264
209
|
}
|
|
265
210
|
size="icon"
|
|
266
211
|
variant="ghost"
|
package/src/components/card.tsx
CHANGED
|
@@ -9,20 +9,21 @@ import { cn } from "#/lib/utils";
|
|
|
9
9
|
/**
|
|
10
10
|
* @since 0.3.16-canary.0
|
|
11
11
|
*/
|
|
12
|
-
type CardProps = ComponentProps<"div"
|
|
12
|
+
type CardProps = ComponentProps<"div"> & {
|
|
13
|
+
size?: "default" | "sm";
|
|
14
|
+
};
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* @since 0.3.16-canary.0
|
|
16
18
|
*/
|
|
17
|
-
function Card({ className, ...props }: CardProps): JSX.Element {
|
|
19
|
+
function Card({ className, size = "default", ...props }: CardProps): JSX.Element {
|
|
18
20
|
return (
|
|
19
21
|
<div
|
|
20
22
|
className={cn(
|
|
21
|
-
"flex flex-col gap-
|
|
22
|
-
"rounded-xl border",
|
|
23
|
-
"bg-card text-card-foreground shadow-sm",
|
|
23
|
+
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
|
|
24
24
|
className,
|
|
25
25
|
)}
|
|
26
|
+
data-size={size}
|
|
26
27
|
data-slot="card"
|
|
27
28
|
{...props}
|
|
28
29
|
/>
|
|
@@ -45,10 +46,7 @@ function CardHeader({ className, ...props }: CardHeaderProps): JSX.Element {
|
|
|
45
46
|
return (
|
|
46
47
|
<div
|
|
47
48
|
className={cn(
|
|
48
|
-
"@container/card-header grid auto-rows-min grid-rows-[auto_auto]
|
|
49
|
-
"px-6",
|
|
50
|
-
"has-[data-slot=card-action]:grid-cols-[1fr_auto]",
|
|
51
|
-
"[.border-b]:pb-6",
|
|
49
|
+
"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
|
|
52
50
|
className,
|
|
53
51
|
)}
|
|
54
52
|
data-slot="card-header"
|
|
@@ -69,11 +67,13 @@ type CardTitleProps = ComponentProps<"div">;
|
|
|
69
67
|
/**
|
|
70
68
|
* @since 0.3.16-canary.0
|
|
71
69
|
*/
|
|
72
|
-
function CardTitle({
|
|
70
|
+
function CardTitle({ className, ...props }: CardTitleProps): JSX.Element {
|
|
73
71
|
return (
|
|
74
|
-
<div
|
|
75
|
-
{
|
|
76
|
-
|
|
72
|
+
<div
|
|
73
|
+
className={cn("font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm", className)}
|
|
74
|
+
data-slot="card-title"
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -90,13 +90,7 @@ type CardDescriptionProps = ComponentProps<"div">;
|
|
|
90
90
|
* @since 0.3.16-canary.0
|
|
91
91
|
*/
|
|
92
92
|
function CardDescription({ className, ...props }: CardDescriptionProps): JSX.Element {
|
|
93
|
-
return (
|
|
94
|
-
<div
|
|
95
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
96
|
-
data-slot="card-description"
|
|
97
|
-
{...props}
|
|
98
|
-
/>
|
|
99
|
-
);
|
|
93
|
+
return <div className={cn("text-sm text-muted-foreground", className)} data-slot="card-description" {...props} />;
|
|
100
94
|
}
|
|
101
95
|
|
|
102
96
|
/* -----------------------------------------------------------------------------
|
|
@@ -112,7 +106,7 @@ type CardContentProps = ComponentProps<"div">;
|
|
|
112
106
|
* @since 0.3.16-canary.0
|
|
113
107
|
*/
|
|
114
108
|
function CardContent({ className, ...props }: CardContentProps): JSX.Element {
|
|
115
|
-
return <div className={cn("px-
|
|
109
|
+
return <div className={cn("px-(--card-spacing)", className)} data-slot="card-content" {...props} />;
|
|
116
110
|
}
|
|
117
111
|
|
|
118
112
|
/* -----------------------------------------------------------------------------
|
|
@@ -130,7 +124,7 @@ type CardFooterProps = ComponentProps<"div">;
|
|
|
130
124
|
function CardFooter({ className, ...props }: CardFooterProps): JSX.Element {
|
|
131
125
|
return (
|
|
132
126
|
<div
|
|
133
|
-
className={cn("flex items-center
|
|
127
|
+
className={cn("flex items-center rounded-b-xl px-(--card-spacing) [.border-t]:pt-(--card-spacing)", className)}
|
|
134
128
|
data-slot="card-footer"
|
|
135
129
|
{...props}
|
|
136
130
|
/>
|