@brightlocal/ui-components 3.1.0 → 3.2.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/README.md +6 -1
- package/component-meta.json +663 -38
- package/deprecations.json +1 -1
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +32 -3
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +61 -58
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +58 -57
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +9 -0
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +50 -30
- package/dist/banner.cjs +1 -0
- package/dist/banner.d.ts +81 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +176 -0
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +4 -3
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +21 -20
- package/dist/blocks/progress-state.d.ts +2 -2
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +17 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +8 -2
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +86 -6
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +185 -96
- package/dist/chart.cjs +3 -3
- package/dist/chart.d.ts +231 -13
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +466 -306
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +2 -1
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +2 -2
- package/dist/command.cjs +1 -1
- package/dist/command.js +1 -1
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +169 -22
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +695 -561
- package/dist/grid.d.ts +24 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +593 -561
- package/dist/info-tooltip.cjs +1 -0
- package/dist/info-tooltip.d.ts +39 -0
- package/dist/info-tooltip.d.ts.map +1 -0
- package/dist/info-tooltip.js +41 -0
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +1 -1
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +33 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +167 -54
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +28 -6
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +5 -5
- package/dist/input.cjs +1 -1
- package/dist/input.js +10 -10
- package/dist/lib/block-illustration.cjs +1 -1
- package/dist/lib/block-illustration.d.ts +4 -1
- package/dist/lib/block-illustration.d.ts.map +1 -1
- package/dist/lib/block-illustration.js +12 -11
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +4 -3
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/multi-select-filter.cjs +1 -0
- package/dist/multi-select-filter.d.ts +178 -0
- package/dist/multi-select-filter.d.ts.map +1 -0
- package/dist/multi-select-filter.js +463 -0
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +123 -16
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +89 -75
- package/dist/rating.cjs +1 -1
- package/dist/rating.js +18 -18
- package/dist/relative-date.cjs +1 -0
- package/dist/relative-date.d.ts +65 -0
- package/dist/relative-date.d.ts.map +1 -0
- package/dist/relative-date.js +128 -0
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +11 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +97 -81
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +78 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +192 -85
- package/dist/single-select-filter.cjs +1 -0
- package/dist/single-select-filter.d.ts +81 -0
- package/dist/single-select-filter.d.ts.map +1 -0
- package/dist/single-select-filter.js +226 -0
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +22 -22
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +13 -13
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +45 -4
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +90 -73
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +12 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +148 -126
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts +38 -36
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +262 -73
- package/dist/typography-text.d.ts +1 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography.d.ts +1 -1
- package/package.json +5 -6
- package/src/blocks/empty-state.tsx +8 -3
- package/src/blocks/progress-state.tsx +2 -2
- package/src/blocks/sidebar.tsx +26 -2
- package/src/components/alert-dialog.tsx +50 -5
- package/src/components/alert.tsx +16 -8
- package/src/components/badge.tsx +40 -3
- package/src/components/banner.tsx +288 -0
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/card.tsx +211 -24
- package/src/components/chart.tsx +523 -35
- package/src/components/checkbox.tsx +1 -1
- package/src/components/combobox.tsx +2 -2
- package/src/components/command.tsx +1 -1
- package/src/components/data-table.tsx +778 -195
- package/src/components/grid.tsx +32 -1
- package/src/components/info-tooltip.tsx +94 -0
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +246 -11
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +33 -11
- package/src/components/input.tsx +1 -1
- package/src/components/list.tsx +1 -1
- package/src/components/multi-select-filter.tsx +912 -0
- package/src/components/progress.tsx +190 -31
- package/src/components/rating.tsx +1 -1
- package/src/components/relative-date.tsx +230 -0
- package/src/components/select.tsx +35 -5
- package/src/components/sheet.tsx +240 -4
- package/src/components/single-select-filter.tsx +443 -0
- package/src/components/sonner.tsx +16 -5
- package/src/components/split-layout.tsx +2 -2
- package/src/components/table.tsx +71 -11
- package/src/components/tabs.tsx +93 -46
- package/src/components/textarea.tsx +1 -1
- package/src/components/tooltip.tsx +440 -68
- package/src/components/typography-text.tsx +1 -2
- package/src/components/typography.tsx +1 -1
- package/src/hooks/use-breakpoint.ts +2 -1
- package/src/index.ts +5 -0
- package/src/lib/block-illustration.tsx +5 -1
- package/src/lib/utils.ts +1 -0
package/src/components/tabs.tsx
CHANGED
|
@@ -2,14 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
5
6
|
|
|
6
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Visual variant of the Tabs component.
|
|
11
|
+
* - `default` — pill-style tabs with muted background (the classic look)
|
|
12
|
+
* - `underline` — border-bottom tabs with an active primary underline
|
|
13
|
+
*/
|
|
14
|
+
type TabsVariant = "default" | "underline";
|
|
15
|
+
|
|
8
16
|
interface TabsContextValue {
|
|
9
17
|
lazyMount: boolean;
|
|
10
18
|
unmountOnExit: boolean;
|
|
11
19
|
activeValue: string | undefined;
|
|
12
20
|
visitedTabs: Set<string>;
|
|
21
|
+
variant: TabsVariant;
|
|
13
22
|
}
|
|
14
23
|
|
|
15
24
|
const TabsContext = React.createContext<TabsContextValue>({
|
|
@@ -17,8 +26,59 @@ const TabsContext = React.createContext<TabsContextValue>({
|
|
|
17
26
|
unmountOnExit: false,
|
|
18
27
|
activeValue: undefined,
|
|
19
28
|
visitedTabs: new Set(),
|
|
29
|
+
variant: "default",
|
|
30
|
+
});
|
|
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",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: "default",
|
|
41
|
+
},
|
|
20
42
|
});
|
|
21
43
|
|
|
44
|
+
const tabsTriggerVariants = cva(
|
|
45
|
+
[
|
|
46
|
+
"inline-flex items-center justify-center gap-2",
|
|
47
|
+
"text-label whitespace-nowrap",
|
|
48
|
+
"focus-visible:outline-none",
|
|
49
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
50
|
+
],
|
|
51
|
+
{
|
|
52
|
+
variants: {
|
|
53
|
+
variant: {
|
|
54
|
+
default: [
|
|
55
|
+
"px-2 py-1",
|
|
56
|
+
"rounded-md border border-transparent",
|
|
57
|
+
"text-muted-foreground hover:text-foreground",
|
|
58
|
+
"transition-[color,box-shadow] duration-fast ease-out",
|
|
59
|
+
"data-[state=active]:bg-background data-[state=active]:shadow-sm data-[state=active]:text-foreground",
|
|
60
|
+
"focus-visible:border-ring",
|
|
61
|
+
"data-[state=inactive]:focus-visible:shadow-default",
|
|
62
|
+
"data-[state=active]:focus-visible:shadow-default",
|
|
63
|
+
"dark:data-[state=active]:border-white/15 dark:data-[state=active]:bg-white/5",
|
|
64
|
+
],
|
|
65
|
+
underline: [
|
|
66
|
+
"-mb-px px-3 py-1.5",
|
|
67
|
+
"rounded-none border-b-2 border-transparent bg-transparent",
|
|
68
|
+
"first:rounded-l-none last:rounded-r-none",
|
|
69
|
+
"text-muted-foreground hover:bg-transparent hover:text-foreground",
|
|
70
|
+
"data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-foreground",
|
|
71
|
+
"transition-[color,border-color,box-shadow] duration-fast ease-out",
|
|
72
|
+
"focus-visible:rounded-md focus-visible:shadow-default",
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
defaultVariants: {
|
|
77
|
+
variant: "default",
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
22
82
|
/**
|
|
23
83
|
* Props for the Tabs component.
|
|
24
84
|
* Generic over the tab value type for type-safe `value` and `onValueChange`.
|
|
@@ -34,6 +94,11 @@ interface TabsProps<T extends string = string> extends Omit<
|
|
|
34
94
|
trackingEl?: string;
|
|
35
95
|
/** Tracking label for analytics context */
|
|
36
96
|
trackingLabel?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Visual variant.
|
|
99
|
+
* @default "default"
|
|
100
|
+
*/
|
|
101
|
+
variant?: TabsVariant;
|
|
37
102
|
/** Only mount tab panel content when the tab is first activated (opt-in) */
|
|
38
103
|
lazyMount?: boolean;
|
|
39
104
|
/** Unmount tab panel content when the tab becomes inactive */
|
|
@@ -52,6 +117,7 @@ function TabsInner<T extends string = string>(
|
|
|
52
117
|
dataHook,
|
|
53
118
|
trackingEl,
|
|
54
119
|
trackingLabel,
|
|
120
|
+
variant = "default",
|
|
55
121
|
lazyMount = false,
|
|
56
122
|
unmountOnExit = false,
|
|
57
123
|
value: controlledValue,
|
|
@@ -91,8 +157,9 @@ function TabsInner<T extends string = string>(
|
|
|
91
157
|
unmountOnExit,
|
|
92
158
|
activeValue,
|
|
93
159
|
visitedTabs,
|
|
160
|
+
variant,
|
|
94
161
|
}),
|
|
95
|
-
[lazyMount, unmountOnExit, activeValue, visitedTabs]
|
|
162
|
+
[lazyMount, unmountOnExit, activeValue, visitedTabs, variant]
|
|
96
163
|
);
|
|
97
164
|
|
|
98
165
|
return (
|
|
@@ -141,25 +208,21 @@ interface TabsListProps extends React.ComponentProps<
|
|
|
141
208
|
const TabsList = React.forwardRef<
|
|
142
209
|
React.ComponentRef<typeof TabsPrimitive.List>,
|
|
143
210
|
TabsListProps
|
|
144
|
-
>(({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) =>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
data-tracking-label={trackingLabel}
|
|
160
|
-
{...props}
|
|
161
|
-
/>
|
|
162
|
-
));
|
|
211
|
+
>(({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => {
|
|
212
|
+
const { variant } = React.useContext(TabsContext);
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<TabsPrimitive.List
|
|
216
|
+
ref={ref}
|
|
217
|
+
className={cn(tabsListVariants({ variant }), className)}
|
|
218
|
+
data-hook={dataHook}
|
|
219
|
+
data-slot="tabs-list"
|
|
220
|
+
data-tracking-el={trackingEl}
|
|
221
|
+
data-tracking-label={trackingLabel}
|
|
222
|
+
{...props}
|
|
223
|
+
/>
|
|
224
|
+
);
|
|
225
|
+
});
|
|
163
226
|
|
|
164
227
|
TabsList.displayName = "TabsList";
|
|
165
228
|
|
|
@@ -192,34 +255,12 @@ function TabsTriggerInner<T extends string = string>(
|
|
|
192
255
|
}: TabsTriggerProps<T>,
|
|
193
256
|
ref: React.ForwardedRef<React.ComponentRef<typeof TabsPrimitive.Trigger>>
|
|
194
257
|
) {
|
|
258
|
+
const { variant } = React.useContext(TabsContext);
|
|
259
|
+
|
|
195
260
|
return (
|
|
196
261
|
<TabsPrimitive.Trigger
|
|
197
262
|
ref={ref}
|
|
198
|
-
className={cn(
|
|
199
|
-
// Layout
|
|
200
|
-
"inline-flex items-center justify-center gap-2 px-2 py-1",
|
|
201
|
-
// Typography
|
|
202
|
-
"text-label whitespace-nowrap",
|
|
203
|
-
// Border radius
|
|
204
|
-
"rounded-md",
|
|
205
|
-
// Border
|
|
206
|
-
"border border-transparent",
|
|
207
|
-
// Text color
|
|
208
|
-
"text-foreground",
|
|
209
|
-
// Transition with explicit duration and easing
|
|
210
|
-
"duration-fast transition-[color,box-shadow] ease-out",
|
|
211
|
-
// Active state
|
|
212
|
-
"data-[state=active]:bg-background data-[state=active]:shadow-sm",
|
|
213
|
-
// Focus state - use compound selector for active+focused to override shadow-sm with shadow-default
|
|
214
|
-
"focus-visible:border-ring focus-visible:outline-none",
|
|
215
|
-
"data-[state=inactive]:focus-visible:shadow-default",
|
|
216
|
-
"data-[state=active]:focus-visible:shadow-default",
|
|
217
|
-
// Dark mode active state
|
|
218
|
-
"dark:data-[state=active]:border-white/15 dark:data-[state=active]:bg-white/5",
|
|
219
|
-
// Disabled state
|
|
220
|
-
"disabled:pointer-events-none disabled:opacity-50",
|
|
221
|
-
className
|
|
222
|
-
)}
|
|
263
|
+
className={cn(tabsTriggerVariants({ variant }), className)}
|
|
223
264
|
data-hook={dataHook}
|
|
224
265
|
data-slot="tabs-trigger"
|
|
225
266
|
data-tracking-el={trackingEl}
|
|
@@ -306,4 +347,10 @@ const TabsContent = React.forwardRef(TabsContentInner) as <
|
|
|
306
347
|
|
|
307
348
|
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
308
349
|
|
|
309
|
-
export type {
|
|
350
|
+
export type {
|
|
351
|
+
TabsProps,
|
|
352
|
+
TabsListProps,
|
|
353
|
+
TabsTriggerProps,
|
|
354
|
+
TabsContentProps,
|
|
355
|
+
TabsVariant,
|
|
356
|
+
};
|
|
@@ -10,7 +10,7 @@ const textareaVariants = cva([
|
|
|
10
10
|
"border border-input bg-background rounded-md",
|
|
11
11
|
"outline-none transition-[border-color,background-color,box-shadow] duration-fast ease-out",
|
|
12
12
|
// Typography
|
|
13
|
-
"text-
|
|
13
|
+
"text-field",
|
|
14
14
|
"text-foreground",
|
|
15
15
|
// Spacing
|
|
16
16
|
"px-3 py-2",
|