@blips/ui 0.0.1 → 2.0.0

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 (60) hide show
  1. package/dist/index.cjs +4308 -2010
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +435 -411
  4. package/dist/index.d.ts +435 -411
  5. package/dist/index.js +4244 -2008
  6. package/dist/index.js.map +1 -1
  7. package/package.json +18 -4
  8. package/src/components/accordion.tsx +58 -48
  9. package/src/components/alert-dialog.tsx +170 -112
  10. package/src/components/alert.tsx +49 -42
  11. package/src/components/aspect-ratio.tsx +9 -3
  12. package/src/components/avatar.tsx +109 -50
  13. package/src/components/badge.tsx +29 -17
  14. package/src/components/breadcrumb.tsx +81 -87
  15. package/src/components/button-group.tsx +83 -0
  16. package/src/components/button.tsx +40 -32
  17. package/src/components/calendar.tsx +49 -45
  18. package/src/components/card.tsx +77 -71
  19. package/src/components/carousel.tsx +150 -168
  20. package/src/components/chart.tsx +357 -0
  21. package/src/components/checkbox.tsx +28 -24
  22. package/src/components/collapsible.tsx +28 -6
  23. package/src/components/command.tsx +144 -110
  24. package/src/components/context-menu.tsx +220 -166
  25. package/src/components/dialog.tsx +131 -95
  26. package/src/components/drawer.tsx +105 -86
  27. package/src/components/dropdown-menu.tsx +234 -177
  28. package/src/components/form.tsx +167 -0
  29. package/src/components/hover-card.tsx +39 -22
  30. package/src/components/input-group.tsx +175 -0
  31. package/src/components/input-otp.tsx +56 -48
  32. package/src/components/input.tsx +18 -19
  33. package/src/components/kbd.tsx +28 -0
  34. package/src/components/label.tsx +20 -22
  35. package/src/components/menubar.tsx +221 -199
  36. package/src/components/navigation-menu.tsx +144 -102
  37. package/src/components/pagination.tsx +102 -91
  38. package/src/components/popover.tsx +86 -26
  39. package/src/components/progress.tsx +27 -24
  40. package/src/components/radio-group.tsx +28 -25
  41. package/src/components/resizable.tsx +42 -34
  42. package/src/components/scroll-area.tsx +54 -42
  43. package/src/components/select.tsx +165 -135
  44. package/src/components/separator.tsx +16 -17
  45. package/src/components/sheet.tsx +116 -113
  46. package/src/components/sidebar.tsx +726 -0
  47. package/src/components/skeleton.tsx +6 -8
  48. package/src/components/slider.tsx +60 -23
  49. package/src/components/sonner.tsx +25 -30
  50. package/src/components/spinner.tsx +16 -0
  51. package/src/components/switch.tsx +30 -22
  52. package/src/components/table.tsx +96 -97
  53. package/src/components/tabs.tsx +91 -53
  54. package/src/components/textarea.tsx +8 -12
  55. package/src/components/toggle-group.tsx +60 -37
  56. package/src/components/toggle.tsx +28 -24
  57. package/src/components/tooltip.tsx +50 -23
  58. package/src/globals.css +230 -68
  59. package/src/hooks/use-mobile.tsx +19 -0
  60. package/src/index.ts +105 -6
@@ -1,122 +1,158 @@
1
- "use client";
1
+ "use client"
2
2
 
3
- import * as DialogPrimitive from "@radix-ui/react-dialog";
4
- import { X } from "lucide-react";
5
- import * as React from "react";
3
+ import * as React from "react"
4
+ import { X } from "@phosphor-icons/react"
5
+ import * as DialogPrimitive from "@radix-ui/react-dialog"
6
6
 
7
- import { cn } from "../lib/utils";
7
+ import { cn } from "../lib/utils"
8
+ import { Button } from "./button"
8
9
 
9
- const Dialog = DialogPrimitive.Root;
10
+ function Dialog({
11
+ ...props
12
+ }: React.ComponentProps<typeof DialogPrimitive.Root>) {
13
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />
14
+ }
15
+
16
+ function DialogTrigger({
17
+ ...props
18
+ }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
19
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
20
+ }
21
+
22
+ function DialogPortal({
23
+ ...props
24
+ }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
25
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
26
+ }
10
27
 
