@brightlocal/ui-components 2.26.0 → 3.0.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 (284) hide show
  1. package/README.md +9 -2
  2. package/component-meta.json +4010 -255
  3. package/deprecations.json +189 -2
  4. package/dist/accordion.cjs +1 -1
  5. package/dist/accordion.js +2 -2
  6. package/dist/alert-dialog.cjs +1 -1
  7. package/dist/alert-dialog.js +18 -18
  8. package/dist/alert.cjs +1 -1
  9. package/dist/alert.d.ts +11 -1
  10. package/dist/alert.d.ts.map +1 -1
  11. package/dist/alert.js +31 -28
  12. package/dist/avatar.cjs +1 -1
  13. package/dist/avatar.js +4 -4
  14. package/dist/badge.cjs +1 -1
  15. package/dist/badge.d.ts.map +1 -1
  16. package/dist/badge.js +15 -11
  17. package/dist/blocks/empty-state.cjs +1 -0
  18. package/dist/blocks/empty-state.d.ts +172 -0
  19. package/dist/blocks/empty-state.d.ts.map +1 -0
  20. package/dist/blocks/empty-state.js +155 -0
  21. package/dist/blocks/input-list.cjs +2 -2
  22. package/dist/blocks/input-list.d.ts.map +1 -1
  23. package/dist/blocks/input-list.js +124 -108
  24. package/dist/blocks/progress-state.cjs +1 -0
  25. package/dist/blocks/progress-state.d.ts +121 -0
  26. package/dist/blocks/progress-state.d.ts.map +1 -0
  27. package/dist/blocks/progress-state.js +368 -0
  28. package/dist/blocks/sidebar.cjs +1 -1
  29. package/dist/blocks/sidebar.d.ts.map +1 -1
  30. package/dist/blocks/sidebar.js +297 -296
  31. package/dist/brand-illustration-motif.d.ts +1 -1
  32. package/dist/breadcrumb.cjs +1 -1
  33. package/dist/breadcrumb.d.ts.map +1 -1
  34. package/dist/breadcrumb.js +44 -40
  35. package/dist/button.cjs +1 -1
  36. package/dist/button.d.ts.map +1 -1
  37. package/dist/button.js +23 -23
  38. package/dist/calendar.cjs +1 -1
  39. package/dist/calendar.d.ts.map +1 -1
  40. package/dist/calendar.js +37 -38
  41. package/dist/callout.cjs +1 -1
  42. package/dist/callout.d.ts +24 -2
  43. package/dist/callout.d.ts.map +1 -1
  44. package/dist/callout.js +57 -55
  45. package/dist/card.cjs +1 -1
  46. package/dist/card.d.ts +23 -2
  47. package/dist/card.d.ts.map +1 -1
  48. package/dist/card.js +94 -91
  49. package/dist/chart-empty.cjs +1 -0
  50. package/dist/chart-empty.d.ts +59 -0
  51. package/dist/chart-empty.d.ts.map +1 -0
  52. package/dist/chart-empty.js +29 -0
  53. package/dist/chart.cjs +6 -6
  54. package/dist/chart.d.ts +6 -1
  55. package/dist/chart.d.ts.map +1 -1
  56. package/dist/chart.js +183 -183
  57. package/dist/chip.cjs +1 -1
  58. package/dist/chip.d.ts +1 -1
  59. package/dist/chip.d.ts.map +1 -1
  60. package/dist/chip.js +47 -44
  61. package/dist/combobox.cjs +3 -3
  62. package/dist/combobox.d.ts +4 -2
  63. package/dist/combobox.d.ts.map +1 -1
  64. package/dist/combobox.js +143 -141
  65. package/dist/command.cjs +1 -1
  66. package/dist/command.d.ts.map +1 -1
  67. package/dist/command.js +74 -77
  68. package/dist/context-menu.cjs +1 -1
  69. package/dist/context-menu.d.ts.map +1 -1
  70. package/dist/context-menu.js +26 -29
  71. package/dist/data-table.cjs +1 -1
  72. package/dist/data-table.d.ts +182 -13
  73. package/dist/data-table.d.ts.map +1 -1
  74. package/dist/data-table.js +462 -314
  75. package/dist/description.cjs +1 -1
  76. package/dist/description.js +5 -5
  77. package/dist/dialog.cjs +1 -1
  78. package/dist/dialog.js +20 -20
  79. package/dist/drawer.cjs +1 -1
  80. package/dist/drawer.d.ts.map +1 -1
  81. package/dist/drawer.js +8 -11
  82. package/dist/dropdown-menu.cjs +1 -1
  83. package/dist/dropdown-menu.d.ts.map +1 -1
  84. package/dist/dropdown-menu.js +17 -20
  85. package/dist/field.cjs +1 -1
  86. package/dist/field.d.ts.map +1 -1
  87. package/dist/field.js +29 -25
  88. package/dist/global-layout.cjs +1 -1
  89. package/dist/global-layout.d.ts +58 -6
  90. package/dist/global-layout.d.ts.map +1 -1
  91. package/dist/global-layout.js +278 -194
  92. package/dist/grid.cjs +1 -0
  93. package/dist/grid.d.ts +56 -0
  94. package/dist/grid.d.ts.map +1 -0
  95. package/dist/grid.js +32 -0
  96. package/dist/header.d.ts +13 -0
  97. package/dist/header.d.ts.map +1 -1
  98. package/dist/hooks/use-delayed-pending.cjs +1 -0
  99. package/dist/hooks/use-delayed-pending.d.ts +34 -0
  100. package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
  101. package/dist/hooks/use-delayed-pending.js +17 -0
  102. package/dist/hover-card.cjs +1 -1
  103. package/dist/hover-card.js +13 -13
  104. package/dist/index.cjs +1 -1
  105. package/dist/index.d.ts +10 -0
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +523 -494
  108. package/dist/input-chip.cjs +1 -1
  109. package/dist/input-chip.js +25 -25
  110. package/dist/input-group.cjs +1 -1
  111. package/dist/input-group.js +9 -9
  112. package/dist/input-otp.cjs +1 -1
  113. package/dist/input-otp.js +9 -9
  114. package/dist/input-password.cjs +1 -1
  115. package/dist/input-password.js +51 -51
  116. package/dist/input.cjs +1 -1
  117. package/dist/input.js +9 -9
  118. package/dist/label.cjs +1 -1
  119. package/dist/label.d.ts.map +1 -1
  120. package/dist/label.js +25 -28
  121. package/dist/lib/block-illustration.cjs +1 -0
  122. package/dist/lib/block-illustration.d.ts +28 -0
  123. package/dist/lib/block-illustration.d.ts.map +1 -0
  124. package/dist/lib/block-illustration.js +21 -0
  125. package/dist/lib/empty-canvas.cjs +1 -0
  126. package/dist/lib/empty-canvas.d.ts +27 -0
  127. package/dist/lib/empty-canvas.d.ts.map +1 -0
  128. package/dist/lib/empty-canvas.js +62 -0
  129. package/dist/lib/motion.cjs +1 -1
  130. package/dist/lib/motion.js +10 -8
  131. package/dist/lib/optical-center.cjs +1 -0
  132. package/dist/lib/optical-center.d.ts +12 -0
  133. package/dist/lib/optical-center.d.ts.map +1 -0
  134. package/dist/lib/optical-center.js +11 -0
  135. package/dist/lib/utils.cjs +1 -1
  136. package/dist/lib/utils.d.ts.map +1 -1
  137. package/dist/lib/utils.js +28 -5
  138. package/dist/link.cjs +1 -1
  139. package/dist/link.d.ts +8 -6
  140. package/dist/link.d.ts.map +1 -1
  141. package/dist/link.js +52 -20
  142. package/dist/list.cjs +1 -1
  143. package/dist/list.d.ts.map +1 -1
  144. package/dist/list.js +87 -81
  145. package/dist/map.cjs +1 -1
  146. package/dist/map.d.ts +60 -2
  147. package/dist/map.d.ts.map +1 -1
  148. package/dist/map.js +187 -164
  149. package/dist/media-empty.cjs +1 -0
  150. package/dist/media-empty.d.ts +72 -0
  151. package/dist/media-empty.d.ts.map +1 -0
  152. package/dist/media-empty.js +45 -0
  153. package/dist/menubar.cjs +1 -1
  154. package/dist/menubar.d.ts.map +1 -1
  155. package/dist/menubar.js +17 -20
  156. package/dist/navigation-menu.cjs +1 -1
  157. package/dist/navigation-menu.js +7 -7
  158. package/dist/pagination.cjs +1 -1
  159. package/dist/pagination.d.ts +127 -1
  160. package/dist/pagination.d.ts.map +1 -1
  161. package/dist/pagination.js +189 -98
  162. package/dist/progress.cjs +1 -1
  163. package/dist/progress.d.ts +37 -3
  164. package/dist/progress.d.ts.map +1 -1
  165. package/dist/progress.js +102 -64
  166. package/dist/route-progress.cjs +1 -0
  167. package/dist/route-progress.d.ts +103 -0
  168. package/dist/route-progress.d.ts.map +1 -0
  169. package/dist/route-progress.js +106 -0
  170. package/dist/select.cjs +2 -2
  171. package/dist/select.d.ts.map +1 -1
  172. package/dist/select.js +19 -18
  173. package/dist/separator.cjs +1 -1
  174. package/dist/separator.js +8 -8
  175. package/dist/sheet.cjs +1 -1
  176. package/dist/sheet.d.ts +35 -2
  177. package/dist/sheet.d.ts.map +1 -1
  178. package/dist/sheet.js +103 -66
  179. package/dist/skeleton.cjs +1 -1
  180. package/dist/skeleton.d.ts +38 -3
  181. package/dist/skeleton.d.ts.map +1 -1
  182. package/dist/skeleton.js +43 -20
  183. package/dist/sonner.cjs +1 -1
  184. package/dist/sonner.d.ts.map +1 -1
  185. package/dist/sonner.js +32 -36
  186. package/dist/spinner.cjs +1 -0
  187. package/dist/spinner.d.ts +57 -0
  188. package/dist/spinner.d.ts.map +1 -0
  189. package/dist/spinner.js +35 -0
  190. package/dist/stepper.cjs +1 -1
  191. package/dist/stepper.d.ts.map +1 -1
  192. package/dist/stepper.js +23 -22
  193. package/dist/table.cjs +1 -1
  194. package/dist/table.d.ts +1 -1
  195. package/dist/table.d.ts.map +1 -1
  196. package/dist/table.js +36 -29
  197. package/dist/tabs.cjs +1 -1
  198. package/dist/tabs.js +1 -1
  199. package/dist/text-reveal-motion.d.ts +10 -0
  200. package/dist/text-reveal-motion.d.ts.map +1 -1
  201. package/dist/textarea.cjs +1 -1
  202. package/dist/textarea.js +11 -11
  203. package/dist/toggle.cjs +1 -1
  204. package/dist/toggle.js +8 -8
  205. package/dist/tooltip.cjs +1 -1
  206. package/dist/tooltip.js +8 -8
  207. package/dist/typography-heading.cjs +1 -0
  208. package/dist/typography-heading.d.ts +116 -0
  209. package/dist/typography-heading.d.ts.map +1 -0
  210. package/dist/typography-heading.js +84 -0
  211. package/dist/typography-text.cjs +1 -0
  212. package/dist/typography-text.d.ts +113 -0
  213. package/dist/typography-text.d.ts.map +1 -0
  214. package/dist/typography-text.js +81 -0
  215. package/dist/typography.d.ts +13 -0
  216. package/dist/typography.d.ts.map +1 -1
  217. package/package.json +42 -2
  218. package/src/blocks/empty-state.tsx +424 -0
  219. package/src/blocks/input-list.tsx +66 -36
  220. package/src/blocks/progress-state.tsx +542 -0
  221. package/src/blocks/sidebar.tsx +46 -40
  222. package/src/components/accordion.tsx +2 -2
  223. package/src/components/alert-dialog.tsx +2 -2
  224. package/src/components/alert.tsx +27 -13
  225. package/src/components/avatar.tsx +1 -1
  226. package/src/components/badge.tsx +8 -4
  227. package/src/components/breadcrumb.tsx +9 -4
  228. package/src/components/button.tsx +5 -8
  229. package/src/components/calendar.tsx +5 -6
  230. package/src/components/callout.tsx +48 -15
  231. package/src/components/card.tsx +52 -17
  232. package/src/components/chart-empty.tsx +116 -0
  233. package/src/components/chart.tsx +43 -17
  234. package/src/components/chip.tsx +9 -6
  235. package/src/components/combobox.tsx +21 -12
  236. package/src/components/command.tsx +9 -10
  237. package/src/components/context-menu.tsx +6 -9
  238. package/src/components/data-table.tsx +405 -31
  239. package/src/components/description.tsx +1 -1
  240. package/src/components/dialog.tsx +2 -2
  241. package/src/components/drawer.tsx +2 -5
  242. package/src/components/dropdown-menu.tsx +8 -11
  243. package/src/components/field.tsx +8 -4
  244. package/src/components/global-layout.tsx +264 -65
  245. package/src/components/grid.tsx +130 -0
  246. package/src/components/header.tsx +13 -0
  247. package/src/components/hover-card.tsx +1 -1
  248. package/src/components/input-chip.tsx +1 -1
  249. package/src/components/input-group.tsx +1 -1
  250. package/src/components/input-otp.tsx +1 -1
  251. package/src/components/input-password.tsx +1 -1
  252. package/src/components/input.tsx +1 -1
  253. package/src/components/label.tsx +10 -13
  254. package/src/components/link.tsx +39 -5
  255. package/src/components/list.tsx +18 -14
  256. package/src/components/map.tsx +101 -5
  257. package/src/components/media-empty.tsx +156 -0
  258. package/src/components/menubar.tsx +7 -10
  259. package/src/components/navigation-menu.tsx +1 -1
  260. package/src/components/pagination.tsx +279 -1
  261. package/src/components/progress.tsx +120 -11
  262. package/src/components/route-progress.tsx +354 -0
  263. package/src/components/select.tsx +5 -4
  264. package/src/components/separator.tsx +1 -1
  265. package/src/components/sheet.tsx +89 -7
  266. package/src/components/skeleton.tsx +78 -7
  267. package/src/components/sonner.tsx +5 -14
  268. package/src/components/spinner.tsx +94 -0
  269. package/src/components/stepper.tsx +6 -7
  270. package/src/components/table.tsx +11 -4
  271. package/src/components/tabs.tsx +1 -1
  272. package/src/components/text-reveal-motion.tsx +10 -0
  273. package/src/components/textarea.tsx +1 -1
  274. package/src/components/toggle.tsx +1 -1
  275. package/src/components/tooltip.tsx +1 -1
  276. package/src/components/typography-heading.tsx +229 -0
  277. package/src/components/typography-text.tsx +225 -0
  278. package/src/components/typography.tsx +13 -0
  279. package/src/hooks/use-delayed-pending.ts +60 -0
  280. package/src/index.ts +12 -0
  281. package/src/lib/block-illustration.tsx +88 -0
  282. package/src/lib/empty-canvas.tsx +128 -0
  283. package/src/lib/optical-center.tsx +45 -0
  284. package/src/lib/utils.ts +26 -0
