@blips/ui 0.0.1 → 1.0.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 (60) hide show
  1. package/dist/index.cjs +1347 -146
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +185 -6
  4. package/dist/index.d.ts +185 -6
  5. package/dist/index.js +1295 -148
  6. package/dist/index.js.map +1 -1
  7. package/package.json +25 -13
  8. package/src/components/accordion.tsx +12 -12
  9. package/src/components/alert-dialog.tsx +25 -24
  10. package/src/components/alert.tsx +11 -11
  11. package/src/components/aspect-ratio.tsx +3 -3
  12. package/src/components/avatar.tsx +11 -11
  13. package/src/components/badge.tsx +6 -6
  14. package/src/components/breadcrumb.tsx +23 -23
  15. package/src/components/button-group.tsx +83 -0
  16. package/src/components/button.tsx +11 -11
  17. package/src/components/calendar.tsx +21 -24
  18. package/src/components/card.tsx +15 -22
  19. package/src/components/carousel.tsx +72 -71
  20. package/src/components/chart.tsx +368 -0
  21. package/src/components/checkbox.tsx +7 -7
  22. package/src/components/collapsible.tsx +6 -6
  23. package/src/components/command.tsx +27 -26
  24. package/src/components/context-menu.tsx +33 -33
  25. package/src/components/dialog.tsx +22 -22
  26. package/src/components/drawer.tsx +21 -21
  27. package/src/components/dropdown-menu.tsx +34 -34
  28. package/src/components/form.tsx +178 -0
  29. package/src/components/hover-card.tsx +8 -8
  30. package/src/components/input-group.tsx +175 -0
  31. package/src/components/input-otp.tsx +16 -16
  32. package/src/components/input.tsx +6 -6
  33. package/src/components/kbd.tsx +28 -0
  34. package/src/components/label.tsx +9 -9
  35. package/src/components/menubar.tsx +36 -36
  36. package/src/components/navigation-menu.tsx +21 -21
  37. package/src/components/pagination.tsx +22 -21
  38. package/src/components/popover.tsx +8 -8
  39. package/src/components/progress.tsx +7 -7
  40. package/src/components/radio-group.tsx +11 -11
  41. package/src/components/resizable.tsx +14 -14
  42. package/src/components/scroll-area.tsx +8 -8
  43. package/src/components/select.tsx +23 -23
  44. package/src/components/separator.tsx +6 -6
  45. package/src/components/sheet.tsx +24 -24
  46. package/src/components/sidebar.tsx +774 -0
  47. package/src/components/skeleton.tsx +3 -3
  48. package/src/components/slider.tsx +6 -6
  49. package/src/components/sonner.tsx +9 -9
  50. package/src/components/spinner.tsx +16 -0
  51. package/src/components/switch.tsx +6 -6
  52. package/src/components/table.tsx +19 -19
  53. package/src/components/tabs.tsx +11 -11
  54. package/src/components/textarea.tsx +6 -6
  55. package/src/components/toggle-group.tsx +15 -14
  56. package/src/components/toggle.tsx +8 -8
  57. package/src/components/tooltip.tsx +10 -10
  58. package/src/globals.css +45 -0
  59. package/src/hooks/use-mobile.tsx +19 -0
  60. package/src/index.ts +78 -0
@@ -1,18 +1,15 @@
1
- "use client";
1
+ "use client"
2
2
 
3
+ import * as React from "react"
3
4
  import {
4
5
  ChevronDownIcon,
5
6
  ChevronLeftIcon,
6
7
  ChevronRightIcon,
7
- } from "lucide-react";
8
- import * as React from "react";
9
- import {
10
- type DayButton,
11
- DayPicker,
12
- getDefaultClassNames,
13
- } from "react-day-picker";
14
- import { Button, buttonVariants } from "./button";
15
- import { cn } from "../lib/utils";
8
+ } from "lucide-react"
9
+ import { type DayButton, DayPicker, getDefaultClassNames } from "react-day-picker"
10
+
11
+ import { cn } from "@/lib/utils"
12
+ import { Button, buttonVariants } from "@/components/button"
16
13
 
