@brightlocal/ui-components 2.21.0 → 2.22.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.
package/dist/tooltip.js CHANGED
@@ -1,65 +1,65 @@
1
- import { jsx as r, jsxs as m } from "react/jsx-runtime";
1
+ import { jsx as a, jsxs as c } from "react/jsx-runtime";
2
2
  import * as i from "react";
3
- import * as o from "@radix-ui/react-tooltip";
4
- import { cn as f } from "@brightlocal/ui-components/lib/utils";
5
- function u({
6
- delayDuration: t = 0,
7
- skipDelayDuration: a = 0,
3
+ import * as t from "@radix-ui/react-tooltip";
4
+ import { cn as f, FLOATING_CONTENT_ANIMATION as g } from "@brightlocal/ui-components/lib/utils";
5
+ function w({
6
+ delayDuration: o = 0,
7
+ skipDelayDuration: r = 0,
8
8
  ...e
9
9
  }) {
10
- return /* @__PURE__ */ r(
11
- o.Provider,
10
+ return /* @__PURE__ */ a(
11
+ t.Provider,
12
12
  {
13
- "data-slot": "tooltip-provider",
14
- delayDuration: t,
15
- skipDelayDuration: a,
13
+ delayDuration: o,
14
+ skipDelayDuration: r,
16
15
  ...e
17
16
  }
18
17
  );
19
18
  }
20
19
  function y({
21
- ...t
20
+ ...o
22
21
  }) {
23
- return /* @__PURE__ */ r(o.Root, { "data-slot": "tooltip", ...t });
22
+ return /* @__PURE__ */ a(t.Root, { ...o });
24
23
  }
25
- const g = i.forwardRef(({ ...t }, a) => /* @__PURE__ */ r(
26
- o.Trigger,
24
+ const T = i.forwardRef(({ ...o }, r) => /* @__PURE__ */ a(
25
+ t.Trigger,
27
26
  {
28
- ref: a,
27
+ ref: r,
29
28
  "data-slot": "tooltip-trigger",
30
- ...t
29
+ ...o
31
30
  }
32
31
  ));
33
- g.displayName = "TooltipTrigger";
32
+ T.displayName = "TooltipTrigger";
34
33
  const x = i.forwardRef(
35
34
  ({
36
- className: t,
37
- sideOffset: a = 0,
35
+ className: o,
36
+ sideOffset: r = 0,
38
37
  dataHook: e,
39
- trackingEl: l,
40
- trackingLabel: d,
41
- hideArrow: n = !1,
38
+ trackingEl: n,
39
+ trackingLabel: l,
40
+ hideArrow: d = !1,
42
41
  children: s,
43
42
  ...p
44
- }, c) => /* @__PURE__ */ r(o.Portal, { children: /* @__PURE__ */ m(
45
- o.Content,
43
+ }, m) => /* @__PURE__ */ a(t.Portal, { children: /* @__PURE__ */ c(
44
+ t.Content,
46
45
  {
47
- ref: c,
46
+ ref: m,
48
47
  className: f(
49
- "bg-secondary text-secondary-foreground z-50 rounded-md px-3 py-1.5 text-xs leading-4 font-normal",
50
- "data-[side=bottom]:[&_[data-slot=tooltip-arrow]]:translate-y-px data-[side=left]:[&_[data-slot=tooltip-arrow]]:-translate-x-px data-[side=right]:[&_[data-slot=tooltip-arrow]]:translate-x-px data-[side=top]:[&_[data-slot=tooltip-arrow]]:-translate-y-px",
51
- t
48
+ "bg-secondary text-secondary-foreground z-50 w-max max-w-sm rounded-md px-3 py-1.5 text-xs leading-4 font-normal",
49
+ g,
50
+ "**:data-[slot=tooltip-arrow]:-translate-y-px",
51
+ o
52
52
  ),
53
53
  "data-hook": e,
54
54
  "data-slot": "tooltip-content",
55
- "data-tracking-el": l,
56
- "data-tracking-label": d,
57
- sideOffset: a,
55
+ "data-tracking-el": n,
56
+ "data-tracking-label": l,
57
+ sideOffset: r,
58
58
  ...p,
59
59
  children: [
60
60
  s,
61
- !n && /* @__PURE__ */ r(
62
- o.Arrow,
61
+ !d && /* @__PURE__ */ a(
62
+ t.Arrow,
63
63
  {
64
64
  className: "fill-secondary",
65
65
  "data-slot": "tooltip-arrow",
@@ -75,6 +75,6 @@ x.displayName = "TooltipContent";
75
75
  export {
76
76
  y as Tooltip,
77
77
  x as TooltipContent,
78
- u as TooltipProvider,
79
- g as TooltipTrigger
78
+ w as TooltipProvider,
79
+ T as TooltipTrigger
80
80
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "2.21.0",
3
+ "version": "2.22.0",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -28,6 +28,7 @@ import {
28
28
  type ExpandedState,
29
29
  type PaginationState,
30
30
  type Row,
31
+ type RowData,
31
32
  type RowSelectionState,
32
33
  type SortingState,
33
34
  type Table as TanStackTable,
@@ -39,6 +40,16 @@ import {
39
40
  getSortedRowModel,
40
41
  useReactTable,
41
42
  } from "@tanstack/react-table";
43
+
44
+ declare module "@tanstack/react-table" {
45
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
46
+ interface ColumnMeta<TData extends RowData, TValue> {
47
+ /** Explicit column width (e.g., "200px", "50%", "10rem"). */
48
+ width?: string;
49
+ /** Minimum column width (e.g., "100px", "8rem"). */
50
+ minWidth?: string;
51
+ }
52
+ }
42
53
  import { useVirtualizer } from "@tanstack/react-virtual";
43
54
  import { ArrowDown, ArrowUp, ArrowUpDown, Search, X } from "@brightlocal/icons";
44
55
 
@@ -400,6 +411,30 @@ export interface DataTableProps<TData> {
400
411
  stickyHeader?: boolean;
401
412
  /** Additional class name for the outer wrapper. */
402
413
  className?: string;
414
+ /**
415
+ * Table layout algorithm.
416
+ * - `"auto"` (default) — browser sizes columns based on content.
417
+ * - `"fixed"` — columns respect explicit `width` values on `TableHead`/`TableCell`
418
+ * and split remaining space equally. Use when you set `width` on headers.
419
+ *
420
+ * **Migration note:** `"fixed"` will become the default in the next major release.
421
+ * Consumers should start setting explicit `width` on columns now.
422
+ * @default "auto"
423
+ */
424
+ layout?: "auto" | "fixed";
425
+ /**
426
+ * Minimum width for the table (e.g., "1100px", "60rem"). Prevents columns
427
+ * from compressing on narrow viewports and enables horizontal scroll.
428
+ * When set, the scroll container becomes a focusable region for
429
+ * keyboard accessibility.
430
+ */
431
+ minWidth?: string;
432
+ /**
433
+ * Accessible label for the scroll container region.
434
+ * Used when `minWidth` is set to provide context for keyboard users.
435
+ * @default "Scrollable table"
436
+ */
437
+ scrollRegionLabel?: string;
403
438
  /**
404
439
  * Optional footer rendered inside the `<table>` element after `<tbody>`.
405
440
  * Use for summary rows or totals. Pass a `<TableFooter>` with rows.
@@ -428,6 +463,9 @@ export function DataTable<TData>({
428
463
  noResultsMessage = "No results.",
429
464
  stickyHeader = false,
430
465
  className,
466
+ layout,
467
+ minWidth,
468
+ scrollRegionLabel,
431
469
  footer,
432
470
  }: DataTableProps<TData>) {
433
471
  const columnCount = table.getVisibleLeafColumns().length;
@@ -443,7 +481,12 @@ export function DataTable<TData>({
443
481
  data-tracking-el={trackingEl}
444
482
  data-tracking-label={trackingLabel}
445
483
  >
446
- <Table dataHook={`${dataHook}-table`}>
484
+ <Table
485
+ dataHook={`${dataHook}-table`}
486
+ layout={layout}
487
+ minWidth={minWidth}
488
+ scrollRegionLabel={scrollRegionLabel}
489
+ >
447
490
  <DataTableHeaderRows stickyHeader={stickyHeader} table={table} />
448
491
  <TableBody>
449
492
  {isLoading ? (
@@ -515,11 +558,14 @@ function DataTableHeaderRows<TData>({
515
558
  : header.column.getCanSort()
516
559
  ? "none"
517
560
  : undefined;
561
+ const meta = header.column.columnDef.meta;
518
562
  return (
519
563
  <TableHead
520
564
  key={header.id}
521
565
  aria-sort={ariaSort}
522
566
  colSpan={header.colSpan}
567
+ minWidth={meta?.minWidth}
568
+ width={meta?.width}
523
569
  >
524
570
  {header.isPlaceholder
525
571
  ? null
@@ -646,6 +692,9 @@ export function VirtualizedDataTable<TData>({
646
692
  noResultsMessage = "No results.",
647
693
  stickyHeader = false,
648
694
  className,
695
+ layout,
696
+ minWidth,
697
+ scrollRegionLabel,
649
698
  footer,
650
699
  height,
651
700
  estimateSize = 48,
@@ -688,7 +737,12 @@ export function VirtualizedDataTable<TData>({
688
737
  data-tracking-label={trackingLabel}
689
738
  style={height != null ? { height } : undefined}
690
739
  >
691
- <Table dataHook={`${dataHook}-table`}>
740
+ <Table
741
+ dataHook={`${dataHook}-table`}
742
+ layout={layout}
743
+ minWidth={minWidth}
744
+ scrollRegionLabel={scrollRegionLabel}
745
+ >
692
746
  <DataTableHeaderRows stickyHeader={stickyHeader} table={table} />
693
747
  <TableBody>
694
748
  {isLoading ? (
@@ -2,7 +2,10 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
5
- import { cn } from "@brightlocal/ui-components/lib/utils";
5
+ import {
6
+ cn,
7
+ FLOATING_CONTENT_ANIMATION,
8
+ } from "@brightlocal/ui-components/lib/utils";
6
9
 
7
10
  /**
8
11
  * HoverCard props
@@ -142,8 +145,8 @@ const HoverCardContent = React.forwardRef<
142
145
  ref={ref}
143
146
  align={align}
144
147
  className={cn(
145
- "border-border bg-popover text-popover-foreground z-50 w-80 rounded-lg border p-4 shadow-md outline-hidden",
146
- "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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
148
+ "border-border bg-popover text-popover-foreground z-50 w-max max-w-sm rounded-lg border p-4 shadow-md outline-hidden",
149
+ FLOATING_CONTENT_ANIMATION,
147
150
  className
148
151
  )}
149
152
  data-hook={dataHook}
@@ -92,11 +92,12 @@ type NavigationMenuTriggerProps = React.ComponentPropsWithoutRef<
92
92
  >;
93
93
 
94
94
  /**
95
- * Window (ms) after the menu opens during which a mouse click is treated as
96
- * instinctive and is NOT allowed to close the menu. Mirrors Base UI's
97
- * "patient click" threshold (PATIENT_CLICK_THRESHOLD).
95
+ * Window (ms) after the pointer enters an open trigger during which a mouse
96
+ * click is treated as instinctive and is NOT allowed to close the menu. Based
97
+ * on Base UI's "patient click" threshold (PATIENT_CLICK_THRESHOLD = 500), tuned
98
+ * slightly shorter so the trigger becomes a deliberate toggle a touch sooner.
98
99
  */
99
- const PATIENT_CLICK_THRESHOLD_MS = 500;
100
+ const PATIENT_CLICK_THRESHOLD_MS = 400;
100
101
 
101
102
  /**
102
103
  * Trigger button that opens a dropdown menu
@@ -107,109 +108,87 @@ const PATIENT_CLICK_THRESHOLD_MS = 500;
107
108
  * closes it immediately (see radix-ui/primitives#1630).
108
109
  *
109
110
  * We port Base UI's "patient click" behaviour: an instinctive mouse click made
110
- * within {@link PATIENT_CLICK_THRESHOLD_MS} of the menu opening keeps it open
111
- * (calling `preventDefault()` makes Radix's internal `composeEventHandlers`
112
- * skip its toggle). The window is measured from the `data-state` open
113
- * transition — not the pointer enter — so it stays correct no matter how large
114
- * `delayDuration` is. A deliberate click after that window still toggles the
115
- * menu shut, and touch taps and keyboard activation are left untouched so they
116
- * can toggle it too.
111
+ * within {@link PATIENT_CLICK_THRESHOLD_MS} of the pointer entering an open
112
+ * trigger keeps the menu open (calling `preventDefault()` makes Radix's internal
113
+ * `composeEventHandlers` skip its toggle). A deliberate click after that window
114
+ * still toggles the menu shut, and touch taps and keyboard activation are left
115
+ * untouched so they can toggle it too.
117
116
  */
118
117
  const NavigationMenuTrigger = React.forwardRef<
119
118
  React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
120
119
  NavigationMenuTriggerProps
121
- >(({ className, children, onClick, onPointerDown, ...props }, ref) => {
122
- // Pointer type of the interaction, so the keep-open behaviour only applies to
123
- // mouse (the only input that hover-opens before a click).
124
- const lastPointerTypeRef = React.useRef<string>("");
125
- // Timestamp (event clock) of the last open transition, used to measure whether
126
- // a click is "instinctive" (right after the menu opened) or "patient"
127
- // (deliberate). Measuring from the open — not the pointer enter — keeps the
128
- // window correct regardless of `delayDuration`. Starts at -Infinity so a click
129
- // on a trigger that was already open at mount (no observed transition) is never
130
- // misclassified as instinctive.
131
- const openedAtRef = React.useRef(-Infinity);
132
- const observerRef = React.useRef<MutationObserver | null>(null);
120
+ >(
121
+ (
122
+ { className, children, onClick, onPointerDown, onPointerEnter, ...props },
123
+ ref
124
+ ) => {
125
+ // Pointer type of the interaction, so the keep-open behaviour only applies
126
+ // to mouse (the only input that hover-opens before a click).
127
+ const lastPointerTypeRef = React.useRef<string>("");
128
+ // Timestamp of the last pointer enter, used to measure whether a click is
129
+ // "instinctive" (right after hover) or "patient" (deliberate). Captured from
130
+ // the SAME `event.timeStamp` clock the click uses so the subtraction is
131
+ // valid — never compare against `performance.now()`, which is a different
132
+ // origin and makes every click read as "patient" (i.e. always closes).
133
+ const pointerEnterAtRef = React.useRef(0);
133
134
 
134
- // Merge the forwarded ref with a `data-state` observer that stamps the open
135
- // time. A callback ref (stable via useCallback) attaches once on mount and
136
- // tears the observer down on unmount.
137
- const composedRef = React.useCallback(
138
- (node: React.ElementRef<typeof NavigationMenuPrimitive.Trigger> | null) => {
139
- if (typeof ref === "function") {
140
- ref(node);
141
- } else if (ref) {
142
- ref.current = node;
143
- }
144
-
145
- observerRef.current?.disconnect();
146
- if (node) {
147
- const observer = new MutationObserver(() => {
148
- if (node.getAttribute("data-state") === "open") {
149
- openedAtRef.current = performance.now();
135
+ return (
136
+ <NavigationMenuPrimitive.Trigger
137
+ ref={ref}
138
+ className={cn(
139
+ [
140
+ "group inline-flex h-9 w-max items-center justify-center gap-1",
141
+ "rounded-md px-4 py-2",
142
+ "text-sm font-medium",
143
+ "text-foreground",
144
+ "transition-colors",
145
+ "hover:bg-accent hover:text-accent-foreground",
146
+ "focus:bg-accent focus:text-accent-foreground",
147
+ "focus-visible:bg-accent focus-visible:ring-ring focus-visible:shadow-[0_0_0_4px_rgba(163,163,163,0.1)] focus-visible:ring-1 focus-visible:outline-none",
148
+ "disabled:pointer-events-none disabled:opacity-50",
149
+ "data-[state=open]:bg-accent/50",
150
+ ],
151
+ className
152
+ )}
153
+ data-slot="navigation-menu-trigger"
154
+ onClick={(event) => {
155
+ // `data-state` is "open" only when hover already opened this trigger.
156
+ // `event.detail > 0` excludes keyboard-synthesised clicks (detail === 0).
157
+ const isOpen =
158
+ event.currentTarget.getAttribute("data-state") === "open";
159
+ const isInstinctiveClick =
160
+ event.timeStamp - pointerEnterAtRef.current <
161
+ PATIENT_CLICK_THRESHOLD_MS;
162
+ if (
163
+ lastPointerTypeRef.current === "mouse" &&
164
+ event.detail > 0 &&
165
+ isOpen &&
166
+ isInstinctiveClick
167
+ ) {
168
+ event.preventDefault();
150
169
  }
151
- });
152
- observer.observe(node, {
153
- attributes: true,
154
- attributeFilter: ["data-state"],
155
- });
156
- observerRef.current = observer;
157
- }
158
- },
159
- [ref]
160
- );
161
-
162
- return (
163
- <NavigationMenuPrimitive.Trigger
164
- ref={composedRef}
165
- className={cn(
166
- [
167
- "group inline-flex h-9 w-max items-center justify-center gap-1",
168
- "rounded-md px-4 py-2",
169
- "text-sm font-medium",
170
- "text-foreground",
171
- "transition-colors",
172
- "hover:bg-accent hover:text-accent-foreground",
173
- "focus:bg-accent focus:text-accent-foreground",
174
- "focus-visible:bg-accent focus-visible:ring-ring focus-visible:shadow-[0_0_0_4px_rgba(163,163,163,0.1)] focus-visible:ring-1 focus-visible:outline-none",
175
- "disabled:pointer-events-none disabled:opacity-50",
176
- "data-[state=open]:bg-accent/50",
177
- ],
178
- className
179
- )}
180
- data-slot="navigation-menu-trigger"
181
- onClick={(event) => {
182
- // `data-state` is "open" only when hover already opened this trigger.
183
- // `event.detail > 0` excludes keyboard-synthesised clicks (detail === 0).
184
- const isOpen =
185
- event.currentTarget.getAttribute("data-state") === "open";
186
- const isInstinctiveClick =
187
- event.timeStamp - openedAtRef.current < PATIENT_CLICK_THRESHOLD_MS;
188
- if (
189
- lastPointerTypeRef.current === "mouse" &&
190
- event.detail > 0 &&
191
- isOpen &&
192
- isInstinctiveClick
193
- ) {
194
- event.preventDefault();
195
- }
196
- onClick?.(event);
197
- }}
198
- onPointerDown={(event) => {
199
- lastPointerTypeRef.current = event.pointerType;
200
- onPointerDown?.(event);
201
- }}
202
- {...props}
203
- >
204
- {children}
205
- <ChevronDown
206
- aria-hidden="true"
207
- className="relative top-[1px] ml-1 transition duration-300 group-data-[state=open]:rotate-180"
208
- size={12}
209
- />
210
- </NavigationMenuPrimitive.Trigger>
211
- );
212
- });
170
+ onClick?.(event);
171
+ }}
172
+ onPointerDown={(event) => {
173
+ lastPointerTypeRef.current = event.pointerType;
174
+ onPointerDown?.(event);
175
+ }}
176
+ onPointerEnter={(event) => {
177
+ pointerEnterAtRef.current = event.timeStamp;
178
+ onPointerEnter?.(event);
179
+ }}
180
+ {...props}
181
+ >
182
+ {children}
183
+ <ChevronDown
184
+ aria-hidden="true"
185
+ className="relative top-[1px] ml-1 transition duration-300 group-data-[state=open]:rotate-180"
186
+ size={12}
187
+ />
188
+ </NavigationMenuPrimitive.Trigger>
189
+ );
190
+ }
191
+ );
213
192
 
214
193
  NavigationMenuTrigger.displayName = "NavigationMenuTrigger";
215
194
 
@@ -64,6 +64,17 @@ interface TableProps extends React.ComponentProps<"table"> {
64
64
  * Tracking label for analytics context
65
65
  */
66
66
  trackingLabel?: string;
67
+ /**
68
+ * Table layout algorithm.
69
+ * - `"auto"` (default) — browser sizes columns based on content.
70
+ * - `"fixed"` — columns respect explicit `width` values on `TableHead`/`TableCell`
71
+ * and split remaining space equally. Use when you set `width` on headers.
72
+ *
73
+ * **Migration note:** `"fixed"` will become the default in the next major release.
74
+ * Consumers should start setting explicit `width` on `TableHead` columns now.
75
+ * @default "auto"
76
+ */
77
+ layout?: "auto" | "fixed";
67
78
  /**
68
79
  * Minimum width for the table (e.g., "600px", "40rem").
69
80
  * Prevents columns from compressing on narrow viewports and enables
@@ -87,6 +98,7 @@ const Table = React.forwardRef<HTMLTableElement, TableProps>(
87
98
  dataHook,
88
99
  trackingEl,
89
100
  trackingLabel,
101
+ layout = "auto",
90
102
  minWidth,
91
103
  scrollRegionLabel,
92
104
  style,
@@ -111,7 +123,11 @@ const Table = React.forwardRef<HTMLTableElement, TableProps>(
111
123
  >
112
124
  <table
113
125
  ref={ref}
114
- className={cn("w-full caption-bottom text-sm", className)}
126
+ className={cn(
127
+ "w-full caption-bottom text-sm",
128
+ layout === "fixed" && "table-fixed",
129
+ className
130
+ )}
115
131
  data-hook={dataHook}
116
132
  data-slot="table"
117
133
  data-tracking-el={trackingEl}
@@ -242,7 +258,11 @@ interface TableHeadProps
242
258
  */
243
259
  dataHook?: string;
244
260
  /**
245
- * Minimum width for the column (e.g., "100px", "8rem")
261
+ * Explicit width for the column (e.g., "200px", "50%", "10rem").
262
+ */
263
+ width?: string;
264
+ /**
265
+ * Minimum width for the column (e.g., "100px", "8rem").
246
266
  */
247
267
  minWidth?: string;
248
268
  /**
@@ -254,7 +274,16 @@ interface TableHeadProps
254
274
 
255
275
  const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(
256
276
  (
257
- { className, dataHook, align, minWidth, style, scope = "col", ...props },
277
+ {
278
+ className,
279
+ dataHook,
280
+ align,
281
+ width,
282
+ minWidth,
283
+ style,
284
+ scope = "col",
285
+ ...props
286
+ },
258
287
  ref
259
288
  ) => (
260
289
  <th
@@ -263,7 +292,7 @@ const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(
263
292
  data-hook={dataHook}
264
293
  data-slot="table-head"
265
294
  scope={scope}
266
- style={{ minWidth, ...style }}
295
+ style={{ width, minWidth, ...style }}
267
296
  {...props}
268
297
  />
269
298
  )
@@ -284,7 +313,12 @@ interface TableCellProps
284
313
  */
285
314
  dataHook?: string;
286
315
  /**
287
- * Minimum width for the cell (e.g., "100px", "8rem")
316
+ * Width for the cell (e.g., "200px", "50%", "10rem").
317
+ * Set `layout="fixed"` on the parent `Table` for this value to be respected as an exact constraint.
318
+ */
319
+ width?: string;
320
+ /**
321
+ * Minimum width for the cell (e.g., "100px", "8rem").
288
322
  */
289
323
  minWidth?: string;
290
324
  /**
@@ -300,13 +334,16 @@ interface TableCellProps
300
334
  }
301
335
 
302
336
  const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(
303
- ({ className, dataHook, size, align, minWidth, style, ...props }, ref) => (
337
+ (
338
+ { className, dataHook, size, align, width, minWidth, style, ...props },
339
+ ref
340
+ ) => (
304
341
  <td
305
342
  ref={ref}
306
343
  className={cn(tableCellVariants({ size, align }), className)}
307
344
  data-hook={dataHook}
308
345
  data-slot="table-cell"
309
- style={{ minWidth, ...style }}
346
+ style={{ width, minWidth, ...style }}
310
347
  {...props}
311
348
  />
312
349
  )
@@ -3,7 +3,10 @@
3
3
  import * as React from "react";
4
4
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
5
5
 
6
- import { cn } from "@brightlocal/ui-components/lib/utils";
6
+ import {
7
+ cn,
8
+ FLOATING_CONTENT_ANIMATION,
9
+ } from "@brightlocal/ui-components/lib/utils";
7
10
 
8
11
  interface TooltipProviderProps extends React.ComponentProps<
9
12
  typeof TooltipPrimitive.Provider
@@ -35,7 +38,6 @@ function TooltipProvider({
35
38
  }: TooltipProviderProps) {
36
39
  return (
37
40
  <TooltipPrimitive.Provider
38
- data-slot="tooltip-provider"
39
41
  delayDuration={delayDuration}
40
42
  skipDelayDuration={skipDelayDuration}
41
43
  {...props}
@@ -65,7 +67,7 @@ function TooltipProvider({
65
67
  function Tooltip({
66
68
  ...props
67
69
  }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
68
- return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
70
+ return <TooltipPrimitive.Root {...props} />;
69
71
  }
70
72
 
71
73
  const TooltipTrigger = React.forwardRef<
@@ -126,8 +128,9 @@ const TooltipContent = React.forwardRef<
126
128
  <TooltipPrimitive.Content
127
129
  ref={ref}
128
130
  className={cn(
129
- "bg-secondary text-secondary-foreground z-50 rounded-md px-3 py-1.5 text-xs leading-4 font-normal",
130
- "data-[side=bottom]:[&_[data-slot=tooltip-arrow]]:translate-y-px data-[side=left]:[&_[data-slot=tooltip-arrow]]:-translate-x-px data-[side=right]:[&_[data-slot=tooltip-arrow]]:translate-x-px data-[side=top]:[&_[data-slot=tooltip-arrow]]:-translate-y-px",
131
+ "bg-secondary text-secondary-foreground z-50 w-max max-w-sm rounded-md px-3 py-1.5 text-xs leading-4 font-normal",
132
+ FLOATING_CONTENT_ANIMATION,
133
+ "**:data-[slot=tooltip-arrow]:-translate-y-px",
131
134
  className
132
135
  )}
133
136
  data-hook={dataHook}
package/src/lib/utils.ts CHANGED
@@ -4,3 +4,6 @@ import { twMerge } from "tailwind-merge";
4
4
  export function cn(...inputs: ClassValue[]) {
5
5
  return twMerge(clsx(inputs));
6
6
  }
7
+
8
+ export const FLOATING_CONTENT_ANIMATION =
9
+ "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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";