11
- const DialogTrigger = DialogPrimitive.Trigger;
28
+ function DialogClose({
29
+ ...props
30
+ }: React.ComponentProps<typeof DialogPrimitive.Close>) {
31
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
32
+ }
12
33
 
13
- const DialogPortal = DialogPrimitive.Portal;
34
+ function DialogOverlay({
35
+ className,
36
+ ...props
37
+ }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
38
+ return (
39
+ <DialogPrimitive.Overlay
40
+ data-slot="dialog-overlay"
41
+ className={cn(
42
+ "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
43
+ className
44
+ )}
45
+ {...props}
46
+ />
47
+ )
48
+ }
14
49
 
15
- const DialogClose = DialogPrimitive.Close;
50
+ function DialogContent({
51
+ className,
52
+ children,
53
+ showCloseButton = true,
54
+ ...props
55
+ }: React.ComponentProps<typeof DialogPrimitive.Content> & {
56
+ showCloseButton?: boolean
57
+ }) {
58
+ return (
59
+ <DialogPortal data-slot="dialog-portal">
60
+ <DialogOverlay />
61
+ <DialogPrimitive.Content
62
+ data-slot="dialog-content"
63
+ className={cn(
64
+ "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
65
+ className
66
+ )}
67
+ {...props}
68
+ >
69
+ {children}
70
+ {showCloseButton && (
71
+ <DialogPrimitive.Close
72
+ data-slot="dialog-close"
73
+ className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
74
+ >
75
+ <X />
76
+ <span className="sr-only">Close</span>
77
+ </DialogPrimitive.Close>
78
+ )}
79
+ </DialogPrimitive.Content>
80
+ </DialogPortal>
81
+ )
82
+ }
16
83
 
17
- const DialogOverlay = React.forwardRef<
18
- React.ElementRef<typeof DialogPrimitive.Overlay>,
19
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
20
- >(({ className, ...props }, ref) => (
21
- <DialogPrimitive.Overlay
22
- ref={ref}
23
- className={cn(
24
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
25
- className
26
- )}
27
- {...props}
28
- />
29
- ));
30
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
84
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
85
+ return (
86
+ <div
87
+ data-slot="dialog-header"
88
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
89
+ {...props}
90
+ />
91
+ )
92
+ }
31
93
 
32
- const DialogContent = React.forwardRef<
33
- React.ElementRef<typeof DialogPrimitive.Content>,
34
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
35
- >(({ className, children, ...props }, ref) => (
36
- <DialogPortal>
37
- <DialogOverlay />
38
- <DialogPrimitive.Content
39
- ref={ref}
94
+ function DialogFooter({
95
+ className,
96
+ showCloseButton = false,
97
+ children,
98
+ ...props
99
+ }: React.ComponentProps<"div"> & {
100
+ showCloseButton?: boolean
101
+ }) {
102
+ return (
103
+ <div
104
+ data-slot="dialog-footer"
40
105
  className={cn(
41
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
106
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
42
107
  className
43
108
  )}
44
109
  {...props}
45
110
  >
46
111
  {children}
47
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
48
- <X className="h-4 w-4" />
49
- <span className="sr-only">Close</span>
50
- </DialogPrimitive.Close>
51
- </DialogPrimitive.Content>
52
- </DialogPortal>
53
- ));
54
- DialogContent.displayName = DialogPrimitive.Content.displayName;
112
+ {showCloseButton && (
113
+ <DialogPrimitive.Close asChild>
114
+ <Button variant="outline">Close</Button>
115
+ </DialogPrimitive.Close>
116
+ )}
117
+ </div>
118
+ )
119
+ }
55
120
 
56
- const DialogHeader = ({
121
+ function DialogTitle({
57
122
  className,
58
123
  ...props
59
- }: React.HTMLAttributes<HTMLDivElement>) => (
60
- <div
61
- className={cn(
62
- "flex flex-col space-y-1.5 text-center sm:text-left",
63
- className
64
- )}
65
- {...props}
66
- />
67
- );
68
- DialogHeader.displayName = "DialogHeader";
124
+ }: React.ComponentProps<typeof DialogPrimitive.Title>) {
125
+ return (
126
+ <DialogPrimitive.Title
127
+ data-slot="dialog-title"
128
+ className={cn("text-lg leading-none font-semibold", className)}
129
+ {...props}
130
+ />
131
+ )
132
+ }
69
133
 
