@brightlocal/ui-components 2.27.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 (259) hide show
  1. package/README.md +6 -1
  2. package/component-meta.json +480 -126
  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-screen.d.ts → progress-state.d.ts} +30 -18
  26. package/dist/blocks/progress-state.d.ts.map +1 -0
  27. package/dist/blocks/{progress-screen.js → progress-state.js} +100 -71
  28. package/dist/blocks/sidebar.cjs +1 -1
  29. package/dist/blocks/sidebar.d.ts.map +1 -1
  30. package/dist/blocks/sidebar.js +160 -161
  31. package/dist/breadcrumb.cjs +1 -1
  32. package/dist/breadcrumb.js +1 -1
  33. package/dist/button.cjs +1 -1
  34. package/dist/button.js +11 -11
  35. package/dist/calendar.cjs +1 -1
  36. package/dist/calendar.d.ts.map +1 -1
  37. package/dist/calendar.js +37 -38
  38. package/dist/callout.cjs +1 -1
  39. package/dist/callout.d.ts +24 -2
  40. package/dist/callout.d.ts.map +1 -1
  41. package/dist/callout.js +57 -55
  42. package/dist/card.cjs +1 -1
  43. package/dist/card.d.ts +23 -2
  44. package/dist/card.d.ts.map +1 -1
  45. package/dist/card.js +94 -91
  46. package/dist/chart-empty.cjs +1 -0
  47. package/dist/chart-empty.d.ts +59 -0
  48. package/dist/chart-empty.d.ts.map +1 -0
  49. package/dist/chart-empty.js +29 -0
  50. package/dist/chart.cjs +6 -6
  51. package/dist/chart.d.ts +6 -1
  52. package/dist/chart.d.ts.map +1 -1
  53. package/dist/chart.js +183 -183
  54. package/dist/chip.cjs +1 -1
  55. package/dist/chip.d.ts.map +1 -1
  56. package/dist/chip.js +5 -3
  57. package/dist/combobox.cjs +2 -2
  58. package/dist/combobox.d.ts.map +1 -1
  59. package/dist/combobox.js +81 -79
  60. package/dist/command.cjs +1 -1
  61. package/dist/command.d.ts.map +1 -1
  62. package/dist/command.js +74 -77
  63. package/dist/context-menu.cjs +1 -1
  64. package/dist/context-menu.d.ts.map +1 -1
  65. package/dist/context-menu.js +26 -29
  66. package/dist/data-table.cjs +1 -1
  67. package/dist/data-table.d.ts +44 -10
  68. package/dist/data-table.d.ts.map +1 -1
  69. package/dist/data-table.js +13 -11
  70. package/dist/description.cjs +1 -1
  71. package/dist/description.js +5 -5
  72. package/dist/dialog.cjs +1 -1
  73. package/dist/dialog.js +20 -20
  74. package/dist/drawer.cjs +1 -1
  75. package/dist/drawer.d.ts.map +1 -1
  76. package/dist/drawer.js +8 -11
  77. package/dist/dropdown-menu.cjs +1 -1
  78. package/dist/dropdown-menu.d.ts.map +1 -1
  79. package/dist/dropdown-menu.js +17 -20
  80. package/dist/field.cjs +1 -1
  81. package/dist/field.d.ts.map +1 -1
  82. package/dist/field.js +29 -25
  83. package/dist/global-layout.cjs +1 -1
  84. package/dist/global-layout.d.ts +27 -1
  85. package/dist/global-layout.d.ts.map +1 -1
  86. package/dist/global-layout.js +18 -16
  87. package/dist/grid.cjs +1 -0
  88. package/dist/grid.d.ts +56 -0
  89. package/dist/grid.d.ts.map +1 -0
  90. package/dist/grid.js +32 -0
  91. package/dist/header.d.ts +13 -0
  92. package/dist/header.d.ts.map +1 -1
  93. package/dist/hooks/use-delayed-pending.cjs +1 -0
  94. package/dist/hooks/use-delayed-pending.d.ts +34 -0
  95. package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
  96. package/dist/hooks/use-delayed-pending.js +17 -0
  97. package/dist/hover-card.cjs +1 -1
  98. package/dist/hover-card.js +13 -13
  99. package/dist/index.cjs +1 -1
  100. package/dist/index.d.ts +8 -1
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +512 -494
  103. package/dist/input-chip.cjs +1 -1
  104. package/dist/input-chip.js +25 -25
  105. package/dist/input-group.cjs +1 -1
  106. package/dist/input-group.js +9 -9
  107. package/dist/input-otp.cjs +1 -1
  108. package/dist/input-otp.js +9 -9
  109. package/dist/input-password.cjs +1 -1
  110. package/dist/input-password.js +51 -51
  111. package/dist/input.cjs +1 -1
  112. package/dist/input.js +9 -9
  113. package/dist/label.cjs +1 -1
  114. package/dist/label.d.ts.map +1 -1
  115. package/dist/label.js +25 -28
  116. package/dist/lib/block-illustration.cjs +1 -0
  117. package/dist/lib/block-illustration.d.ts +28 -0
  118. package/dist/lib/block-illustration.d.ts.map +1 -0
  119. package/dist/lib/block-illustration.js +21 -0
  120. package/dist/lib/empty-canvas.cjs +1 -0
  121. package/dist/lib/empty-canvas.d.ts +27 -0
  122. package/dist/lib/empty-canvas.d.ts.map +1 -0
  123. package/dist/lib/empty-canvas.js +62 -0
  124. package/dist/lib/optical-center.cjs +1 -0
  125. package/dist/lib/optical-center.d.ts +12 -0
  126. package/dist/lib/optical-center.d.ts.map +1 -0
  127. package/dist/lib/optical-center.js +11 -0
  128. package/dist/lib/utils.cjs +1 -1
  129. package/dist/lib/utils.d.ts.map +1 -1
  130. package/dist/lib/utils.js +28 -5
  131. package/dist/list.cjs +1 -1
  132. package/dist/list.d.ts.map +1 -1
  133. package/dist/list.js +62 -58
  134. package/dist/map.cjs +1 -1
  135. package/dist/map.d.ts +60 -2
  136. package/dist/map.d.ts.map +1 -1
  137. package/dist/map.js +187 -164
  138. package/dist/media-empty.cjs +1 -0
  139. package/dist/media-empty.d.ts +72 -0
  140. package/dist/media-empty.d.ts.map +1 -0
  141. package/dist/media-empty.js +45 -0
  142. package/dist/menubar.cjs +1 -1
  143. package/dist/menubar.d.ts.map +1 -1
  144. package/dist/menubar.js +17 -20
  145. package/dist/navigation-menu.cjs +1 -1
  146. package/dist/navigation-menu.js +7 -7
  147. package/dist/pagination.cjs +1 -1
  148. package/dist/pagination.d.ts +127 -1
  149. package/dist/pagination.d.ts.map +1 -1
  150. package/dist/pagination.js +189 -98
  151. package/dist/progress.cjs +1 -1
  152. package/dist/progress.d.ts +2 -26
  153. package/dist/progress.d.ts.map +1 -1
  154. package/dist/progress.js +79 -118
  155. package/dist/select.cjs +2 -2
  156. package/dist/select.d.ts.map +1 -1
  157. package/dist/select.js +19 -18
  158. package/dist/separator.cjs +1 -1
  159. package/dist/separator.js +8 -8
  160. package/dist/sheet.cjs +1 -1
  161. package/dist/sheet.js +2 -2
  162. package/dist/skeleton.cjs +1 -1
  163. package/dist/skeleton.d.ts +38 -3
  164. package/dist/skeleton.d.ts.map +1 -1
  165. package/dist/skeleton.js +43 -20
  166. package/dist/sonner.cjs +1 -1
  167. package/dist/sonner.js +26 -26
  168. package/dist/stepper.cjs +1 -1
  169. package/dist/stepper.js +40 -40
  170. package/dist/table.cjs +1 -1
  171. package/dist/table.d.ts.map +1 -1
  172. package/dist/table.js +31 -28
  173. package/dist/tabs.cjs +1 -1
  174. package/dist/tabs.js +1 -1
  175. package/dist/text-reveal-motion.d.ts +10 -0
  176. package/dist/text-reveal-motion.d.ts.map +1 -1
  177. package/dist/textarea.cjs +1 -1
  178. package/dist/textarea.js +11 -11
  179. package/dist/toggle.cjs +1 -1
  180. package/dist/toggle.js +8 -8
  181. package/dist/tooltip.cjs +1 -1
  182. package/dist/tooltip.js +8 -8
  183. package/dist/typography-heading.cjs +1 -0
  184. package/dist/typography-heading.d.ts +116 -0
  185. package/dist/typography-heading.d.ts.map +1 -0
  186. package/dist/typography-heading.js +84 -0
  187. package/dist/typography-text.cjs +1 -0
  188. package/dist/typography-text.d.ts +113 -0
  189. package/dist/typography-text.d.ts.map +1 -0
  190. package/dist/typography-text.js +81 -0
  191. package/dist/typography.d.ts +13 -0
  192. package/dist/typography.d.ts.map +1 -1
  193. package/package.json +35 -7
  194. package/src/blocks/empty-state.tsx +424 -0
  195. package/src/blocks/input-list.tsx +66 -36
  196. package/src/blocks/{progress-screen.tsx → progress-state.tsx} +154 -93
  197. package/src/blocks/sidebar.tsx +25 -26
  198. package/src/components/accordion.tsx +2 -2
  199. package/src/components/alert-dialog.tsx +2 -2
  200. package/src/components/alert.tsx +27 -13
  201. package/src/components/avatar.tsx +1 -1
  202. package/src/components/badge.tsx +8 -4
  203. package/src/components/breadcrumb.tsx +1 -1
  204. package/src/components/button.tsx +3 -3
  205. package/src/components/calendar.tsx +5 -6
  206. package/src/components/callout.tsx +48 -15
  207. package/src/components/card.tsx +52 -17
  208. package/src/components/chart-empty.tsx +116 -0
  209. package/src/components/chart.tsx +43 -17
  210. package/src/components/chip.tsx +5 -3
  211. package/src/components/combobox.tsx +12 -10
  212. package/src/components/command.tsx +9 -10
  213. package/src/components/context-menu.tsx +6 -9
  214. package/src/components/data-table.tsx +72 -17
  215. package/src/components/description.tsx +1 -1
  216. package/src/components/dialog.tsx +2 -2
  217. package/src/components/drawer.tsx +2 -5
  218. package/src/components/dropdown-menu.tsx +8 -11
  219. package/src/components/field.tsx +8 -4
  220. package/src/components/global-layout.tsx +36 -3
  221. package/src/components/grid.tsx +130 -0
  222. package/src/components/header.tsx +13 -0
  223. package/src/components/hover-card.tsx +1 -1
  224. package/src/components/input-chip.tsx +1 -1
  225. package/src/components/input-group.tsx +1 -1
  226. package/src/components/input-otp.tsx +1 -1
  227. package/src/components/input-password.tsx +1 -1
  228. package/src/components/input.tsx +1 -1
  229. package/src/components/label.tsx +10 -13
  230. package/src/components/list.tsx +13 -9
  231. package/src/components/map.tsx +101 -5
  232. package/src/components/media-empty.tsx +156 -0
  233. package/src/components/menubar.tsx +7 -10
  234. package/src/components/navigation-menu.tsx +1 -1
  235. package/src/components/pagination.tsx +279 -1
  236. package/src/components/progress.tsx +35 -113
  237. package/src/components/select.tsx +5 -4
  238. package/src/components/separator.tsx +1 -1
  239. package/src/components/sheet.tsx +2 -2
  240. package/src/components/skeleton.tsx +78 -7
  241. package/src/components/sonner.tsx +2 -2
  242. package/src/components/stepper.tsx +3 -3
  243. package/src/components/table.tsx +6 -3
  244. package/src/components/tabs.tsx +1 -1
  245. package/src/components/text-reveal-motion.tsx +10 -0
  246. package/src/components/textarea.tsx +1 -1
  247. package/src/components/toggle.tsx +1 -1
  248. package/src/components/tooltip.tsx +1 -1
  249. package/src/components/typography-heading.tsx +229 -0
  250. package/src/components/typography-text.tsx +225 -0
  251. package/src/components/typography.tsx +13 -0
  252. package/src/hooks/use-delayed-pending.ts +60 -0
  253. package/src/index.ts +10 -1
  254. package/src/lib/block-illustration.tsx +88 -0
  255. package/src/lib/empty-canvas.tsx +128 -0
  256. package/src/lib/optical-center.tsx +45 -0
  257. package/src/lib/utils.ts +26 -0
  258. package/dist/blocks/progress-screen.cjs +0 -1
  259. package/dist/blocks/progress-screen.d.ts.map +0 -1
