@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
@@ -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 };
@@ -6,15 +6,11 @@ import {
6
6
  Info,
7
7
  Loader2,
8
8
  XCircle,
9
- } from "lucide-react";
9
+ } from "@brightlocal/icons";
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;
@@ -44,20 +46,17 @@ type ToastProps = {
44
46
  icon?: ToastIconType | null;
45
47
  };
46
48
 
47
- export enum SonnerIcon {
48
- INFO = "info",
49
- SUCCESS = "success",
50
- WARNING = "warning",
51
- ERROR = "error",
52
- LOADING = "loading",
53
- }
49
+ /**
50
+ * Icon type variants for toast notifications
51
+ */
52
+ export type SonnerIcon = "info" | "success" | "warning" | "error" | "loading";
54
53
 
55
54
  export type ToastIconType = SonnerIcon | null;
56
55
 
57
- export enum SonnerColorSchema {
58
- DEFAULT = "default",
59
- SUCCESS = "success",
60
- }
56
+ /**
57
+ * Color schema variants for toast notifications
58
+ */
59
+ export type SonnerColorSchema = "default" | "success";
61
60
 
62
61
  type SonnerCustomOptions = {
63
62
  className?: string;
@@ -144,19 +143,19 @@ const ICON_VARIANTS = cva("size-5", {
144
143
  */
145
144
  function renderToastIcon(type: ToastIconType, schema: "default" | "success") {
146
145
  switch (type) {
147
- case SonnerIcon.INFO:
146
+ case "info":
148
147
  return <Info className={cn(ICON_VARIANTS({ colorSchema: schema }))} />;
149
- case SonnerIcon.SUCCESS:
148
+ case "success":
150
149
  return (
151
150
  <CheckCircle2 className={cn(ICON_VARIANTS({ colorSchema: schema }))} />
152
151
  );
153
- case SonnerIcon.WARNING:
152
+ case "warning":
154
153
  return (
155
154
  <AlertTriangle className={cn(ICON_VARIANTS({ colorSchema: schema }))} />
156
155
  );
157
- case SonnerIcon.ERROR:
156
+ case "error":
158
157
  return <XCircle className={cn(ICON_VARIANTS({ colorSchema: schema }))} />;
159
- case SonnerIcon.LOADING:
158
+ case "loading":
160
159
  return (
161
160
  <Loader2
162
161
  className={cn(ICON_VARIANTS({ colorSchema: schema }), "animate-spin")}
@@ -215,7 +214,7 @@ function Toast(props: ToastProps) {
215
214
  const { button, description, icon, title, colorSchema } = props;
216
215
 
217
216
  const resolveSchema = (schema?: SonnerColorSchema): "default" | "success" =>
218
- schema === SonnerColorSchema.SUCCESS ? "success" : "default";
217
+ schema === "success" ? "success" : "default";
219
218
 
220
219
  const schema = resolveSchema(colorSchema);
221
220
 
@@ -243,7 +242,7 @@ function Toast(props: ToastProps) {
243
242
  aria-label={button.label}
244
243
  className="min-h-6 px-2 py-0 text-xs leading-normal font-medium"
245
244
  dataHook="toast-action"
246
- size={ButtonSize.DEFAULT}
245
+ size="default"
247
246
  variant={button.variant}
248
247
  onClick={button.onClick}
249
248
  >
@@ -308,13 +307,13 @@ function Toast(props: ToastProps) {
308
307
  *
309
308
  * @example
310
309
  * // Then use sonner() anywhere in your app
311
- * import { sonner, SonnerIcon } from '@brightlocal/ui-components/sonner';
310
+ * import { sonner } from '@brightlocal/ui-components/sonner';
312
311
  *
313
312
  * function MyComponent() {
314
313
  * const handleClick = () => {
315
314
  * sonner({
316
315
  * title: "Success!",
317
- * icon: SonnerIcon.SUCCESS
316
+ * icon: "success"
318
317
  * });
319
318
  * };
320
319
  *
@@ -324,6 +323,7 @@ function Toast(props: ToastProps) {
324
323
  function Sonner() {
325
324
  return <SonnerToaster position="top-right" />;
326
325
  }
326
+ Sonner.displayName = "Sonner";
327
327
 
328
328
  /**
329
329
  * @module Sonner
@@ -345,7 +345,7 @@ function Sonner() {
345
345
  * <Sonner />
346
346
  *
347
347
  * // 2. Show toasts anywhere in your app
348
- * import { sonner, SonnerIcon, SonnerColorSchema } from '@brightlocal/ui-components/sonner';
348
+ * import { sonner } from '@brightlocal/ui-components/sonner';
349
349
  *
350
350
  * // Simple toast
351
351
  * sonner({ title: "Hello world" });
@@ -354,8 +354,8 @@ function Sonner() {
354
354
  * sonner({
355
355
  * title: "Changes saved",
356
356
  * description: "Your changes have been saved successfully.",
357
- * icon: SonnerIcon.SUCCESS,
358
- * colorSchema: SonnerColorSchema.SUCCESS,
357
+ * icon: "success",
358
+ * colorSchema: "success",
359
359
  * button: {
360
360
  * label: "Undo",
361
361
  * onClick: () => undoChanges()
@@ -370,7 +370,7 @@ function Sonner() {
370
370
  * sonner({
371
371
  * title: "Uploading...",
372
372
  * description: "Please wait while we upload your file.",
373
- * icon: SonnerIcon.LOADING,
373
+ * icon: "loading",
374
374
  * id: loadingToastId
375
375
  * });
376
376
  *
@@ -380,15 +380,15 @@ function Sonner() {
380
380
  * toast.dismiss(loadingToastId);
381
381
  * sonner({
382
382
  * title: "Upload complete!",
383
- * icon: SonnerIcon.SUCCESS,
384
- * colorSchema: SonnerColorSchema.SUCCESS
383
+ * icon: "success",
384
+ * colorSchema: "success"
385
385
  * });
386
386
  * } catch (error) {
387
387
  * toast.dismiss(loadingToastId);
388
388
  * sonner({
389
389
  * title: "Upload failed",
390
390
  * description: error.message,
391
- * icon: SonnerIcon.ERROR
391
+ * icon: "error"
392
392
  * });
393
393
  * }
394
394
  * ```
@@ -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
 
@@ -1,10 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { figma } from "@figma/code-connect";
3
- import {
4
- Switch,
5
- SwitchVariant,
6
- SwitchSide,
7
- } from "@brightlocal/ui-components/switch";
3
+ import { Switch } from "@brightlocal/ui-components/switch";
8
4
 
9
5
  /**
10
6
  * Figma Code Connect mapping for Switch component
@@ -32,8 +28,8 @@ figma.connect(
32
28
  dataHook="switch-default"
33
29
  id="switch"
34
30
  label="Switch Text"
35
- side={SwitchSide.RIGHT}
36
- variant={SwitchVariant.DEFAULT}
31
+ side="right"
32
+ variant="default"
37
33
  />
38
34
  ),
39
35
  }
@@ -57,8 +53,8 @@ figma.connect(
57
53
  dataHook="switch-default-left"
58
54
  id="switch-left"
59
55
  label="Switch Text"
60
- side={SwitchSide.LEFT}
61
- variant={SwitchVariant.DEFAULT}
56
+ side="left"
57
+ variant="default"
62
58
  />
63
59
  ),
64
60
  }
@@ -83,7 +79,7 @@ figma.connect(
83
79
  description="This is a switch description."
84
80
  id="switch-box"
85
81
  label="Switch Text"
86
- variant={SwitchVariant.BOX}
82
+ variant="box"
87
83
  />
88
84
  ),
89
85
  }
@@ -108,7 +104,7 @@ figma.connect(
108
104
  description="This is a switch description."
109
105
  id="switch-box-right"
110
106
  label="Switch Text"
111
- variant={SwitchVariant.BOX}
107
+ variant="box"
112
108
  />
113
109
  ),
114
110
  }
@@ -9,22 +9,12 @@ import { cn } from "@brightlocal/ui-components/lib/utils";
9
9
  /**
10
10
  * Visual style variants for Switch component
11
11
  */
12
- export enum SwitchVariant {
13
- /** Default variant with inline switch and side label */
14
- DEFAULT = "default",
15
- /** Box variant with bordered container, label, and description */
16
- BOX = "box",
17
- }
12
+ export type SwitchVariant = "default" | "box";
18
13
 
19
14
  /**
20
15
  * Label position for switch (used in Default variant)
21
16
  */
22
- export enum SwitchSide {
23
- /** Label positioned on the left side */
24
- LEFT = "left",
25
- /** Label positioned on the right side */
26
- RIGHT = "right",
27
- }
17
+ export type SwitchSide = "left" | "right";
28
18
 
29
19
  const switchVariants = cva(
30
20
  [
@@ -41,7 +31,7 @@ const switchVariants = cva(
41
31
  },
42
32
  },
43
33
  defaultVariants: {
44
- variant: SwitchVariant.DEFAULT,
34
+ variant: "default",
45
35
  },
46
36
  }
47
37
  );
@@ -73,13 +63,13 @@ const Switch = React.forwardRef<
73
63
  (
74
64
  {
75
65
  className,
76
- variant = SwitchVariant.DEFAULT,
66
+ variant = "default",
77
67
  dataHook,
78
68
  trackingEl,
79
69
  trackingLabel,
80
70
  label,
81
71
  description,
82
- side = SwitchSide.RIGHT,
72
+ side = "right",
83
73
  ...props
84
74
  },
85
75
  ref
@@ -106,12 +96,12 @@ const Switch = React.forwardRef<
106
96
  );
107
97
 
108
98
  // Default variant: inline switch with side label
109
- if (variant === SwitchVariant.DEFAULT) {
99
+ if (variant === "default") {
110
100
  return (
111
101
  <div
112
102
  className={cn(
113
103
  "flex items-center gap-2",
114
- side === SwitchSide.LEFT && "flex-row-reverse"
104
+ side === "left" && "flex-row-reverse"
115
105
  )}
116
106
  >
117
107
  {switchElement}
@@ -128,7 +118,7 @@ const Switch = React.forwardRef<
128
118
  }
129
119
 
130
120
  // Box variant: switch in bordered container with label and description
131
- if (variant === SwitchVariant.BOX) {
121
+ if (variant === "box") {
132
122
  const textContent = (
133
123
  <div className="flex flex-col gap-2">
134
124
  {label && (
@@ -149,7 +139,7 @@ const Switch = React.forwardRef<
149
139
 
150
140
  return (
151
141
  <div className="border-border flex items-center justify-between gap-4 rounded-lg border p-4">
152
- {side === SwitchSide.LEFT ? (
142
+ {side === "left" ? (
153
143
  <>
154
144
  {switchElement}
155
145
  {textContent}
@@ -1,28 +1,18 @@
1
+ "use client";
2
+
1
3
  import * as React from "react";
2
4
  import { cva, type VariantProps } from "class-variance-authority";
3
5
 
4
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
5
7
 
6
- /**
7
- * Table size variants
8
- */
9
- export enum TableSize {
10
- /** Default size - compact padding */
11
- DEFAULT = "default",
12
- /** Medium size - moderate padding */
13
- MD = "md",
14
- /** Large size - spacious padding */
15
- LG = "lg",
16
- }
17
-
18
8
  const tableCellVariants = cva(
19
9
  "align-middle bg-transparent text-foreground text-sm font-normal leading-normal break-words",
20
10
  {
21
11
  variants: {
22
12
  size: {
23
- [TableSize.DEFAULT]: "h-12 p-2",
24
- [TableSize.MD]: "h-16 p-2",
25
- [TableSize.LG]: "h-24 p-2",
13
+ default: "h-12 p-2",
14
+ md: "h-16 p-2",
15
+ lg: "h-24 p-2",
26
16
  },
27
17
  align: {
28
18
  left: "text-left",
@@ -30,14 +20,14 @@ const tableCellVariants = cva(
30
20
  },
31
21
  },
32
22
  defaultVariants: {
33
- size: TableSize.DEFAULT,
23
+ size: "default",
34
24
  align: "left",
35
25
  },
36
26
  }
37
27
  );
38
28
 
39
29
  const tableHeadVariants = cva(
40
- "h-10 p-2 border-b align-middle text-muted-foreground text-sm font-medium leading-normal hover:bg-muted break-words",
30
+ "h-10 p-2 border-b align-middle text-muted-foreground text-sm font-medium leading-normal hover:bg-muted break-words outline-none focus-visible:shadow-default transition-[background-color,box-shadow] duration-150 ease-in-out",
41
31
  {
42
32
  variants: {
43
33
  align: {
@@ -162,7 +152,7 @@ const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(
162
152
  <tr
163
153
  ref={ref}
164
154
  className={cn(
165
- "data-[state=selected]:bg-muted border-b transition-colors",
155
+ "data-[state=selected]:bg-muted border-b transition-colors duration-150 ease-in-out",
166
156
  className
167
157
  )}
168
158
  data-hook={dataHook}
@@ -186,6 +176,11 @@ interface TableHeadProps
186
176
  * Minimum width for the column (e.g., "100px", "8rem")
187
177
  */
188
178
  minWidth?: string;
179
+ /**
180
+ * Text alignment for the header cell
181
+ * @default "left"
182
+ */
183
+ align?: "left" | "right";
189
184
  }
190
185
 
191
186
  const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(
@@ -215,6 +210,16 @@ interface TableCellProps
215
210
  * Minimum width for the cell (e.g., "100px", "8rem")
216
211
  */
217
212
  minWidth?: string;
213
+ /**
214
+ * Size variant for cell height/padding
215
+ * @default "default"
216
+ */
217
+ size?: "default" | "md" | "lg";
218
+ /**
219
+ * Text alignment for the cell
220
+ * @default "left"
221
+ */
222
+ align?: "left" | "right";
218
223
  }
219
224
 
220
225
  const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(
@@ -5,9 +5,15 @@ import * as TabsPrimitive from "@radix-ui/react-tabs";
5
5
 
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
7
 
8
+ /**
9
+ * Props for the Tabs component
10
+ */
8
11
  interface TabsProps extends React.ComponentProps<typeof TabsPrimitive.Root> {
12
+ /** Data hook for automated testing (required) */
9
13
  dataHook: string;
14
+ /** Tracking element identifier for analytics */
10
15
  trackingEl?: string;
16
+ /** Tracking label for analytics context */
11
17
  trackingLabel?: string;
12
18
  }
13
19
 
@@ -28,11 +34,17 @@ const Tabs = React.forwardRef<
28
34
 
29
35
  Tabs.displayName = "Tabs";
30
36
 
37
+ /**
38
+ * Props for the TabsList component
39
+ */
31
40
  interface TabsListProps extends React.ComponentProps<
32
41
  typeof TabsPrimitive.List
33
42
  > {
34
- dataHook: string;
43
+ /** Data hook for automated testing */
44
+ dataHook?: string;
45
+ /** Tracking element identifier for analytics */
35
46
  trackingEl?: string;
47
+ /** Tracking label for analytics context */
36
48
  trackingLabel?: string;
37
49
  }
38
50
 
@@ -61,11 +73,17 @@ const TabsList = React.forwardRef<
61
73
 
62
74
  TabsList.displayName = "TabsList";
63
75
 
76
+ /**
77
+ * Props for the TabsTrigger component
78
+ */
64
79
  interface TabsTriggerProps extends React.ComponentProps<
65
80
  typeof TabsPrimitive.Trigger
66
81
  > {
67
- dataHook: string;
82
+ /** Data hook for automated testing */
83
+ dataHook?: string;
84
+ /** Tracking element identifier for analytics */
68
85
  trackingEl?: string;
86
+ /** Tracking label for analytics context */
69
87
  trackingLabel?: string;
70
88
  }
71
89
 
@@ -112,11 +130,17 @@ const TabsTrigger = React.forwardRef<
112
130
 
113
131
  TabsTrigger.displayName = "TabsTrigger";
114
132
 
133
+ /**
134
+ * Props for the TabsContent component
135
+ */
115
136
  interface TabsContentProps extends React.ComponentProps<
116
137
  typeof TabsPrimitive.Content
117
138
  > {
118
- dataHook: string;
139
+ /** Data hook for automated testing */
140
+ dataHook?: string;
141
+ /** Tracking element identifier for analytics */
119
142
  trackingEl?: string;
143
+ /** Tracking label for analytics context */
120
144
  trackingLabel?: string;
121
145
  }
122
146