@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,18 +1,19 @@
1
- "use client";
1
+ "use client"
2
2
 
3
+ import * as React from "react"
3
4
  import {
4
- ChevronDownIcon,
5
- ChevronLeftIcon,
6
- ChevronRightIcon,
7
- } from "lucide-react";
8
- import * as React from "react";
5
+ CaretDown,
6
+ CaretLeft,
7
+ CaretRight,
8
+ } from "@phosphor-icons/react"
9
9
  import {
10
- type DayButton,
11
10
  DayPicker,
12
11
  getDefaultClassNames,
13
- } from "react-day-picker";
14
- import { Button, buttonVariants } from "./button";
15
- import { cn } from "../lib/utils";
12
+ type DayButton,
13
+ } from "react-day-picker"
14
+
15
+ import { cn } from "../lib/utils"
16
+ import { Button, buttonVariants } from "./button"
16
17
 
17
18
  function Calendar({
18
19
  className,
@@ -24,15 +25,15 @@ function Calendar({
24
25
  components,
25
26
  ...props
26
27
  }: React.ComponentProps<typeof DayPicker> & {
27
- buttonVariant?: React.ComponentProps<typeof Button>["variant"];
28
+ buttonVariant?: React.ComponentProps<typeof Button>["variant"]
28
29
  }) {
29
- const defaultClassNames = getDefaultClassNames();
30
+ const defaultClassNames = getDefaultClassNames()
30
31
 
31
32
  return (
32
33
  <DayPicker
33
34
  showOutsideDays={showOutsideDays}
34
35
  className={cn(
35
- "bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
36
+ "group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
36
37
  String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
37
38
  String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
38
39
  className
@@ -56,64 +57,67 @@ function Calendar({
56
57
  ),
57
58
  button_previous: cn(
58
59
  buttonVariants({ variant: buttonVariant }),
59
- "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
60
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
60
61
  defaultClassNames.button_previous
61
62
  ),
62
63
  button_next: cn(
63
64
  buttonVariants({ variant: buttonVariant }),
64
- "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
65
+ "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
65
66
  defaultClassNames.button_next
66
67
  ),
67
68
  month_caption: cn(
68
- "flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",
69
+ "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
69
70
  defaultClassNames.month_caption
70
71
  ),
71
72
  dropdowns: cn(
72
- "flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",
73
+ "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
73
74
  defaultClassNames.dropdowns
74
75
  ),
75
76
  dropdown_root: cn(
76
- "has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",
77
+ "relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50",
77
78
  defaultClassNames.dropdown_root
78
79
  ),
79
80
  dropdown: cn(
80
- "bg-popover absolute inset-0 opacity-0",
81
+ "absolute inset-0 bg-popover opacity-0",
81
82
  defaultClassNames.dropdown
82
83
  ),
83
84
  caption_label: cn(
84
- "select-none font-medium",
85
+ "font-medium select-none",
85
86
  captionLayout === "label"
86
87
  ? "text-sm"
87
- : "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",
88
+ : "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
88
89
  defaultClassNames.caption_label
89
90
  ),
90
91
  table: "w-full border-collapse",
91
92
  weekdays: cn("flex", defaultClassNames.weekdays),
92
93
  weekday: cn(
93
- "text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",
94
+ "flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none",
94
95
  defaultClassNames.weekday
95
96
  ),
96
97
  week: cn("mt-2 flex w-full", defaultClassNames.week),
97
98
  week_number_header: cn(
98
- "w-[--cell-size] select-none",
99
+ "w-(--cell-size) select-none",
99
100
  defaultClassNames.week_number_header
100
101
  ),
101
102
  week_number: cn(
102
- "text-muted-foreground select-none text-[0.8rem]",
103
+ "text-[0.8rem] text-muted-foreground select-none",
103
104
  defaultClassNames.week_number
104
105
  ),
105
106
  day: cn(
106
- "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",
107
+ "group/day relative aspect-square h-full w-full p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-md",
108
+ props.showWeekNumber
109
+ ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
110
+ : "[&:first-child[data-selected=true]_button]:rounded-l-md",
107
111
  defaultClassNames.day
108
112
  ),
109
113
  range_start: cn(
110
- "bg-accent rounded-l-md",
114
+ "rounded-l-md bg-accent",
111
115
  defaultClassNames.range_start
112
116
  ),
113
117
  range_middle: cn("rounded-none", defaultClassNames.range_middle),
114
- range_end: cn("bg-accent rounded-r-md", defaultClassNames.range_end),
118
+ range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
115
119
  today: cn(
116
- "bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
120
+ "rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none",
117
121
  defaultClassNames.today
118
122
  ),
119
123
  outside: cn(
@@ -136,43 +140,43 @@ function Calendar({
136
140
  className={cn(className)}
137
141
  {...props}
138
142
  />
139
- );
143
+ )
140
144
  },
141
145
  Chevron: ({ className, orientation, ...props }) => {
142
146
  if (orientation === "left") {
143
147
  return (
144
- <ChevronLeftIcon className={cn("size-4", className)} {...props} />
145
- );
148
+ <CaretLeft className={cn("size-4", className)} {...props} />
149
+ )
146
150
  }
147
151
 
148
152
  if (orientation === "right") {
149
153
  return (
150
- <ChevronRightIcon
154
+ <CaretRight
151
155
  className={cn("size-4", className)}
152
156
  {...props}
153
157
  />
154
- );
158
+ )
155
159
  }
156
160
 
157
161
  return (
158
- <ChevronDownIcon className={cn("size-4", className)} {...props} />
159
- );
162
+ <CaretDown className={cn("size-4", className)} {...props} />
163
+ )
160
164
  },
161
165
  DayButton: CalendarDayButton,
162
166
  WeekNumber: ({ children, ...props }) => {
163
167
  return (
164
168
  <td {...props}>
165
- <div className="flex size-[--cell-size] items-center justify-center text-center">
169
+ <div className="flex size-(--cell-size) items-center justify-center text-center">
166
170
  {children}
167
171
  </div>
168
172
  </td>
169
- );
173
+ )
170
174
  },
171
175
  ...components,
172
176
  }}
173
177
  {...props}
174
178
  />
175
- );
179
+ )
176
180
  }