@@ -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"
@@ -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,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,
@@ -26,7 +26,6 @@ const chipVariants = cva(
26
26
  "justify-center",
27
27
  "gap-0.5",
28
28
  "rounded-full",
29
- "font-medium",
30
29
  "whitespace-nowrap",
31
30
  "shrink-0",
32
31
  "select-none",
@@ -51,8 +50,11 @@ const chipVariants = cva(
51
50
  {
52
51
  variants: {
53
52
  size: {
54
- md: ["h-7", "pl-2.5", "pr-1", "text-xs"],
55
- 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"],
56
58
  },
57
59
  },
58
60
  defaultVariants: {
@@ -384,7 +384,7 @@ const comboboxTriggerVariants = cva([
384
384
  "dark:bg-white/5 dark:border-white/15",
385
385
 
386
386
  // Typography
387
- "text-base font-normal font-sans text-foreground",
387
+ "text-body text-foreground",
388
388
 
389
389
  // Placeholder state
390
390
  "data-[placeholder=true]:text-muted-foreground",
@@ -620,7 +620,7 @@ function ComboboxValue<T>({
620
620
  return (
621
621
  <span
622
622
  className={cn(
623
- "overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",
623
+ "text-body overflow-hidden text-ellipsis whitespace-nowrap",
624
624
  className
625
625
  )}
626
626
  data-slot="combobox-value"
@@ -1473,7 +1473,7 @@ const ComboboxItem = React.forwardRef<
1473
1473
  return highlightText(
1474
1474
  children,
1475
1475
  highlight,
1476
- highlightClassName || "text-sm leading-normal font-semibold"
1476
+ highlightClassName || "text-label font-semibold"
1477
1477
  );
1478
1478
  }
1479
1479
  return children;
@@ -1492,7 +1492,7 @@ const ComboboxItem = React.forwardRef<
1492
1492
  aria-selected={isSelected}
1493
1493
  aria-setsize={virtualCtx.filteredCount}
1494
1494
  className={cn(
1495
- "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",
1496
1496
  "[&_svg]:pointer-events-none [&_svg]:shrink-0",
1497
1497
  isDisabled && "pointer-events-none opacity-50",
1498
1498
  className
@@ -1597,12 +1597,14 @@ function ComboboxLoading({
1597
1597
  <div
1598
1598
  aria-live="polite"
1599
1599
  className={cn(
1600
- // The entrance fade doubles as a ~150ms appearance delay (`both`
1601
- // holds the hidden start): a fetch that resolves faster than the
1602
- // delay never flashes a spinner, which would read slower than no
1603
- // indicator at all.
1604
- "text-muted-foreground relative flex items-center justify-center gap-2 py-6 text-sm",
1605
- "animate-entrance-fade entrance-delay-1",
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",
1606
1608
  className
1607
1609
  )}
1608
1610
  data-slot="combobox-loading"