@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
@@ -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
  />
@@ -18,8 +18,6 @@
18
18
  * - Layout: `DataTableToolbar`, `DataTableToolbarLeft`,
19
19
  * `DataTableToolbarRight` — responsive flex container for search +
20
20
  * pagination above (or below) the table.
21
- *
22
- * Block composition example — see `apps/sandbox/components/audit-table.tsx`.
23
21
  */
24
22
 
25
23
  import * as React from "react";
@@ -62,6 +60,7 @@ import {
62
60
  } from "@brightlocal/icons";
63
61
 
64
62
  import { cn } from "@brightlocal/ui-components/lib/utils";
63
+ import { useIsBelowBreakpoint } from "@brightlocal/ui-components/hooks/use-breakpoint";
65
64
  import { Button } from "./button";
66
65
  import { Checkbox } from "./checkbox";
67
66
  import { InputGroup, InputGroupAddon, InputGroupInput } from "./input-group";
@@ -182,8 +181,16 @@ export interface UseDataTableOptions<TData> {
182
181
  enableSorting?: boolean;
183
182
  /** Enable global text search across rows (substring match). @default false */
184
183
  enableGlobalFiltering?: boolean;
185
- /** Enable row selection via checkboxes. @default false */
186
- enableRowSelection?: boolean;
184
+ /**
185
+ * Enable row selection via checkboxes. Pass a predicate to decide per row:
186
+ * a row for which it returns `false` has `row.getCanSelect() === false`, so
187
+ * `DataTableSelectRowCheckbox` renders disabled and `DataTableSelectAllCheckbox`
188
+ * skips the row. Use it for caps and allowances — let already-selected rows
189
+ * stay selectable so the user can undo.
190
+ * @default false
191
+ * @example enableRowSelection: (row) => row.getIsSelected() || selectedCount < 20
192
+ */
193
+ enableRowSelection?: boolean | ((row: Row<TData>) => boolean);
187
194
  /** Enable client-side pagination. @default false */
188
195
  enablePagination?: boolean;
189
196
  /** Initial page size when pagination is enabled. @default 10 */
@@ -288,6 +295,14 @@ export interface UseDataTableOptions<TData> {
288
295
  * mixed (keep the table-level default and set `enableSorting: false` on the
289
296
  * individual column defs that must not sort).
290
297
  *
298
+ * Row selection can be resolved per row the same way: `enableRowSelection`
299
+ * takes a predicate as well as a boolean, which backs `row.getCanSelect()`.
300
+ * A blocked row renders a disabled `DataTableSelectRowCheckbox` and is skipped
301
+ * by `DataTableSelectAllCheckbox`. Let already-selected rows pass the
302
+ * predicate, or a cap leaves the user no way to swap a choice — and leave
303
+ * select-all out of a capped table, since every row passes a count-based
304
+ * predicate while the selection is empty.
305
+ *
291
306
  * @example
292
307
  * const table = useDataTable({
293
308
  * columns,
@@ -402,7 +417,9 @@ export function useDataTable<TData>(
402
417
  // omitting it would leave `row.getCanSelect()` returning true and
403
418
  // `DataTableSelectRowCheckbox` enabled on tables without selection.
404
419
  enableRowSelection,
405
- ...(enableRowSelection && {
420
+ // A predicate turns selection on for the table as a whole; individual rows
421
+ // opt out through `row.getCanSelect()`, so the state wiring is still needed.
422
+ ...(enableRowSelection !== false && {
406
423
  onRowSelectionChange: setRowSelectionState,
407
424
  }),
408
425
 
@@ -457,8 +474,22 @@ export interface DataTableProps<TData> {
457
474
  isLoading?: boolean;
458
475
  /** Number of skeleton rows when loading. Falls back to the table's page size, then 10. */
459
476
  skeletonRowCount?: number;
460
- /** Empty state message. @default "No results." */
461
- noResultsMessage?: string;
477
+ /**
478
+ * What the table shows in place of rows when it has none.
479
+ *
480
+ * A string is the no-results case — a filter or search that excludes
481
+ * everything — and it is announced politely, because the reader's own query
482
+ * caused it and they are waiting to hear the outcome.
483
+ *
484
+ * Pass an `<EmptyState>` for a collection that is empty rather than filtered:
485
+ * nothing has been added yet, so the cell needs a title and a way to add the
486
+ * first one. The cell brings the block's breathing room with it — do not wrap
487
+ * it in a padding element. The block is wrapped in the same live region, so
488
+ * keep it to the standard anatomy — its title and one line are worth hearing;
489
+ * a wall of copy is not.
490
+ * @default "No results."
491
+ */
492
+ noResultsMessage?: React.ReactNode;
462
493
  /**
463
494
  * Pin the `<thead>` to the top of the scroll container so column headers
464
495
  * remain visible while scrolling. The header keeps its opaque `bg-muted`
@@ -626,7 +657,14 @@ export function DataTable<TData>({
626
657
  ) : (
627
658
  <TableRow>
628
659
  <TableCell align="center" colSpan={columnCount} size="lg">
629
- <div aria-live="polite" role="status">
660
+ {/* Padded for a block, not for a line: an `EmptyState` passed
661
+ as the message needs the same room here that it gets
662
+ anywhere else, and a prop API gives the consumer nowhere
663
+ to add it. 24 rather than 32, because this sits inside
664
+ the cell's own 8: together they give the block its 32,
665
+ and a one-line message still measures under `size="lg"`'s
666
+ min-height, so the plain-string row does not move. */}
667
+ <div aria-live="polite" className="py-6" role="status">
630
668
  {noResultsMessage}
631
669
  </div>
632
670
  </TableCell>
@@ -960,7 +998,9 @@ export function VirtualizedDataTable<TData>({
960
998
  ) : (
961
999
  <TableRow>
962
1000
  <TableCell align="center" colSpan={columnCount} size="lg">
963
- <div aria-live="polite" role="status">
1001
+ {/* Padded for a block — see the note on the non-virtualised
1002
+ table's no-results cell. */}
1003
+ <div aria-live="polite" className="py-6" role="status">
964
1004
  {noResultsMessage}
965
1005
  </div>
966
1006
  </TableCell>
@@ -1013,6 +1053,20 @@ export interface DataTableColumnHeaderProps<
1013
1053
  * Falls back to a non-interactive label when the column is not sortable.
1014
1054
  * Otherwise renders a ghost button that toggles sort on click, with an
1015
1055
  * accessible label describing the current sort state.
1056
+ *
1057
+ * **First-click direction:** clicking an unsorted column starts ascending
1058
+ * (A–Z, lowest first). Numeric columns (counts, rates, scores) usually want
1059
+ * highest-first on the first click — opt in per column with TanStack's
1060
+ * `sortDescFirst` on the column def:
1061
+ *
1062
+ * ```tsx
1063
+ * { accessorKey: "score", sortDescFirst: true, header: ... }
1064
+ * ```
1065
+ *
1066
+ * Only an explicit `sortDescFirst` is honoured — TanStack's automatic
1067
+ * "numbers sort descending first" detection is deliberately not consulted,
1068
+ * so tables that do not opt in keep first-click-ascending. Once a column is
1069
+ * sorted, clicking again reverses the direction as before.
1016
1070
  */
1017
1071
  export function DataTableColumnHeader<TData, TValue>({
1018
1072
  column,
@@ -1028,7 +1082,7 @@ export function DataTableColumnHeader<TData, TValue>({
1028
1082
  return (
1029
1083
  <div
1030
1084
  className={cn(
1031
- "text-muted-foreground text-left text-sm leading-normal font-medium",
1085
+ "text-muted-foreground text-label text-left font-semibold",
1032
1086
  align === "right" && "text-right",
1033
1087
  align === "center" && "text-center",
1034
1088
  className
@@ -1044,6 +1098,14 @@ export function DataTableColumnHeader<TData, TValue>({
1044
1098
  }
1045
1099
 
1046
1100
  const sortState = column.getIsSorted();
1101
+ // First click on an unsorted column follows the column def's explicit
1102
+ // `sortDescFirst`; later clicks reverse the current direction. TanStack's
1103
+ // `getFirstSortDir()` is not used here — its automatic numeric detection
1104
+ // would silently flip existing tables to descending-first (DS-953).
1105
+ const nextSortDesc =
1106
+ sortState === false
1107
+ ? column.columnDef.sortDescFirst === true
1108
+ : sortState === "asc";
1047
1109
  const sortLabel = getSortLabel
1048
1110
  ? getSortLabel(title, sortState)
1049
1111
  : sortState === "desc"
@@ -1066,11 +1128,11 @@ export function DataTableColumnHeader<TData, TValue>({
1066
1128
  >
1067
1129
  <Button
1068
1130
  aria-label={sortLabel}
1069
- className="text-muted-foreground h-auto p-0 text-sm font-medium"
1131
+ className="text-muted-foreground text-label h-auto p-0 font-semibold"
1070
1132
  dataHook={dataHook || `column-header-${column.id}`}
1071
1133
  size="sm"
1072
1134
  variant="ghost"
1073
- onClick={() => column.toggleSorting(sortState === "asc")}
1135
+ onClick={() => column.toggleSorting(nextSortDesc)}
1074
1136
  >
1075
1137
  <span aria-hidden="true">{title}</span>
1076
1138
  <span
@@ -1155,7 +1217,9 @@ export function DataTableSearch<TData>({
1155
1217
  <InputGroupAddon className="pr-1">
1156
1218
  <Button
1157
1219
  aria-label={clearSearchAriaLabel ?? "Clear search"}
1158
- className="h-auto p-1"
1220
+ /* Fixed square hit area — h-auto p-1 let the ghost hover hug the
1221
+ 14px icon into a squashed pill. */
1222
+ className="size-6 p-0"
1159
1223
  data-slot="data-table-search-clear"
1160
1224
  dataHook={`${inputGroupProps.dataHook}-clear`}
1161
1225
  variant="ghost"
@@ -1328,6 +1392,8 @@ export interface DataTablePaginationRowCountProps {
1328
1392
  *
1329
1393
  * Renders "start–end of total" by default. Pass `renderText` for i18n-friendly
1330
1394
  * custom text with full control over wording, pluralization, and order.
1395
+ * Renders nothing below the `sm` viewport breakpoint — on small screens the
1396
+ * label is removed so the page buttons get the full width (DS-998).
1331
1397
  *
1332
1398
  * Must be rendered inside `<DataTablePagination>`.
1333
1399
  */
@@ -1336,8 +1402,14 @@ function DataTablePaginationRowCount({
1336
1402
  className,
1337
1403
  }: DataTablePaginationRowCountProps) {
1338
1404
  const { info } = useDataTablePaginationContext();
1405
+ const isMobile = useIsBelowBreakpoint("sm");
1339
1406
  const { startRow, endRow, totalRows, pageIndex, pageSize } = info;
1340
1407
 
1408
+ // Below `sm` the label is removed so the page buttons get the full width
1409
+ // and centre (DS-998) — same rule as the default layout and
1410
+ // `PaginationControls`.
1411
+ if (isMobile) return null;
1412
+
1341
1413
  const content = renderText
1342
1414
  ? renderText({ startRow, endRow, totalRows, pageIndex, pageSize })
1343
1415
  : totalRows === 0
@@ -1348,7 +1420,10 @@ function DataTablePaginationRowCount({
1348
1420
 
1349
1421
  return (
1350
1422
  <span
1351
- className={cn("text-muted-foreground text-sm", className)}
1423
+ className={cn(
1424
+ "text-body-sm text-muted-foreground whitespace-nowrap",
1425
+ className
1426
+ )}
1352
1427
  data-slot="data-table-pagination-row-count"
1353
1428
  >
1354
1429
  {content}
@@ -1374,8 +1449,10 @@ export interface DataTablePaginationNavProps {
1374
1449
  /**
1375
1450
  * Pagination navigation for `DataTablePagination`.
1376
1451
  *
1377
- * Renders previous/next buttons and page links. Must be rendered inside
1378
- * `<DataTablePagination>`.
1452
+ * Renders previous/next buttons and page links. Renders nothing when there
1453
+ * is at most one page — navigation controls are noise when there is nowhere
1454
+ * to navigate. Below the `sm` viewport breakpoint the buttons centre in the
1455
+ * available width (DS-998). Must be rendered inside `<DataTablePagination>`.
1379
1456
  */
1380
1457
  function DataTablePaginationNav({
1381
1458
  ariaLabel = "Table pagination",
@@ -1383,16 +1460,23 @@ function DataTablePaginationNav({
1383
1460
  className,
1384
1461
  }: DataTablePaginationNavProps) {
1385
1462
  const { info } = useDataTablePaginationContext();
1463
+ const isMobile = useIsBelowBreakpoint("sm");
1386
1464
 
1387
1465
  const paginationItems = usePagination({
1388
1466
  page: info.currentPage,
1389
1467
  totalPages: info.totalPages,
1390
1468
  });
1391
1469
 
1470
+ if (info.totalPages <= 1) {
1471
+ return null;
1472
+ }
1473
+
1392
1474
  return (
1393
1475
  <Pagination
1394
1476
  ariaLabel={ariaLabel}
1395
- className={cn("mx-0 w-auto justify-end", className)}
1477
+ // Below `sm` keep the base centred layout (the row count is removed
1478
+ // there); at `sm` and up hug the content and align right.
1479
+ className={cn(!isMobile && "mx-0 w-auto justify-end", className)}
1396
1480
  dataHook={dataHook ?? "pagination-nav"}
1397
1481
  >
1398
1482
  <PaginationContent>
@@ -1500,6 +1584,25 @@ export interface DataTablePaginationProps<TData> {
1500
1584
  * optional "start–end of total" row count label. Use `renderRowCount` for
1501
1585
  * i18n-friendly text.
1502
1586
  *
1587
+ * The navigation hides itself when there is at most one page (the row count
1588
+ * stays, keeping the bar informative and the layout stable). When both the
1589
+ * row count and the nav are empty, the component renders nothing — no
1590
+ * consumer render gate needed.
1591
+ *
1592
+ * **Responsive behaviour:** below the `sm` viewport breakpoint the row-count
1593
+ * label is removed and the page buttons centre in the available width — the
1594
+ * same rule `PaginationControls` follows for its caption. This applies to
1595
+ * both layouts: the default row count and `DataTablePaginationRowCount`
1596
+ * render nothing below `sm`, and `DataTablePaginationNav` centres itself.
1597
+ * From `sm` up the bar wraps inside narrow containers: when the row count
1598
+ * and the page buttons no longer fit on one line, the buttons move to their
1599
+ * own line below the row count — no consumer layout classes needed. The row
1600
+ * of page buttons itself does not wrap or shrink, so the **minimum supported
1601
+ * container width** is the width of the button row: **300px** below the `sm`
1602
+ * viewport breakpoint (compact five-slot list) and **388px** from `sm` up
1603
+ * (seven-slot list). Narrower containers than that are outside the
1604
+ * component's supported range (DS-998).
1605
+ *
1503
1606
  * **Compositional mode** (with children): acts as a context provider.
1504
1607
  * Compose `DataTablePaginationRowCount` and `DataTablePaginationNav`
1505
1608
  * in any order/layout.
@@ -1537,6 +1640,7 @@ export function DataTablePagination<TData>({
1537
1640
  children,
1538
1641
  }: DataTablePaginationProps<TData>) {
1539
1642
  const info = useDataTablePagination(table);
1643
+ const isMobile = useIsBelowBreakpoint("sm");
1540
1644
 
1541
1645
  const contextValue = React.useMemo<DataTablePaginationContextValue>(
1542
1646
  () => ({ info }),
@@ -1554,7 +1658,10 @@ export function DataTablePagination<TData>({
1554
1658
  return (
1555
1659
  <DataTablePaginationContext.Provider value={contextValue}>
1556
1660
  <div
1557
- className={cn("flex w-full items-center gap-4", className)}
1661
+ className={cn(
1662
+ "flex w-full flex-wrap items-center gap-x-4 gap-y-2",
1663
+ className
1664
+ )}
1558
1665
  {...wrapperDataAttrs}
1559
1666
  >
1560
1667
  {children}
@@ -1564,6 +1671,9 @@ export function DataTablePagination<TData>({
1564
1671
  }
1565
1672
 
1566
1673
  const rowCountContent = (() => {
1674
+ // Below `sm` the label is removed so the page buttons get the full width
1675
+ // and centre (DS-998).
1676
+ if (isMobile) return null;
1567
1677
  if (!showRowCount) return null;
1568
1678
  if (renderRowCount === null) return null;
1569
1679
  if (renderRowCount) {
@@ -1579,23 +1689,28 @@ export function DataTablePagination<TData>({
1579
1689
  return `${info.startRow}-${info.endRow} of ${info.totalRows}`;
1580
1690
  })();
1581
1691
 
1692
+ if (rowCountContent == null && info.totalPages <= 1) {
1693
+ return null;
1694
+ }
1695
+
1582
1696
  return (
1583
1697
  <DataTablePaginationContext.Provider value={contextValue}>
1584
1698
  <div
1585
1699
  className={cn(
1586
- "flex w-full items-center gap-4",
1700
+ "flex min-h-9 w-full flex-wrap items-center gap-x-4 gap-y-2",
1587
1701
  rowCountContent != null ? "justify-between" : "justify-end",
1588
1702
  className
1589
1703
  )}
1590
1704
  {...wrapperDataAttrs}
1591
1705
  >
1592
1706
  {rowCountContent != null && (
1593
- <span className="text-muted-foreground text-sm">
1707
+ <span className="text-body-sm text-muted-foreground whitespace-nowrap">
1594
1708
  {rowCountContent}
1595
1709
  </span>
1596
1710
  )}
1597
1711
  <DataTablePaginationNav
1598
1712
  ariaLabel={ariaLabel}
1713
+ className="grow"
1599
1714
  dataHook={`${dataHook}-nav`}
1600
1715
  />
1601
1716
  </div>
@@ -77,17 +77,17 @@ function useDatePickerContext() {
77
77
  const context = React.useContext(DatePickerContext);
78
78
  if (!context) {
79
79
  throw new Error(
80
- "DatePicker compound components must be used within DatePickerRoot"
80
+ "DatePicker compound components must be used within DatePicker"
81
81
  );
82
82
  }
83
83
  return context;
84
84
  }
85
85
 
86
86
  // ============================================================================
87
- // DatePickerRoot
87
+ // DatePicker (root)
88
88
  // ============================================================================
89
89
 
90
- export interface DatePickerRootProps {
90
+ export interface DatePickerProps {
91
91
  /**
92
92
  * Data hook for automated testing (REQUIRED)
93
93
  */
@@ -155,9 +155,9 @@ export interface DatePickerRootProps {
155
155
  }
156
156
 
157
157
  /**
158
- * DatePickerRoot - Root component that provides context for all DatePicker parts
158
+ * DatePicker - Root component that provides context for all DatePicker parts
159
159
  */
160
- function DatePickerRoot({
160
+ function DatePicker({
161
161
  children,
162
162
  dataHook,
163
163
  trackingEl,
@@ -173,7 +173,7 @@ function DatePickerRoot({
173
173
  open: controlledOpen,
174
174
  onOpenChange,
175
175
  defaultOpen = false,
176
- }: DatePickerRootProps) {
176
+ }: DatePickerProps) {
177
177
  const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
178
178
 
179
179
  const isControlled = controlledOpen !== undefined;
@@ -235,7 +235,17 @@ function DatePickerRoot({
235
235
  );
236
236
  }
237
237
 
238
- DatePickerRoot.displayName = "DatePickerRoot";
238
+ DatePicker.displayName = "DatePicker";
239
+
240
+ /**
241
+ * @deprecated Use `DatePicker` instead — family roots are bare names (DS-853).
242
+ */
243
+ const DatePickerRoot = DatePicker;
244
+
245
+ /**
246
+ * @deprecated Use `DatePickerProps` instead — family roots are bare names (DS-853).
247
+ */
248
+ export type DatePickerRootProps = DatePickerProps;
239
249
 
240
250
  // ============================================================================
241
251
  // DatePickerTrigger
@@ -594,6 +604,7 @@ DatePickerPresets.displayName = "DatePickerPresets";
594
604
  // ============================================================================
595
605
 
596
606
  export {
607
+ DatePicker,
597
608
  DatePickerRoot,
598
609
  DatePickerTrigger,
599
610
  DatePickerContent,
@@ -41,7 +41,7 @@ const Description = React.forwardRef<HTMLParagraphElement, DescriptionProps>(
41
41
  <p
42
42
  ref={ref}
43
43
  className={cn(
44
- "text-muted-foreground text-left text-sm",
44
+ "text-body-sm text-muted-foreground text-left",
45
45
  "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
46
46
  className
47
47
  )}
@@ -218,7 +218,7 @@ const DialogTitle = React.forwardRef<
218
218
  >(({ className, dataHook, ...props }, ref) => (
219
219
  <DialogPrimitive.Title
220
220
  ref={ref}
221
- className={cn("text-lg leading-none font-semibold", className)}
221
+ className={cn("text-heading-section", className)}
222
222
  data-hook={dataHook}
223
223
  data-slot="dialog-title"
224
224
  {...props}
@@ -249,7 +249,7 @@ const DialogDescription = React.forwardRef<
249
249
  >(({ className, dataHook, ...props }, ref) => (
250
250
  <DialogPrimitive.Description
251
251
  ref={ref}
252
- className={cn("text-muted-foreground text-sm", className)}
252
+ className={cn("text-body-sm text-muted-foreground", className)}
253
253
  data-hook={dataHook}
254
254
  data-slot="dialog-description"
255
255
  {...props}
@@ -196,10 +196,7 @@ function DrawerTitle({
196
196
  }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
197
197
  return (
198
198
  <DrawerPrimitive.Title
199
- className={cn(
200
- "text-foreground text-lg leading-none font-semibold",
201
- className
202
- )}
199
+ className={cn("text-foreground text-heading-section", className)}
203
200
  data-slot="drawer-title"
204
201
  {...props}
205
202
  />
@@ -217,7 +214,7 @@ function DrawerDescription({
217
214
  }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
218
215
  return (
219
216
  <DrawerPrimitive.Description
220
- className={cn("text-muted-foreground text-sm leading-normal", className)}
217
+ className={cn("text-body-sm text-muted-foreground", className)}
221
218
  data-slot="drawer-description"
222
219
  {...props}
223
220
  />
@@ -195,7 +195,7 @@ const DropdownMenuItem = React.forwardRef<
195
195
  className={cn(
196
196
  [
197
197
  "relative flex cursor-default items-center gap-2 self-stretch select-none",
198
- "rounded-sm px-2 py-1.5 text-sm leading-normal outline-hidden",
198
+ "text-label rounded-sm px-2 py-1.5 outline-hidden",
199
199
  // Text truncation for child text elements
200
200
  "[&>span]:overflow-hidden [&>span]:text-ellipsis [&>span]:whitespace-nowrap",
201
201
  "focus:bg-accent focus:text-accent-foreground",
@@ -263,7 +263,7 @@ const DropdownMenuCheckboxItem = React.forwardRef<
263
263
  className={cn(
264
264
  [
265
265
  "relative flex cursor-default items-center gap-2 select-none",
266
- "rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden",
266
+ "text-label rounded-sm py-1.5 pr-2 pl-8 outline-hidden",
267
267
  "focus:bg-accent focus:text-accent-foreground",
268
268
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
269
269
  // Icon styling
@@ -335,7 +335,7 @@ const DropdownMenuRadioItem = React.forwardRef<
335
335
  className={cn(
336
336
  [
337
337
  "relative flex cursor-default items-center gap-2 select-none",
338
- "rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden",
338
+ "text-label rounded-sm py-1.5 pr-2 pl-8 outline-hidden",
339
339
  "focus:bg-accent focus:text-accent-foreground",
340
340
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
341
341
  // Icon styling
@@ -387,10 +387,7 @@ const DropdownMenuLabel = React.forwardRef<
387
387
  <DropdownMenuPrimitive.Label
388
388
  ref={ref}
389
389
  className={cn(
390
- [
391
- "px-2 py-1.5 text-sm leading-normal font-semibold",
392
- "data-[inset]:pl-8",
393
- ],
390
+ ["text-label-sm px-2 py-1.5", "data-[inset]:pl-8"],
394
391
  className
395
392
  )}
396
393
  data-hook={dataHook}
@@ -432,7 +429,7 @@ function DropdownMenuShortcut({
432
429
  return (
433
430
  <span
434
431
  className={cn(
435
- ["text-popover-foreground ml-auto text-xs leading-normal opacity-60"],
432
+ ["text-popover-foreground text-body-xs ml-auto opacity-60"],
436
433
  className
437
434
  )}
438
435
  data-slot="dropdown-menu-shortcut"
@@ -500,7 +497,7 @@ const DropdownMenuSubTrigger = React.forwardRef<
500
497
  className={cn(
501
498
  [
502
499
  "flex cursor-default items-center gap-2 select-none",
503
- "rounded-sm px-2 py-1.5 text-sm outline-hidden",
500
+ "text-label rounded-sm px-2 py-1.5 outline-hidden",
504
501
  "focus:bg-accent focus:text-accent-foreground",
505
502
  "data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
506
503
  "data-[inset]:pl-8",
@@ -634,11 +631,11 @@ const DropdownMenuTriggerAvatar = React.forwardRef<
634
631
  >
635
632
  {avatar}
636
633
  <div className="flex min-w-0 flex-1 flex-col items-start">
637
- <span className="w-full overflow-hidden text-sm leading-normal font-semibold text-ellipsis whitespace-nowrap">
634
+ <span className="text-heading-compact w-full overflow-hidden text-ellipsis whitespace-nowrap">
638
635
  {title}
639
636
  </span>
640
637
  {description && (
641
- <span className="text-muted-foreground w-full overflow-hidden text-xs leading-normal text-ellipsis whitespace-nowrap">
638
+ <span className="text-muted-foreground text-body-xs w-full overflow-hidden text-ellipsis whitespace-nowrap">
642
639
  {description}
643
640
  </span>
644
641
  )}