70
- const DialogFooter = ({
134
+ function DialogDescription({
71
135
  className,
72
136
  ...props
73
- }: React.HTMLAttributes<HTMLDivElement>) => (
74
- <div
75
- className={cn(
76
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
77
- className
78
- )}
79
- {...props}
80
- />
81
- );
82
- DialogFooter.displayName = "DialogFooter";
83
-
84
- const DialogTitle = React.forwardRef<
85
- React.ElementRef<typeof DialogPrimitive.Title>,
86
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
87
- >(({ className, ...props }, ref) => (
88
- <DialogPrimitive.Title
89
- ref={ref}
90
- className={cn(
91
- "text-lg font-semibold leading-none tracking-tight",
92
- className
93
- )}
94
- {...props}
95
- />
96
- ));
97
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
98
-
99
- const DialogDescription = React.forwardRef<
100
- React.ElementRef<typeof DialogPrimitive.Description>,
101
- React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
102
- >(({ className, ...props }, ref) => (
103
- <DialogPrimitive.Description
104
- ref={ref}
105
- className={cn("text-sm text-muted-foreground", className)}
106
- {...props}
107
- />
108
- ));
109
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
137
+ }: React.ComponentProps<typeof DialogPrimitive.Description>) {
138
+ return (
139
+ <DialogPrimitive.Description
140
+ data-slot="dialog-description"
141
+ className={cn("text-sm text-muted-foreground", className)}
142
+ {...props}
143
+ />
144
+ )
145
+ }
110
146
 
111
147
  export {
112
148
  Dialog,
113
- DialogPortal,
114
- DialogOverlay,
115
149
  DialogClose,
116
- DialogTrigger,
117
150
  DialogContent,
118
- DialogHeader,
151
+ DialogDescription,
119
152
  DialogFooter,
153
+ DialogHeader,
154
+ DialogOverlay,
155
+ DialogPortal,
120
156
  DialogTitle,
121
- DialogDescription,
122
- };
157
+ DialogTrigger,
158
+ }
@@ -1,106 +1,125 @@
1
- import * as React from "react";
2
- import { Drawer as DrawerPrimitive } from "vaul";
1
+ "use client"
3
2
 
4
- import { cn } from "../lib/utils";
3
+ import * as React from "react"
4
+ import { Drawer as DrawerPrimitive } from "vaul"
5
5
 
6
- const Drawer = ({
7
- shouldScaleBackground = true,
8
- ...props
9
- }: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
10
- <DrawerPrimitive.Root
11
- shouldScaleBackground={shouldScaleBackground}
12
- {...props}
13
- />
14
- );
15
- Drawer.displayName = "Drawer";
6
+ import { cn } from "../lib/utils"
16
7
 
17
- const DrawerTrigger = DrawerPrimitive.Trigger;
8
+ function Drawer({
9
+ ...props
10
+ }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
11
+ return <DrawerPrimitive.Root data-slot="drawer" {...props} />
12
+ }
18
13
 
19
- const DrawerPortal = DrawerPrimitive.Portal;
14
+ function DrawerTrigger({
15
+ ...props
16
+ }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
17
+ return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
18
+ }
20
19
 
21
- const DrawerClose = DrawerPrimitive.Close;
20
+ function DrawerPortal({
21
+ ...props
22
+ }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
23
+ return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
24
+ }
22
25
 
23
- const DrawerOverlay = React.forwardRef<
24
- React.ElementRef<typeof DrawerPrimitive.Overlay>,
25
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
26
- >(({ className, ...props }, ref) => (
27
- <DrawerPrimitive.Overlay
28
- ref={ref}
29
- className={cn("fixed inset-0 z-50 bg-black/80", className)}
30
- {...props}
31
- />
32
- ));
33
- DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
26
+ function DrawerClose({
27
+ ...props
28
+ }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
29
+ return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
30
+ }
34
31
 
