@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.
Files changed (281) hide show
  1. package/dist/accordion.cjs +1 -1
  2. package/dist/accordion.d.ts +74 -4
  3. package/dist/accordion.d.ts.map +1 -1
  4. package/dist/accordion.js +100 -105
  5. package/dist/alert-dialog.cjs +1 -1
  6. package/dist/alert-dialog.d.ts +30 -10
  7. package/dist/alert-dialog.d.ts.map +1 -1
  8. package/dist/alert-dialog.js +129 -132
  9. package/dist/alert.cjs +1 -1
  10. package/dist/alert.d.ts +22 -1
  11. package/dist/alert.d.ts.map +1 -1
  12. package/dist/alert.js +1 -1
  13. package/dist/aspect-ratio.cjs +1 -1
  14. package/dist/aspect-ratio.d.ts +11 -1
  15. package/dist/aspect-ratio.d.ts.map +1 -1
  16. package/dist/aspect-ratio.js +16 -20
  17. package/dist/avatar.cjs +1 -1
  18. package/dist/avatar.d.ts +43 -3
  19. package/dist/avatar.d.ts.map +1 -1
  20. package/dist/avatar.js +18 -16
  21. package/dist/badge.cjs +1 -1
  22. package/dist/badge.d.ts +24 -9
  23. package/dist/badge.d.ts.map +1 -1
  24. package/dist/badge.js +34 -32
  25. package/dist/blocks/data-table.cjs +1 -1
  26. package/dist/blocks/data-table.d.ts.map +1 -1
  27. package/dist/blocks/data-table.js +177 -170
  28. package/dist/blocks/sidebar.cjs +1 -1
  29. package/dist/blocks/sidebar.d.ts +38 -307
  30. package/dist/blocks/sidebar.d.ts.map +1 -1
  31. package/dist/blocks/sidebar.js +411 -508
  32. package/dist/breadcrumb.cjs +1 -1
  33. package/dist/breadcrumb.d.ts +63 -8
  34. package/dist/breadcrumb.d.ts.map +1 -1
  35. package/dist/breadcrumb.js +97 -93
  36. package/dist/button.cjs +1 -1
  37. package/dist/button.d.ts +17 -45
  38. package/dist/button.d.ts.map +1 -1
  39. package/dist/button.js +49 -50
  40. package/dist/calendar.cjs +1 -1
  41. package/dist/calendar.d.ts +16 -1
  42. package/dist/calendar.d.ts.map +1 -1
  43. package/dist/calendar.js +31 -29
  44. package/dist/card.cjs +1 -1
  45. package/dist/card.d.ts +58 -18
  46. package/dist/card.d.ts.map +1 -1
  47. package/dist/card.js +60 -51
  48. package/dist/carousel.cjs +1 -1
  49. package/dist/carousel.d.ts +99 -9
  50. package/dist/carousel.d.ts.map +1 -1
  51. package/dist/carousel.js +142 -128
  52. package/dist/centred-layout.cjs +1 -1
  53. package/dist/centred-layout.d.ts +18 -15
  54. package/dist/centred-layout.d.ts.map +1 -1
  55. package/dist/centred-layout.js +44 -33
  56. package/dist/chart.cjs +4 -4
  57. package/dist/chart.d.ts +70 -7
  58. package/dist/chart.d.ts.map +1 -1
  59. package/dist/chart.js +71 -66
  60. package/dist/checkbox.cjs +1 -1
  61. package/dist/checkbox.d.ts +9 -5
  62. package/dist/checkbox.d.ts.map +1 -1
  63. package/dist/checkbox.js +61 -82
  64. package/dist/collapsible.cjs +1 -1
  65. package/dist/collapsible.d.ts +65 -8
  66. package/dist/collapsible.d.ts.map +1 -1
  67. package/dist/collapsible.js +41 -55
  68. package/dist/combobox.cjs +1 -1
  69. package/dist/combobox.d.ts +28 -18
  70. package/dist/combobox.d.ts.map +1 -1
  71. package/dist/combobox.js +191 -160
  72. package/dist/command.cjs +1 -1
  73. package/dist/command.d.ts +115 -9
  74. package/dist/command.d.ts.map +1 -1
  75. package/dist/command.js +176 -152
  76. package/dist/context-menu.cjs +1 -1
  77. package/dist/context-menu.d.ts +188 -20
  78. package/dist/context-menu.d.ts.map +1 -1
  79. package/dist/context-menu.js +120 -122
  80. package/dist/date-picker.cjs +1 -1
  81. package/dist/date-picker.d.ts +75 -9
  82. package/dist/date-picker.d.ts.map +1 -1
  83. package/dist/date-picker.js +221 -82
  84. package/dist/description.cjs +1 -0
  85. package/dist/description.d.ts +37 -0
  86. package/dist/description.d.ts.map +1 -0
  87. package/dist/description.js +25 -0
  88. package/dist/dialog.cjs +1 -1
  89. package/dist/dialog.d.ts +73 -9
  90. package/dist/dialog.d.ts.map +1 -1
  91. package/dist/dialog.js +103 -112
  92. package/dist/drawer.cjs +1 -1
  93. package/dist/drawer.d.ts +92 -0
  94. package/dist/drawer.d.ts.map +1 -1
  95. package/dist/drawer.js +67 -52
  96. package/dist/dropdown-menu.cjs +1 -1
  97. package/dist/dropdown-menu.d.ts +95 -11
  98. package/dist/dropdown-menu.d.ts.map +1 -1
  99. package/dist/dropdown-menu.js +146 -106
  100. package/dist/field.cjs +1 -1
  101. package/dist/field.d.ts +26 -6
  102. package/dist/field.d.ts.map +1 -1
  103. package/dist/field.js +55 -53
  104. package/dist/global-layout.cjs +1 -1
  105. package/dist/global-layout.d.ts +27 -17
  106. package/dist/global-layout.d.ts.map +1 -1
  107. package/dist/global-layout.js +86 -79
  108. package/dist/hover-card.cjs +1 -1
  109. package/dist/hover-card.d.ts +36 -6
  110. package/dist/hover-card.d.ts.map +1 -1
  111. package/dist/hover-card.js +44 -42
  112. package/dist/index.cjs +1 -1
  113. package/dist/index.d.ts +1 -1
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +367 -386
  116. package/dist/input-group.cjs +1 -1
  117. package/dist/input-group.d.ts +21 -2
  118. package/dist/input-group.d.ts.map +1 -1
  119. package/dist/input-group.js +51 -41
  120. package/dist/input-otp.cjs +1 -1
  121. package/dist/input-otp.js +1 -1
  122. package/dist/input-password.cjs +1 -1
  123. package/dist/input-password.d.ts.map +1 -1
  124. package/dist/input-password.js +25 -26
  125. package/dist/input.cjs +1 -1
  126. package/dist/input.d.ts +38 -24
  127. package/dist/input.d.ts.map +1 -1
  128. package/dist/input.js +68 -136
  129. package/dist/label.cjs +1 -1
  130. package/dist/label.d.ts +20 -1
  131. package/dist/label.d.ts.map +1 -1
  132. package/dist/label.js +31 -18
  133. package/dist/link.cjs +1 -1
  134. package/dist/link.js +1 -1
  135. package/dist/logo.cjs +1 -1
  136. package/dist/logo.d.ts +9 -4
  137. package/dist/logo.d.ts.map +1 -1
  138. package/dist/logo.js +20 -21
  139. package/dist/menubar.cjs +1 -1
  140. package/dist/menubar.d.ts +43 -6
  141. package/dist/menubar.d.ts.map +1 -1
  142. package/dist/menubar.js +100 -78
  143. package/dist/navigation-menu.cjs +1 -1
  144. package/dist/navigation-menu.d.ts +6 -54
  145. package/dist/navigation-menu.d.ts.map +1 -1
  146. package/dist/navigation-menu.js +73 -84
  147. package/dist/pagination.cjs +1 -1
  148. package/dist/pagination.d.ts +8 -10
  149. package/dist/pagination.d.ts.map +1 -1
  150. package/dist/pagination.js +78 -86
  151. package/dist/popover.cjs +1 -1
  152. package/dist/popover.d.ts +59 -4
  153. package/dist/popover.d.ts.map +1 -1
  154. package/dist/popover.js +42 -34
  155. package/dist/progress.cjs +1 -1
  156. package/dist/progress.d.ts +9 -2
  157. package/dist/progress.d.ts.map +1 -1
  158. package/dist/progress.js +71 -59
  159. package/dist/radio-group.cjs +1 -1
  160. package/dist/radio-group.d.ts +33 -10
  161. package/dist/radio-group.d.ts.map +1 -1
  162. package/dist/radio-group.js +56 -66
  163. package/dist/rating.d.ts +4 -0
  164. package/dist/rating.d.ts.map +1 -1
  165. package/dist/resizable.cjs +1 -1
  166. package/dist/resizable.d.ts +58 -6
  167. package/dist/resizable.d.ts.map +1 -1
  168. package/dist/resizable.js +38 -37
  169. package/dist/scroll-area.cjs +1 -1
  170. package/dist/scroll-area.d.ts +46 -5
  171. package/dist/scroll-area.d.ts.map +1 -1
  172. package/dist/scroll-area.js +42 -38
  173. package/dist/select.cjs +1 -1
  174. package/dist/select.d.ts +30 -0
  175. package/dist/select.d.ts.map +1 -1
  176. package/dist/select.js +64 -54
  177. package/dist/separator.cjs +1 -1
  178. package/dist/separator.d.ts +52 -5
  179. package/dist/separator.d.ts.map +1 -1
  180. package/dist/separator.js +45 -35
  181. package/dist/sheet.cjs +1 -1
  182. package/dist/sheet.d.ts +85 -19
  183. package/dist/sheet.d.ts.map +1 -1
  184. package/dist/sheet.js +117 -115
  185. package/dist/skeleton.cjs +1 -1
  186. package/dist/skeleton.d.ts +24 -2
  187. package/dist/skeleton.d.ts.map +1 -1
  188. package/dist/skeleton.js +15 -9
  189. package/dist/slider.cjs +1 -1
  190. package/dist/slider.d.ts +18 -4
  191. package/dist/slider.d.ts.map +1 -1
  192. package/dist/slider.js +72 -66
  193. package/dist/sonner.cjs +1 -1
  194. package/dist/sonner.d.ts +21 -22
  195. package/dist/sonner.d.ts.map +1 -1
  196. package/dist/sonner.js +46 -48
  197. package/dist/split-layout.d.ts +4 -1
  198. package/dist/split-layout.d.ts.map +1 -1
  199. package/dist/switch.cjs +1 -1
  200. package/dist/switch.d.ts +2 -12
  201. package/dist/switch.d.ts.map +1 -1
  202. package/dist/switch.js +37 -41
  203. package/dist/table.cjs +1 -1
  204. package/dist/table.d.ts +16 -12
  205. package/dist/table.d.ts.map +1 -1
  206. package/dist/table.js +56 -58
  207. package/dist/tabs.d.ts +27 -3
  208. package/dist/tabs.d.ts.map +1 -1
  209. package/dist/toggle-group.cjs +1 -1
  210. package/dist/toggle-group.d.ts +57 -7
  211. package/dist/toggle-group.d.ts.map +1 -1
  212. package/dist/toggle-group.js +60 -67
  213. package/dist/toggle.cjs +1 -1
  214. package/dist/toggle.d.ts +12 -26
  215. package/dist/toggle.d.ts.map +1 -1
  216. package/dist/toggle.js +16 -20
  217. package/package.json +9 -3
  218. package/src/blocks/data-table.tsx +43 -33
  219. package/src/blocks/sidebar.tsx +158 -541
  220. package/src/components/accordion.tsx +164 -78
  221. package/src/components/alert-dialog.tsx +156 -111
  222. package/src/components/alert.tsx +27 -14
  223. package/src/components/aspect-ratio.tsx +25 -16
  224. package/src/components/avatar.tsx +56 -8
  225. package/src/components/badge.tsx +65 -42
  226. package/src/components/breadcrumb.tsx +159 -83
  227. package/src/components/button.tsx +42 -63
  228. package/src/components/calendar.tsx +22 -6
  229. package/src/components/card.tsx +92 -40
  230. package/src/components/carousel.tsx +240 -115
  231. package/src/components/centred-layout.tsx +68 -49
  232. package/src/components/chart.tsx +118 -47
  233. package/src/components/checkbox.tsx +43 -79
  234. package/src/components/collapsible.tsx +95 -26
  235. package/src/components/combobox.tsx +243 -153
  236. package/src/components/command.tsx +295 -121
  237. package/src/components/context-menu.tsx +279 -82
  238. package/src/components/date-picker.tsx +282 -31
  239. package/src/components/description.tsx +60 -0
  240. package/src/components/dialog.tsx +163 -87
  241. package/src/components/drawer.tsx +76 -2
  242. package/src/components/dropdown-menu.tsx +143 -37
  243. package/src/components/field.tsx +38 -11
  244. package/src/components/global-layout.tsx +116 -77
  245. package/src/components/hover-card.tsx +54 -14
  246. package/src/components/input-group.tsx +56 -18
  247. package/src/components/input-otp.tsx +1 -1
  248. package/src/components/input-password.tsx +4 -5
  249. package/src/components/input.tsx +93 -186
  250. package/src/components/label.tsx +56 -15
  251. package/src/components/link.tsx +1 -1
  252. package/src/components/logo.tsx +12 -7
  253. package/src/components/menubar.tsx +61 -5
  254. package/src/components/navigation-menu.tsx +37 -99
  255. package/src/components/pagination.tsx +13 -19
  256. package/src/components/popover.tsx +103 -20
  257. package/src/components/progress.tsx +82 -60
  258. package/src/components/radio-group.tsx +44 -25
  259. package/src/components/rating.tsx +4 -0
  260. package/src/components/resizable.tsx +88 -38
  261. package/src/components/scroll-area.tsx +123 -56
  262. package/src/components/select.tsx +22 -2
  263. package/src/components/separator.tsx +101 -24
  264. package/src/components/sheet.tsx +186 -90
  265. package/src/components/skeleton.tsx +40 -10
  266. package/src/components/slider.tsx +83 -57
  267. package/src/components/sonner.tsx +34 -34
  268. package/src/components/split-layout.tsx +4 -1
  269. package/src/components/switch.figma.tsx +7 -11
  270. package/src/components/switch.tsx +9 -19
  271. package/src/components/table.tsx +23 -18
  272. package/src/components/tabs.tsx +27 -3
  273. package/src/components/toggle-group.tsx +115 -86
  274. package/src/components/toggle.figma.tsx +13 -19
  275. package/src/components/toggle.tsx +20 -34
  276. package/src/index.ts +1 -1
  277. package/dist/input-base.cjs +0 -1
  278. package/dist/input-base.d.ts +0 -28
  279. package/dist/input-base.d.ts.map +0 -1
  280. package/dist/input-base.js +0 -56
  281. 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