177
181
 
178
182
  function CalendarDayButton({
@@ -181,12 +185,12 @@ function CalendarDayButton({
181
185
  modifiers,
182
186
  ...props
183
187
  }: React.ComponentProps<typeof DayButton>) {
184
- const defaultClassNames = getDefaultClassNames();
188
+ const defaultClassNames = getDefaultClassNames()
185
189
 
186
- const ref = React.useRef<HTMLButtonElement>(null);
190
+ const ref = React.useRef<HTMLButtonElement>(null)
187
191
  React.useEffect(() => {
188
- if (modifiers.focused) ref.current?.focus();
189
- }, [modifiers.focused]);
192
+ if (modifiers.focused) ref.current?.focus()
193
+ }, [modifiers.focused])
190
194
 
191
195
  return (
192
196
  <Button
@@ -204,13 +208,13 @@ function CalendarDayButton({
204
208
  data-range-end={modifiers.range_end}
205
209
  data-range-middle={modifiers.range_middle}
206
210
  className={cn(
207
- "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",
211
+ "flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70",
208
212
  defaultClassNames.day,
209
213
  className
210
214
  )}
211
215
  {...props}
212
216
  />
213
- );
217
+ )
214
218
  }
215
219
 
216
- export { Calendar, CalendarDayButton };
220
+ export { Calendar, CalendarDayButton }
@@ -1,86 +1,92 @@
1
- import * as React from "react";
1
+ import * as React from "react"
2
2
 
3
- import { cn } from "../lib/utils";
3
+ import { cn } from "../lib/utils"
4
4
 
5
- const Card = React.forwardRef<
6
- HTMLDivElement,
7
- React.HTMLAttributes<HTMLDivElement>
8
- >(({ className, ...props }, ref) => (
9
- <div
10
- ref={ref}
11
- className={cn(
12
- "rounded-lg border bg-card text-card-foreground shadow-sm",
13
- className
14
- )}
15
- {...props}
16
- />
17
- ));
18
- Card.displayName = "Card";
5
+ function Card({ className, ...props }: React.ComponentProps<"div">) {
6
+ return (
7
+ <div
8
+ data-slot="card"
9
+ className={cn(
10
+ "flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ )
16
+ }
19
17
 
20
- const CardHeader = React.forwardRef<
21
- HTMLDivElement,
22
- React.HTMLAttributes<HTMLDivElement>
23
- >(({ className, ...props }, ref) => (
24
- <div
25
- ref={ref}
26
- className={cn("flex flex-col space-y-1.5 p-6", className)}
27
- {...props}
28
- />
29
- ));
30
- CardHeader.displayName = "CardHeader";
18
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
20
+ <div
21
+ data-slot="card-header"
22
+ className={cn(
23
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
24
+ className
25
+ )}
26
+ {...props}
27
+ />
28
+ )
29
+ }
31
30
 
32
- const CardTitle = React.forwardRef<
33
- HTMLDivElement,
34
- React.HTMLAttributes<HTMLDivElement>
35
- >(({ className, ...props }, ref) => (
36
- <div
37
- ref={ref}
38
- className={cn(
39
- "text-2xl font-semibold leading-none tracking-tight",
40
- className
41
- )}
42
- {...props}
43
- />
44
- ));
45
- CardTitle.displayName = "CardTitle";
31
+ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
32
+ return (
33
+ <div
34
+ data-slot="card-title"
35
+ className={cn("leading-none font-semibold", className)}
36
+ {...props}
37
+ />
38
+ )
39
+ }
46
40
 
47
- const CardDescription = React.forwardRef<
48
- HTMLDivElement,
49
- React.HTMLAttributes<HTMLDivElement>
50
- >(({ className, ...props }, ref) => (
51
- <div
52
- ref={ref}
53
- className={cn("text-sm text-muted-foreground", className)}
54
- {...props}
55
- />
56
- ));
57
- CardDescription.displayName = "CardDescription";
41
+ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
42
+ return (
43
+ <div
44
+ data-slot="card-description"
45
+ className={cn("text-sm text-muted-foreground", className)}
46
+ {...props}
47
+ />
48
+ )
49
+ }
58
50
 