17
14
  function Calendar({
18
15
  className,
@@ -24,9 +21,9 @@ function Calendar({
24
21
  components,
25
22
  ...props
26
23
  }: React.ComponentProps<typeof DayPicker> & {
27
- buttonVariant?: React.ComponentProps<typeof Button>["variant"];
24
+ buttonVariant?: React.ComponentProps<typeof Button>["variant"]
28
25
  }) {
29
- const defaultClassNames = getDefaultClassNames();
26
+ const defaultClassNames = getDefaultClassNames()
30
27
 
31
28
  return (
32
29
  <DayPicker
@@ -136,13 +133,13 @@ function Calendar({
136
133
  className={cn(className)}
137
134
  {...props}
138
135
  />
139
- );
136
+ )
140
137
  },
141
138
  Chevron: ({ className, orientation, ...props }) => {
142
139
  if (orientation === "left") {
143
140
  return (
144
141
  <ChevronLeftIcon className={cn("size-4", className)} {...props} />
145
- );
142
+ )
146
143
  }
147
144
 
148
145
  if (orientation === "right") {
@@ -151,12 +148,12 @@ function Calendar({
151
148
  className={cn("size-4", className)}
152
149
  {...props}
153
150
  />
154
- );
151
+ )
155
152
  }
156
153
 
157
154
  return (
158
155
  <ChevronDownIcon className={cn("size-4", className)} {...props} />
159
- );
156
+ )
160
157
  },
161
158
  DayButton: CalendarDayButton,
162
159
  WeekNumber: ({ children, ...props }) => {
@@ -166,13 +163,13 @@ function Calendar({
166
163
  {children}
167
164
  </div>
168
165
  </td>
169
- );
166
+ )
170
167
  },
171
168
  ...components,
172
169
  }}
173
170
  {...props}
174
171
  />
175
- );
172
+ )
176
173
  }
177
174
 
178
175
  function CalendarDayButton({
@@ -181,12 +178,12 @@ function CalendarDayButton({
181
178
  modifiers,
182
179
  ...props
183
180
  }: React.ComponentProps<typeof DayButton>) {
184
- const defaultClassNames = getDefaultClassNames();
181
+ const defaultClassNames = getDefaultClassNames()
185
182
 
186
- const ref = React.useRef<HTMLButtonElement>(null);
183
+ const ref = React.useRef<HTMLButtonElement>(null)
187
184
  React.useEffect(() => {
188
- if (modifiers.focused) ref.current?.focus();
189
- }, [modifiers.focused]);
185
+ if (modifiers.focused) ref.current?.focus()
186
+ }, [modifiers.focused])
190
187
 
191
188
  return (
192
189
  <Button
@@ -210,7 +207,7 @@ function CalendarDayButton({
210
207
  )}
211
208
  {...props}
212
209
  />
213
- );
210
+ )
214
211
  }
215
212
 
216
- export { Calendar, CalendarDayButton };
213
+ export { Calendar, CalendarDayButton }
@@ -1,6 +1,6 @@
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
5
  const Card = React.forwardRef<
6
6
  HTMLDivElement,
@@ -14,8 +14,8 @@ const Card = React.forwardRef<
14
14
  )}
15
15
  {...props}
16
16
  />
17
- ));
18
- Card.displayName = "Card";
17
+ ))
18
+ Card.displayName = "Card"
19
19
 
20
20
  const CardHeader = React.forwardRef<
21
21
  HTMLDivElement,
@@ -26,8 +26,8 @@ const CardHeader = React.forwardRef<
26
26
  className={cn("flex flex-col space-y-1.5 p-6", className)}
27
27
  {...props}
28
28
  />
29
- ));
30
- CardHeader.displayName = "CardHeader";
29
+ ))
30
+ CardHeader.displayName = "CardHeader"
31
31
 
32
32
  const CardTitle = React.forwardRef<
33
33
  HTMLDivElement,
@@ -41,8 +41,8 @@ const CardTitle = React.forwardRef<
41
41
  )}
42
42
  {...props}
43
43
  />
44
- ));
45
- CardTitle.displayName = "CardTitle";
44
+ ))
45
+ CardTitle.displayName = "CardTitle"
46
46
 
47
47
  const CardDescription = React.forwardRef<
48
48
  HTMLDivElement,
@@ -53,16 +53,16 @@ const CardDescription = React.forwardRef<
53
53
  className={cn("text-sm text-muted-foreground", className)}
54
54
  {...props}
55
55
  />
56
- ));
57
- CardDescription.displayName = "CardDescription";
56
+ ))
57
+ CardDescription.displayName = "CardDescription"
58
58
 
59
59
  const CardContent = React.forwardRef<
60
60
  HTMLDivElement,
61
61
  React.HTMLAttributes<HTMLDivElement>
62
62
  >(({ className, ...props }, ref) => (
63
63
  <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
64
- ));
65
- CardContent.displayName = "CardContent";
64
+ ))
65
+ CardContent.displayName = "CardContent"
66
66
 
67
67
  const CardFooter = React.forwardRef<
68
68
  HTMLDivElement,
@@ -73,14 +73,7 @@ const CardFooter = React.forwardRef<
73
73
  className={cn("flex items-center p-6 pt-0", className)}
74
74
  {...props}
75
75
  />
76
- ));
77
- CardFooter.displayName = "CardFooter";
76
+ ))
77
+ CardFooter.displayName = "CardFooter"
78
78
 
