@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,183 +1,237 @@
1
- import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
2
- import { Check, ChevronRight, Circle } from "lucide-react";
3
- import * as React from "react";
4
-
5
- import { cn } from "../lib/utils";
6
-
7
- const ContextMenu = ContextMenuPrimitive.Root;
8
-
9
- const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
10
-
11
- const ContextMenuGroup = ContextMenuPrimitive.Group;
12
-
13
- const ContextMenuPortal = ContextMenuPrimitive.Portal;
14
-
15
- const ContextMenuSub = ContextMenuPrimitive.Sub;
16
-
17
- const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
18
-
19
- const ContextMenuSubTrigger = React.forwardRef<
20
- React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
21
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
22
- inset?: boolean;
23
- }
24
- >(({ className, inset, children, ...props }, ref) => (
25
- <ContextMenuPrimitive.SubTrigger
26
- ref={ref}
27
- className={cn(
28
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
29
- inset && "pl-8",
30
- className
31
- )}
32
- {...props}
33
- >
34
- {children}
35
- <ChevronRight className="ml-auto h-4 w-4" />
36
- </ContextMenuPrimitive.SubTrigger>
37
- ));
38
- ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
39
-
40
- const ContextMenuSubContent = React.forwardRef<
41
- React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
42
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
43
- >(({ className, ...props }, ref) => (
44
- <ContextMenuPrimitive.SubContent
45
- ref={ref}
46
- className={cn(
47
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
48
- className
49
- )}
50
- {...props}
51
- />
52
- ));
53
- ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
54
-
55
- const ContextMenuContent = React.forwardRef<
56
- React.ElementRef<typeof ContextMenuPrimitive.Content>,
57
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
58
- >(({ className, ...props }, ref) => (
59
- <ContextMenuPrimitive.Portal>
60
- <ContextMenuPrimitive.Content
61
- ref={ref}
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Check, CaretRight, Circle } from "@phosphor-icons/react"
5
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
6
+
7
+ import { cn } from "../lib/utils"
8
+
9
+ function ContextMenu({
10
+ ...props
11
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
12
+ return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
13
+ }
14
+
15
+ function ContextMenuTrigger({
16
+ ...props
17
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
18
+ return (
19
+ <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
20
+ )
21
+ }
22
+
23
+ function ContextMenuGroup({
24
+ ...props
25
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
26
+ return (
27
+ <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
28
+ )
29
+ }
30
+
31
+ function ContextMenuPortal({
32
+ ...props
33
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
34
+ return (
35
+ <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
36
+ )
37
+ }
38
+
39
+ function ContextMenuSub({
40
+ ...props
41
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
42
+ return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />
43
+ }
44
+
45
+ function ContextMenuRadioGroup({
46
+ ...props
47
+ }: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
48
+ return (
49
+ <ContextMenuPrimitive.RadioGroup
50
+ data-slot="context-menu-radio-group"
51
+ {...props}
52
+ />
53
+ )
54
+ }
55
+
56
+ function ContextMenuSubTrigger({
57
+ className,
58
+ inset,
59
+ children,
60
+ ...props
61
+ }: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
62
+ inset?: boolean
63
+ }) {
64
+ return (
65
+ <ContextMenuPrimitive.SubTrigger
66
+ data-slot="context-menu-sub-trigger"
67
+ data-inset={inset}
68
+ className={cn(
69
+ "flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
70
+ className
71
+ )}
72
+ {...props}
73
+ >
74
+ {children}
75
+ <CaretRight className="ml-auto" />
76
+ </ContextMenuPrimitive.SubTrigger>
77
+ )
78
+ }
79
+
80
+ function ContextMenuSubContent({
81
+ className,
82
+ ...props
83
+ }: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
84
+ return (
85
+ <ContextMenuPrimitive.SubContent
86
+ data-slot="context-menu-sub-content"
62
87
  className={cn(
63
- "z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
88
+ "z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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",
64
89
  className
65
90
  )}
66
91
  {...props}
67
92
  />
68
- </ContextMenuPrimitive.Portal>
69
- ));
70
- ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
71
-
72
- const ContextMenuItem = React.forwardRef<
73
- React.ElementRef<typeof ContextMenuPrimitive.Item>,
74
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
75
- inset?: boolean;
76
- }
77
- >(({ className, inset, ...props }, ref) => (
78
- <ContextMenuPrimitive.Item
79
- ref={ref}
80
- className={cn(
81
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
82
- inset && "pl-8",
83
- className
84
- )}
85
- {...props}
86
- />
87
- ));
88
- ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
89
-
90
- const ContextMenuCheckboxItem = React.forwardRef<
91
- React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
92
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
93
- >(({ className, children, checked, ...props }, ref) => (
94
- <ContextMenuPrimitive.CheckboxItem
95
- ref={ref}
96
- className={cn(
97
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
98
- className
99
- )}
100
- checked={checked}
101
- {...props}
102
- >
103
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
104
- <ContextMenuPrimitive.ItemIndicator>
105
- <Check className="h-4 w-4" />
106
- </ContextMenuPrimitive.ItemIndicator>
107
- </span>
108
- {children}
109
- </ContextMenuPrimitive.CheckboxItem>
110
- ));
111
- ContextMenuCheckboxItem.displayName =
112
- ContextMenuPrimitive.CheckboxItem.displayName;
113
-
114
- const ContextMenuRadioItem = React.forwardRef<
115
- React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
116
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
117
- >(({ className, children, ...props }, ref) => (
118
- <ContextMenuPrimitive.RadioItem
119
- ref={ref}
120
- className={cn(
121
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
122
- className
123
- )}
124
- {...props}
125
- >
126
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
127
- <ContextMenuPrimitive.ItemIndicator>
128
- <Circle className="h-2 w-2 fill-current" />
129
- </ContextMenuPrimitive.ItemIndicator>
130
- </span>
131
- {children}
132
- </ContextMenuPrimitive.RadioItem>
133
- ));
134
- ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
135
-
136
- const ContextMenuLabel = React.forwardRef<
137
- React.ElementRef<typeof ContextMenuPrimitive.Label>,
138
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
139
- inset?: boolean;
140
- }
141
- >(({ className, inset, ...props }, ref) => (
142
- <ContextMenuPrimitive.Label
143
- ref={ref}
144
- className={cn(
145
- "px-2 py-1.5 text-sm font-semibold text-foreground",
146
- inset && "pl-8",
147
- className
148
- )}
149
- {...props}
150
- />
151
- ));
152
- ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
153
-
154
- const ContextMenuSeparator = React.forwardRef<
155
- React.ElementRef<typeof ContextMenuPrimitive.Separator>,
156
- React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
157
- >(({ className, ...props }, ref) => (
158
- <ContextMenuPrimitive.Separator
159
- ref={ref}
160
- className={cn("-mx-1 my-1 h-px bg-border", className)}
161
- {...props}
162
- />
163
- ));
164
- ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
165
-
166
- const ContextMenuShortcut = ({
93
+ )
94
+ }
95
+
96
+ function ContextMenuContent({
97
+ className,
98
+ ...props
99
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
100
+ return (
101
+ <ContextMenuPrimitive.Portal>
102
+ <ContextMenuPrimitive.Content
103
+ data-slot="context-menu-content"
104
+ className={cn(
105
+ "z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 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",
106
+ className
107
+ )}
108
+ {...props}
109
+ />
110
+ </ContextMenuPrimitive.Portal>
111
+ )
112
+ }
113
+
114
+ function ContextMenuItem({
115
+ className,
116
+ inset,
117
+ variant = "default",
118
+ ...props
119
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
120
+ inset?: boolean
121
+ variant?: "default" | "destructive"
122
+ }) {
123
+ return (
124
+ <ContextMenuPrimitive.Item
125
+ data-slot="context-menu-item"
126
+ data-inset={inset}
127
+ data-variant={variant}
128
+ className={cn(
129
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
130
+ className
131
+ )}
132
+ {...props}
133
+ />
134
+ )
135
+ }
136
+
137
+ function ContextMenuCheckboxItem({
138
+ className,
139
+ children,
140
+ checked,
141
+ ...props
142
+ }: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
143
+ return (
144
+ <ContextMenuPrimitive.CheckboxItem
145
+ data-slot="context-menu-checkbox-item"
146
+ className={cn(
147
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
148
+ className
149
+ )}
150
+ checked={checked}
151
+ {...props}
152
+ >
153
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
154
+ <ContextMenuPrimitive.ItemIndicator>
155
+ <Check className="size-4" />
156
+ </ContextMenuPrimitive.ItemIndicator>
157
+ </span>
158
+ {children}
159
+ </ContextMenuPrimitive.CheckboxItem>
160
+ )
161
+ }
162
+
163
+ function ContextMenuRadioItem({
164
+ className,
165
+ children,
166
+ ...props
167
+ }: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
168
+ return (
169
+ <ContextMenuPrimitive.RadioItem
170
+ data-slot="context-menu-radio-item"
171
+ className={cn(
172
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
173
+ className
174
+ )}
175
+ {...props}
176
+ >
177
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
178
+ <ContextMenuPrimitive.ItemIndicator>
179
+ <Circle className="size-2 fill-current" />
180
+ </ContextMenuPrimitive.ItemIndicator>
181
+ </span>
182
+ {children}
183
+ </ContextMenuPrimitive.RadioItem>
184
+ )
185
+ }
186
+
187
+ function ContextMenuLabel({
188
+ className,
189
+ inset,
190
+ ...props
191
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
192
+ inset?: boolean
193
+ }) {
194
+ return (
195
+ <ContextMenuPrimitive.Label
196
+ data-slot="context-menu-label"
197
+ data-inset={inset}
198
+ className={cn(
199
+ "px-2 py-1.5 text-sm font-medium text-foreground data-[inset]:pl-8",
200
+ className
201
+ )}
202
+ {...props}
203
+ />
204
+ )
205
+ }
206
+
207
+ function ContextMenuSeparator({
208
+ className,
209
+ ...props
210
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
211
+ return (
212
+ <ContextMenuPrimitive.Separator
213
+ data-slot="context-menu-separator"
214
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
215
+ {...props}
216
+ />
217
+ )
218
+ }
219
+
220
+ function ContextMenuShortcut({
167
221
  className,
168
222
  ...props
169
- }: React.HTMLAttributes<HTMLSpanElement>) => {
223
+ }: React.ComponentProps<"span">) {
170
224
  return (
171
225
  <span
226
+ data-slot="context-menu-shortcut"
172
227
  className={cn(
173
228
  "ml-auto text-xs tracking-widest text-muted-foreground",
174
229
  className
175
230
  )}
176
231
  {...props}
177
232
  />
178
- );
179
- };
180
- ContextMenuShortcut.displayName = "ContextMenuShortcut";
233
+ )
234
+ }
181
235
 
182
236
  export {
183
237
  ContextMenu,
@@ -195,4 +249,4 @@ export {
195
249
  ContextMenuSubContent,
196
250
  ContextMenuSubTrigger,
197
251
  ContextMenuRadioGroup,
198
- };
252
+ }