@brightlocal/ui-components 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) 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.d.ts +22 -1
  10. package/dist/alert.d.ts.map +1 -1
  11. package/dist/aspect-ratio.cjs +1 -1
  12. package/dist/aspect-ratio.d.ts +11 -1
  13. package/dist/aspect-ratio.d.ts.map +1 -1
  14. package/dist/aspect-ratio.js +16 -20
  15. package/dist/avatar.cjs +1 -1
  16. package/dist/avatar.d.ts +43 -3
  17. package/dist/avatar.d.ts.map +1 -1
  18. package/dist/avatar.js +18 -16
  19. package/dist/badge.cjs +1 -1
  20. package/dist/badge.d.ts +24 -9
  21. package/dist/badge.d.ts.map +1 -1
  22. package/dist/badge.js +34 -32
  23. package/dist/blocks/data-table.cjs +1 -1
  24. package/dist/blocks/data-table.d.ts.map +1 -1
  25. package/dist/blocks/data-table.js +177 -170
  26. package/dist/blocks/sidebar.cjs +1 -1
  27. package/dist/blocks/sidebar.d.ts +1 -1
  28. package/dist/blocks/sidebar.d.ts.map +1 -1
  29. package/dist/blocks/sidebar.js +154 -154
  30. package/dist/breadcrumb.cjs +1 -1
  31. package/dist/breadcrumb.d.ts +63 -8
  32. package/dist/breadcrumb.d.ts.map +1 -1
  33. package/dist/breadcrumb.js +97 -93
  34. package/dist/button.cjs +1 -1
  35. package/dist/button.d.ts +17 -45
  36. package/dist/button.d.ts.map +1 -1
  37. package/dist/button.js +49 -50
  38. package/dist/calendar.cjs +1 -1
  39. package/dist/calendar.d.ts +12 -0
  40. package/dist/calendar.d.ts.map +1 -1
  41. package/dist/calendar.js +10 -8
  42. package/dist/card.cjs +1 -1
  43. package/dist/card.d.ts +58 -18
  44. package/dist/card.d.ts.map +1 -1
  45. package/dist/card.js +60 -51
  46. package/dist/carousel.cjs +1 -1
  47. package/dist/carousel.d.ts +99 -9
  48. package/dist/carousel.d.ts.map +1 -1
  49. package/dist/carousel.js +142 -128
  50. package/dist/centred-layout.cjs +1 -1
  51. package/dist/centred-layout.d.ts +18 -2
  52. package/dist/centred-layout.d.ts.map +1 -1
  53. package/dist/centred-layout.js +46 -33
  54. package/dist/chart.cjs +4 -4
  55. package/dist/chart.d.ts +70 -7
  56. package/dist/chart.d.ts.map +1 -1
  57. package/dist/chart.js +71 -66
  58. package/dist/checkbox.cjs +1 -1
  59. package/dist/checkbox.d.ts +9 -5
  60. package/dist/checkbox.d.ts.map +1 -1
  61. package/dist/checkbox.js +61 -82
  62. package/dist/collapsible.cjs +1 -1
  63. package/dist/collapsible.d.ts +65 -8
  64. package/dist/collapsible.d.ts.map +1 -1
  65. package/dist/collapsible.js +41 -55
  66. package/dist/combobox.cjs +1 -1
  67. package/dist/combobox.d.ts +29 -11
  68. package/dist/combobox.d.ts.map +1 -1
  69. package/dist/combobox.js +193 -159
  70. package/dist/command.cjs +1 -1
  71. package/dist/command.d.ts +115 -9
  72. package/dist/command.d.ts.map +1 -1
  73. package/dist/command.js +176 -152
  74. package/dist/context-menu.cjs +1 -1
  75. package/dist/context-menu.d.ts +188 -20
  76. package/dist/context-menu.d.ts.map +1 -1
  77. package/dist/context-menu.js +119 -121
  78. package/dist/date-picker.cjs +1 -1
  79. package/dist/date-picker.d.ts +75 -9
  80. package/dist/date-picker.d.ts.map +1 -1
  81. package/dist/date-picker.js +220 -81
  82. package/dist/description.cjs +1 -0
  83. package/dist/description.d.ts +37 -0
  84. package/dist/description.d.ts.map +1 -0
  85. package/dist/description.js +25 -0
  86. package/dist/dialog.cjs +1 -1
  87. package/dist/dialog.d.ts +73 -9
  88. package/dist/dialog.d.ts.map +1 -1
  89. package/dist/dialog.js +103 -112
  90. package/dist/drawer.cjs +1 -1
  91. package/dist/drawer.d.ts +92 -0
  92. package/dist/drawer.d.ts.map +1 -1
  93. package/dist/drawer.js +67 -52
  94. package/dist/dropdown-menu.cjs +1 -1
  95. package/dist/dropdown-menu.d.ts +95 -11
  96. package/dist/dropdown-menu.d.ts.map +1 -1
  97. package/dist/dropdown-menu.js +146 -106
  98. package/dist/field.cjs +1 -1
  99. package/dist/field.d.ts +23 -6
  100. package/dist/field.d.ts.map +1 -1
  101. package/dist/field.js +54 -53
  102. package/dist/global-layout.cjs +1 -1
  103. package/dist/global-layout.d.ts +27 -17
  104. package/dist/global-layout.d.ts.map +1 -1
  105. package/dist/global-layout.js +86 -79
  106. package/dist/hover-card.cjs +1 -1
  107. package/dist/hover-card.d.ts +36 -6
  108. package/dist/hover-card.d.ts.map +1 -1
  109. package/dist/hover-card.js +44 -42
  110. package/dist/index.cjs +1 -1
  111. package/dist/index.d.ts +1 -1
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +383 -387
  114. package/dist/input-group.cjs +1 -1
  115. package/dist/input-group.d.ts +21 -2
  116. package/dist/input-group.d.ts.map +1 -1
  117. package/dist/input-group.js +51 -41
  118. package/dist/input-password.cjs +1 -1
  119. package/dist/input-password.d.ts.map +1 -1
  120. package/dist/input-password.js +24 -25
  121. package/dist/input.cjs +1 -1
  122. package/dist/input.d.ts +38 -24
  123. package/dist/input.d.ts.map +1 -1
  124. package/dist/input.js +68 -136
  125. package/dist/label.cjs +1 -1
  126. package/dist/label.d.ts +20 -1
  127. package/dist/label.d.ts.map +1 -1
  128. package/dist/label.js +31 -18
  129. package/dist/logo.cjs +1 -1
  130. package/dist/logo.d.ts +3 -0
  131. package/dist/logo.d.ts.map +1 -1
  132. package/dist/logo.js +12 -10
  133. package/dist/menubar.cjs +1 -1
  134. package/dist/menubar.d.ts +40 -6
  135. package/dist/menubar.d.ts.map +1 -1
  136. package/dist/menubar.js +97 -76
  137. package/dist/popover.cjs +1 -1
  138. package/dist/popover.d.ts +59 -4
  139. package/dist/popover.d.ts.map +1 -1
  140. package/dist/popover.js +42 -34
  141. package/dist/progress.cjs +1 -1
  142. package/dist/progress.d.ts +9 -2
  143. package/dist/progress.d.ts.map +1 -1
  144. package/dist/progress.js +71 -59
  145. package/dist/radio-group.d.ts +40 -0
  146. package/dist/radio-group.d.ts.map +1 -1
  147. package/dist/rating.d.ts +4 -0
  148. package/dist/rating.d.ts.map +1 -1
  149. package/dist/resizable.cjs +1 -1
  150. package/dist/resizable.d.ts +65 -4
  151. package/dist/resizable.d.ts.map +1 -1
  152. package/dist/resizable.js +53 -36
  153. package/dist/scroll-area.cjs +1 -1
  154. package/dist/scroll-area.d.ts +46 -5
  155. package/dist/scroll-area.d.ts.map +1 -1
  156. package/dist/scroll-area.js +42 -38
  157. package/dist/select.cjs +1 -1
  158. package/dist/select.d.ts +30 -0
  159. package/dist/select.d.ts.map +1 -1
  160. package/dist/select.js +64 -54
  161. package/dist/separator.cjs +1 -1
  162. package/dist/separator.d.ts +49 -2
  163. package/dist/separator.d.ts.map +1 -1
  164. package/dist/separator.js +48 -36
  165. package/dist/sheet.cjs +1 -1
  166. package/dist/sheet.d.ts +80 -9
  167. package/dist/sheet.d.ts.map +1 -1
  168. package/dist/sheet.js +117 -113
  169. package/dist/skeleton.cjs +1 -1
  170. package/dist/skeleton.d.ts +24 -2
  171. package/dist/skeleton.d.ts.map +1 -1
  172. package/dist/skeleton.js +15 -9
  173. package/dist/slider.cjs +1 -1
  174. package/dist/slider.d.ts +18 -4
  175. package/dist/slider.d.ts.map +1 -1
  176. package/dist/slider.js +72 -66
  177. package/dist/sonner.cjs +1 -1
  178. package/dist/sonner.d.ts +4 -2
  179. package/dist/sonner.d.ts.map +1 -1
  180. package/dist/sonner.js +29 -28
  181. package/dist/split-layout.d.ts +4 -1
  182. package/dist/split-layout.d.ts.map +1 -1
  183. package/package.json +8 -2
  184. package/src/blocks/data-table.tsx +42 -32
  185. package/src/blocks/sidebar.tsx +4 -12
  186. package/src/components/accordion.tsx +163 -77
  187. package/src/components/alert-dialog.tsx +156 -111
  188. package/src/components/alert.tsx +26 -13
  189. package/src/components/aspect-ratio.tsx +25 -16
  190. package/src/components/avatar.tsx +56 -8
  191. package/src/components/badge.tsx +65 -42
  192. package/src/components/breadcrumb.tsx +158 -82
  193. package/src/components/button.tsx +41 -62
  194. package/src/components/calendar.tsx +16 -2
  195. package/src/components/card.tsx +92 -40
  196. package/src/components/carousel.tsx +240 -115
  197. package/src/components/centred-layout.tsx +67 -35
  198. package/src/components/chart.tsx +118 -47
  199. package/src/components/checkbox.tsx +42 -78
  200. package/src/components/collapsible.tsx +95 -26
  201. package/src/components/combobox.tsx +242 -144
  202. package/src/components/command.tsx +295 -121
  203. package/src/components/context-menu.tsx +278 -81
  204. package/src/components/date-picker.tsx +281 -30
  205. package/src/components/description.tsx +60 -0
  206. package/src/components/dialog.tsx +162 -86
  207. package/src/components/drawer.tsx +76 -2
  208. package/src/components/dropdown-menu.tsx +143 -37
  209. package/src/components/field.tsx +36 -11
  210. package/src/components/global-layout.tsx +116 -77
  211. package/src/components/hover-card.tsx +54 -14
  212. package/src/components/input-group.tsx +56 -18
  213. package/src/components/input-password.tsx +3 -4
  214. package/src/components/input.tsx +93 -186
  215. package/src/components/label.tsx +56 -15
  216. package/src/components/logo.tsx +3 -0
  217. package/src/components/menubar.tsx +58 -4
  218. package/src/components/popover.tsx +103 -20
  219. package/src/components/progress.tsx +82 -60
  220. package/src/components/radio-group.tsx +40 -0
  221. package/src/components/rating.tsx +4 -0
  222. package/src/components/resizable.tsx +119 -31
  223. package/src/components/scroll-area.tsx +123 -56
  224. package/src/components/select.tsx +21 -1
  225. package/src/components/separator.tsx +97 -20
  226. package/src/components/sheet.tsx +180 -79
  227. package/src/components/skeleton.tsx +40 -10
  228. package/src/components/slider.tsx +83 -57
  229. package/src/components/sonner.tsx +10 -7
  230. package/src/components/split-layout.tsx +4 -1
  231. package/src/index.ts +1 -1
  232. package/dist/input-base.cjs +0 -1
  233. package/dist/input-base.d.ts +0 -28
  234. package/dist/input-base.d.ts.map +0 -1
  235. package/dist/input-base.js +0 -56
  236. 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 "lucide-react";
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,21 @@ function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
17
18
  );
