@blips/ui 1.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 (59) hide show
  1. package/dist/index.cjs +3612 -2515
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +329 -484
  4. package/dist/index.d.ts +329 -484
  5. package/dist/index.js +3602 -2513
  6. package/dist/index.js.map +1 -1
  7. package/package.json +14 -12
  8. package/src/components/accordion.tsx +56 -46
  9. package/src/components/alert-dialog.tsx +166 -109
  10. package/src/components/alert.tsx +45 -38
  11. package/src/components/aspect-ratio.tsx +7 -1
  12. package/src/components/avatar.tsx +104 -45
  13. package/src/components/badge.tsx +25 -13
  14. package/src/components/breadcrumb.tsx +76 -82
  15. package/src/components/button-group.tsx +2 -2
  16. package/src/components/button.tsx +36 -28
  17. package/src/components/calendar.tsx +35 -28
  18. package/src/components/card.tsx +83 -70
  19. package/src/components/carousel.tsx +118 -137
  20. package/src/components/chart.tsx +197 -208
  21. package/src/components/checkbox.tsx +25 -21
  22. package/src/components/collapsible.tsx +25 -3
  23. package/src/components/command.tsx +138 -105
  24. package/src/components/context-menu.tsx +215 -161
  25. package/src/components/dialog.tsx +127 -91
  26. package/src/components/drawer.tsx +102 -83
  27. package/src/components/dropdown-menu.tsx +227 -170
  28. package/src/components/form.tsx +41 -52
  29. package/src/components/hover-card.tsx +36 -19
  30. package/src/components/input-group.tsx +4 -4
  31. package/src/components/input-otp.tsx +51 -43
  32. package/src/components/input.tsx +16 -17
  33. package/src/components/kbd.tsx +1 -1
  34. package/src/components/label.tsx +16 -18
  35. package/src/components/menubar.tsx +214 -192
  36. package/src/components/navigation-menu.tsx +140 -98
  37. package/src/components/pagination.tsx +97 -87
  38. package/src/components/popover.tsx +83 -23
  39. package/src/components/progress.tsx +23 -20
  40. package/src/components/radio-group.tsx +23 -20
  41. package/src/components/resizable.tsx +39 -31
  42. package/src/components/scroll-area.tsx +51 -39
  43. package/src/components/select.tsx +161 -131
  44. package/src/components/separator.tsx +13 -14
  45. package/src/components/sheet.tsx +112 -109
  46. package/src/components/sidebar.tsx +422 -470
  47. package/src/components/skeleton.tsx +4 -6
  48. package/src/components/slider.tsx +57 -20
  49. package/src/components/sonner.tsx +19 -24
  50. package/src/components/spinner.tsx +3 -3
  51. package/src/components/switch.tsx +28 -20
  52. package/src/components/table.tsx +94 -95
  53. package/src/components/tabs.tsx +88 -50
  54. package/src/components/textarea.tsx +5 -9
  55. package/src/components/toggle-group.tsx +52 -30
  56. package/src/components/toggle.tsx +24 -20
  57. package/src/components/tooltip.tsx +46 -19
  58. package/src/globals.css +213 -96
  59. package/src/index.ts +27 -6
@@ -1,31 +1,58 @@
1
+ "use client"
2
+
1
3
  import * as React from "react"
2
- import type { DialogProps } from "@radix-ui/react-dialog"
3
4
  import { Command as CommandPrimitive } from "cmdk"
