@vvedantb/ui 0.1.0 → 0.1.2

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 (74) hide show
  1. package/LICENSE +21 -21
  2. package/package.json +3 -2
  3. package/src/ai-elements/artifact.tsx +99 -99
  4. package/src/ai-elements/attachments.tsx +366 -366
  5. package/src/ai-elements/chain-of-thought.tsx +212 -212
  6. package/src/ai-elements/code-block.tsx +478 -478
  7. package/src/ai-elements/conversation.tsx +157 -157
  8. package/src/ai-elements/image.tsx +25 -25
  9. package/src/ai-elements/inline-citation.tsx +252 -252
  10. package/src/ai-elements/message.tsx +269 -269
  11. package/src/ai-elements/model-selector.tsx +211 -211
  12. package/src/ai-elements/prompt-input.tsx +1018 -1018
  13. package/src/ai-elements/queue.tsx +251 -251
  14. package/src/ai-elements/reasoning.tsx +178 -178
  15. package/src/ai-elements/shimmer.tsx +56 -56
  16. package/src/ai-elements/sources.tsx +77 -77
  17. package/src/ai-elements/speech-input.tsx +290 -290
  18. package/src/ai-elements/suggestion.tsx +191 -191
  19. package/src/css.d.ts +2 -2
  20. package/src/index.ts +96 -96
  21. package/src/motion/presets.ts +35 -35
  22. package/src/motion/presets.vibot.ts +105 -105
  23. package/src/ui/_menu-classes.ts +30 -30
  24. package/src/ui/_menu-classes.vibot.ts +33 -33
  25. package/src/ui/accordion.tsx +81 -81
  26. package/src/ui/accordion.verve.tsx +56 -56
  27. package/src/ui/badge.tsx +34 -34
  28. package/src/ui/breadcrumb.tsx +83 -83
  29. package/src/ui/button-group.tsx +84 -84
  30. package/src/ui/button.tsx +57 -57
  31. package/src/ui/card.tsx +27 -27
  32. package/src/ui/carousel.tsx +211 -211
  33. package/src/ui/checkbox.tsx +27 -27
  34. package/src/ui/clear-input.tsx +170 -170
  35. package/src/ui/clear-input.vibot.tsx +76 -76
  36. package/src/ui/clearInputDissolve.ts +214 -214
  37. package/src/ui/collapsible.tsx +7 -7
  38. package/src/ui/command.tsx +148 -148
  39. package/src/ui/context-menu.tsx +173 -173
  40. package/src/ui/dialog.tsx +149 -149
  41. package/src/ui/dropdown-menu.tsx +178 -178
  42. package/src/ui/hover-card.tsx +31 -31
  43. package/src/ui/input-group.tsx +162 -162
  44. package/src/ui/input-group.verve.tsx +150 -150
  45. package/src/ui/input.tsx +21 -21
  46. package/src/ui/kbd.tsx +18 -18
  47. package/src/ui/label.tsx +20 -20
  48. package/src/ui/labeled-switch-row.tsx +53 -53
  49. package/src/ui/modalTransition.ts +85 -85
  50. package/src/ui/pagination.tsx +47 -47
  51. package/src/ui/popover.tsx +33 -33
  52. package/src/ui/progress.tsx +25 -25
  53. package/src/ui/radix-select.tsx +202 -202
  54. package/src/ui/scroll-area.tsx +55 -55
  55. package/src/ui/scroll-area.verve.tsx +43 -43
  56. package/src/ui/search-input.tsx +29 -29
  57. package/src/ui/select.tsx +163 -163
  58. package/src/ui/separator.tsx +28 -28
  59. package/src/ui/sheet.tsx +87 -87
  60. package/src/ui/skeleton.tsx +18 -18
  61. package/src/ui/sonner.css +16 -16
  62. package/src/ui/sonner.tsx +47 -47
  63. package/src/ui/spinner.tsx +27 -27
  64. package/src/ui/surface-classes.ts +55 -55
  65. package/src/ui/switch.tsx +26 -26
  66. package/src/ui/table.tsx +123 -123
  67. package/src/ui/tabs.tsx +140 -140
  68. package/src/ui/tabsSliding.ts +56 -56
  69. package/src/ui/textarea.tsx +21 -21
  70. package/src/ui/time-picker.tsx +170 -170
  71. package/src/ui/tooltip.tsx +25 -25
  72. package/src/ui/visually-hidden.tsx +3 -3
  73. package/src/utils/cn.ts +16 -16
  74. package/src/utils/ref.ts +10 -10
