@brightlocal/ui-components 2.24.1 → 2.26.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 (162) hide show
  1. package/README.md +3 -2
  2. package/component-meta.json +331 -91
  3. package/dist/accordion.cjs +1 -1
  4. package/dist/accordion.js +2 -2
  5. package/dist/alert-dialog.cjs +1 -1
  6. package/dist/alert-dialog.js +17 -17
  7. package/dist/alert.cjs +1 -1
  8. package/dist/alert.d.ts +23 -9
  9. package/dist/alert.d.ts.map +1 -1
  10. package/dist/alert.js +95 -87
  11. package/dist/badge.cjs +1 -1
  12. package/dist/badge.js +9 -9
  13. package/dist/blocks/input-list.cjs +2 -2
  14. package/dist/blocks/input-list.d.ts.map +1 -1
  15. package/dist/blocks/input-list.js +43 -46
  16. package/dist/blocks/sidebar.cjs +1 -1
  17. package/dist/blocks/sidebar.js +14 -14
  18. package/dist/brand-illustration-motif.cjs +1 -1
  19. package/dist/brand-illustration-motif.js +11 -11
  20. package/dist/breadcrumb.cjs +1 -1
  21. package/dist/breadcrumb.js +1 -1
  22. package/dist/button.cjs +1 -1
  23. package/dist/button.js +10 -10
  24. package/dist/card.cjs +1 -1
  25. package/dist/card.js +1 -1
  26. package/dist/carousel.cjs +1 -1
  27. package/dist/carousel.js +12 -12
  28. package/dist/checkbox.cjs +1 -1
  29. package/dist/checkbox.js +7 -7
  30. package/dist/chip.cjs +1 -1
  31. package/dist/chip.js +7 -7
  32. package/dist/combobox.cjs +1 -1
  33. package/dist/combobox.js +1 -1
  34. package/dist/data-table.cjs +1 -1
  35. package/dist/data-table.d.ts +46 -1
  36. package/dist/data-table.d.ts.map +1 -1
  37. package/dist/data-table.js +8 -1
  38. package/dist/dialog.cjs +1 -1
  39. package/dist/dialog.js +61 -61
  40. package/dist/field.cjs +1 -1
  41. package/dist/field.js +1 -1
  42. package/dist/height-transition.cjs +1 -0
  43. package/dist/height-transition.d.ts +44 -0
  44. package/dist/height-transition.d.ts.map +1 -0
  45. package/dist/height-transition.js +63 -0
  46. package/dist/index.cjs +1 -1
  47. package/dist/index.d.ts +1 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +326 -324
  50. package/dist/input-chip.cjs +1 -1
  51. package/dist/input-chip.js +2 -2
  52. package/dist/input-group.cjs +1 -1
  53. package/dist/input-group.js +15 -15
  54. package/dist/input-otp.cjs +1 -1
  55. package/dist/input-otp.js +1 -1
  56. package/dist/input.cjs +1 -1
  57. package/dist/input.js +1 -1
  58. package/dist/lib/motion.cjs +1 -0
  59. package/dist/lib/motion.d.ts +70 -0
  60. package/dist/lib/motion.d.ts.map +1 -0
  61. package/dist/lib/motion.js +25 -0
  62. package/dist/lib/utils.cjs +1 -1
  63. package/dist/lib/utils.d.ts +1 -1
  64. package/dist/lib/utils.d.ts.map +1 -1
  65. package/dist/lib/utils.js +12 -4
  66. package/dist/link.cjs +1 -1
  67. package/dist/link.d.ts +6 -5
  68. package/dist/link.d.ts.map +1 -1
  69. package/dist/link.js +69 -94
  70. package/dist/list.cjs +1 -1
  71. package/dist/list.js +10 -10
  72. package/dist/loading.cjs +1 -1
  73. package/dist/loading.d.ts.map +1 -1
  74. package/dist/loading.js +45 -47
  75. package/dist/map.cjs +1 -1
  76. package/dist/map.d.ts.map +1 -1
  77. package/dist/map.js +2 -2
  78. package/dist/menubar.cjs +1 -1
  79. package/dist/menubar.js +5 -5
  80. package/dist/navigation-menu.cjs +1 -1
  81. package/dist/navigation-menu.js +13 -13
  82. package/dist/pagination.cjs +1 -1
  83. package/dist/pagination.js +1 -1
  84. package/dist/progress.cjs +1 -1
  85. package/dist/progress.d.ts.map +1 -1
  86. package/dist/progress.js +21 -25
  87. package/dist/radio-group.cjs +1 -1
  88. package/dist/radio-group.js +12 -12
  89. package/dist/scroll-area.cjs +1 -1
  90. package/dist/scroll-area.js +11 -11
  91. package/dist/select.cjs +1 -1
  92. package/dist/select.js +12 -12
  93. package/dist/sheet.cjs +1 -1
  94. package/dist/sheet.d.ts.map +1 -1
  95. package/dist/sheet.js +54 -50
  96. package/dist/slider.cjs +1 -1
  97. package/dist/slider.js +13 -13
  98. package/dist/stepper.cjs +1 -1
  99. package/dist/stepper.js +4 -4
  100. package/dist/switch.cjs +1 -1
  101. package/dist/switch.js +5 -5
  102. package/dist/table.cjs +1 -1
  103. package/dist/table.js +2 -2
  104. package/dist/tabs.cjs +1 -1
  105. package/dist/tabs.js +1 -1
  106. package/dist/text-reveal-motion.cjs +1 -1
  107. package/dist/text-reveal-motion.d.ts.map +1 -1
  108. package/dist/text-reveal-motion.js +77 -79
  109. package/dist/textarea.cjs +1 -1
  110. package/dist/textarea.js +11 -11
  111. package/dist/toggle.cjs +1 -1
  112. package/dist/toggle.js +5 -5
  113. package/package.json +10 -4
  114. package/src/blocks/input-list.tsx +3 -6
  115. package/src/blocks/sidebar.tsx +14 -14
  116. package/src/components/accordion.tsx +2 -2
  117. package/src/components/alert-dialog.tsx +2 -2
  118. package/src/components/alert.tsx +68 -33
  119. package/src/components/badge.tsx +1 -1
  120. package/src/components/brand-illustration-motif.tsx +1 -1
  121. package/src/components/breadcrumb.tsx +1 -1
  122. package/src/components/button.tsx +2 -2
  123. package/src/components/card.tsx +1 -1
  124. package/src/components/carousel.tsx +1 -1
  125. package/src/components/checkbox.tsx +1 -1
  126. package/src/components/chip.tsx +2 -2
  127. package/src/components/combobox.tsx +1 -1
  128. package/src/components/data-table.tsx +54 -2
  129. package/src/components/dialog.tsx +3 -3
  130. package/src/components/field.tsx +1 -1
  131. package/src/components/height-transition.tsx +164 -0
  132. package/src/components/input-chip.tsx +2 -2
  133. package/src/components/input-group.tsx +2 -2
  134. package/src/components/input-otp.tsx +1 -1
  135. package/src/components/input.tsx +1 -1
  136. package/src/components/link.tsx +59 -67
  137. package/src/components/list.tsx +1 -1
  138. package/src/components/loading.tsx +2 -15
  139. package/src/components/map.tsx +3 -2
  140. package/src/components/menubar.tsx +5 -5
  141. package/src/components/navigation-menu.tsx +6 -6
  142. package/src/components/pagination.tsx +1 -1
  143. package/src/components/progress.tsx +2 -10
  144. package/src/components/radio-group.tsx +1 -1
  145. package/src/components/scroll-area.tsx +2 -2
  146. package/src/components/select.tsx +1 -1
  147. package/src/components/sheet.tsx +9 -5
  148. package/src/components/slider.tsx +1 -1
  149. package/src/components/stepper.tsx +4 -4
  150. package/src/components/switch.tsx +2 -2
  151. package/src/components/table.tsx +2 -2
  152. package/src/components/tabs.tsx +1 -1
  153. package/src/components/text-reveal-motion.tsx +3 -8
  154. package/src/components/textarea.tsx +1 -1
  155. package/src/components/toggle.tsx +1 -1
  156. package/src/index.ts +1 -0
  157. package/src/lib/motion.ts +75 -0
  158. package/src/lib/utils.ts +14 -2
  159. package/dist/browser-entry.d.ts +0 -19
  160. package/dist/browser-entry.d.ts.map +0 -1
  161. package/src/browser-entry.ts +0 -99
  162. package/src/browser-tokens.css +0 -1
