@brightlocal/ui-components 2.27.0 → 3.1.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 (289) hide show
  1. package/README.md +7 -1
  2. package/component-meta.json +568 -143
  3. package/deprecations.json +298 -1
  4. package/dist/accordion.cjs +1 -1
  5. package/dist/accordion.d.ts +36 -0
  6. package/dist/accordion.d.ts.map +1 -1
  7. package/dist/accordion.js +74 -61
  8. package/dist/alert-dialog.cjs +1 -1
  9. package/dist/alert-dialog.js +18 -18
  10. package/dist/alert.cjs +1 -1
  11. package/dist/alert.d.ts +11 -1
  12. package/dist/alert.d.ts.map +1 -1
  13. package/dist/alert.js +31 -28
  14. package/dist/avatar.cjs +1 -1
  15. package/dist/avatar.js +4 -4
  16. package/dist/badge.cjs +1 -1
  17. package/dist/badge.d.ts.map +1 -1
  18. package/dist/badge.js +15 -11
  19. package/dist/blocks/empty-state.cjs +1 -0
  20. package/dist/blocks/empty-state.d.ts +172 -0
  21. package/dist/blocks/empty-state.d.ts.map +1 -0
  22. package/dist/blocks/empty-state.js +147 -0
  23. package/dist/blocks/input-list.cjs +2 -2
  24. package/dist/blocks/input-list.d.ts.map +1 -1
  25. package/dist/blocks/input-list.js +124 -108
  26. package/dist/blocks/progress-state.cjs +1 -0
  27. package/dist/blocks/{progress-screen.d.ts → progress-state.d.ts} +30 -18
  28. package/dist/blocks/progress-state.d.ts.map +1 -0
  29. package/dist/blocks/{progress-screen.js → progress-state.js} +100 -71
  30. package/dist/blocks/sidebar.cjs +1 -1
  31. package/dist/blocks/sidebar.d.ts.map +1 -1
  32. package/dist/blocks/sidebar.js +160 -161
  33. package/dist/breadcrumb.cjs +1 -1
  34. package/dist/breadcrumb.js +1 -1
  35. package/dist/button-group.cjs +1 -0
  36. package/dist/button-group.d.ts +36 -0
  37. package/dist/button-group.d.ts.map +1 -0
  38. package/dist/button-group.js +47 -0
  39. package/dist/button.cjs +1 -1
  40. package/dist/button.js +12 -12
  41. package/dist/calendar.cjs +1 -1
  42. package/dist/calendar.d.ts.map +1 -1
  43. package/dist/calendar.js +37 -38
  44. package/dist/callout.cjs +1 -1
  45. package/dist/callout.d.ts +24 -2
  46. package/dist/callout.d.ts.map +1 -1
  47. package/dist/callout.js +57 -55
  48. package/dist/card.cjs +1 -1
  49. package/dist/card.d.ts +42 -3
  50. package/dist/card.d.ts.map +1 -1
  51. package/dist/card.js +102 -91
  52. package/dist/chart-empty.cjs +1 -0
  53. package/dist/chart-empty.d.ts +59 -0
  54. package/dist/chart-empty.d.ts.map +1 -0
  55. package/dist/chart-empty.js +29 -0
  56. package/dist/chart.cjs +6 -6
  57. package/dist/chart.d.ts +46 -13
  58. package/dist/chart.d.ts.map +1 -1
  59. package/dist/chart.js +172 -157
  60. package/dist/chip.cjs +1 -1
  61. package/dist/chip.d.ts +38 -4
  62. package/dist/chip.d.ts.map +1 -1
  63. package/dist/chip.js +100 -84
  64. package/dist/combobox.cjs +2 -2
  65. package/dist/combobox.d.ts.map +1 -1
  66. package/dist/combobox.js +81 -79
  67. package/dist/command.cjs +1 -1
  68. package/dist/command.d.ts +23 -1
  69. package/dist/command.d.ts.map +1 -1
  70. package/dist/command.js +248 -225
  71. package/dist/context-menu.cjs +1 -1
  72. package/dist/context-menu.d.ts.map +1 -1
  73. package/dist/context-menu.js +26 -29
  74. package/dist/data-table.cjs +1 -1
  75. package/dist/data-table.d.ts +75 -10
  76. package/dist/data-table.d.ts.map +1 -1
  77. package/dist/data-table.js +346 -334
  78. package/dist/date-picker.cjs +1 -1
  79. package/dist/date-picker.d.ts +13 -5
  80. package/dist/date-picker.d.ts.map +1 -1
  81. package/dist/date-picker.js +54 -53
  82. package/dist/description.cjs +1 -1
  83. package/dist/description.js +5 -5
  84. package/dist/dialog.cjs +1 -1
  85. package/dist/dialog.js +20 -20
  86. package/dist/drawer.cjs +1 -1
  87. package/dist/drawer.d.ts.map +1 -1
  88. package/dist/drawer.js +8 -11
  89. package/dist/dropdown-menu.cjs +1 -1
  90. package/dist/dropdown-menu.d.ts.map +1 -1
  91. package/dist/dropdown-menu.js +17 -20
  92. package/dist/field.cjs +1 -1
  93. package/dist/field.d.ts +8 -1
  94. package/dist/field.d.ts.map +1 -1
  95. package/dist/field.js +96 -65
  96. package/dist/global-layout.cjs +1 -1
  97. package/dist/global-layout.d.ts +130 -12
  98. package/dist/global-layout.d.ts.map +1 -1
  99. package/dist/global-layout.js +146 -127
  100. package/dist/grid.cjs +1 -0
  101. package/dist/grid.d.ts +56 -0
  102. package/dist/grid.d.ts.map +1 -0
  103. package/dist/grid.js +32 -0
  104. package/dist/header.d.ts +13 -0
  105. package/dist/header.d.ts.map +1 -1
  106. package/dist/hooks/use-delayed-pending.cjs +1 -0
  107. package/dist/hooks/use-delayed-pending.d.ts +34 -0
  108. package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
  109. package/dist/hooks/use-delayed-pending.js +17 -0
  110. package/dist/hooks/use-mobile.cjs +1 -0
  111. package/dist/hooks/use-mobile.js +8 -0
  112. package/dist/hover-card.cjs +1 -1
  113. package/dist/hover-card.js +13 -13
  114. package/dist/index.cjs +1 -1
  115. package/dist/index.d.ts +9 -1
  116. package/dist/index.d.ts.map +1 -1
  117. package/dist/index.js +554 -527
  118. package/dist/input-chip.cjs +1 -1
  119. package/dist/input-chip.js +25 -25
  120. package/dist/input-group.cjs +1 -1
  121. package/dist/input-group.js +9 -9
  122. package/dist/input-otp.cjs +1 -1
  123. package/dist/input-otp.js +9 -9
  124. package/dist/input-password.cjs +1 -1
  125. package/dist/input-password.d.ts +17 -9
  126. package/dist/input-password.d.ts.map +1 -1
  127. package/dist/input-password.js +73 -72
  128. package/dist/input.cjs +1 -1
  129. package/dist/input.js +9 -9
  130. package/dist/label.cjs +1 -1
  131. package/dist/label.d.ts.map +1 -1
  132. package/dist/label.js +25 -28
  133. package/dist/lib/block-illustration.cjs +1 -0
  134. package/dist/lib/block-illustration.d.ts +28 -0
  135. package/dist/lib/block-illustration.d.ts.map +1 -0
  136. package/dist/lib/block-illustration.js +21 -0
  137. package/dist/lib/empty-canvas.cjs +1 -0
  138. package/dist/lib/empty-canvas.d.ts +27 -0
  139. package/dist/lib/empty-canvas.d.ts.map +1 -0
  140. package/dist/lib/empty-canvas.js +62 -0
  141. package/dist/lib/empty-chip.cjs +1 -0
  142. package/dist/lib/empty-chip.d.ts +4 -0
  143. package/dist/lib/empty-chip.d.ts.map +1 -0
  144. package/dist/lib/empty-chip.js +13 -0
  145. package/dist/lib/optical-center.cjs +1 -0
  146. package/dist/lib/optical-center.d.ts +12 -0
  147. package/dist/lib/optical-center.d.ts.map +1 -0
  148. package/dist/lib/optical-center.js +11 -0
  149. package/dist/lib/utils.cjs +1 -1
  150. package/dist/lib/utils.d.ts.map +1 -1
  151. package/dist/lib/utils.js +28 -5
  152. package/dist/list.cjs +1 -1
  153. package/dist/list.d.ts.map +1 -1
  154. package/dist/list.js +62 -58
  155. package/dist/map.cjs +1 -1
  156. package/dist/map.d.ts +60 -2
  157. package/dist/map.d.ts.map +1 -1
  158. package/dist/map.js +187 -164
  159. package/dist/media-empty.cjs +1 -0
  160. package/dist/media-empty.d.ts +72 -0
  161. package/dist/media-empty.d.ts.map +1 -0
  162. package/dist/media-empty.js +45 -0
  163. package/dist/menubar.cjs +1 -1
  164. package/dist/menubar.d.ts.map +1 -1
  165. package/dist/menubar.js +17 -20
  166. package/dist/navigation-menu.cjs +1 -1
  167. package/dist/navigation-menu.js +7 -7
  168. package/dist/pagination.cjs +1 -1
  169. package/dist/pagination.d.ts +130 -1
  170. package/dist/pagination.d.ts.map +1 -1
  171. package/dist/pagination.js +193 -102
  172. package/dist/progress.cjs +1 -1
  173. package/dist/progress.d.ts +2 -26
  174. package/dist/progress.d.ts.map +1 -1
  175. package/dist/progress.js +79 -118
  176. package/dist/scroll-area.cjs +1 -1
  177. package/dist/scroll-area.d.ts +15 -6
  178. package/dist/scroll-area.d.ts.map +1 -1
  179. package/dist/scroll-area.js +38 -36
  180. package/dist/select.cjs +2 -2
  181. package/dist/select.d.ts +13 -2
  182. package/dist/select.d.ts.map +1 -1
  183. package/dist/select.js +92 -87
  184. package/dist/separator.cjs +1 -1
  185. package/dist/separator.js +8 -8
  186. package/dist/sheet.cjs +1 -1
  187. package/dist/sheet.js +2 -2
  188. package/dist/skeleton.cjs +1 -1
  189. package/dist/skeleton.d.ts +38 -3
  190. package/dist/skeleton.d.ts.map +1 -1
  191. package/dist/skeleton.js +43 -20
  192. package/dist/sonner.cjs +1 -1
  193. package/dist/sonner.js +26 -26
  194. package/dist/stepper.cjs +1 -1
  195. package/dist/stepper.js +40 -40
  196. package/dist/table.cjs +1 -1
  197. package/dist/table.d.ts.map +1 -1
  198. package/dist/table.js +31 -28
  199. package/dist/tabs.cjs +1 -1
  200. package/dist/tabs.js +1 -1
  201. package/dist/text-reveal-motion.d.ts +10 -0
  202. package/dist/text-reveal-motion.d.ts.map +1 -1
  203. package/dist/textarea.cjs +1 -1
  204. package/dist/textarea.js +11 -11
  205. package/dist/toggle.cjs +1 -1
  206. package/dist/toggle.js +8 -8
  207. package/dist/tooltip.cjs +1 -1
  208. package/dist/tooltip.js +8 -8
  209. package/dist/typography-heading.cjs +1 -0
  210. package/dist/typography-heading.d.ts +129 -0
  211. package/dist/typography-heading.d.ts.map +1 -0
  212. package/dist/typography-heading.js +95 -0
  213. package/dist/typography-text.cjs +1 -0
  214. package/dist/typography-text.d.ts +127 -0
  215. package/dist/typography-text.d.ts.map +1 -0
  216. package/dist/typography-text.js +92 -0
  217. package/dist/typography.d.ts +13 -0
  218. package/dist/typography.d.ts.map +1 -1
  219. package/package.json +35 -7
  220. package/src/blocks/empty-state.tsx +412 -0
  221. package/src/blocks/input-list.tsx +66 -36
  222. package/src/blocks/{progress-screen.tsx → progress-state.tsx} +154 -93
  223. package/src/blocks/sidebar.tsx +25 -26
  224. package/src/components/accordion.tsx +82 -27
  225. package/src/components/alert-dialog.tsx +2 -2
  226. package/src/components/alert.tsx +27 -13
  227. package/src/components/avatar.tsx +1 -1
  228. package/src/components/badge.tsx +8 -4
  229. package/src/components/breadcrumb.tsx +1 -1
  230. package/src/components/button-group.tsx +112 -0
  231. package/src/components/button.tsx +4 -4
  232. package/src/components/calendar.tsx +5 -6
  233. package/src/components/callout.tsx +48 -15
  234. package/src/components/card.tsx +89 -19
  235. package/src/components/chart-empty.tsx +116 -0
  236. package/src/components/chart.tsx +103 -32
  237. package/src/components/chip.tsx +88 -13
  238. package/src/components/combobox.tsx +12 -10
  239. package/src/components/command.tsx +64 -13
  240. package/src/components/context-menu.tsx +6 -9
  241. package/src/components/data-table.tsx +135 -20
  242. package/src/components/date-picker.tsx +18 -7
  243. package/src/components/description.tsx +1 -1
  244. package/src/components/dialog.tsx +2 -2
  245. package/src/components/drawer.tsx +2 -5
  246. package/src/components/dropdown-menu.tsx +8 -11
  247. package/src/components/field.tsx +89 -16
  248. package/src/components/global-layout.tsx +210 -39
  249. package/src/components/grid.tsx +130 -0
  250. package/src/components/header.tsx +13 -0
  251. package/src/components/hover-card.tsx +1 -1
  252. package/src/components/input-chip.tsx +1 -1
  253. package/src/components/input-group.tsx +1 -1
  254. package/src/components/input-otp.tsx +1 -1
  255. package/src/components/input-password.tsx +24 -12
  256. package/src/components/input.tsx +1 -1
  257. package/src/components/label.tsx +10 -13
  258. package/src/components/list.tsx +13 -9
  259. package/src/components/map.tsx +101 -5
  260. package/src/components/media-empty.tsx +156 -0
  261. package/src/components/menubar.tsx +7 -10
  262. package/src/components/navigation-menu.tsx +1 -1
  263. package/src/components/pagination.tsx +286 -1
  264. package/src/components/progress.tsx +35 -113
  265. package/src/components/scroll-area.tsx +23 -10
  266. package/src/components/select.tsx +35 -10
  267. package/src/components/separator.tsx +1 -1
  268. package/src/components/sheet.tsx +2 -2
  269. package/src/components/skeleton.tsx +78 -7
  270. package/src/components/sonner.tsx +2 -2
  271. package/src/components/stepper.tsx +3 -3
  272. package/src/components/table.tsx +6 -3
  273. package/src/components/tabs.tsx +1 -1
  274. package/src/components/text-reveal-motion.tsx +10 -0
  275. package/src/components/textarea.tsx +1 -1
  276. package/src/components/toggle.tsx +1 -1
  277. package/src/components/tooltip.tsx +1 -1
  278. package/src/components/typography-heading.tsx +253 -0
  279. package/src/components/typography-text.tsx +250 -0
  280. package/src/components/typography.tsx +13 -0
  281. package/src/hooks/use-delayed-pending.ts +60 -0
  282. package/src/index.ts +11 -1
  283. package/src/lib/block-illustration.tsx +88 -0
  284. package/src/lib/empty-canvas.tsx +128 -0
  285. package/src/lib/empty-chip.ts +24 -0
  286. package/src/lib/optical-center.tsx +45 -0
  287. package/src/lib/utils.ts +26 -0
  288. package/dist/blocks/progress-screen.cjs +0 -1
  289. package/dist/blocks/progress-screen.d.ts.map +0 -1