package/src/ui/select.tsx CHANGED
@@ -1,163 +1,163 @@
1
- import * as React from "react";
2
- import * as SelectPrimitive from "@radix-ui/react-select";
3
- import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
4
- import { cn } from "../utils/cn";
5
- import {
6
- floatingSurfaceAnimateClass,
7
- floatingSurfaceClass,
8
- } from "./_menu-classes";
9
-
10
- const Select = SelectPrimitive.Root;
11
- const SelectGroup = SelectPrimitive.Group;
12
- const SelectValue = SelectPrimitive.Value;
13
-
14
- const SelectTrigger = React.forwardRef<
15
- React.ComponentRef<typeof SelectPrimitive.Trigger>,
16
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
17
- >(({ className, children, ...props }, ref) => (
18
- <SelectPrimitive.Trigger
19
- ref={ref}
20
- className={cn(
21
- "flex h-10 w-full max-sm:min-w-0 items-center justify-between whitespace-nowrap rounded-field border border-border bg-field-background px-3.5 py-2 text-base sm:text-sm ring-offset-background placeholder:text-field-placeholder transition-[border-color,box-shadow,background-color] duration-200 ease-smooth focus-visible:border-focus-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
22
- className,
23
- )}
24
- {...props}
25
- >
26
- {children}
27
- <SelectPrimitive.Icon asChild>
28
- <IconChevronDown className="h-4 w-4 text-muted/85" />
29
- </SelectPrimitive.Icon>
30
- </SelectPrimitive.Trigger>
31
- ));
32
- SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
33
-
34
- const SelectScrollUpButton = React.forwardRef<
35
- React.ComponentRef<typeof SelectPrimitive.ScrollUpButton>,
36
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
37
- >(({ className, ...props }, ref) => (
38
- <SelectPrimitive.ScrollUpButton
39
- ref={ref}
40
- className={cn(
41
- "flex cursor-default items-center justify-center py-1 text-muted",
42
- className,
43
- )}
44
- {...props}
45
- >
46
- <IconChevronUp className="h-4 w-4" />
47
- </SelectPrimitive.ScrollUpButton>
48
- ));
49
- SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
50
-
51
- const SelectScrollDownButton = React.forwardRef<
52
- React.ComponentRef<typeof SelectPrimitive.ScrollDownButton>,
53
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
54
- >(({ className, ...props }, ref) => (
55
- <SelectPrimitive.ScrollDownButton
56
- ref={ref}
57
- className={cn(
58
- "flex cursor-default items-center justify-center py-1 text-muted",
59
- className,
60
- )}
61
- {...props}
62
- >
63
- <IconChevronDown className="h-4 w-4" />
64
- </SelectPrimitive.ScrollDownButton>
65
- ));
66
- SelectScrollDownButton.displayName =
67
- SelectPrimitive.ScrollDownButton.displayName;
68
-
69
- const SelectContent = React.forwardRef<
70
- React.ComponentRef<typeof SelectPrimitive.Content>,
71
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
72
- >(({ className, children, position = "popper", ...props }, ref) => (
73
- <SelectPrimitive.Portal>
74
- <SelectPrimitive.Content
75
- ref={ref}
76
- className={cn(
77
- "relative z-50 max-h-96 w-36 overflow-hidden outline-none",
78
- floatingSurfaceClass,
79
- floatingSurfaceAnimateClass,
80
- position === "popper" &&
81
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
82
- className,
83
- )}
84
- position={position}
85
- {...props}
86
- >
87
- <SelectScrollUpButton />
88
- <SelectPrimitive.Viewport
89
- className={cn(
90
- "p-1.5",
91
- position === "popper" &&
92
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
93
- )}
94
- >
95
- {children}
96
- </SelectPrimitive.Viewport>
97
- <SelectScrollDownButton />
98
- </SelectPrimitive.Content>
99
- </SelectPrimitive.Portal>
100
- ));
101
- SelectContent.displayName = SelectPrimitive.Content.displayName;
102
-
103
- const SelectLabel = React.forwardRef<
104
- React.ComponentRef<typeof SelectPrimitive.Label>,
105
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
106
- >(({ className, ...props }, ref) => (
107
- <SelectPrimitive.Label
108
- ref={ref}
109
- className={cn(
110
- "px-2.5 py-1.5 text-xs font-semibold uppercase tracking-widest text-muted",
111
- className,
112
- )}
113
- {...props}
114
- />
115
- ));
116
- SelectLabel.displayName = SelectPrimitive.Label.displayName;
117
-
118
- const SelectItem = React.forwardRef<
119
- React.ComponentRef<typeof SelectPrimitive.Item>,
120
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
121
- >(({ className, children, ...props }, ref) => (
122
- <SelectPrimitive.Item
123
- ref={ref}
124
- className={cn(
125
- "relative flex w-full cursor-pointer select-none items-center rounded-lg py-2 pl-2.5 pr-8 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
126
- className,
127
- )}
128
- {...props}
129
- >
130
- <span className="absolute right-2.5 flex h-3.5 w-3.5 items-center justify-center">
131
- <SelectPrimitive.ItemIndicator>
132
- <IconCheck className="h-4 w-4" />
133
- </SelectPrimitive.ItemIndicator>
134
- </span>
135
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
136
- </SelectPrimitive.Item>
137
- ));
138
- SelectItem.displayName = SelectPrimitive.Item.displayName;
139
-
140
- const SelectSeparator = React.forwardRef<
141
- React.ComponentRef<typeof SelectPrimitive.Separator>,
142
- React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
143
- >(({ className, ...props }, ref) => (
144
- <SelectPrimitive.Separator
145
- ref={ref}
146
- className={cn("-mx-1.5 my-1 h-px bg-separator", className)}
147
- {...props}
148
- />
149
- ));
150
- SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
151
-
152
- export {
153
- Select,
154
- SelectGroup,
155
- SelectValue,
156
- SelectTrigger,
157
- SelectContent,
158
- SelectLabel,
159
- SelectItem,
160
- SelectSeparator,
161
- SelectScrollUpButton,
162
- SelectScrollDownButton,
163
- };
1
+ import * as React from "react";
2
+ import * as SelectPrimitive from "@radix-ui/react-select";
3
+ import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
4
+ import { cn } from "../utils/cn";
5
+ import {
6
+ floatingSurfaceAnimateClass,
7
+ floatingSurfaceClass,
8
+ } from "./_menu-classes";
9
+
10
+ const Select = SelectPrimitive.Root;
11
+ const SelectGroup = SelectPrimitive.Group;
12
+ const SelectValue = SelectPrimitive.Value;
13
+
14
+ const SelectTrigger = React.forwardRef<
15
+ React.ComponentRef<typeof SelectPrimitive.Trigger>,
16
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
17
+ >(({ className, children, ...props }, ref) => (
18
+ <SelectPrimitive.Trigger
19
+ ref={ref}
20
+ className={cn(
21
+ "flex h-10 w-full max-sm:min-w-0 items-center justify-between whitespace-nowrap rounded-field border border-border bg-field-background px-3.5 py-2 text-base sm:text-sm ring-offset-background placeholder:text-field-placeholder transition-[border-color,box-shadow,background-color] duration-200 ease-smooth focus-visible:border-focus-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
22
+ className,
23
+ )}
24
+ {...props}
25
+ >
26
+ {children}
27
+ <SelectPrimitive.Icon asChild>
28
+ <IconChevronDown className="h-4 w-4 text-muted/85" />
29
+ </SelectPrimitive.Icon>
30
+ </SelectPrimitive.Trigger>
31
+ ));
32
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
33
+
34
+ const SelectScrollUpButton = React.forwardRef<
35
+ React.ComponentRef<typeof SelectPrimitive.ScrollUpButton>,
36
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
37
+ >(({ className, ...props }, ref) => (
38
+ <SelectPrimitive.ScrollUpButton
39
+ ref={ref}
40
+ className={cn(
41
+ "flex cursor-default items-center justify-center py-1 text-muted",
42
+ className,
43
+ )}
44
+ {...props}
45
+ >
46
+ <IconChevronUp className="h-4 w-4" />
47
+ </SelectPrimitive.ScrollUpButton>
48
+ ));
49
+ SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
50
+
51
+ const SelectScrollDownButton = React.forwardRef<
52
+ React.ComponentRef<typeof SelectPrimitive.ScrollDownButton>,
53
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
54
+ >(({ className, ...props }, ref) => (
55
+ <SelectPrimitive.ScrollDownButton
56
+ ref={ref}
57
+ className={cn(
58
+ "flex cursor-default items-center justify-center py-1 text-muted",
59
+ className,
60
+ )}
61
+ {...props}
62
+ >
63
+ <IconChevronDown className="h-4 w-4" />
64
+ </SelectPrimitive.ScrollDownButton>
65
+ ));
66
+ SelectScrollDownButton.displayName =
67
+ SelectPrimitive.ScrollDownButton.displayName;
68
+
69
+ const SelectContent = React.forwardRef<
70
+ React.ComponentRef<typeof SelectPrimitive.Content>,
71
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
72
+ >(({ className, children, position = "popper", ...props }, ref) => (
73
+ <SelectPrimitive.Portal>
74
+ <SelectPrimitive.Content
75
+ ref={ref}
76
+ className={cn(
77
+ "relative z-50 max-h-96 w-36 overflow-hidden outline-none",
78
+ floatingSurfaceClass,
79
+ floatingSurfaceAnimateClass,
80
+ position === "popper" &&
81
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
82
+ className,
83
+ )}
84
+ position={position}
85
+ {...props}
86
+ >
87
+ <SelectScrollUpButton />
88
+ <SelectPrimitive.Viewport
89
+ className={cn(
90
+ "p-1.5",
91
+ position === "popper" &&
92
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",
93
+ )}
94
+ >
95
+ {children}
96
+ </SelectPrimitive.Viewport>
97
+ <SelectScrollDownButton />
98
+ </SelectPrimitive.Content>
99
+ </SelectPrimitive.Portal>
100
+ ));
101
+ SelectContent.displayName = SelectPrimitive.Content.displayName;
102
+
103
+ const SelectLabel = React.forwardRef<
104
+ React.ComponentRef<typeof SelectPrimitive.Label>,
105
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
106
+ >(({ className, ...props }, ref) => (
107
+ <SelectPrimitive.Label
108
+ ref={ref}
109
+ className={cn(
110
+ "px-2.5 py-1.5 text-xs font-semibold uppercase tracking-widest text-muted",
111
+ className,
112
+ )}
113
+ {...props}
114
+ />
115
+ ));
116
+ SelectLabel.displayName = SelectPrimitive.Label.displayName;
117
+
118
+ const SelectItem = React.forwardRef<
119
+ React.ComponentRef<typeof SelectPrimitive.Item>,
120
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
121
+ >(({ className, children, ...props }, ref) => (
122
+ <SelectPrimitive.Item
123
+ ref={ref}
124
+ className={cn(
125
+ "relative flex w-full cursor-pointer select-none items-center rounded-lg py-2 pl-2.5 pr-8 text-sm outline-none transition-[background-color,color] focus:bg-default focus:text-foreground data-[highlighted]:bg-default data-[highlighted]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
126
+ className,
127
+ )}
128
+ {...props}
129
+ >
130
+ <span className="absolute right-2.5 flex h-3.5 w-3.5 items-center justify-center">
131
+ <SelectPrimitive.ItemIndicator>
132
+ <IconCheck className="h-4 w-4" />
133
+ </SelectPrimitive.ItemIndicator>
134
+ </span>
135
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
136
+ </SelectPrimitive.Item>
137
+ ));
138
+ SelectItem.displayName = SelectPrimitive.Item.displayName;
139
+
140
+ const SelectSeparator = React.forwardRef<
141
+ React.ComponentRef<typeof SelectPrimitive.Separator>,
142
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
143
+ >(({ className, ...props }, ref) => (
144
+ <SelectPrimitive.Separator
145
+ ref={ref}
146
+ className={cn("-mx-1.5 my-1 h-px bg-separator", className)}
147
+ {...props}
148
+ />
149
+ ));
150
+ SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
151
+
152
+ export {
153
+ Select,
154
+ SelectGroup,
155
+ SelectValue,
156
+ SelectTrigger,
157
+ SelectContent,
158
+ SelectLabel,
159
+ SelectItem,
160
+ SelectSeparator,
161
+ SelectScrollUpButton,
162
+ SelectScrollDownButton,
163
+ };
@@ -1,28 +1,28 @@
1
- import * as React from "react";
2
- import * as SeparatorPrimitive from "@radix-ui/react-separator";
3
- import { cn } from "../utils/cn";
4
-
5
- const Separator = React.forwardRef<
6
- React.ComponentRef<typeof SeparatorPrimitive.Root>,
7
- React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
8
- >(
9
- (
10
- { className, orientation = "horizontal", decorative = true, ...props },
11
- ref,
12
- ) => (
13
- <SeparatorPrimitive.Root
14
- ref={ref}
15
- decorative={decorative}
16
- orientation={orientation}
17
- className={cn(
18
- "shrink-0 bg-separator",
19
- orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
20
- className,
21
- )}
22
- {...props}
23
- />
24
- ),
25
- );
26
- Separator.displayName = SeparatorPrimitive.Root.displayName;
27
-
28
- export { Separator };
1
+ import * as React from "react";
2
+ import * as SeparatorPrimitive from "@radix-ui/react-separator";
3
+ import { cn } from "../utils/cn";
4
+
5
+ const Separator = React.forwardRef<
6
+ React.ComponentRef<typeof SeparatorPrimitive.Root>,
7
+ React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
8
+ >(
9
+ (
10
+ { className, orientation = "horizontal", decorative = true, ...props },
11
+ ref,
12
+ ) => (
13
+ <SeparatorPrimitive.Root
14
+ ref={ref}
15
+ decorative={decorative}
16
+ orientation={orientation}
17
+ className={cn(
18
+ "shrink-0 bg-separator",
19
+ orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
20
+ className,
21
+ )}
22
+ {...props}
23
+ />
24
+ ),
25
+ );
26
+ Separator.displayName = SeparatorPrimitive.Root.displayName;
27
+
28
+ export { Separator };
package/src/ui/sheet.tsx CHANGED
@@ -1,87 +1,87 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { Drawer as DrawerPrimitive } from "vaul";
5
- import { cn } from "../utils/cn";
6
-
7
- type SheetSide = "top" | "bottom" | "left" | "right";
8
-
9
- function Sheet({
10
- shouldScaleBackground = false,
11
- ...props
12
- }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
13
- return (
14
- <DrawerPrimitive.Root
15
- shouldScaleBackground={shouldScaleBackground}
16
- {...props}
17
- />
18
- );
19
- }
20
-
21
- const SheetTrigger = DrawerPrimitive.Trigger;
22
- const SheetPortal = DrawerPrimitive.Portal;
23
- const SheetClose = DrawerPrimitive.Close;
24
- const SheetHandle = DrawerPrimitive.Handle;
25
- const SheetTitle = DrawerPrimitive.Title;
26
- const SheetDescription = DrawerPrimitive.Description;
27
-
28
- const SheetOverlay = React.forwardRef<
29
- React.ComponentRef<typeof DrawerPrimitive.Overlay>,
30
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
31
- >(({ className, ...props }, ref) => (
32
- <DrawerPrimitive.Overlay
33
- ref={ref}
34
- className={cn(
35
- "fixed inset-0 z-50 bg-backdrop backdrop-blur-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
36
- className,
37
- )}
38
- {...props}
39
- />
40
- ));
41
- SheetOverlay.displayName = "SheetOverlay";
42
-
43
- const sheetSideClass: Record<SheetSide, string> = {
44
- bottom: "inset-x-0 bottom-0 mt-24 flex h-auto flex-col rounded-t-2xl",
45
- top: "inset-x-0 top-0 mb-24 flex h-auto flex-col rounded-b-2xl",
46
- left: "inset-y-2 left-2 right-auto flex h-auto w-80 max-w-[88vw] flex-col rounded-2xl",
47
- right:
48
- "inset-y-2 left-auto right-2 flex h-auto w-80 max-w-[88vw] flex-col rounded-2xl",
49
- };
50
-
51
- const SheetContent = React.forwardRef<
52
- React.ComponentRef<typeof DrawerPrimitive.Content>,
53
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> & {
54
- side?: SheetSide;
55
- }
56
- >(({ className, children, side = "bottom", ...props }, ref) => (
57
- <SheetPortal>
58
- <SheetOverlay />
59
- <DrawerPrimitive.Content
60
- ref={ref}
61
- className={cn(
62
- "fixed z-50 bg-overlay/95 text-overlay-foreground smooth-shadow-ring-xl outline-hidden backdrop-blur-xl",
63
- sheetSideClass[side],
64
- className,
65
- )}
66
- {...props}
67
- >
68
- {side === "bottom" || side === "top" ? (
69
- <SheetHandle className="mx-auto mt-3 mb-1 h-1 w-12 shrink-0 rounded-full bg-surface-tertiary" />
70
- ) : null}
71
- {children}
72
- </DrawerPrimitive.Content>
73
- </SheetPortal>
74
- ));
75
- SheetContent.displayName = "SheetContent";
76
-
77
- export {
78
- Sheet,
79
- SheetPortal,
80
- SheetOverlay,
81
- SheetTrigger,
82
- SheetClose,
83
- SheetContent,
84
- SheetHandle,
85
- SheetTitle,
86
- SheetDescription,
87
- };
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import { Drawer as DrawerPrimitive } from "vaul";
5
+ import { cn } from "../utils/cn";
6
+
7
+ type SheetSide = "top" | "bottom" | "left" | "right";
8
+
9
+ function Sheet({
10
+ shouldScaleBackground = false,
11
+ ...props
12
+ }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
13
+ return (
14
+ <DrawerPrimitive.Root
15
+ shouldScaleBackground={shouldScaleBackground}
16
+ {...props}
17
+ />
18
+ );
19
+ }
20
+
21
+ const SheetTrigger = DrawerPrimitive.Trigger;
22
+ const SheetPortal = DrawerPrimitive.Portal;
23
+ const SheetClose = DrawerPrimitive.Close;
24
+ const SheetHandle = DrawerPrimitive.Handle;
25
+ const SheetTitle = DrawerPrimitive.Title;
26
+ const SheetDescription = DrawerPrimitive.Description;
27
+
28
+ const SheetOverlay = React.forwardRef<
29
+ React.ComponentRef<typeof DrawerPrimitive.Overlay>,
30
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
31
+ >(({ className, ...props }, ref) => (
32
+ <DrawerPrimitive.Overlay
33
+ ref={ref}
34
+ className={cn(
35
+ "fixed inset-0 z-50 bg-backdrop backdrop-blur-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
36
+ className,
37
+ )}
38
+ {...props}
39
+ />
40
+ ));
41
+ SheetOverlay.displayName = "SheetOverlay";
42
+
43
+ const sheetSideClass: Record<SheetSide, string> = {
44
+ bottom: "inset-x-0 bottom-0 mt-24 flex h-auto flex-col rounded-t-2xl",
45
+ top: "inset-x-0 top-0 mb-24 flex h-auto flex-col rounded-b-2xl",
46
+ left: "inset-y-2 left-2 right-auto flex h-auto w-80 max-w-[88vw] flex-col rounded-2xl",
47
+ right:
48
+ "inset-y-2 left-auto right-2 flex h-auto w-80 max-w-[88vw] flex-col rounded-2xl",
49
+ };
50
+
51
+ const SheetContent = React.forwardRef<
52
+ React.ComponentRef<typeof DrawerPrimitive.Content>,
53
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> & {
54
+ side?: SheetSide;
55
+ }
56
+ >(({ className, children, side = "bottom", ...props }, ref) => (
57
+ <SheetPortal>
58
+ <SheetOverlay />
59
+ <DrawerPrimitive.Content
60
+ ref={ref}
61
+ className={cn(
62
+ "fixed z-50 bg-overlay/95 text-overlay-foreground smooth-shadow-ring-xl outline-hidden backdrop-blur-xl",
63
+ sheetSideClass[side],
64
+ className,
65
+ )}
66
+ {...props}
67
+ >
68
+ {side === "bottom" || side === "top" ? (
69
+ <SheetHandle className="mx-auto mt-3 mb-1 h-1 w-12 shrink-0 rounded-full bg-surface-tertiary" />
70
+ ) : null}
71
+ {children}
72
+ </DrawerPrimitive.Content>
73
+ </SheetPortal>
74
+ ));
75
+ SheetContent.displayName = "SheetContent";
76
+
77
+ export {
78
+ Sheet,
79
+ SheetPortal,
80
+ SheetOverlay,
81
+ SheetTrigger,
82
+ SheetClose,
83
+ SheetContent,
84
+ SheetHandle,
85
+ SheetTitle,
86
+ SheetDescription,
87
+ };
@@ -1,18 +1,18 @@
1
- import { cn } from "../utils/cn";
2
-
3
- function Skeleton({
4
- className,
5
- ...props
6
- }: React.HTMLAttributes<HTMLDivElement>) {
7
- return (
8
- <div
9
- className={cn(
10
- "animate-pulse rounded-lg bg-surface-secondary/70",
11
- className,
12
- )}
13
- {...props}
14
- />
15
- );
16
- }
17
-
18
- export { Skeleton };
1
+ import { cn } from "../utils/cn";
2
+
3
+ function Skeleton({
4
+ className,
5
+ ...props
6
+ }: React.HTMLAttributes<HTMLDivElement>) {
7
+ return (
8
+ <div
9
+ className={cn(
10
+ "animate-pulse rounded-lg bg-surface-secondary/70",
11
+ className,
12
+ )}
13
+ {...props}
14
+ />
15
+ );
16
+ }
17
+
18
+ export { Skeleton };
package/src/ui/sonner.css CHANGED
@@ -1,16 +1,16 @@
1
- /**
2
- * Unstyled toasts skip Sonner's data-styled rules, so stacked back toasts show
3
- * full overlapping content. Mirror the styled-mode stack: hide inner content on
4
- * collapsed back cards, expand spacing on hover (data-expanded on the toaster).
5
- */
6
- [data-sonner-toaster]
7
- [data-sonner-toast][data-expanded="false"][data-front="false"] {
8
- overflow: hidden;
9
- pointer-events: none;
10
- }
11
-
12
- [data-sonner-toaster]
13
- [data-sonner-toast][data-expanded="false"][data-front="false"]
14
- > * {
15
- opacity: 0;
16
- }
1
+ /**
2
+ * Unstyled toasts skip Sonner's data-styled rules, so stacked back toasts show
3
+ * full overlapping content. Mirror the styled-mode stack: hide inner content on
4
+ * collapsed back cards, expand spacing on hover (data-expanded on the toaster).
5
+ */
6
+ [data-sonner-toaster]
7
+ [data-sonner-toast][data-expanded="false"][data-front="false"] {
8
+ overflow: hidden;
9
+ pointer-events: none;
10
+ }
11
+
12
+ [data-sonner-toaster]
13
+ [data-sonner-toast][data-expanded="false"][data-front="false"]
14
+ > * {
15
+ opacity: 0;
16
+ }