@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,70 +2,125 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import * as DialogPrimitive from "@radix-ui/react-dialog";
5
- import { XIcon } from "lucide-react";
5
+ import { XIcon } from "@brightlocal/icons";
6
6
 
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
8
 
9
- function Dialog({
10
- ...props
11
- }: React.ComponentProps<typeof DialogPrimitive.Root>) {
12
- return <DialogPrimitive.Root {...props} />;
13
- }
14
-
15
- function DialogTrigger({
16
- ...props
17
- }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
18
- return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
9
+ /**
10
+ * Dialog - Root component for modal dialogs
11
+ * @description Wraps content in a modal dialog that overlays the main content
12
+ */
13
+ const Dialog = DialogPrimitive.Root;
14
+ Dialog.displayName = "Dialog";
15
+
16
+ /**
17
+ * Props for DialogTrigger component
18
+ */
19
+ interface DialogTriggerProps extends React.ComponentProps<
20
+ typeof DialogPrimitive.Trigger
21
+ > {
22
+ /**
23
+ * Data hook for automated testing
24
+ */
25
+ dataHook?: string;
19
26
  }
20
27
 
28
+ /**
29
+ * DialogTrigger - Button or element that opens the dialog
30
+ * @description Wraps an interactive element that toggles the dialog open state
31
+ */
32
+ const DialogTrigger = React.forwardRef<
33
+ React.ComponentRef<typeof DialogPrimitive.Trigger>,
34
+ DialogTriggerProps
35
+ >(({ dataHook, ...props }, ref) => (
36
+ <DialogPrimitive.Trigger
37
+ ref={ref}
38
+ data-hook={dataHook}
39
+ data-slot="dialog-trigger"
40
+ {...props}
41
+ />
42
+ ));
43
+ DialogTrigger.displayName = "DialogTrigger";
44
+
45
+ /**
46
+ * DialogPortal - Portal for rendering dialog outside of DOM hierarchy
47
+ * @description Renders dialog content in a React portal
48
+ */
21
49
  function DialogPortal({
22
50
  ...props
23
51
  }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
24
- return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
25
- }
26
-
27
- function DialogClose({
28
- ...props
29
- }: React.ComponentProps<typeof DialogPrimitive.Close>) {
30
- return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
31
- }
32
-
33
- function DialogOverlay({
34
- className,
35
- ...props
36
- }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
37
- return (
38
- <DialogPrimitive.Overlay
39
- className={cn(
40
- "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",
41
- className
42
- )}
43
- data-slot="dialog-overlay"
44
- {...props}
45
- />
46
- );
52
+ return <DialogPrimitive.Portal {...props} />;
47
53
  }
48
-
54
+ DialogPortal.displayName = "DialogPortal";
55
+
56
+ /**
57
+ * DialogClose - Button or element that closes the dialog
58
+ * @description Wraps an element that closes the dialog when clicked
59
+ */
60
+ const DialogClose = React.forwardRef<
61
+ React.ComponentRef<typeof DialogPrimitive.Close>,
62
+ React.ComponentProps<typeof DialogPrimitive.Close>
63
+ >(({ ...props }, ref) => (
64
+ <DialogPrimitive.Close ref={ref} data-slot="dialog-close" {...props} />
65
+ ));
66
+ DialogClose.displayName = "DialogClose";
67
+
68
+ /**
69
+ * DialogOverlay - Semi-transparent backdrop behind the dialog
70
+ * @description Renders a backdrop that dims the page content
71
+ */
72
+ const DialogOverlay = React.forwardRef<
73
+ React.ComponentRef<typeof DialogPrimitive.Overlay>,
74
+ React.ComponentProps<typeof DialogPrimitive.Overlay>
75
+ >(({ className, ...props }, ref) => (
76
+ <DialogPrimitive.Overlay
77
+ ref={ref}
78
+ className={cn(
79
+ "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",
80
+ className
81
+ )}
82
+ data-slot="dialog-overlay"
83
+ {...props}
84
+ />
85
+ ));
86
+ DialogOverlay.displayName = "DialogOverlay";
87
+
88
+ /**
89
+ * Props for DialogContent component
90
+ */
49
91
  interface DialogContentProps extends React.ComponentProps<
50
92
  typeof DialogPrimitive.Content
51
93
  > {
94
+ /**
95
+ * Data hook for automated testing (required)
96
+ */
52
97
  dataHook?: string;
98
+ /**
99
+ * Tracking element identifier for analytics
100
+ */
53
101
  trackingEl?: string;
102
+ /**
103
+ * Tracking label for analytics context
104
+ */
54
105
  trackingLabel?: string;
55
106
  }
56
107
 
108
+ /**
109
+ * DialogContent - The main dialog content container
110
+ * @description Contains the dialog's content including header, body, and footer
111
+ */
57
112
  const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
58
113
  (
59
114
  { className, children, dataHook, trackingEl, trackingLabel, ...props },
60
115
  ref
61
116
  ) => {
62
117
  return (
63
- <DialogPortal data-slot="dialog-portal">
118
+ <DialogPortal>
64
119
  <DialogOverlay />
65
120
  <DialogPrimitive.Content
66
121
  ref={ref}
67
122
  className={cn(
68
- "bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border border-card-border p-8 shadow-lg duration-200 sm:max-w-lg",
123
+ "bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-card-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border p-8 shadow-lg duration-200 sm:max-w-lg",
69
124
  className
70
125
  )}
71
126
  data-hook={dataHook}
@@ -84,57 +139,78 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
84
139
  );
85
140
  }
86
141
  );
