@brightlocal/ui-components 3.4.0 → 3.5.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 (196) hide show
  1. package/AI_USAGE.md +22 -3
  2. package/README.md +177 -109
  3. package/component-meta.json +1061 -102
  4. package/dist/alert-dialog.cjs +1 -1
  5. package/dist/alert-dialog.d.ts +13 -2
  6. package/dist/alert-dialog.d.ts.map +1 -1
  7. package/dist/alert-dialog.js +4 -3
  8. package/dist/banner.cjs +1 -1
  9. package/dist/banner.d.ts +47 -11
  10. package/dist/banner.d.ts.map +1 -1
  11. package/dist/banner.js +156 -79
  12. package/dist/blocks/empty-state.cjs +1 -1
  13. package/dist/blocks/empty-state.d.ts +40 -5
  14. package/dist/blocks/empty-state.d.ts.map +1 -1
  15. package/dist/blocks/empty-state.js +59 -52
  16. package/dist/blocks/input-list.d.ts +1 -0
  17. package/dist/blocks/input-list.d.ts.map +1 -1
  18. package/dist/blocks/sidebar.cjs +1 -1
  19. package/dist/blocks/sidebar.d.ts +12 -6
  20. package/dist/blocks/sidebar.d.ts.map +1 -1
  21. package/dist/blocks/sidebar.js +64 -63
  22. package/dist/button.cjs +1 -1
  23. package/dist/button.d.ts.map +1 -1
  24. package/dist/button.js +47 -43
  25. package/dist/card.cjs +1 -1
  26. package/dist/card.d.ts +12 -0
  27. package/dist/card.d.ts.map +1 -1
  28. package/dist/card.js +115 -97
  29. package/dist/chart.cjs +6 -6
  30. package/dist/chart.d.ts +6 -10
  31. package/dist/chart.d.ts.map +1 -1
  32. package/dist/chart.js +281 -296
  33. package/dist/combobox.cjs +3 -3
  34. package/dist/combobox.d.ts.map +1 -1
  35. package/dist/combobox.js +430 -343
  36. package/dist/command.cjs +1 -1
  37. package/dist/command.d.ts +23 -2
  38. package/dist/command.d.ts.map +1 -1
  39. package/dist/command.js +212 -207
  40. package/dist/count-indicator.cjs +1 -0
  41. package/dist/count-indicator.d.ts +85 -0
  42. package/dist/count-indicator.d.ts.map +1 -0
  43. package/dist/count-indicator.js +72 -0
  44. package/dist/data-table.cjs +1 -1
  45. package/dist/data-table.d.ts +101 -11
  46. package/dist/data-table.d.ts.map +1 -1
  47. package/dist/data-table.js +593 -523
  48. package/dist/dialog.cjs +1 -1
  49. package/dist/dialog.d.ts +26 -3
  50. package/dist/dialog.d.ts.map +1 -1
  51. package/dist/dialog.js +62 -47
  52. package/dist/drawer.cjs +1 -1
  53. package/dist/drawer.d.ts +8 -4
  54. package/dist/drawer.d.ts.map +1 -1
  55. package/dist/drawer.js +37 -38
  56. package/dist/file-upload.cjs +1 -0
  57. package/dist/file-upload.d.ts +546 -0
  58. package/dist/file-upload.d.ts.map +1 -0
  59. package/dist/file-upload.js +1103 -0
  60. package/dist/global-layout.cjs +1 -1
  61. package/dist/global-layout.d.ts +7 -2
  62. package/dist/global-layout.d.ts.map +1 -1
  63. package/dist/global-layout.js +52 -52
  64. package/dist/hooks/use-file-dropzone.cjs +1 -0
  65. package/dist/hooks/use-file-dropzone.d.ts +75 -0
  66. package/dist/hooks/use-file-dropzone.d.ts.map +1 -0
  67. package/dist/hooks/use-file-dropzone.js +133 -0
  68. package/dist/hover-card.cjs +1 -1
  69. package/dist/hover-card.d.ts +29 -16
  70. package/dist/hover-card.d.ts.map +1 -1
  71. package/dist/hover-card.js +153 -36
  72. package/dist/index.cjs +1 -1
  73. package/dist/index.d.ts +3 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +676 -640
  76. package/dist/input-chip.cjs +1 -1
  77. package/dist/input-chip.d.ts +30 -1
  78. package/dist/input-chip.d.ts.map +1 -1
  79. package/dist/input-chip.js +131 -115
  80. package/dist/input-group.cjs +1 -1
  81. package/dist/input-group.d.ts +37 -2
  82. package/dist/input-group.d.ts.map +1 -1
  83. package/dist/input-group.js +131 -114
  84. package/dist/input-password.cjs +1 -1
  85. package/dist/input-password.js +6 -6
  86. package/dist/lib/empty-canvas.cjs +1 -1
  87. package/dist/lib/empty-canvas.d.ts +27 -1
  88. package/dist/lib/empty-canvas.d.ts.map +1 -1
  89. package/dist/lib/empty-canvas.js +27 -23
  90. package/dist/lib/empty-chip.cjs +1 -1
  91. package/dist/lib/empty-chip.d.ts +19 -2
  92. package/dist/lib/empty-chip.d.ts.map +1 -1
  93. package/dist/lib/empty-chip.js +14 -9
  94. package/dist/lib/field-aria.cjs +1 -1
  95. package/dist/lib/field-aria.d.ts +4 -4
  96. package/dist/lib/field-aria.d.ts.map +1 -1
  97. package/dist/lib/field-aria.js +7 -5
  98. package/dist/lib/media-viewer-content.cjs +1 -1
  99. package/dist/lib/media-viewer-content.js +1 -1
  100. package/dist/lib/table-internal.cjs +1 -1
  101. package/dist/lib/table-internal.d.ts +19 -0
  102. package/dist/lib/table-internal.d.ts.map +1 -1
  103. package/dist/lib/table-internal.js +22 -7
  104. package/dist/list.cjs +1 -1
  105. package/dist/list.d.ts +13 -0
  106. package/dist/list.d.ts.map +1 -1
  107. package/dist/list.js +103 -82
  108. package/dist/logo-mark.cjs +1 -1
  109. package/dist/logo-mark.d.ts +18 -2
  110. package/dist/logo-mark.d.ts.map +1 -1
  111. package/dist/logo-mark.js +159 -79
  112. package/dist/media-empty.cjs +1 -1
  113. package/dist/media-empty.d.ts +50 -7
  114. package/dist/media-empty.d.ts.map +1 -1
  115. package/dist/media-empty.js +14 -13
  116. package/dist/media-viewer.cjs +1 -1
  117. package/dist/media-viewer.js +6 -6
  118. package/dist/multi-select-filter.cjs +1 -1
  119. package/dist/multi-select-filter.d.ts.map +1 -1
  120. package/dist/multi-select-filter.js +92 -101
  121. package/dist/pagination.cjs +1 -1
  122. package/dist/pagination.d.ts +11 -0
  123. package/dist/pagination.d.ts.map +1 -1
  124. package/dist/pagination.js +17 -17
  125. package/dist/relative-date.d.ts +6 -0
  126. package/dist/relative-date.d.ts.map +1 -1
  127. package/dist/resizable.d.ts +1 -1
  128. package/dist/result-count.cjs +1 -1
  129. package/dist/result-count.d.ts +13 -16
  130. package/dist/result-count.d.ts.map +1 -1
  131. package/dist/result-count.js +24 -33
  132. package/dist/sheet.cjs +1 -1
  133. package/dist/sheet.d.ts +22 -3
  134. package/dist/sheet.d.ts.map +1 -1
  135. package/dist/sheet.js +152 -125
  136. package/dist/single-select-filter.cjs +1 -1
  137. package/dist/single-select-filter.d.ts.map +1 -1
  138. package/dist/single-select-filter.js +67 -76
  139. package/dist/table.cjs +1 -1
  140. package/dist/table.d.ts.map +1 -1
  141. package/dist/table.js +77 -76
  142. package/dist/tabs.cjs +1 -1
  143. package/dist/tabs.d.ts +39 -3
  144. package/dist/tabs.d.ts.map +1 -1
  145. package/dist/tabs.js +127 -76
  146. package/dist/textarea.cjs +1 -1
  147. package/dist/textarea.d.ts +34 -0
  148. package/dist/textarea.d.ts.map +1 -1
  149. package/dist/textarea.js +115 -19
  150. package/dist/tooltip.cjs +1 -1
  151. package/dist/tooltip.d.ts.map +1 -1
  152. package/dist/tooltip.js +137 -131
  153. package/dist/typography-text.cjs +1 -1
  154. package/dist/typography-text.d.ts +6 -2
  155. package/dist/typography-text.d.ts.map +1 -1
  156. package/dist/typography-text.js +14 -13
  157. package/package.json +3 -4
  158. package/src/blocks/empty-state.tsx +108 -48
  159. package/src/blocks/input-list.tsx +1 -0
  160. package/src/blocks/sidebar.tsx +39 -16
  161. package/src/components/alert-dialog.tsx +18 -2
  162. package/src/components/banner.tsx +247 -68
  163. package/src/components/button.tsx +27 -10
  164. package/src/components/card.tsx +89 -7
  165. package/src/components/chart.tsx +47 -67
  166. package/src/components/combobox.tsx +221 -12
  167. package/src/components/command.tsx +83 -37
  168. package/src/components/count-indicator.tsx +188 -0
  169. package/src/components/data-table.tsx +506 -159
  170. package/src/components/dialog.tsx +74 -5
  171. package/src/components/drawer.tsx +52 -32
  172. package/src/components/file-upload.tsx +2574 -0
  173. package/src/components/global-layout.tsx +18 -5
  174. package/src/components/hover-card.tsx +395 -65
  175. package/src/components/input-chip.tsx +67 -2
  176. package/src/components/input-group.tsx +89 -6
  177. package/src/components/list.tsx +40 -3
  178. package/src/components/logo-mark.tsx +109 -25
  179. package/src/components/media-empty.tsx +62 -7
  180. package/src/components/multi-select-filter.tsx +9 -16
  181. package/src/components/pagination.tsx +15 -2
  182. package/src/components/relative-date.tsx +6 -0
  183. package/src/components/result-count.tsx +27 -54
  184. package/src/components/sheet.tsx +86 -8
  185. package/src/components/single-select-filter.tsx +9 -16
  186. package/src/components/table.tsx +16 -1
  187. package/src/components/tabs.tsx +223 -41
  188. package/src/components/textarea.tsx +271 -4
  189. package/src/components/tooltip.tsx +29 -2
  190. package/src/components/typography-text.tsx +7 -2
  191. package/src/hooks/use-file-dropzone.ts +325 -0
  192. package/src/index.ts +3 -0
  193. package/src/lib/empty-canvas.tsx +47 -20
  194. package/src/lib/empty-chip.tsx +38 -3
  195. package/src/lib/field-aria.tsx +11 -6
  196. package/src/lib/table-internal.ts +38 -0