- * Defaults to "Progress" if not provided
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
- function Progress({
36
- className,
37
- value,
38
- dataHook,
39
- trackingEl,
40
- trackingLabel,
41
- ariaLabel = "Progress",
42
- label,
43
- ...props
44
- }: ProgressProps) {
45
- const labelId = React.useId();
46
- const hasVisibleLabel = !!label;
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
- const progressBar = (
49
- <ProgressPrimitive.Root
50
- aria-label={hasVisibleLabel ? undefined : ariaLabel}
51
- aria-labelledby={hasVisibleLabel ? labelId : undefined}
52
- className={cn(
53
- "relative h-2 w-full overflow-hidden rounded-full",
54
- "bg-primary/20",
55
- className
56
- )}
57
- data-hook={dataHook}
58
- data-slot="progress"
59
- data-tracking-el={trackingEl}
60
- data-tracking-label={trackingLabel}
61
- {...props}
62
- >
63
- <ProgressPrimitive.Indicator asChild>
64
- <motion.div
65
- animate={{
66
- transform: `translateX(-${100 - (value || 0)}%)`,
67
- }}
68
- className="h-full w-full flex-1 bg-green-400"
69
- data-slot="progress-indicator"
70
- initial={false}
71
- transition={{
72
- type: "spring",
73
- stiffness: 80,
74
- damping: 20,
75
- mass: 1,
76
- }}
77
- />
78
- </ProgressPrimitive.Indicator>
79
- </ProgressPrimitive.Root>
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
- if (!label) {
83
- return progressBar;
84
- }
97
+ if (!label) {
98
+ return progressBar;
99
+ }
85
100
 
86
- return (
87
- <div className="flex w-full items-center gap-2">
88
- <span
89
- className="text-foreground text-sm leading-normal font-medium"
90
- id={labelId}
101
+ return (
102
+ <div
103
+ className="flex w-full items-center gap-2"
104
+ data-slot="progress-wrapper"
91
105
  >
92
- {label}
93
- </span>
94
- {progressBar}
95
- </div>
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 "lucide-react";
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
- enum RadioGroupVariant {
122
- DEFAULT = "default",
123
- BOX = "box",
124
- BOX_ICON_VERTICAL = "boxIconVertical",
125
- BOX_ICON_HORIZONTAL = "boxIconHorizontal",
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: RadioGroupVariant.DEFAULT,
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 = RadioGroupVariant.DEFAULT,
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 = (variant ||
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 ?? RadioGroupVariant.DEFAULT;
241
+ const variant = variantProp ?? context.variant ?? "default";
219
242
 
220
243
  const isBoxIcon =
221
- variant === RadioGroupVariant.BOX_ICON_VERTICAL ||
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 === RadioGroupVariant.DEFAULT
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 "lucide-react";
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
- const ResizablePanelGroup = ({
9
- className,
10
- ...props
11
- }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (
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
- const ResizablePanel = ({
23
- ...props
24
- }: React.ComponentProps<typeof ResizablePrimitive.Panel>) => (
25
- <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
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
- const ResizableHandle = ({
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
- <ResizablePrimitive.PanelResizeHandle
46
- className={cn(
47
- "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",
48
- className
49
- )}
50
- data-hook={dataHook}
51
- data-slot="resizable-handle"
52
- data-tracking-el={trackingEl}
53
- data-tracking-label={trackingLabel}
54
- {...props}
55
- >
56
- {withHandle && (
57
- <div className="border-border bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border">
58
- <GripVertical className="h-2.5 w-2.5" />
59
- </div>
60
- )}
61
- </ResizablePrimitive.PanelResizeHandle>
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 { ResizableHandleProps };
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
- type ScrollAreaProps = React.ComponentProps<typeof ScrollAreaPrimitive.Root> & {
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
- function ScrollArea({
14
- className,
15
- children,
16
- dataHook,
17
- trackingEl,
18
- trackingLabel,
19
- ...props
20
- }: ScrollAreaProps) {
21
- return (
22
- <ScrollAreaPrimitive.Root
23
- className={cn("relative", className)}
24
- data-hook={dataHook}
25
- data-slot="scroll-area"
26
- data-tracking-el={trackingEl}
27
- data-tracking-label={trackingLabel}
28
- {...props}
29
- >
30
- <ScrollAreaPrimitive.Viewport
31
- className="focus-visible:shadow-default size-full rounded-[inherit] p-1 transition-[color,box-shadow] outline-none"
32
- data-slot="scroll-area-viewport"
33
- tabIndex={0}
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
- {children}
36
- </ScrollAreaPrimitive.Viewport>
37
- <ScrollBar />
38
- <ScrollAreaPrimitive.Corner />
39
- </ScrollAreaPrimitive.Root>
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
- function ScrollBar({
44
- className,
45
- orientation = "vertical",
46
- ...props
47
- }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
48
- return (
49
- <ScrollAreaPrimitive.ScrollAreaScrollbar
50
- className={cn(
51
- "flex touch-none p-px transition-colors select-none",
52
- orientation === "vertical" &&
53
- "h-full w-2.5 border-l border-l-transparent",
54
- orientation === "horizontal" &&
55
- "h-2.5 flex-col border-t border-t-transparent",
56
- className
57
- )}
58
- data-slot="scroll-area-scrollbar"
59
- orientation={orientation}
60
- {...props}
61
- >
62
- <ScrollAreaPrimitive.ScrollAreaThumb
63
- className="bg-border relative flex-1 rounded-full"
64
- data-slot="scroll-area-thumb"
65
- />
66
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
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 };