4
- import { Search } from "lucide-react"
5
-
6
- import { cn } from "@/lib/utils"
7
- import { Dialog, DialogContent } from "@/components/dialog"
8
-
9
- const Command = React.forwardRef<
10
- React.ElementRef<typeof CommandPrimitive>,
11
- React.ComponentPropsWithoutRef<typeof CommandPrimitive>
12
- >(({ className, ...props }, ref) => (
13
- <CommandPrimitive
14
- ref={ref}
15
- className={cn(
16
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
17
- className
18
- )}
19
- {...props}
20
- />
21
- ))
22
- Command.displayName = CommandPrimitive.displayName
5
+ import { MagnifyingGlass } from "@phosphor-icons/react"
6
+
7
+ import { cn } from "../lib/utils"
8
+ import {
9
+ Dialog,
10
+ DialogContent,
11
+ DialogDescription,
12
+ DialogHeader,
13
+ DialogTitle,
14
+ } from "./dialog"
15
+
16
+ function Command({
17
+ className,
18
+ ...props
19
+ }: React.ComponentProps<typeof CommandPrimitive>) {
20
+ return (
21
+ <CommandPrimitive
22
+ data-slot="command"
23
+ className={cn(
24
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
25
+ className
26
+ )}
27
+ {...props}
28
+ />
29
+ )
30
+ }
23
31
 
