aural-ui 2.0.5 → 2.0.7

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.
@@ -0,0 +1,205 @@
1
+ import * as React from "react"
2
+ import { Overlay } from "@components/overlay"
3
+ import { cva, VariantProps } from "class-variance-authority"
4
+ import { Drawer as DrawerPrimitive } from "vaul"
5
+
6
+ import { cn } from "src/ui/lib/utils"
7
+
8
+ function Drawer({
9
+ ...props
10
+ }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
11
+ return <DrawerPrimitive.Root data-slot="drawer" {...props} />
12
+ }
13
+
14
+ function DrawerTrigger({
15
+ ...props
16
+ }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
17
+ return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
18
+ }
19
+
20
+ function DrawerPortal({
21
+ ...props
22
+ }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
23
+ return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
24
+ }
25
+
26
+ function DrawerClose({
27
+ ...props
28
+ }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
29
+ return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
30
+ }
31
+
32
+ interface IDrawerOverlay {
33
+ opacity?: "high" | "medium" | "low" | "none"
34
+ glass?: "high" | "medium" | "low" | "none"
35
+ noise?: "high" | "medium" | "low" | "none"
36
+ classes?: {
37
+ overlay?: string
38
+ content?: string
39
+ root?: string
40
+ }
41
+ }
42
+
43
+ function DrawerOverlay({
44
+ className,
45
+ opacity,
46
+ glass,
47
+ noise,
48
+ classes,
49
+ ...props
50
+ }: React.ComponentProps<typeof DrawerPrimitive.Overlay> & IDrawerOverlay) {
51
+ return (
52
+ <DrawerPrimitive.Overlay data-slot="drawer-overlay" asChild {...props}>
53
+ <Overlay
54
+ opacity={opacity}
55
+ glass={glass}
56
+ noise={noise}
57
+ className={cn(
58
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50",
59
+ className,
60
+ classes?.overlay
61
+ )}
62
+ />
63
+ </DrawerPrimitive.Overlay>
64
+ )
65
+ }
66
+
67
+ export const drawerVariants = cva(
68
+ "flex flex-col gap-5 w-full rounded-fm-s p-4 relative group/drawer-content fixed z-50 h-auto py-2 text-white",
69
+ {
70
+ variants: {
71
+ variant: {
72
+ neutral:
73
+ "bg-fm-surface-frosted/20 border-solid border-fm-divider-secondary backdrop-blur-sm",
74
+ gradient:
75
+ "bg-fm-surface-primary [background-image:var(--color-fm-gradient-white)] border-0",
76
+ },
77
+ },
78
+ defaultVariants: {
79
+ variant: "neutral",
80
+ },
81
+ }
82
+ )
83
+
84
+ interface DrawerContentProps
85
+ extends React.HTMLAttributes<HTMLDivElement>,
86
+ VariantProps<typeof drawerVariants> {
87
+ showOverlay?: boolean
88
+ showSwipeButton?: boolean
89
+ }
90
+
91
+ const DrawerContent = React.forwardRef<
92
+ React.ElementRef<typeof DrawerPrimitive.Content>,
93
+ DrawerContentProps & IDrawerOverlay
94
+ >(
95
+ (
96
+ {
97
+ variant,
98
+ className,
99
+ opacity,
100
+ glass,
101
+ noise,
102
+ children,
103
+ classes,
104
+ showOverlay = true,
105
+ showSwipeButton = false,
106
+ ...props
107
+ },
108
+ ref
109
+ ) => {
110
+ return (
111
+ <DrawerPortal data-slot="drawer-portal">
112
+ {showOverlay && (
113
+ <DrawerOverlay
114
+ opacity={opacity}
115
+ glass={glass}
116
+ noise={noise}
117
+ classes={classes}
118
+ />
119
+ )}
120
+ <DrawerPrimitive.Content
121
+ ref={ref}
122
+ data-slot="drawer-content"
123
+ className={cn(
124
+ drawerVariants({ variant }),
125
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg",
126
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg",
127
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-lg data-[vaul-drawer-direction=right]:sm:max-w-sm",
128
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-lg data-[vaul-drawer-direction=left]:sm:max-w-sm",
129
+ className,
130
+ classes?.content
131
+ )}
132
+ {...props}
133
+ >
134
+ {showSwipeButton && (
135
+ <div className="bg-fm-surface-primary mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
136
+ )}
137
+ {children}
138
+ </DrawerPrimitive.Content>
139
+ </DrawerPortal>
140
+ )
141
+ }
142
+ )
143
+ DrawerContent.displayName = DrawerPrimitive.Content.displayName
144
+
145
+ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
146
+ return (
147
+ <div
148
+ data-slot="drawer-header"
149
+ className={cn(
150
+ "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
151
+ className
152
+ )}
153
+ {...props}
154
+ />
155
+ )
156
+ }
157
+
158
+ function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
159
+ return (
160
+ <div
161
+ data-slot="drawer-footer"
162
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
163
+ {...props}
164
+ />
165
+ )
166
+ }
167
+
168
+ function DrawerTitle({
169
+ className,
170
+ ...props
171
+ }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
172
+ return (
173
+ <DrawerPrimitive.Title
174
+ data-slot="drawer-title"
175
+ className={cn("font-semibold text-white", className)}
176
+ {...props}
177
+ />
178
+ )
179
+ }
180
+
181
+ function DrawerDescription({
182
+ className,
183
+ ...props
184
+ }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
185
+ return (
186
+ <DrawerPrimitive.Description
187
+ data-slot="drawer-description"
188
+ className={cn("text-sm text-white", className)}
189
+ {...props}
190
+ />
191
+ )
192
+ }
193
+
194
+ export {
195
+ Drawer,
196
+ DrawerPortal,
197
+ DrawerOverlay,
198
+ DrawerTrigger,
199
+ DrawerClose,
200
+ DrawerContent,
201
+ DrawerHeader,
202
+ DrawerFooter,
203
+ DrawerTitle,
204
+ DrawerDescription,
205
+ }
@@ -0,0 +1,64 @@
1
+ export const meta = {
2
+ dependencies: {
3
+ vaul: "^1.1.2",
4
+ },
5
+ internalDependencies: [],
6
+ tokens: [
7
+ "--color-fm-surface-frosted",
8
+ "--color-fm-divider-secondary",
9
+ "--color-fm-surface-primary",
10
+ "--color-white",
11
+ "--color-fm-white-alpha-16",
12
+ "--color-fm-white-alpha-0",
13
+ "--color-fm-gradient-white",
14
+ "--spacing-fm-4",
15
+ "--spacing-fm-5",
16
+ "--spacing-fm-2",
17
+ "--spacing-fm-24",
18
+ "--text-fm-sm",
19
+ "--font-fm-semibold",
20
+ "--z-index-50",
21
+ "--border-radius-fm-s",
22
+ "--border-radius-lg",
23
+ "--border-radius-t-lg",
24
+ "--border-radius-b-lg",
25
+ "--border-radius-l-lg",
26
+ "--border-radius-r-lg",
27
+ "--shadow-lg",
28
+ ],
29
+ props: {
30
+ DrawerContent: {
31
+ showOverlay: {
32
+ type: "boolean",
33
+ default: true,
34
+ description: "Whether to show the overlay behind the drawer",
35
+ },
36
+ showSwipeButton: {
37
+ type: "boolean",
38
+ default: false,
39
+ description:
40
+ "Whether to show the swipe indicator button at the top of the drawer",
41
+ },
42
+ variant: {
43
+ type: "string",
44
+ default: "neutral",
45
+ description: "The visual variant of the drawer (neutral or gradient)",
46
+ },
47
+ opacity: {
48
+ type: "string",
49
+ default: "medium",
50
+ description: "Overlay opacity level (high, medium, low, none)",
51
+ },
52
+ glass: {
53
+ type: "string",
54
+ default: "low",
55
+ description: "Overlay glass effect level (high, medium, low, none)",
56
+ },
57
+ noise: {
58
+ type: "string",
59
+ default: "low",
60
+ description: "Overlay noise texture level (high, medium, low, none)",
61
+ },
62
+ },
63
+ },
64
+ }
@@ -70,3 +70,4 @@ export * from "./vertical-menu-icon"
70
70
  export * from "./git-branch-icon"
71
71
  export * from "./git-fork-icon"
72
72
  export * from "./import-left-arrow-folder-icon"
73
+ export * from "./star-icon"