@brightlocal/ui-components 2.20.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/AI_USAGE.md +2 -0
- package/README.md +26 -13
- package/component-meta.json +41 -14
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +35 -3
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +178 -154
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +2 -2
- package/dist/blocks/sidebar.js +18 -18
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +9 -6
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +12 -12
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +45 -45
- package/dist/index.cjs +1 -1
- package/dist/index.js +69 -68
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +7 -5
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +1 -1
- package/dist/logo.js +2 -2
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts +17 -0
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +120 -90
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +12 -8
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +117 -113
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +28 -2
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +90 -49
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/sonner.d.ts +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +22 -2
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +57 -43
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +36 -36
- package/package.json +7 -3
- package/src/blocks/data-table.tsx +56 -4
- package/src/blocks/sidebar.tsx +5 -5
- package/src/components/breadcrumb.tsx +6 -3
- package/src/components/button.tsx +7 -1
- package/src/components/hover-card.tsx +6 -3
- package/src/components/logo.tsx +3 -3
- package/src/components/navigation-menu.tsx +113 -32
- package/src/components/pagination.tsx +47 -67
- package/src/components/progress.tsx +118 -14
- package/src/components/skeleton.tsx +1 -1
- package/src/components/sonner.tsx +1 -1
- package/src/components/table.tsx +44 -7
- package/src/components/tooltip.tsx +8 -5
- package/src/lib/utils.ts +3 -0
package/src/components/table.tsx
CHANGED
|
@@ -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(
|
|
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
|
-
*
|
|
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
|
-
{
|
|
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
|
-
*
|
|
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
|
-
(
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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";
|