@brightlocal/ui-components 0.1.1 → 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 (244) 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 +209 -202
  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/dist/table.cjs +1 -1
  184. package/dist/table.js +1 -1
  185. package/dist/toggle-group.cjs +1 -1
  186. package/dist/toggle-group.d.ts +3 -1
  187. package/dist/toggle-group.d.ts.map +1 -1
  188. package/dist/toggle-group.js +38 -36
  189. package/package.json +8 -2
  190. package/src/blocks/data-table.tsx +42 -32
  191. package/src/blocks/sidebar.tsx +4 -12
  192. package/src/components/accordion.tsx +163 -77
  193. package/src/components/alert-dialog.tsx +156 -111
  194. package/src/components/alert.tsx +26 -13
  195. package/src/components/aspect-ratio.tsx +25 -16
  196. package/src/components/avatar.tsx +56 -8
  197. package/src/components/badge.tsx +65 -42
  198. package/src/components/breadcrumb.tsx +158 -82
  199. package/src/components/button.tsx +41 -62
  200. package/src/components/calendar.tsx +16 -2
  201. package/src/components/card.tsx +92 -40
  202. package/src/components/carousel.tsx +240 -115
  203. package/src/components/centred-layout.tsx +67 -35
  204. package/src/components/chart.tsx +118 -47
  205. package/src/components/checkbox.tsx +42 -78
  206. package/src/components/collapsible.tsx +95 -26
  207. package/src/components/combobox.tsx +242 -144
  208. package/src/components/command.tsx +295 -121
  209. package/src/components/context-menu.tsx +278 -81
  210. package/src/components/date-picker.tsx +281 -30
  211. package/src/components/description.tsx +60 -0
  212. package/src/components/dialog.tsx +162 -86
  213. package/src/components/drawer.tsx +76 -2
  214. package/src/components/dropdown-menu.tsx +143 -37
  215. package/src/components/field.tsx +36 -11
  216. package/src/components/global-layout.tsx +116 -77
  217. package/src/components/hover-card.tsx +54 -14
  218. package/src/components/input-group.tsx +56 -18
  219. package/src/components/input-password.tsx +3 -4
  220. package/src/components/input.tsx +93 -186
  221. package/src/components/label.tsx +56 -15
  222. package/src/components/logo.tsx +3 -0
  223. package/src/components/menubar.tsx +58 -4
  224. package/src/components/popover.tsx +103 -20
  225. package/src/components/progress.tsx +82 -60
  226. package/src/components/radio-group.tsx +40 -0
  227. package/src/components/rating.tsx +4 -1
  228. package/src/components/resizable.tsx +119 -31
  229. package/src/components/scroll-area.tsx +123 -56
  230. package/src/components/select.tsx +21 -1
  231. package/src/components/separator.tsx +97 -20
  232. package/src/components/sheet.tsx +180 -79
  233. package/src/components/skeleton.tsx +40 -10
  234. package/src/components/slider.tsx +83 -57
  235. package/src/components/sonner.tsx +10 -7
  236. package/src/components/split-layout.tsx +4 -1
  237. package/src/components/table.tsx +1 -1
  238. package/src/components/toggle-group.tsx +4 -0
  239. package/src/index.ts +1 -1
  240. package/dist/input-base.cjs +0 -1
  241. package/dist/input-base.d.ts +0 -28
  242. package/dist/input-base.d.ts.map +0 -1
  243. package/dist/input-base.js +0 -56
  244. package/src/components/input-base.tsx +0 -86
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import * as React from "react";
2
4
  import * as SheetPrimitive from "@radix-ui/react-dialog";
3
5
  import { cva, type VariantProps } from "class-variance-authority";
@@ -83,66 +85,142 @@ const sheetContentVariants = cva(
83
85
  }
84
86
  );
85
87
 
88
+ /**
89
+ * Sheet root component that provides context for the sheet dialog.
90
+ * Wraps the Radix UI Dialog primitive with modal behavior enabled by default.
91
+ */
86
92
  function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
87
93
  return <SheetPrimitive.Root data-slot="sheet" modal={true} {...props} />;
88
94
  }
95
+ Sheet.displayName = "Sheet";
89
96
 
