@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 DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
5
- import { Check, ChevronRight, Circle } from "lucide-react";
5
+ import { Check, ChevronRight, Circle, ChevronsUpDown } from "@brightlocal/icons";
6
6
 
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
8
 
@@ -28,18 +28,38 @@ function DropdownMenuPortal({
28
28
 
29
29
  DropdownMenuPortal.displayName = "DropdownMenuPortal";
30
30
 
31
+ type DropdownMenuTriggerProps = React.ComponentPropsWithoutRef<
32
+ typeof DropdownMenuPrimitive.Trigger
33
+ > & {
34
+ /**
35
+ * Data hook for automated testing (optional)
36
+ */
37
+ dataHook?: string;
38
+ /**
39
+ * Tracking element identifier for analytics
40
+ */
41
+ trackingEl?: string;
42
+ /**
43
+ * Tracking label for analytics context
44
+ */
45
+ trackingLabel?: string;
46
+ };
47
+
31
48
  /**
32
49
  * Trigger button that opens the dropdown menu
33
50
  */
34
51
  const DropdownMenuTrigger = React.forwardRef<
35
- React.ElementRef<typeof DropdownMenuPrimitive.Trigger>,
36
- React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>
37
- >(({ className, ...props }, ref) => {
52
+ React.ComponentRef<typeof DropdownMenuPrimitive.Trigger>,
53
+ DropdownMenuTriggerProps
54
+ >(({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => {
38
55
  return (
39
56
  <DropdownMenuPrimitive.Trigger
40
57
  ref={ref}
41
58
  className={className}
59
+ data-hook={dataHook}
42
60
  data-slot="dropdown-menu-trigger"
61
+ data-tracking-el={trackingEl}
62
+ data-tracking-label={trackingLabel}
43
63
  {...props}
44
64
  />
45
65
  );
@@ -68,7 +88,7 @@ type DropdownMenuContentProps = React.ComponentPropsWithoutRef<
68
88
  * Dropdown menu content container (popup)
69
89
  */
70
90
  const DropdownMenuContent = React.forwardRef<
71
- React.ElementRef<typeof DropdownMenuPrimitive.Content>,
91
+ React.ComponentRef<typeof DropdownMenuPrimitive.Content>,
72
92
  DropdownMenuContentProps
73
93
  >(
74
94
  (
@@ -150,29 +170,17 @@ type DropdownMenuItemProps = React.ComponentPropsWithoutRef<
150
170
  * Indent the item (for hierarchical menus)
151
171
  */
152
172
  inset?: boolean;
153
- /**
154
- * Visual variant for destructive actions
155
- */
156
- variant?: "default" | "destructive";
157
173
  };
158
174
 
159
175
  /**
160
176
  * Individual dropdown menu item
161
177
  */
162
178
  const DropdownMenuItem = React.forwardRef<
163
- React.ElementRef<typeof DropdownMenuPrimitive.Item>,
179
+ React.ComponentRef<typeof DropdownMenuPrimitive.Item>,
164
180
  DropdownMenuItemProps
165
181
  >(
166
182
  (
167
- {
168
- className,
169
- inset,
170
- variant = "default",
171
- dataHook,
172
- trackingEl,
173
- trackingLabel,
174
- ...props
175
- },
183
+ { className, inset, dataHook, trackingEl, trackingLabel, ...props },
176
184
  ref
177
185
  ) => {
178
186
  return (
@@ -180,22 +188,18 @@ const DropdownMenuItem = React.forwardRef<
180
188
  ref={ref}
181
189
  className={cn(
182
190
  [
183
- "relative flex cursor-default items-center gap-2 select-none",
184
- "rounded-sm px-2 py-1.5 text-sm outline-hidden",
191
+ "relative flex cursor-default items-center gap-2 self-stretch select-none",
192
+ "rounded-sm px-2 py-1.5 text-sm leading-normal outline-hidden",
193
+ // Text truncation for child text elements
194
+ "[&>span]:overflow-hidden [&>span]:text-ellipsis [&>span]:whitespace-nowrap",
185
195
  "focus:bg-accent focus:text-accent-foreground",
186
196
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
187
197
  // Inset (indentation)
188
198
  "data-[inset]:pl-8",
189
- // Variant: destructive
190
- "data-[variant=destructive]:text-destructive",
191
- "data-[variant=destructive]:focus:bg-destructive/10",
192
- "dark:data-[variant=destructive]:focus:bg-destructive/20",
193
- "data-[variant=destructive]:focus:text-destructive",
194
- "data-[variant=destructive]:*:[svg]:!text-destructive",
195
199
  // Icon styling
196
- "[&_svg:not([class*='text-'])]:text-muted-foreground",
197
200
  "[&_svg]:pointer-events-none [&_svg]:shrink-0",
198
201
  "[&_svg:not([class*='size-'])]:size-4",
202
+ "[&_svg:not([class*='text-'])]:text-muted-foreground",
199
203
  ],
200
204
  className
201
205
  )}
@@ -204,7 +208,6 @@ const DropdownMenuItem = React.forwardRef<
204
208
  data-slot="dropdown-menu-item"
205
209
  data-tracking-el={trackingEl}
206
210
  data-tracking-label={trackingLabel}
207
- data-variant={variant}
208
211
  {...props}
209
212
  />
210
213
  );
@@ -234,7 +237,7 @@ type DropdownMenuCheckboxItemProps = React.ComponentPropsWithoutRef<
234
237
  * Checkbox menu item with check indicator
235
238
  */
236
239
  const DropdownMenuCheckboxItem = React.forwardRef<
237
- React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
240
+ React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,
238
241
  DropdownMenuCheckboxItemProps
239
242
  >(
240
243
  (
@@ -316,7 +319,7 @@ type DropdownMenuRadioItemProps = React.ComponentPropsWithoutRef<
316
319
  * Radio menu item with circle indicator
317
320
  */
318
321
  const DropdownMenuRadioItem = React.forwardRef<
319
- React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
322
+ React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,
320
323
  DropdownMenuRadioItemProps
321
324
  >(
322
325
  (
@@ -370,14 +373,17 @@ type DropdownMenuLabelProps = React.ComponentPropsWithoutRef<
370
373
  * Label/header for menu sections
371
374
  */
372
375
  const DropdownMenuLabel = React.forwardRef<
373
- React.ElementRef<typeof DropdownMenuPrimitive.Label>,
376
+ React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
374
377
  DropdownMenuLabelProps
375
378
  >(({ className, inset, ...props }, ref) => {
376
379
  return (
377
380
  <DropdownMenuPrimitive.Label
378
381
  ref={ref}
379
382
  className={cn(
380
- ["px-2 py-1.5 text-sm font-semibold", "data-[inset]:pl-8"],
383
+ [
384
+ "px-2 py-1.5 text-sm leading-normal font-semibold",
385
+ "data-[inset]:pl-8",
386
+ ],
381
387
  className
382
388
  )}
383
389
  data-inset={inset}
@@ -393,7 +399,7 @@ DropdownMenuLabel.displayName = "DropdownMenuLabel";
393
399
  * Separator/divider between menu sections
394
400
  */
395
401
  const DropdownMenuSeparator = React.forwardRef<
396
- React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
402
+ React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,
397
403
  React.ComponentProps<typeof DropdownMenuPrimitive.Separator>
398
404
  >(({ className, ...props }, ref) => {
399
405
  return (
@@ -418,7 +424,7 @@ function DropdownMenuShortcut({
418
424
  return (
419
425
  <span
420
426
  className={cn(
421
- ["text-muted-foreground ml-auto text-xs tracking-widest opacity-60"],
427
+ ["text-popover-foreground ml-auto text-xs leading-normal opacity-60"],
422
428
  className
423
429
  )}
424
430
  data-slot="dropdown-menu-shortcut"
@@ -465,7 +471,7 @@ type DropdownMenuSubTriggerProps = React.ComponentPropsWithoutRef<
465
471
  * Trigger for opening sub-menu
466
472
  */
467
473
  const DropdownMenuSubTrigger = React.forwardRef<
468
- React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
474
+ React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,
469
475
  DropdownMenuSubTriggerProps
470
476
  >(
471
477
  (
@@ -516,7 +522,7 @@ DropdownMenuSubTrigger.displayName = "DropdownMenuSubTrigger";
516
522
  * Sub-menu content container
517
523
  */
518
524
  const DropdownMenuSubContent = React.forwardRef<
519
- React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
525
+ React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,
520
526
  React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>
521
527
  >(({ className, ...props }, ref) => {
522
528
  return (
@@ -547,6 +553,103 @@ const DropdownMenuSubContent = React.forwardRef<
547
553
 
548
554
  DropdownMenuSubContent.displayName = "DropdownMenuSubContent";
549
555
 
556
+ type DropdownMenuTriggerAvatarProps = React.ComponentPropsWithoutRef<
557
+ typeof DropdownMenuPrimitive.Trigger
558
+ > & {
559
+ /**
560
+ * Data hook for automated testing
561
+ */
562
+ dataHook?: string;
563
+ /**
564
+ * Tracking element identifier for analytics
565
+ */
566
+ trackingEl?: string;
567
+ /**
568
+ * Tracking label for analytics context
569
+ */
570
+ trackingLabel?: string;
571
+ /**
572
+ * Avatar slot - expects an Avatar component
573
+ */
574
+ avatar: React.ReactNode;
575
+ /**
576
+ * Main text/title displayed next to avatar
577
+ */
578
+ title: string;
579
+ /**
580
+ * Description text displayed below title
581
+ */
582
+ description?: string;
583
+ /**
584
+ * Accessible label for screen readers.
585
+ * Defaults to title if not provided.
586
+ */
587
+ ariaLabel?: string;
588
+ };
589
+
590
+ /**
591
+ * Avatar-style trigger button for dropdown menu with title and description
592
+ */
593
+ const DropdownMenuTriggerAvatar = React.forwardRef<
594
+ React.ComponentRef<typeof DropdownMenuPrimitive.Trigger>,
595
+ DropdownMenuTriggerAvatarProps
596
+ >(
597
+ (
598
+ {
599
+ className,
600
+ dataHook,
601
+ trackingEl,
602
+ trackingLabel,
603
+ avatar,
604
+ title,
605
+ description,
606
+ disabled,
607
+ ariaLabel,
608
+ ...props
609
+ },
610
+ ref
611
+ ) => {
612
+ return (
613
+ <DropdownMenuPrimitive.Trigger
614
+ ref={ref}
615
+ aria-label={ariaLabel ?? title}
616
+ className={cn(
617
+ [
618
+ "flex items-center gap-2 rounded-lg border px-3 py-2",
619
+ "bg-popover shadow-sm",
620
+ "outline-none",
621
+ "hover:bg-accent",
622
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
623
+ "disabled:pointer-events-none disabled:opacity-50",
624
+ ],
625
+ className
626
+ )}
627
+ data-hook={dataHook}
628
+ data-slot="dropdown-menu-trigger-avatar"
629
+ data-tracking-el={trackingEl}
630
+ data-tracking-label={trackingLabel}
631
+ disabled={disabled}
632
+ {...props}
633
+ >
634
+ {avatar}
635
+ <div className="flex min-w-0 flex-1 flex-col items-start">
636
+ <span className="w-full overflow-hidden text-sm leading-normal font-semibold text-ellipsis whitespace-nowrap">
637
+ {title}
638
+ </span>
639
+ {description && (
640
+ <span className="text-muted-foreground w-full overflow-hidden text-xs leading-normal text-ellipsis whitespace-nowrap">
641
+ {description}
642
+ </span>
643
+ )}
644
+ </div>
645
+ <ChevronsUpDown className="text-muted-foreground size-4 opacity-50" />
646
+ </DropdownMenuPrimitive.Trigger>
647
+ );
648
+ }
649
+ );
650
+
651
+ DropdownMenuTriggerAvatar.displayName = "DropdownMenuTriggerAvatar";
652
+
550
653
  export {
551
654
  DropdownMenu,
552
655
  DropdownMenuCheckboxItem,
@@ -563,13 +666,16 @@ export {
563
666
  DropdownMenuSubContent,
564
667
  DropdownMenuSubTrigger,
565
668
  DropdownMenuTrigger,
669
+ DropdownMenuTriggerAvatar,
566
670
  };
567
671
 
568
672
  export type {
673
+ DropdownMenuTriggerProps,
569
674
  DropdownMenuContentProps,
570
675
  DropdownMenuItemProps,
571
676
  DropdownMenuCheckboxItemProps,
572
677
  DropdownMenuRadioItemProps,
573
678
  DropdownMenuLabelProps,
574
679
  DropdownMenuSubTriggerProps,
680
+ DropdownMenuTriggerAvatarProps,
575
681
  };
@@ -1,6 +1,7 @@
1
1
  import { cva, type VariantProps } from "class-variance-authority";
2
2
 
3
3
  import { cn } from "@brightlocal/ui-components/lib/utils";
4
+ import { Description } from "./description";
4
5
  import { Label } from "@brightlocal/ui-components/label";
5
6
 
6
7
  function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
@@ -17,11 +18,23 @@ function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
17
18
  );
18
19
  }
19
20
 
21
+ FieldSet.displayName = "FieldSet";
22
+
23
+ interface FieldLegendProps extends React.ComponentProps<"legend"> {
24
+ /**
25
+ * Visual style variant of the legend
26
+ * @default "legend"
27
+ */
28
+ variant?: "legend" | "label";
29
+ }
30
+
31
+ const fieldLegendVariants: FieldLegendProps["variant"][] = ["legend", "label"];
32
+
20
33
  function FieldLegend({
21
34
  className,
22
35
  variant = "legend",
23
36
  ...props
24
- }: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
37
+ }: FieldLegendProps) {
25
38
  return (
26
39
  <legend
27
40
  className={cn(
@@ -71,14 +84,27 @@ const fieldVariants = cva("group/field flex w-full gap-2", {
71
84
  },
72
85
  });
73
86
 
87
+ /**
88
+ * Props for the Field component
89
+ */
90
+ interface FieldProps
91
+ extends React.ComponentProps<"div">, VariantProps<typeof fieldVariants> {
92
+ /**
93
+ * Data hook for automated testing
94
+ */
95
+ dataHook?: string;
96
+ }
97
+
74
98
  function Field({
75
99
  className,
76
100
  orientation = "vertical",
101
+ dataHook,
77
102
  ...props
78
- }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
103
+ }: FieldProps) {
79
104
  return (
80
105
  <div
81
106
  className={cn(fieldVariants({ orientation }), className)}
107
+ data-hook={dataHook}
82
108
  data-orientation={orientation}
83
109
  data-slot="field"
84
110
  role="group"
@@ -100,16 +126,14 @@ function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
100
126
  );
101
127
  }
102
128
 
103
- function FieldLabel({
104
- className,
105
- htmlFor,
106
- ...props
107
- }: Omit<React.ComponentProps<typeof Label>, "htmlFor"> & {
129
+ interface FieldLabelProps extends React.ComponentProps<typeof Label> {
108
130
  /**
109
131
  * Required htmlFor attribute for linking label with input
110
132
  */
111
133
  htmlFor: string;
112
- }) {
134
+ }
135
+
136
+ function FieldLabel({ className, htmlFor, ...props }: FieldLabelProps) {
113
137
  return (
114
138
  <Label
115
139
  className={cn(
@@ -130,12 +154,12 @@ function FieldLabel({
130
154
 
131
155
  function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
132
156
  return (
133
- <p
157
+ <Description
134
158
  className={cn(
135
- "text-muted-foreground mt-2 text-left text-sm",
159
+ // Field-specific positioning and context styles
160
+ "mt-2",
136
161
  "group-has-[[data-orientation=horizontal]]/field:text-balance",
137
162
  "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
138
- "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
139
163
  className
140
164
  )}
141
165
  data-slot="field-description"
@@ -150,6 +174,9 @@ export {
150
174
  FieldDescription,
151
175
  FieldGroup,
152
176
  FieldLegend,
177
+ fieldLegendVariants,
153
178
  FieldSet,
154
179
  FieldContent,
155
180
  };
181
+
182
+ export type { FieldProps };
@@ -18,59 +18,92 @@ const MAX_WIDTH = "1280px";
18
18
  */
19
19
 
20
20
  interface GlobalLayoutProps extends React.ComponentProps<"div"> {
21
+ /**
22
+ * Data hook for automated testing (required)
23
+ */
24
+ dataHook: string;
25
+ /**
26
+ * Tracking element identifier for analytics
27
+ */
28
+ trackingEl?: string;
29
+ /**
30
+ * Tracking label for analytics context
31
+ */
32
+ trackingLabel?: string;
21
33
  /**
22
34
  * Maximum width for the global container (default: 1280px)
23
35
  */
24
36
  maxWidth?: string | number;
25
37
  }
26
38
 
27
- function GlobalLayout({
28
- className,
29
- maxWidth = MAX_WIDTH,
30
- children,
31
- ...props
32
- }: GlobalLayoutProps) {
33
- const maxWidthStyle =
34
- typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
35
-
36
- return (
37
- <div
38
- className={cn("min-h-screen w-full px-4 md:px-6", className)}
39
- data-slot="global-layout"
40
- {...props}
41
- >
39
+ const GlobalLayout = React.forwardRef<HTMLDivElement, GlobalLayoutProps>(
40
+ (
41
+ {
42
+ className,
43
+ maxWidth = MAX_WIDTH,
44
+ dataHook,
45
+ trackingEl,
46
+ trackingLabel,
47
+ children,
48
+ ...props
49
+ },
50
+ ref
51
+ ) => {
52
+ const maxWidthStyle =
53
+ typeof maxWidth === "number" ? `${maxWidth}px` : maxWidth;
54
+
55
+ return (
42
56
  <div
43
- className="mx-auto flex h-full w-full"
44
- data-slot="global-container"
45
- style={{ maxWidth: maxWidthStyle }}
57
+ ref={ref}
58
+ className={cn(
59
+ "flex min-h-screen w-full flex-col px-4 md:px-6",
60
+ className
61
+ )}
62
+ data-hook={dataHook}
63
+ data-slot="global-layout"
64
+ data-tracking-el={trackingEl}
65
+ data-tracking-label={trackingLabel}
66
+ {...props}
46
67
  >
47
- {children}
68
+ <div
69
+ className="mx-auto flex w-full flex-1 gap-4 md:gap-6"
70
+ data-slot="global-container"
71
+ style={{ maxWidth: maxWidthStyle }}
72
+ >
73
+ {children}
74
+ </div>
48
75
  </div>
49
- </div>
50
- );
51
- }
76
+ );
77
+ }
78
+ );
79
+
80
+ GlobalLayout.displayName = "GlobalLayout";
52
81
 
53
82
  // Matches 16rem (256px) and aligns with Figma design
54
83
  const SIDEBAR_WIDTH = "256px";
55
84
 
56
85
  interface GlobalLayoutSidebarProps extends React.ComponentProps<"aside"> {
86
+ /**
87
+ * Data hook for automated testing
88
+ */
89
+ dataHook?: string;
57
90
  /**
58
91
  * Width of the sidebar (default: 256px)
59
92
  */
60
93
  width?: string | number;
61
94
  }
62
95
 
63
- function GlobalLayoutSidebar({
64
- className,
65
- width = SIDEBAR_WIDTH,
66
- children,
67
- ...props
68
- }: GlobalLayoutSidebarProps) {
96
+ const GlobalLayoutSidebar = React.forwardRef<
97
+ HTMLElement,
98
+ GlobalLayoutSidebarProps
99
+ >(({ className, width = SIDEBAR_WIDTH, dataHook, children, ...props }, ref) => {
69
100
  const widthStyle = typeof width === "number" ? `${width}px` : width;
70
101
 
71
102
  return (
72
103
  <aside
73
- className={cn("hidden h-full shrink-0 lg:block", className)}
104
+ ref={ref}
105
+ className={cn("hidden shrink-0 self-stretch lg:block", className)}
106
+ data-hook={dataHook}
74
107
  data-slot="sidebar-container"
75
108
  style={{ width: widthStyle }}
76
109
  {...props}
@@ -78,27 +111,23 @@ function GlobalLayoutSidebar({
78
111
  {children}
79
112
  </aside>
80
113
  );
81
- }
114
+ });
115
+
116
+ GlobalLayoutSidebar.displayName = "GlobalLayoutSidebar";
82
117
 
83
118
  /**
84
119
  * Content width variants for GlobalLayoutContent
120
+ * - "full": Full width of available space
121
+ * - "md": Medium width (768px max-width)
122
+ * - "sm": Small width (374px max-width)
85
123
  */
86
- export enum ContentVariant {
87
- /**
88
- * Full width of available space
89
- */
90
- FULL = "full",
91
- /**
92
- * Medium width (768px max-width)
93
- */
94
- MD = "md",
95
- /**
96
- * Small width (374px max-width)
97
- */
98
- SM = "sm",
99
- }
124
+ type ContentVariant = "full" | "md" | "sm";
100
125
 
101
126
  interface GlobalLayoutContentProps extends React.ComponentProps<"div"> {
127
+ /**
128
+ * Data hook for automated testing
129
+ */
130
+ dataHook?: string;
102
131
  /**
103
132
  * Content width variant:
104
133
  * - "full": Full width of available space
@@ -112,42 +141,52 @@ interface GlobalLayoutContentProps extends React.ComponentProps<"div"> {
112
141
  padding?: string;
113
142
  }
114
143
 
115
- function GlobalLayoutContent({
116
- className,
117
- variant = ContentVariant.FULL,
118
- padding,
119
- children,
120
- ...props
121
- }: GlobalLayoutContentProps) {
122
- // Aligned with Figma design and Tailwind breakpoints
123
- // md: 768px - matches Tailwind's max-w-3xl
124
- // sm: 374px - optimized for mobile content
125
- const contentMaxWidth = {
126
- [ContentVariant.FULL]: "100%",
127
- [ContentVariant.MD]: "768px",
128
- [ContentVariant.SM]: "374px",
129
- };
130
-
131
- return (
132
- <div
133
- className={cn("flex h-full min-h-0 min-w-0 flex-1", className)}
134
- data-slot="content-wrapper"
135
- {...props}
136
- >
144
+ const GlobalLayoutContent = React.forwardRef<
145
+ HTMLDivElement,
146
+ GlobalLayoutContentProps
147
+ >(
148
+ (
149
+ { className, variant = "full", padding, dataHook, children, ...props },
150
+ ref
151
+ ) => {
152
+ // Aligned with Figma design and Tailwind breakpoints
153
+ // md: 768px - matches Tailwind's max-w-3xl
154
+ // sm: 374px - optimized for mobile content
155
+ const contentMaxWidth: Record<ContentVariant, string> = {
156
+ full: "100%",
157
+ md: "768px",
158
+ sm: "374px",
159
+ };
160
+
161
+ return (
137
162
  <div
138
- className={cn("mx-auto w-full px-4 md:px-6")}
139
- data-slot="content-container"
140
- style={{
141
- maxWidth: contentMaxWidth[variant],
142
- padding,
143
- }}
163
+ ref={ref}
164
+ className={cn("flex min-h-0 min-w-0 flex-1 self-stretch", className)}
165
+ data-hook={dataHook}
166
+ data-slot="content-wrapper"
167
+ {...props}
144
168
  >
145
- {children}
169
+ <div
170
+ className={cn("mx-auto w-full")}
171
+ data-slot="content-container"
172
+ style={{
173
+ maxWidth: contentMaxWidth[variant],
174
+ padding,
175
+ }}
176
+ >
177
+ {children}
178
+ </div>
146
179
  </div>
147
- </div>
148
- );
149
- }
180
+ );
181
+ }
182
+ );
183
+
184
+ GlobalLayoutContent.displayName = "GlobalLayoutContent";
150
185
 
151
186
  export { GlobalLayout, GlobalLayoutSidebar, GlobalLayoutContent };
152
187
 
153
- export type { GlobalLayoutProps };
188
+ export type {
189
+ GlobalLayoutProps,
190
+ GlobalLayoutSidebarProps,
191
+ GlobalLayoutContentProps,
192
+ };