@@ -29,24 +29,79 @@ const TabsContext = React.createContext<TabsContextValue>({
29
29
  variant: "default",
30
30
  });
31
31
 
32
- const tabsListVariants = cva("inline-flex items-center justify-center", {
33
- variants: {
34
- variant: {
35
- default: "h-9 w-fit bg-muted rounded-lg p-1",
36
- underline: "border-border w-full gap-1 rounded-none border-b",
32
+ /**
33
+ * Horizontal alignment of triggers inside the tab list.
34
+ * - `"start"` — triggers sit at the left edge (default for underline)
35
+ * - `"center"` — triggers are centred; falls back to start on overflow
36
+ * (default for pill)
37
+ *
38
+ * @deprecated No consumer uses this — the variant-aware defaults cover every
39
+ * real case. Will be removed in a future major. Use `className="justify-center"`
40
+ * if you need to override.
41
+ */
42
+ type TabsListAlign = "start" | "center";
43
+
44
+ const tabsListVariants = cva(
45
+ [
46
+ "inline-flex max-w-full items-center",
47
+ // A row wider than its container scrolls sideways instead of widening
48
+ // the page (six tabs on a phone). Only an overflowing list becomes a
49
+ // scroll container (data-overflowing), because a scroll container clips
50
+ // the focus ring of a list that fits. The scrollbar stays hidden; touch,
51
+ // trackpad and arrow keys scroll the row. overscroll-x-contain is scoped
52
+ // to the list, so the page keeps its back/forward swipe gestures.
53
+ "overscroll-x-contain [scrollbar-width:none]",
54
+ "data-overflowing:overflow-x-auto data-overflowing:overflow-y-hidden",
55
+ ],
56
+ {
57
+ variants: {
58
+ variant: {
59
+ default: "h-9 w-fit bg-muted rounded-lg p-1",
60
+ // The bottom rule is an inset shadow, not a border: a scrolling list
61
+ // clips at its padding box, so a border would cut the active
62
+ // underline in half.
63
+ underline:
64
+ "w-full gap-1 rounded-none shadow-[inset_0_-1px_0_var(--border)]",
65
+ },
66
+ align: {
67
+ start: "justify-start",
68
+ center: "justify-center-safe",
69
+ },
70
+ fullWidth: {
71
+ // Triggers share the row equally (basis-0 + grow) and wrap long labels
72
+ // inside their cell instead of overflowing or truncating.
73
+ true: [
74
+ "flex w-full items-stretch",
75
+ // wrap-anywhere breaks a single long word too, so it never spills
76
+ // into the next trigger.
77
+ "*:min-w-0 *:flex-1 *:basis-0 *:whitespace-normal *:wrap-anywhere *:text-center",
78
+ ],
79
+ false: "",
80
+ },
37
81
  },
38
- },
39
- defaultVariants: {
40
- variant: "default",
41
- },
42
- });
82
+ compoundVariants: [
83
+ // The pill row grows with wrapped labels instead of clipping at 36px.
84
+ // py-0.5 keeps a one-line row at h-9: stretched triggers (30px tall)
85
+ // fit the 32px content box instead of pushing the row to 38px.
86
+ {
87
+ variant: "default",
88
+ fullWidth: true,
89
+ className: "h-auto min-h-9 py-0.5",
90
+ },
91
+ ],
92
+ defaultVariants: {
93
+ variant: "default",
94
+ fullWidth: false,
95
+ },
96
+ }
97
+ );
43
98
 
44
99
  const tabsTriggerVariants = cva(
45
100
  [
46
101
  "inline-flex items-center justify-center gap-2",
47
102
  "text-label whitespace-nowrap",
48
103
  "cursor-pointer",
49
- "focus-visible:outline-none",
104
+ "outline-none",
50
105
  "disabled:pointer-events-none disabled:opacity-50",
51
106
  ],
52
107
  {
@@ -64,13 +119,15 @@ const tabsTriggerVariants = cva(
64
119
  "dark:data-[state=active]:border-white/15 dark:data-[state=active]:bg-white/5",
65
120
  ],
66
121
  underline: [
67
- "-mb-px px-3 py-1.5",
122
+ "px-3 py-1.5",
68
123
  "rounded-none border-b-2 border-transparent bg-transparent",
69
124
  "first:rounded-l-none last:rounded-r-none",
70
125
  "text-muted-foreground hover:bg-transparent hover:text-foreground",
71
126
  "data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-foreground",
72
127
  "transition-[color,border-color,box-shadow] duration-fast ease-out",
73
128
  "focus-visible:rounded-md focus-visible:shadow-default",
129
+ "[&:focus:not(:focus-visible)]:shadow-none",
130
+ "[&[data-pointer-focus]:focus-visible]:shadow-none [&[data-pointer-focus]:focus-visible]:rounded-none",
74
131
  ],
75
132
  },
76
133
  },
@@ -100,9 +157,18 @@ interface TabsProps<T extends string = string> extends Omit<
100
157
  * @default "default"
101
158
  */
102
159
  variant?: TabsVariant;
103
- /** Only mount tab panel content when the tab is first activated (opt-in) */
160
+ /**
161
+ * Only mount a panel when its tab is first activated; once visited it stays
162
+ * mounted (hidden while inactive) unless `unmountOnExit` is also set.
163
+ * @default false
164
+ */
104
165
  lazyMount?: boolean;
105
- /** Unmount tab panel content when the tab becomes inactive */
166
+ /**
167
+ * Unmount a panel's content when its tab becomes inactive. Off by default:
168
+ * inactive panels stay mounted and hidden, so form edits, scroll position
169
+ * and other local state survive a tab switch.
170
+ * @default false
171
+ */
106
172
  unmountOnExit?: boolean;
107
173
  /** The controlled value of the active tab */
108
174
  value?: T;
@@ -136,20 +202,20 @@ function TabsInner<T extends string = string>(
136
202
  () => new Set(activeValue != null ? [activeValue] : [])
137
203
  );
138
204
 
205
+ // Record the active tab as visited however it became active: a trigger
206
+ // click or a parent changing the controlled `value`. Updating state during
207
+ // render (guarded, so it settles in one pass) keeps the panel from being
208
+ // dropped when it is left.
209
+ if (lazyMount && activeValue != null && !visitedTabs.has(activeValue)) {
210
+ setVisitedTabs(new Set(visitedTabs).add(activeValue));
211
+ }
212
+
139
213
  const handleValueChange = React.useCallback(
140
214
  (newValue: string) => {
141
215
  setInternalValue(newValue as T);
142
- if (lazyMount) {
143
- setVisitedTabs((prev) => {
144
- if (prev.has(newValue)) return prev;
145
- const next = new Set(prev);
146
- next.add(newValue);
147
- return next;
148
- });
149
- }
150
216
  onValueChange?.(newValue as T);
151
217
  },
152
- [lazyMount, onValueChange]
218
+ [onValueChange]
153
219
  );
154
220
 
155
221
  const contextValue = React.useMemo(
@@ -167,7 +233,11 @@ function TabsInner<T extends string = string>(
167
233
  <TabsContext.Provider value={contextValue}>
168
234
  <TabsPrimitive.Root
169
235
  ref={ref}
170
- className={cn("flex flex-col gap-2", className)}
236
+ className={cn(
237
+ "flex max-w-full min-w-0 flex-col",
238
+ variant === "underline" ? "gap-6" : "gap-2",
239
+ className
240
+ )}
171
241
  data-hook={dataHook}
172
242
  data-slot="tabs"
173
243
  data-tracking-el={trackingEl}
@@ -192,6 +262,44 @@ const Tabs = React.forwardRef(TabsInner) as <T extends string = string>(
192
262
 
193
263
  (Tabs as React.FC).displayName = "Tabs";
194
264
 
265
+ /**
266
+ * True while an element's children are wider than the element itself.
267
+ * Re-measures when the element or any child resizes, and when children are
268
+ * added or removed.
269
+ */
270
+ function useHorizontalOverflow(element: HTMLElement | null) {
271
+ const [overflowing, setOverflowing] = React.useState(false);
272
+
273
+ React.useLayoutEffect(() => {
274
+ if (!element || typeof ResizeObserver === "undefined") return;
275
+
276
+ const measure = () =>
277
+ setOverflowing(element.scrollWidth > element.clientWidth + 1);
278
+
279
+ const resize = new ResizeObserver(measure);
280
+ const observeAll = () => {
281
+ resize.disconnect();
282
+ resize.observe(element);
283
+ for (const child of Array.from(element.children)) resize.observe(child);
284
+ };
285
+ const mutation = new MutationObserver(() => {
286
+ observeAll();
287
+ measure();
288
+ });
289
+
290
+ observeAll();
291
+ mutation.observe(element, { childList: true });
292
+ measure();
293
+
294
+ return () => {
295
+ resize.disconnect();
296
+ mutation.disconnect();
297
+ };
298
+ }, [element]);
299
+
300
+ return overflowing;
301
+ }
302
+
195
303
  /**
196
304
  * Props for the TabsList component
197
305
  */
@@ -204,26 +312,72 @@ interface TabsListProps extends React.ComponentProps<
204
312
  trackingEl?: string;
205
313
  /** Tracking label for analytics context */
206
314
  trackingLabel?: string;
315
+ /**
316
+ * Horizontal alignment of triggers inside the list.
317
+ * Defaults to `"start"` for the underline variant and `"center"` for the
318
+ * pill variant.
319
+ *
320
+ * @deprecated No consumer uses this — the variant-aware defaults cover every
321
+ * real case. Will be removed in a future major. Use `className` if you need
322
+ * to override alignment.
323
+ */
324
+ align?: TabsListAlign;
325
+ /**
326
+ * Stretch the list to its container and give every trigger an equal share
327
+ * of the width. Long labels wrap inside their trigger; they never truncate.
328
+ * @default false
329
+ */
330
+ fullWidth?: boolean;
207
331
  }
208
332
 
209
333
  const TabsList = React.forwardRef<
210
334
  React.ComponentRef<typeof TabsPrimitive.List>,
211
335
  TabsListProps
212
- >(({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => {
213
- const { variant } = React.useContext(TabsContext);
214
-
215
- return (
216
- <TabsPrimitive.List
217
- ref={ref}
218
- className={cn(tabsListVariants({ variant }), className)}
219
- data-hook={dataHook}
220
- data-slot="tabs-list"
221
- data-tracking-el={trackingEl}
222
- data-tracking-label={trackingLabel}
223
- {...props}
224
- />
225
- );
226
- });
336
+ >(
337
+ (
338
+ {
339
+ className,
340
+ dataHook,
341
+ trackingEl,
342
+ trackingLabel,
343
+ align: alignProp,
344
+ fullWidth = false,
345
+ ...props
346
+ },
347
+ ref
348
+ ) => {
349
+ const { variant } = React.useContext(TabsContext);
350
+ const resolvedAlign =
351
+ alignProp ?? (variant === "underline" ? "start" : "center");
352
+ const [list, setList] = React.useState<HTMLDivElement | null>(null);
353
+ const overflowing = useHorizontalOverflow(list);
354
+
355
+ const setRefs = React.useCallback(
356
+ (node: HTMLDivElement | null) => {
357
+ setList(node);
358
+ if (typeof ref === "function") ref(node);
359
+ else if (ref) ref.current = node;
360
+ },
361
+ [ref]
362
+ );
363
+
364
+ return (
365
+ <TabsPrimitive.List
366
+ ref={setRefs}
367
+ className={cn(
368
+ tabsListVariants({ variant, align: resolvedAlign, fullWidth }),
369
+ className
370
+ )}
371
+ data-hook={dataHook}
372
+ data-overflowing={overflowing ? "" : undefined}
373
+ data-slot="tabs-list"
374
+ data-tracking-el={trackingEl}
375
+ data-tracking-label={trackingLabel}
376
+ {...props}
377
+ />
378
+ );
379
+ }
380
+ );
227
381
 
228
382
  TabsList.displayName = "TabsList";
229
383
 
@@ -252,12 +406,30 @@ function TabsTriggerInner<T extends string = string>(
252
406
  dataHook,
253
407
  trackingEl,
254
408
  trackingLabel,
409
+ onPointerDown: onPointerDownProp,
410
+ onBlur: onBlurProp,
255
411
  ...props
256
412
  }: TabsTriggerProps<T>,
257
413
  ref: React.ForwardedRef<React.ComponentRef<typeof TabsPrimitive.Trigger>>
258
414
  ) {
259
415
  const { variant } = React.useContext(TabsContext);
260
416
 
417
+ const handlePointerDown = React.useCallback(
418
+ (e: React.PointerEvent<HTMLButtonElement>) => {
419
+ e.currentTarget.setAttribute("data-pointer-focus", "");
420
+ onPointerDownProp?.(e);
421
+ },
422
+ [onPointerDownProp]
423
+ );
424
+
425
+ const handleBlur = React.useCallback(
426
+ (e: React.FocusEvent<HTMLButtonElement>) => {
427
+ e.currentTarget.removeAttribute("data-pointer-focus");
428
+ onBlurProp?.(e);
429
+ },
430
+ [onBlurProp]
431
+ );
432
+
261
433
  return (
262
434
  <TabsPrimitive.Trigger
263
435
  ref={ref}
@@ -266,6 +438,8 @@ function TabsTriggerInner<T extends string = string>(
266
438
  data-slot="tabs-trigger"
267
439
  data-tracking-el={trackingEl}
268
440
  data-tracking-label={trackingLabel}
441
+ onBlur={handleBlur}
442
+ onPointerDown={handlePointerDown}
269
443
  {...props}
270
444
  />
271
445
  );
@@ -315,7 +489,7 @@ function TabsContentInner<T extends string = string>(
315
489
 
316
490
  const isActive = value === activeValue;
317
491
 
318
- if (lazyMount && !visitedTabs.has(value)) {
492
+ if (lazyMount && !isActive && !visitedTabs.has(value)) {
319
493
  return null;
320
494
  }
321
495
 
@@ -326,11 +500,18 @@ function TabsContentInner<T extends string = string>(
326
500
  return (
327
501
  <TabsPrimitive.Content
328
502
  ref={ref}
329
- className={cn("flex-1 outline-none", className)}
503
+ className={cn(
504
+ "flex-1 outline-none data-[state=inactive]:hidden",
505
+ className
506
+ )}
330
507
  data-hook={dataHook}
331
508
  data-slot="tabs-content"
332
509
  data-tracking-el={trackingEl}
333
510
  data-tracking-label={trackingLabel}
511
+ // Radix unmounts inactive content unless forceMount. Keep it mounted
512
+ // (unless unmountOnExit); the class above hides it with display: none,
513
+ // which also takes it out of the accessibility tree and the tab order.
514
+ forceMount={unmountOnExit ? undefined : true}
334
515
  value={value}
335
516
  {...props}
336
517
  />
@@ -351,6 +532,7 @@ export { Tabs, TabsList, TabsTrigger, TabsContent };
351
532
  export type {
352
533
  TabsProps,
353
534
  TabsListProps,
535
+ TabsListAlign,
354
536
  TabsTriggerProps,
355
537
  TabsContentProps,
356
538
  TabsVariant,