@brightlocal/ui-components 0.1.2 → 0.1.3
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.d.ts +22 -1
- package/dist/alert.d.ts.map +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 +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +154 -154
- 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 +12 -0
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +10 -8
- 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 -2
- package/dist/centred-layout.d.ts.map +1 -1
- package/dist/centred-layout.js +46 -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 +29 -11
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +193 -159
- 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 +119 -121
- 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 +220 -81
- 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 +23 -6
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +54 -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 +383 -387
- 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-password.cjs +1 -1
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +24 -25
- 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/logo.cjs +1 -1
- package/dist/logo.d.ts +3 -0
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +12 -10
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts +40 -6
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +97 -76
- 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.d.ts +40 -0
- package/dist/radio-group.d.ts.map +1 -1
- 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 +65 -4
- package/dist/resizable.d.ts.map +1 -1
- package/dist/resizable.js +53 -36
- 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 +49 -2
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +48 -36
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +80 -9
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +117 -113
- 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 +4 -2
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +29 -28
- package/dist/split-layout.d.ts +4 -1
- package/dist/split-layout.d.ts.map +1 -1
- package/package.json +8 -2
- package/src/blocks/data-table.tsx +42 -32
- package/src/blocks/sidebar.tsx +4 -12
- package/src/components/accordion.tsx +163 -77
- package/src/components/alert-dialog.tsx +156 -111
- package/src/components/alert.tsx +26 -13
- 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 +158 -82
- package/src/components/button.tsx +41 -62
- package/src/components/calendar.tsx +16 -2
- package/src/components/card.tsx +92 -40
- package/src/components/carousel.tsx +240 -115
- package/src/components/centred-layout.tsx +67 -35
- package/src/components/chart.tsx +118 -47
- package/src/components/checkbox.tsx +42 -78
- package/src/components/collapsible.tsx +95 -26
- package/src/components/combobox.tsx +242 -144
- package/src/components/command.tsx +295 -121
- package/src/components/context-menu.tsx +278 -81
- package/src/components/date-picker.tsx +281 -30
- package/src/components/description.tsx +60 -0
- package/src/components/dialog.tsx +162 -86
- package/src/components/drawer.tsx +76 -2
- package/src/components/dropdown-menu.tsx +143 -37
- package/src/components/field.tsx +36 -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-password.tsx +3 -4
- package/src/components/input.tsx +93 -186
- package/src/components/label.tsx +56 -15
- package/src/components/logo.tsx +3 -0
- package/src/components/menubar.tsx +58 -4
- package/src/components/popover.tsx +103 -20
- package/src/components/progress.tsx +82 -60
- package/src/components/radio-group.tsx +40 -0
- package/src/components/rating.tsx +4 -0
- package/src/components/resizable.tsx +119 -31
- package/src/components/scroll-area.tsx +123 -56
- package/src/components/select.tsx +21 -1
- package/src/components/separator.tsx +97 -20
- package/src/components/sheet.tsx +180 -79
- package/src/components/skeleton.tsx +40 -10
- package/src/components/slider.tsx +83 -57
- package/src/components/sonner.tsx +10 -7
- package/src/components/split-layout.tsx +4 -1
- 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
|
@@ -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,6 +47,7 @@ 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
|
);
|
|
@@ -51,9 +57,17 @@ function Menubar({
|
|
|
51
57
|
* MenubarMenu - Individual menu within the menubar
|
|
52
58
|
*/
|
|
53
59
|
function MenubarMenu({
|
|
60
|
+
value,
|
|
54
61
|
...props
|
|
55
|
-
}: React.ComponentProps<typeof MenubarPrimitive.Menu>
|
|
56
|
-
|
|
62
|
+
}: React.ComponentProps<typeof MenubarPrimitive.Menu> & {
|
|
63
|
+
/**
|
|
64
|
+
* A unique value that associates the menu with the menubar's defaultValue/value
|
|
65
|
+
*/
|
|
66
|
+
value?: string;
|
|
67
|
+
}) {
|
|
68
|
+
return (
|
|
69
|
+
<MenubarPrimitive.Menu data-slot="menubar-menu" value={value} {...props} />
|
|
70
|
+
);
|
|
57
71
|
}
|
|
58
72
|
|
|
59
73
|
/**
|
|
@@ -113,9 +127,14 @@ function MenubarContent({
|
|
|
113
127
|
*/
|
|
114
128
|
function MenubarItem({
|
|
115
129
|
className,
|
|
130
|
+
disabled,
|
|
116
131
|
inset,
|
|
117
132
|
...props
|
|
118
133
|
}: React.ComponentProps<typeof MenubarPrimitive.Item> & {
|
|
134
|
+
/**
|
|
135
|
+
* Whether the menu item is disabled
|
|
136
|
+
*/
|
|
137
|
+
disabled?: boolean;
|
|
119
138
|
/**
|
|
120
139
|
* Adds left padding for alignment with items that have icons
|
|
121
140
|
*/
|
|
@@ -132,6 +151,7 @@ function MenubarItem({
|
|
|
132
151
|
className
|
|
133
152
|
)}
|
|
134
153
|
data-slot="menubar-item"
|
|
154
|
+
disabled={disabled}
|
|
135
155
|
{...props}
|
|
136
156
|
/>
|
|
137
157
|
);
|
|
@@ -141,20 +161,31 @@ function MenubarItem({
|
|
|
141
161
|
* MenubarCheckboxItem - Menu item with checkbox
|
|
142
162
|
*/
|
|
143
163
|
function MenubarCheckboxItem({
|
|
164
|
+
checked,
|
|
144
165
|
children,
|
|
145
166
|
className,
|
|
146
167
|
closeOnSelect = true,
|
|
168
|
+
onCheckedChange,
|
|
147
169
|
onSelect,
|
|
148
170
|
...props
|
|
149
171
|
}: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem> & {
|
|
172
|
+
/**
|
|
173
|
+
* The controlled checked state of the checkbox
|
|
174
|
+
*/
|
|
175
|
+
checked?: boolean;
|
|
150
176
|
/**
|
|
151
177
|
* Whether to close the menu when the item is selected
|
|
152
178
|
* @default true
|
|
153
179
|
*/
|
|
154
180
|
closeOnSelect?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Callback fired when the checked state changes
|
|
183
|
+
*/
|
|
184
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
155
185
|
}) {
|
|
156
186
|
return (
|
|
157
187
|
<MenubarPrimitive.CheckboxItem
|
|
188
|
+
checked={checked}
|
|
158
189
|
className={cn(
|
|
159
190
|
"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
191
|
"hover:bg-accent hover:text-foreground",
|
|
@@ -163,6 +194,7 @@ function MenubarCheckboxItem({
|
|
|
163
194
|
className
|
|
164
195
|
)}
|
|
165
196
|
data-slot="menubar-checkbox-item"
|
|
197
|
+
onCheckedChange={onCheckedChange}
|
|
166
198
|
onSelect={(event) => {
|
|
167
199
|
if (!closeOnSelect) {
|
|
168
200
|
event.preventDefault();
|
|
@@ -185,10 +217,26 @@ function MenubarCheckboxItem({
|
|
|
185
217
|
* MenubarRadioGroup - Container for radio menu items
|
|
186
218
|
*/
|
|
187
219
|
function MenubarRadioGroup({
|
|
220
|
+
onValueChange,
|
|
221
|
+
value,
|
|
188
222
|
...props
|
|
189
|
-
}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>
|
|
223
|
+
}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup> & {
|
|
224
|
+
/**
|
|
225
|
+
* Callback fired when the selected value changes
|
|
226
|
+
*/
|
|
227
|
+
onValueChange?: (value: string) => void;
|
|
228
|
+
/**
|
|
229
|
+
* The controlled value of the selected radio item
|
|
230
|
+
*/
|
|
231
|
+
value?: string;
|
|
232
|
+
}) {
|
|
190
233
|
return (
|
|
191
|
-
<MenubarPrimitive.RadioGroup
|
|
234
|
+
<MenubarPrimitive.RadioGroup
|
|
235
|
+
data-slot="menubar-radio-group"
|
|
236
|
+
value={value}
|
|
237
|
+
onValueChange={onValueChange}
|
|
238
|
+
{...props}
|
|
239
|
+
/>
|
|
192
240
|
);
|
|
193
241
|
}
|
|
194
242
|
|
|
@@ -200,6 +248,7 @@ function MenubarRadioItem({
|
|
|
200
248
|
className,
|
|
201
249
|
closeOnSelect = true,
|
|
202
250
|
onSelect,
|
|
251
|
+
value,
|
|
203
252
|
...props
|
|
204
253
|
}: React.ComponentProps<typeof MenubarPrimitive.RadioItem> & {
|
|
205
254
|
/**
|
|
@@ -207,6 +256,10 @@ function MenubarRadioItem({
|
|
|
207
256
|
* @default true
|
|
208
257
|
*/
|
|
209
258
|
closeOnSelect?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* The unique value of the radio item
|
|
261
|
+
*/
|
|
262
|
+
value: string;
|
|
210
263
|
}) {
|
|
211
264
|
return (
|
|
212
265
|
<MenubarPrimitive.RadioItem
|
|
@@ -218,6 +271,7 @@ function MenubarRadioItem({
|
|
|
218
271
|
className
|
|
219
272
|
)}
|
|
220
273
|
data-slot="menubar-radio-item"
|
|
274
|
+
value={value}
|
|
221
275
|
onSelect={(event) => {
|
|
222
276
|
if (!closeOnSelect) {
|
|
223
277
|
event.preventDefault();
|
|
@@ -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 };
|
|
@@ -6,6 +6,9 @@ import { motion } from "framer-motion";
|
|
|
6
6
|
|
|
7
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Props for the Progress component.
|
|
11
|
+
*/
|
|
9
12
|
interface ProgressProps extends React.ComponentProps<
|
|
10
13
|
typeof ProgressPrimitive.Root
|
|
11
14
|
> {
|
|
@@ -23,7 +26,7 @@ interface ProgressProps extends React.ComponentProps<
|
|
|
23
26
|
trackingLabel?: string;
|
|
24
27
|
/**
|
|
25
28
|
* Accessible label for the progress bar for screen readers
|
|
26
|
-
*
|
|
29
|
+
* @default "Progress"
|
|
27
30
|
*/
|
|
28
31
|
ariaLabel?: string;
|
|
29
32
|
/**
|
|
@@ -32,69 +35,88 @@ interface ProgressProps extends React.ComponentProps<
|
|
|
32
35
|
label?: string;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Progress component for displaying loading states and task completion.
|
|
40
|
+
* Built on Radix UI Progress primitive with Framer Motion animation.
|
|
41
|
+
*/
|
|
42
|
+
const Progress = React.forwardRef<
|
|
43
|
+
React.ComponentRef<typeof ProgressPrimitive.Root>,
|
|
44
|
+
ProgressProps
|
|
45
|
+
>(
|
|
46
|
+
(
|
|
47
|
+
{
|
|
48
|
+
className,
|
|
49
|
+
value,
|
|
50
|
+
dataHook,
|
|
51
|
+
trackingEl,
|
|
52
|
+
trackingLabel,
|
|
53
|
+
ariaLabel = "Progress",
|
|
54
|
+
label,
|
|
55
|
+
...props
|
|
56
|
+
},
|
|
57
|
+
ref
|
|
58
|
+
) => {
|
|
59
|
+
const labelId = React.useId();
|
|
60
|
+
const hasVisibleLabel = !!label;
|
|
47
61
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
const progressBar = (
|
|
63
|
+
<ProgressPrimitive.Root
|
|
64
|
+
ref={ref}
|
|
65
|
+
aria-label={hasVisibleLabel ? undefined : ariaLabel}
|
|
66
|
+
aria-labelledby={hasVisibleLabel ? labelId : undefined}
|
|
67
|
+
className={cn(
|
|
68
|
+
"relative h-2 w-full overflow-hidden rounded-full",
|
|
69
|
+
"bg-primary/20",
|
|
70
|
+
className
|
|
71
|
+
)}
|
|
72
|
+
data-hook={dataHook}
|
|
73
|
+
data-slot="progress"
|
|
74
|
+
data-tracking-el={trackingEl}
|
|
75
|
+
data-tracking-label={trackingLabel}
|
|
76
|
+
{...props}
|
|
77
|
+
>
|
|
78
|
+
<ProgressPrimitive.Indicator asChild>
|
|
79
|
+
<motion.div
|
|
80
|
+
animate={{
|
|
81
|
+
transform: `translateX(-${100 - (value || 0)}%)`,
|
|
82
|
+
}}
|
|
83
|
+
className="h-full w-full flex-1 bg-green-400"
|
|
84
|
+
data-slot="progress-indicator"
|
|
85
|
+
initial={false}
|
|
86
|
+
transition={{
|
|
87
|
+
type: "spring",
|
|
88
|
+
stiffness: 80,
|
|
89
|
+
damping: 20,
|
|
90
|
+
mass: 1,
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
</ProgressPrimitive.Indicator>
|
|
94
|
+
</ProgressPrimitive.Root>
|
|
95
|
+
);
|
|
81
96
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
if (!label) {
|
|
98
|
+
return progressBar;
|
|
99
|
+
}
|
|
85
100
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
id={labelId}
|
|
101
|
+
return (
|
|
102
|
+
<div
|
|
103
|
+
className="flex w-full items-center gap-2"
|
|
104
|
+
data-slot="progress-wrapper"
|
|
91
105
|
>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
106
|
+
<span
|
|
107
|
+
className="text-foreground text-sm leading-normal font-medium"
|
|
108
|
+
data-slot="progress-label"
|
|
109
|
+
id={labelId}
|
|
110
|
+
>
|
|
111
|
+
{label}
|
|
112
|
+
</span>
|
|
113
|
+
{progressBar}
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
Progress.displayName = "Progress";
|
|
98
120
|
|
|
99
121
|
export { Progress };
|
|
100
122
|
export type { ProgressProps };
|
|
@@ -118,10 +118,17 @@ const radioContentVariants = cva(
|
|
|
118
118
|
|
|
119
119
|
/* ---------------------------------- Types --------------------------------- */
|
|
120
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Visual style variants for the radio group component.
|
|
123
|
+
*/
|
|
121
124
|
enum RadioGroupVariant {
|
|
125
|
+
/** Standard radio group with minimal styling */
|
|
122
126
|
DEFAULT = "default",
|
|
127
|
+
/** Radio items wrapped in styled card containers */
|
|
123
128
|
BOX = "box",
|
|
129
|
+
/** Radio items with icons displayed vertically above the label */
|
|
124
130
|
BOX_ICON_VERTICAL = "boxIconVertical",
|
|
131
|
+
/** Radio items with icons displayed horizontally to the left */
|
|
125
132
|
BOX_ICON_HORIZONTAL = "boxIconHorizontal",
|
|
126
133
|
}
|
|
127
134
|
|
|
@@ -129,24 +136,57 @@ interface RadioGroupContextValue {
|
|
|
129
136
|
variant?: RadioGroupVariant;
|
|
130
137
|
}
|
|
131
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Props for the RadioGroup component.
|
|
141
|
+
*/
|
|
132
142
|
interface RadioGroupProps
|
|
133
143
|
extends
|
|
134
144
|
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>,
|
|
135
145
|
VariantProps<typeof radioGroupVariants> {
|
|
146
|
+
/**
|
|
147
|
+
* Data hook for automated testing (required)
|
|
148
|
+
*/
|
|
136
149
|
dataHook: string;
|
|
150
|
+
/**
|
|
151
|
+
* Tracking element identifier for analytics
|
|
152
|
+
*/
|
|
137
153
|
trackingEl?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Tracking label for analytics context
|
|
156
|
+
*/
|
|
138
157
|
trackingLabel?: string;
|
|
139
158
|
}
|
|
140
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Props for the RadioGroupItem component.
|
|
162
|
+
*/
|
|
141
163
|
interface RadioGroupItemProps
|
|
142
164
|
extends
|
|
143
165
|
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>,
|
|
144
166
|
VariantProps<typeof radioGroupItemVariants> {
|
|
167
|
+
/**
|
|
168
|
+
* Label text displayed next to the radio button
|
|
169
|
+
*/
|
|
145
170
|
label?: React.ReactNode;
|
|
171
|
+
/**
|
|
172
|
+
* Description text displayed below the label
|
|
173
|
+
*/
|
|
146
174
|
description?: React.ReactNode;
|
|
175
|
+
/**
|
|
176
|
+
* Icon displayed for box icon variants
|
|
177
|
+
*/
|
|
147
178
|
icon?: React.ReactNode;
|
|
179
|
+
/**
|
|
180
|
+
* Data hook for automated testing (required)
|
|
181
|
+
*/
|
|
148
182
|
dataHook: string;
|
|
183
|
+
/**
|
|
184
|
+
* Tracking element identifier for analytics
|
|
185
|
+
*/
|
|
149
186
|
trackingEl?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Tracking label for analytics context
|
|
189
|
+
*/
|
|
150
190
|
trackingLabel?: string;
|
|
151
191
|
}
|
|
152
192
|
|
|
@@ -3,6 +3,10 @@ import { StarRating } from "@brightlocal/icons";
|
|
|
3
3
|
|
|
4
4
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Rating component displays a star-based rating indicator.
|
|
8
|
+
* Supports full and half-star values for precise rating display.
|
|
9
|
+
*/
|
|
6
10
|
export interface RatingProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
11
|
/**
|
|
8
12
|
* The rating value (0-5, supports 0.5 increments)
|