59
- const CardContent = React.forwardRef<
60
- HTMLDivElement,
61
- React.HTMLAttributes<HTMLDivElement>
62
- >(({ className, ...props }, ref) => (
63
- <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
64
- ));
65
- CardContent.displayName = "CardContent";
51
+ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
52
+ return (
53
+ <div
54
+ data-slot="card-action"
55
+ className={cn(
56
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
57
+ className
58
+ )}
59
+ {...props}
60
+ />
61
+ )
62
+ }
66
63
 
67
- const CardFooter = React.forwardRef<
68
- HTMLDivElement,
69
- React.HTMLAttributes<HTMLDivElement>
70
- >(({ className, ...props }, ref) => (
71
- <div
72
- ref={ref}
73
- className={cn("flex items-center p-6 pt-0", className)}
74
- {...props}
75
- />
76
- ));
77
- CardFooter.displayName = "CardFooter";
64
+ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
65
+ return (
66
+ <div
67
+ data-slot="card-content"
68
+ className={cn("px-6", className)}
69
+ {...props}
70
+ />
71
+ )
72
+ }
73
+
74
+ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
75
+ return (
76
+ <div
77
+ data-slot="card-footer"
78
+ className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
79
+ {...props}
80
+ />
81
+ )
82
+ }
78
83
 
79
84
  export {
80
85
  Card,
81
86
  CardHeader,
82
87
  CardFooter,
83
88
  CardTitle,
89
+ CardAction,
84
90
  CardDescription,
85
91
  CardContent,
86
- };
92
+ }