87
-
88
142
  DialogContent.displayName = "DialogContent";
89
143
 
90
- function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
91
- return (
92
- <div
93
- className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
94
- data-slot="dialog-header"
95
- {...props}
96
- />
97
- );
98
- }
99
-
100
- function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
101
- return (
102
- <div
103
- className={cn(
104
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
105
- className
106
- )}
107
- data-slot="dialog-footer"
108
- {...props}
109
- />
110
- );
111
- }
112
-
113
- function DialogTitle({
114
- className,
115
- ...props
116
- }: React.ComponentProps<typeof DialogPrimitive.Title>) {
117
- return (
118
- <DialogPrimitive.Title
119
- className={cn("text-lg leading-none font-semibold", className)}
120
- data-slot="dialog-title"
121
- {...props}
122
- />
123
- );
124
- }
125
-
126
- function DialogDescription({
127
- className,
128
- ...props
129
- }: React.ComponentProps<typeof DialogPrimitive.Description>) {
130
- return (
131
- <DialogPrimitive.Description
132
- className={cn("text-muted-foreground text-sm", className)}
133
- data-slot="dialog-description"
134
- {...props}
135
- />
136
- );
137
- }
144
+ /**
145
+ * DialogHeader - Container for dialog title and description
146
+ * @description Groups the title and description at the top of the dialog
147
+ */
148
+ const DialogHeader = React.forwardRef<
149
+ HTMLDivElement,
150
+ React.ComponentProps<"div">
151
+ >(({ className, ...props }, ref) => (
152
+ <div
153
+ ref={ref}
154
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
155
+ data-slot="dialog-header"
156
+ {...props}
157
+ />
158
+ ));
159
+ DialogHeader.displayName = "DialogHeader";
160
+
161
+ /**
162
+ * DialogFooter - Container for dialog action buttons
163
+ * @description Groups action buttons at the bottom of the dialog
164
+ */
165
+ const DialogFooter = React.forwardRef<
166
+ HTMLDivElement,
167
+ React.ComponentProps<"div">
168
+ >(({ className, ...props }, ref) => (
169
+ <div
170
+ ref={ref}
171
+ className={cn(
172
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
173
+ className
174
+ )}
175
+ data-slot="dialog-footer"
176
+ {...props}
177
+ />
178
+ ));
179
+ DialogFooter.displayName = "DialogFooter";
180
+
181
+ /**
182
+ * DialogTitle - The title of the dialog
183
+ * @description Renders an accessible title for the dialog
184
+ */
185
+ const DialogTitle = React.forwardRef<
186
+ React.ComponentRef<typeof DialogPrimitive.Title>,
187
+ React.ComponentProps<typeof DialogPrimitive.Title>
188
+ >(({ className, ...props }, ref) => (
189
+ <DialogPrimitive.Title
190
+ ref={ref}
191
+ className={cn("text-lg leading-none font-semibold", className)}
192
+ data-slot="dialog-title"
193
+ {...props}
194
+ />
195
+ ));
196
+ DialogTitle.displayName = "DialogTitle";
197
+
198
+ /**
199
+ * DialogDescription - The description of the dialog
200
+ * @description Renders an accessible description for the dialog
201
+ */
202
+ const DialogDescription = React.forwardRef<
203
+ React.ComponentRef<typeof DialogPrimitive.Description>,
204
+ React.ComponentProps<typeof DialogPrimitive.Description>
205
+ >(({ className, ...props }, ref) => (
206
+ <DialogPrimitive.Description
207
+ ref={ref}
208
+ className={cn("text-muted-foreground text-sm", className)}
209
+ data-slot="dialog-description"
210
+ {...props}
211
+ />
212
+ ));
213
+ DialogDescription.displayName = "DialogDescription";
138
214
 
