@brightlocal/ui-components 2.15.0 → 2.17.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.
Files changed (44) hide show
  1. package/component-meta.json +10 -9
  2. package/deprecations.json +189 -0
  3. package/dist/badge.d.ts +1 -1
  4. package/dist/button.d.ts +1 -1
  5. package/dist/card.cjs +1 -1
  6. package/dist/card.d.ts +20 -4
  7. package/dist/card.d.ts.map +1 -1
  8. package/dist/card.js +95 -72
  9. package/dist/chart.cjs +4 -4
  10. package/dist/chart.d.ts +26 -0
  11. package/dist/chart.d.ts.map +1 -1
  12. package/dist/chart.js +75 -59
  13. package/dist/combobox.cjs +3 -3
  14. package/dist/combobox.js +33 -33
  15. package/dist/field.cjs +1 -1
  16. package/dist/field.d.ts.map +1 -1
  17. package/dist/field.js +10 -2
  18. package/dist/global-layout.cjs +1 -1
  19. package/dist/global-layout.d.ts +17 -2
  20. package/dist/global-layout.d.ts.map +1 -1
  21. package/dist/global-layout.js +53 -26
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.js +366 -360
  24. package/dist/map.cjs +1 -1
  25. package/dist/map.d.ts +147 -4
  26. package/dist/map.d.ts.map +1 -1
  27. package/dist/map.js +375 -219
  28. package/dist/rating.cjs +1 -1
  29. package/dist/rating.d.ts +10 -0
  30. package/dist/rating.d.ts.map +1 -1
  31. package/dist/rating.js +38 -33
  32. package/dist/sheet.cjs +1 -1
  33. package/dist/sheet.d.ts +13 -2
  34. package/dist/sheet.d.ts.map +1 -1
  35. package/dist/sheet.js +38 -30
  36. package/package.json +18 -6
  37. package/src/components/card.tsx +62 -8
  38. package/src/components/chart.tsx +39 -1
  39. package/src/components/combobox.tsx +1 -1
  40. package/src/components/field.tsx +9 -1
  41. package/src/components/global-layout.tsx +60 -7
  42. package/src/components/map.tsx +414 -28
  43. package/src/components/rating.tsx +20 -1
  44. package/src/components/sheet.tsx +30 -5
@@ -3,6 +3,16 @@ import { StarRating } from "@brightlocal/icons";
3
3
 
4
4
  import { cn } from "@brightlocal/ui-components/lib/utils";
5
5
 
6
+ /**
7
+ * Available size variants for the Rating component.
8
+ */
9
+ type RatingSize = "sm" | "md";
10
+
11
+ const starSizeMap: Record<RatingSize, number> = {
12
+ sm: 16,
13
+ md: 24,
14
+ };
15
+
6
16
  /**
7
17
  * Rating component displays a star-based rating indicator.
8
18
  * Supports full and half-star values for precise rating display.
@@ -16,6 +26,11 @@ export interface RatingProps extends React.HTMLAttributes<HTMLDivElement> {
16
26
  * Data hook for testing
17
27
  */
18
28
  dataHook: string;
29
+ /**
30
+ * Size of the star icons.
31
+ * @default "sm"
32
+ */
33
+ size?: RatingSize;
19
34
  /**
20
35
  * Accessible label for the rating.
21
36
  * Supports `{value}` placeholder for interpolation.
@@ -37,6 +52,7 @@ const Rating = React.forwardRef<HTMLDivElement, RatingProps>(
37
52
  {
38
53
  value,
39
54
  dataHook,
55
+ size = "sm",
40
56
  ariaLabel,
41
57
  trackingEl,
42
58
  trackingLabel,
@@ -47,6 +63,7 @@ const Rating = React.forwardRef<HTMLDivElement, RatingProps>(
47
63
  ) => {
48
64
  // Clamp value between 0 and 5
49
65
  const clampedValue = Math.max(0, Math.min(5, value));
66
+ const starSize = starSizeMap[size];
50
67
 
51
68
  return (
52
69
  <div
@@ -80,6 +97,7 @@ const Rating = React.forwardRef<HTMLDivElement, RatingProps>(
80
97
  <StarRating
81
98
  className="fill-muted stroke-muted"
82
99
  data-slot="rating-star-base"
100
+ size={starSize}
83
101
  />
84
102
 
85
103
  {/* Filled overlay */}
@@ -92,7 +110,7 @@ const Rating = React.forwardRef<HTMLDivElement, RatingProps>(
92
110
  width: `${fillPercentage}%`,
93
111
  }}
94
112
  >
95
- <StarRating />
113
+ <StarRating size={starSize} />
96
114
  </div>
97
115
  )}
98
116
  </div>
@@ -106,3 +124,4 @@ const Rating = React.forwardRef<HTMLDivElement, RatingProps>(
106
124
  Rating.displayName = "Rating";
107
125
 
108
126
  export { Rating };
127
+ export type { RatingSize };
@@ -274,20 +274,45 @@ const SheetFooter = React.forwardRef<
274
274
  ));
275
275
  SheetFooter.displayName = "SheetFooter";
276
276
 
277
+ /**
278
+ * Props for the SheetTitle component
279
+ */
280
+ interface SheetTitleProps extends React.ComponentProps<
281
+ typeof SheetPrimitive.Title
282
+ > {
283
+ /**
284
+ * Optional icon rendered before the title text.
285
+ * Pass any React node (typically a DS icon component).
286
+ * @example <SheetTitle icon={<Heart />}>Title</SheetTitle>
287
+ */
288
+ icon?: React.ReactNode;
289
+ }
290
+
277
291
  /**
278
292
  * Sheet title component for the main heading.
279
293
  * Should be used within SheetHeader.
280
294
  */
281
295
  const SheetTitle = React.forwardRef<
282
296
  React.ComponentRef<typeof SheetPrimitive.Title>,
283
- React.ComponentProps<typeof SheetPrimitive.Title>
284
- >(({ className, ...props }, ref) => (
297
+ SheetTitleProps
298
+ >(({ className, icon, children, ...props }, ref) => (
285
299
  <SheetPrimitive.Title
286
300
  ref={ref}
287
- className={cn("text-foreground text-lg font-semibold", className)}
301
+ className={cn(
302
+ "text-foreground text-lg font-semibold",
303
+ icon && "flex items-center gap-2",
304
+ className
305
+ )}
288
306
  data-slot="sheet-title"
289
307
  {...props}
290
- />
308
+ >
309
+ {icon && (
310
+ <span className="shrink-0 [&_svg]:size-5" data-slot="sheet-title-icon">
311
+ {icon}
312
+ </span>
313
+ )}
314
+ {children}
315
+ </SheetPrimitive.Title>
291
316
  ));
292
317
  SheetTitle.displayName = "SheetTitle";
293
318
 
@@ -321,4 +346,4 @@ export {
321
346
  SheetTrigger,
322
347
  };
323
348
 
324
- export type { SheetContentProps, SheetTriggerProps };
349
+ export type { SheetContentProps, SheetTitleProps, SheetTriggerProps };