@@ -178,14 +178,14 @@ const AccordionTrigger = React.forwardRef<
178
178
  <AccordionPrimitive.Trigger
179
179
  ref={ref}
180
180
  className={cn(
181
- "focus-visible:border-ring focus-visible:shadow-default flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-shadow outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
181
+ "focus-visible:border-ring focus-visible:shadow-default duration-fast flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-shadow ease-out outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
182
182
  className
183
183
  )}
184
184
  data-slot="accordion-trigger"
185
185
  {...props}
186
186
  >
187
187
  {children}
188
- <ChevronDown className="text-muted-foreground pointer-events-none shrink-0 translate-y-0.5 transition-transform duration-200" />
188
+ <ChevronDown className="text-muted-foreground duration-base pointer-events-none shrink-0 translate-y-0.5 transition-transform ease-in-out" />
189
189
  </AccordionPrimitive.Trigger>
190
190
  </AccordionPrimitive.Header>
191
191
  ));
@@ -71,7 +71,7 @@ const AlertDialogOverlay = React.forwardRef<
71
71
  <AlertDialogPrimitive.Overlay
72
72
  ref={ref}
73
73
  className={cn(
74
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
74
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:duration-slow fixed inset-0 z-50 bg-black/50 ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in",
75
75
  className
76
76
  )}