18
19
  }
19
20
 
21
+ interface FieldLegendProps extends React.ComponentProps<"legend"> {
22
+ /**
23
+ * Visual style variant of the legend
24
+ * @default "legend"
25
+ */
26
+ variant?: "legend" | "label";
27
+ }
28
+
29
+ const fieldLegendVariants: FieldLegendProps["variant"][] = ["legend", "label"];
30
+
20
31
  function FieldLegend({
21
32
  className,
22
33
  variant = "legend",
23
34
  ...props
24
- }: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
35
+ }: FieldLegendProps) {
25
36
  return (
26
37
  <legend
27
38
  className={cn(
@@ -71,14 +82,27 @@ const fieldVariants = cva("group/field flex w-full gap-2", {
71
82
  },
72
83
  });
73
84
 
85
+ /**
86
+ * Props for the Field component
87
+ */
88
+ interface FieldProps
89
+ extends React.ComponentProps<"div">, VariantProps<typeof fieldVariants> {
90
+ /**
91
+ * Data hook for automated testing
92
+ */
93
+ dataHook?: string;
94
+ }
95
+
74
96
  function Field({
75
97
  className,
76
98
  orientation = "vertical",
99
+ dataHook,
77
100
  ...props
78
- }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
101
+ }: FieldProps) {
79
102
  return (
80
103
  <div
81
104
  className={cn(fieldVariants({ orientation }), className)}
105
+ data-hook={dataHook}
82
106
  data-orientation={orientation}
83
107
  data-slot="field"
84
108
  role="group"
@@ -100,16 +124,14 @@ function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
100
124
  );
101
125
  }
102
126
 
103
- function FieldLabel({
104
- className,
105
- htmlFor,
106
- ...props
107
- }: Omit<React.ComponentProps<typeof Label>, "htmlFor"> & {
127
+ interface FieldLabelProps extends React.ComponentProps<typeof Label> {
108
128
  /**
109
129
  * Required htmlFor attribute for linking label with input
110
130
  */
111
131
  htmlFor: string;
112
- }) {
132
+ }
133
+
134
+ function FieldLabel({ className, htmlFor, ...props }: FieldLabelProps) {
113
135
  return (
114
136
  <Label
115
137
  className={cn(
@@ -130,12 +152,12 @@ function FieldLabel({
130
152
 
131
153
  function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
132
154
  return (
133
- <p
155
+ <Description
134
156
  className={cn(
135
- "text-muted-foreground mt-2 text-left text-sm",
157
+ // Field-specific positioning and context styles
158
+ "mt-2",
136
159
  "group-has-[[data-orientation=horizontal]]/field:text-balance",
137
160
  "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
161
  className
140
162
  )}
141
163
  data-slot="field-description"
@@ -150,6 +172,9 @@ export {
150
172
  FieldDescription,
151
173
  FieldGroup,
152
174
  FieldLegend,
175
+ fieldLegendVariants,
153
176
  FieldSet,
154
177
  FieldContent,
155
178
  };
179
+
180
+ 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
+ };