shadcn-packaged 2025.8.18 → 2025.9.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.
Files changed (93) hide show
  1. package/index.css +20 -0
  2. package/package.json +4 -4
  3. package/ui/accordion.d.ts +4 -4
  4. package/ui/accordion.jsx +15 -20
  5. package/ui/alert-dialog.d.ts +17 -11
  6. package/ui/alert-dialog.jsx +23 -36
  7. package/ui/alert.d.ts +4 -5
  8. package/ui/alert.jsx +9 -12
  9. package/ui/aspect-ratio.d.ts +1 -1
  10. package/ui/aspect-ratio.jsx +1 -3
  11. package/ui/avatar.d.ts +3 -3
  12. package/ui/avatar.jsx +6 -9
  13. package/ui/badge.d.ts +3 -3
  14. package/ui/badge.jsx +7 -9
  15. package/ui/breadcrumb.d.ts +16 -8
  16. package/ui/breadcrumb.jsx +21 -26
  17. package/ui/button.d.ts +3 -2
  18. package/ui/button.jsx +14 -13
  19. package/ui/calendar.jsx +20 -20
  20. package/ui/card.d.ts +7 -8
  21. package/ui/card.jsx +13 -22
  22. package/ui/carousel.d.ts +5 -6
  23. package/ui/carousel.jsx +34 -26
  24. package/ui/chart.d.ts +28 -6
  25. package/ui/chart.jsx +40 -37
  26. package/ui/checkbox.d.ts +1 -1
  27. package/ui/checkbox.jsx +7 -8
  28. package/ui/collapsible.d.ts +3 -3
  29. package/ui/collapsible.jsx +3 -9
  30. package/ui/command.d.ts +78 -16
  31. package/ui/command.jsx +27 -37
  32. package/ui/context-menu.d.ts +21 -19
  33. package/ui/context-menu.jsx +47 -65
  34. package/ui/dialog.d.ts +17 -13
  35. package/ui/dialog.jsx +27 -41
  36. package/ui/drawer.d.ts +19 -10
  37. package/ui/drawer.jsx +23 -36
  38. package/ui/dropdown-menu.d.ts +22 -20
  39. package/ui/dropdown-menu.jsx +50 -66
  40. package/ui/form.d.ts +5 -6
  41. package/ui/form.jsx +23 -19
  42. package/ui/hover-card.d.ts +3 -3
  43. package/ui/hover-card.jsx +4 -11
  44. package/ui/input-otp.d.ts +30 -7
  45. package/ui/input-otp.jsx +15 -17
  46. package/ui/input.d.ts +1 -1
  47. package/ui/input.jsx +4 -3
  48. package/ui/label.d.ts +2 -1
  49. package/ui/label.jsx +4 -3
  50. package/ui/menubar.d.ts +19 -17
  51. package/ui/menubar.jsx +49 -58
  52. package/ui/navigation-menu.d.ts +9 -11
  53. package/ui/navigation-menu.jsx +29 -37
  54. package/ui/pagination.d.ts +25 -10
  55. package/ui/pagination.jsx +28 -35
  56. package/ui/popover.d.ts +4 -5
  57. package/ui/popover.jsx +7 -15
  58. package/ui/progress.d.ts +1 -1
  59. package/ui/progress.jsx +4 -5
  60. package/ui/radio-group.d.ts +2 -2
  61. package/ui/radio-group.jsx +11 -9
  62. package/ui/resizable.d.ts +20 -5
  63. package/ui/resizable.jsx +8 -15
  64. package/ui/scroll-area.d.ts +2 -2
  65. package/ui/scroll-area.jsx +14 -16
  66. package/ui/select.d.ts +11 -13
  67. package/ui/select.jsx +47 -58
  68. package/ui/separator.d.ts +1 -1
  69. package/ui/separator.jsx +2 -3
  70. package/ui/sheet.d.ts +23 -11
  71. package/ui/sheet.jsx +41 -45
  72. package/ui/sidebar.d.ts +34 -38
  73. package/ui/sidebar.jsx +122 -109
  74. package/ui/skeleton.d.ts +1 -1
  75. package/ui/skeleton.jsx +1 -1
  76. package/ui/slider.d.ts +1 -1
  77. package/ui/slider.jsx +7 -13
  78. package/ui/sonner.d.ts +2 -1
  79. package/ui/sonner.jsx +7 -4
  80. package/ui/switch.d.ts +2 -2
  81. package/ui/switch.jsx +5 -6
  82. package/ui/table.d.ts +8 -8
  83. package/ui/table.jsx +18 -27
  84. package/ui/tabs.d.ts +4 -4
  85. package/ui/tabs.jsx +7 -12
  86. package/ui/textarea.d.ts +1 -1
  87. package/ui/textarea.jsx +4 -3
  88. package/ui/toggle-group.d.ts +8 -3
  89. package/ui/toggle-group.jsx +11 -11
  90. package/ui/toggle.d.ts +4 -1
  91. package/ui/toggle.jsx +7 -8
  92. package/ui/tooltip.d.ts +4 -4
  93. package/ui/tooltip.jsx +5 -19
