@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
|
@@ -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 };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
5
|
-
import { Circle } from "
|
|
5
|
+
import { Circle } from "@brightlocal/icons";
|
|
6
6
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
7
7
|
|
|
8
8
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
@@ -118,42 +118,69 @@ const radioContentVariants = cva(
|
|
|
118
118
|
|
|
119
119
|
/* ---------------------------------- Types --------------------------------- */
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Visual style variants for the radio group component.
|
|
123
|
+
* - `default`: Standard radio group with minimal styling
|
|
124
|
+
* - `box`: Radio items wrapped in styled card containers
|
|
125
|
+
* - `boxIconVertical`: Radio items with icons displayed vertically above the label
|
|
126
|
+
* - `boxIconHorizontal`: Radio items with icons displayed horizontally to the left
|
|
127
|
+
*/
|
|
128
|
+
type RadioGroupVariant =
|
|
129
|
+
| "default"
|
|
130
|
+
| "box"
|
|
131
|
+
| "boxIconVertical"
|
|
132
|
+
| "boxIconHorizontal";
|
|
127
133
|
|
|
128
134
|
interface RadioGroupContextValue {
|
|
129
135
|
variant?: RadioGroupVariant;
|
|
130
136
|
}
|
|
131
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Props for the RadioGroup component.
|
|
140
|
+
*/
|
|
132
141
|
interface RadioGroupProps
|
|
133
142
|
extends
|
|
134
143
|
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>,
|
|
135
144
|
VariantProps<typeof radioGroupVariants> {
|
|
145
|
+
/**
|
|
146
|
+
* Data hook for automated testing (required)
|
|
147
|
+
*/
|
|
136
148
|
dataHook: string;
|
|
149
|
+
/**
|
|
150
|
+
* Tracking element identifier for analytics
|
|
151
|
+
*/
|
|
137
152
|
trackingEl?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Tracking label for analytics context
|
|
155
|
+
*/
|
|
138
156
|
trackingLabel?: string;
|
|
139
157
|
}
|
|
140
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Props for the RadioGroupItem component.
|
|
161
|
+
*/
|
|
141
162
|
interface RadioGroupItemProps
|
|
142
163
|
extends
|
|
143
164
|
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>,
|
|
144
165
|
VariantProps<typeof radioGroupItemVariants> {
|
|
166
|
+
/**
|
|
167
|
+
* Label text displayed next to the radio button
|
|
168
|
+
*/
|
|
145
169
|
label?: React.ReactNode;
|
|
170
|
+
/**
|
|
171
|
+
* Description text displayed below the label
|
|
172
|
+
*/
|
|
146
173
|
description?: React.ReactNode;
|
|
174
|
+
/**
|
|
175
|
+
* Icon displayed for box icon variants
|
|
176
|
+
*/
|
|
147
177
|
icon?: React.ReactNode;
|
|
148
|
-
dataHook: string;
|
|
149
|
-
trackingEl?: string;
|
|
150
|
-
trackingLabel?: string;
|
|
151
178
|
}
|
|
152
179
|
|
|
153
180
|
/* --------------------------------- Context -------------------------------- */
|
|
154
181
|
|
|
155
182
|
const RadioGroupContext = React.createContext<RadioGroupContextValue>({
|
|
156
|
-
variant:
|
|
183
|
+
variant: "default",
|
|
157
184
|
});
|
|
158
185
|
|
|
159
186
|
/* ------------------------------- RadioGroup ------------------------------- */
|
|
@@ -165,7 +192,7 @@ const RadioGroup = React.forwardRef<
|
|
|
165
192
|
(
|
|
166
193
|
{
|
|
167
194
|
className,
|
|
168
|
-
variant =
|
|
195
|
+
variant = "default",
|
|
169
196
|
dataHook,
|
|
170
197
|
trackingEl,
|
|
171
198
|
trackingLabel,
|
|
@@ -173,8 +200,7 @@ const RadioGroup = React.forwardRef<
|
|
|
173
200
|
},
|
|
174
201
|
ref
|
|
175
202
|
) => {
|
|
176
|
-
const contextVariant =
|
|
177
|
-
RadioGroupVariant.DEFAULT) as RadioGroupVariant;
|
|
203
|
+
const contextVariant = variant || "default";
|
|
178
204
|
|
|
179
205
|
return (
|
|
180
206
|
<RadioGroupContext.Provider value={{ variant: contextVariant }}>
|
|
@@ -207,28 +233,21 @@ const RadioGroupItem = React.forwardRef<
|
|
|
207
233
|
description,
|
|
208
234
|
icon,
|
|
209
235
|
children,
|
|
210
|
-
dataHook,
|
|
211
|
-
trackingEl,
|
|
212
|
-
trackingLabel,
|
|
213
236
|
...props
|
|
214
237
|
},
|
|
215
238
|
ref
|
|
216
239
|
) => {
|
|
217
240
|
const context = React.useContext(RadioGroupContext);
|
|
218
|
-
const variant = variantProp ?? context.variant ??
|
|
241
|
+
const variant = variantProp ?? context.variant ?? "default";
|
|
219
242
|
|
|
220
243
|
const isBoxIcon =
|
|
221
|
-
variant ===
|
|
222
|
-
variant === RadioGroupVariant.BOX_ICON_HORIZONTAL;
|
|
244
|
+
variant === "boxIconVertical" || variant === "boxIconHorizontal";
|
|
223
245
|
|
|
224
246
|
return (
|
|
225
247
|
<RadioGroupPrimitive.Item
|
|
226
248
|
ref={ref}
|
|
227
249
|
className={cn(radioGroupItemVariants({ variant }), className)}
|
|
228
|
-
data-hook={dataHook}
|
|
229
250
|
data-slot="radio-group-item"
|
|
230
|
-
data-tracking-el={trackingEl}
|
|
231
|
-
data-tracking-label={trackingLabel}
|
|
232
251
|
{...props}
|
|
233
252
|
>
|
|
234
253
|
{/* Icon for box icon variants */}
|
|
@@ -248,7 +267,7 @@ const RadioGroupItem = React.forwardRef<
|
|
|
248
267
|
<Circle
|
|
249
268
|
className={cn(
|
|
250
269
|
"size-2",
|
|
251
|
-
variant ===
|
|
270
|
+
variant === "default"
|
|
252
271
|
? "fill-primary text-primary"
|
|
253
272
|
: "fill-background text-background"
|
|
254
273
|
)}
|
|
@@ -277,5 +296,5 @@ RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
|
277
296
|
|
|
278
297
|
/* --------------------------------- Exports -------------------------------- */
|
|
279
298
|
|
|
280
|
-
export { RadioGroup, RadioGroupItem, RadioGroupVariant };
|
|
299
|
+
export { RadioGroup, RadioGroupItem, type RadioGroupVariant };
|
|
281
300
|
export type { RadioGroupProps, RadioGroupItemProps };
|
|
@@ -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)
|
|
@@ -1,66 +1,116 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { GripVertical } from "
|
|
3
|
+
import { GripVertical } from "@brightlocal/icons";
|
|
4
4
|
import * as ResizablePrimitive from "react-resizable-panels";
|
|
5
5
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Props for the ResizablePanelGroup component.
|
|
10
|
+
*/
|
|
11
|
+
interface ResizablePanelGroupProps extends React.ComponentProps<
|
|
12
|
+
typeof ResizablePrimitive.PanelGroup
|
|
13
|
+
> {
|
|
14
|
+
/**
|
|
15
|
+
* Data hook for automated testing
|
|
16
|
+
*/
|
|
17
|
+
dataHook?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Tracking element identifier for analytics
|
|
20
|
+
*/
|
|
21
|
+
trackingEl?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Tracking label for analytics context
|
|
24
|
+
*/
|
|
25
|
+
trackingLabel?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Container for resizable panels. Manages layout direction and panel sizing.
|
|
30
|
+
*/
|
|
31
|
+
const ResizablePanelGroup = React.forwardRef<
|
|
32
|
+
React.ComponentRef<typeof ResizablePrimitive.PanelGroup>,
|
|
33
|
+
ResizablePanelGroupProps
|
|
34
|
+
>(({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => (
|
|
12
35
|
<ResizablePrimitive.PanelGroup
|
|
36
|
+
ref={ref}
|
|
13
37
|
className={cn(
|
|
14
38
|
"flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
|
|
15
39
|
className
|
|
16
40
|
)}
|
|
41
|
+
data-hook={dataHook}
|
|
17
42
|
data-slot="resizable-panel-group"
|
|
43
|
+
data-tracking-el={trackingEl}
|
|
44
|
+
data-tracking-label={trackingLabel}
|
|
18
45
|
{...props}
|
|
19
46
|
/>
|
|
20
|
-
);
|
|
47
|
+
));
|
|
21
48
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
49
|
+
ResizablePanelGroup.displayName = "ResizablePanelGroup";
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Props for the ResizablePanel component.
|
|
53
|
+
*/
|
|
54
|
+
type ResizablePanelProps = React.ComponentProps<
|
|
55
|
+
typeof ResizablePrimitive.Panel
|
|
56
|
+
>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Individual resizable panel within a panel group.
|
|
60
|
+
*/
|
|
61
|
+
const ResizablePanel = React.forwardRef<
|
|
62
|
+
React.ComponentRef<typeof ResizablePrimitive.Panel>,
|
|
63
|
+
ResizablePanelProps
|
|
64
|
+
>(({ ...props }, ref) => (
|
|
65
|
+
<ResizablePrimitive.Panel ref={ref} data-slot="resizable-panel" {...props} />
|
|
66
|
+
));
|
|
27
67
|
|
|
68
|
+
ResizablePanel.displayName = "ResizablePanel";
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Props for the ResizableHandle component.
|
|
72
|
+
*/
|
|
28
73
|
interface ResizableHandleProps extends React.ComponentProps<
|
|
29
74
|
typeof ResizablePrimitive.PanelResizeHandle
|
|
30
75
|
> {
|
|
76
|
+
/**
|
|
77
|
+
* Show a visible drag handle indicator
|
|
78
|
+
*/
|
|
31
79
|
withHandle?: boolean;
|
|
32
|
-
dataHook?: string;
|
|
33
|
-
trackingEl?: string;
|
|
34
|
-
trackingLabel?: string;
|
|
35
80
|
}
|
|
36
81
|
|
|
37
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Draggable handle between resizable panels.
|
|
84
|
+
*/
|
|
85
|
+
function ResizableHandle({
|
|
38
86
|
withHandle,
|
|
39
87
|
className,
|
|
40
|
-
dataHook,
|
|
41
|
-
trackingEl,
|
|
42
|
-
trackingLabel,
|
|
43
88
|
...props
|
|
44
|
-
}: ResizableHandleProps)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
}: ResizableHandleProps) {
|
|
90
|
+
return (
|
|
91
|
+
<ResizablePrimitive.PanelResizeHandle
|
|
92
|
+
className={cn(
|
|
93
|
+
"bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-none data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",
|
|
94
|
+
className
|
|
95
|
+
)}
|
|
96
|
+
data-slot="resizable-handle"
|
|
97
|
+
{...props}
|
|
98
|
+
>
|
|
99
|
+
{withHandle && (
|
|
100
|
+
<div className="border-border bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border">
|
|
101
|
+
<GripVertical className="h-2.5 w-2.5" />
|
|
102
|
+
</div>
|
|
103
|
+
)}
|
|
104
|
+
</ResizablePrimitive.PanelResizeHandle>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
ResizableHandle.displayName = "ResizableHandle";
|
|
63
109
|
|
|
64
110
|
export { ResizablePanelGroup, ResizablePanel, ResizableHandle };
|
|
65
111
|
|
|
66
|
-
export type {
|
|
112
|
+
export type {
|
|
113
|
+
ResizablePanelGroupProps,
|
|
114
|
+
ResizablePanelProps,
|
|
115
|
+
ResizableHandleProps,
|
|
116
|
+
};
|
|
@@ -4,69 +4,136 @@ import * as React from "react";
|
|
|
4
4
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
5
5
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Props for the ScrollArea component.
|
|
9
|
+
*/
|
|
10
|
+
interface ScrollAreaProps extends React.ComponentProps<
|
|
11
|
+
typeof ScrollAreaPrimitive.Root
|
|
12
|
+
> {
|
|
13
|
+
/**
|
|
14
|
+
* Data hook for automated testing (required)
|
|
15
|
+
*/
|
|
8
16
|
dataHook: string;
|
|
17
|
+
/**
|
|
18
|
+
* Tracking element identifier for analytics
|
|
19
|
+
*/
|
|
9
20
|
trackingEl?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Tracking label for analytics context
|
|
23
|
+
*/
|
|
10
24
|
trackingLabel?: string;
|
|
11
|
-
}
|
|
25
|
+
}
|
|
12
26
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
data-
|
|
33
|
-
|
|
27
|
+
/**
|
|
28
|
+
* ScrollArea provides a styled scrollable viewport with custom scrollbars.
|
|
29
|
+
* Built on Radix UI ScrollArea primitive.
|
|
30
|
+
*/
|
|
31
|
+
const ScrollArea = React.forwardRef<
|
|
32
|
+
React.ComponentRef<typeof ScrollAreaPrimitive.Root>,
|
|
33
|
+
ScrollAreaProps
|
|
34
|
+
>(
|
|
35
|
+
(
|
|
36
|
+
{ className, children, dataHook, trackingEl, trackingLabel, ...props },
|
|
37
|
+
ref
|
|
38
|
+
) => {
|
|
39
|
+
return (
|
|
40
|
+
<ScrollAreaPrimitive.Root
|
|
41
|
+
ref={ref}
|
|
42
|
+
className={cn("relative", className)}
|
|
43
|
+
data-hook={dataHook}
|
|
44
|
+
data-slot="scroll-area"
|
|
45
|
+
data-tracking-el={trackingEl}
|
|
46
|
+
data-tracking-label={trackingLabel}
|
|
47
|
+
{...props}
|
|
34
48
|
>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
<ScrollAreaPrimitive.Viewport
|
|
50
|
+
className="focus-visible:shadow-default size-full rounded-[inherit] p-1 transition-[color,box-shadow] outline-none"
|
|
51
|
+
data-slot="scroll-area-viewport"
|
|
52
|
+
tabIndex={0}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</ScrollAreaPrimitive.Viewport>
|
|
56
|
+
<ScrollBar />
|
|
57
|
+
<ScrollAreaPrimitive.Corner />
|
|
58
|
+
</ScrollAreaPrimitive.Root>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
);
|
|
42
62
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
ScrollArea.displayName = "ScrollArea";
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Props for the ScrollBar component.
|
|
67
|
+
*/
|
|
68
|
+
interface ScrollBarProps extends React.ComponentProps<
|
|
69
|
+
typeof ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
70
|
+
> {
|
|
71
|
+
/**
|
|
72
|
+
* Data hook for automated testing
|
|
73
|
+
*/
|
|
74
|
+
dataHook?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Tracking element identifier for analytics
|
|
77
|
+
*/
|
|
78
|
+
trackingEl?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Tracking label for analytics context
|
|
81
|
+
*/
|
|
82
|
+
trackingLabel?: string;
|
|
83
|
+
/**
|
|
84
|
+
* The orientation of the scrollbar
|
|
85
|
+
* @default "vertical"
|
|
86
|
+
*/
|
|
87
|
+
orientation?: "vertical" | "horizontal";
|
|
68
88
|
}
|
|
69
89
|
|
|
90
|
+
/**
|
|
91
|
+
* ScrollBar provides a styled scrollbar for ScrollArea.
|
|
92
|
+
*/
|
|
93
|
+
const ScrollBar = React.forwardRef<
|
|
94
|
+
React.ComponentRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
95
|
+
ScrollBarProps
|
|
96
|
+
>(
|
|
97
|
+
(
|
|
98
|
+
{
|
|
99
|
+
className,
|
|
100
|
+
orientation = "vertical",
|
|
101
|
+
dataHook,
|
|
102
|
+
trackingEl,
|
|
103
|
+
trackingLabel,
|
|
104
|
+
...props
|
|
105
|
+
},
|
|
106
|
+
ref
|
|
107
|
+
) => {
|
|
108
|
+
return (
|
|
109
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
110
|
+
ref={ref}
|
|
111
|
+
className={cn(
|
|
112
|
+
"flex touch-none p-px transition-colors select-none",
|
|
113
|
+
orientation === "vertical" &&
|
|
114
|
+
"h-full w-2.5 border-l border-l-transparent",
|
|
115
|
+
orientation === "horizontal" &&
|
|
116
|
+
"h-2.5 flex-col border-t border-t-transparent",
|
|
117
|
+
className
|
|
118
|
+
)}
|
|
119
|
+
data-hook={dataHook}
|
|
120
|
+
data-slot="scroll-area-scrollbar"
|
|
121
|
+
data-tracking-el={trackingEl}
|
|
122
|
+
data-tracking-label={trackingLabel}
|
|
123
|
+
orientation={orientation}
|
|
124
|
+
{...props}
|
|
125
|
+
>
|
|
126
|
+
<ScrollAreaPrimitive.ScrollAreaThumb
|
|
127
|
+
className="bg-border relative flex-1 rounded-full"
|
|
128
|
+
data-slot="scroll-area-thumb"
|
|
129
|
+
/>
|
|
130
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
ScrollBar.displayName = "ScrollBar";
|
|
136
|
+
|
|
70
137
|
export { ScrollArea, ScrollBar };
|
|
71
138
|
|
|
72
|
-
export type { ScrollAreaProps };
|
|
139
|
+
export type { ScrollAreaProps, ScrollBarProps };
|