77
77
  data-slot="alert-dialog-overlay"
@@ -94,7 +94,7 @@ const AlertDialogContent = React.forwardRef<
94
94
  <AlertDialogPrimitive.Content
95
95
  ref={ref}
96
96
  className={cn(
97
- "border-border bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
97
+ "border-border bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=open]:duration-slow fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in sm:max-w-lg",
98
98
  className
99
99
  )}
100
100
  data-slot="alert-dialog-content"
@@ -63,15 +63,7 @@ const AlertDescription = React.forwardRef<
63
63
  ));
64
64
  AlertDescription.displayName = "AlertDescription";
65
65
 
66
- interface AlertContentProps {
67
- /**
68
- * Optional title for the alert
69
- */
70
- title?: string;
71
- /**
72
- * Description text for the alert (REQUIRED)
73
- */
74
- description: React.ReactNode;
66
+ interface AlertContentBaseProps {
75
67
  /**
76
68
  * Additional CSS classes
77
69
  */
@@ -94,6 +86,33 @@ interface AlertContentProps {
94
86
  trackingLabel?: string;
95
87
  }
96
88
 
89
+ /**
90
+ * At least one of `title` or `description` must be provided.
91
+ */
92
+ type AlertContentProps = AlertContentBaseProps &
93
+ (
94
+ | {
95
+ /**
96
+ * Title for the alert
97
+ */
98
+ title: string;
99
+ /**
100
+ * Optional description text for the alert
101
+ */
102
+ description?: React.ReactNode;
103
+ }
104
+ | {
105
+ /**
106
+ * Optional title for the alert
107
+ */
108
+ title?: string;
109
+ /**
110
+ * Description text for the alert
111
+ */
112
+ description: React.ReactNode;
113
+ }
114
+ );
115
+
97
116
  function AlertSuccess({
98
117
  title,
99
118
  description,
@@ -105,18 +124,22 @@ function AlertSuccess({
105
124
  }: AlertContentProps) {
106
125
  return (
107
126
  <Alert
108
- className={className}
127
+ className={cn("items-center", className)}
109
128
  data-hook={dataHook}
110
129
  data-tracking-el={trackingEl}
111
130
  data-tracking-label={trackingLabel}
112
131
  variant="success"
113
132
  >
114
- <CircleCheck className="text-success-foreground shrink-0 translate-y-0.5" />
115
- <div className="flex min-w-0 flex-1 flex-col gap-1">
116
- {title && <AlertTitle>{title}</AlertTitle>}
117
- <AlertDescription>{description}</AlertDescription>
133
+ <div className="flex min-w-0 flex-1 items-start gap-3">
134
+ <CircleCheck className="text-success-foreground shrink-0 translate-y-0.5" />
135
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
136
+ {title && <AlertTitle>{title}</AlertTitle>}
137
+ {description != null && (
138
+ <AlertDescription>{description}</AlertDescription>
139
+ )}
140
+ </div>
118
141
  </div>
119
- {action && <div className="self-center">{action}</div>}
142
+ {action && <div className="shrink-0 self-center">{action}</div>}
120
143
  </Alert>
121
144
  );
122
145
  }
@@ -132,18 +155,22 @@ function AlertInfo({
132
155
  }: AlertContentProps) {
133
156
  return (
134
157
  <Alert
135
- className={className}
158
+ className={cn("items-center", className)}
136
159
  data-hook={dataHook}
137
160
  data-tracking-el={trackingEl}
138
161
  data-tracking-label={trackingLabel}
139
162
  variant="info"
140
163
  >
141
- <Info className="text-info-foreground shrink-0 translate-y-0.5" />
142
- <div className="flex min-w-0 flex-1 flex-col gap-1">
143
- {title && <AlertTitle>{title}</AlertTitle>}
144
- <AlertDescription>{description}</AlertDescription>
164
+ <div className="flex min-w-0 flex-1 items-start gap-3">
165
+ <Info className="text-info-foreground shrink-0 translate-y-0.5" />
166
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
167
+ {title && <AlertTitle>{title}</AlertTitle>}
168
+ {description != null && (
169
+ <AlertDescription>{description}</AlertDescription>
170
+ )}
171
+ </div>
145
172
  </div>
146
- {action && <div className="self-center">{action}</div>}
173
+ {action && <div className="shrink-0 self-center">{action}</div>}
147
174
  </Alert>
148
175
  );
149
176
  }
@@ -159,18 +186,22 @@ function AlertDestructive({
159
186
  }: AlertContentProps) {
160
187
  return (
161
188
  <Alert
162
- className={className}
189
+ className={cn("items-center", className)}
163
190
  data-hook={dataHook}
164
191
  data-tracking-el={trackingEl}
165
192
  data-tracking-label={trackingLabel}
166
193
  variant="destructive"
167
194
  >
168
- <CircleX className="text-destructive-foreground shrink-0 translate-y-0.5" />
169
- <div className="flex min-w-0 flex-1 flex-col gap-1">
170
- {title && <AlertTitle>{title}</AlertTitle>}
171
- <AlertDescription>{description}</AlertDescription>
195
+ <div className="flex min-w-0 flex-1 items-start gap-3">
196
+ <CircleX className="text-destructive-foreground shrink-0 translate-y-0.5" />
197
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
198
+ {title && <AlertTitle>{title}</AlertTitle>}
199
+ {description != null && (
200
+ <AlertDescription>{description}</AlertDescription>
201
+ )}
202
+ </div>
172
203
  </div>
173
- {action && <div className="self-center">{action}</div>}
204
+ {action && <div className="shrink-0 self-center">{action}</div>}
174
205
  </Alert>
175
206
  );
176
207
  }
@@ -186,18 +217,22 @@ function AlertWarning({
186
217
  }: AlertContentProps) {
187
218
  return (
188
219
  <Alert
189
- className={className}
220
+ className={cn("items-center", className)}
190
221
  data-hook={dataHook}
191
222
  data-tracking-el={trackingEl}
192
223
  data-tracking-label={trackingLabel}
193
224
  variant="warning"
194
225
  >
195
- <TriangleAlert className="text-warning-foreground shrink-0 translate-y-0.5" />
196
- <div className="flex min-w-0 flex-1 flex-col gap-1">
197
- {title && <AlertTitle>{title}</AlertTitle>}
198
- <AlertDescription>{description}</AlertDescription>
226
+ <div className="flex min-w-0 flex-1 items-start gap-3">
227
+ <TriangleAlert className="text-warning-foreground shrink-0 translate-y-0.5" />
228
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
229
+ {title && <AlertTitle>{title}</AlertTitle>}
230
+ {description != null && (
231
+ <AlertDescription>{description}</AlertDescription>
232
+ )}
233
+ </div>
199
234
  </div>
200
- {action && <div className="self-center">{action}</div>}
235
+ {action && <div className="shrink-0 self-center">{action}</div>}
201
236
  </Alert>
202
237
  );
203
238
  }
@@ -15,7 +15,7 @@ const badgeVariants = cva(
15
15
  // Icons
16
16
  "[&>svg]:size-3 [&>svg]:pointer-events-none",
17
17
  // Transition
18
- "transition-[color,background-color,border-color,box-shadow] duration-150 ease-in-out",
18
+ "transition-[color,background-color,border-color,box-shadow] duration-fast ease-out",
19
19
  // Focus
20
20
  "focus-visible:outline-none",
21
21
  "focus-visible:shadow-[0_0_0_1px_white,0_0_0_2px_var(--color-ring),0_0_0_4px_rgba(0,0,0,0.1)]",
@@ -123,7 +123,7 @@ const BrandIllustrationMotif = React.forwardRef<
123
123
  >
124
124
  <div
125
125
  aria-hidden="true"
126
- className={cn("absolute inset-0", spinning && "animate-motif-spin")}
126
+ className={cn("absolute inset-0", spinning && "animate-ambient-spin")}
127
127
  >
128
128
  <MotifIcon className="size-full" size="100%" />
129
129
  </div>
@@ -109,7 +109,7 @@ const BreadcrumbLink = React.forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>(
109
109
  <Comp
110
110
  ref={ref}
111
111
  className={cn(
112
- "hover:text-foreground focus-visible:shadow-default rounded-sm transition-colors outline-none",
112
+ "hover:text-foreground focus-visible:shadow-default duration-fast rounded-sm transition-colors ease-out outline-none",
113
113
  className
114
114
  )}
115
115
  data-slot="breadcrumb-link"
@@ -43,8 +43,8 @@ const ButtonVariants = cva(
43
43
  "gap-2",
44
44
  "whitespace-nowrap",
45
45
  "transition-[color,background-color,border-color,box-shadow,opacity]",
46
- "duration-150",
47
- "ease-in-out",
46
+ "duration-fast",
47
+ "ease-out",
48
48
  "cursor-pointer",
49
49
  "disabled:pointer-events-none",
50
50
  "disabled:cursor-not-allowed",
@@ -32,7 +32,7 @@ const cardVariants = cva(
32
32
  "flex",
33
33
  "flex-col",
34
34
  "rounded-xl",
35
- "transition-colors",
35
+ "transition-colors duration-fast ease-out",
36
36
  "w-full",
37
37
  "max-w-[400px]",
38
38
  ],
@@ -586,7 +586,7 @@ function CarouselDots({
586
586
  : `Go to slide ${index + 1}`
587
587
  }
588
588
  className={cn(
589
- "focus-visible:shadow-default size-3 rounded-full transition-[width,background-color] duration-200 ease-out outline-none",
589
+ "focus-visible:shadow-default duration-base size-3 rounded-full transition-[width,background-color] ease-in-out outline-none",
590
590
  index === selectedIndex
591
591
  ? "bg-muted-foreground/50 dark:bg-muted-foreground/70 w-9"
592
592
  : "bg-input hover:bg-muted-foreground/30 dark:bg-input/80 dark:hover:bg-muted-foreground/50"
@@ -10,7 +10,7 @@ const checkboxVariants = cva(
10
10
  // Layout & Size
11
11
  "size-[18px] shrink-0 self-start mt-0.5",
12
12
  // Appearance
13
- "bg-background peer border border-ring dark:bg-input/30 rounded-xs transition-colors outline-none",
13
+ "bg-background peer border border-ring dark:bg-input/30 rounded-xs transition-colors duration-fast ease-out outline-none",
14
14
  // Checked State
15
15
  "data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary",
16
16
  // Focus States
@@ -34,8 +34,8 @@ const chipVariants = cva(
34
34
  "text-foreground",
35
35
  // Transitions
36
36
  "transition-[color,background-color,box-shadow]",
37
- "duration-150",
38
- "ease-in-out",
37
+ "duration-fast",
38
+ "ease-out",
39
39
  // Hover state
40
40
  "hover:bg-secondary/80",
41
41
  // Focus state - direct focus on chip (for keyboard navigation)
@@ -399,7 +399,7 @@ const comboboxTriggerVariants = cva([
399
399
  "disabled:cursor-not-allowed disabled:opacity-50",
400
400
 
401
401
  // Transitions
402
- "transition-[background-color,border-color,box-shadow] duration-200 ease-out",
402
+ "transition-[background-color,border-color,box-shadow] duration-fast ease-out",
403
403
 
404
404
  // Icon styles
405
405
  "[&_svg]:pointer-events-none [&_svg]:shrink-0",
@@ -162,7 +162,16 @@ export interface UseDataTableOptions<TData> {
162
162
 
163
163
  // ---------- Common features ----------
164
164
 
165
- /** Enable column sorting. @default true */
165
+ /**
166
+ * Enable column sorting. Set to `false` to disable sorting for every
167
+ * column — `column.getCanSort()` returns `false`, so
168
+ * `DataTableColumnHeader` renders plain titles with no sort buttons and
169
+ * no `aria-sort`. TanStack ANDs this flag with each column def's own
170
+ * `enableSorting`: per-column `false` opts a column out under the
171
+ * default, but per-column `true` cannot re-enable sorting when this
172
+ * table-level flag is `false`.
173
+ * @default true
174
+ */
166
175
  enableSorting?: boolean;
167
176
  /** Enable global text search across rows (substring match). @default false */
168
177
  enableGlobalFiltering?: boolean;
@@ -247,6 +256,13 @@ export interface UseDataTableOptions<TData> {
247
256
  * consumers to pass into `DataTable`, `DataTablePagination`,
248
257
  * `DataTableSearch`, etc.
249
258
  *
259
+ * Sorting is resolved per column: TanStack ANDs the table-level
260
+ * `enableSorting` flag (default `true`) with each column def's own
261
+ * `enableSorting`. Three cases — all columns sortable (default, configure
262
+ * nothing), whole table unsortable (`enableSorting: false` on the hook), or
263
+ * mixed (keep the table-level default and set `enableSorting: false` on the
264
+ * individual column defs that must not sort).
265
+ *
250
266
  * @example
251
267
  * const table = useDataTable({
252
268
  * columns,
@@ -334,6 +350,10 @@ export function useDataTable<TData>(
334
350
  ...(pageCount != null && { pageCount }),
335
351
  }),
336
352
 
353
+ // Always forward the flag — TanStack defaults `enableSorting` to true,
354
+ // so omitting it would leave `column.getCanSort()` returning true even
355
+ // when the consumer disabled sorting table-wide.
356
+ enableSorting,
337
357
  ...(enableSorting && {
338
358
  ...(!manualSorting && {
339
359
  getSortedRowModel: getSortedRowModel(),
@@ -351,8 +371,11 @@ export function useDataTable<TData>(
351
371
  globalFilterFn: "includesString",
352
372
  }),
353
373
 
374
+ // Always forward — TanStack defaults `enableRowSelection` to true, so
375
+ // omitting it would leave `row.getCanSelect()` returning true and
376
+ // `DataTableSelectRowCheckbox` enabled on tables without selection.
377
+ enableRowSelection,
354
378
  ...(enableRowSelection && {
355
- enableRowSelection: true,
356
379
  onRowSelectionChange: setRowSelectionState,
357
380
  }),
358
381
 
@@ -447,9 +470,33 @@ export interface DataTableProps<TData> {
447
470
  * the table primitives. Keep it focused on rendering — toolbars, search,
448
471
  * pagination, etc. are composed around it.
449
472
  *
473
+ * **Compose as one slot.** The table and its companions — `DataTableToolbar`
474
+ * rows (search, filters, pagination, counters), `DataTableBulkActions` — form
475
+ * a single unit. When the parent lays out its children with a gap (e.g.
476
+ * `DialogContent` with `gap-8`, a Card body, a page section), wrap the whole
477
+ * unit in one flex-column container so the parent's gap applies around the
478
+ * table block, not between the toolbars and the table. Vertical rhythm inside
479
+ * the block comes from the toolbars' built-in padding — don't add custom
480
+ * margins between the parts.
481
+ *
450
482
  * @example
451
483
  * const table = useDataTable({ columns, data, enableSorting: true });
452
484
  * return <DataTable table={table} dataHook="my-table" />;
485
+ *
486
+ * @example
487
+ * // One slot inside a gapped parent (dialog, card, page section).
488
+ * // min-h-0/flex-1 keep the table scrollable in height-capped parents.
489
+ * <div className="flex min-h-0 flex-1 flex-col">
490
+ * <DataTableToolbar dataHook="toolbar-top">
491
+ * <DataTableToolbarLeft>{heading or search}</DataTableToolbarLeft>
492
+ * <DataTableToolbarRight>{filters}</DataTableToolbarRight>
493
+ * </DataTableToolbar>
494
+ * <DataTable table={table} dataHook="my-table" className="min-h-0 flex-1 overflow-y-auto" />
495
+ * <DataTableToolbar dataHook="toolbar-bottom">
496
+ * <DataTableToolbarLeft>{selection counter}</DataTableToolbarLeft>
497
+ * <DataTableToolbarRight>{pagination}</DataTableToolbarRight>
498
+ * </DataTableToolbar>
499
+ * </div>
453
500
  */
454
501
  export function DataTable<TData>({
455
502
  table,
@@ -1792,6 +1839,11 @@ export interface DataTableToolbarProps {
1792
1839
  * row on `sm:` and up. Layout-only — no dependency on a TanStack Table
1793
1840
  * instance, so it works for table footers or any search-plus-pagination row.
1794
1841
  *
1842
+ * Toolbars belong in the same flex-column container as their `DataTable` so
1843
+ * the group reads as one slot inside gapped parents — see the composition
1844
+ * note on `DataTable`. The built-in vertical padding provides the spacing
1845
+ * between a toolbar and its table; don't add custom margins or padding.
1846
+ *
1795
1847
  * @example
1796
1848
  * <DataTableToolbar dataHook="locations-toolbar">
1797
1849
  * <DataTableToolbarLeft>
@@ -77,7 +77,7 @@ const DialogOverlay = React.forwardRef<
77
77
  <DialogPrimitive.Overlay
78
78
  ref={ref}
79
79
  className={cn(
80
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
80
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:duration-slow fixed inset-0 z-50 bg-black/50 ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in",
81
81
  className
82
82
  )}
83
83
  data-slot="dialog-overlay"
@@ -137,7 +137,7 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
137
137
  <DialogPrimitive.Content
138
138
  ref={ref}
139
139
  className={cn(
140
- "bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-card-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border p-8 shadow-lg duration-200 sm:max-w-lg",
140
+ "bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-card-border data-[state=open]:duration-slow fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border p-8 shadow-lg ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in sm:max-w-lg",
141
141
  className
142
142
  )}
143
143
  data-hook={dataHook}
@@ -147,7 +147,7 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
147
147
  {...props}
148
148
  >
149
149
  {children}
150
- <DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-8 right-8 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0">
150
+ <DialogPrimitive.Close className="ring-offset-background focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground duration-fast absolute top-8 right-8 rounded-xs opacity-70 outline-hidden transition-opacity ease-out hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0">
151
151
  <X />
152
152
  <span className="sr-only">{closeLabel ?? "Close"}</span>
153
153
  </DialogPrimitive.Close>
@@ -118,7 +118,7 @@ const fieldVariants = cva(
118
118
  box: [
119
119
  "relative cursor-pointer gap-3",
120
120
  "rounded-lg border border-border bg-background p-3",
121
- "transition-colors",
121
+ "transition-colors duration-fast ease-out",
122
122
  "[&_[data-slot=field-label]]:after:absolute [&_[data-slot=field-label]]:after:inset-0 [&_[data-slot=field-label]]:after:cursor-pointer",
123
123
  // Focus ring when a child control receives focus
124
124
  "has-[:focus-visible]:shadow-default has-[:focus-visible]:border-ring",
@@ -0,0 +1,164 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+
5
+ import { cn } from "@brightlocal/ui-components/lib/utils";
6
+
7
+ /**
8
+ * Result of {@link useHeightTransition}: attach `contentRef` to the element
9
+ * whose natural height should be tracked, and apply `height` (px) to the
10
+ * clipping wrapper around it.
11
+ */
12
+ interface UseHeightTransitionResult {
13
+ /** Ref for the inner content element the hook measures. */
14
+ contentRef: React.RefObject<HTMLDivElement | null>;
15
+ /**
16
+ * Measured content height in pixels, or `undefined` before the first
17
+ * measurement (render `auto` until then so mounting never animates).
18
+ */
19
+ height: number | undefined;
20
+ }
21
+
22
+ /**
23
+ * Measures an element's natural height with a ResizeObserver so a wrapper
24
+ * can set an explicit pixel height and CSS-transition between values —
25
+ * the same idea the Accordion uses (`--radix-accordion-content-height`),
26
+ * generalized to arbitrary content changes.
27
+ *
28
+ * Module-private on purpose: no external consumer exists yet, and keeping it
29
+ * out of the public API leaves the ref/height contract free to change.
30
+ */
31
+ function useHeightTransition(): UseHeightTransitionResult {
32
+ const contentRef = React.useRef<HTMLDivElement>(null);
33
+ const [height, setHeight] = React.useState<number>();
34
+
35
+ React.useLayoutEffect(() => {
36
+ const node = contentRef.current;
37
+ if (!node) {
38
+ return;
39
+ }
40
+ // Missing in some non-browser runtimes (e.g. jsdom without a polyfill);
41
+ // height stays undefined there, so the wrapper renders `auto` with no
42
+ // animation instead of throwing.
43
+ if (typeof ResizeObserver === "undefined") {
44
+ return;
45
+ }
46
+ const observer = new ResizeObserver((entries) => {
47
+ // A display:none ancestor reports size 0 — keep the last real height
48
+ // so re-showing doesn't animate the content open from 0px.
49
+ if (node.offsetParent === null) {
50
+ return;
51
+ }
52
+ const entry = entries[0];
53
+ const next =
54
+ entry?.borderBoxSize?.[0]?.blockSize ??
55
+ node.getBoundingClientRect().height;
56
+ setHeight(next);
57
+ });
58
+ // No manual first measurement: observe() always delivers an initial
59
+ // entry, and getBoundingClientRect would bake ancestor entrance
60
+ // transforms (e.g. the Dialog's zoom-in-95) into the recorded height —
61
+ // the observer's borderBoxSize doesn't.
62
+ observer.observe(node);
63
+ return () => observer.disconnect();
64
+ }, []);
65
+
66
+ return { contentRef, height };
67
+ }
68
+
69
+ /**
70
+ * Props for the HeightTransition component.
71
+ * Extends native `<div>` props with testing and analytics attributes.
72
+ */
73
+ export interface HeightTransitionProps extends React.ComponentPropsWithoutRef<"div"> {
74
+ /**
75
+ * Data hook for automated testing (required).
76
+ * @example "suggest-prompts-list-height"
77
+ */
78
+ dataHook: string;
79
+ /** Tracking element identifier for analytics. */
80
+ trackingEl?: string;
81
+ /** Tracking label for analytics context. */
82
+ trackingLabel?: string;
83
+ }
84
+
85
+ /**
86
+ * Smoothly transitions its own height whenever the children's natural
87
+ * height changes (content swap, filtering, inline expansion). A
88
+ * ResizeObserver measures the content and the wrapper transitions an
89
+ * explicit pixel height over `duration-base` with `ease-out` (matching the
90
+ * Accordion's reveal timing), clipping overflow while the transition runs.
91
+ *
92
+ * The anchor point of the resize comes from the surrounding layout, not from
93
+ * this component: in normal flow the top edge is pinned and growth extends
94
+ * downward; inside a vertically centered parent (a Dialog's
95
+ * `top-[50%] translate-y-[-50%]`, or `grid place-items-center`) the same
96
+ * transition reshapes around the center with both edges moving. Pick the
97
+ * parent positioning to pick the motion.
98
+ *
99
+ * Reduced motion is handled by the DS global kill-switch — no
100
+ * component-level handling needed or allowed.
101
+ *
102
+ * Note: animating `height` reflows on every frame — reserve this for
103
+ * occasional content swaps (dialogs, panels), not for anything that
104
+ * resizes continuously.
105
+ *
106
+ * @example
107
+ * <HeightTransition dataHook="results-height">
108
+ * {loading ? <ResultsSkeleton /> : <Results items={items} />}
109
+ * </HeightTransition>
110
+ */
111
+ export const HeightTransition = React.forwardRef<
112
+ HTMLDivElement,
113
+ HeightTransitionProps
114
+ >(
115
+ (
116
+ {
117
+ className,
118
+ style,
119
+ dataHook,
120
+ trackingEl,
121
+ trackingLabel,
122
+ children,
123
+ ...props
124
+ },
125
+ ref
126
+ ) => {
127
+ const { contentRef, height } = useHeightTransition();
128
+
129
+ return (
130
+ <div
131
+ ref={ref}
132
+ className={cn(
133
+ "duration-base overflow-hidden transition-[height] ease-out",
134
+ className
135
+ )}
136
+ data-hook={dataHook}
137
+ data-slot="height-transition"
138
+ data-tracking-el={trackingEl || "height-transition"}
139
+ data-tracking-label={trackingLabel}
140
+ // Managed height last: the component's one job is controlling
141
+ // height, so a consumer style={{height}} must not silently
142
+ // disable the transition (and clip content).
143
+ style={{
144
+ ...style,
145
+ height,
146
+ }}
147
+ {...props}
148
+ >
149
+ {/* flow-root keeps children's vertical margins inside the measured
150
+ border-box — otherwise they collapse through this div and the
151
+ wrapper's overflow-hidden clips the uncounted space. */}
152
+ <div
153
+ ref={contentRef}
154
+ className="flow-root"
155
+ data-slot="height-transition-content"
156
+ >
157
+ {children}
158
+ </div>
159
+ </div>
160
+ );
161
+ }
162
+ );
163
+
164
+ HeightTransition.displayName = "HeightTransition";
@@ -251,8 +251,8 @@ const inputChipInputVariants = cva(
251
251
  "has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50",
252
252
  // Transition
253
253
  "transition-[color,box-shadow,border-color]",
254
- "duration-150",
255
- "ease-in-out",
254
+ "duration-fast",
255
+ "ease-out",
256
256
  ],
257
257
  {
258
258
  variants: {
@@ -8,7 +8,7 @@ import { cn } from "@brightlocal/ui-components/lib/utils";
8
8
  import { Input, type InputProps } from "./input";
9
9
 
10
10
  const inputGroupVariants = cva(
11
- "relative flex w-full items-center rounded-sm border border-input bg-background transition-colors has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-default has-[:disabled]:opacity-50",
11
+ "relative flex w-full items-center rounded-sm border border-input bg-background transition-[color,background-color,border-color,box-shadow] duration-fast ease-out has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-default has-[:disabled]:opacity-50",
12
12
  {
13
13
  variants: {
14
14
  size: {
@@ -137,7 +137,7 @@ InputGroupAddon.displayName = "InputGroupAddon";
137
137
  const inputGroupButtonVariants = cva(
138
138
  [
139
139
  "inline-flex items-center justify-center gap-2",
140
- "text-sm font-medium transition-colors",
140
+ "text-sm font-medium transition-colors duration-fast ease-out",
141
141
  "outline-none focus-visible:shadow-default rounded-sm",
142
142
  "disabled:pointer-events-none disabled:opacity-50",
143
143
  "text-muted-foreground hover:text-foreground",
@@ -137,7 +137,7 @@ function InputOTPSlot({ index, className, ...props }: InputOTPSlotProps) {
137
137
  // Base styles
138
138
  "relative flex h-9 w-9 items-center justify-center",
139
139
  "border-input bg-background border-y border-r",
140
- "text-foreground text-base font-normal transition-[border-color,box-shadow] outline-none",
140
+ "text-foreground duration-fast text-base font-normal transition-[border-color,box-shadow] ease-out outline-none",
141
141
  "first:rounded-l-md first:border-l last:rounded-r-md",
142
142
  // Focus state
143
143
  "data-[active=true]:border-ring data-[active=true]:z-10",
@@ -14,7 +14,7 @@ export const inputVariants = cva(
14
14
  "flex w-full min-w-0 h-9",
15
15
  // Appearance
16
16
  "border border-input bg-background rounded-sm",
17
- "outline-none transition-[border-color,box-shadow,background-color]",
17
+ "outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
18
18
  // Typography
19
19
  "text-base font-sans",
20
20
  "text-foreground",