@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
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import * as SelectPrimitive from "@radix-ui/react-select";
5
- import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
5
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "@brightlocal/icons";
6
6
  import { cva } from "class-variance-authority";
7
7
 
8
8
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -114,6 +114,8 @@ function Select({
114
114
  );
115
115
  }
116
116
 
117
+ Select.displayName = "Select";
118
+
117
119
  /**
118
120
  * SelectGroup - Groups related select options together
119
121
  */
@@ -123,6 +125,8 @@ function SelectGroup(
123
125
  return <SelectPrimitive.Group data-slot="select-group" {...props} />;
124
126
  }
125
127
 
128
+ SelectGroup.displayName = "SelectGroup";
129
+
126
130
  /**
127
131
  * SelectValue - Displays the selected value in the trigger
128
132
  */
@@ -132,6 +136,8 @@ function SelectValue(
132
136
  return <SelectPrimitive.Value data-slot="select-value" {...props} />;
133
137
  }
134
138
 
139
+ SelectValue.displayName = "SelectValue";
140
+
135
141
  // ============================================================================
136
142
  // Styles
137
143
  // ============================================================================
@@ -142,7 +148,7 @@ const selectTriggerVariants = cva([
142
148
  "px-3 py-2",
143
149
 
144
150
  // Base appearance
145
- "border border-border rounded-lg outline-none transition-all",
151
+ "border border-border rounded-sm outline-none transition-all",
146
152
  "bg-neutral-50 border-neutral-300",
147
153
  "dark:bg-white/5 dark:border-white/15",
148
154
 
@@ -229,6 +235,8 @@ function SelectTrigger({
229
235
  );
230
236
  }
231
237
 
238
+ SelectTrigger.displayName = "SelectTrigger";
239
+
232
240
  /**
233
241
  * SelectContent - The dropdown container for select options
234
242
  */
@@ -292,6 +300,8 @@ function SelectContent({
292
300
  );
293
301
  }
294
302
 
303
+ SelectContent.displayName = "SelectContent";
304
+
295
305
  /**
296
306
  * SelectLabel - Label for a group of select options
297
307
  */
@@ -311,6 +321,8 @@ function SelectLabel({
311
321
  );
312
322
  }
313
323
 
324
+ SelectLabel.displayName = "SelectLabel";
325
+
314
326
  /**
315
327
  * SelectItem - Individual selectable option in the dropdown
316
328
  *
@@ -368,6 +380,8 @@ function SelectItem({
368
380
  );
369
381
  }
370
382
 
383
+ SelectItem.displayName = "SelectItem";
384
+
371
385
  /**
372
386
  * SelectSeparator - Visual separator between select items or groups
373
387
  */
@@ -384,6 +398,8 @@ function SelectSeparator({
384
398
  );
385
399
  }
386
400
 
401
+ SelectSeparator.displayName = "SelectSeparator";
402
+
387
403
  /**
388
404
  * SelectScrollUpButton - Button to scroll up in the dropdown (when content overflows)
389
405
  */
@@ -405,6 +421,8 @@ function SelectScrollUpButton({
405
421
  );
406
422
  }
407
423
 
424
+ SelectScrollUpButton.displayName = "SelectScrollUpButton";
425
+
408
426
  /**
409
427
  * SelectScrollDownButton - Button to scroll down in the dropdown (when content overflows)
410
428
  */
@@ -426,6 +444,8 @@ function SelectScrollDownButton({
426
444
  );
427
445
  }
428
446
 
447
+ SelectScrollDownButton.displayName = "SelectScrollDownButton";
448
+
429
449
  export {
430
450
  Select,
431
451
  SelectContent,
@@ -5,41 +5,114 @@ import * as SeparatorPrimitive from "@radix-ui/react-separator";
5
5
 
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
7
 
8
- export enum SeparatorOrientation {
9
- HORIZONTAL = "horizontal",
10
- VERTICAL = "vertical",
11
- }
8
+ /**
9
+ * Orientation variants for Separator
10
+ */
11
+ export type SeparatorOrientation = "horizontal" | "vertical";
12
12
 
13
- function Separator({
14
- className,
15
- orientation = SeparatorOrientation.HORIZONTAL,
16
- decorative = true,
17
- ...props
18
- }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
19
- return (
20
- <SeparatorPrimitive.Root
21
- className={cn(
22
- "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
23
- className
24
- )}
25
- data-slot="separator-root"
26
- decorative={decorative}
27
- orientation={orientation}
28
- {...props}
29
- />
30
- );
13
+ /**
14
+ * Props for the Separator component.
15
+ */
16
+ interface SeparatorProps extends React.ComponentProps<
17
+ typeof SeparatorPrimitive.Root
18
+ > {
19
+ /**
20
+ * Data hook for automated testing
21
+ */
22
+ dataHook?: string;
23
+ /**
24
+ * Tracking element identifier for analytics
25
+ */
26
+ trackingEl?: string;
27
+ /**
28
+ * Tracking label for analytics context
29
+ */
30
+ trackingLabel?: string;
31
31
  }
32
32
 
33
+ /**
34
+ * Separator visually divides content using a horizontal or vertical line.
35
+ * Built on Radix UI Separator primitive.
36
+ */
37
+ const Separator = React.forwardRef<
38
+ React.ComponentRef<typeof SeparatorPrimitive.Root>,
39
+ SeparatorProps
40
+ >(
41
+ (
42
+ {
43
+ className,
44
+ orientation = "horizontal",
45
+ decorative = true,
46
+ dataHook,
47
+ trackingEl,
48
+ trackingLabel,
49
+ ...props
50
+ },
51
+ ref
52
+ ) => {
53
+ return (
54
+ <SeparatorPrimitive.Root
55
+ ref={ref}
56
+ className={cn(
57
+ "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
58
+ className
59
+ )}
60
+ data-hook={dataHook}
61
+ data-slot="separator"
62
+ data-tracking-el={trackingEl}
63
+ data-tracking-label={trackingLabel}
64
+ decorative={decorative}
65
+ orientation={orientation}
66
+ {...props}
67
+ />
68
+ );
69
+ }
70
+ );
71
+
72
+ Separator.displayName = "Separator";
73
+
74
+ /**
75
+ * Props for the SeparatorWithText component.
76
+ */
33
77
  interface SeparatorWithTextProps {
78
+ /**
79
+ * Additional CSS classes
80
+ */
34
81
  className?: string;
82
+ /**
83
+ * Text content to display between separators
84
+ */
35
85
  children: React.ReactNode;
86
+ /**
87
+ * Data hook for automated testing
88
+ */
89
+ dataHook?: string;
90
+ /**
91
+ * Tracking element identifier for analytics
92
+ */
93
+ trackingEl?: string;
94
+ /**
95
+ * Tracking label for analytics context
96
+ */
97
+ trackingLabel?: string;
36
98
  }
37
99
 
38
- function SeparatorWithText({ className, children }: SeparatorWithTextProps) {
100
+ /**
101
+ * SeparatorWithText displays a horizontal separator with centered text.
102
+ * Commonly used for "OR" dividers in forms.
103
+ */
104
+ const SeparatorWithText = React.forwardRef<
105
+ HTMLDivElement,
106
+ SeparatorWithTextProps
107
+ >(({ className, children, dataHook, trackingEl, trackingLabel }, ref) => {
39
108
  return (
40
109
  <div
110
+ ref={ref}
41
111
  className={cn("flex items-center gap-2", className)}
112
+ data-hook={dataHook}
42
113
  data-slot="separator-with-text"
114
+ data-tracking-el={trackingEl}
115
+ data-tracking-label={trackingLabel}
43
116
  >
44
117
  <Separator className="flex-1" />
45
118
  <span className="text-sidebar-foreground shrink-0 text-sm leading-none font-medium whitespace-nowrap">
@@ -48,6 +121,10 @@ function SeparatorWithText({ className, children }: SeparatorWithTextProps) {
48
121
  <Separator className="flex-1" />
49
122
  </div>
50
123
  );
51
- }
124
+ });
125
+
126
+ SeparatorWithText.displayName = "SeparatorWithText";
52
127
 
53
128
  export { Separator, SeparatorWithText };
129
+
130
+ export type { SeparatorProps, SeparatorWithTextProps };
@@ -1,23 +1,20 @@
1
+ "use client";
2
+
1
3
  import * as React from "react";
2
4
  import * as SheetPrimitive from "@radix-ui/react-dialog";
3
5
  import { cva, type VariantProps } from "class-variance-authority";
4
- import { XIcon } from "lucide-react";
6
+ import { XIcon } from "@brightlocal/icons";
5
7
 
6
8
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
9
 
8
10
  /**
9
11
  * Available sheet side variants
12
+ * - top: Sheet slides in from the top
13
+ * - right: Sheet slides in from the right (default)
14
+ * - bottom: Sheet slides in from the bottom
15
+ * - left: Sheet slides in from the left
10
16
  */
11
- export enum SheetSide {
12
- /** Sheet slides in from the top */
13
- TOP = "top",
14
- /** Sheet slides in from the right (default) */
15
- RIGHT = "right",
16
- /** Sheet slides in from the bottom */
17
- BOTTOM = "bottom",
18
- /** Sheet slides in from the left */
19
- LEFT = "left",
20
- }
17
+ export type SheetSide = "top" | "right" | "bottom" | "left";
21
18
 
22
19
  const sheetContentVariants = cva(
23
20
  [
@@ -83,66 +80,142 @@ const sheetContentVariants = cva(
83
80
  }
84
81
  );
85
82
 
83
+ /**
84
+ * Sheet root component that provides context for the sheet dialog.
85
+ * Wraps the Radix UI Dialog primitive with modal behavior enabled by default.
86
+ */
86
87
  function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
87
88
  return <SheetPrimitive.Root data-slot="sheet" modal={true} {...props} />;
88
89
  }
90
+ Sheet.displayName = "Sheet";
89
91
 
90
- function SheetTrigger({
91
- ...props
92
- }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
93
- return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
92
+ /**
93
+ * Props for SheetTrigger component
94
+ */
95
+ interface SheetTriggerProps extends React.ComponentProps<
96
+ typeof SheetPrimitive.Trigger
97
+ > {
98
+ /**
99
+ * Data hook for automated testing
100
+ */
101
+ dataHook?: string;
94
102
  }
95
103
 
96
- function SheetClose({
97
- ...props
98
- }: React.ComponentProps<typeof SheetPrimitive.Close>) {
99
- return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
100
- }
104
+ /**
105
+ * Sheet trigger button that opens the sheet when clicked.
106
+ * Use with asChild prop to merge with your own button component.
107
+ */
108
+ const SheetTrigger = React.forwardRef<
109
+ React.ComponentRef<typeof SheetPrimitive.Trigger>,
110
+ SheetTriggerProps
111
+ >(({ dataHook, ...props }, ref) => (
112
+ <SheetPrimitive.Trigger
113
+ ref={ref}
114
+ data-hook={dataHook}
115
+ data-slot="sheet-trigger"
116
+ {...props}
117
+ />
118
+ ));
119
+ SheetTrigger.displayName = "SheetTrigger";
101
120
 
121
+ /**
122
+ * Sheet close button that closes the sheet when clicked.
123
+ * Use with asChild prop to merge with your own button component.
124
+ */
125
+ const SheetClose = React.forwardRef<
126
+ React.ComponentRef<typeof SheetPrimitive.Close>,
127
+ React.ComponentProps<typeof SheetPrimitive.Close>
128
+ >(({ ...props }, ref) => (
129
+ <SheetPrimitive.Close ref={ref} data-slot="sheet-close" {...props} />
130
+ ));
131
+ SheetClose.displayName = "SheetClose";
132
+
133
+ /**
134
+ * Sheet portal that renders content in a React portal.
135
+ * Used internally by SheetContent.
136
+ */
102
137
  function SheetPortal({
103
138
  ...props
104
139
  }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
105
140
  return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
106
141
  }
142
+ SheetPortal.displayName = "SheetPortal";
107
143
 
108
- function SheetOverlay({
109
- className,
110
- ...props
111
- }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
112
- return (
113
- <SheetPrimitive.Overlay
114
- className={cn(
115
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
116
- className
117
- )}
118
- data-slot="sheet-overlay"
119
- {...props}
120
- />
121
- );
122
- }
144
+ /**
145
+ * Sheet overlay that appears behind the sheet content.
146
+ * Provides a semi-transparent backdrop with fade animation.
147
+ */
148
+ const SheetOverlay = React.forwardRef<
149
+ React.ComponentRef<typeof SheetPrimitive.Overlay>,
150
+ React.ComponentProps<typeof SheetPrimitive.Overlay>
151
+ >(({ className, ...props }, ref) => (
152
+ <SheetPrimitive.Overlay
153
+ ref={ref}
154
+ className={cn(
155
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
156
+ className
157
+ )}
158
+ data-slot="sheet-overlay"
159
+ {...props}
160
+ />
161
+ ));
162
+ SheetOverlay.displayName = "SheetOverlay";
123
163
 
164
+ /**
165
+ * Props for the SheetContent component
166
+ */
124
167
  interface SheetContentProps
125
168
  extends
126
169
  React.ComponentProps<typeof SheetPrimitive.Content>,
127
170
  VariantProps<typeof sheetContentVariants> {
128
171
  /**
129
172
  * Side from which the sheet slides in
173
+ * @default "right"
130
174
  */
131
175
  side?: SheetSide;
176
+ /**
177
+ * Data hook for automated testing
178
+ */
179
+ dataHook?: string;
180
+ /**
181
+ * Tracking element identifier for analytics
182
+ */
183
+ trackingEl?: string;
184
+ /**
185
+ * Tracking label for analytics context
186
+ */
187
+ trackingLabel?: string;
132
188
  }
133
189
 
134
- function SheetContent({
135
- className,
136
- children,
137
- side,
138
- ...props
139
- }: SheetContentProps) {
140
- return (
190
+ /**
191
+ * Sheet content container that slides in from the specified side.
192
+ * Includes an overlay backdrop and close button.
193
+ */
194
+ const SheetContent = React.forwardRef<
195
+ React.ComponentRef<typeof SheetPrimitive.Content>,
196
+ SheetContentProps
197
+ >(
198
+ (
199
+ {
200
+ className,
201
+ children,
202
+ side,
203
+ dataHook,
204
+ trackingEl,
205
+ trackingLabel,
206
+ ...props
207
+ },
208
+ ref
209
+ ) => (
141
210
  <SheetPortal>
142
211
  <SheetOverlay />
143
212
  <SheetPrimitive.Content
213
+ ref={ref}
144
214
  className={cn(sheetContentVariants({ side }), className)}
215
+ data-hook={dataHook}
145
216
  data-slot="sheet-content"
217
+ data-tracking-el={trackingEl}
218
+ data-tracking-label={trackingLabel}
146
219
  {...props}
147
220
  >
148
221
  {children}
@@ -152,57 +225,80 @@ function SheetContent({
152
225
  </SheetPrimitive.Close>
153
226
  </SheetPrimitive.Content>
154
227
  </SheetPortal>
155
- );
156
- }
228
+ )
229
+ );
230
+ SheetContent.displayName = "SheetContent";
157
231
 
158
- function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
159
- return (
160
- <div
161
- className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
162
- data-slot="sheet-header"
163
- {...props}
164
- />
165
- );
166
- }
232
+ /**
233
+ * Sheet header section for title and description.
234
+ * Centers text on mobile, left-aligns on larger screens.
235
+ */
236
+ const SheetHeader = React.forwardRef<
237
+ HTMLDivElement,
238
+ React.ComponentProps<"div">
239
+ >(({ className, ...props }, ref) => (
240
+ <div
241
+ ref={ref}
242
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
243
+ data-slot="sheet-header"
244
+ {...props}
245
+ />
246
+ ));
247
+ SheetHeader.displayName = "SheetHeader";
167
248
 
168
- function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
169
- return (
170
- <div
171
- className={cn(
172
- "mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end",
173
- className
174
- )}
175
- data-slot="sheet-footer"
176
- {...props}
177
- />
178
- );
179
- }
249
+ /**
250
+ * Sheet footer section for actions and buttons.
251
+ * Stacks buttons on mobile, aligns to end on larger screens.
252
+ */
253
+ const SheetFooter = React.forwardRef<
254
+ HTMLDivElement,
255
+ React.ComponentProps<"div">
256
+ >(({ className, ...props }, ref) => (
257
+ <div
258
+ ref={ref}
259
+ className={cn(
260
+ "mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end",
261
+ className
262
+ )}
263
+ data-slot="sheet-footer"
264
+ {...props}
265
+ />
266
+ ));
267
+ SheetFooter.displayName = "SheetFooter";
180
268
 
181
- function SheetTitle({
182
- className,
183
- ...props
184
- }: React.ComponentProps<typeof SheetPrimitive.Title>) {
185
- return (
186
- <SheetPrimitive.Title
187
- className={cn("text-foreground text-lg font-semibold", className)}
188
- data-slot="sheet-title"
189
- {...props}
190
- />
191
- );
192
- }
269
+ /**
270
+ * Sheet title component for the main heading.
271
+ * Should be used within SheetHeader.
272
+ */
273
+ const SheetTitle = React.forwardRef<
274
+ React.ComponentRef<typeof SheetPrimitive.Title>,
275
+ React.ComponentProps<typeof SheetPrimitive.Title>
276
+ >(({ className, ...props }, ref) => (
277
+ <SheetPrimitive.Title
278
+ ref={ref}
279
+ className={cn("text-foreground text-lg font-semibold", className)}
280
+ data-slot="sheet-title"
281
+ {...props}
282
+ />
283
+ ));
284
+ SheetTitle.displayName = "SheetTitle";
193
285
 
194
- function SheetDescription({
195
- className,
196
- ...props
197
- }: React.ComponentProps<typeof SheetPrimitive.Description>) {
198
- return (
199
- <SheetPrimitive.Description
200
- className={cn("text-muted-foreground text-sm", className)}
201
- data-slot="sheet-description"
202
- {...props}
203
- />
204
- );
205
- }
286
+ /**
287
+ * Sheet description component for additional context.
288
+ * Should be used within SheetHeader below SheetTitle.
289
+ */
290
+ const SheetDescription = React.forwardRef<
291
+ React.ComponentRef<typeof SheetPrimitive.Description>,
292
+ React.ComponentProps<typeof SheetPrimitive.Description>
293
+ >(({ className, ...props }, ref) => (
294
+ <SheetPrimitive.Description
295
+ ref={ref}
296
+ className={cn("text-muted-foreground text-sm", className)}
297
+ data-slot="sheet-description"
298
+ {...props}
299
+ />
300
+ ));
301
+ SheetDescription.displayName = "SheetDescription";
206
302
 
207
303
  export {
208
304
  Sheet,
@@ -217,4 +313,4 @@ export {
217
313
  SheetTrigger,
218
314
  };
219
315
 
220
- export type { SheetContentProps };
316
+ export type { SheetContentProps, SheetTriggerProps };
@@ -1,17 +1,47 @@
1
- import { cn } from "@brightlocal/ui-components/lib/utils";
1
+ import * as React from "react";
2
2
 
3
- type SkeletonProps = React.ComponentProps<"div">;
3
+ import { cn } from "@brightlocal/ui-components/lib/utils";
4
4
 
5
- function Skeleton({ className, ...props }: SkeletonProps) {
6
- return (
7
- <div
8
- className={cn("bg-accent animate-pulse rounded-md", className)}
9
- data-slot="skeleton"
10
- {...props}
11
- />
12
- );
5
+ /**
6
+ * Props for the Skeleton component
7
+ */
8
+ interface SkeletonProps extends React.ComponentProps<"div"> {
9
+ /**
10
+ * Data hook for automated testing (optional for Skeleton as it's purely presentational)
11
+ */
12
+ dataHook?: string;
13
+ /**
14
+ * Tracking element identifier for analytics
15
+ */
16
+ trackingEl?: string;
17
+ /**
18
+ * Tracking label for analytics context
19
+ */
20
+ trackingLabel?: string;
13
21
  }
14
22
 
23
+ /**
24
+ * Skeleton component for loading placeholder states.
25
+ * Displays a pulsing animation to indicate content is loading.
26
+ * Use to represent text, images, avatars, or any other content while data is being fetched.
27
+ */
28
+ const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
29
+ ({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => {
30
+ return (
31
+ <div
32
+ ref={ref}
33
+ className={cn("bg-accent animate-pulse rounded-md", className)}
34
+ data-hook={dataHook}
35
+ data-slot="skeleton"
36
+ data-tracking-el={trackingEl}
37
+ data-tracking-label={trackingLabel}
38
+ {...props}
39
+ />
40
+ );
41
+ }
42
+ );
43
+ Skeleton.displayName = "Skeleton";
44
+
15
45
  export { Skeleton };
16
46
 
17
47
  export type { SkeletonProps };