35
- const DrawerContent = React.forwardRef<
36
- React.ElementRef<typeof DrawerPrimitive.Content>,
37
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
38
- >(({ className, children, ...props }, ref) => (
39
- <DrawerPortal>
40
- <DrawerOverlay />
41
- <DrawerPrimitive.Content
42
- ref={ref}
32
+ function DrawerOverlay({
33
+ className,
34
+ ...props
35
+ }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
36
+ return (
37
+ <DrawerPrimitive.Overlay
38
+ data-slot="drawer-overlay"
43
39
  className={cn(
44
- "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
40
+ "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
45
41
  className
46
42
  )}
47
43
  {...props}
48
- >
49
- <div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
50
- {children}
51
- </DrawerPrimitive.Content>
52
- </DrawerPortal>
53
- ));
54
- DrawerContent.displayName = "DrawerContent";
44
+ />
45
+ )
46
+ }
55
47
 
56
- const DrawerHeader = ({
48
+ function DrawerContent({
57
49
  className,
50
+ children,
58
51
  ...props
59
- }: React.HTMLAttributes<HTMLDivElement>) => (
60
- <div
61
- className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
62
- {...props}
63
- />
64
- );
65
- DrawerHeader.displayName = "DrawerHeader";
52
+ }: React.ComponentProps<typeof DrawerPrimitive.Content>) {
53
+ return (
54
+ <DrawerPortal data-slot="drawer-portal">
55
+ <DrawerOverlay />
56
+ <DrawerPrimitive.Content
57
+ data-slot="drawer-content"
58
+ className={cn(
59
+ "group/drawer-content fixed z-50 flex h-auto flex-col bg-background",
60
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
61
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
62
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
63
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
64
+ className
65
+ )}
66
+ {...props}
67
+ >
68
+ <div className="mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
69
+ {children}
70
+ </DrawerPrimitive.Content>
71
+ </DrawerPortal>
72
+ )
73
+ }
66
74
 
67
- const DrawerFooter = ({
75
+ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
76
+ return (
77
+ <div
78
+ data-slot="drawer-header"
79
+ className={cn(
80
+ "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
81
+ className
82
+ )}
83
+ {...props}
84
+ />
85
+ )
86
+ }
87
+
88
+ function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
89
+ return (
90
+ <div
91
+ data-slot="drawer-footer"
92
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
93
+ {...props}
94
+ />
95
+ )
96
+ }
97
+
98
+ function DrawerTitle({
68
99
  className,
69
100
  ...props
70
- }: React.HTMLAttributes<HTMLDivElement>) => (
71
- <div
72
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
73
- {...props}
74
- />
75
- );
76
- DrawerFooter.displayName = "DrawerFooter";
77
-
78
- const DrawerTitle = React.forwardRef<
79
- React.ElementRef<typeof DrawerPrimitive.Title>,
80
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
81
- >(({ className, ...props }, ref) => (
82
- <DrawerPrimitive.Title
83
- ref={ref}
84
- className={cn(
85
- "text-lg font-semibold leading-none tracking-tight",
86
- className
87
- )}
88
- {...props}
89
- />
90
- ));
91
- DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
101
+ }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
102
+ return (
103
+ <DrawerPrimitive.Title
104
+ data-slot="drawer-title"
105
+ className={cn("font-semibold text-foreground", className)}
106
+ {...props}
107
+ />
108
+ )
109
+ }
92
110
 
93
- const DrawerDescription = React.forwardRef<
94
- React.ElementRef<typeof DrawerPrimitive.Description>,
95
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
96
- >(({ className, ...props }, ref) => (
97
- <DrawerPrimitive.Description
98
- ref={ref}
99
- className={cn("text-sm text-muted-foreground", className)}
100
- {...props}
101
- />
102
- ));
103
- DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
111
+ function DrawerDescription({
112
+ className,
113
+ ...props
114
+ }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
115
+ return (
116
+ <DrawerPrimitive.Description
117
+ data-slot="drawer-description"
118
+ className={cn("text-sm text-muted-foreground", className)}
119
+ {...props}
120
+ />
121
+ )
122
+ }
104
123
 
105
124
  export {
106
125
  Drawer,
@@ -113,4 +132,4 @@ export {
113
132
  DrawerFooter,
114
133
  DrawerTitle,
115
134
  DrawerDescription,
116
- };
135
+ }