79
- export {
80
- Card,
81
- CardHeader,
82
- CardFooter,
83
- CardTitle,
84
- CardDescription,
85
- CardContent,
86
- };
79
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
@@ -1,42 +1,43 @@
1
+ import * as React from "react"
1
2
  import useEmblaCarousel, {
2
3
  type UseEmblaCarouselType,
3
- } from "embla-carousel-react";
4
- import { ArrowLeft, ArrowRight } from "lucide-react";
5
- import * as React from "react";
6
- import { Button } from "./button";
7
- import { cn } from "../lib/utils";
4
+ } from "embla-carousel-react"
5
+ import { ArrowLeft, ArrowRight } from "lucide-react"
8
6
 
9
- type CarouselApi = UseEmblaCarouselType[1];
10
- type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
11
- type CarouselOptions = UseCarouselParameters[0];
12
- type CarouselPlugin = UseCarouselParameters[1];
7
+ import { cn } from "@/lib/utils"
8
+ import { Button } from "@/components/button"
9
+
10
+ type CarouselApi = UseEmblaCarouselType[1]
11
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
12
+ type CarouselOptions = UseCarouselParameters[0]
13
+ type CarouselPlugin = UseCarouselParameters[1]
13
14
 
14
15
  type CarouselProps = {
15
- opts?: CarouselOptions;
16
- plugins?: CarouselPlugin;
17
- orientation?: "horizontal" | "vertical";
18
- setApi?: (api: CarouselApi) => void;
19
- };
16
+ opts?: CarouselOptions
17
+ plugins?: CarouselPlugin
18
+ orientation?: "horizontal" | "vertical"
19
+ setApi?: (api: CarouselApi) => void
20
+ }
20
21
 
21
22
  type CarouselContextProps = {
22
- carouselRef: ReturnType<typeof useEmblaCarousel>[0];
23
- api: ReturnType<typeof useEmblaCarousel>[1];
24
- scrollPrev: () => void;
25
- scrollNext: () => void;
26
- canScrollPrev: boolean;
27
- canScrollNext: boolean;
28
- } & CarouselProps;
23
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0]
24
+ api: ReturnType<typeof useEmblaCarousel>[1]
25
+ scrollPrev: () => void
26
+ scrollNext: () => void
27
+ canScrollPrev: boolean
28
+ canScrollNext: boolean
29
+ } & CarouselProps
29
30
 
30
- const CarouselContext = React.createContext<CarouselContextProps | null>(null);
31
+ const CarouselContext = React.createContext<CarouselContextProps | null>(null)
31
32
 
32
33
  function useCarousel() {
33
- const context = React.useContext(CarouselContext);
34
+ const context = React.useContext(CarouselContext)
34
35
 
35
36
  if (!context) {
36
- throw new Error("useCarousel must be used within a <Carousel />");
37
+ throw new Error("useCarousel must be used within a <Carousel />")
37
38
  }
38
39
 
39
- return context;
40
+ return context
40
41
  }
41
42
 
42
43
  const Carousel = React.forwardRef<
@@ -61,61 +62,61 @@ const Carousel = React.forwardRef<
61
62
  axis: orientation === "horizontal" ? "x" : "y",
62
63
  },
63
64
  plugins
64
- );
65
- const [canScrollPrev, setCanScrollPrev] = React.useState(false);
66
- const [canScrollNext, setCanScrollNext] = React.useState(false);
65
+ )
66
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false)
67
+ const [canScrollNext, setCanScrollNext] = React.useState(false)
67
68
 
68
69
  const onSelect = React.useCallback((api: CarouselApi) => {
69
70
  if (!api) {
70
- return;
71
+ return
71
72
  }
72
73
 
73
- setCanScrollPrev(api.canScrollPrev());
74
- setCanScrollNext(api.canScrollNext());
75
- }, []);
74
+ setCanScrollPrev(api.canScrollPrev())
75
+ setCanScrollNext(api.canScrollNext())
76
+ }, [])
76
77
 
77
78
  const scrollPrev = React.useCallback(() => {
78
- api?.scrollPrev();
79
- }, [api]);
79
+ api?.scrollPrev()
80
+ }, [api])
80
81
 
81
82
  const scrollNext = React.useCallback(() => {
82
- api?.scrollNext();
83
- }, [api]);
83
+ api?.scrollNext()
84
+ }, [api])
84
85
 
85
86
  const handleKeyDown = React.useCallback(
86
87
  (event: React.KeyboardEvent<HTMLDivElement>) => {
87
88
  if (event.key === "ArrowLeft") {
88
- event.preventDefault();
89
- scrollPrev();
89
+ event.preventDefault()
90
+ scrollPrev()
90
91
  } else if (event.key === "ArrowRight") {
91
- event.preventDefault();
92
- scrollNext();
92
+ event.preventDefault()
93
+ scrollNext()
93
94
  }
94
95
  },
95
96
  [scrollPrev, scrollNext]
96
- );
97
+ )
97
98
 