package/ui/calendar.jsx CHANGED
@@ -6,33 +6,33 @@ import { cn } from "../lib/utils";
6
6
  import { Button, buttonVariants } from "../ui/button";
7
7
  function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", formatters, components, ...props }) {
8
8
  const defaultClassNames = getDefaultClassNames();
9
- return (<DayPicker showOutsideDays={showOutsideDays} className={cn("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw `rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw `rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className)} captionLayout={captionLayout} formatters={{
9
+ return (<DayPicker showOutsideDays={showOutsideDays} className={cn("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw `rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw `rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className)} captionLayout={captionLayout} formatters={{
10
10
  formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
11
11
  ...formatters,
12
12
  }} classNames={{
13
13
  root: cn("w-fit", defaultClassNames.root),
14
- months: cn("flex gap-4 flex-col md:flex-row relative", defaultClassNames.months),
15
- month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
16
- nav: cn("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between", defaultClassNames.nav),
17
- button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", defaultClassNames.button_previous),
18
- button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", defaultClassNames.button_next),
19
- month_caption: cn("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)", defaultClassNames.month_caption),
20
- dropdowns: cn("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5", defaultClassNames.dropdowns),
21
- dropdown_root: cn("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md", defaultClassNames.dropdown_root),
22
- dropdown: cn("absolute bg-popover inset-0 opacity-0", defaultClassNames.dropdown),
14
+ months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
15
+ month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
16
+ nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
17
+ button_previous: cn(buttonVariants({ variant: buttonVariant }), "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50", defaultClassNames.button_previous),
18
+ button_next: cn(buttonVariants({ variant: buttonVariant }), "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50", defaultClassNames.button_next),
19
+ month_caption: cn("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]", defaultClassNames.month_caption),
20
+ dropdowns: cn("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
21
+ dropdown_root: cn("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border", defaultClassNames.dropdown_root),
22
+ dropdown: cn("bg-popover absolute inset-0 opacity-0", defaultClassNames.dropdown),
23
23
  caption_label: cn("select-none font-medium", captionLayout === "label"
24
24
  ? "text-sm"
25
- : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5", defaultClassNames.caption_label),
25
+ : "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5", defaultClassNames.caption_label),
26
26
  table: "w-full border-collapse",
27
27
  weekdays: cn("flex", defaultClassNames.weekdays),
28
- weekday: cn("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none", defaultClassNames.weekday),
29
- week: cn("flex w-full mt-2", defaultClassNames.week),
30
- week_number_header: cn("select-none w-(--cell-size)", defaultClassNames.week_number_header),
31
- week_number: cn("text-[0.8rem] select-none text-muted-foreground", defaultClassNames.week_number),
32
- day: cn("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none", defaultClassNames.day),
33
- range_start: cn("rounded-l-md bg-accent", defaultClassNames.range_start),
28
+ weekday: cn("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal", defaultClassNames.weekday),
29
+ week: cn("mt-2 flex w-full", defaultClassNames.week),
30
+ week_number_header: cn("w-[--cell-size] select-none", defaultClassNames.week_number_header),
31
+ week_number: cn("text-muted-foreground select-none text-[0.8rem]", defaultClassNames.week_number),
32
+ day: cn("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md", defaultClassNames.day),
33
+ range_start: cn("bg-accent rounded-l-md", defaultClassNames.range_start),
34
34
  range_middle: cn("rounded-none", defaultClassNames.range_middle),
35
- range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
35
+ range_end: cn("bg-accent rounded-r-md", defaultClassNames.range_end),
36
36
  today: cn("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none", defaultClassNames.today),
37
37
  outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
38
38
  disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
@@ -54,7 +54,7 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
54
54
  DayButton: CalendarDayButton,
55
55
  WeekNumber: ({ children, ...props }) => {
56
56
  return (<td {...props}>
57
- <div className="flex size-(--cell-size) items-center justify-center text-center">
57
+ <div className="flex size-[--cell-size] items-center justify-center text-center">
58
58
  {children}
59
59
  </div>
60
60
  </td>);
@@ -72,6 +72,6 @@ function CalendarDayButton({ className, day, modifiers, ...props }) {
72
72
  return (<Button ref={ref} variant="ghost" size="icon" data-day={day.date.toLocaleDateString()} data-selected-single={modifiers.selected &&
73
73
  !modifiers.range_start &&
74
74
  !modifiers.range_end &&
75
- !modifiers.range_middle} data-range-start={modifiers.range_start} data-range-end={modifiers.range_end} data-range-middle={modifiers.range_middle} className={cn("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground 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:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className)} {...props}/>);
75
+ !modifiers.range_middle} data-range-start={modifiers.range_start} data-range-end={modifiers.range_end} data-range-middle={modifiers.range_middle} className={cn("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className)} {...props}/>);
76
76
  }
77
77
  export { Calendar, CalendarDayButton };
package/ui/card.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import * as React from "react";
2
- declare function Card({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
3
- declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
4
- declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
5
- declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
6
- declare function CardAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
7
- declare function CardContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
8
- declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
9
- export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
2
+ declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
3
+ declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
4
+ declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
5
+ declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
6
+ declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
7
+ declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
package/ui/card.jsx CHANGED
@@ -1,24 +1,15 @@
1
1
  import * as React from "react";
2
2
  import { cn } from "../lib/utils";
3
- function Card({ className, ...props }) {
4
- return (<div data-slot="card" className={cn("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm", className)} {...props}/>);
5
- }
6
- function CardHeader({ className, ...props }) {
7
- return (<div data-slot="card-header" 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)} {...props}/>);
8
- }
9
- function CardTitle({ className, ...props }) {
10
- return (<div data-slot="card-title" className={cn("leading-none font-semibold", className)} {...props}/>);
11
- }
12
- function CardDescription({ className, ...props }) {
13
- return (<div data-slot="card-description" className={cn("text-muted-foreground text-sm", className)} {...props}/>);
14
- }
15
- function CardAction({ className, ...props }) {
16
- return (<div data-slot="card-action" className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)} {...props}/>);
17
- }
18
- function CardContent({ className, ...props }) {
19
- return (<div data-slot="card-content" className={cn("px-6", className)} {...props}/>);
20
- }
21
- function CardFooter({ className, ...props }) {
22
- return (<div data-slot="card-footer" className={cn("flex items-center px-6 [.border-t]:pt-6", className)} {...props}/>);
23
- }
24
- export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
3
+ const Card = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("rounded-lg border bg-card text-card-foreground shadow-sm", className)} {...props}/>));
4
+ Card.displayName = "Card";
5
+ const CardHeader = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props}/>));
6
+ CardHeader.displayName = "CardHeader";
7
+ const CardTitle = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("text-2xl font-semibold leading-none tracking-tight", className)} {...props}/>));
8
+ CardTitle.displayName = "CardTitle";
9
+ const CardDescription = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props}/>));
10
+ CardDescription.displayName = "CardDescription";
11
+ const CardContent = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("p-6 pt-0", className)} {...props}/>));
12
+ CardContent.displayName = "CardContent";
13
+ const CardFooter = React.forwardRef(({ className, ...props }, ref) => (<div ref={ref} className={cn("flex items-center p-6 pt-0", className)} {...props}/>));
14
+ CardFooter.displayName = "CardFooter";
15
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
package/ui/carousel.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as React from "react";
2
2
  import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
