@brightlocal/ui-components 2.12.0 → 2.14.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/component-meta.json +316 -19
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +203 -4
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +667 -393
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +5 -1
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +48 -31
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +8 -0
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +227 -226
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +450 -441
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +25 -4
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +71 -53
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +7 -7
- package/dist/rating.cjs +1 -1
- package/dist/rating.js +13 -13
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +10 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +36 -30
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +14 -0
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +57 -39
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +25 -9
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +128 -113
- package/package.json +2 -2
- package/src/blocks/sidebar.tsx +596 -9
- package/src/components/card.tsx +23 -0
- package/src/components/combobox.tsx +10 -0
- package/src/components/dropdown-menu.tsx +1 -1
- package/src/components/list.tsx +45 -2
- package/src/components/popover.tsx +1 -1
- package/src/components/rating.tsx +1 -1
- package/src/components/select.tsx +24 -2
- package/src/components/table.tsx +39 -2
- package/src/components/tabs.tsx +195 -146
package/src/components/card.tsx
CHANGED
|
@@ -228,6 +228,28 @@ const CardAction = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
|
|
|
228
228
|
);
|
|
229
229
|
CardAction.displayName = "CardAction";
|
|
230
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Media container for images, videos, or other visual content within the Card.
|
|
233
|
+
*/
|
|
234
|
+
const CardMedia = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
|
|
235
|
+
({ className, children, ...props }, ref) => {
|
|
236
|
+
const { flush, density } = React.useContext(CardContext);
|
|
237
|
+
return (
|
|
238
|
+
<div
|
|
239
|
+
ref={ref}
|
|
240
|
+
className={cn(subPadding(flush, density), className)}
|
|
241
|
+
data-slot="card-media"
|
|
242
|
+
{...props}
|
|
243
|
+
>
|
|
244
|
+
<div className="overflow-hidden rounded-md" data-slot="card-media-clip">
|
|
245
|
+
{children}
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
CardMedia.displayName = "CardMedia";
|
|
252
|
+
|
|
231
253
|
/**
|
|
232
254
|
* Main content area of the Card.
|
|
233
255
|
*/
|
|
@@ -275,6 +297,7 @@ export {
|
|
|
275
297
|
CardTitle,
|
|
276
298
|
CardAction,
|
|
277
299
|
CardDescription,
|
|
300
|
+
CardMedia,
|
|
278
301
|
CardContent,
|
|
279
302
|
};
|
|
280
303
|
|
|
@@ -1352,6 +1352,14 @@ export interface ComboboxItemProps extends Omit<
|
|
|
1352
1352
|
highlightClassName?: string;
|
|
1353
1353
|
/** Additional keywords to match against when filtering. The item label is always included automatically. */
|
|
1354
1354
|
keywords?: string[];
|
|
1355
|
+
/**
|
|
1356
|
+
* Callback fired when the item is activated (clicked or chosen via keyboard).
|
|
1357
|
+
* Fires on every activation, including when the item is being deselected
|
|
1358
|
+
* (toggled off). Always receives the item's own value, not the resulting
|
|
1359
|
+
* combobox value — use `Combobox`'s `onValueChange` for selection state.
|
|
1360
|
+
* @param value - The value of the activated item
|
|
1361
|
+
*/
|
|
1362
|
+
onSelect?: (value: string) => void;
|
|
1355
1363
|
}
|
|
1356
1364
|
|
|
1357
1365
|
const ComboboxItem = React.forwardRef<
|
|
@@ -1368,6 +1376,7 @@ const ComboboxItem = React.forwardRef<
|
|
|
1368
1376
|
highlight,
|
|
1369
1377
|
highlightClassName,
|
|
1370
1378
|
keywords,
|
|
1379
|
+
onSelect,
|
|
1371
1380
|
...props
|
|
1372
1381
|
},
|
|
1373
1382
|
ref
|
|
@@ -1407,6 +1416,7 @@ const ComboboxItem = React.forwardRef<
|
|
|
1407
1416
|
const newValue = itemValue === value ? "" : itemValue;
|
|
1408
1417
|
onValueChange(newValue);
|
|
1409
1418
|
setOpen(false);
|
|
1419
|
+
onSelect?.(itemValue);
|
|
1410
1420
|
};
|
|
1411
1421
|
|
|
1412
1422
|
// Render children with optional highlighting
|
|
@@ -61,10 +61,10 @@ const DropdownMenuTrigger = React.forwardRef<
|
|
|
61
61
|
<DropdownMenuPrimitive.Trigger
|
|
62
62
|
ref={ref}
|
|
63
63
|
className={className}
|
|
64
|
-
data-hook={dataHook}
|
|
65
64
|
data-slot="dropdown-menu-trigger"
|
|
66
65
|
data-tracking-el={trackingEl}
|
|
67
66
|
data-tracking-label={trackingLabel}
|
|
67
|
+
{...(dataHook != null && { "data-hook": dataHook })}
|
|
68
68
|
{...props}
|
|
69
69
|
/>
|
|
70
70
|
);
|
package/src/components/list.tsx
CHANGED
|
@@ -25,6 +25,7 @@ const itemVariants = cva(
|
|
|
25
25
|
{
|
|
26
26
|
variants: {
|
|
27
27
|
variant: {
|
|
28
|
+
default: [],
|
|
28
29
|
filled: ["bg-card"],
|
|
29
30
|
outline: ["bg-background", "border", "border-border"],
|
|
30
31
|
loading: ["flex-col", "gap-2", "px-0", "pt-0", "pb-3"],
|
|
@@ -107,12 +108,13 @@ export type ItemProps = React.ComponentProps<"li"> & {
|
|
|
107
108
|
asChild?: boolean;
|
|
108
109
|
/**
|
|
109
110
|
* Visual style of the item row.
|
|
111
|
+
* - `default` — plain row without background or border
|
|
110
112
|
* - `filled` — card background (default)
|
|
111
113
|
* - `outline` — bordered row on page background
|
|
112
114
|
* - `loading` — skeleton placeholder
|
|
113
115
|
* @default "filled"
|
|
114
116
|
*/
|
|
115
|
-
variant?: "filled" | "outline" | "loading";
|
|
117
|
+
variant?: "default" | "filled" | "outline" | "loading";
|
|
116
118
|
/**
|
|
117
119
|
* Data hook for automated testing.
|
|
118
120
|
*/
|
|
@@ -128,7 +130,7 @@ export type ItemProps = React.ComponentProps<"li"> & {
|
|
|
128
130
|
};
|
|
129
131
|
|
|
130
132
|
/**
|
|
131
|
-
* Row component within a List. Supports `filled`, `outline`, and `loading` variants.
|
|
133
|
+
* Row component within a List. Supports `default`, `filled`, `outline`, and `loading` variants.
|
|
132
134
|
* Compose with ItemMedia, ItemContent, ItemTitle, ItemDescription, and ItemActions.
|
|
133
135
|
*/
|
|
134
136
|
const Item = React.forwardRef<HTMLLIElement, ItemProps>(
|
|
@@ -285,6 +287,46 @@ const ItemActions = React.forwardRef<HTMLDivElement, ItemActionsProps>(
|
|
|
285
287
|
);
|
|
286
288
|
ItemActions.displayName = "ItemActions";
|
|
287
289
|
|
|
290
|
+
/* -------------------------------------------------------------------------------------------------
|
|
291
|
+
* ItemSubheader
|
|
292
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
293
|
+
|
|
294
|
+
/** Props for the ItemSubheader sub-component — section heading within a List. */
|
|
295
|
+
export type ItemSubheaderProps = React.ComponentProps<"li"> & {
|
|
296
|
+
/**
|
|
297
|
+
* Data hook for automated testing.
|
|
298
|
+
*/
|
|
299
|
+
dataHook?: string;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Section heading for grouping related items within a List.
|
|
304
|
+
* Renders as a non-interactive `<li>` with muted label styling.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```tsx
|
|
308
|
+
* <List dataHook="actions-list">
|
|
309
|
+
* <ItemSubheader>Suggestions</ItemSubheader>
|
|
310
|
+
* <Item variant="default" dataHook="item-1">...</Item>
|
|
311
|
+
* </List>
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
const ItemSubheader = React.forwardRef<HTMLLIElement, ItemSubheaderProps>(
|
|
315
|
+
({ className, dataHook, ...props }, ref) => (
|
|
316
|
+
<li
|
|
317
|
+
ref={ref}
|
|
318
|
+
className={cn(
|
|
319
|
+
"text-muted-foreground flex items-center py-2 pr-2 pl-4 text-base leading-none font-medium",
|
|
320
|
+
className
|
|
321
|
+
)}
|
|
322
|
+
data-hook={dataHook}
|
|
323
|
+
data-slot="item-subheader"
|
|
324
|
+
{...props}
|
|
325
|
+
/>
|
|
326
|
+
)
|
|
327
|
+
);
|
|
328
|
+
ItemSubheader.displayName = "ItemSubheader";
|
|
329
|
+
|
|
288
330
|
/* -------------------------------------------------------------------------------------------------
|
|
289
331
|
* Exports
|
|
290
332
|
* -----------------------------------------------------------------------------------------------*/
|
|
@@ -297,5 +339,6 @@ export {
|
|
|
297
339
|
ItemTitle,
|
|
298
340
|
ItemDescription,
|
|
299
341
|
ItemActions,
|
|
342
|
+
ItemSubheader,
|
|
300
343
|
itemVariants,
|
|
301
344
|
};
|
|
@@ -44,8 +44,8 @@ const PopoverTrigger = React.forwardRef<
|
|
|
44
44
|
>(({ dataHook, ...props }, ref) => (
|
|
45
45
|
<PopoverPrimitive.Trigger
|
|
46
46
|
ref={ref}
|
|
47
|
-
data-hook={dataHook}
|
|
48
47
|
data-slot="popover-trigger"
|
|
48
|
+
{...(dataHook != null && { "data-hook": dataHook })}
|
|
49
49
|
{...props}
|
|
50
50
|
/>
|
|
51
51
|
));
|
|
@@ -19,6 +19,17 @@ interface SelectProps extends React.ComponentProps<
|
|
|
19
19
|
children?: React.ReactNode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
interface SelectContentProps extends React.ComponentProps<
|
|
23
|
+
typeof SelectPrimitive.Content
|
|
24
|
+
> {
|
|
25
|
+
/**
|
|
26
|
+
* Maximum height of the dropdown in pixels.
|
|
27
|
+
* Constrains the dropdown height and shows scroll indicators when content overflows.
|
|
28
|
+
* The dropdown uses the smaller of this value and the available viewport space.
|
|
29
|
+
*/
|
|
30
|
+
maxHeight?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
// ============================================================================
|
|
23
34
|
// Main Select Component
|
|
24
35
|
// ============================================================================
|
|
@@ -191,8 +202,10 @@ function SelectContent({
|
|
|
191
202
|
className,
|
|
192
203
|
children,
|
|
193
204
|
position = "popper",
|
|
205
|
+
maxHeight,
|
|
206
|
+
style,
|
|
194
207
|
...props
|
|
195
|
-
}:
|
|
208
|
+
}: SelectContentProps) {
|
|
196
209
|
const viewportRef = React.useRef<HTMLDivElement>(null);
|
|
197
210
|
|
|
198
211
|
useDevWarning(
|
|
@@ -238,12 +251,21 @@ function SelectContent({
|
|
|
238
251
|
"data-[side=top]:-translate-y-1"
|
|
239
252
|
);
|
|
240
253
|
|
|
254
|
+
const contentStyle: React.CSSProperties | undefined =
|
|
255
|
+
maxHeight !== undefined
|
|
256
|
+
? {
|
|
257
|
+
...style,
|
|
258
|
+
maxHeight: `min(${maxHeight}px, var(--radix-select-content-available-height))`,
|
|
259
|
+
}
|
|
260
|
+
: style;
|
|
261
|
+
|
|
241
262
|
return (
|
|
242
263
|
<SelectPrimitive.Portal>
|
|
243
264
|
<SelectPrimitive.Content
|
|
244
265
|
className={cn(baseStyles, popperStyles, className)}
|
|
245
266
|
data-slot="select-content"
|
|
246
267
|
position={position}
|
|
268
|
+
style={contentStyle}
|
|
247
269
|
{...props}
|
|
248
270
|
>
|
|
249
271
|
<SelectScrollUpButton />
|
|
@@ -420,4 +442,4 @@ export {
|
|
|
420
442
|
SelectValue,
|
|
421
443
|
};
|
|
422
444
|
|
|
423
|
-
export type { SelectProps, SelectTriggerProps };
|
|
445
|
+
export type { SelectContentProps, SelectProps, SelectTriggerProps };
|
package/src/components/table.tsx
CHANGED
|
@@ -64,14 +64,50 @@ interface TableProps extends React.ComponentProps<"table"> {
|
|
|
64
64
|
* Tracking label for analytics context
|
|
65
65
|
*/
|
|
66
66
|
trackingLabel?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Minimum width for the table (e.g., "600px", "40rem").
|
|
69
|
+
* Prevents columns from compressing on narrow viewports and enables
|
|
70
|
+
* horizontal scroll via the built-in overflow container.
|
|
71
|
+
* When set, the scroll container becomes a focusable region for
|
|
72
|
+
* keyboard accessibility.
|
|
73
|
+
*/
|
|
74
|
+
minWidth?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Accessible label for the scroll container region.
|
|
77
|
+
* Used when `minWidth` is set to provide context for keyboard users.
|
|
78
|
+
* @default "Scrollable table"
|
|
79
|
+
*/
|
|
80
|
+
scrollRegionLabel?: string;
|
|
67
81
|
}
|
|
68
82
|
|
|
69
83
|
const Table = React.forwardRef<HTMLTableElement, TableProps>(
|
|
70
|
-
(
|
|
84
|
+
(
|
|
85
|
+
{
|
|
86
|
+
className,
|
|
87
|
+
dataHook,
|
|
88
|
+
trackingEl,
|
|
89
|
+
trackingLabel,
|
|
90
|
+
minWidth,
|
|
91
|
+
scrollRegionLabel,
|
|
92
|
+
style,
|
|
93
|
+
...props
|
|
94
|
+
},
|
|
95
|
+
ref
|
|
96
|
+
) => {
|
|
71
97
|
return (
|
|
72
98
|
<div
|
|
73
|
-
className=
|
|
99
|
+
className={cn(
|
|
100
|
+
"relative w-full overflow-x-auto",
|
|
101
|
+
minWidth && "focus-visible:shadow-default rounded-md outline-none"
|
|
102
|
+
)}
|
|
74
103
|
data-slot="table-container"
|
|
104
|
+
{...(minWidth
|
|
105
|
+
? {
|
|
106
|
+
role: "region",
|
|
107
|
+
"aria-label": scrollRegionLabel ?? "Scrollable table",
|
|
108
|
+
tabIndex: 0,
|
|
109
|
+
}
|
|
110
|
+
: undefined)}
|
|
75
111
|
>
|
|
76
112
|
<table
|
|
77
113
|
ref={ref}
|
|
@@ -80,6 +116,7 @@ const Table = React.forwardRef<HTMLTableElement, TableProps>(
|
|
|
80
116
|
data-slot="table"
|
|
81
117
|
data-tracking-el={trackingEl}
|
|
82
118
|
data-tracking-label={trackingLabel}
|
|
119
|
+
style={{ minWidth, ...style }}
|
|
83
120
|
{...props}
|
|
84
121
|
/>
|
|
85
122
|
</div>
|