98
99
  React.useEffect(() => {
99
100
  if (!api || !setApi) {
100
- return;
101
+ return
101
102
  }
102
103
 
103
- setApi(api);
104
- }, [api, setApi]);
104
+ setApi(api)
105
+ }, [api, setApi])
105
106
 
106
107
  React.useEffect(() => {
107
108
  if (!api) {
108
- return;
109
+ return
109
110
  }
110
111
 
111
- onSelect(api);
112
- api.on("reInit", onSelect);
113
- api.on("select", onSelect);
112
+ onSelect(api)
113
+ api.on("reInit", onSelect)
114
+ api.on("select", onSelect)
114
115
 
115
116
  return () => {
116
- api?.off("select", onSelect);
117
- };
118
- }, [api, onSelect]);
117
+ api?.off("select", onSelect)
118
+ }
119
+ }, [api, onSelect])
119
120
 
120
121
  return (
121
122
  <CarouselContext.Provider
@@ -142,16 +143,16 @@ const Carousel = React.forwardRef<
142
143
  {children}
143
144
  </div>
144
145
  </CarouselContext.Provider>
145
- );
146
+ )
146
147
  }
147
- );
148
- Carousel.displayName = "Carousel";
148
+ )
149
+ Carousel.displayName = "Carousel"
149
150
 
150
151
  const CarouselContent = React.forwardRef<
151
152
  HTMLDivElement,
152
153
  React.HTMLAttributes<HTMLDivElement>
153
154
  >(({ className, ...props }, ref) => {
154
- const { carouselRef, orientation } = useCarousel();
155
+ const { carouselRef, orientation } = useCarousel()
155
156
 
156
157
  return (
157
158
  <div ref={carouselRef} className="overflow-hidden">
@@ -165,15 +166,15 @@ const CarouselContent = React.forwardRef<
165
166
  {...props}
166
167
  />
167
168
  </div>
168
- );
169
- });
170
- CarouselContent.displayName = "CarouselContent";
169
+ )
170
+ })
171
+ CarouselContent.displayName = "CarouselContent"
171
172
 
172
173
  const CarouselItem = React.forwardRef<
173
174
  HTMLDivElement,
174
175
  React.HTMLAttributes<HTMLDivElement>
175
176
  >(({ className, ...props }, ref) => {
176
- const { orientation } = useCarousel();
177
+ const { orientation } = useCarousel()
177
178
 
178
179
  return (
179
180
  <div
@@ -187,15 +188,15 @@ const CarouselItem = React.forwardRef<
187
188
  )}
188
189
  {...props}
189
190
  />
190
- );
191
- });
192
- CarouselItem.displayName = "CarouselItem";
191
+ )
192
+ })
193
+ CarouselItem.displayName = "CarouselItem"
193
194
 
194
195
  const CarouselPrevious = React.forwardRef<
195
196
  HTMLButtonElement,
196
197
  React.ComponentProps<typeof Button>
197
198
  >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
198
- const { orientation, scrollPrev, canScrollPrev } = useCarousel();
199
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel()
199
200
 
200
201
  return (
201
202
  <Button
@@ -216,15 +217,15 @@ const CarouselPrevious = React.forwardRef<
216
217
  <ArrowLeft className="h-4 w-4" />
217
218
  <span className="sr-only">Previous slide</span>
218
219
  </Button>
219
- );
220
- });
221
- CarouselPrevious.displayName = "CarouselPrevious";
220
+ )
221
+ })
222
+ CarouselPrevious.displayName = "CarouselPrevious"
222
223
 
223
224
  const CarouselNext = React.forwardRef<
224
225
  HTMLButtonElement,
225
226
  React.ComponentProps<typeof Button>
226
227
  >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
227
- const { orientation, scrollNext, canScrollNext } = useCarousel();
228
+ const { orientation, scrollNext, canScrollNext } = useCarousel()
228
229
 
229
230
  return (
230
231
  <Button
@@ -245,9 +246,9 @@ const CarouselNext = React.forwardRef<
245
246
  <ArrowRight className="h-4 w-4" />
246
247
  <span className="sr-only">Next slide</span>
247
248
  </Button>
248
- );
249
- });
250
- CarouselNext.displayName = "CarouselNext";
249
+ )
250
+ })
251
+ CarouselNext.displayName = "CarouselNext"
251
252
 
252
253
  export {
253
254
  type CarouselApi,
@@ -256,4 +257,4 @@ export {
256
257
  CarouselItem,
257
258
  CarouselPrevious,
258
259
  CarouselNext,
259
- };
260
+ }