24
- const CommandDialog = ({ children, ...props }: DialogProps) => {
32
+ function CommandDialog({
33
+ title = "Command Palette",
34
+ description = "Search for a command to run...",
35
+ children,
36
+ className,
37
+ showCloseButton = true,
38
+ ...props
39
+ }: React.ComponentProps<typeof Dialog> & {
40
+ title?: string
41
+ description?: string
42
+ className?: string
43
+ showCloseButton?: boolean
44
+ }) {
25
45
  return (
26
46
  <Dialog {...props}>
27
- <DialogContent className="overflow-hidden p-0 shadow-lg">
28
- <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
47
+ <DialogHeader className="sr-only">
48
+ <DialogTitle>{title}</DialogTitle>
49
+ <DialogDescription>{description}</DialogDescription>
50
+ </DialogHeader>
51
+ <DialogContent
52
+ className={cn("overflow-hidden p-0", className)}
53
+ showCloseButton={showCloseButton}
54
+ >
55
+ <Command className="**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
29
56
  {children}
30
57
  </Command>
31
58
  </DialogContent>
@@ -33,101 +60,108 @@ const CommandDialog = ({ children, ...props }: DialogProps) => {
33
60
  )
34
61
  }
35
62
 
36
- const CommandInput = React.forwardRef<
37
- React.ElementRef<typeof CommandPrimitive.Input>,
38
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
39
- >(({ className, ...props }, ref) => (
40
- <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
41
- <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
42
- <CommandPrimitive.Input
43
- ref={ref}
63
+ function CommandInput({
64
+ className,
65
+ ...props
66
+ }: React.ComponentProps<typeof CommandPrimitive.Input>) {
67
+ return (
68
+ <div
69
+ data-slot="command-input-wrapper"
70
+ className="flex h-9 items-center gap-2 border-b px-3"
71
+ >
72
+ <MagnifyingGlass className="size-4 shrink-0 opacity-50" />
73
+ <CommandPrimitive.Input
74
+ data-slot="command-input"
75
+ className={cn(
76
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ </div>
82
+ )
83
+ }
84
+
85
+ function CommandList({
86
+ className,
87
+ ...props
88
+ }: React.ComponentProps<typeof CommandPrimitive.List>) {
89
+ return (
90
+ <CommandPrimitive.List
91
+ data-slot="command-list"
44
92
  className={cn(
45
- "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
93
+ "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
46
94
  className
47
95
  )}
48
96
  {...props}
49
97
  />
50
- </div>
51
- ))
52
-
53
- CommandInput.displayName = CommandPrimitive.Input.displayName
54
-
55
- const CommandList = React.forwardRef<
56
- React.ElementRef<typeof CommandPrimitive.List>,
57
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
58
- >(({ className, ...props }, ref) => (
59
- <CommandPrimitive.List
60
- ref={ref}
61
- className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
62
- {...props}
63
- />
64
- ))
65
-
66
- CommandList.displayName = CommandPrimitive.List.displayName
67
-
68
- const CommandEmpty = React.forwardRef<
69
- React.ElementRef<typeof CommandPrimitive.Empty>,
70
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
71
- >((props, ref) => (
72
- <CommandPrimitive.Empty
73
- ref={ref}
74
- className="py-6 text-center text-sm"
75
- {...props}
76
- />
77
- ))
78
-
79
- CommandEmpty.displayName = CommandPrimitive.Empty.displayName
80
-
81
- const CommandGroup = React.forwardRef<
82
- React.ElementRef<typeof CommandPrimitive.Group>,
83
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
84
- >(({ className, ...props }, ref) => (
85
- <CommandPrimitive.Group
86
- ref={ref}
87
- className={cn(
88
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
89
- className
90
- )}
91
- {...props}
92
- />
93
- ))
98
+ )
99
+ }
94
100
 
95
- CommandGroup.displayName = CommandPrimitive.Group.displayName
101
+ function CommandEmpty({
102
+ ...props
103
+ }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
104
+ return (
105
+ <CommandPrimitive.Empty
106
+ data-slot="command-empty"
107
+ className="py-6 text-center text-sm"
108
+ {...props}
109
+ />
110
+ )
111
+ }
96
112
 
97
- const CommandSeparator = React.forwardRef<
98
- React.ElementRef<typeof CommandPrimitive.Separator>,
99
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
100
- >(({ className, ...props }, ref) => (
101
- <CommandPrimitive.Separator
102
- ref={ref}
103
- className={cn("-mx-1 h-px bg-border", className)}
104
- {...props}
105
- />
106
- ))
107
- CommandSeparator.displayName = CommandPrimitive.Separator.displayName
113
+ function CommandGroup({
114
+ className,
115
+ ...props
116
+ }: React.ComponentProps<typeof CommandPrimitive.Group>) {
117
+ return (
118
+ <CommandPrimitive.Group
119
+ data-slot="command-group"
120
+ className={cn(
121
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
122
+ className
123
+ )}
124
+ {...props}
125
+ />
126
+ )
127
+ }
108
128
 
109
- const CommandItem = React.forwardRef<
110
- React.ElementRef<typeof CommandPrimitive.Item>,
111
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
112
- >(({ className, ...props }, ref) => (
113
- <CommandPrimitive.Item
114
- ref={ref}
115
- className={cn(
116
- "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
117
- className
118
- )}
119
- {...props}
120
- />
121
- ))
129
+ function CommandSeparator({
130
+ className,
131
+ ...props
132
+ }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
133
+ return (
134
+ <CommandPrimitive.Separator
135
+ data-slot="command-separator"
136
+ className={cn("-mx-1 h-px bg-border", className)}
137
+ {...props}
138
+ />
139
+ )
140
+ }
122
141
 
123
- CommandItem.displayName = CommandPrimitive.Item.displayName
142
+ function CommandItem({
143
+ className,
144
+ ...props
145
+ }: React.ComponentProps<typeof CommandPrimitive.Item>) {
146
+ return (
147
+ <CommandPrimitive.Item
148
+ data-slot="command-item"
149
+ className={cn(
150
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
151
+ className
152
+ )}
153
+ {...props}
154
+ />
155
+ )
156
+ }
124
157
 
125
- const CommandShortcut = ({
158
+ function CommandShortcut({
126
159
  className,
127
160
  ...props
128
- }: React.HTMLAttributes<HTMLSpanElement>) => {
161
+ }: React.ComponentProps<"span">) {
129
162
  return (
130
163
  <span
164
+ data-slot="command-shortcut"
131
165
  className={cn(
132
166
  "ml-auto text-xs tracking-widest text-muted-foreground",
133
167
  className
@@ -136,7 +170,6 @@ const CommandShortcut = ({
136
170
  />
137
171
  )
138
172
  }
139
- CommandShortcut.displayName = "CommandShortcut"
140
173
 
141
174
  export {
142
175
  Command,