@@ -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,21 +268,51 @@ 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
 
@@ -286,10 +323,7 @@ const CardDescription = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
286
323
  ({ className, dataHook, ...props }, ref) => (
287
324
  <div
288
325
  ref={ref}
289
- className={cn(
290
- "text-muted-foreground text-sm leading-normal font-normal",
291
- className
292
- )}
326
+ className={cn("text-body-sm text-muted-foreground", className)}
293
327
  data-hook={dataHook}
294
328
  data-slot="card-description"
295
329
  {...props}
@@ -400,6 +434,7 @@ export type {
400
434
  CardHeaderAlign,
401
435
  CardTitleProps,
402
436
  CardTitleSize,
437
+ CardTitleLevel,
403
438
  CardVariant,
404
439
  CardDensity,
405
440
  };
@@ -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 };
@@ -124,7 +124,7 @@ const ChartContainer = React.forwardRef<HTMLDivElement, ChartContainerProps>(
124
124
  <div
125
125
  ref={ref}
126
126
  className={cn(
127
- "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-polar-radius-axis-tick-value]:fill-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",
127
+ "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-polar-radius-axis-tick-value]:fill-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background text-body-xs flex aspect-video justify-center [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",
128
128
  className
129
129
  )}
130
130
  data-chart={chartId}
@@ -200,6 +200,19 @@ function ChartStyle({ id, config }: { id: string; config: ChartConfig }) {
200
200
  // Chart Tooltip
201
201
  // ============================================================================
202
202
 
203
+ /**
204
+ * Whether a tooltip row has a value worth printing. Zero is a real value and
205
+ * must render; NaN/Infinity (a dataKey over a non-numeric field, a ratio with
206
+ * a zero denominator) and blank strings have nothing to show, so the value
207
+ * slot stays empty rather than reading "NaN".
208
+ */
209
+ function isRenderableValue(value: unknown): boolean {
210
+ if (value == null || value === "") {
211
+ return false;
212
+ }
213
+ return typeof value === "number" ? Number.isFinite(value) : true;
214
+ }
215
+
203
216
  /**
204
217
  * Props for the ChartTooltip component.
205
218
  */
@@ -330,7 +343,7 @@ function ChartTooltipContent({
330
343
  return (
331
344
  <div
332
345
  className={cn(
333
- "border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
346
+ "border-border/50 bg-background text-body-xs grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 shadow-xl",
334
347
  className
335
348
  )}
336
349
  data-slot="chart-tooltip-content"
@@ -351,7 +364,7 @@ function ChartTooltipContent({
351
364
  indicator === "dot" && "items-center"
352
365
  )}
353
366
  >
354
- {formatter && item?.value !== undefined && item.name ? (
367
+ {formatter && isRenderableValue(item?.value) && item.name ? (
355
368
  formatter(item.value, item.name, item, index, payload)
356
369
  ) : (
357
370
  <>
@@ -391,8 +404,8 @@ function ChartTooltipContent({
391
404
  {itemConfig?.label || item.name}
392
405
  </span>
393
406
  </div>
394
- {item.value && (
395
- <span className="text-foreground font-mono font-medium tabular-nums">
407
+ {isRenderableValue(item.value) && (
408
+ <span className="text-foreground tabular-nums">
396
409
  {typeof item.value === "number"
397
410
  ? item.value.toLocaleString()
398
411
  : item.value}
@@ -874,7 +887,7 @@ function ChartRadarLabelWrapper({
874
887
 
875
888
  return (
876
889
  <text
877
- className="text-xs"
890
+ className="text-body-xs"
878
891
  data-slot="chart-radar-label-wrapper"
879
892
  textAnchor={textAnchor}
880
893
  x={x}
@@ -966,7 +979,7 @@ function ChartPieLabelList({
966
979
 
967
980
  return (
968
981
  <text
969
- className="fill-foreground text-xs"
982
+ className="fill-foreground text-body-xs"
970
983
  data-slot="chart-pie-label-list"
971
984
  dominantBaseline="middle"
972
985
  textAnchor="middle"
@@ -1024,7 +1037,7 @@ function ChartPieLabelWrapper({
1024
1037
 
1025
1038
  return (
1026
1039
  <text
1027
- className="fill-foreground text-xs"
1040
+ className="fill-foreground text-body-xs"
1028
1041
  data-slot="chart-pie-label-wrapper"
1029
1042
  dominantBaseline="middle"
1030
1043
  textAnchor={textAnchor}
@@ -1056,7 +1069,8 @@ interface ChartCenterLabelProps {
1056
1069
  /** Secondary label shown beneath the primary value. */
1057
1070
  secondary?: React.ReactNode;
1058
1071
  /**
1059
- * Size of the primary value text.
1072
+ * Size of the primary value text. Every size keeps the `text-metric`
1073
+ * identity (Inter semibold); only the figure size scales.
1060
1074
  * @default "3xl"
1061
1075
  */
1062
1076
  size?: ChartCenterLabelSize;
@@ -1064,14 +1078,20 @@ interface ChartCenterLabelProps {
1064
1078
  viewBox?: unknown;
1065
1079
  }
1066
1080
 
1081
+ /* Only text-metric (24/28) exists on the type scale; the larger sizes are
1082
+ scaled variants of it carrying the same metric identity (Inter semibold)
1083
+ spelled out — twMerge registers scale styles as font-size atoms, so
1084
+ `text-metric text-4xl` would drop text-metric. */
1067
1085
  const chartCenterLabelPrimarySize: Record<ChartCenterLabelSize, string> = {
1068
- "2xl": "text-2xl leading-8",
1069
- "3xl": "text-3xl",
1070
- "4xl": "text-4xl leading-10",
1086
+ "2xl": "text-metric",
1087
+ "3xl": "font-sans text-3xl font-semibold",
1088
+ "4xl": "font-sans text-4xl font-semibold",
1071
1089
  };
1072
1090
 
1073
1091
  /**
1074
1092
  * ChartCenterLabel renders a centred primary value with an optional label.
1093
+ * The primary value is a KPI figure in the `text-metric` type-scale style;
1094
+ * `size` scales the figure.
1075
1095
  */
1076
1096
  function ChartCenterLabel({
1077
1097
  primary,
@@ -1099,10 +1119,7 @@ function ChartCenterLabel({
1099
1119
  y={cy}
1100
1120
  >
1101
1121
  <tspan
1102
- className={cn(
1103
- "fill-foreground font-sans font-bold",
1104
- chartCenterLabelPrimarySize[size]
1105
- )}
1122
+ className={cn("fill-foreground", chartCenterLabelPrimarySize[size])}
1106
1123
  x={cx}
1107
1124
  y={cy}
1108
1125
  >
@@ -1110,7 +1127,7 @@ function ChartCenterLabel({
1110
1127
  </tspan>
1111
1128
  {secondary != null && (
1112
1129
  <tspan
1113
- className="fill-muted-foreground font-sans text-xs font-normal"
1130
+ className="fill-muted-foreground text-body-xs"
1114
1131
  x={cx}
1115
1132
  y={cy + 24}
1116
1133
  >
@@ -1163,6 +1180,15 @@ export type {
1163
1180
  ChartCenterLabelSize,
1164
1181
  };
1165
1182
 
1183
+ /* ChartEmpty is defined in its own file so that a card showing "no data yet"
1184
+ need not pull Recharts in to say so — but it belongs to the chart family, so
1185
+ `/chart` exports it too and either import path works. It stays below the
1186
+ primary exports: the MCP indexer treats the file's first value export as the
1187
+ primary component when no export matches the file name, and `/chart`'s
1188
+ primary is ChartContainer. */
1189
+ export { ChartEmpty } from "./chart-empty";
1190
+ export type { ChartEmptyProps } from "./chart-empty";
1191
+
1166
1192
  // Re-export Recharts components with aliases to avoid naming conflicts
1167
1193
  export {
1168
1194
  Area,
@@ -2,9 +2,10 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import { cva } from "class-variance-authority";
5
- import { X, LoaderCircle } from "@brightlocal/icons";
5
+ import { X } from "@brightlocal/icons";
6
6
 
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
+ import { Spinner } from "@brightlocal/ui-components/spinner";
8
9
  import {
9
10
  Tooltip,
10
11
  TooltipContent,
@@ -25,7 +26,6 @@ const chipVariants = cva(
25
26
  "justify-center",
26
27
  "gap-0.5",
27
28
  "rounded-full",
28
- "font-medium",
29
29
  "whitespace-nowrap",
30
30
  "shrink-0",
31
31
  "select-none",
@@ -50,8 +50,11 @@ const chipVariants = cva(
50
50
  {
51
51
  variants: {
52
52
  size: {
53
- md: ["h-7", "pl-2.5", "pr-1", "text-xs"],
54
- lg: ["h-8", "pl-4", "pr-2", "text-base"],
53
+ md: ["h-7", "pl-2.5", "pr-1", "text-label-sm"],
54
+ // A chip is a control: the bigger box steps up one label role, never
55
+ // onto a body size — mirrors Button (sm → label-sm, md/lg → label).
56
+ // Resolves the 16px off-scale flag from DS-925 (DS-966).
57
+ lg: ["h-8", "pl-4", "pr-2", "text-label"],
55
58
  },
56
59
  },
57
60
  defaultVariants: {
@@ -173,7 +176,7 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
173
176
  ref
174
177
  ) => {
175
178
  const isDisabled = disabled || loading;
176
- const iconSize = size === "lg" ? 16 : 16;
179
+ const iconSize = size === "lg" ? 16 : 14;
177
180
  const labelRef = React.useRef<HTMLSpanElement>(null);
178
181
  const [isTruncated, setIsTruncated] = React.useState(false);
179
182
 
@@ -232,7 +235,7 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
232
235
  data-slot="chip-loading"
233
236
  role="status"
234
237
  >
235
- <LoaderCircle className="animate-spin" size={iconSize} />
238
+ <Spinner size={size === "lg" ? "md" : "sm"} />
236
239
  </span>
237
240
  ) : (
238
241
  <button
@@ -22,6 +22,7 @@ import {
22
22
  CommandList,
23
23
  CommandSeparator,
24
24
  } from "@brightlocal/ui-components/command";
25
+ import { Spinner } from "@brightlocal/ui-components/spinner";
25
26
 
26
27
  /* -------------------------------------------------------------------------------------------------
27
28
  * Combobox Context
@@ -383,7 +384,7 @@ const comboboxTriggerVariants = cva([
383
384
  "dark:bg-white/5 dark:border-white/15",
384
385
 
385
386
  // Typography
386
- "text-base font-normal font-sans text-foreground",
387
+ "text-body text-foreground",
387
388
 
388
389
  // Placeholder state
389
390
  "data-[placeholder=true]:text-muted-foreground",
@@ -619,7 +620,7 @@ function ComboboxValue<T>({
619
620
  return (
620
621
  <span
621
622
  className={cn(
622
- "overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",
623
+ "text-body overflow-hidden text-ellipsis whitespace-nowrap",
623
624
  className
624
625
  )}
625
626
  data-slot="combobox-value"
@@ -1472,7 +1473,7 @@ const ComboboxItem = React.forwardRef<
1472
1473
  return highlightText(
1473
1474
  children,
1474
1475
  highlight,
1475
- highlightClassName || "text-sm leading-normal font-semibold"
1476
+ highlightClassName || "text-label font-semibold"
1476
1477
  );
1477
1478
  }
1478
1479
  return children;
@@ -1491,7 +1492,7 @@ const ComboboxItem = React.forwardRef<
1491
1492
  aria-selected={isSelected}
1492
1493
  aria-setsize={virtualCtx.filteredCount}
1493
1494
  className={cn(
1494
- "data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none",
1495
+ "data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground text-label relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-3 outline-hidden select-none",
1495
1496
  "[&_svg]:pointer-events-none [&_svg]:shrink-0",
1496
1497
  isDisabled && "pointer-events-none opacity-50",
1497
1498
  className
@@ -1579,8 +1580,10 @@ export interface ComboboxLoadingProps {
1579
1580
  /** Children - custom loading content */
1580
1581
  children?: React.ReactNode;
1581
1582
  /**
1582
- * Loading text displayed next to the spinner.
1583
- * @default "Loading..."
1583
+ * Loading announcement for assistive technologies (visually hidden).
1584
+ * The default loading state is a spinner only — the surrounding combobox
1585
+ * makes the context unambiguous, so visible text would be noise.
1586
+ * @default "Loading suggestions"
1584
1587
  */
1585
1588
  loadingText?: string;
1586
1589
  }
@@ -1594,7 +1597,14 @@ function ComboboxLoading({
1594
1597
  <div
1595
1598
  aria-live="polite"
1596
1599
  className={cn(
1597
- "text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",
1600
+ // The entrance fade doubles as the flash-threshold appearance delay
1601
+ // (`both` holds the hidden start): a fetch that resolves inside the
1602
+ // flash zone never flashes a spinner, which would read slower than
1603
+ // no indicator at all. flash-delay draws the delay from
1604
+ // --ds-motion-flash-threshold — the same threshold useDelayedPending
1605
+ // mirrors in JS.
1606
+ "text-body-sm text-muted-foreground relative flex items-center justify-center gap-2 py-6",
1607
+ "animate-entrance-fade flash-delay",
1598
1608
  className
1599
1609
  )}
1600
1610
  data-slot="combobox-loading"
@@ -1602,11 +1612,10 @@ function ComboboxLoading({
1602
1612
  >
1603
1613
  {children || (
1604
1614
  <>
1605
- <div
1606
- aria-hidden="true"
1607
- className="size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"
1608
- />
1609
- {loadingText ?? "Loading..."}
1615
+ <Spinner size="md" />
1616
+ <span className="sr-only">
1617
+ {loadingText ?? "Loading suggestions"}
1618
+ </span>
1610
1619
  </>
1611
1620
  )}
1612
1621
  </div>
@@ -249,7 +249,7 @@ const CommandInput = React.forwardRef<
249
249
  <CommandPrimitive.Input
250
250
  ref={inputRef}
251
251
  className={cn(
252
- "placeholder:text-muted-foreground flex w-full bg-transparent text-base outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
252
+ "placeholder:text-muted-foreground text-body flex w-full bg-transparent outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
253
253
  className
254
254
  )}
255
255
  data-slot="command-input"
@@ -262,7 +262,9 @@ const CommandInput = React.forwardRef<
262
262
  {showClearButton && (
263
263
  <Button
264
264
  aria-label={clearSearchAriaLabel ?? "Clear search"}
265
- className="text-muted-foreground hover:text-foreground"
265
+ /* Same square hit area as the DataTableSearch clear — a default
266
+ h-9 px-4 button hovers as a wide pill inside the field. */
267
+ className="text-muted-foreground hover:text-foreground size-6 p-0"
266
268
  dataHook="command-input-clear"
267
269
  variant="ghost"
268
270
  onClick={handleClear}
@@ -352,7 +354,7 @@ const CommandEmpty = React.forwardRef<
352
354
  ref={setRef}
353
355
  aria-disabled="true"
354
356
  aria-selected="false"
355
- className="py-6 text-center text-sm"
357
+ className="text-body-sm py-6 text-center"
356
358
  data-hook={dataHook}
357
359
  data-slot="command-empty"
358
360
  {...props}
@@ -387,7 +389,7 @@ const CommandGroup = React.forwardRef<
387
389
  <CommandPrimitive.Group
388
390
  ref={ref}
389
391
  className={cn(
390
- "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden px-2 py-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
392
+ "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-label-sm overflow-hidden px-2 py-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5",
391
393
  className
392
394
  )}
393
395
  data-hook={dataHook}
@@ -480,7 +482,7 @@ const CommandItem = React.forwardRef<
480
482
  <CommandPrimitive.Item
481
483
  ref={ref}
482
484
  className={cn(
483
- "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
485
+ "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:text-muted-foreground text-label relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
484
486
  className
485
487
  )}
486
488
  data-hook={dataHook}
@@ -526,10 +528,7 @@ const CommandShortcut = React.forwardRef<HTMLSpanElement, CommandShortcutProps>(
526
528
  ({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => (
527
529
  <span
528
530
  ref={ref}
529
- className={cn(
530
- "text-muted-foreground ml-auto text-xs tracking-widest",
531
- className
532
- )}
531
+ className={cn("text-muted-foreground text-body-xs ml-auto", className)}
533
532
  data-hook={dataHook}
534
533
  data-slot="command-shortcut"
535
534
  data-tracking-el={trackingEl}
@@ -976,7 +975,7 @@ const CommandVirtualItem = React.forwardRef<
976
975
  aria-selected={selected || undefined}
977
976
  aria-setsize={virtualCtx?.filteredCount}
978
977
  className={cn(
979
- "data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none",
978
+ "data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground text-label relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 outline-hidden select-none",
980
979
  "[&_svg]:pointer-events-none [&_svg]:shrink-0",
981
980
  disabled && "pointer-events-none opacity-50",
982
981
  className
@@ -168,7 +168,7 @@ const ContextMenuSubTrigger = React.forwardRef<
168
168
  <ContextMenuPrimitive.SubTrigger
169
169
  ref={ref}
170
170
  className={cn(
171
- "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none",
171
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground text-label flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 outline-none select-none",
172
172
  inset && "pl-8",
173
173
  className
174
174
  )}
@@ -284,7 +284,7 @@ const ContextMenuItem = React.forwardRef<
284
284
  <ContextMenuPrimitive.Item
285
285
  ref={ref}
286
286
  className={cn(
287
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
287
+ "focus:bg-accent focus:text-accent-foreground text-label relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
288
288
  inset && "pl-8",
289
289
  className
290
290
  )}
@@ -341,7 +341,7 @@ const ContextMenuCheckboxItem = React.forwardRef<
341
341
  ref={ref}
342
342
  checked={checked}
343
343
  className={cn(
344
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
344
+ "focus:bg-accent focus:text-accent-foreground text-label relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
345
345
  className
346
346
  )}
347
347
  data-hook={dataHook}
@@ -395,7 +395,7 @@ const ContextMenuRadioItem = React.forwardRef<
395
395
  <ContextMenuPrimitive.RadioItem
396
396
  ref={ref}
397
397
  className={cn(
398
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
398
+ "focus:bg-accent focus:text-accent-foreground text-label relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
399
399
  className
400
400
  )}
401
401
  data-hook={dataHook}
@@ -437,7 +437,7 @@ const ContextMenuLabel = React.forwardRef<
437
437
  <ContextMenuPrimitive.Label
438
438
  ref={ref}
439
439
  className={cn(
440
- "text-foreground px-2 py-1.5 text-sm font-semibold",
440
+ "text-foreground text-label-sm px-2 py-1.5",
441
441
  inset && "pl-8",
442
442
  className
443
443
  )}
@@ -484,10 +484,7 @@ const ContextMenuShortcut = React.forwardRef<
484
484
  >(({ className, ...props }, ref) => (
485
485
  <span
486
486
  ref={ref}
487
- className={cn(
488
- "text-muted-foreground ml-auto text-xs tracking-widest",
489
- className
490
- )}
487
+ className={cn("text-muted-foreground text-body-xs ml-auto", className)}
491
488
  data-slot="context-menu-shortcut"
492
489
  {...props}
493
490
  />