@brightlocal/ui-components 2.14.0 → 2.16.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.
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import * as React from "react";
2
4
  import { cva } from "class-variance-authority";
3
5
 
@@ -26,7 +28,14 @@ function subPadding(flush: boolean, density: CardDensity): string | false {
26
28
  }
27
29
 
28
30
  const cardVariants = cva(
29
- ["flex", "flex-col", "rounded-xl", "transition-colors", "w-full"],
31
+ [
32
+ "flex",
33
+ "flex-col",
34
+ "rounded-xl",
35
+ "transition-colors",
36
+ "w-full",
37
+ "max-w-[400px]",
38
+ ],
30
39
  {
31
40
  variants: {
32
41
  variant: {
@@ -84,8 +93,10 @@ type CardProps = React.ComponentProps<"div"> & {
84
93
  */
85
94
  trackingLabel?: string;
86
95
  /**
87
- * Maximum width of the card (e.g., "420px", "600px", "100%")
88
- * @default "400px"
96
+ * Maximum width of the card (e.g., "420px", "600px", "100%").
97
+ * Cards are full-width by default — use className="max-w-[400px]" instead.
98
+ * @default undefined
99
+ * @deprecated Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").
89
100
  */
90
101
  maxWidth?: string | number;
91
102
  };
@@ -103,7 +114,7 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>(
103
114
  dataHook,
104
115
  trackingEl,
105
116
  trackingLabel,
106
- maxWidth = "400px",
117
+ maxWidth,
107
118
  children,
108
119
  style,
109
120
  ...props
@@ -112,6 +123,14 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>(
112
123
  ) => {
113
124
  const flush = variant === "transparent-flush";
114
125
 
126
+ React.useEffect(() => {
127
+ if (process.env.NODE_ENV !== "production" && maxWidth !== undefined) {
128
+ console.warn(
129
+ 'Card: the "maxWidth" prop is deprecated. Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").'
130
+ );
131
+ }
132
+ }, [maxWidth]);
133
+
115
134
  const maxWidthStyle =
116
135
  maxWidth !== undefined
117
136
  ? {
@@ -177,14 +196,42 @@ const CardHeader = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
177
196
  );
178
197
  CardHeader.displayName = "CardHeader";
179
198
 
199
+ /**
200
+ * Size variant for the CardTitle.
201
+ */
202
+ type CardTitleSize = "small" | "default";
203
+
204
+ const cardTitleVariants = cva("font-display font-medium", {
205
+ variants: {
206
+ size: {
207
+ small: "text-base",
208
+ default: "text-2xl",
209
+ },
210
+ },
211
+ defaultVariants: {
212
+ size: "default",
213
+ },
214
+ });
215
+
216
+ /**
217
+ * Props for the CardTitle component.
218
+ */
219
+ type CardTitleProps = CardSubComponentProps & {
220
+ /**
221
+ * Title text size.
222
+ * @default "default"
223
+ */
224
+ size?: CardTitleSize;
225
+ };
226
+
180
227
  /**
181
228
  * Title element within the Card header.
182
229
  */
183
- const CardTitle = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
184
- ({ className, ...props }, ref) => (
230
+ const CardTitle = React.forwardRef<HTMLDivElement, CardTitleProps>(
231
+ ({ className, size = "default", ...props }, ref) => (
185
232
  <div
186
233
  ref={ref}
187
- className={cn("font-display text-2xl font-medium", className)}
234
+ className={cn(cardTitleVariants({ size }), className)}
188
235
  data-slot="card-title"
189
236
  {...props}
190
237
  />
@@ -301,4 +348,11 @@ export {
301
348
  CardContent,
302
349
  };
303
350
 
304
- export type { CardProps, CardSubComponentProps, CardVariant, CardDensity };
351
+ export type {
352
+ CardProps,
353
+ CardSubComponentProps,
354
+ CardTitleProps,
355
+ CardTitleSize,
356
+ CardVariant,
357
+ CardDensity,
358
+ };
@@ -572,7 +572,7 @@ function ComboboxValue<T>({
572
572
  return (
573
573
  <span
574
574
  className={cn(
575
- "text-foreground overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",
575
+ "overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",
576
576
  className
577
577
  )}
578
578
  data-slot="combobox-value"
@@ -92,7 +92,7 @@ const fieldVariants = cva(
92
92
  variant: {
93
93
  default: [],
94
94
  box: [
95
- "relative cursor-pointer",
95
+ "relative cursor-pointer gap-3",
96
96
  "rounded-lg border border-border bg-background p-3",
97
97
  "transition-colors",
98
98
  "[&_[data-slot=field-label]]:after:absolute [&_[data-slot=field-label]]:after:inset-0 [&_[data-slot=field-label]]:after:cursor-pointer",
@@ -101,9 +101,15 @@ const fieldVariants = cva(
101
101
  // Checked-state for radio/checkbox (not switch)
102
102
  "has-[[data-state=checked]:not([role=switch])]:border-primary has-[[data-state=checked]:not([role=switch])]:bg-primary/10",
103
103
  "dark:has-[[data-state=checked]:not([role=switch])]:bg-alpha-10",
104
+ // Disabled-state from child control
105
+ "has-[[data-disabled]]:cursor-not-allowed",
106
+ "[&:has([data-disabled])_[data-slot=field-label]]:after:cursor-not-allowed",
104
107
  // Error-state when inside an invalid container (e.g. RadioGroup with error)
105
108
  "[[aria-invalid=true]_&]:border-destructive-40",
106
109
  "[[aria-invalid=true]_&]:has-[:focus-visible]:border-destructive-40 [[aria-invalid=true]_&]:has-[:focus-visible]:shadow-destructive",
110
+ // Error-state from child control (standalone checkbox/radio)
111
+ "has-[[aria-invalid=true]]:border-destructive-40",
112
+ "has-[[aria-invalid=true]:focus-visible]:border-destructive-40 has-[[aria-invalid=true]:focus-visible]:shadow-destructive",
107
113
  ],
108
114
  },
109
115
  },
@@ -42,7 +42,10 @@ const GlobalLayout = React.forwardRef<HTMLDivElement, GlobalLayoutProps>(
42
42
 
43
43
  return (
44
44
  <ScrollArea
45
- className={cn("h-dvh w-full", className)}
45
+ className={cn(
46
+ "h-dvh w-full [&>[data-radix-scroll-area-viewport]>div]:block! [&>[data-radix-scroll-area-viewport]>div]:min-w-0!",
47
+ className
48
+ )}
46
49
  dataHook={`${dataHook}-scroll`}
47
50
  scrollOrientation="both"
48
51
  >
@@ -232,7 +232,10 @@ const ItemTitle = React.forwardRef<HTMLDivElement, ItemTitleProps>(
232
232
  ({ className, ...props }, ref) => (
233
233
  <div
234
234
  ref={ref}
235
- className={cn("text-foreground text-lg font-medium", className)}
235
+ className={cn(
236
+ "text-foreground text-base leading-normal font-medium",
237
+ className
238
+ )}
236
239
  data-slot="item-title"
237
240
  {...props}
238
241
  />
@@ -254,7 +257,10 @@ const ItemDescription = React.forwardRef<HTMLDivElement, ItemDescriptionProps>(
254
257
  ({ className, ...props }, ref) => (
255
258
  <div
256
259
  ref={ref}
257
- className={cn("text-muted-foreground text-base", className)}
260
+ className={cn(
261
+ "text-muted-foreground text-sm leading-normal font-normal",
262
+ className
263
+ )}
258
264
  data-slot="item-description"
259
265
  {...props}
260
266
  />