@@ -156,7 +156,7 @@ const AlertDialogTitle = React.forwardRef<
156
156
  >(({ className, dataHook, ...props }, ref) => (
157
157
  <AlertDialogPrimitive.Title
158
158
  ref={ref}
159
- className={cn("text-lg font-semibold", className)}
159
+ className={cn("text-heading-section", className)}
160
160
  data-hook={dataHook}
161
161
  data-slot="alert-dialog-title"
162
162
  {...props}
@@ -184,7 +184,7 @@ const AlertDialogDescription = React.forwardRef<
184
184
  >(({ className, dataHook, ...props }, ref) => (
185
185
  <AlertDialogPrimitive.Description
186
186
  ref={ref}
187
- className={cn("text-muted-foreground text-sm", className)}
187
+ className={cn("text-body-sm text-muted-foreground", className)}
188
188
  data-hook={dataHook}
189
189
  data-slot="alert-dialog-description"
190
190
  {...props}
@@ -1,11 +1,12 @@
1
1
  import * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
2
3
  import { cva, type VariantProps } from "class-variance-authority";
3
4
  import { CircleCheck, Info, CircleX, TriangleAlert } from "@brightlocal/icons";
4
5
 
5
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
6
7
 
7
8
  const alertVariants = cva(
8
- "relative w-full rounded-lg px-4 py-3 text-sm flex gap-3 items-start",
9
+ "relative w-full rounded-lg px-4 py-3 flex gap-3 items-start",
9
10
  {
10
11
  variants: {
11
12
  variant: {
@@ -37,17 +38,29 @@ const Alert = React.forwardRef<
37
38
  ));
38
39
  Alert.displayName = "Alert";
39
40
 
40
- const AlertTitle = React.forwardRef<
41
- HTMLDivElement,
42
- React.HTMLAttributes<HTMLDivElement>
43
- >(({ className, ...props }, ref) => (
44
- <div
45
- ref={ref}
46
- className={cn("leading-5 font-medium break-words", className)}
47
- data-slot="alert-title"
48
- {...props}
49
- />
50
- ));
41
+ interface AlertTitleProps extends React.HTMLAttributes<HTMLDivElement> {
42
+ /**
43
+ * Render the title as its child element (e.g. an `h2`–`h6`) so consumers
44
+ * can opt the alert title into the document outline at the level their
45
+ * page calls for.
46
+ * @default false
47
+ */
48
+ asChild?: boolean;
49
+ }
50
+
51
+ const AlertTitle = React.forwardRef<HTMLDivElement, AlertTitleProps>(
52
+ ({ className, asChild = false, ...props }, ref) => {
53
+ const Comp = asChild ? Slot : "div";
54
+ return (
55
+ <Comp
56
+ ref={ref}
57
+ className={cn("text-heading-compact break-words", className)}
58
+ data-slot="alert-title"
59
+ {...props}
60
+ />
61
+ );
62
+ }
63
+ );
51
64
  AlertTitle.displayName = "AlertTitle";
52
65
 
53
66
  const AlertDescription = React.forwardRef<
@@ -56,7 +69,7 @@ const AlertDescription = React.forwardRef<
56
69
  >(({ className, ...props }, ref) => (
57
70
  <div
58
71
  ref={ref}
59
- className={cn("text-sm leading-5 font-normal [&_p]:leading-5", className)}
72
+ className={cn("text-body-sm [&_p]:leading-5", className)}
60
73
  data-slot="alert-description"
61
74
  {...props}
62
75
  />
@@ -247,3 +260,4 @@ export {
247
260
  AlertDestructive,
248
261
  AlertWarning,
249
262
  };
263
+ export type { AlertTitleProps };
@@ -91,7 +91,7 @@ const AvatarFallback = React.forwardRef<
91
91
  <AvatarPrimitive.Fallback
92
92
  ref={ref}
93
93
  className={cn(
94
- "bg-muted text-foreground flex size-full items-center justify-center rounded-full text-sm",
94
+ "text-body-sm bg-muted text-foreground flex size-full items-center justify-center rounded-full",
95
95
  className
96
96
  )}
97
97
  data-slot="avatar-fallback"
@@ -8,10 +8,14 @@ const badgeVariants = cva(
8
8
  [
9
9
  // Layout
10
10
  "inline-flex items-center justify-center gap-1 w-fit shrink-0 overflow-hidden",
11
- // Spacing & shape
12
- "rounded-full border px-2 py-1",
13
- // Typography
14
- "text-xs font-semibold whitespace-nowrap leading-none",
11
+ // Spacing & shape — 2px vertical padding around the 16px line box keeps the
12
+ // content box 20px, matching the Figma frame (its stroke sits inside); the
13
+ // 1px border makes the rendered box 22px, unchanged from the pre-scale
14
+ // `leading-none` + py-1 stack (DS-925)
15
+ "rounded-full border px-2 py-0.5",
16
+ // Typography — type-scale role for badges (12/16 Figma 500; the weight
17
+ // drop from the old semibold is intentional, DS-925)
18
+ "text-label-sm whitespace-nowrap",
15
19
  // Icons
16
20
  "[&>svg]:size-3 [&>svg]:pointer-events-none",
17
21
  // Transition
@@ -61,7 +61,7 @@ const BreadcrumbList = React.forwardRef<
61
61
  // trails. Overflow is handled by collapsing the middle behind an
62
62
  // ellipsis and truncating the location crumb, not by wrapping.
63
63
  className={cn(
64
- "text-muted-foreground flex min-w-0 flex-nowrap items-center gap-1.5 text-sm whitespace-nowrap sm:gap-2.5",
64
+ "text-body-sm text-muted-foreground flex min-w-0 flex-nowrap items-center gap-1.5 whitespace-nowrap sm:gap-2.5",
65
65
  className
66
66
  )}
67
67
  data-slot="breadcrumb-list"
@@ -0,0 +1,112 @@
1
+ import * as React from "react";
2
+ import { cva } from "class-variance-authority";
3
+
4
+ import { cn } from "@brightlocal/ui-components/lib/utils";
5
+
6
+ /* The group owns only the joining: it zeroes the radii on the shared edges,
7
+ collapses the doubled border between bordered neighbours, and raises the
8
+ focused/open child above its siblings so the focus shadow paints over the
9
+ joined edge. Children keep their own outer-edge shape — a Button end stays
10
+ a pill, a SelectTrigger end stays rounded-sm — because the child's variant,
11
+ not the group, owns its identity.
12
+
13
+ A joined SelectTrigger keeps BOTH its side borders and the neighbour
14
+ touching it gives up its own: Button borders are border (neutral-200) while
15
+ the trigger's are input (neutral-300), so letting each seam fall to "the
16
+ child on the left" would draw the trigger's two seams in different colours.
17
+
18
+ Base order: layout, the corner/border joins, the z-raise that lets a
19
+ focused/open child paint its shadow over the joined neighbour's edge, then
20
+ the SelectTrigger width fix: a joined trigger hugs its value instead of
21
+ stretching. The `.w-full` guard is the discriminator — SelectTrigger runs
22
+ className through twMerge, so its default `w-full` survives only when the
23
+ consumer set no width; an explicit width (e.g. `w-44`) replaces it and
24
+ this rule stops matching. */
25
+ const buttonGroupVariants = cva([
26
+ "flex w-fit items-stretch",
27
+ "[&>*:not(:first-child)]:rounded-l-none",
28
+ "[&>*:not(:last-child)]:rounded-r-none",
29
+ "[&>*:not(:first-child):not([data-slot=select-trigger])]:border-l-0",
30
+ "[&>*:has(+[data-slot=select-trigger])]:border-r-0",
31
+ "[&>*]:focus-visible:relative [&>*]:focus-visible:z-10",
32
+ "[&>*]:data-[state=open]:relative [&>*]:data-[state=open]:z-10",
33
+ "[&>[data-slot=select-trigger].w-full]:w-fit",
34
+ ]);
35
+
36
+ /**
37
+ * Props for the ButtonGroup component.
38
+ * Joins Buttons and a Select trigger into one attached row with merged
39
+ * borders. Children must be direct children of the group.
40
+ */
41
+ interface ButtonGroupProps extends React.ComponentPropsWithoutRef<"div"> {
42
+ /**
43
+ * Data hook for automated testing (REQUIRED)
44
+ * @example "run-navigator"
45
+ */
46
+ dataHook: string;
47
+ /**
48
+ * Tracking element identifier for analytics
49
+ */
50
+ trackingEl?: string;
51
+ /**
52
+ * Tracking label for analytics context
53
+ */
54
+ trackingLabel?: string;
55
+ }
56
+
57
+ const ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(
58
+ ({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => {
59
+ return (
60
+ <div
61
+ ref={ref}
62
+ className={cn(buttonGroupVariants(), className)}
63
+ data-hook={dataHook}
64
+ data-slot="button-group"
65
+ data-tracking-el={trackingEl || "button-group"}
66
+ data-tracking-label={trackingLabel}
67
+ role="group"
68
+ {...props}
69
+ />
70
+ );
71
+ }
72
+ );
73
+
74
+ ButtonGroup.displayName = "ButtonGroup";
75
+
76
+ /**
77
+ * Props for the ButtonGroupSeparator component.
78
+ */
79
+ interface ButtonGroupSeparatorProps extends React.ComponentPropsWithoutRef<"div"> {
80
+ /**
81
+ * Data hook for automated testing
82
+ */
83
+ dataHook?: string;
84
+ }
85
+
86
+ /* A black scrim darkens whatever fill it sits on, so one default works on a
87
+ primary green split, a destructive red one, and an outline group alike —
88
+ no per-variant separator colour and nothing to redefine in dark mode.
89
+ -ml-px pulls the line over the previous segment's edge (net width 0), so it
90
+ reads as a darker shade of the fill, not a gap showing the page behind. */
91
+ const ButtonGroupSeparator = React.forwardRef<
92
+ HTMLDivElement,
93
+ ButtonGroupSeparatorProps
94
+ >(({ className, dataHook, ...props }, ref) => {
95
+ return (
96
+ <div
97
+ ref={ref}
98
+ aria-orientation="vertical"
99
+ className={cn("-ml-px w-px shrink-0 self-stretch bg-black/15", className)}
100
+ data-hook={dataHook}
101
+ data-slot="button-group-separator"
102
+ role="separator"
103
+ {...props}
104
+ />
105
+ );
106
+ });
107
+
108
+ ButtonGroupSeparator.displayName = "ButtonGroupSeparator";
109
+
110
+ export { ButtonGroup, ButtonGroupSeparator, buttonGroupVariants };
111
+
112
+ export type { ButtonGroupProps, ButtonGroupSeparatorProps };
@@ -89,7 +89,7 @@ const ButtonVariants = cva(
89
89
  ],
90
90
  outline: [
91
91
  "border",
92
- "border-border",
92
+ "border-input",
93
93
  "border-solid",
94
94
  "bg-background",
95
95
  "hover:bg-accent",
@@ -110,9 +110,9 @@ const ButtonVariants = cva(
110
110
  ],
111
111
  },
112
112
  size: {
113
- default: "px-4 py-2 h-9 text-sm",
114
- sm: "py-2 px-3 h-8 text-xs",
115
- lg: "py-2 px-8 h-10 text-sm [&_svg:not([class*='size-'])]:size-5",
113
+ default: "px-4 py-2 h-9 text-label",
114
+ sm: "py-2 px-3 h-8 text-label-sm",
115
+ lg: "py-2 px-8 h-10 text-label [&_svg:not([class*='size-'])]:size-5",
116
116
  },
117
117
  state: {
118
118
  default: "",
@@ -63,7 +63,7 @@ const CalendarDayButton = ({
63
63
  <button
64
64
  ref={ref}
65
65
  className={cn(
66
- "text-foreground h-8 w-8 rounded-md p-0 font-sans text-sm leading-5 font-normal",
66
+ "text-foreground text-label h-8 w-8 rounded-md p-0",
67
67
  "hover:bg-accent hover:text-accent-foreground",
68
68
  "focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:outline-none",
69
69
  "group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10",
@@ -128,14 +128,13 @@ function Calendar({
128
128
  defaultClassNames.month_caption
129
129
  ),
130
130
  caption_label: cn(
131
- "text-sm font-sans leading-5 text-foreground select-none",
132
- captionLayout === "dropdown" ? "font-normal" : "font-medium",
131
+ "text-label text-foreground select-none",
133
132
  "[&>svg]:text-muted-foreground",
134
133
  "flex h-[34px] items-center gap-1 rounded-md pl-2 pr-1",
135
134
  defaultClassNames.caption_label
136
135
  ),
137
136
  dropdowns: cn(
138
- "flex w-full items-center justify-center gap-1.5 text-sm font-normal",
137
+ "flex w-full items-center justify-center gap-1.5 text-label",
139
138
  defaultClassNames.dropdowns
140
139
  ),
141
140
  dropdown_root: cn(
@@ -161,12 +160,12 @@ function Calendar({
161
160
  ),
162
161
  weekdays: cn("flex", defaultClassNames.weekdays),
163
162
  weekday: cn(
164
- "text-muted-foreground rounded-md w-8 h-5 flex items-center justify-center font-normal font-sans text-xs leading-4",
163
+ "text-muted-foreground rounded-md w-8 h-5 flex items-center justify-center text-body-xs",
165
164
  defaultClassNames.weekday
166
165
  ),
167
166
  week: cn(defaultClassNames.week, "flex w-full mt-2"),
168
167
  day: cn(
169
- "relative w-full h-full p-0 text-center text-sm focus-within:relative focus-within:z-20 group/day select-none",
168
+ "relative w-full h-full p-0 text-center text-label focus-within:relative focus-within:z-20 group/day select-none",
170
169
  "[&:first-child[data-selected=true]_button]:!rounded-l-md",
171
170
  "[&:last-child[data-selected=true]_button]:!rounded-r-md",
172
171
  defaultClassNames.day
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
2
3
  import { cva } from "class-variance-authority";
3
4
 
4
5
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -123,23 +124,58 @@ const Callout = React.forwardRef<HTMLElement, CalloutProps>(
123
124
 
124
125
  Callout.displayName = "Callout";
125
126
 
127
+ /**
128
+ * Document outline level for the CalloutHeading — renders the corresponding
129
+ * `h1`–`h6` tag. Level 1 is allowed: an onboarding welcome callout can
130
+ * legitimately be the page's own heading.
131
+ */
132
+ type CalloutHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
133
+
126
134
  /** Props for the CalloutHeading sub-component */
127
135
  interface CalloutHeadingProps extends React.ComponentPropsWithoutRef<"div"> {
128
136
  /** Optional test hook identifier */
129
137
  dataHook?: string;
138
+ /**
139
+ * Document outline level — renders the statement as the corresponding
140
+ * heading element (`h1`–`h6`) while the display typography stays ours.
141
+ * The DS never guesses a level: with no `level` the statement renders a
142
+ * `div` and stays out of the outline, which is right for a decorative
143
+ * pull-quote. Ignored when `asChild` is set.
144
+ * @example <CalloutHeading level={2}>Let's get you set up.</CalloutHeading>
145
+ */
146
+ level?: CalloutHeadingLevel;
147
+ /**
148
+ * Render the statement as its child element, for the rare case neither a
149
+ * `div` nor a heading fits (a `blockquote`, say). Takes precedence over
150
+ * `level`; the display typography is applied either way.
151
+ * @default false
152
+ */
153
+ asChild?: boolean;
130
154
  }
131
155
 
132
156
  /** Main heading/statement content for a Callout */
133
- const CalloutHeading = React.forwardRef<HTMLDivElement, CalloutHeadingProps>(
134
- ({ className, dataHook, ...props }, ref) => (
135
- <div
136
- ref={ref}
137
- className={cn("font-display text-4xl font-semibold", className)}
138
- data-hook={dataHook}
139
- data-slot="callout-heading"
140
- {...props}
141
- />
142
- )
157
+ // HTMLElement, not HTMLDivElement: `level` renders h1–h6 and `asChild` an
158
+ // arbitrary element, so heading refs must type-check too.
159
+ const CalloutHeading = React.forwardRef<HTMLElement, CalloutHeadingProps>(
160
+ ({ className, dataHook, level, asChild = false, ...props }, ref) => {
161
+ const sharedProps = {
162
+ className: cn("text-display", className),
163
+ "data-hook": dataHook,
164
+ "data-slot": "callout-heading",
165
+ ...props,
166
+ };
167
+
168
+ if (asChild) {
169
+ return <Slot ref={ref} {...sharedProps} />;
170
+ }
171
+ if (level) {
172
+ const Heading = `h${level}` as const;
173
+ return (
174
+ <Heading ref={ref as React.Ref<HTMLHeadingElement>} {...sharedProps} />
175
+ );
176
+ }
177
+ return <div ref={ref as React.Ref<HTMLDivElement>} {...sharedProps} />;
178
+ }
143
179
  );
144
180
 
145
181
  CalloutHeading.displayName = "CalloutHeading";
@@ -158,11 +194,7 @@ const CalloutCitation = React.forwardRef<HTMLDivElement, CalloutCitationProps>(
158
194
  return (
159
195
  <div
160
196
  ref={ref}
161
- className={cn(
162
- "text-xs font-medium",
163
- citationColorMap[variant],
164
- className
165
- )}
197
+ className={cn("text-label-sm", citationColorMap[variant], className)}
166
198
  data-hook={dataHook}
167
199
  data-slot="callout-citation"
168
200
  {...props}
@@ -177,6 +209,7 @@ export { Callout, CalloutHeading, CalloutCitation, calloutVariants };
177
209
  export type {
178
210
  CalloutProps,
179
211
  CalloutHeadingProps,
212
+ CalloutHeadingLevel,
180
213
  CalloutCitationProps,
181
214
  CalloutVariant,
182
215
  CalloutPointer,
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import * as React from "react";
4
+ import { Slot } from "@radix-ui/react-slot";
4
5
  import { cva } from "class-variance-authority";
5
6
 
6
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -240,11 +241,17 @@ CardHeader.displayName = "CardHeader";
240
241
  */
241
242
  type CardTitleSize = "small" | "default";
242
243
 
243
- const cardTitleVariants = cva("font-display font-medium", {
244
+ /**
245
+ * Document outline level for the CardTitle — renders the corresponding
246
+ * h2–h6 tag. There is no level 1: a card title is never the page title.
247
+ */
248
+ type CardTitleLevel = 2 | 3 | 4 | 5 | 6;
249
+
250
+ const cardTitleVariants = cva("", {
244
251
  variants: {
245
252
  size: {
246
- small: "text-base",
247
- default: "text-2xl",
253
+ small: "text-heading-subsection",
254
+ default: "text-heading-section",
248
255
  },
249
256
  },
250
257
  defaultVariants: {
@@ -261,35 +268,95 @@ type CardTitleProps = CardSubComponentProps & {
261
268
  * @default "default"
262
269
  */
263
270
  size?: CardTitleSize;
271
+ /**
272
+ * Document outline level — renders the title as the corresponding
273
+ * heading element (`h2`–`h6`). The DS never guesses a level: when
274
+ * omitted, the title renders as a `div` and stays out of the outline.
275
+ * Ignored when `asChild` is set.
276
+ * @example <CardTitle level={2}>Card Title</CardTitle>
277
+ */
278
+ level?: CardTitleLevel;
279
+ /**
280
+ * Render as a different element using Radix Slot pattern.
281
+ * When true, merges props onto the child element so consumers can opt the
282
+ * title into the document outline (e.g. `<CardTitle asChild><h2>…</h2></CardTitle>`).
283
+ * Takes precedence over `level`.
284
+ * @default false
285
+ */
286
+ asChild?: boolean;
264
287
  };
265
288
 
266
289
  /**
267
290
  * Title element within the Card header.
268
291
  */
269
- const CardTitle = React.forwardRef<HTMLDivElement, CardTitleProps>(
270
- ({ className, size = "default", dataHook, ...props }, ref) => (
271
- <div
272
- ref={ref}
273
- className={cn(cardTitleVariants({ size }), className)}
274
- data-hook={dataHook}
275
- data-slot="card-title"
276
- {...props}
277
- />
278
- )
292
+ // HTMLElement, not HTMLDivElement: `level` renders h2–h6 and `asChild` an
293
+ // arbitrary element, so heading refs must type-check too.
294
+ const CardTitle = React.forwardRef<HTMLElement, CardTitleProps>(
295
+ (
296
+ { className, size = "default", level, asChild = false, dataHook, ...props },
297
+ ref
298
+ ) => {
299
+ const sharedProps = {
300
+ className: cn(cardTitleVariants({ size }), className),
301
+ "data-hook": dataHook,
302
+ "data-slot": "card-title",
303
+ ...props,
304
+ };
305
+ if (asChild) {
306
+ return <Slot ref={ref} {...sharedProps} />;
307
+ }
308
+ if (level) {
309
+ const Heading = `h${level}` as const;
310
+ return (
311
+ <Heading ref={ref as React.Ref<HTMLHeadingElement>} {...sharedProps} />
312
+ );
313
+ }
314
+ return <div ref={ref as React.Ref<HTMLDivElement>} {...sharedProps} />;
315
+ }
279
316
  );
280
317
  CardTitle.displayName = "CardTitle";
281
318
 
319
+ /**
320
+ * Text alignment for the CardDescription.
321
+ */
322
+ type CardDescriptionAlign = "left" | "center" | "right";
323
+
324
+ // No defaultVariants on purpose: when `align` is omitted the description
325
+ // keeps inheriting alignment from its parent (e.g. `CardHeader align`),
326
+ // so existing cards render exactly as before.
327
+ const cardDescriptionVariants = cva("text-body-sm text-muted-foreground", {
328
+ variants: {
329
+ align: {
330
+ left: "text-left",
331
+ center: "text-center",
332
+ right: "text-right",
333
+ },
334
+ },
335
+ });
336
+
337
+ /**
338
+ * Props for the CardDescription component.
339
+ */
340
+ type CardDescriptionProps = CardSubComponentProps & {
341
+ /**
342
+ * Text alignment of the description itself. When omitted, the description
343
+ * inherits alignment from its parent — e.g. `CardHeader align`, or the
344
+ * centring a browser applies inside a `button`. Set it to pin the
345
+ * description's alignment regardless of context (matches `CardHeader`
346
+ * and Typography alignment values).
347
+ * @example <CardDescription align="left">…</CardDescription>
348
+ */
349
+ align?: CardDescriptionAlign;
350
+ };
351
+
282
352
  /**
283
353
  * Description text within the Card header.
284
354
  */
285
- const CardDescription = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
286
- ({ className, dataHook, ...props }, ref) => (
355
+ const CardDescription = React.forwardRef<HTMLDivElement, CardDescriptionProps>(
356
+ ({ className, align, dataHook, ...props }, ref) => (
287
357
  <div
288
358
  ref={ref}
289
- className={cn(
290
- "text-muted-foreground text-sm leading-normal font-normal",
291
- className
292
- )}
359
+ className={cn(cardDescriptionVariants({ align }), className)}
293
360
  data-hook={dataHook}
294
361
  data-slot="card-description"
295
362
  {...props}
@@ -398,8 +465,11 @@ export type {
398
465
  CardSubComponentProps,
399
466
  CardHeaderProps,
400
467
  CardHeaderAlign,
468
+ CardDescriptionProps,
469
+ CardDescriptionAlign,
401
470
  CardTitleProps,
402
471
  CardTitleSize,
472
+ CardTitleLevel,
403
473
  CardVariant,
404
474
  CardDensity,
405
475
  };
@@ -0,0 +1,116 @@
1
+ import * as React from "react";
2
+ import { ChartColumn } from "@brightlocal/icons";
3
+
4
+ import { cn } from "@brightlocal/ui-components/lib/utils";
5
+ import { EmptyCanvas } from "../lib/empty-canvas";
6
+
7
+ /* -------------------------------------------------------------------------------------------------
8
+ * ChartEmpty
9
+ *
10
+ * The empty-canvas treatment for a chart's plot area (Patterns/Empty States →
11
+ * Charts, maps & images). Deliberately not the standard empty block: a canvas
12
+ * keeps quiet. The plot area becomes a muted surface at the chart's own
13
+ * reserved height, carrying one bare icon and one line — no title, no CTA, and
14
+ * no circle behind the icon, because a circle on a flat surface reads as a
15
+ * button.
16
+ *
17
+ * It lives in its own file rather than inside `chart.tsx` so that rendering an
18
+ * empty chart does not pull Recharts into the bundle — the one case where there
19
+ * is no chart to draw is the one case that should cost nothing. `/chart`
20
+ * re-exports it, so either import path works.
21
+ *
22
+ * A primitive, not a block: it composes nothing but its own surface, a glyph
23
+ * and a line. That body is shared with its two siblings through an internal
24
+ * helper — deliberately not through `EmptyState`, which is a block, and which
25
+ * a primitive must not depend on.
26
+ *
27
+ * THE SURROUNDINGS MUST AGREE. This component can only speak for the plot
28
+ * area; everything in the card has to tell the same story. A KPI beside an
29
+ * empty chart shows an em-dash (`text-metric`) and drops its trend badge — a
30
+ * number or a flat-0 trend next to "No data yet" is a contradiction the reader
31
+ * has to resolve, and they will resolve it as "this screen is broken".
32
+ * -----------------------------------------------------------------------------------------------*/
33
+
34
+ /**
35
+ * Props for the ChartEmpty component.
36
+ */
37
+ export interface ChartEmptyProps extends Omit<
38
+ React.ComponentPropsWithoutRef<"div">,
39
+ "children" | "title"
40
+ > {
41
+ /**
42
+ * Required data-hook attribute for automated testing. The parts derive
43
+ * theirs from it: `-icon`, `-message`.
44
+ * @example "visibility-score-chart-empty"
45
+ */
46
+ dataHook: string;
47
+ /**
48
+ * The glyph on the surface. Pass one that names the missing chart where a
49
+ * generic bar chart would be vague. The component sizes it.
50
+ * @default <ChartColumn strokeWidth={2} />
51
+ */
52
+ icon?: React.ReactNode;
53
+ /**
54
+ * The one line on the canvas. Domain copy in the reader's terms — "No
55
+ * ranking data yet" beats "No data yet" — with no trailing period.
56
+ * @default "No data yet"
57
+ */
58
+ message?: string;
59
+ /**
60
+ * The height the chart had reserved. The consumer owns the box: this
61
+ * component only fills it, so the layout never shifts when data arrives.
62
+ * @example "h-36"
63
+ */
64
+ className?: string;
65
+ /**
66
+ * Tracking element identifier for analytics.
67
+ */
68
+ trackingEl?: string;
69
+ /**
70
+ * Tracking label for analytics context.
71
+ */
72
+ trackingLabel?: string;
73
+ }
74
+
75
+ /**
76
+ * A chart's plot area with nothing to plot — a muted surface at the chart's
77
+ * reserved height, a bare icon, and one quiet line.
78
+ *
79
+ * @example
80
+ * ```tsx
81
+ * // The card's headline agrees: an em-dash, and no trend badge.
82
+ * <CardContent className="flex flex-col gap-2">
83
+ * <TypographySmall dataHook="metric-label">Visibility score</TypographySmall>
84
+ * <p className="text-metric">{hasData ? score : "—"}</p>
85
+ * {hasData ? (
86
+ * <MetricBarChart data={byPlatform} />
87
+ * ) : (
88
+ * <ChartEmpty className="h-36" dataHook="metric-chart-empty" />
89
+ * )}
90
+ * </CardContent>
91
+ * ```
92
+ */
93
+ const ChartEmpty = React.forwardRef<HTMLDivElement, ChartEmptyProps>(
94
+ (
95
+ { className, dataHook, icon, message, trackingEl, trackingLabel, ...props },
96
+ ref
97
+ ) => (
98
+ /* `w-full` and no height: the height is the consumer's, because only the
99
+ chart knows what it had reserved. */
100
+ <EmptyCanvas
101
+ ref={ref}
102
+ className={cn("w-full rounded-lg", className)}
103
+ dataHook={dataHook}
104
+ icon={icon ?? <ChartColumn strokeWidth={2} />}
105
+ message={message ?? "No data yet"}
106
+ slot="chart-empty"
107
+ trackingEl={trackingEl}
108
+ trackingLabel={trackingLabel}
109
+ {...props}
110
+ />
111
+ )
112
+ );
113
+
114
+ ChartEmpty.displayName = "ChartEmpty";
115
+
116
+ export { ChartEmpty };