@codefast/ui 0.3.11-canary.1 → 0.3.11
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 +36 -0
- package/README.md +34 -14
- package/dist/components/accordion.d.ts +29 -10
- package/dist/components/accordion.js +38 -37
- package/dist/components/alert-dialog.d.ts +60 -24
- package/dist/components/alert-dialog.js +69 -72
- package/dist/components/alert.d.ts +27 -15
- package/dist/components/alert.js +29 -31
- package/dist/components/aspect-ratio.d.ts +8 -4
- package/dist/components/aspect-ratio.js +7 -5
- package/dist/components/avatar.d.ts +17 -6
- package/dist/components/avatar.js +19 -17
- package/dist/components/badge.d.ts +21 -14
- package/dist/components/badge.js +19 -22
- package/dist/components/breadcrumb.d.ts +35 -12
- package/dist/components/breadcrumb.js +48 -54
- package/dist/components/button-group.d.ts +29 -14
- package/dist/components/button-group.js +27 -32
- package/dist/components/button.d.ts +35 -25
- package/dist/components/button.js +50 -48
- package/dist/components/calendar.d.ts +24 -9
- package/dist/components/calendar.js +92 -98
- package/dist/components/card.d.ts +34 -10
- package/dist/components/card.js +39 -37
- package/dist/components/carousel.d.ts +55 -24
- package/dist/components/carousel.js +113 -130
- package/dist/components/chart.d.ts +72 -36
- package/dist/components/chart.js +154 -166
- package/dist/components/checkbox-cards.d.ts +15 -8
- package/dist/components/checkbox-cards.js +22 -25
- package/dist/components/checkbox-group.d.ts +16 -8
- package/dist/components/checkbox-group.js +19 -19
- package/dist/components/checkbox.d.ts +9 -4
- package/dist/components/checkbox.js +14 -14
- package/dist/components/collapsible.d.ts +14 -6
- package/dist/components/collapsible.js +18 -16
- package/dist/components/command.d.ts +55 -23
- package/dist/components/command.js +70 -85
- package/dist/components/context-menu.d.ts +72 -22
- package/dist/components/context-menu.js +88 -109
- package/dist/components/dialog.d.ts +53 -22
- package/dist/components/dialog.js +71 -85
- package/dist/components/drawer.d.ts +60 -28
- package/dist/components/drawer.js +59 -67
- package/dist/components/dropdown-menu.d.ts +73 -22
- package/dist/components/dropdown-menu.js +95 -112
- package/dist/components/empty.d.ts +37 -15
- package/dist/components/empty.js +43 -45
- package/dist/components/field.d.ts +63 -25
- package/dist/components/field.js +88 -104
- package/dist/components/form.d.ts +37 -15
- package/dist/components/form.js +65 -70
- package/dist/components/hover-card.d.ts +21 -7
- package/dist/components/hover-card.js +24 -24
- package/dist/components/input-group.d.ts +53 -28
- package/dist/components/input-group.js +63 -77
- package/dist/components/input-number.d.ts +28 -7
- package/dist/components/input-number.js +55 -59
- package/dist/components/input-otp.d.ts +24 -10
- package/dist/components/input-otp.js +33 -37
- package/dist/components/input-password.d.ts +12 -5
- package/dist/components/input-password.js +31 -32
- package/dist/components/input-search.d.ts +18 -8
- package/dist/components/input-search.js +43 -41
- package/dist/components/input.d.ts +10 -4
- package/dist/components/input.js +9 -7
- package/dist/components/item.d.ts +69 -32
- package/dist/components/item.js +89 -92
- package/dist/components/kbd.d.ts +13 -5
- package/dist/components/kbd.js +13 -11
- package/dist/components/label.d.ts +9 -4
- package/dist/components/label.js +9 -7
- package/dist/components/menubar.d.ts +80 -23
- package/dist/components/menubar.js +97 -118
- package/dist/components/native-select.d.ts +16 -6
- package/dist/components/native-select.js +25 -26
- package/dist/components/navigation-menu.d.ts +36 -12
- package/dist/components/navigation-menu.js +60 -75
- package/dist/components/pagination.d.ts +35 -14
- package/dist/components/pagination.js +54 -69
- package/dist/components/popover.d.ts +24 -8
- package/dist/components/popover.js +28 -28
- package/dist/components/progress-circle.d.ts +106 -88
- package/dist/components/progress-circle.js +106 -138
- package/dist/components/progress.d.ts +10 -4
- package/dist/components/progress.js +14 -14
- package/dist/components/radio-cards.d.ts +10 -4
- package/dist/components/radio-cards.js +22 -23
- package/dist/components/radio-group.d.ts +13 -5
- package/dist/components/radio-group.js +18 -16
- package/dist/components/radio.d.ts +12 -5
- package/dist/components/radio.js +10 -8
- package/dist/components/resizable.d.ts +18 -7
- package/dist/components/resizable.js +22 -22
- package/dist/components/scroll-area.d.ts +33 -20
- package/dist/components/scroll-area.js +84 -88
- package/dist/components/select.d.ts +50 -16
- package/dist/components/select.js +77 -96
- package/dist/components/separator.d.ts +29 -19
- package/dist/components/separator.js +36 -34
- package/dist/components/sheet.d.ts +62 -29
- package/dist/components/sheet.js +79 -100
- package/dist/components/sidebar.d.ts +160 -66
- package/dist/components/sidebar.js +294 -336
- package/dist/components/skeleton.d.ts +9 -4
- package/dist/components/skeleton.js +8 -6
- package/dist/components/slider.d.ts +13 -4
- package/dist/components/slider.js +34 -40
- package/dist/components/sonner.d.ts +10 -7
- package/dist/components/sonner.js +16 -14
- package/dist/components/spinner.d.ts +12 -5
- package/dist/components/spinner.js +33 -35
- package/dist/components/switch.d.ts +9 -4
- package/dist/components/switch.js +13 -11
- package/dist/components/table.d.ts +37 -11
- package/dist/components/table.js +47 -45
- package/dist/components/tabs.d.ts +21 -7
- package/dist/components/tabs.js +24 -22
- package/dist/components/textarea.d.ts +9 -4
- package/dist/components/textarea.js +8 -6
- package/dist/components/toggle-group.d.ts +24 -9
- package/dist/components/toggle-group.js +41 -42
- package/dist/components/toggle.d.ts +25 -17
- package/dist/components/toggle.js +30 -28
- package/dist/components/tooltip.d.ts +24 -8
- package/dist/components/tooltip.js +29 -32
- package/dist/hooks/use-animated-value.d.ts +4 -1
- package/dist/hooks/use-animated-value.js +57 -36
- package/dist/hooks/use-copy-to-clipboard.d.ts +11 -5
- package/dist/hooks/use-copy-to-clipboard.js +39 -20
- package/dist/hooks/use-is-mobile.d.ts +4 -1
- package/dist/hooks/use-is-mobile.js +21 -1
- package/dist/hooks/use-media-query.d.ts +4 -1
- package/dist/hooks/use-media-query.js +45 -18
- package/dist/hooks/use-mutation-observer.d.ts +6 -2
- package/dist/hooks/use-mutation-observer.js +34 -16
- package/dist/hooks/use-pagination.d.ts +22 -14
- package/dist/hooks/use-pagination.js +100 -49
- package/dist/index.d.ts +69 -130
- package/dist/index.js +11 -11
- package/dist/primitives/checkbox-group.d.ts +105 -83
- package/dist/primitives/checkbox-group.js +111 -84
- package/dist/primitives/input-number.d.ts +51 -40
- package/dist/primitives/input-number.js +483 -350
- package/dist/primitives/input.d.ts +48 -42
- package/dist/primitives/input.js +65 -43
- package/dist/primitives/progress-circle.d.ts +79 -48
- package/dist/primitives/progress-circle.js +154 -105
- package/package.json +6 -7
|
@@ -1,55 +1,57 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import { tv } from "@codefast/tailwind-variants";
|
|
3
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/button.tsx
|
|
4
5
|
const buttonVariants = tv({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
base: "inline-flex shrink-0 items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap outline-hidden transition select-none focus-visible:ring-3 disabled:opacity-50 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
7
|
+
defaultVariants: {
|
|
8
|
+
size: "md",
|
|
9
|
+
variant: "default"
|
|
10
|
+
},
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
"icon-sm": "size-8",
|
|
14
|
+
icon: "size-9",
|
|
15
|
+
"icon-lg": "size-10",
|
|
16
|
+
sm: "h-8 px-3 has-[>svg]:px-2.5",
|
|
17
|
+
md: "h-9 px-4 has-[>svg]:px-3",
|
|
18
|
+
lg: "h-10 px-6 has-[>svg]:px-4"
|
|
19
|
+
},
|
|
20
|
+
variant: {
|
|
21
|
+
default: "bg-primary text-primary-foreground hover:not-disabled:bg-primary/80 focus-visible:ring-primary/20 dark:focus-visible:ring-primary/40",
|
|
22
|
+
destructive: "bg-destructive text-white hover:not-disabled:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
23
|
+
ghost: "hover:not-disabled:bg-secondary hover:not-disabled:text-secondary-foreground focus-visible:ring-ring/50 dark:hover:not-disabled:bg-secondary/50",
|
|
24
|
+
link: "text-primary underline-offset-4 hover:not-disabled:underline focus-visible:ring-ring/50",
|
|
25
|
+
outline: "border border-input shadow-xs hover:not-disabled:border-ring/60 hover:not-disabled:bg-secondary hover:not-disabled:text-secondary-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive focus-within:aria-invalid:ring-destructive/20 hover:not-disabled:aria-invalid:border-destructive/60 dark:bg-input/30 dark:hover:not-disabled:bg-input/50 dark:aria-invalid:border-destructive/70 dark:focus-within:aria-invalid:ring-destructive/40",
|
|
26
|
+
secondary: "bg-secondary text-secondary-foreground hover:not-disabled:bg-secondary/80 focus-visible:ring-ring/50"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
28
29
|
});
|
|
29
30
|
function Button({ asChild = false, children, className, size, type = "button", variant, ...props }) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
31
|
+
const Comp = asChild ? Slot : "button";
|
|
32
|
+
if (asChild) return /* @__PURE__ */ jsx(Comp, {
|
|
33
|
+
className: buttonVariants({
|
|
34
|
+
className,
|
|
35
|
+
size,
|
|
36
|
+
variant
|
|
37
|
+
}),
|
|
38
|
+
"data-slot": "button",
|
|
39
|
+
"data-variant": variant,
|
|
40
|
+
...props,
|
|
41
|
+
children
|
|
42
|
+
});
|
|
43
|
+
return /* @__PURE__ */ jsx("button", {
|
|
44
|
+
className: buttonVariants({
|
|
45
|
+
className,
|
|
46
|
+
size,
|
|
47
|
+
variant
|
|
48
|
+
}),
|
|
49
|
+
"data-slot": "button",
|
|
50
|
+
"data-variant": variant,
|
|
51
|
+
type,
|
|
52
|
+
...props,
|
|
53
|
+
children
|
|
54
|
+
});
|
|
54
55
|
}
|
|
56
|
+
//#endregion
|
|
55
57
|
export { Button, buttonVariants };
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { DayPicker } from "react-day-picker";
|
|
4
|
-
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
3
|
+
import { DayButton, DayPicker } from "react-day-picker";
|
|
4
|
+
|
|
5
|
+
//#region src/components/calendar.d.ts
|
|
5
6
|
type CalendarProps = ComponentProps<typeof DayPicker> & {
|
|
6
|
-
|
|
7
|
+
buttonVariant?: ComponentProps<typeof Button>["variant"];
|
|
7
8
|
};
|
|
8
|
-
declare function Calendar({
|
|
9
|
+
declare function Calendar({
|
|
10
|
+
buttonVariant,
|
|
11
|
+
captionLayout,
|
|
12
|
+
className,
|
|
13
|
+
classNames,
|
|
14
|
+
components,
|
|
15
|
+
formatters,
|
|
16
|
+
showOutsideDays,
|
|
17
|
+
...props
|
|
18
|
+
}: CalendarProps): JSX.Element;
|
|
9
19
|
type CalendarDayButtonProps = ComponentProps<typeof DayButton>;
|
|
10
|
-
declare function CalendarDayButton({
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
declare function CalendarDayButton({
|
|
21
|
+
className,
|
|
22
|
+
day,
|
|
23
|
+
modifiers,
|
|
24
|
+
...props
|
|
25
|
+
}: CalendarDayButtonProps): JSX.Element;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Calendar, CalendarDayButton, type CalendarDayButtonProps, type CalendarProps };
|
|
@@ -1,114 +1,108 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { Button, buttonVariants } from "./button.js";
|
|
3
3
|
import { cn } from "@codefast/tailwind-variants";
|
|
4
4
|
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
import { useEffect, useRef } from "react";
|
|
6
7
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
7
|
-
|
|
8
|
+
//#region src/components/calendar.tsx
|
|
8
9
|
function Calendar({ buttonVariant = "ghost", captionLayout = "label", className, classNames, components, formatters, showOutsideDays = true, ...props }) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}),
|
|
56
|
-
...formatters
|
|
57
|
-
},
|
|
58
|
-
showOutsideDays: showOutsideDays,
|
|
59
|
-
...props
|
|
60
|
-
});
|
|
10
|
+
const defaultClassNames = getDefaultClassNames();
|
|
11
|
+
return /* @__PURE__ */ jsx(DayPicker, {
|
|
12
|
+
captionLayout,
|
|
13
|
+
className: cn("group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", "rtl:**:[.rdp-button_next>svg]:rotate-180", "rtl:**:[.rdp-button_previous>svg]:rotate-180", className),
|
|
14
|
+
classNames: {
|
|
15
|
+
button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
16
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
17
|
+
caption_label: cn("font-medium select-none", captionLayout === "label" ? "text-sm" : "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label),
|
|
18
|
+
day: cn("group/day relative aspect-square h-full w-full p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-md", props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "[&:first-child[data-selected=true]_button]:rounded-l-md", defaultClassNames.day),
|
|
19
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
20
|
+
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
21
|
+
dropdown_root: cn("relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-3 has-focus:ring-ring/50", defaultClassNames.dropdown_root),
|
|
22
|
+
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
23
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
24
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
25
|
+
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
|
|
26
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
27
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
28
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
29
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
30
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
31
|
+
range_start: cn("rounded-l-md bg-accent", defaultClassNames.range_start),
|
|
32
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
33
|
+
table: "w-full border-collapse",
|
|
34
|
+
today: cn("rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
35
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
36
|
+
week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
|
|
37
|
+
week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
|
|
38
|
+
weekday: cn("flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none", defaultClassNames.weekday),
|
|
39
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
40
|
+
...classNames
|
|
41
|
+
},
|
|
42
|
+
components: {
|
|
43
|
+
Chevron: CalendarChevron,
|
|
44
|
+
DayButton: CalendarDayButton,
|
|
45
|
+
Root: CalendarRoot,
|
|
46
|
+
WeekNumber: CalendarWeekNumber,
|
|
47
|
+
...components
|
|
48
|
+
},
|
|
49
|
+
formatters: {
|
|
50
|
+
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
51
|
+
...formatters
|
|
52
|
+
},
|
|
53
|
+
showOutsideDays,
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
61
56
|
}
|
|
62
57
|
function CalendarChevron({ className, orientation, ...props }) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
if (orientation === "left") return /* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
59
|
+
className: cn("size-4", className),
|
|
60
|
+
...props
|
|
61
|
+
});
|
|
62
|
+
if (orientation === "right") return /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
63
|
+
className: cn("size-4", className),
|
|
64
|
+
...props
|
|
65
|
+
});
|
|
66
|
+
return /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
67
|
+
className: cn("size-4", className),
|
|
68
|
+
...props
|
|
69
|
+
});
|
|
75
70
|
}
|
|
76
71
|
function CalendarRoot({ className, rootRef, ...props }) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
return /* @__PURE__ */ jsx("div", {
|
|
73
|
+
ref: rootRef,
|
|
74
|
+
className: cn(className),
|
|
75
|
+
"data-slot": "calendar",
|
|
76
|
+
...props
|
|
77
|
+
});
|
|
83
78
|
}
|
|
84
79
|
function CalendarWeekNumber({ children, ...props }) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
return /* @__PURE__ */ jsx("td", {
|
|
81
|
+
...props,
|
|
82
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
83
|
+
className: "flex size-(--cell-size) items-center justify-center text-center",
|
|
84
|
+
children
|
|
85
|
+
})
|
|
86
|
+
});
|
|
92
87
|
}
|
|
93
88
|
function CalendarDayButton({ className, day, modifiers, ...props }) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
...props
|
|
112
|
-
});
|
|
89
|
+
const defaultClassNames = getDefaultClassNames();
|
|
90
|
+
const ref = useRef(null);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (modifiers.focused) ref.current?.focus();
|
|
93
|
+
}, [modifiers.focused]);
|
|
94
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
95
|
+
ref,
|
|
96
|
+
className: cn("flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-3 group-data-[focused=true]/day:ring-ring/50 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 data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground 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 data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className),
|
|
97
|
+
"data-day": day.date.toLocaleDateString(),
|
|
98
|
+
"data-range-end": modifiers.range_end,
|
|
99
|
+
"data-range-middle": modifiers.range_middle,
|
|
100
|
+
"data-range-start": modifiers.range_start,
|
|
101
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
102
|
+
size: "icon",
|
|
103
|
+
variant: "ghost",
|
|
104
|
+
...props
|
|
105
|
+
});
|
|
113
106
|
}
|
|
107
|
+
//#endregion
|
|
114
108
|
export { Calendar, CalendarDayButton };
|
|
@@ -1,17 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, JSX } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/card.d.ts
|
|
2
4
|
type CardProps = ComponentProps<"div">;
|
|
3
|
-
declare function Card({
|
|
5
|
+
declare function Card({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}: CardProps): JSX.Element;
|
|
4
9
|
type CardHeaderProps = ComponentProps<"div">;
|
|
5
|
-
declare function CardHeader({
|
|
10
|
+
declare function CardHeader({
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}: CardHeaderProps): JSX.Element;
|
|
6
14
|
type CardTitleProps = ComponentProps<"div">;
|
|
7
|
-
declare function CardTitle({
|
|
15
|
+
declare function CardTitle({
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}: CardTitleProps): JSX.Element;
|
|
8
20
|
type CardDescriptionProps = ComponentProps<"div">;
|
|
9
|
-
declare function CardDescription({
|
|
21
|
+
declare function CardDescription({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: CardDescriptionProps): JSX.Element;
|
|
10
25
|
type CardContentProps = ComponentProps<"div">;
|
|
11
|
-
declare function CardContent({
|
|
26
|
+
declare function CardContent({
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
}: CardContentProps): JSX.Element;
|
|
12
30
|
type CardFooterProps = ComponentProps<"div">;
|
|
13
|
-
declare function CardFooter({
|
|
31
|
+
declare function CardFooter({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: CardFooterProps): JSX.Element;
|
|
14
35
|
type CardActionProps = ComponentProps<"div">;
|
|
15
|
-
declare function CardAction({
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
declare function CardAction({
|
|
37
|
+
className,
|
|
38
|
+
...props
|
|
39
|
+
}: CardActionProps): JSX.Element;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Card, CardAction, type CardActionProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps };
|
package/dist/components/card.js
CHANGED
|
@@ -1,53 +1,55 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import { cn } from "@codefast/tailwind-variants";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/card.tsx
|
|
3
4
|
function Card({ className, ...props }) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
className: cn("flex flex-col gap-6 overflow-auto rounded-xl border bg-card py-6 text-card-foreground shadow-sm", className),
|
|
7
|
+
"data-slot": "card",
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
9
10
|
}
|
|
10
11
|
function CardHeader({ className, ...props }) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
return /* @__PURE__ */ jsx("div", {
|
|
13
|
+
className: cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-[data-slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6", className),
|
|
14
|
+
"data-slot": "card-header",
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
16
17
|
}
|
|
17
18
|
function CardTitle({ children, className, ...props }) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: cn("leading-none font-semibold", className),
|
|
21
|
+
"data-slot": "card-title",
|
|
22
|
+
...props,
|
|
23
|
+
children
|
|
24
|
+
});
|
|
24
25
|
}
|
|
25
26
|
function CardDescription({ className, ...props }) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
29
|
+
"data-slot": "card-description",
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
31
32
|
}
|
|
32
33
|
function CardContent({ className, ...props }) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
return /* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: cn("px-6", className),
|
|
36
|
+
"data-slot": "card-content",
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
38
39
|
}
|
|
39
40
|
function CardFooter({ className, ...props }) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: cn("flex items-center px-6 [.border-t]:pt-6", className),
|
|
43
|
+
"data-slot": "card-footer",
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
45
46
|
}
|
|
46
47
|
function CardAction({ className, ...props }) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
|
|
50
|
+
"data-slot": "card-action",
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
52
53
|
}
|
|
54
|
+
//#endregion
|
|
53
55
|
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -1,37 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import { Button } from "./button.js";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
3
|
+
import * as _$_radix_ui_react_context0 from "@radix-ui/react-context";
|
|
4
|
+
import { Scope } from "@radix-ui/react-context";
|
|
5
|
+
import useEmblaCarousel, { UseEmblaCarouselType } from "embla-carousel-react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/carousel.d.ts
|
|
6
8
|
type ScopedProps<P> = P & {
|
|
7
|
-
|
|
9
|
+
__scopeCarousel?: Scope;
|
|
8
10
|
};
|
|
9
|
-
declare const createCarouselScope:
|
|
11
|
+
declare const createCarouselScope: _$_radix_ui_react_context0.CreateScope;
|
|
10
12
|
type CarouselApi = UseEmblaCarouselType[1];
|
|
11
13
|
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
12
14
|
type CarouselOptions = UseCarouselParameters[0];
|
|
13
15
|
type CarouselPlugin = UseCarouselParameters[1];
|
|
14
16
|
interface BaseCarouselProps {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
opts?: CarouselOptions;
|
|
18
|
+
orientation?: "horizontal" | "vertical";
|
|
19
|
+
plugins?: CarouselPlugin;
|
|
20
|
+
setApi?: (api: CarouselApi) => void;
|
|
19
21
|
}
|
|
20
|
-
interface CarouselProps extends BaseCarouselProps, ComponentProps<"div"> {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
interface CarouselProps extends BaseCarouselProps, ComponentProps<"div"> {}
|
|
23
|
+
declare function Carousel({
|
|
24
|
+
__scopeCarousel,
|
|
25
|
+
children,
|
|
26
|
+
className,
|
|
27
|
+
opts,
|
|
28
|
+
orientation,
|
|
29
|
+
plugins,
|
|
30
|
+
setApi,
|
|
31
|
+
...props
|
|
32
|
+
}: ScopedProps<CarouselProps>): JSX.Element;
|
|
23
33
|
interface CarouselContentProps extends ComponentProps<"div"> {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
classNames?: {
|
|
35
|
+
content?: string;
|
|
36
|
+
wrapper?: string;
|
|
37
|
+
};
|
|
28
38
|
}
|
|
29
|
-
declare function CarouselContent({
|
|
39
|
+
declare function CarouselContent({
|
|
40
|
+
__scopeCarousel,
|
|
41
|
+
className,
|
|
42
|
+
classNames,
|
|
43
|
+
...props
|
|
44
|
+
}: ScopedProps<CarouselContentProps>): JSX.Element;
|
|
30
45
|
type CarouselItemProps = ComponentProps<"div">;
|
|
31
|
-
declare function CarouselItem({
|
|
46
|
+
declare function CarouselItem({
|
|
47
|
+
__scopeCarousel,
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}: ScopedProps<CarouselItemProps>): JSX.Element;
|
|
32
51
|
type CarouselPreviousProps = ComponentProps<typeof Button>;
|
|
33
|
-
declare function CarouselPrevious({
|
|
52
|
+
declare function CarouselPrevious({
|
|
53
|
+
__scopeCarousel,
|
|
54
|
+
className,
|
|
55
|
+
size,
|
|
56
|
+
variant,
|
|
57
|
+
...props
|
|
58
|
+
}: ScopedProps<CarouselPreviousProps>): JSX.Element;
|
|
34
59
|
type CarouselNextProps = ComponentProps<typeof Button>;
|
|
35
|
-
declare function CarouselNext({
|
|
36
|
-
|
|
37
|
-
|
|
60
|
+
declare function CarouselNext({
|
|
61
|
+
__scopeCarousel,
|
|
62
|
+
className,
|
|
63
|
+
size,
|
|
64
|
+
variant,
|
|
65
|
+
...props
|
|
66
|
+
}: ScopedProps<CarouselNextProps>): JSX.Element;
|
|
67
|
+
//#endregion
|
|
68
|
+
export { Carousel, type CarouselApi, CarouselContent, type CarouselContentProps, CarouselItem, type CarouselItemProps, CarouselNext, type CarouselNextProps, CarouselPrevious, type CarouselPreviousProps, type CarouselProps, createCarouselScope };
|