139
215
  export {
140
216
  Dialog,
@@ -149,4 +225,4 @@ export {
149
225
  DialogTrigger,
150
226
  };
151
227
 
152
- export type { DialogContentProps };
228
+ export type { DialogContentProps, DialogTriggerProps };
@@ -5,30 +5,57 @@ import { Drawer as DrawerPrimitive } from "vaul";
5
5
 
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
7
 
8
+ /**
9
+ * Props for Drawer component
10
+ */
8
11
  type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root>;
9
12
 
13
+ /**
14
+ * Drawer - Root component for slide-out panels
15
+ * @description A responsive drawer component that slides in from the edge of the screen
16
+ */
10
17
  function Drawer({ ...props }: DrawerProps) {
11
18
  return <DrawerPrimitive.Root data-slot="drawer" {...props} />;
12
19
  }
20
+ Drawer.displayName = "Drawer";
13
21
 
22
+ /**
23
+ * DrawerTrigger - Button or element that opens the drawer
24
+ * @description Wraps an interactive element that toggles the drawer open state
25
+ */
14
26
  function DrawerTrigger({
15
27
  ...props
16
28
  }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
17
29
  return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
18
30
  }
31
+ DrawerTrigger.displayName = "DrawerTrigger";
19
32
 
33
+ /**
34
+ * DrawerPortal - Portal for rendering drawer outside of DOM hierarchy
35
+ * @description Renders drawer content in a React portal
36
+ */
20
37
  function DrawerPortal({
21
38
  ...props
22
39
  }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
23
- return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />;
40
+ return <DrawerPrimitive.Portal {...props} />;
24
41
  }
42
+ DrawerPortal.displayName = "DrawerPortal";
25
43
 
44
+ /**
45
+ * DrawerClose - Button or element that closes the drawer
46
+ * @description Wraps an element that closes the drawer when clicked
47
+ */
26
48
  function DrawerClose({
27
49
  ...props
28
50
  }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
29
51
  return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
30
52
  }
53
+ DrawerClose.displayName = "DrawerClose";
31
54
 
55
+ /**
56
+ * DrawerOverlay - Semi-transparent backdrop behind the drawer
57
+ * @description Renders a backdrop that dims the page content
58
+ */
32
59
  function DrawerOverlay({
33
60
  className,
34
61
  ...props
@@ -44,15 +71,32 @@ function DrawerOverlay({
44
71
  />
45
72
  );
46
73
  }
74
+ DrawerOverlay.displayName = "DrawerOverlay";
47
75
 
76
+ /**
77
+ * Props for DrawerContent component
78
+ */
48
79
  type DrawerContentProps = React.ComponentProps<
49
80
  typeof DrawerPrimitive.Content
50
81
  > & {
82
+ /**
83
+ * Data hook for automated testing (required)
84
+ */
51
85
  dataHook?: string;
86
+ /**
87
+ * Tracking element identifier for analytics
88
+ */
52
89
  trackingEl?: string;
90
+ /**
91
+ * Tracking label for analytics context
92
+ */
53
93
  trackingLabel?: string;
54
94
  };
55
95
 
96
+ /**
97
+ * DrawerContent - The main drawer content container
98
+ * @description Contains the drawer's content including header, body, and footer
99
+ */
56
100
  function DrawerContent({
57
101
  className,
58
102
  children,
@@ -85,7 +129,12 @@ function DrawerContent({
85
129
  </DrawerPortal>
86
130
  );
87
131
  }
132
+ DrawerContent.displayName = "DrawerContent";
88
133
 
134
+ /**
135
+ * DrawerHeader - Container for drawer title and description
136
+ * @description Groups the title and description at the top of the drawer
137
+ */
89
138
  function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
90
139
  return (
91
140
  <div
@@ -98,17 +147,31 @@ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
98
147
  />
99
148
  );
100
149
  }
150
+ DrawerHeader.displayName = "DrawerHeader";
101
151
 
152
+ /**
153
+ * DrawerBody - Main content area of the drawer
154
+ * @description Container for the primary drawer content
155
+ */
102
156
  function DrawerBody({ className, ...props }: React.ComponentProps<"div">) {
103
157
  return (
104
158
  <div
105
- className={cn("mx-auto w-full max-w-sm px-4", className)}
159
+ className={cn(
160
+ "mx-auto w-full max-w-sm px-4",
161
+ "mt-4 group-has-[[data-slot=drawer-header]]/drawer-content:mt-0",
162
+ className
163
+ )}
106
164
  data-slot="drawer-body"
107
165
  {...props}
108
166
  />
109
167
  );
110
168
  }
169
+ DrawerBody.displayName = "DrawerBody";
111
170
 
171
+ /**
172
+ * DrawerFooter - Container for drawer action buttons
173
+ * @description Groups action buttons at the bottom of the drawer
174
+ */
112
175
  function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
113
176
  return (
114
177
  <div
@@ -121,7 +184,12 @@ function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
121
184
  />
122
185
  );
123
186
  }
187
+ DrawerFooter.displayName = "DrawerFooter";
124
188
 
189
+ /**
190
+ * DrawerTitle - The title of the drawer
191
+ * @description Renders an accessible title for the drawer
192
+ */
125
193
  function DrawerTitle({
126
194
  className,
127
195
  ...props
@@ -137,7 +205,12 @@ function DrawerTitle({
137
205
  />
138
206
  );
139
207
  }
208
+ DrawerTitle.displayName = "DrawerTitle";
140
209
 
210
+ /**
211
+ * DrawerDescription - The description of the drawer
212
+ * @description Renders an accessible description for the drawer
213
+ */
141
214
  function DrawerDescription({
142
215
  className,
143
216
  ...props
@@ -150,6 +223,7 @@ function DrawerDescription({
150
223
  />
151
224
  );
152
225
  }
226
+ DrawerDescription.displayName = "DrawerDescription";
153
227
 
154
228
  export {
155
229
  Drawer,