90
- function SheetTrigger({
91
- ...props
92
- }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
93
- return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
97
+ /**
98
+ * Props for SheetTrigger component
99
+ */
100
+ interface SheetTriggerProps extends React.ComponentProps<
101
+ typeof SheetPrimitive.Trigger
102
+ > {
103
+ /**
104
+ * Data hook for automated testing
105
+ */
106
+ dataHook?: string;
94
107
  }
95
108
 
96
- function SheetClose({
97
- ...props
98
- }: React.ComponentProps<typeof SheetPrimitive.Close>) {
99
- return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
100
- }
109
+ /**
110
+ * Sheet trigger button that opens the sheet when clicked.
111
+ * Use with asChild prop to merge with your own button component.
112
+ */
113
+ const SheetTrigger = React.forwardRef<
114
+ React.ComponentRef<typeof SheetPrimitive.Trigger>,
115
+ SheetTriggerProps
116
+ >(({ dataHook, ...props }, ref) => (
117
+ <SheetPrimitive.Trigger
118
+ ref={ref}
119
+ data-hook={dataHook}
120
+ data-slot="sheet-trigger"
121
+ {...props}
122
+ />
123
+ ));
124
+ SheetTrigger.displayName = "SheetTrigger";
101
125
 
126
+ /**
127
+ * Sheet close button that closes the sheet when clicked.
128
+ * Use with asChild prop to merge with your own button component.
129
+ */
130
+ const SheetClose = React.forwardRef<
131
+ React.ComponentRef<typeof SheetPrimitive.Close>,
132
+ React.ComponentProps<typeof SheetPrimitive.Close>
133
+ >(({ ...props }, ref) => (
134
+ <SheetPrimitive.Close ref={ref} data-slot="sheet-close" {...props} />
135
+ ));
136
+ SheetClose.displayName = "SheetClose";
137
+
138
+ /**
139
+ * Sheet portal that renders content in a React portal.
140
+ * Used internally by SheetContent.
141
+ */
102
142
  function SheetPortal({
103
143
  ...props
104
144
  }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
105
145
  return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
106
146
  }
147
+ SheetPortal.displayName = "SheetPortal";
107
148
 
108
- function SheetOverlay({
109
- className,
110
- ...props
111
- }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
112
- return (
113
- <SheetPrimitive.Overlay
114
- className={cn(
115
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
116
- className
117
- )}
118
- data-slot="sheet-overlay"
119
- {...props}
120
- />
121
- );
122
- }
149
+ /**
150
+ * Sheet overlay that appears behind the sheet content.
151
+ * Provides a semi-transparent backdrop with fade animation.
152
+ */
153
+ const SheetOverlay = React.forwardRef<
154
+ React.ComponentRef<typeof SheetPrimitive.Overlay>,
155
+ React.ComponentProps<typeof SheetPrimitive.Overlay>
156
+ >(({ className, ...props }, ref) => (
157
+ <SheetPrimitive.Overlay
158
+ ref={ref}
159
+ className={cn(
160
+ "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",
161
+ className
162
+ )}
163
+ data-slot="sheet-overlay"
164
+ {...props}
165
+ />
166
+ ));
167
+ SheetOverlay.displayName = "SheetOverlay";
123
168
 
169
+ /**
170
+ * Props for the SheetContent component
171
+ */
124
172
  interface SheetContentProps
125
173
  extends
126
174
  React.ComponentProps<typeof SheetPrimitive.Content>,
127
175
  VariantProps<typeof sheetContentVariants> {
128
176
  /**
129
177
  * Side from which the sheet slides in
178
+ * @default "right"
130
179
  */
131
180
  side?: SheetSide;
181
+ /**
182
+ * Data hook for automated testing
183
+ */
184
+ dataHook?: string;
185
+ /**
186
+ * Tracking element identifier for analytics
187
+ */
188
+ trackingEl?: string;
189
+ /**
190
+ * Tracking label for analytics context
191
+ */
192
+ trackingLabel?: string;
132
193
  }
133
194
 
134
- function SheetContent({
135
- className,
136
- children,
137
- side,
138
- ...props
139
- }: SheetContentProps) {
140
- return (
195
+ /**
196
+ * Sheet content container that slides in from the specified side.
197
+ * Includes an overlay backdrop and close button.
198
+ */
199
+ const SheetContent = React.forwardRef<
200
+ React.ComponentRef<typeof SheetPrimitive.Content>,
201
+ SheetContentProps
202
+ >(
203
+ (
204
+ {
205
+ className,
206
+ children,
207
+ side,
208
+ dataHook,
209
+ trackingEl,
210
+ trackingLabel,
211
+ ...props
212
+ },
213
+ ref
214
+ ) => (
141
215
  <SheetPortal>
142
216
  <SheetOverlay />
143
217
  <SheetPrimitive.Content
218
+ ref={ref}
144
219
  className={cn(sheetContentVariants({ side }), className)}
220
+ data-hook={dataHook}
145
221
  data-slot="sheet-content"
222
+ data-tracking-el={trackingEl}
223
+ data-tracking-label={trackingLabel}
146
224
  {...props}
147
225
  >
148
226
  {children}
@@ -152,57 +230,80 @@ function SheetContent({
152
230
  </SheetPrimitive.Close>
153
231
  </SheetPrimitive.Content>
154
232
  </SheetPortal>
155
- );
156
- }
233
+ )
234
+ );
235
+ SheetContent.displayName = "SheetContent";
157
236
 
158
- function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
159
- return (
160
- <div
161
- className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
162
- data-slot="sheet-header"
163
- {...props}
164
- />
165
- );
166
- }
237
+ /**
238
+ * Sheet header section for title and description.
239
+ * Centers text on mobile, left-aligns on larger screens.
240
+ */
241
+ const SheetHeader = React.forwardRef<
242
+ HTMLDivElement,
243
+ React.ComponentProps<"div">
244
+ >(({ className, ...props }, ref) => (
245
+ <div
246
+ ref={ref}
247
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
248
+ data-slot="sheet-header"
249
+ {...props}
250
+ />
251
+ ));
252
+ SheetHeader.displayName = "SheetHeader";
167
253
 
168
- function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
169
- return (
170
- <div
171
- className={cn(
172
- "mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end",
173
- className
174
- )}
175
- data-slot="sheet-footer"
176
- {...props}
177
- />
178
- );
179
- }
254
+ /**
255
+ * Sheet footer section for actions and buttons.
256
+ * Stacks buttons on mobile, aligns to end on larger screens.
257
+ */
258
+ const SheetFooter = React.forwardRef<
259
+ HTMLDivElement,
260
+ React.ComponentProps<"div">
261
+ >(({ className, ...props }, ref) => (
262
+ <div
263
+ ref={ref}
264
+ className={cn(
265
+ "mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end",
266
+ className
267
+ )}
268
+ data-slot="sheet-footer"
269
+ {...props}
270
+ />
271
+ ));
272
+ SheetFooter.displayName = "SheetFooter";
180
273
 
181
- function SheetTitle({
182
- className,
183
- ...props
184
- }: React.ComponentProps<typeof SheetPrimitive.Title>) {
185
- return (
186
- <SheetPrimitive.Title
187
- className={cn("text-foreground text-lg font-semibold", className)}
188
- data-slot="sheet-title"
189
- {...props}
190
- />
191
- );
192
- }
274
+ /**
275
+ * Sheet title component for the main heading.
276
+ * Should be used within SheetHeader.
277
+ */
278
+ const SheetTitle = React.forwardRef<
279
+ React.ComponentRef<typeof SheetPrimitive.Title>,
280
+ React.ComponentProps<typeof SheetPrimitive.Title>
281
+ >(({ className, ...props }, ref) => (
282
+ <SheetPrimitive.Title
283
+ ref={ref}
284
+ className={cn("text-foreground text-lg font-semibold", className)}
285
+ data-slot="sheet-title"
286
+ {...props}
287
+ />
288
+ ));
289
+ SheetTitle.displayName = "SheetTitle";
193
290
 
194
- function SheetDescription({
195
- className,
196
- ...props
197
- }: React.ComponentProps<typeof SheetPrimitive.Description>) {
198
- return (
199
- <SheetPrimitive.Description
200
- className={cn("text-muted-foreground text-sm", className)}
201
- data-slot="sheet-description"
202
- {...props}
203
- />
204
- );
205
- }
291
+ /**
292
+ * Sheet description component for additional context.
293
+ * Should be used within SheetHeader below SheetTitle.
294
+ */
295
+ const SheetDescription = React.forwardRef<
296
+ React.ComponentRef<typeof SheetPrimitive.Description>,
297
+ React.ComponentProps<typeof SheetPrimitive.Description>
298
+ >(({ className, ...props }, ref) => (
299
+ <SheetPrimitive.Description
300
+ ref={ref}
301
+ className={cn("text-muted-foreground text-sm", className)}
302
+ data-slot="sheet-description"
303
+ {...props}
304
+ />
305
+ ));
306
+ SheetDescription.displayName = "SheetDescription";
206
307
 
207
308
  export {
208
309
  Sheet,
@@ -217,4 +318,4 @@ export {
217
318
  SheetTrigger,
218
319
  };
219
320
 
220
- export type { SheetContentProps };
321
+ export type { SheetContentProps, SheetTriggerProps };
@@ -1,17 +1,47 @@
1
- import { cn } from "@brightlocal/ui-components/lib/utils";
1
+ import * as React from "react";
2
2
 
3
- type SkeletonProps = React.ComponentProps<"div">;
3
+ import { cn } from "@brightlocal/ui-components/lib/utils";
4
4
 
5
- function Skeleton({ className, ...props }: SkeletonProps) {
6
- return (
7
- <div
8
- className={cn("bg-accent animate-pulse rounded-md", className)}
9
- data-slot="skeleton"
10
- {...props}
11
- />
12
- );
5
+ /**
6
+ * Props for the Skeleton component
7
+ */
8
+ interface SkeletonProps extends React.ComponentProps<"div"> {
9
+ /**
10
+ * Data hook for automated testing (optional for Skeleton as it's purely presentational)
11
+ */
12
+ dataHook?: string;
13
+ /**
14
+ * Tracking element identifier for analytics
15
+ */
16
+ trackingEl?: string;
17
+ /**
18
+ * Tracking label for analytics context
19
+ */
20
+ trackingLabel?: string;
13
21
  }
14
22
 
23
+ /**
24
+ * Skeleton component for loading placeholder states.
25
+ * Displays a pulsing animation to indicate content is loading.
26
+ * Use to represent text, images, avatars, or any other content while data is being fetched.
27
+ */
28
+ const Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(
29
+ ({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => {
30
+ return (
31
+ <div
32
+ ref={ref}
33
+ className={cn("bg-accent animate-pulse rounded-md", className)}
34
+ data-hook={dataHook}
35
+ data-slot="skeleton"
36
+ data-tracking-el={trackingEl}
37
+ data-tracking-label={trackingLabel}
38
+ {...props}
39
+ />
40
+ );
41
+ }
42
+ );
43
+ Skeleton.displayName = "Skeleton";
44
+
15
45
  export { Skeleton };
16
46
 
17
47
  export type { SkeletonProps };
@@ -5,82 +5,108 @@ import * as SliderPrimitive from "@radix-ui/react-slider";
5
5
 
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
7
 
8
+ /**
9
+ * Props for the Slider component
10
+ */
8
11
  export interface SliderProps extends React.ComponentProps<
9
12
  typeof SliderPrimitive.Root
10
13
  > {
11
14
  /**
12
- * Required data-hook attribute for testing and analytics
15
+ * Data hook for automated testing (required)
13
16
  */
14
17
  dataHook: string;
15
18
  /**
16
- * Optional analytics element identifier
19
+ * Accessible labels for the slider thumb(s).
20
+ * For range sliders with multiple thumbs, provide an array of labels.
21
+ * @default ["Slider"]
22
+ */
23
+ thumbLabels?: string[];
24
+ /**
25
+ * Tracking element identifier for analytics
17
26
  */
18
27
  trackingEl?: string;
19
28
  /**
20
- * Optional analytics label context
29
+ * Tracking label for analytics context
21
30
  */
22
31
  trackingLabel?: string;
23
32
  }
24
33
 
25
- function Slider({
26
- className,
27
- dataHook,
28
- defaultValue,
29
- max = 100,
30
- min = 0,
31
- trackingEl,
32
- trackingLabel,
33
- value,
34
- ...props
35
- }: SliderProps) {
36
- const _values = React.useMemo(
37
- () =>
38
- Array.isArray(value)
39
- ? value
40
- : Array.isArray(defaultValue)
41
- ? defaultValue
42
- : [min, max],
43
- [value, defaultValue, min, max]
44
- );
34
+ /**
35
+ * Slider component for selecting numeric values within a range.
36
+ * Supports single value selection and range selection (two thumbs).
37
+ * Built on Radix UI Slider primitive with full keyboard accessibility.
38
+ */
39
+ const Slider = React.forwardRef<
40
+ React.ComponentRef<typeof SliderPrimitive.Root>,
41
+ SliderProps
42
+ >(
43
+ (
44
+ {
45
+ className,
46
+ dataHook,
47
+ defaultValue,
48
+ max = 100,
49
+ min = 0,
50
+ thumbLabels,
51
+ trackingEl,
52
+ trackingLabel,
53
+ value,
54
+ ...props
55
+ },
56
+ ref
57
+ ) => {
58
+ const _values = React.useMemo(
59
+ () =>
60
+ Array.isArray(value)
61
+ ? value
62
+ : Array.isArray(defaultValue)
63
+ ? defaultValue
64
+ : [min, max],
65
+ [value, defaultValue, min, max]
66
+ );
45
67
 
46
- return (
47
- <SliderPrimitive.Root
48
- className={cn(
49
- "relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
50
- className
51
- )}
52
- data-hook={dataHook}
53
- data-slot="slider"
54
- data-tracking-el={trackingEl}
55
- data-tracking-label={trackingLabel}
56
- defaultValue={defaultValue}
57
- max={max}
58
- min={min}
59
- value={value}
60
- {...props}
61
- >
62
- <SliderPrimitive.Track
68
+ return (
69
+ <SliderPrimitive.Root
70
+ ref={ref}
63
71
  className={cn(
64
- "bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
72
+ "relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
73
+ className
65
74
  )}
66
- data-slot="slider-track"
75
+ data-hook={dataHook}
76
+ data-slot="slider"
77
+ data-tracking-el={trackingEl}
78
+ data-tracking-label={trackingLabel}
79
+ defaultValue={defaultValue}
80
+ max={max}
81
+ min={min}
82
+ value={value}
83
+ {...props}
67
84
  >
68
- <SliderPrimitive.Range
85
+ <SliderPrimitive.Track
69
86
  className={cn(
70
- "bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
87
+ "bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
71
88
  )}
72
- data-slot="slider-range"
73
- />
74
- </SliderPrimitive.Track>
75
- {Array.from({ length: _values.length }, (_, index) => (
76
- <SliderPrimitive.Thumb
77
- key={index}
78
- className="border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
79
- data-slot="slider-thumb"
80
- />
81
- ))}
82
- </SliderPrimitive.Root>
83
- );
84
- }
89
+ data-slot="slider-track"
90
+ >
91
+ <SliderPrimitive.Range
92
+ className={cn(
93
+ "bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
94
+ )}
95
+ data-slot="slider-range"
96
+ />
97
+ </SliderPrimitive.Track>
98
+ {Array.from({ length: _values.length }, (_, index) => (
99
+ <SliderPrimitive.Thumb
100
+ key={index}
101
+ aria-label={thumbLabels?.[index] ?? "Slider"}
102
+ className="border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
103
+ data-slot="slider-thumb"
104
+ />
105
+ ))}
106
+ </SliderPrimitive.Root>
107
+ );
108
+ }
109
+ );
110
+ Slider.displayName = "Slider";
85
111
 
86
112
  export { Slider };
@@ -10,11 +10,7 @@ import {
10
10
  import { cva } from "class-variance-authority";
11
11
  import { toast as sonnerToast, Toaster as SonnerToaster } from "sonner";
12
12
 
13
- import {
14
- Button,
15
- ButtonVariant,
16
- ButtonSize,
17
- } from "@brightlocal/ui-components/button";
13
+ import { Button } from "@brightlocal/ui-components/button";
18
14
  import { cn } from "@brightlocal/ui-components/lib/utils";
19
15
 
20
16
  /**
@@ -36,7 +32,13 @@ type ToastProps = {
36
32
  /** Click handler for the button */
37
33
  onClick?: () => void;
38
34
  /** Visual variant of the button */
39
- variant?: ButtonVariant;
35
+ variant?:
36
+ | "default"
37
+ | "destructive"
38
+ | "outline"
39
+ | "secondary"
40
+ | "ghost"
41
+ | "warning";
40
42
  };
41
43
  /** Color theme for the toast */
42
44
  colorSchema?: SonnerColorSchema;
@@ -243,7 +245,7 @@ function Toast(props: ToastProps) {
243
245
  aria-label={button.label}
244
246
  className="min-h-6 px-2 py-0 text-xs leading-normal font-medium"
245
247
  dataHook="toast-action"
246
- size={ButtonSize.DEFAULT}
248
+ size="default"
247
249
  variant={button.variant}
248
250
  onClick={button.onClick}
249
251
  >
@@ -324,6 +326,7 @@ function Toast(props: ToastProps) {
324
326
  function Sonner() {
325
327
  return <SonnerToaster position="top-right" />;
326
328
  }
329
+ Sonner.displayName = "Sonner";
327
330
 
328
331
  /**
329
332
  * @module Sonner
@@ -120,7 +120,10 @@ const SplitLayout = React.forwardRef<HTMLDivElement, SplitLayoutProps>(
120
120
  SplitLayout.displayName = "SplitLayout";
121
121
 
122
122
  interface SplitLayoutSectionProps extends React.ComponentProps<"div"> {
123
- /** Which side this section appears on */
123
+ /**
124
+ * Which side this section appears on: "left" | "right"
125
+ * @default "left"
126
+ */
124
127
  side?: "left" | "right";
125
128
  }
126
129
 
@@ -37,7 +37,7 @@ const tableCellVariants = cva(
37
37
  );
38
38
 
39
39
  const tableHeadVariants = cva(
40
- "h-10 p-2 border-b align-middle text-muted-foreground text-sm font-medium leading-normal hover:bg-muted/50 break-words",
40
+ "h-10 p-2 border-b align-middle text-muted-foreground text-sm font-medium leading-normal hover:bg-muted break-words",
41
41
  {
42
42
  variants: {
43
43
  align: {
@@ -66,6 +66,8 @@ type ToggleGroupItemProps = {
66
66
  trackingEl?: string;
67
67
  /** Tracking label for analytics context */
68
68
  trackingLabel?: string;
69
+ /** ARIA label for accessibility (required when no text content) */
70
+ ariaLabel?: string;
69
71
  } & React.ComponentProps<typeof ToggleGroupPrimitive.Item> &
70
72
  VariantProps<typeof toggleVariants>;
71
73
 
@@ -77,12 +79,14 @@ function ToggleGroupItem({
77
79
  dataHook,
78
80
  trackingEl,
79
81
  trackingLabel,
82
+ ariaLabel,
80
83
  ...props
81
84
  }: ToggleGroupItemProps) {
82
85
  const context = React.useContext(ToggleGroupContext);
83
86
 
84
87
  return (
85
88
  <ToggleGroupPrimitive.Item
89
+ aria-label={ariaLabel}
86
90
  className={cn(
87
91
  toggleVariants({
88
92
  variant: context.variant || variant,
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ export * from "./components/combobox";
18
18
  export * from "./components/command";
19
19
  export * from "./components/date-picker";
20
20
  export * from "./components/context-menu";
21
+ export * from "./components/description";
21
22
  export * from "./components/dialog";
22
23
  export * from "./components/drawer";
23
24
  export * from "./components/dropdown-menu";
@@ -25,7 +26,6 @@ export * from "./components/field";
25
26
  export * from "./components/global-layout";
26
27
  export * from "./components/hover-card";
27
28
  export * from "./components/input";
28
- export * from "./components/input-base";
29
29
  export * from "./components/input-group";
30
30
  export * from "./components/input-otp";
31
31
  export * from "./components/label";
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),i=require("react"),u=require("class-variance-authority"),c=require("@brightlocal/ui-components/lib/utils");function d(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const f=d(i),r=u.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-all","text-sm font-sans","text-foreground","overflow-hidden text-ellipsis","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground","placeholder:overflow-hidden placeholder:text-ellipsis","items-center px-3 pb-[1px] leading-5"],{variants:{hasIcon:{true:"pl-9",false:""},hasSecondaryIcon:{true:"pr-9",false:""}},defaultVariants:{hasIcon:!1,hasSecondaryIcon:!1}}),o=f.forwardRef(({className:e,hasIcon:n=!1,hasSecondaryIcon:t=!1,...a},s)=>l.jsx("input",{ref:s,className:c.cn(r({hasIcon:n,hasSecondaryIcon:t}),e),"data-slot":"input",...a}));o.displayName="BaseInputElement";exports.BaseInputElement=o;exports.inputVariants=r;