aural-ui 2.0.3 → 2.0.5

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.
@@ -13,6 +13,9 @@ const DialogPortal = DialogPrimitive.Portal
13
13
 
14
14
  const DialogClose = DialogPrimitive.Close
15
15
 
16
+ type BorderSide = "top" | "bottom" | "left" | "right"
17
+ type BorderConfig = BorderSide[] | "all" | "none"
18
+
16
19
  interface IDialogOverlay {
17
20
  opacity?: "high" | "medium" | "low" | "none"
18
21
  glass?: "high" | "medium" | "low" | "none"
@@ -39,26 +42,135 @@ const DialogOverlay = React.forwardRef<
39
42
 
40
43
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
41
44
 
42
- export const dialogBorderVariants = cva(
43
- "absolute w-full left-0 right-0 top-0 h-0.5 block",
44
- {
45
- variants: {
46
- variant: {
47
- neutral: "bg-(image:--gradient-fm-stroke-neutral)",
48
- negative: "bg-(image:--gradient-fm-stroke-negative)",
49
- warning: "bg-(image:--gradient-fm-stroke-warning)",
50
- positive: "bg-(image:--gradient-fm-stroke-positive)",
51
- info: "bg-(image:--gradient-fm-stroke-info)",
52
- },
45
+ export const dialogBorderVariants = cva("absolute block", {
46
+ variants: {
47
+ variant: {
48
+ neutral: "",
49
+ negative: "",
50
+ warning: "",
51
+ positive: "",
52
+ info: "",
53
53
  },
54
- defaultVariants: {
54
+ side: {
55
+ top: "w-full left-0 right-0 top-0 h-0.5",
56
+ bottom: "w-full left-0 right-0 bottom-0 h-0.5",
57
+ left: "h-full top-0 bottom-0 left-0 w-0.5",
58
+ right: "h-full top-0 bottom-0 right-0 w-0.5",
59
+ },
60
+ },
61
+ compoundVariants: [
62
+ // Horizontal borders (top/bottom) - use regular gradients
63
+ {
55
64
  variant: "neutral",
65
+ side: "top",
66
+ class: "bg-(image:--gradient-fm-stroke-neutral)",
56
67
  },
57
- }
58
- )
68
+ {
69
+ variant: "neutral",
70
+ side: "bottom",
71
+ class: "bg-(image:--gradient-fm-stroke-neutral)",
72
+ },
73
+ {
74
+ variant: "negative",
75
+ side: "top",
76
+ class: "bg-(image:--gradient-fm-stroke-negative)",
77
+ },
78
+ {
79
+ variant: "negative",
80
+ side: "bottom",
81
+ class: "bg-(image:--gradient-fm-stroke-negative)",
82
+ },
83
+ {
84
+ variant: "warning",
85
+ side: "top",
86
+ class: "bg-(image:--gradient-fm-stroke-warning)",
87
+ },
88
+ {
89
+ variant: "warning",
90
+ side: "bottom",
91
+ class: "bg-(image:--gradient-fm-stroke-warning)",
92
+ },
93
+ {
94
+ variant: "positive",
95
+ side: "top",
96
+ class: "bg-(image:--gradient-fm-stroke-positive)",
97
+ },
98
+ {
99
+ variant: "positive",
100
+ side: "bottom",
101
+ class: "bg-(image:--gradient-fm-stroke-positive)",
102
+ },
103
+ {
104
+ variant: "info",
105
+ side: "top",
106
+ class: "bg-(image:--gradient-fm-stroke-info)",
107
+ },
108
+ {
109
+ variant: "info",
110
+ side: "bottom",
111
+ class: "bg-(image:--gradient-fm-stroke-info)",
112
+ },
113
+
114
+ // Vertical borders (left/right) - use vertical gradients
115
+ {
116
+ variant: "neutral",
117
+ side: "left",
118
+ class: "bg-(image:--gradient-fm-stroke-neutral-vertical)",
119
+ },
120
+ {
121
+ variant: "neutral",
122
+ side: "right",
123
+ class: "bg-(image:--gradient-fm-stroke-neutral-vertical)",
124
+ },
125
+ {
126
+ variant: "negative",
127
+ side: "left",
128
+ class: "bg-(image:--gradient-fm-stroke-negative-vertical)",
129
+ },
130
+ {
131
+ variant: "negative",
132
+ side: "right",
133
+ class: "bg-(image:--gradient-fm-stroke-negative-vertical)",
134
+ },
135
+ {
136
+ variant: "warning",
137
+ side: "left",
138
+ class: "bg-(image:--gradient-fm-stroke-warning-vertical)",
139
+ },
140
+ {
141
+ variant: "warning",
142
+ side: "right",
143
+ class: "bg-(image:--gradient-fm-stroke-warning-vertical)",
144
+ },
145
+ {
146
+ variant: "positive",
147
+ side: "left",
148
+ class: "bg-(image:--gradient-fm-stroke-positive-vertical)",
149
+ },
150
+ {
151
+ variant: "positive",
152
+ side: "right",
153
+ class: "bg-(image:--gradient-fm-stroke-positive-vertical)",
154
+ },
155
+ {
156
+ variant: "info",
157
+ side: "left",
158
+ class: "bg-(image:--gradient-fm-stroke-info-vertical)",
159
+ },
160
+ {
161
+ variant: "info",
162
+ side: "right",
163
+ class: "bg-(image:--gradient-fm-stroke-info-vertical)",
164
+ },
165
+ ],
166
+ defaultVariants: {
167
+ variant: "neutral",
168
+ side: "top",
169
+ },
170
+ })
59
171
 
60
172
  export const dialogVariants = cva(
61
- "flex flex-col gap-5 rounded-fm-s bg-fm-surface-frosted/20 border-solid border-fm-divider-secondary p-4 backdrop-blur-sm w-full max-w-lg",
173
+ "flex flex-col gap-5 rounded-fm-s bg-fm-surface-frosted/20 border-solid border-fm-divider-secondary p-4 backdrop-blur-sm w-full max-w-lg relative",
62
174
  {
63
175
  variants: {
64
176
  variant: {
@@ -83,6 +195,7 @@ interface DialogContentProps
83
195
  extends React.HTMLAttributes<HTMLDivElement>,
84
196
  VariantProps<typeof dialogVariants> {
85
197
  showCloseButton?: boolean
198
+ borderConfig?: BorderConfig
86
199
  }
87
200
 
88
201
  const DialogContent = React.forwardRef<
@@ -99,51 +212,77 @@ const DialogContent = React.forwardRef<
99
212
  children,
100
213
  classes,
101
214
  showCloseButton = true,
215
+ borderConfig = "top",
102
216
  ...props
103
217
  },
104
218
  ref
105
- ) => (
106
- <DialogPortal>
107
- <DialogOverlay
108
- opacity={opacity}
109
- glass={glass}
110
- noise={noise}
111
- className={classes?.overlay}
112
- />
113
- <DialogPrimitive.Content
114
- ref={ref}
115
- className={cn(
116
- "data-[state=open]:animate-fm-zoomIn data-[state=closed]:animate-fm-zoomOut fixed top-1/2 left-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col items-center justify-center gap-4 duration-200",
117
- classes?.content
118
- )}
119
- >
120
- {showCloseButton && (
121
- <DialogPrimitive.Close
219
+ ) => {
220
+ const borderSides = React.useMemo<BorderSide[]>(() => {
221
+ if (borderConfig === "none") return []
222
+ if (borderConfig === "all") return ["top", "bottom", "left", "right"]
223
+ if (Array.isArray(borderConfig)) return borderConfig
224
+ // Only include borderConfig if it's a valid BorderSide
225
+ const validSides: BorderSide[] = ["top", "bottom", "left", "right"]
226
+ return validSides.includes(borderConfig as BorderSide)
227
+ ? [borderConfig as BorderSide]
228
+ : []
229
+ }, [borderConfig])
230
+
231
+ return (
232
+ <DialogPortal>
233
+ <DialogOverlay
234
+ opacity={opacity}
235
+ glass={glass}
236
+ noise={noise}
237
+ className={classes?.overlay}
238
+ />
239
+ <DialogPrimitive.Content
240
+ ref={ref}
241
+ className={cn(
242
+ "data-[state=open]:animate-fm-zoomIn data-[state=closed]:animate-fm-zoomOut fixed top-1/2 left-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col items-center justify-center gap-4 duration-200",
243
+ classes?.content
244
+ )}
245
+ >
246
+ {showCloseButton && (
247
+ <DialogPrimitive.Close
248
+ className={cn(
249
+ "bg-fm-button-fill-secondary text-fm-icon-active hover:bg-fm-button-fill-secondary/80 flex cursor-pointer items-center justify-center gap-2 rounded-full p-3 backdrop-blur-sm",
250
+ classes?.close
251
+ )}
252
+ >
253
+ <CrossIcon className={cn("h-4 w-4", classes?.closeIcon)} />
254
+ <span className="sr-only">Close</span>
255
+ </DialogPrimitive.Close>
256
+ )}
257
+
258
+ <div
122
259
  className={cn(
123
- "bg-fm-button-fill-secondary text-fm-icon-active hover:bg-fm-button-fill-secondary/80 flex cursor-pointer items-center justify-center gap-2 rounded-full p-3 backdrop-blur-sm",
124
- classes?.close
260
+ dialogVariants({ variant }),
261
+ className,
262
+ classes?.root
125
263
  )}
264
+ {...props}
126
265
  >
127
- <CrossIcon className={cn("h-4 w-4", classes?.closeIcon)} />
128
- <span className="sr-only">Close</span>
129
- </DialogPrimitive.Close>
130
- )}
131
-
132
- <div
133
- className={cn(dialogVariants({ variant }), className, classes?.root)}
134
- {...props}
135
- >
136
- <div
137
- className={cn(dialogBorderVariants({ variant }), classes?.border)}
138
- />
139
- {children}
140
- </div>
141
- </DialogPrimitive.Content>
142
- </DialogPortal>
143
- )
266
+ {borderSides.map((side) => (
267
+ <div
268
+ key={side}
269
+ className={cn(
270
+ dialogBorderVariants({ variant, side }),
271
+ classes?.border
272
+ )}
273
+ />
274
+ ))}
275
+ {children}
276
+ </div>
277
+ </DialogPrimitive.Content>
278
+ </DialogPortal>
279
+ )
280
+ }
144
281
  )
145
282
  DialogContent.displayName = DialogPrimitive.Content.displayName
146
283
 
284
+ // ...existing code...
285
+
147
286
  const DialogHeader = ({
148
287
  className,
149
288
  ...props