@brightlocal/ui-components 0.1.2 → 0.1.4
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/accordion.cjs +1 -1
- package/dist/accordion.d.ts +74 -4
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +100 -105
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +30 -10
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +129 -132
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +22 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +1 -1
- package/dist/aspect-ratio.cjs +1 -1
- package/dist/aspect-ratio.d.ts +11 -1
- package/dist/aspect-ratio.d.ts.map +1 -1
- package/dist/aspect-ratio.js +16 -20
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.d.ts +43 -3
- package/dist/avatar.d.ts.map +1 -1
- package/dist/avatar.js +18 -16
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +24 -9
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +34 -32
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +177 -170
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +38 -307
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +411 -508
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +63 -8
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +97 -93
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts +17 -45
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +49 -50
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts +16 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +31 -29
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +58 -18
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +60 -51
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +99 -9
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +142 -128
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.d.ts +18 -15
- package/dist/centred-layout.d.ts.map +1 -1
- package/dist/centred-layout.js +44 -33
- package/dist/chart.cjs +4 -4
- package/dist/chart.d.ts +70 -7
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +71 -66
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +9 -5
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +61 -82
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.d.ts +65 -8
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +41 -55
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts +28 -18
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +191 -160
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +115 -9
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +176 -152
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts +188 -20
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +120 -122
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +75 -9
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +221 -82
- package/dist/description.cjs +1 -0
- package/dist/description.d.ts +37 -0
- package/dist/description.d.ts.map +1 -0
- package/dist/description.js +25 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +73 -9
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +103 -112
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +92 -0
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +67 -52
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts +95 -11
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +146 -106
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +26 -6
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +55 -53
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +27 -17
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +86 -79
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +36 -6
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +44 -42
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +367 -386
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +21 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +51 -41
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +25 -26
- package/dist/input.cjs +1 -1
- package/dist/input.d.ts +38 -24
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +68 -136
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts +20 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +31 -18
- package/dist/link.cjs +1 -1
- package/dist/link.js +1 -1
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +9 -4
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +20 -21
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts +43 -6
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +100 -78
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts +6 -54
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +73 -84
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +8 -10
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +78 -86
- package/dist/popover.cjs +1 -1
- package/dist/popover.d.ts +59 -4
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +42 -34
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +9 -2
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +71 -59
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.d.ts +33 -10
- package/dist/radio-group.d.ts.map +1 -1
- package/dist/radio-group.js +56 -66
- package/dist/rating.d.ts +4 -0
- package/dist/rating.d.ts.map +1 -1
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.d.ts +58 -6
- package/dist/resizable.d.ts.map +1 -1
- package/dist/resizable.js +38 -37
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +46 -5
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +42 -38
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts +30 -0
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +64 -54
- package/dist/separator.cjs +1 -1
- package/dist/separator.d.ts +52 -5
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +45 -35
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +85 -19
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +117 -115
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +24 -2
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +15 -9
- package/dist/slider.cjs +1 -1
- package/dist/slider.d.ts +18 -4
- package/dist/slider.d.ts.map +1 -1
- package/dist/slider.js +72 -66
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts +21 -22
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +46 -48
- package/dist/split-layout.d.ts +4 -1
- package/dist/split-layout.d.ts.map +1 -1
- package/dist/switch.cjs +1 -1
- package/dist/switch.d.ts +2 -12
- package/dist/switch.d.ts.map +1 -1
- package/dist/switch.js +37 -41
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +16 -12
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +56 -58
- package/dist/tabs.d.ts +27 -3
- package/dist/tabs.d.ts.map +1 -1
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.d.ts +57 -7
- package/dist/toggle-group.d.ts.map +1 -1
- package/dist/toggle-group.js +60 -67
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.d.ts +12 -26
- package/dist/toggle.d.ts.map +1 -1
- package/dist/toggle.js +16 -20
- package/package.json +9 -3
- package/src/blocks/data-table.tsx +43 -33
- package/src/blocks/sidebar.tsx +158 -541
- package/src/components/accordion.tsx +164 -78
- package/src/components/alert-dialog.tsx +156 -111
- package/src/components/alert.tsx +27 -14
- package/src/components/aspect-ratio.tsx +25 -16
- package/src/components/avatar.tsx +56 -8
- package/src/components/badge.tsx +65 -42
- package/src/components/breadcrumb.tsx +159 -83
- package/src/components/button.tsx +42 -63
- package/src/components/calendar.tsx +22 -6
- package/src/components/card.tsx +92 -40
- package/src/components/carousel.tsx +240 -115
- package/src/components/centred-layout.tsx +68 -49
- package/src/components/chart.tsx +118 -47
- package/src/components/checkbox.tsx +43 -79
- package/src/components/collapsible.tsx +95 -26
- package/src/components/combobox.tsx +243 -153
- package/src/components/command.tsx +295 -121
- package/src/components/context-menu.tsx +279 -82
- package/src/components/date-picker.tsx +282 -31
- package/src/components/description.tsx +60 -0
- package/src/components/dialog.tsx +163 -87
- package/src/components/drawer.tsx +76 -2
- package/src/components/dropdown-menu.tsx +143 -37
- package/src/components/field.tsx +38 -11
- package/src/components/global-layout.tsx +116 -77
- package/src/components/hover-card.tsx +54 -14
- package/src/components/input-group.tsx +56 -18
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +4 -5
- package/src/components/input.tsx +93 -186
- package/src/components/label.tsx +56 -15
- package/src/components/link.tsx +1 -1
- package/src/components/logo.tsx +12 -7
- package/src/components/menubar.tsx +61 -5
- package/src/components/navigation-menu.tsx +37 -99
- package/src/components/pagination.tsx +13 -19
- package/src/components/popover.tsx +103 -20
- package/src/components/progress.tsx +82 -60
- package/src/components/radio-group.tsx +44 -25
- package/src/components/rating.tsx +4 -0
- package/src/components/resizable.tsx +88 -38
- package/src/components/scroll-area.tsx +123 -56
- package/src/components/select.tsx +22 -2
- package/src/components/separator.tsx +101 -24
- package/src/components/sheet.tsx +186 -90
- package/src/components/skeleton.tsx +40 -10
- package/src/components/slider.tsx +83 -57
- package/src/components/sonner.tsx +34 -34
- package/src/components/split-layout.tsx +4 -1
- package/src/components/switch.figma.tsx +7 -11
- package/src/components/switch.tsx +9 -19
- package/src/components/table.tsx +23 -18
- package/src/components/tabs.tsx +27 -3
- package/src/components/toggle-group.tsx +115 -86
- package/src/components/toggle.figma.tsx +13 -19
- package/src/components/toggle.tsx +20 -34
- package/src/index.ts +1 -1
- package/dist/input-base.cjs +0 -1
- package/dist/input-base.d.ts +0 -28
- package/dist/input-base.d.ts.map +0 -1
- package/dist/input-base.js +0 -56
- package/src/components/input-base.tsx +0 -86
package/src/components/link.tsx
CHANGED
package/src/components/logo.tsx
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { cva, VariantProps } from "class-variance-authority";
|
|
2
2
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Visual style variants for the Logo component.
|
|
6
|
+
* - `logotype`: Full BrightLocal logo with text
|
|
7
|
+
* - `mark`: Icon-only logo mark
|
|
8
|
+
*/
|
|
9
|
+
export type LogoVariant = "logotype" | "mark";
|
|
8
10
|
|
|
9
11
|
const logoVariants = cva("inline-flex [&_path]:fill-primary", {
|
|
10
12
|
variants: {
|
|
@@ -14,7 +16,7 @@ const logoVariants = cva("inline-flex [&_path]:fill-primary", {
|
|
|
14
16
|
},
|
|
15
17
|
},
|
|
16
18
|
defaultVariants: {
|
|
17
|
-
variant:
|
|
19
|
+
variant: "logotype",
|
|
18
20
|
},
|
|
19
21
|
});
|
|
20
22
|
|
|
@@ -49,12 +51,13 @@ function Logo({
|
|
|
49
51
|
aria-label="BrightLocal Logo"
|
|
50
52
|
className={cn(logoVariants({ variant }), className)}
|
|
51
53
|
data-hook={dataHook}
|
|
54
|
+
data-slot="logo"
|
|
52
55
|
data-tracking-el={trackingEl}
|
|
53
56
|
data-tracking-label={trackingLabel}
|
|
54
57
|
role="img"
|
|
55
58
|
{...props}
|
|
56
59
|
>
|
|
57
|
-
{variant ===
|
|
60
|
+
{variant === "logotype" && (
|
|
58
61
|
<svg
|
|
59
62
|
fill="none"
|
|
60
63
|
height="30"
|
|
@@ -72,7 +75,7 @@ function Logo({
|
|
|
72
75
|
</defs>
|
|
73
76
|
</svg>
|
|
74
77
|
)}
|
|
75
|
-
{variant ===
|
|
78
|
+
{variant === "mark" && (
|
|
76
79
|
<svg
|
|
77
80
|
fill="none"
|
|
78
81
|
height="21"
|
|
@@ -94,4 +97,6 @@ function Logo({
|
|
|
94
97
|
);
|
|
95
98
|
}
|
|
96
99
|
|
|
100
|
+
Logo.displayName = "Logo";
|
|
101
|
+
|
|
97
102
|
export { Logo };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
|
4
|
-
import { Check, ChevronRight, Circle } from "
|
|
4
|
+
import { Check, ChevronRight, Circle } from "@brightlocal/icons";
|
|
5
5
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
|
|
@@ -25,12 +25,17 @@ import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
|
25
25
|
function Menubar({
|
|
26
26
|
className,
|
|
27
27
|
dataHook,
|
|
28
|
+
defaultValue,
|
|
28
29
|
...props
|
|
29
30
|
}: React.ComponentProps<typeof MenubarPrimitive.Root> & {
|
|
30
31
|
/**
|
|
31
32
|
* Required data-hook attribute for testing and analytics
|
|
32
33
|
*/
|
|
33
34
|
dataHook: string;
|
|
35
|
+
/**
|
|
36
|
+
* The value of the menu that should be open when initially rendered (uncontrolled)
|
|
37
|
+
*/
|
|
38
|
+
defaultValue?: string;
|
|
34
39
|
}) {
|
|
35
40
|
return (
|
|
36
41
|
<MenubarPrimitive.Root
|
|
@@ -42,18 +47,29 @@ function Menubar({
|
|
|
42
47
|
data-slot="menubar"
|
|
43
48
|
data-tracking-el="menubar"
|
|
44
49
|
data-tracking-label={dataHook}
|
|
50
|
+
defaultValue={defaultValue}
|
|
45
51
|
{...props}
|
|
46
52
|
/>
|
|
47
53
|
);
|
|
48
54
|
}
|
|
49
55
|
|
|
56
|
+
Menubar.displayName = "Menubar";
|
|
57
|
+
|
|
50
58
|
/**
|
|
51
59
|
* MenubarMenu - Individual menu within the menubar
|
|
52
60
|
*/
|
|
53
61
|
function MenubarMenu({
|
|
62
|
+
value,
|
|
54
63
|
...props
|
|
55
|
-
}: React.ComponentProps<typeof MenubarPrimitive.Menu>
|
|
56
|
-
|
|
64
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Menu> & {
|
|
65
|
+
/**
|
|
66
|
+
* A unique value that associates the menu with the menubar's defaultValue/value
|
|
67
|
+
*/
|
|
68
|
+
value?: string;
|
|
69
|
+
}) {
|
|
70
|
+
return (
|
|
71
|
+
<MenubarPrimitive.Menu data-slot="menubar-menu" value={value} {...props} />
|
|
72
|
+
);
|
|
57
73
|
}
|
|
58
74
|
|
|
59
75
|
/**
|
|
@@ -113,9 +129,14 @@ function MenubarContent({
|
|
|
113
129
|
*/
|
|
114
130
|
function MenubarItem({
|
|
115
131
|
className,
|
|
132
|
+
disabled,
|
|
116
133
|
inset,
|
|
117
134
|
...props
|
|
118
135
|
}: React.ComponentProps<typeof MenubarPrimitive.Item> & {
|
|
136
|
+
/**
|
|
137
|
+
* Whether the menu item is disabled
|
|
138
|
+
*/
|
|
139
|
+
disabled?: boolean;
|
|
119
140
|
/**
|
|
120
141
|
* Adds left padding for alignment with items that have icons
|
|
121
142
|
*/
|
|
@@ -132,6 +153,7 @@ function MenubarItem({
|
|
|
132
153
|
className
|
|
133
154
|
)}
|
|
134
155
|
data-slot="menubar-item"
|
|
156
|
+
disabled={disabled}
|
|
135
157
|
{...props}
|
|
136
158
|
/>
|
|
137
159
|
);
|
|
@@ -141,20 +163,31 @@ function MenubarItem({
|
|
|
141
163
|
* MenubarCheckboxItem - Menu item with checkbox
|
|
142
164
|
*/
|
|
143
165
|
function MenubarCheckboxItem({
|
|
166
|
+
checked,
|
|
144
167
|
children,
|
|
145
168
|
className,
|
|
146
169
|
closeOnSelect = true,
|
|
170
|
+
onCheckedChange,
|
|
147
171
|
onSelect,
|
|
148
172
|
...props
|
|
149
173
|
}: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem> & {
|
|
174
|
+
/**
|
|
175
|
+
* The controlled checked state of the checkbox
|
|
176
|
+
*/
|
|
177
|
+
checked?: boolean;
|
|
150
178
|
/**
|
|
151
179
|
* Whether to close the menu when the item is selected
|
|
152
180
|
* @default true
|
|
153
181
|
*/
|
|
154
182
|
closeOnSelect?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Callback fired when the checked state changes
|
|
185
|
+
*/
|
|
186
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
155
187
|
}) {
|
|
156
188
|
return (
|
|
157
189
|
<MenubarPrimitive.CheckboxItem
|
|
190
|
+
checked={checked}
|
|
158
191
|
className={cn(
|
|
159
192
|
"text-foreground relative flex cursor-pointer items-center justify-between rounded-sm py-1.5 pr-2 pl-8 text-sm font-normal transition-colors outline-none",
|
|
160
193
|
"hover:bg-accent hover:text-foreground",
|
|
@@ -163,6 +196,7 @@ function MenubarCheckboxItem({
|
|
|
163
196
|
className
|
|
164
197
|
)}
|
|
165
198
|
data-slot="menubar-checkbox-item"
|
|
199
|
+
onCheckedChange={onCheckedChange}
|
|
166
200
|
onSelect={(event) => {
|
|
167
201
|
if (!closeOnSelect) {
|
|
168
202
|
event.preventDefault();
|
|
@@ -185,10 +219,26 @@ function MenubarCheckboxItem({
|
|
|
185
219
|
* MenubarRadioGroup - Container for radio menu items
|
|
186
220
|
*/
|
|
187
221
|
function MenubarRadioGroup({
|
|
222
|
+
onValueChange,
|
|
223
|
+
value,
|
|
188
224
|
...props
|
|
189
|
-
}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>
|
|
225
|
+
}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup> & {
|
|
226
|
+
/**
|
|
227
|
+
* Callback fired when the selected value changes
|
|
228
|
+
*/
|
|
229
|
+
onValueChange?: (value: string) => void;
|
|
230
|
+
/**
|
|
231
|
+
* The controlled value of the selected radio item
|
|
232
|
+
*/
|
|
233
|
+
value?: string;
|
|
234
|
+
}) {
|
|
190
235
|
return (
|
|
191
|
-
<MenubarPrimitive.RadioGroup
|
|
236
|
+
<MenubarPrimitive.RadioGroup
|
|
237
|
+
data-slot="menubar-radio-group"
|
|
238
|
+
value={value}
|
|
239
|
+
onValueChange={onValueChange}
|
|
240
|
+
{...props}
|
|
241
|
+
/>
|
|
192
242
|
);
|
|
193
243
|
}
|
|
194
244
|
|
|
@@ -200,6 +250,7 @@ function MenubarRadioItem({
|
|
|
200
250
|
className,
|
|
201
251
|
closeOnSelect = true,
|
|
202
252
|
onSelect,
|
|
253
|
+
value,
|
|
203
254
|
...props
|
|
204
255
|
}: React.ComponentProps<typeof MenubarPrimitive.RadioItem> & {
|
|
205
256
|
/**
|
|
@@ -207,6 +258,10 @@ function MenubarRadioItem({
|
|
|
207
258
|
* @default true
|
|
208
259
|
*/
|
|
209
260
|
closeOnSelect?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* The unique value of the radio item
|
|
263
|
+
*/
|
|
264
|
+
value: string;
|
|
210
265
|
}) {
|
|
211
266
|
return (
|
|
212
267
|
<MenubarPrimitive.RadioItem
|
|
@@ -218,6 +273,7 @@ function MenubarRadioItem({
|
|
|
218
273
|
className
|
|
219
274
|
)}
|
|
220
275
|
data-slot="menubar-radio-item"
|
|
276
|
+
value={value}
|
|
221
277
|
onSelect={(event) => {
|
|
222
278
|
if (!closeOnSelect) {
|
|
223
279
|
event.preventDefault();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
5
|
-
import { ChevronDown } from "
|
|
5
|
+
import { ChevronDown } from "@brightlocal/icons";
|
|
6
6
|
|
|
7
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
8
|
|
|
@@ -78,25 +78,9 @@ NavigationMenuItem.displayName = "NavigationMenuItem";
|
|
|
78
78
|
/**
|
|
79
79
|
* Props for NavigationMenuTrigger component
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
type NavigationMenuTriggerProps = React.ComponentPropsWithoutRef<
|
|
82
82
|
typeof NavigationMenuPrimitive.Trigger
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Data hook for automated testing (REQUIRED)
|
|
86
|
-
* Used to identify component in tests and E2E automation
|
|
87
|
-
*/
|
|
88
|
-
dataHook: string;
|
|
89
|
-
/**
|
|
90
|
-
* Tracking element identifier for analytics
|
|
91
|
-
* Defaults to component name if not provided
|
|
92
|
-
*/
|
|
93
|
-
trackingEl?: string;
|
|
94
|
-
/**
|
|
95
|
-
* Tracking label for analytics context
|
|
96
|
-
* Additional context for tracking events
|
|
97
|
-
*/
|
|
98
|
-
trackingLabel?: string;
|
|
99
|
-
}
|
|
83
|
+
>;
|
|
100
84
|
|
|
101
85
|
/**
|
|
102
86
|
* Trigger button that opens a dropdown menu
|
|
@@ -105,67 +89,43 @@ interface NavigationMenuTriggerProps extends React.ComponentPropsWithoutRef<
|
|
|
105
89
|
const NavigationMenuTrigger = React.forwardRef<
|
|
106
90
|
React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
|
|
107
91
|
NavigationMenuTriggerProps
|
|
108
|
-
>(
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
{children}
|
|
137
|
-
<ChevronDown
|
|
138
|
-
aria-hidden="true"
|
|
139
|
-
className="relative top-[1px] ml-1 h-3 w-3 transition duration-300 group-data-[state=open]:rotate-180"
|
|
140
|
-
/>
|
|
141
|
-
</NavigationMenuPrimitive.Trigger>
|
|
142
|
-
)
|
|
143
|
-
);
|
|
92
|
+
>(({ className, children, ...props }, ref) => (
|
|
93
|
+
<NavigationMenuPrimitive.Trigger
|
|
94
|
+
ref={ref}
|
|
95
|
+
className={cn(
|
|
96
|
+
[
|
|
97
|
+
"group inline-flex h-9 w-max items-center justify-center gap-1",
|
|
98
|
+
"rounded-md px-4 py-2",
|
|
99
|
+
"text-sm font-medium",
|
|
100
|
+
"text-foreground",
|
|
101
|
+
"transition-colors",
|
|
102
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
103
|
+
"focus:bg-accent focus:text-accent-foreground",
|
|
104
|
+
"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",
|
|
105
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
106
|
+
"data-[state=open]:bg-accent/50",
|
|
107
|
+
],
|
|
108
|
+
className
|
|
109
|
+
)}
|
|
110
|
+
data-slot="navigation-menu-trigger"
|
|
111
|
+
{...props}
|
|
112
|
+
>
|
|
113
|
+
{children}
|
|
114
|
+
<ChevronDown
|
|
115
|
+
aria-hidden="true"
|
|
116
|
+
className="relative top-[1px] ml-1 h-3 w-3 transition duration-300 group-data-[state=open]:rotate-180"
|
|
117
|
+
/>
|
|
118
|
+
</NavigationMenuPrimitive.Trigger>
|
|
119
|
+
));
|
|
144
120
|
|
|
145
121
|
NavigationMenuTrigger.displayName = "NavigationMenuTrigger";
|
|
146
122
|
|
|
147
123
|
/**
|
|
148
124
|
* Props for NavigationMenuContent component
|
|
149
125
|
*/
|
|
150
|
-
|
|
126
|
+
type NavigationMenuContentProps = React.ComponentPropsWithoutRef<
|
|
151
127
|
typeof NavigationMenuPrimitive.Content
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Data hook for automated testing (REQUIRED)
|
|
155
|
-
* Used to identify component in tests and E2E automation
|
|
156
|
-
*/
|
|
157
|
-
dataHook: string;
|
|
158
|
-
/**
|
|
159
|
-
* Tracking element identifier for analytics
|
|
160
|
-
* Defaults to component name if not provided
|
|
161
|
-
*/
|
|
162
|
-
trackingEl?: string;
|
|
163
|
-
/**
|
|
164
|
-
* Tracking label for analytics context
|
|
165
|
-
* Additional context for tracking events
|
|
166
|
-
*/
|
|
167
|
-
trackingLabel?: string;
|
|
168
|
-
}
|
|
128
|
+
>;
|
|
169
129
|
|
|
170
130
|
/**
|
|
171
131
|
* Dropdown content container
|
|
@@ -174,7 +134,7 @@ interface NavigationMenuContentProps extends React.ComponentPropsWithoutRef<
|
|
|
174
134
|
const NavigationMenuContent = React.forwardRef<
|
|
175
135
|
React.ElementRef<typeof NavigationMenuPrimitive.Content>,
|
|
176
136
|
NavigationMenuContentProps
|
|
177
|
-
>(({ className,
|
|
137
|
+
>(({ className, ...props }, ref) => (
|
|
178
138
|
<NavigationMenuPrimitive.Content
|
|
179
139
|
ref={ref}
|
|
180
140
|
className={cn(
|
|
@@ -187,10 +147,7 @@ const NavigationMenuContent = React.forwardRef<
|
|
|
187
147
|
],
|
|
188
148
|
className
|
|
189
149
|
)}
|
|
190
|
-
data-hook={dataHook}
|
|
191
150
|
data-slot="navigation-menu-content"
|
|
192
|
-
data-tracking-el={trackingEl || "navigation-menu-content"}
|
|
193
|
-
data-tracking-label={trackingLabel}
|
|
194
151
|
{...props}
|
|
195
152
|
/>
|
|
196
153
|
));
|
|
@@ -200,25 +157,9 @@ NavigationMenuContent.displayName = "NavigationMenuContent";
|
|
|
200
157
|
/**
|
|
201
158
|
* Props for NavigationMenuLink component
|
|
202
159
|
*/
|
|
203
|
-
|
|
160
|
+
type NavigationMenuLinkProps = React.ComponentPropsWithoutRef<
|
|
204
161
|
typeof NavigationMenuPrimitive.Link
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Data hook for automated testing (REQUIRED)
|
|
208
|
-
* Used to identify component in tests and E2E automation
|
|
209
|
-
*/
|
|
210
|
-
dataHook: string;
|
|
211
|
-
/**
|
|
212
|
-
* Tracking element identifier for analytics
|
|
213
|
-
* Defaults to component name if not provided
|
|
214
|
-
*/
|
|
215
|
-
trackingEl?: string;
|
|
216
|
-
/**
|
|
217
|
-
* Tracking label for analytics context
|
|
218
|
-
* Additional context for tracking events
|
|
219
|
-
*/
|
|
220
|
-
trackingLabel?: string;
|
|
221
|
-
}
|
|
162
|
+
>;
|
|
222
163
|
|
|
223
164
|
/**
|
|
224
165
|
* Navigation link within the menu
|
|
@@ -227,7 +168,7 @@ interface NavigationMenuLinkProps extends React.ComponentPropsWithoutRef<
|
|
|
227
168
|
const NavigationMenuLink = React.forwardRef<
|
|
228
169
|
React.ElementRef<typeof NavigationMenuPrimitive.Link>,
|
|
229
170
|
NavigationMenuLinkProps
|
|
230
|
-
>(({ className,
|
|
171
|
+
>(({ className, ...props }, ref) => (
|
|
231
172
|
<NavigationMenuPrimitive.Link
|
|
232
173
|
ref={ref}
|
|
233
174
|
className={cn(
|
|
@@ -240,10 +181,7 @@ const NavigationMenuLink = React.forwardRef<
|
|
|
240
181
|
],
|
|
241
182
|
className
|
|
242
183
|
)}
|
|
243
|
-
data-hook={dataHook}
|
|
244
184
|
data-slot="navigation-menu-link"
|
|
245
|
-
data-tracking-el={trackingEl || "navigation-menu-link"}
|
|
246
|
-
data-tracking-label={trackingLabel}
|
|
247
185
|
{...props}
|
|
248
186
|
/>
|
|
249
187
|
));
|
|
@@ -3,23 +3,18 @@ import {
|
|
|
3
3
|
ChevronLeftIcon,
|
|
4
4
|
ChevronRightIcon,
|
|
5
5
|
MoreHorizontalIcon,
|
|
6
|
-
} from "
|
|
6
|
+
} from "@brightlocal/icons";
|
|
7
7
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
8
8
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Pagination item variants
|
|
12
|
+
* - `previous`: Previous navigation button
|
|
13
|
+
* - `next`: Next navigation button
|
|
14
|
+
* - `link`: Page number link
|
|
15
|
+
* - `ellipsis`: Ellipsis indicator for skipped pages
|
|
12
16
|
*/
|
|
13
|
-
export
|
|
14
|
-
/** Previous navigation button */
|
|
15
|
-
PREVIOUS = "previous",
|
|
16
|
-
/** Next navigation button */
|
|
17
|
-
NEXT = "next",
|
|
18
|
-
/** Page number link */
|
|
19
|
-
LINK = "link",
|
|
20
|
-
/** Ellipsis indicator for skipped pages */
|
|
21
|
-
ELLIPSIS = "ellipsis",
|
|
22
|
-
}
|
|
17
|
+
export type PaginationVariant = "previous" | "next" | "link" | "ellipsis";
|
|
23
18
|
|
|
24
19
|
/**
|
|
25
20
|
* Pagination hook parameters
|
|
@@ -167,7 +162,7 @@ const paginationItemVariants = cva(
|
|
|
167
162
|
},
|
|
168
163
|
},
|
|
169
164
|
defaultVariants: {
|
|
170
|
-
variant:
|
|
165
|
+
variant: "link",
|
|
171
166
|
},
|
|
172
167
|
}
|
|
173
168
|
);
|
|
@@ -205,6 +200,8 @@ function Pagination({
|
|
|
205
200
|
);
|
|
206
201
|
}
|
|
207
202
|
|
|
203
|
+
Pagination.displayName = "Pagination";
|
|
204
|
+
|
|
208
205
|
function PaginationContent({
|
|
209
206
|
className,
|
|
210
207
|
...props
|
|
@@ -270,7 +267,7 @@ const PaginationPrevious = React.forwardRef<
|
|
|
270
267
|
aria-label="Go to previous page"
|
|
271
268
|
className={className}
|
|
272
269
|
disabled={disabled}
|
|
273
|
-
variant=
|
|
270
|
+
variant="previous"
|
|
274
271
|
{...props}
|
|
275
272
|
>
|
|
276
273
|
<ChevronLeftIcon className="size-4" />
|
|
@@ -294,7 +291,7 @@ const PaginationNext = React.forwardRef<HTMLButtonElement, PaginationNextProps>(
|
|
|
294
291
|
aria-label="Go to next page"
|
|
295
292
|
className={className}
|
|
296
293
|
disabled={disabled}
|
|
297
|
-
variant=
|
|
294
|
+
variant="next"
|
|
298
295
|
{...props}
|
|
299
296
|
>
|
|
300
297
|
<ChevronRightIcon className="size-4" />
|
|
@@ -318,7 +315,7 @@ const PaginationLink = React.forwardRef<HTMLButtonElement, PaginationLinkProps>(
|
|
|
318
315
|
aria-label={`Go to page ${page}`}
|
|
319
316
|
className={className}
|
|
320
317
|
isActive={isActive}
|
|
321
|
-
variant=
|
|
318
|
+
variant="link"
|
|
322
319
|
{...props}
|
|
323
320
|
>
|
|
324
321
|
{page}
|
|
@@ -336,10 +333,7 @@ function PaginationEllipsis({
|
|
|
336
333
|
return (
|
|
337
334
|
<span
|
|
338
335
|
aria-hidden="true"
|
|
339
|
-
className={cn(
|
|
340
|
-
paginationItemVariants({ variant: PaginationVariant.ELLIPSIS }),
|
|
341
|
-
className
|
|
342
|
-
)}
|
|
336
|
+
className={cn(paginationItemVariants({ variant: "ellipsis" }), className)}
|
|
343
337
|
data-slot="pagination-ellipsis"
|
|
344
338
|
{...props}
|
|
345
339
|
>
|
|
@@ -1,46 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
3
5
|
|
|
4
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
export interface PopoverProps extends React.ComponentProps<
|
|
9
|
+
typeof PopoverPrimitive.Root
|
|
10
|
+
> {
|
|
11
|
+
/** The open state when initially rendered. Use when you do not need to control the open state. */
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
/** The controlled open state of the popover. */
|
|
14
|
+
open?: boolean;
|
|
15
|
+
/** Event handler called when the open state of the popover changes. */
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
/** When true, interaction with outside elements is disabled and only popover content is visible to screen readers. */
|
|
18
|
+
modal?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Contains all the parts of a popover.
|
|
23
|
+
*/
|
|
24
|
+
function Popover({ ...props }: PopoverProps) {
|
|
9
25
|
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
10
26
|
}
|
|
27
|
+
Popover.displayName = "Popover";
|
|
28
|
+
|
|
29
|
+
export interface PopoverTriggerProps extends React.ComponentProps<
|
|
30
|
+
typeof PopoverPrimitive.Trigger
|
|
31
|
+
> {
|
|
32
|
+
/** Change the default rendered element for the one passed as a child, merging their props and behavior. */
|
|
33
|
+
asChild?: boolean;
|
|
34
|
+
/** Test hook identifier for testing purposes. */
|
|
35
|
+
dataHook?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The button that toggles the popover.
|
|
40
|
+
*/
|
|
41
|
+
const PopoverTrigger = React.forwardRef<
|
|
42
|
+
React.ComponentRef<typeof PopoverPrimitive.Trigger>,
|
|
43
|
+
PopoverTriggerProps
|
|
44
|
+
>(({ dataHook, ...props }, ref) => (
|
|
45
|
+
<PopoverPrimitive.Trigger
|
|
46
|
+
ref={ref}
|
|
47
|
+
data-hook={dataHook}
|
|
48
|
+
data-slot="popover-trigger"
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
));
|
|
52
|
+
PopoverTrigger.displayName = "PopoverTrigger";
|
|
11
53
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
54
|
+
export interface PopoverContentProps extends React.ComponentProps<
|
|
55
|
+
typeof PopoverPrimitive.Content
|
|
56
|
+
> {
|
|
57
|
+
/** Test hook identifier for testing purposes. */
|
|
58
|
+
dataHook?: string;
|
|
59
|
+
/** The preferred side of the anchor to render against. Will be reversed when collisions occur. */
|
|
60
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
61
|
+
/** The distance in pixels from the anchor. */
|
|
62
|
+
sideOffset?: number;
|
|
63
|
+
/** The preferred alignment against the anchor. May change when collisions occur. */
|
|
64
|
+
align?: "start" | "center" | "end";
|
|
65
|
+
/** An offset in pixels from the "start" or "end" alignment options. */
|
|
66
|
+
alignOffset?: number;
|
|
67
|
+
/** When true, overrides side and align to prevent collisions with boundary edges. */
|
|
68
|
+
avoidCollisions?: boolean;
|
|
69
|
+
/** The sticky behavior on the align axis. "partial" keeps content in boundary as long as trigger is at least partially in boundary. */
|
|
70
|
+
sticky?: "partial" | "always";
|
|
71
|
+
/** Whether to hide content when the trigger becomes fully occluded. */
|
|
72
|
+
hideWhenDetached?: boolean;
|
|
16
73
|
}
|
|
17
74
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
75
|
+
/**
|
|
76
|
+
* The component that pops out when the popover is open.
|
|
77
|
+
*/
|
|
78
|
+
const PopoverContent = React.forwardRef<
|
|
79
|
+
React.ComponentRef<typeof PopoverPrimitive.Content>,
|
|
80
|
+
PopoverContentProps
|
|
81
|
+
>(
|
|
82
|
+
(
|
|
83
|
+
{ className, align = "center", sideOffset = 4, dataHook, ...props },
|
|
84
|
+
ref
|
|
85
|
+
) => (
|
|
25
86
|
<PopoverPrimitive.Portal>
|
|
26
87
|
<PopoverPrimitive.Content
|
|
88
|
+
ref={ref}
|
|
27
89
|
align={align}
|
|
28
90
|
className={cn(
|
|
29
91
|
"bg-popover text-popover-foreground 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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
30
92
|
className
|
|
31
93
|
)}
|
|
94
|
+
data-hook={dataHook}
|
|
32
95
|
data-slot="popover-content"
|
|
33
96
|
sideOffset={sideOffset}
|
|
34
97
|
{...props}
|
|
35
98
|
/>
|
|
36
99
|
</PopoverPrimitive.Portal>
|
|
37
|
-
)
|
|
38
|
-
|
|
100
|
+
)
|
|
101
|
+
);
|
|
102
|
+
PopoverContent.displayName = "PopoverContent";
|
|
39
103
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
104
|
+
export interface PopoverAnchorProps extends React.ComponentProps<
|
|
105
|
+
typeof PopoverPrimitive.Anchor
|
|
106
|
+
> {
|
|
107
|
+
/** Change the default rendered element for the one passed as a child, merging their props and behavior. */
|
|
108
|
+
asChild?: boolean;
|
|
109
|
+
/** Test hook identifier for testing purposes. */
|
|
110
|
+
dataHook?: string;
|
|
44
111
|
}
|
|
45
112
|
|
|
113
|
+
/**
|
|
114
|
+
* An optional element to position the popover against. If not used, the popover will position against the trigger.
|
|
115
|
+
*/
|
|
116
|
+
const PopoverAnchor = React.forwardRef<
|
|
117
|
+
React.ComponentRef<typeof PopoverPrimitive.Anchor>,
|
|
118
|
+
PopoverAnchorProps
|
|
119
|
+
>(({ dataHook, ...props }, ref) => (
|
|
120
|
+
<PopoverPrimitive.Anchor
|
|
121
|
+
ref={ref}
|
|
122
|
+
data-hook={dataHook}
|
|
123
|
+
data-slot="popover-anchor"
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
));
|
|
127
|
+
PopoverAnchor.displayName = "PopoverAnchor";
|
|
128
|
+
|
|
46
129
|
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|