@codefast/ui 0.3.10 → 0.3.11-canary.1
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 +32 -0
- package/README.md +277 -167
- package/dist/components/accordion.d.ts +4 -4
- package/dist/components/accordion.js +5 -5
- package/dist/components/alert-dialog.d.ts +11 -11
- package/dist/components/alert-dialog.js +9 -9
- package/dist/components/alert.d.ts +5 -5
- package/dist/components/alert.js +5 -5
- package/dist/components/aspect-ratio.d.ts +2 -2
- package/dist/components/avatar.d.ts +2 -2
- package/dist/components/avatar.js +3 -3
- package/dist/components/badge.d.ts +3 -3
- package/dist/components/badge.js +7 -7
- package/dist/components/breadcrumb.d.ts +8 -8
- package/dist/components/breadcrumb.js +6 -8
- package/dist/components/button-group.d.ts +5 -5
- package/dist/components/button-group.js +8 -8
- package/dist/components/button.d.ts +6 -6
- package/dist/components/button.js +17 -17
- package/dist/components/calendar.d.ts +5 -5
- package/dist/components/calendar.js +35 -35
- package/dist/components/card.d.ts +8 -8
- package/dist/components/card.js +7 -7
- package/dist/components/carousel.d.ts +10 -10
- package/dist/components/carousel.js +20 -20
- package/dist/components/chart.d.ts +12 -11
- package/dist/components/chart.js +42 -42
- package/dist/components/checkbox-cards.d.ts +2 -2
- package/dist/components/checkbox-cards.js +2 -2
- package/dist/components/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox-group.js +2 -2
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/collapsible.d.ts +2 -2
- package/dist/components/command.d.ts +4 -4
- package/dist/components/command.js +10 -10
- package/dist/components/context-menu.d.ts +4 -4
- package/dist/components/context-menu.js +10 -10
- package/dist/components/dialog.d.ts +10 -10
- package/dist/components/dialog.js +12 -12
- package/dist/components/drawer.d.ts +9 -9
- package/dist/components/drawer.js +9 -9
- package/dist/components/dropdown-menu.d.ts +4 -4
- package/dist/components/dropdown-menu.js +10 -10
- package/dist/components/empty.d.ts +9 -9
- package/dist/components/empty.js +10 -10
- package/dist/components/field.d.ts +14 -14
- package/dist/components/field.js +17 -17
- package/dist/components/form.d.ts +10 -10
- package/dist/components/form.js +8 -8
- package/dist/components/hover-card.d.ts +2 -2
- package/dist/components/hover-card.js +3 -3
- package/dist/components/input-group.d.ts +15 -15
- package/dist/components/input-group.js +20 -20
- package/dist/components/input-number.d.ts +2 -2
- package/dist/components/input-number.js +7 -7
- package/dist/components/input-otp.d.ts +6 -6
- package/dist/components/input-otp.js +4 -4
- package/dist/components/input-password.d.ts +3 -3
- package/dist/components/input-password.js +6 -6
- package/dist/components/input-search.d.ts +3 -3
- package/dist/components/input-search.js +4 -4
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +1 -1
- package/dist/components/item.d.ts +12 -12
- package/dist/components/item.js +23 -23
- package/dist/components/kbd.d.ts +3 -3
- package/dist/components/kbd.js +2 -2
- package/dist/components/label.d.ts +2 -2
- package/dist/components/label.js +1 -1
- package/dist/components/menubar.d.ts +4 -4
- package/dist/components/menubar.js +13 -13
- package/dist/components/native-select.d.ts +4 -4
- package/dist/components/native-select.js +2 -2
- package/dist/components/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu.js +10 -10
- package/dist/components/pagination.d.ts +10 -10
- package/dist/components/pagination.js +6 -6
- package/dist/components/popover.d.ts +3 -3
- package/dist/components/popover.js +3 -3
- package/dist/components/progress-circle.d.ts +5 -5
- package/dist/components/progress-circle.js +22 -22
- package/dist/components/progress.d.ts +2 -2
- package/dist/components/progress.js +2 -2
- package/dist/components/radio-cards.d.ts +2 -2
- package/dist/components/radio-cards.js +3 -3
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +3 -3
- package/dist/components/radio.d.ts +2 -2
- package/dist/components/radio.js +1 -1
- package/dist/components/resizable.d.ts +2 -2
- package/dist/components/resizable.js +3 -3
- package/dist/components/scroll-area.d.ts +5 -5
- package/dist/components/scroll-area.js +31 -31
- package/dist/components/select.d.ts +5 -5
- package/dist/components/select.js +9 -9
- package/dist/components/separator.d.ts +5 -5
- package/dist/components/separator.js +9 -9
- package/dist/components/sheet.d.ts +9 -9
- package/dist/components/sheet.js +17 -17
- package/dist/components/sidebar.d.ts +31 -31
- package/dist/components/sidebar.js +65 -65
- package/dist/components/skeleton.d.ts +2 -2
- package/dist/components/skeleton.js +1 -1
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +4 -4
- package/dist/components/sonner.d.ts +3 -3
- package/dist/components/sonner.js +4 -4
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/spinner.js +5 -5
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +2 -2
- package/dist/components/table.d.ts +9 -9
- package/dist/components/table.js +8 -8
- package/dist/components/tabs.d.ts +2 -2
- package/dist/components/tabs.js +4 -4
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +1 -1
- package/dist/components/toggle-group.d.ts +4 -4
- package/dist/components/toggle-group.js +5 -5
- package/dist/components/toggle.d.ts +3 -3
- package/dist/components/toggle.js +8 -8
- package/dist/components/tooltip.d.ts +3 -3
- package/dist/components/tooltip.js +2 -2
- package/dist/css/preset.css +4 -4
- package/dist/css/style.css +3 -3
- package/dist/hooks/use-copy-to-clipboard.d.ts +1 -1
- package/dist/hooks/use-copy-to-clipboard.js +1 -1
- package/dist/hooks/use-media-query.js +3 -3
- package/dist/hooks/use-mutation-observer.d.ts +1 -1
- package/dist/hooks/use-pagination.js +1 -1
- package/dist/index.d.ts +130 -130
- package/dist/primitives/checkbox-group.d.ts +11 -11
- package/dist/primitives/checkbox-group.js +3 -3
- package/dist/primitives/input-number.d.ts +8 -8
- package/dist/primitives/input-number.js +46 -46
- package/dist/primitives/input.d.ts +4 -4
- package/dist/primitives/input.js +7 -7
- package/dist/primitives/progress-circle.d.ts +7 -7
- package/dist/primitives/progress-circle.js +8 -8
- package/package.json +111 -189
- package/dist/components/accordion.cjs +0 -98
- package/dist/components/alert-dialog.cjs +0 -156
- package/dist/components/alert.cjs +0 -84
- package/dist/components/aspect-ratio.cjs +0 -44
- package/dist/components/avatar.cjs +0 -66
- package/dist/components/badge.cjs +0 -67
- package/dist/components/breadcrumb.cjs +0 -127
- package/dist/components/button-group.cjs +0 -87
- package/dist/components/button.cjs +0 -92
- package/dist/components/calendar.cjs +0 -151
- package/dist/components/card.cjs +0 -105
- package/dist/components/carousel.cjs +0 -211
- package/dist/components/chart.cjs +0 -251
- package/dist/components/checkbox-cards.cjs +0 -70
- package/dist/components/checkbox-group.cjs +0 -64
- package/dist/components/checkbox.cjs +0 -54
- package/dist/components/collapsible.cjs +0 -62
- package/dist/components/command.cjs +0 -168
- package/dist/components/context-menu.cjs +0 -219
- package/dist/components/dialog.cjs +0 -165
- package/dist/components/drawer.cjs +0 -144
- package/dist/components/dropdown-menu.cjs +0 -222
- package/dist/components/empty.cjs +0 -113
- package/dist/components/field.cjs +0 -194
- package/dist/components/form.cjs +0 -152
- package/dist/components/hover-card.cjs +0 -78
- package/dist/components/input-group.cjs +0 -156
- package/dist/components/input-number.cjs +0 -99
- package/dist/components/input-otp.cjs +0 -102
- package/dist/components/input-password.cjs +0 -72
- package/dist/components/input-search.cjs +0 -81
- package/dist/components/input.cjs +0 -46
- package/dist/components/item.cjs +0 -186
- package/dist/components/kbd.cjs +0 -54
- package/dist/components/label.cjs +0 -46
- package/dist/components/menubar.cjs +0 -233
- package/dist/components/native-select.cjs +0 -75
- package/dist/components/navigation-menu.cjs +0 -146
- package/dist/components/pagination.cjs +0 -138
- package/dist/components/popover.cjs +0 -87
- package/dist/components/progress-circle.cjs +0 -185
- package/dist/components/progress.cjs +0 -53
- package/dist/components/radio-cards.cjs +0 -67
- package/dist/components/radio-group.cjs +0 -60
- package/dist/components/radio.cjs +0 -48
- package/dist/components/resizable.cjs +0 -72
- package/dist/components/scroll-area.cjs +0 -141
- package/dist/components/select.cjs +0 -181
- package/dist/components/separator.cjs +0 -83
- package/dist/components/sheet.cjs +0 -185
- package/dist/components/sidebar.cjs +0 -507
- package/dist/components/skeleton.cjs +0 -44
- package/dist/components/slider.cjs +0 -80
- package/dist/components/sonner.cjs +0 -58
- package/dist/components/spinner.cjs +0 -76
- package/dist/components/switch.cjs +0 -50
- package/dist/components/table.cjs +0 -118
- package/dist/components/tabs.cjs +0 -76
- package/dist/components/textarea.cjs +0 -44
- package/dist/components/toggle-group.cjs +0 -91
- package/dist/components/toggle.cjs +0 -72
- package/dist/components/tooltip.cjs +0 -91
- package/dist/hooks/use-animated-value.cjs +0 -75
- package/dist/hooks/use-copy-to-clipboard.cjs +0 -58
- package/dist/hooks/use-is-mobile.cjs +0 -40
- package/dist/hooks/use-media-query.cjs +0 -57
- package/dist/hooks/use-mutation-observer.cjs +0 -57
- package/dist/hooks/use-pagination.cjs +0 -93
- package/dist/index.cjs +0 -1081
- package/dist/primitives/checkbox-group.cjs +0 -151
- package/dist/primitives/input-number.cjs +0 -439
- package/dist/primitives/input.cjs +0 -99
- package/dist/primitives/progress-circle.cjs +0 -199
|
@@ -5,41 +5,41 @@ import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react
|
|
|
5
5
|
import { useEffect, useRef } from "react";
|
|
6
6
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
7
7
|
import { Button, buttonVariants } from "./button.js";
|
|
8
|
-
function Calendar({ buttonVariant =
|
|
8
|
+
function Calendar({ buttonVariant = "ghost", captionLayout = "label", className, classNames, components, formatters, showOutsideDays = true, ...props }) {
|
|
9
9
|
const defaultClassNames = getDefaultClassNames();
|
|
10
10
|
return /*#__PURE__*/ jsx(DayPicker, {
|
|
11
11
|
captionLayout: captionLayout,
|
|
12
|
-
className: cn(
|
|
12
|
+
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),
|
|
13
13
|
classNames: {
|
|
14
14
|
button_next: cn(buttonVariants({
|
|
15
15
|
variant: buttonVariant
|
|
16
|
-
}),
|
|
16
|
+
}), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
17
17
|
button_previous: cn(buttonVariants({
|
|
18
18
|
variant: buttonVariant
|
|
19
|
-
}),
|
|
20
|
-
caption_label: cn(
|
|
21
|
-
day: cn(
|
|
22
|
-
disabled: cn(
|
|
23
|
-
dropdown: cn(
|
|
24
|
-
dropdown_root: cn(
|
|
25
|
-
dropdowns: cn(
|
|
26
|
-
hidden: cn(
|
|
27
|
-
month: cn(
|
|
28
|
-
month_caption: cn(
|
|
29
|
-
months: cn(
|
|
30
|
-
nav: cn(
|
|
31
|
-
outside: cn(
|
|
32
|
-
range_end: cn(
|
|
33
|
-
range_middle: cn(
|
|
34
|
-
range_start: cn(
|
|
35
|
-
root: cn(
|
|
36
|
-
table:
|
|
37
|
-
today: cn(
|
|
38
|
-
week: cn(
|
|
39
|
-
week_number: cn(
|
|
40
|
-
week_number_header: cn(
|
|
41
|
-
weekday: cn(
|
|
42
|
-
weekdays: cn(
|
|
19
|
+
}), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
20
|
+
caption_label: cn("font-medium select-none", "label" === captionLayout ? "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),
|
|
21
|
+
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),
|
|
22
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
23
|
+
dropdown: cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown),
|
|
24
|
+
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),
|
|
25
|
+
dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
26
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
27
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
28
|
+
month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
|
|
29
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
30
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
31
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
32
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
33
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
34
|
+
range_start: cn("rounded-l-md bg-accent", defaultClassNames.range_start),
|
|
35
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
36
|
+
table: "w-full border-collapse",
|
|
37
|
+
today: cn("rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
38
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
39
|
+
week_number: cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number),
|
|
40
|
+
week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
|
|
41
|
+
weekday: cn("flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none", defaultClassNames.weekday),
|
|
42
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
43
43
|
...classNames
|
|
44
44
|
},
|
|
45
45
|
components: {
|
|
@@ -50,8 +50,8 @@ function Calendar({ buttonVariant = 'ghost', captionLayout = 'label', className,
|
|
|
50
50
|
...components
|
|
51
51
|
},
|
|
52
52
|
formatters: {
|
|
53
|
-
formatMonthDropdown: (date)=>date.toLocaleString(
|
|
54
|
-
month:
|
|
53
|
+
formatMonthDropdown: (date)=>date.toLocaleString("default", {
|
|
54
|
+
month: "short"
|
|
55
55
|
}),
|
|
56
56
|
...formatters
|
|
57
57
|
},
|
|
@@ -60,16 +60,16 @@ function Calendar({ buttonVariant = 'ghost', captionLayout = 'label', className,
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
function CalendarChevron({ className, orientation, ...props }) {
|
|
63
|
-
if (
|
|
64
|
-
className: cn(
|
|
63
|
+
if ("left" === orientation) return /*#__PURE__*/ jsx(ChevronLeftIcon, {
|
|
64
|
+
className: cn("size-4", className),
|
|
65
65
|
...props
|
|
66
66
|
});
|
|
67
|
-
if (
|
|
68
|
-
className: cn(
|
|
67
|
+
if ("right" === orientation) return /*#__PURE__*/ jsx(ChevronRightIcon, {
|
|
68
|
+
className: cn("size-4", className),
|
|
69
69
|
...props
|
|
70
70
|
});
|
|
71
71
|
return /*#__PURE__*/ jsx(ChevronDownIcon, {
|
|
72
|
-
className: cn(
|
|
72
|
+
className: cn("size-4", className),
|
|
73
73
|
...props
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -100,7 +100,7 @@ function CalendarDayButton({ className, day, modifiers, ...props }) {
|
|
|
100
100
|
]);
|
|
101
101
|
return /*#__PURE__*/ jsx(Button, {
|
|
102
102
|
ref: ref,
|
|
103
|
-
className: cn(
|
|
103
|
+
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),
|
|
104
104
|
"data-day": day.date.toLocaleDateString(),
|
|
105
105
|
"data-range-end": modifiers.range_end,
|
|
106
106
|
"data-range-middle": modifiers.range_middle,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { ComponentProps, JSX } from
|
|
2
|
-
type CardProps = ComponentProps<
|
|
1
|
+
import type { ComponentProps, JSX } from "react";
|
|
2
|
+
type CardProps = ComponentProps<"div">;
|
|
3
3
|
declare function Card({ className, ...props }: CardProps): JSX.Element;
|
|
4
|
-
type CardHeaderProps = ComponentProps<
|
|
4
|
+
type CardHeaderProps = ComponentProps<"div">;
|
|
5
5
|
declare function CardHeader({ className, ...props }: CardHeaderProps): JSX.Element;
|
|
6
|
-
type CardTitleProps = ComponentProps<
|
|
6
|
+
type CardTitleProps = ComponentProps<"div">;
|
|
7
7
|
declare function CardTitle({ children, className, ...props }: CardTitleProps): JSX.Element;
|
|
8
|
-
type CardDescriptionProps = ComponentProps<
|
|
8
|
+
type CardDescriptionProps = ComponentProps<"div">;
|
|
9
9
|
declare function CardDescription({ className, ...props }: CardDescriptionProps): JSX.Element;
|
|
10
|
-
type CardContentProps = ComponentProps<
|
|
10
|
+
type CardContentProps = ComponentProps<"div">;
|
|
11
11
|
declare function CardContent({ className, ...props }: CardContentProps): JSX.Element;
|
|
12
|
-
type CardFooterProps = ComponentProps<
|
|
12
|
+
type CardFooterProps = ComponentProps<"div">;
|
|
13
13
|
declare function CardFooter({ className, ...props }: CardFooterProps): JSX.Element;
|
|
14
|
-
type CardActionProps = ComponentProps<
|
|
14
|
+
type CardActionProps = ComponentProps<"div">;
|
|
15
15
|
declare function CardAction({ className, ...props }: CardActionProps): JSX.Element;
|
|
16
16
|
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
17
17
|
export type { CardActionProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardProps, CardTitleProps, };
|
package/dist/components/card.js
CHANGED
|
@@ -2,21 +2,21 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { cn } from "@codefast/tailwind-variants";
|
|
3
3
|
function Card({ className, ...props }) {
|
|
4
4
|
return /*#__PURE__*/ jsx("div", {
|
|
5
|
-
className: cn(
|
|
5
|
+
className: cn("flex flex-col gap-6 overflow-auto rounded-xl border bg-card py-6 text-card-foreground shadow-sm", className),
|
|
6
6
|
"data-slot": "card",
|
|
7
7
|
...props
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
function CardHeader({ className, ...props }) {
|
|
11
11
|
return /*#__PURE__*/ jsx("div", {
|
|
12
|
-
className: cn(
|
|
12
|
+
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),
|
|
13
13
|
"data-slot": "card-header",
|
|
14
14
|
...props
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
function CardTitle({ children, className, ...props }) {
|
|
18
18
|
return /*#__PURE__*/ jsx("div", {
|
|
19
|
-
className: cn(
|
|
19
|
+
className: cn("leading-none font-semibold", className),
|
|
20
20
|
"data-slot": "card-title",
|
|
21
21
|
...props,
|
|
22
22
|
children: children
|
|
@@ -24,28 +24,28 @@ function CardTitle({ children, className, ...props }) {
|
|
|
24
24
|
}
|
|
25
25
|
function CardDescription({ className, ...props }) {
|
|
26
26
|
return /*#__PURE__*/ jsx("div", {
|
|
27
|
-
className: cn(
|
|
27
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
28
28
|
"data-slot": "card-description",
|
|
29
29
|
...props
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
function CardContent({ className, ...props }) {
|
|
33
33
|
return /*#__PURE__*/ jsx("div", {
|
|
34
|
-
className: cn(
|
|
34
|
+
className: cn("px-6", className),
|
|
35
35
|
"data-slot": "card-content",
|
|
36
36
|
...props
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
function CardFooter({ className, ...props }) {
|
|
40
40
|
return /*#__PURE__*/ jsx("div", {
|
|
41
|
-
className: cn(
|
|
41
|
+
className: cn("flex items-center px-6 [.border-t]:pt-6", className),
|
|
42
42
|
"data-slot": "card-footer",
|
|
43
43
|
...props
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
function CardAction({ className, ...props }) {
|
|
47
47
|
return /*#__PURE__*/ jsx("div", {
|
|
48
|
-
className: cn(
|
|
48
|
+
className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
|
|
49
49
|
"data-slot": "card-action",
|
|
50
50
|
...props
|
|
51
51
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Scope } from
|
|
2
|
-
import type { UseEmblaCarouselType } from
|
|
3
|
-
import type { ComponentProps, JSX } from
|
|
4
|
-
import useEmblaCarousel from
|
|
5
|
-
import { Button } from
|
|
1
|
+
import type { Scope } from "@radix-ui/react-context";
|
|
2
|
+
import type { UseEmblaCarouselType } from "embla-carousel-react";
|
|
3
|
+
import type { ComponentProps, JSX } from "react";
|
|
4
|
+
import useEmblaCarousel from "embla-carousel-react";
|
|
5
|
+
import { Button } from "./button";
|
|
6
6
|
type ScopedProps<P> = P & {
|
|
7
7
|
__scopeCarousel?: Scope;
|
|
8
8
|
};
|
|
@@ -13,25 +13,25 @@ type CarouselOptions = UseCarouselParameters[0];
|
|
|
13
13
|
type CarouselPlugin = UseCarouselParameters[1];
|
|
14
14
|
interface BaseCarouselProps {
|
|
15
15
|
opts?: CarouselOptions;
|
|
16
|
-
orientation?:
|
|
16
|
+
orientation?: "horizontal" | "vertical";
|
|
17
17
|
plugins?: CarouselPlugin;
|
|
18
18
|
setApi?: (api: CarouselApi) => void;
|
|
19
19
|
}
|
|
20
|
-
interface CarouselProps extends BaseCarouselProps, ComponentProps<
|
|
20
|
+
interface CarouselProps extends BaseCarouselProps, ComponentProps<"div"> {
|
|
21
21
|
}
|
|
22
22
|
declare function Carousel({ __scopeCarousel, children, className, opts, orientation, plugins, setApi, ...props }: ScopedProps<CarouselProps>): JSX.Element;
|
|
23
|
-
interface CarouselContentProps extends ComponentProps<
|
|
23
|
+
interface CarouselContentProps extends ComponentProps<"div"> {
|
|
24
24
|
classNames?: {
|
|
25
25
|
content?: string;
|
|
26
26
|
wrapper?: string;
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
declare function CarouselContent({ __scopeCarousel, className, classNames, ...props }: ScopedProps<CarouselContentProps>): JSX.Element;
|
|
30
|
-
type CarouselItemProps = ComponentProps<
|
|
30
|
+
type CarouselItemProps = ComponentProps<"div">;
|
|
31
31
|
declare function CarouselItem({ __scopeCarousel, className, ...props }: ScopedProps<CarouselItemProps>): JSX.Element;
|
|
32
32
|
type CarouselPreviousProps = ComponentProps<typeof Button>;
|
|
33
33
|
declare function CarouselPrevious({ __scopeCarousel, className, size, variant, ...props }: ScopedProps<CarouselPreviousProps>): JSX.Element;
|
|
34
34
|
type CarouselNextProps = ComponentProps<typeof Button>;
|
|
35
35
|
declare function CarouselNext({ __scopeCarousel, className, size, variant, ...props }: ScopedProps<CarouselNextProps>): JSX.Element;
|
|
36
36
|
export type { CarouselApi, CarouselContentProps, CarouselItemProps, CarouselNextProps, CarouselPreviousProps, CarouselProps, };
|
|
37
|
-
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, createCarouselScope };
|
|
37
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, createCarouselScope, };
|
|
@@ -6,13 +6,13 @@ import embla_carousel_react from "embla-carousel-react";
|
|
|
6
6
|
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
|
|
7
7
|
import { useCallback, useEffect, useState } from "react";
|
|
8
8
|
import { Button } from "./button.js";
|
|
9
|
-
const CAROUSEL_NAME =
|
|
9
|
+
const CAROUSEL_NAME = "Carousel";
|
|
10
10
|
const [createCarouselContext, createCarouselScope] = createContextScope(CAROUSEL_NAME);
|
|
11
11
|
const [CarouselContextProvider, useCarouselContext] = createCarouselContext(CAROUSEL_NAME);
|
|
12
12
|
function Carousel({ __scopeCarousel, children, className, opts, orientation, plugins, setApi, ...props }) {
|
|
13
13
|
const [carouselRef, api] = embla_carousel_react({
|
|
14
14
|
...opts,
|
|
15
|
-
axis:
|
|
15
|
+
axis: "vertical" === orientation ? "y" : "x"
|
|
16
16
|
}, plugins);
|
|
17
17
|
const [canScrollPrevious, setCanScrollPrevious] = useState(false);
|
|
18
18
|
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
@@ -32,10 +32,10 @@ function Carousel({ __scopeCarousel, children, className, opts, orientation, plu
|
|
|
32
32
|
api
|
|
33
33
|
]);
|
|
34
34
|
const handleKeyDown = useCallback((event)=>{
|
|
35
|
-
if (
|
|
35
|
+
if ("ArrowLeft" === event.key) {
|
|
36
36
|
event.preventDefault();
|
|
37
37
|
scrollPrevious();
|
|
38
|
-
} else if (
|
|
38
|
+
} else if ("ArrowRight" === event.key) {
|
|
39
39
|
event.preventDefault();
|
|
40
40
|
scrollNext();
|
|
41
41
|
}
|
|
@@ -55,10 +55,10 @@ function Carousel({ __scopeCarousel, children, className, opts, orientation, plu
|
|
|
55
55
|
queueMicrotask(()=>{
|
|
56
56
|
onSelect(api);
|
|
57
57
|
});
|
|
58
|
-
api.on(
|
|
59
|
-
api.on(
|
|
58
|
+
api.on("reInit", onSelect);
|
|
59
|
+
api.on("select", onSelect);
|
|
60
60
|
return ()=>{
|
|
61
|
-
api.off(
|
|
61
|
+
api.off("select", onSelect);
|
|
62
62
|
};
|
|
63
63
|
}, [
|
|
64
64
|
api,
|
|
@@ -70,12 +70,12 @@ function Carousel({ __scopeCarousel, children, className, opts, orientation, plu
|
|
|
70
70
|
canScrollPrev: canScrollPrevious,
|
|
71
71
|
carouselRef: carouselRef,
|
|
72
72
|
opts: opts,
|
|
73
|
-
orientation: orientation ?? (opts?.axis ===
|
|
73
|
+
orientation: orientation ?? (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
74
74
|
scope: __scopeCarousel,
|
|
75
75
|
scrollNext: scrollNext,
|
|
76
76
|
scrollPrev: scrollPrevious,
|
|
77
77
|
children: /*#__PURE__*/ jsx("div", {
|
|
78
|
-
className: cn(
|
|
78
|
+
className: cn("relative", className),
|
|
79
79
|
"data-slot": "carousel",
|
|
80
80
|
onKeyDownCapture: handleKeyDown,
|
|
81
81
|
...props,
|
|
@@ -83,36 +83,36 @@ function Carousel({ __scopeCarousel, children, className, opts, orientation, plu
|
|
|
83
83
|
})
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
const CAROUSEL_CONTENT_NAME =
|
|
86
|
+
const CAROUSEL_CONTENT_NAME = "CarouselContent";
|
|
87
87
|
function CarouselContent({ __scopeCarousel, className, classNames, ...props }) {
|
|
88
88
|
const { carouselRef, orientation } = useCarouselContext(CAROUSEL_CONTENT_NAME, __scopeCarousel);
|
|
89
89
|
return /*#__PURE__*/ jsx("div", {
|
|
90
90
|
ref: carouselRef,
|
|
91
|
-
className: cn(
|
|
91
|
+
className: cn("overflow-hidden", classNames?.wrapper),
|
|
92
92
|
"data-slot": "carousel-content",
|
|
93
93
|
children: /*#__PURE__*/ jsx("div", {
|
|
94
|
-
className: cn(
|
|
94
|
+
className: cn("flex", "horizontal" === orientation ? "-ml-4" : "-mt-4 flex-col", classNames?.content, className),
|
|
95
95
|
...props
|
|
96
96
|
})
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
const CAROUSEL_ITEM_NAME =
|
|
99
|
+
const CAROUSEL_ITEM_NAME = "CarouselItem";
|
|
100
100
|
function CarouselItem({ __scopeCarousel, className, ...props }) {
|
|
101
101
|
const { orientation } = useCarouselContext(CAROUSEL_ITEM_NAME, __scopeCarousel);
|
|
102
102
|
return /*#__PURE__*/ jsx("div", {
|
|
103
103
|
"aria-roledescription": "slide",
|
|
104
|
-
className: cn(
|
|
104
|
+
className: cn("min-w-0 shrink-0 grow-0 basis-full", "horizontal" === orientation ? "pl-4" : "pt-4", className),
|
|
105
105
|
"data-slot": "carousel-item",
|
|
106
106
|
role: "group",
|
|
107
107
|
...props
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
const CAROUSEL_PREVIOUS_NAME =
|
|
111
|
-
function CarouselPrevious({ __scopeCarousel, className, size =
|
|
110
|
+
const CAROUSEL_PREVIOUS_NAME = "CarouselPrevious";
|
|
111
|
+
function CarouselPrevious({ __scopeCarousel, className, size = "icon", variant = "outline", ...props }) {
|
|
112
112
|
const { canScrollPrev, orientation, scrollPrev } = useCarouselContext(CAROUSEL_PREVIOUS_NAME, __scopeCarousel);
|
|
113
113
|
return /*#__PURE__*/ jsxs(Button, {
|
|
114
114
|
"aria-label": "Previous slide",
|
|
115
|
-
className: cn(
|
|
115
|
+
className: cn("absolute size-8 shadow-none", "horizontal" === orientation ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
116
116
|
"data-slot": "carousel-previous",
|
|
117
117
|
disabled: !canScrollPrev,
|
|
118
118
|
size: size,
|
|
@@ -128,12 +128,12 @@ function CarouselPrevious({ __scopeCarousel, className, size = 'icon', variant =
|
|
|
128
128
|
]
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
const CAROUSEL_NEXT_NAME =
|
|
132
|
-
function CarouselNext({ __scopeCarousel, className, size =
|
|
131
|
+
const CAROUSEL_NEXT_NAME = "CarouselNext";
|
|
132
|
+
function CarouselNext({ __scopeCarousel, className, size = "icon", variant = "outline", ...props }) {
|
|
133
133
|
const { canScrollNext, orientation, scrollNext } = useCarouselContext(CAROUSEL_NEXT_NAME, __scopeCarousel);
|
|
134
134
|
return /*#__PURE__*/ jsxs(Button, {
|
|
135
135
|
"aria-label": "Next slide",
|
|
136
|
-
className: cn(
|
|
136
|
+
className: cn("absolute size-8 shadow-none", "horizontal" === orientation ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className),
|
|
137
137
|
"data-slot": "carousel-next",
|
|
138
138
|
disabled: !canScrollNext,
|
|
139
139
|
size: size,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { Scope } from
|
|
2
|
-
import type { ComponentProps, ComponentType, JSX, ReactNode } from
|
|
3
|
-
import type { NameType, Payload, ValueType } from
|
|
4
|
-
import
|
|
1
|
+
import type { Scope } from "@radix-ui/react-context";
|
|
2
|
+
import type { ComponentProps, ComponentType, JSX, ReactNode } from "react";
|
|
3
|
+
import type { NameType, Payload, ValueType } from "recharts/types/component/DefaultTooltipContent";
|
|
4
|
+
import type { TooltipContentProps, TooltipProps } from "recharts";
|
|
5
|
+
import * as RechartsPrimitive from "recharts";
|
|
5
6
|
type ExtractProps<T> = T extends (props: infer P) => ReactNode ? P : never;
|
|
6
7
|
type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
7
8
|
declare const THEMES: {
|
|
@@ -22,8 +23,8 @@ type ScopedProps<P> = P & {
|
|
|
22
23
|
__scopeChart?: Scope;
|
|
23
24
|
};
|
|
24
25
|
declare const createChartScope: import("@radix-ui/react-context").CreateScope;
|
|
25
|
-
interface ChartContainerProps extends ComponentProps<
|
|
26
|
-
children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>[
|
|
26
|
+
interface ChartContainerProps extends ComponentProps<"div"> {
|
|
27
|
+
children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
27
28
|
config: ChartConfig;
|
|
28
29
|
}
|
|
29
30
|
declare function ChartContainer({ __scopeChart, children, className, config, id, ...props }: ScopedProps<ChartContainerProps>): JSX.Element;
|
|
@@ -32,12 +33,12 @@ interface ChartStyleProps {
|
|
|
32
33
|
id: string;
|
|
33
34
|
}
|
|
34
35
|
declare function ChartStyle({ config, id }: ChartStyleProps): ReactNode;
|
|
35
|
-
type ChartTooltipProps<TValue extends ValueType, TName extends NameType> =
|
|
36
|
+
type ChartTooltipProps<TValue extends ValueType, TName extends NameType> = TooltipProps<TValue, TName>;
|
|
36
37
|
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
37
|
-
type ChartTooltipContentProps<TValue extends ValueType, TName extends NameType> = Omit<MakeOptional<
|
|
38
|
+
type ChartTooltipContentProps<TValue extends ValueType, TName extends NameType> = Omit<MakeOptional<TooltipContentProps<TValue, TName>, "accessibilityLayer" | "active" | "activeIndex" | "coordinate" | "payload">, "payload"> & {
|
|
38
39
|
hideIndicator?: boolean;
|
|
39
40
|
hideLabel?: boolean;
|
|
40
|
-
indicator?:
|
|
41
|
+
indicator?: "dashed" | "dot" | "line";
|
|
41
42
|
labelKey?: string;
|
|
42
43
|
nameKey?: string;
|
|
43
44
|
color?: string | undefined;
|
|
@@ -46,8 +47,8 @@ type ChartTooltipContentProps<TValue extends ValueType, TName extends NameType>
|
|
|
46
47
|
};
|
|
47
48
|
declare function ChartTooltipContent<TValue extends ValueType, TName extends NameType>({ __scopeChart, active, className, color, formatter, hideIndicator, hideLabel, indicator, label, labelClassName, labelFormatter, labelKey, nameKey, payload, }: ScopedProps<ChartTooltipContentProps<TValue, TName>>): ReactNode;
|
|
48
49
|
type ChartLegendProps = ComponentProps<typeof RechartsPrimitive.Legend>;
|
|
49
|
-
declare const ChartLegend:
|
|
50
|
-
type ChartLegendContentProps = ComponentProps<
|
|
50
|
+
declare const ChartLegend: import("react").MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
51
|
+
type ChartLegendContentProps = ComponentProps<"div"> & ExtractProps<RechartsPrimitive.LegendProps["content"]> & {
|
|
51
52
|
hideIcon?: boolean;
|
|
52
53
|
nameKey?: string;
|
|
53
54
|
};
|