3
- import { Button } from "../ui/button";
4
3
  type CarouselApi = UseEmblaCarouselType[1];
5
4
  type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
6
5
  type CarouselOptions = UseCarouselParameters[0];
@@ -11,9 +10,9 @@ type CarouselProps = {
11
10
  orientation?: "horizontal" | "vertical";
12
11
  setApi?: (api: CarouselApi) => void;
13
12
  };
14
- declare function Carousel({ orientation, opts, setApi, plugins, className, children, ...props }: React.ComponentProps<"div"> & CarouselProps): React.JSX.Element;
15
- declare function CarouselContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
16
- declare function CarouselItem({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
17
- declare function CarouselPrevious({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
18
- declare function CarouselNext({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
13
+ declare const Carousel: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & CarouselProps & React.RefAttributes<HTMLDivElement>>;
14
+ declare const CarouselContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
15
+ declare const CarouselItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
16
+ declare const CarouselPrevious: React.ForwardRefExoticComponent<Omit<import("../ui/button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
17
+ declare const CarouselNext: React.ForwardRefExoticComponent<Omit<import("../ui/button").ButtonProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
19
18
  export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
package/ui/carousel.jsx CHANGED
@@ -12,7 +12,7 @@ function useCarousel() {
12
12
  }
13
13
  return context;
14
14
  }
15
- function Carousel({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }) {
15
+ const Carousel = React.forwardRef(({ orientation = "horizontal", opts, setApi, plugins, className, children, ...props }, ref) => {
16
16
  const [carouselRef, api] = useEmblaCarousel({
17
17
  ...opts,
18
18
  axis: orientation === "horizontal" ? "x" : "y",
@@ -20,8 +20,9 @@ function Carousel({ orientation = "horizontal", opts, setApi, plugins, className
20
20
  const [canScrollPrev, setCanScrollPrev] = React.useState(false);
21
21
  const [canScrollNext, setCanScrollNext] = React.useState(false);
22
22
  const onSelect = React.useCallback((api) => {
23
- if (!api)
23
+ if (!api) {
24
24
  return;
25
+ }
25
26
  setCanScrollPrev(api.canScrollPrev());
26
27
  setCanScrollNext(api.canScrollNext());
27
28
  }, []);
@@ -42,13 +43,15 @@ function Carousel({ orientation = "horizontal", opts, setApi, plugins, className
42
43
  }
43
44
  }, [scrollPrev, scrollNext]);
44
45
  React.useEffect(() => {
45
- if (!api || !setApi)
46
+ if (!api || !setApi) {
46
47
  return;
48
+ }
47
49
  setApi(api);
48
50
  }, [api, setApi]);
49
51
  React.useEffect(() => {
50
- if (!api)
52
+ if (!api) {
51
53
  return;
54
+ }
52
55
  onSelect(api);
53
56
  api.on("reInit", onSelect);
54
57
  api.on("select", onSelect);
@@ -66,37 +69,42 @@ function Carousel({ orientation = "horizontal", opts, setApi, plugins, className
66
69
  canScrollPrev,
67
70
  canScrollNext,
68
71
  }}>
69
- <div onKeyDownCapture={handleKeyDown} className={cn("relative", className)} role="region" aria-roledescription="carousel" data-slot="carousel" {...props}>
70
- {children}
71
- </div>
72
- </CarouselContext.Provider>);
73
- }
74
- function CarouselContent({ className, ...props }) {
72
+ <div ref={ref} onKeyDownCapture={handleKeyDown} className={cn("relative", className)} role="region" aria-roledescription="carousel" {...props}>
73
+ {children}
74
+ </div>
75
+ </CarouselContext.Provider>);
76
+ });
77
+ Carousel.displayName = "Carousel";
78
+ const CarouselContent = React.forwardRef(({ className, ...props }, ref) => {
75
79
  const { carouselRef, orientation } = useCarousel();
76
- return (<div ref={carouselRef} className="overflow-hidden" data-slot="carousel-content">
77
- <div className={cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className)} {...props}/>
80
+ return (<div ref={carouselRef} className="overflow-hidden">
81
+ <div ref={ref} className={cn("flex", orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className)} {...props}/>
78
82
  </div>);
79
- }
80
- function CarouselItem({ className, ...props }) {
83
+ });
84
+ CarouselContent.displayName = "CarouselContent";
85
+ const CarouselItem = React.forwardRef(({ className, ...props }, ref) => {
81
86
  const { orientation } = useCarousel();
82
- return (<div role="group" aria-roledescription="slide" data-slot="carousel-item" className={cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className)} {...props}/>);
83
- }
84
- function CarouselPrevious({ className, variant = "outline", size = "icon", ...props }) {
87
+ return (<div ref={ref} role="group" aria-roledescription="slide" className={cn("min-w-0 shrink-0 grow-0 basis-full", orientation === "horizontal" ? "pl-4" : "pt-4", className)} {...props}/>);
88
+ });
89
+ CarouselItem.displayName = "CarouselItem";
90
+ const CarouselPrevious = React.forwardRef(({ className, variant = "outline", size = "icon", ...props }, ref) => {
85
91
  const { orientation, scrollPrev, canScrollPrev } = useCarousel();
86
- return (<Button data-slot="carousel-previous" variant={variant} size={size} className={cn("absolute size-8 rounded-full", orientation === "horizontal"
87
- ? "top-1/2 -left-12 -translate-y-1/2"
92
+ return (<Button ref={ref} variant={variant} size={size} className={cn("absolute h-8 w-8 rounded-full", orientation === "horizontal"
93
+ ? "-left-12 top-1/2 -translate-y-1/2"
88
94
  : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className)} disabled={!canScrollPrev} onClick={scrollPrev} {...props}>
89
- <ArrowLeft />
95
+ <ArrowLeft className="h-4 w-4"/>
90
96
  <span className="sr-only">Previous slide</span>
91
97
  </Button>);
92
- }
93
- function CarouselNext({ className, variant = "outline", size = "icon", ...props }) {
98
+ });
99
+ CarouselPrevious.displayName = "CarouselPrevious";
100
+ const CarouselNext = React.forwardRef(({ className, variant = "outline", size = "icon", ...props }, ref) => {
94
101
  const { orientation, scrollNext, canScrollNext } = useCarousel();
95
- return (<Button data-slot="carousel-next" variant={variant} size={size} className={cn("absolute size-8 rounded-full", orientation === "horizontal"
96
- ? "top-1/2 -right-12 -translate-y-1/2"
102
+ return (<Button ref={ref} variant={variant} size={size} className={cn("absolute h-8 w-8 rounded-full", orientation === "horizontal"
103
+ ? "-right-12 top-1/2 -translate-y-1/2"
97
104
  : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className)} disabled={!canScrollNext} onClick={scrollNext} {...props}>
98
- <ArrowRight />
105
+ <ArrowRight className="h-4 w-4"/>
99
106
  <span className="sr-only">Next slide</span>
100
107
  </Button>);
101
- }
108
+ });
109
+ CarouselNext.displayName = "CarouselNext";
102
110
  export { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
package/ui/chart.d.ts CHANGED
@@ -16,25 +16,47 @@ export type ChartConfig = {
16
16
  theme: Record<keyof typeof THEMES, string>;
17
17
  });
18
18
  };
19
- declare function ChartContainer({ id, className, children, config, ...props }: React.ComponentProps<"div"> & {
19
+ declare const ChartContainer: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
20
20
  config: ChartConfig;
21
21
  children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
22
- }): React.JSX.Element;
22
+ }, "ref"> & React.RefAttributes<HTMLDivElement>>;
23
23
  declare const ChartStyle: ({ id, config }: {
24
24
  id: string;
25
25
  config: ChartConfig;
26
26
  }) => React.JSX.Element;
27
27
  declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
28
- declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> & React.ComponentProps<"div"> & {
28
+ declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<RechartsPrimitive.DefaultTooltipContentProps<import("recharts/types/component/DefaultTooltipContent").ValueType, import("recharts/types/component/DefaultTooltipContent").NameType> & {
29
+ accessibilityLayer?: boolean;
30
+ active?: boolean | undefined;
31
+ includeHidden?: boolean | undefined;
32
+ allowEscapeViewBox?: import("recharts/types/util/types").AllowInDimension;
33
+ animationDuration?: import("recharts/types/util/types").AnimationDuration;
34
+ animationEasing?: import("recharts/types/util/types").AnimationTiming;
35
+ content?: import("recharts/types/component/Tooltip").ContentType<import("recharts/types/component/DefaultTooltipContent").ValueType, import("recharts/types/component/DefaultTooltipContent").NameType>;
36
+ coordinate?: Partial<import("recharts/types/util/types").Coordinate>;
37
+ cursor?: boolean | React.ReactElement | React.SVGProps<SVGElement>;
38
+ filterNull?: boolean;
39
+ defaultIndex?: number;
40
+ isAnimationActive?: boolean;
41
+ offset?: number;
42
+ payloadUniqBy?: import("recharts/types/util/payload/getUniqPayload").UniqueOption<import("recharts/types/component/DefaultTooltipContent").Payload<import("recharts/types/component/DefaultTooltipContent").ValueType, import("recharts/types/component/DefaultTooltipContent").NameType>>;
43
+ position?: Partial<import("recharts/types/util/types").Coordinate>;
44
+ reverseDirection?: import("recharts/types/util/types").AllowInDimension;
45
+ shared?: boolean;
46
+ trigger?: "hover" | "click";
47
+ useTranslate3d?: boolean;
48
+ viewBox?: import("recharts/types/util/types").CartesianViewBox;
49
+ wrapperStyle?: React.CSSProperties;
50
+ } & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
29
51
  hideLabel?: boolean;
30
52
  hideIndicator?: boolean;
31
53
  indicator?: "line" | "dot" | "dashed";
32
54
  nameKey?: string;
33
55
  labelKey?: string;
34
- }): React.JSX.Element;
56
+ }, "ref"> & React.RefAttributes<HTMLDivElement>>;
35
57
  declare const ChartLegend: typeof RechartsPrimitive.Legend;
36
- declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: React.ComponentProps<"div"> & Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
58
+ declare const ChartLegendContent: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Pick<RechartsPrimitive.LegendProps, "verticalAlign" | "payload"> & {
37
59
  hideIcon?: boolean;
38
60
  nameKey?: string;
39
- }): React.JSX.Element;
61
+ }, "ref"> & React.RefAttributes<HTMLDivElement>>;
40
62
  export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
package/ui/chart.jsx CHANGED
@@ -12,18 +12,19 @@ function useChart() {
12
12
  }
13
13
  return context;
14
14
  }
15
- function ChartContainer({ id, className, children, config, ...props }) {
15
+ const ChartContainer = React.forwardRef(({ id, className, children, config, ...props }, ref) => {
16
16
  const uniqueId = React.useId();
17
17
  const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
18
18
  return (<ChartContext.Provider value={{ config }}>
19
- <div data-slot="chart" data-chart={chartId} className={cn("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className)} {...props}>
19
+ <div data-chart={chartId} ref={ref} className={cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none", className)} {...props}>
20
20
  <ChartStyle id={chartId} config={config}/>
21
21
  <RechartsPrimitive.ResponsiveContainer>
22
22
  {children}
23
23
  </RechartsPrimitive.ResponsiveContainer>
24
24
  </div>
25
25
  </ChartContext.Provider>);
26
- }
26
+ });
27
+ ChartContainer.displayName = "Chart";
27
28
  const ChartStyle = ({ id, config }) => {
28
29
  const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
29
30
  if (!colorConfig.length) {
@@ -46,7 +47,7 @@ ${colorConfig
46
47
  }}/>);
47
48
  };
48
49
  const ChartTooltip = RechartsPrimitive.Tooltip;
49
- function ChartTooltipContent({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }) {
50
+ const ChartTooltipContent = React.forwardRef(({ active, payload, className, indicator = "dot", hideLabel = false, hideIndicator = false, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }, ref) => {
50
51
  const { config } = useChart();
51
52
  const tooltipLabel = React.useMemo(() => {
52
53
  if (hideLabel || !payload?.length) {
@@ -60,8 +61,8 @@ function ChartTooltipContent({ active, payload, className, indicator = "dot", hi
60
61
  : itemConfig?.label;
61
62
  if (labelFormatter) {
62
63
  return (<div className={cn("font-medium", labelClassName)}>
63
- {labelFormatter(value, payload)}
64
- </div>);
64
+ {labelFormatter(value, payload)}
65
+ </div>);
65
66
  }
66
67
  if (!value) {
67
68
  return null;
@@ -80,16 +81,16 @@ function ChartTooltipContent({ active, payload, className, indicator = "dot", hi
80
81
  return null;
81
82
  }
82
83
  const nestLabel = payload.length === 1 && indicator !== "dot";
83
- return (<div className={cn("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", className)}>
84
- {!nestLabel ? tooltipLabel : null}
85
- <div className="grid gap-1.5">
86
- {payload.map((item, index) => {
84
+ return (<div ref={ref} className={cn("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className)}>
85
+ {!nestLabel ? tooltipLabel : null}
86
+ <div className="grid gap-1.5">
87
+ {payload.map((item, index) => {
87
88
  const key = `${nameKey || item.name || item.dataKey || "value"}`;
88
89
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
89
90
  const indicatorColor = color || item.payload.fill || item.color;
90
- return (<div key={item.dataKey} className={cn("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", indicator === "dot" && "items-center")}>
91
- {formatter && item?.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, item.payload)) : (<>
92
- {itemConfig?.icon ? (<itemConfig.icon />) : (!hideIndicator && (<div className={cn("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", {
91
+ return (<div key={item.dataKey} className={cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center")}>
92
+ {formatter && item?.value !== undefined && item.name ? (formatter(item.value, item.name, item, index, item.payload)) : (<>
93
+ {itemConfig?.icon ? (<itemConfig.icon />) : (!hideIndicator && (<div className={cn("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
93
94
  "h-2.5 w-2.5": indicator === "dot",
94
95
  "w-1": indicator === "line",
95
96
  "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
@@ -98,42 +99,44 @@ function ChartTooltipContent({ active, payload, className, indicator = "dot", hi
98
99
  "--color-bg": indicatorColor,
99
100
  "--color-border": indicatorColor,
100
101
  }}/>))}
101
- <div className={cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center")}>
102
- <div className="grid gap-1.5">
103
- {nestLabel ? tooltipLabel : null}
104
- <span className="text-muted-foreground">
105
- {itemConfig?.label || item.name}
106
- </span>
102
+ <div className={cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center")}>
103
+ <div className="grid gap-1.5">
104
+ {nestLabel ? tooltipLabel : null}
105
+ <span className="text-muted-foreground">
106
+ {itemConfig?.label || item.name}
107
+ </span>
108
+ </div>
109
+ {item.value && (<span className="font-mono font-medium tabular-nums text-foreground">
110
+ {item.value.toLocaleString()}
111
+ </span>)}
107
112
  </div>
108
- {item.value && (<span className="text-foreground font-mono font-medium tabular-nums">
109
- {item.value.toLocaleString()}
110
- </span>)}
111
- </div>
112
- </>)}
113
- </div>);
113
+ </>)}
114
+ </div>);
114
115
  })}
115
- </div>
116
- </div>);
117
- }
116
+ </div>
117
+ </div>);
118
+ });
119
+ ChartTooltipContent.displayName = "ChartTooltip";
118
120
  const ChartLegend = RechartsPrimitive.Legend;
119
- function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey, }) {
121
+ const ChartLegendContent = React.forwardRef(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
120
122
  const { config } = useChart();
121
123
  if (!payload?.length) {
122
124
  return null;
123
125
  }
124
- return (<div className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}>
125
- {payload.map((item) => {
126
+ return (<div ref={ref} className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}>
127
+ {payload.map((item) => {
126
128
  const key = `${nameKey || item.dataKey || "value"}`;
127
129
  const itemConfig = getPayloadConfigFromPayload(config, item, key);
128
- return (<div key={item.value} className={cn("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3")}>
129
- {itemConfig?.icon && !hideIcon ? (<itemConfig.icon />) : (<div className="h-2 w-2 shrink-0 rounded-[2px]" style={{
130
+ return (<div key={item.value} className={cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground")}>
131
+ {itemConfig?.icon && !hideIcon ? (<itemConfig.icon />) : (<div className="h-2 w-2 shrink-0 rounded-[2px]" style={{
130
132
  backgroundColor: item.color,
131
133
  }}/>)}
132
- {itemConfig?.label}
133
- </div>);
134
+ {itemConfig?.label}
135
+ </div>);
134
136
  })}
135
- </div>);
136
- }
137
+ </div>);
138
+ });
139
+ ChartLegendContent.displayName = "ChartLegend";
137
140
  // Helper to extract item config from a payload.
138
141
  function getPayloadConfigFromPayload(config, payload, key) {
139
142
  if (typeof payload !== "object" || payload === null) {
package/ui/checkbox.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import * as React from "react";
2
2
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3
- declare function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>): React.JSX.Element;
3
+ declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
4
  export { Checkbox };
package/ui/checkbox.jsx CHANGED
@@ -1,13 +1,12 @@
1
1
  "use client";
2
2
  import * as React from "react";
3
3
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
4
- import { CheckIcon } from "lucide-react";
4
+ import { Check } from "lucide-react";
5
5
  import { cn } from "../lib/utils";
6
- function Checkbox({ className, ...props }) {
7
- return (<CheckboxPrimitive.Root data-slot="checkbox" className={cn("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className)} {...props}>
8
- <CheckboxPrimitive.Indicator data-slot="checkbox-indicator" className="flex items-center justify-center text-current transition-none">
9
- <CheckIcon className="size-3.5"/>
10
- </CheckboxPrimitive.Indicator>
11
- </CheckboxPrimitive.Root>);
12
- }
6
+ const Checkbox = React.forwardRef(({ className, ...props }, ref) => (<CheckboxPrimitive.Root ref={ref} className={cn("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground", className)} {...props}>
7
+ <CheckboxPrimitive.Indicator className={cn("flex items-center justify-center text-current")}>
8
+ <Check className="h-4 w-4"/>
9
+ </CheckboxPrimitive.Indicator>
10
+ </CheckboxPrimitive.Root>));
11
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName;
13
12
  export { Checkbox };
@@ -1,5 +1,5 @@
1
1
  import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
2
- declare function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>): import("react").JSX.Element;
3
- declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): import("react").JSX.Element;
4
- declare function CollapsibleContent({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): import("react").JSX.Element;
2
+ declare const Collapsible: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleProps & import("react").RefAttributes<HTMLDivElement>>;
3
+ declare const CollapsibleTrigger: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
4
+ declare const CollapsibleContent: import("react").ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleContentProps & import("react").RefAttributes<HTMLDivElement>>;
5
5
  export { Collapsible, CollapsibleTrigger, CollapsibleContent };
@@ -1,12 +1,6 @@
1
1
  "use client";
2
2
  import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
3
- function Collapsible({ ...props }) {
4
- return <CollapsiblePrimitive.Root data-slot="collapsible" {...props}/>;
5
- }
6
- function CollapsibleTrigger({ ...props }) {
7
- return (<CollapsiblePrimitive.CollapsibleTrigger data-slot="collapsible-trigger" {...props}/>);
8
- }
9
- function CollapsibleContent({ ...props }) {
10
- return (<CollapsiblePrimitive.CollapsibleContent data-slot="collapsible-content" {...props}/>);
11
- }
3
+ const Collapsible = CollapsiblePrimitive.Root;
4
+ const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
5
+ const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
12
6
  export { Collapsible, CollapsibleTrigger, CollapsibleContent };