@brightlocal/ui-components 0.1.3 → 0.2.0

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 (166) hide show
  1. package/README.md +2 -1
  2. package/dist/accordion.cjs +1 -1
  3. package/dist/accordion.js +1 -1
  4. package/dist/alert.cjs +1 -1
  5. package/dist/alert.js +1 -1
  6. package/dist/blocks/data-table.cjs +1 -1
  7. package/dist/blocks/data-table.js +1 -1
  8. package/dist/blocks/sidebar.cjs +1 -1
  9. package/dist/blocks/sidebar.d.ts +37 -306
  10. package/dist/blocks/sidebar.d.ts.map +1 -1
  11. package/dist/blocks/sidebar.js +392 -489
  12. package/dist/breadcrumb.cjs +1 -1
  13. package/dist/breadcrumb.js +1 -1
  14. package/dist/button.cjs +1 -1
  15. package/dist/button.js +1 -1
  16. package/dist/calendar.cjs +1 -1
  17. package/dist/calendar.d.ts +4 -1
  18. package/dist/calendar.d.ts.map +1 -1
  19. package/dist/calendar.js +33 -33
  20. package/dist/centred-layout.cjs +1 -1
  21. package/dist/centred-layout.d.ts +5 -18
  22. package/dist/centred-layout.d.ts.map +1 -1
  23. package/dist/centred-layout.js +21 -23
  24. package/dist/checkbox.cjs +1 -1
  25. package/dist/checkbox.d.ts.map +1 -1
  26. package/dist/checkbox.js +19 -19
  27. package/dist/combobox.cjs +1 -1
  28. package/dist/combobox.d.ts +75 -67
  29. package/dist/combobox.d.ts.map +1 -1
  30. package/dist/combobox.js +241 -194
  31. package/dist/command.cjs +1 -1
  32. package/dist/command.js +1 -1
  33. package/dist/context-menu.cjs +1 -1
  34. package/dist/context-menu.js +1 -1
  35. package/dist/date-picker.cjs +1 -1
  36. package/dist/date-picker.js +1 -1
  37. package/dist/dialog.cjs +1 -1
  38. package/dist/dialog.js +1 -1
  39. package/dist/dropdown-menu.cjs +1 -1
  40. package/dist/dropdown-menu.js +1 -1
  41. package/dist/field.cjs +1 -1
  42. package/dist/field.d.ts +3 -0
  43. package/dist/field.d.ts.map +1 -1
  44. package/dist/field.js +5 -4
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.js +361 -366
  47. package/dist/input-group.cjs +1 -1
  48. package/dist/input-group.d.ts +5 -0
  49. package/dist/input-group.d.ts.map +1 -1
  50. package/dist/input-group.js +47 -39
  51. package/dist/input-otp.cjs +1 -1
  52. package/dist/input-otp.d.ts +6 -0
  53. package/dist/input-otp.d.ts.map +1 -1
  54. package/dist/input-otp.js +79 -76
  55. package/dist/input-password.cjs +1 -1
  56. package/dist/input-password.d.ts +4 -0
  57. package/dist/input-password.d.ts.map +1 -1
  58. package/dist/input-password.js +32 -31
  59. package/dist/input.cjs +1 -1
  60. package/dist/input.d.ts +4 -0
  61. package/dist/input.d.ts.map +1 -1
  62. package/dist/input.js +26 -24
  63. package/dist/link.cjs +1 -1
  64. package/dist/link.js +1 -1
  65. package/dist/logo.cjs +1 -1
  66. package/dist/logo.d.ts +6 -4
  67. package/dist/logo.d.ts.map +1 -1
  68. package/dist/logo.js +17 -20
  69. package/dist/menubar.cjs +1 -1
  70. package/dist/menubar.d.ts +3 -0
  71. package/dist/menubar.d.ts.map +1 -1
  72. package/dist/menubar.js +31 -30
  73. package/dist/navigation-menu.cjs +1 -1
  74. package/dist/navigation-menu.d.ts +6 -54
  75. package/dist/navigation-menu.d.ts.map +1 -1
  76. package/dist/navigation-menu.js +73 -84
  77. package/dist/pagination.cjs +1 -1
  78. package/dist/pagination.d.ts +8 -10
  79. package/dist/pagination.d.ts.map +1 -1
  80. package/dist/pagination.js +78 -86
  81. package/dist/radio-group.cjs +1 -1
  82. package/dist/radio-group.d.ts +10 -23
  83. package/dist/radio-group.d.ts.map +1 -1
  84. package/dist/radio-group.js +47 -55
  85. package/dist/resizable.cjs +1 -1
  86. package/dist/resizable.d.ts +19 -28
  87. package/dist/resizable.d.ts.map +1 -1
  88. package/dist/resizable.js +24 -40
  89. package/dist/select.cjs +1 -1
  90. package/dist/select.d.ts +3 -1
  91. package/dist/select.d.ts.map +1 -1
  92. package/dist/select.js +57 -56
  93. package/dist/separator.cjs +1 -1
  94. package/dist/separator.d.ts +4 -4
  95. package/dist/separator.d.ts.map +1 -1
  96. package/dist/separator.js +19 -21
  97. package/dist/sheet.cjs +1 -1
  98. package/dist/sheet.d.ts +5 -10
  99. package/dist/sheet.d.ts.map +1 -1
  100. package/dist/sheet.js +24 -26
  101. package/dist/sonner.cjs +1 -1
  102. package/dist/sonner.d.ts +17 -20
  103. package/dist/sonner.d.ts.map +1 -1
  104. package/dist/sonner.js +42 -45
  105. package/dist/switch.cjs +1 -1
  106. package/dist/switch.d.ts +2 -12
  107. package/dist/switch.d.ts.map +1 -1
  108. package/dist/switch.js +37 -41
  109. package/dist/table.cjs +1 -1
  110. package/dist/table.d.ts +16 -12
  111. package/dist/table.d.ts.map +1 -1
  112. package/dist/table.js +56 -58
  113. package/dist/tabs.d.ts +27 -3
  114. package/dist/tabs.d.ts.map +1 -1
  115. package/dist/textarea.cjs +1 -1
  116. package/dist/textarea.d.ts +4 -0
  117. package/dist/textarea.d.ts.map +1 -1
  118. package/dist/textarea.js +19 -18
  119. package/dist/toggle-group.cjs +1 -1
  120. package/dist/toggle-group.d.ts +57 -7
  121. package/dist/toggle-group.d.ts.map +1 -1
  122. package/dist/toggle-group.js +60 -67
  123. package/dist/toggle.cjs +1 -1
  124. package/dist/toggle.d.ts +12 -26
  125. package/dist/toggle.d.ts.map +1 -1
  126. package/dist/toggle.js +18 -22
  127. package/package.json +2 -2
  128. package/src/blocks/data-table.tsx +1 -1
  129. package/src/blocks/sidebar.tsx +157 -532
  130. package/src/components/accordion.tsx +1 -1
  131. package/src/components/alert.tsx +1 -1
  132. package/src/components/breadcrumb.tsx +1 -1
  133. package/src/components/button.tsx +1 -1
  134. package/src/components/calendar.tsx +6 -4
  135. package/src/components/centred-layout.tsx +11 -24
  136. package/src/components/checkbox.tsx +5 -6
  137. package/src/components/combobox.tsx +481 -301
  138. package/src/components/command.tsx +1 -1
  139. package/src/components/context-menu.tsx +1 -1
  140. package/src/components/date-picker.tsx +1 -1
  141. package/src/components/dialog.tsx +1 -1
  142. package/src/components/dropdown-menu.tsx +1 -1
  143. package/src/components/field.tsx +2 -0
  144. package/src/components/input-group.tsx +14 -2
  145. package/src/components/input-otp.tsx +17 -2
  146. package/src/components/input-password.tsx +7 -2
  147. package/src/components/input.tsx +11 -3
  148. package/src/components/link.tsx +1 -1
  149. package/src/components/logo.tsx +10 -8
  150. package/src/components/menubar.tsx +3 -1
  151. package/src/components/navigation-menu.tsx +37 -99
  152. package/src/components/pagination.tsx +13 -19
  153. package/src/components/radio-group.tsx +28 -38
  154. package/src/components/resizable.tsx +5 -43
  155. package/src/components/select.tsx +8 -3
  156. package/src/components/separator.tsx +5 -5
  157. package/src/components/sheet.tsx +6 -11
  158. package/src/components/sonner.tsx +24 -27
  159. package/src/components/switch.figma.tsx +7 -11
  160. package/src/components/switch.tsx +9 -19
  161. package/src/components/table.tsx +23 -18
  162. package/src/components/tabs.tsx +27 -3
  163. package/src/components/textarea.tsx +12 -5
  164. package/src/components/toggle-group.tsx +115 -86
  165. package/src/components/toggle.figma.tsx +13 -19
  166. package/src/components/toggle.tsx +32 -48
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
5
- import { Circle } from "lucide-react";
5
+ import { Circle } from "@brightlocal/icons";
6
6
  import { cva, type VariantProps } from "class-variance-authority";
7
7
 
8
8
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -120,17 +120,16 @@ const radioContentVariants = cva(
120
120
 
121
121
  /**
122
122
  * Visual style variants for the radio group component.
123
+ * - `default`: Standard radio group with minimal styling
124
+ * - `box`: Radio items wrapped in styled card containers
125
+ * - `boxIconVertical`: Radio items with icons displayed vertically above the label
126
+ * - `boxIconHorizontal`: Radio items with icons displayed horizontally to the left
123
127
  */
124
- enum RadioGroupVariant {
125
- /** Standard radio group with minimal styling */
126
- DEFAULT = "default",
127
- /** Radio items wrapped in styled card containers */
128
- BOX = "box",
129
- /** Radio items with icons displayed vertically above the label */
130
- BOX_ICON_VERTICAL = "boxIconVertical",
131
- /** Radio items with icons displayed horizontally to the left */
132
- BOX_ICON_HORIZONTAL = "boxIconHorizontal",
133
- }
128
+ type RadioGroupVariant =
129
+ | "default"
130
+ | "box"
131
+ | "boxIconVertical"
132
+ | "boxIconHorizontal";
134
133
 
135
134
  interface RadioGroupContextValue {
136
135
  variant?: RadioGroupVariant;
@@ -155,6 +154,10 @@ interface RadioGroupProps
155
154
  * Tracking label for analytics context
156
155
  */
157
156
  trackingLabel?: string;
157
+ /**
158
+ * Whether the radio group has an error state
159
+ */
160
+ error?: boolean;
158
161
  }
159
162
 
160
163
  /**
@@ -176,24 +179,12 @@ interface RadioGroupItemProps
176
179
  * Icon displayed for box icon variants
177
180
  */
178
181
  icon?: React.ReactNode;
179
- /**
180
- * Data hook for automated testing (required)
181
- */
182
- dataHook: string;
183
- /**
184
- * Tracking element identifier for analytics
185
- */
186
- trackingEl?: string;
187
- /**
188
- * Tracking label for analytics context
189
- */
190
- trackingLabel?: string;
191
182
  }
192
183
 
193
184
  /* --------------------------------- Context -------------------------------- */
194
185
 
195
186
  const RadioGroupContext = React.createContext<RadioGroupContextValue>({
196
- variant: RadioGroupVariant.DEFAULT,
187
+ variant: "default",
197
188
  });
198
189
 
199
190
  /* ------------------------------- RadioGroup ------------------------------- */
@@ -205,21 +196,27 @@ const RadioGroup = React.forwardRef<
205
196
  (
206
197
  {
207
198
  className,
208
- variant = RadioGroupVariant.DEFAULT,
199
+ variant = "default",
209
200
  dataHook,
210
201
  trackingEl,
211
202
  trackingLabel,
203
+ error,
212
204
  ...props
213
205
  },
214
206
  ref
215
207
  ) => {
216
- const contextVariant = (variant ||
217
- RadioGroupVariant.DEFAULT) as RadioGroupVariant;
208
+ const contextVariant = variant || "default";
209
+ // Support both error prop and aria-invalid for backwards compatibility
210
+ const hasError =
211
+ error ||
212
+ props["aria-invalid"] === true ||
213
+ props["aria-invalid"] === "true";
218
214
 
219
215
  return (
220
216
  <RadioGroupContext.Provider value={{ variant: contextVariant }}>
221
217
  <RadioGroupPrimitive.Root
222
218
  ref={ref}
219
+ aria-invalid={hasError ? "true" : undefined}
223
220
  className={cn(radioGroupVariants({ variant }), className)}
224
221
  data-hook={dataHook}
225
222
  data-slot="radio-group"
@@ -247,28 +244,21 @@ const RadioGroupItem = React.forwardRef<
247
244
  description,
248
245
  icon,
249
246
  children,
250
- dataHook,
251
- trackingEl,
252
- trackingLabel,
253
247
  ...props
254
248
  },
255
249
  ref
256
250
  ) => {
257
251
  const context = React.useContext(RadioGroupContext);
258
- const variant = variantProp ?? context.variant ?? RadioGroupVariant.DEFAULT;
252
+ const variant = variantProp ?? context.variant ?? "default";
259
253
 
260
254
  const isBoxIcon =
261
- variant === RadioGroupVariant.BOX_ICON_VERTICAL ||
262
- variant === RadioGroupVariant.BOX_ICON_HORIZONTAL;
255
+ variant === "boxIconVertical" || variant === "boxIconHorizontal";
263
256
 
264
257
  return (
265
258
  <RadioGroupPrimitive.Item
266
259
  ref={ref}
267
260
  className={cn(radioGroupItemVariants({ variant }), className)}
268
- data-hook={dataHook}
269
261
  data-slot="radio-group-item"
270
- data-tracking-el={trackingEl}
271
- data-tracking-label={trackingLabel}
272
262
  {...props}
273
263
  >
274
264
  {/* Icon for box icon variants */}
@@ -288,7 +278,7 @@ const RadioGroupItem = React.forwardRef<
288
278
  <Circle
289
279
  className={cn(
290
280
  "size-2",
291
- variant === RadioGroupVariant.DEFAULT
281
+ variant === "default"
292
282
  ? "fill-primary text-primary"
293
283
  : "fill-background text-background"
294
284
  )}
@@ -317,5 +307,5 @@ RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
317
307
 
318
308
  /* --------------------------------- Exports -------------------------------- */
319
309
 
320
- export { RadioGroup, RadioGroupItem, RadioGroupVariant };
310
+ export { RadioGroup, RadioGroupItem, type RadioGroupVariant };
321
311
  export type { RadioGroupProps, RadioGroupItemProps };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import * as React from "react";
3
- import { GripVertical } from "lucide-react";
3
+ import { GripVertical } from "@brightlocal/icons";
4
4
  import * as ResizablePrimitive from "react-resizable-panels";
5
5
 
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -51,22 +51,9 @@ ResizablePanelGroup.displayName = "ResizablePanelGroup";
51
51
  /**
52
52
  * Props for the ResizablePanel component.
53
53
  */
54
- interface ResizablePanelProps extends React.ComponentProps<
54
+ type ResizablePanelProps = React.ComponentProps<
55
55
  typeof ResizablePrimitive.Panel
56
- > {
57
- /**
58
- * Data hook for automated testing
59
- */
60
- dataHook?: string;
61
- /**
62
- * Tracking element identifier for analytics
63
- */
64
- trackingEl?: string;
65
- /**
66
- * Tracking label for analytics context
67
- */
68
- trackingLabel?: string;
69
- }
56
+ >;
70
57
 
71
58
  /**
72
59
  * Individual resizable panel within a panel group.
@@ -74,15 +61,8 @@ interface ResizablePanelProps extends React.ComponentProps<
74
61
  const ResizablePanel = React.forwardRef<
75
62
  React.ComponentRef<typeof ResizablePrimitive.Panel>,
76
63
  ResizablePanelProps
77
- >(({ dataHook, trackingEl, trackingLabel, ...props }, ref) => (
78
- <ResizablePrimitive.Panel
79
- ref={ref}
80
- data-hook={dataHook}
81
- data-slot="resizable-panel"
82
- data-tracking-el={trackingEl}
83
- data-tracking-label={trackingLabel}
84
- {...props}
85
- />
64
+ >(({ ...props }, ref) => (
65
+ <ResizablePrimitive.Panel ref={ref} data-slot="resizable-panel" {...props} />
86
66
  ));
87
67
 
88
68
  ResizablePanel.displayName = "ResizablePanel";
@@ -97,18 +77,6 @@ interface ResizableHandleProps extends React.ComponentProps<
97
77
  * Show a visible drag handle indicator
98
78
  */
99
79
  withHandle?: boolean;
100
- /**
101
- * Data hook for automated testing
102
- */
103
- dataHook?: string;
104
- /**
105
- * Tracking element identifier for analytics
106
- */
107
- trackingEl?: string;
108
- /**
109
- * Tracking label for analytics context
110
- */
111
- trackingLabel?: string;
112
80
  }
113
81
 
114
82
  /**
@@ -117,9 +85,6 @@ interface ResizableHandleProps extends React.ComponentProps<
117
85
  function ResizableHandle({
118
86
  withHandle,
119
87
  className,
120
- dataHook,
121
- trackingEl,
122
- trackingLabel,
123
88
  ...props
124
89
  }: ResizableHandleProps) {
125
90
  return (
@@ -128,10 +93,7 @@ function ResizableHandle({
128
93
  "bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-none data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",
129
94
  className
130
95
  )}
131
- data-hook={dataHook}
132
96
  data-slot="resizable-handle"
133
- data-tracking-el={trackingEl}
134
- data-tracking-label={trackingLabel}
135
97
  {...props}
136
98
  >
137
99
  {withHandle && (
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import * as SelectPrimitive from "@radix-ui/react-select";
5
- import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
5
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "@brightlocal/icons";
6
6
  import { cva } from "class-variance-authority";
7
7
 
8
8
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -184,6 +184,8 @@ interface SelectTriggerProps extends React.ComponentProps<
184
184
  placeholder?: string;
185
185
  /** Data hook for testing and automation */
186
186
  dataHook?: string;
187
+ /** Whether the select trigger has an error state */
188
+ error?: boolean;
187
189
  }
188
190
 
189
191
  // ============================================================================
@@ -198,11 +200,14 @@ function SelectTrigger({
198
200
  children,
199
201
  placeholder,
200
202
  dataHook,
203
+ error,
201
204
  ...props
202
205
  }: SelectTriggerProps) {
203
- // Parse aria attributes
206
+ // Support both error prop and aria-invalid for backwards compatibility
204
207
  const isError =
205
- props["aria-invalid"] === true || props["aria-invalid"] === "true";
208
+ error ||
209
+ props["aria-invalid"] === true ||
210
+ props["aria-invalid"] === "true";
206
211
  const isRequired =
207
212
  props["aria-required"] === true || props["aria-required"] === "true";
208
213
 
@@ -5,10 +5,10 @@ import * as SeparatorPrimitive from "@radix-ui/react-separator";
5
5
 
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
7
 
8
- export enum SeparatorOrientation {
9
- HORIZONTAL = "horizontal",
10
- VERTICAL = "vertical",
11
- }
8
+ /**
9
+ * Orientation variants for Separator
10
+ */
11
+ export type SeparatorOrientation = "horizontal" | "vertical";
12
12
 
13
13
  /**
14
14
  * Props for the Separator component.
@@ -41,7 +41,7 @@ const Separator = React.forwardRef<
41
41
  (
42
42
  {
43
43
  className,
44
- orientation = SeparatorOrientation.HORIZONTAL,
44
+ orientation = "horizontal",
45
45
  decorative = true,
46
46
  dataHook,
47
47
  trackingEl,
@@ -3,23 +3,18 @@
3
3
  import * as React from "react";
4
4
  import * as SheetPrimitive from "@radix-ui/react-dialog";
5
5
  import { cva, type VariantProps } from "class-variance-authority";
6
- import { XIcon } from "lucide-react";
6
+ import { XIcon } from "@brightlocal/icons";
7
7
 
8
8
  import { cn } from "@brightlocal/ui-components/lib/utils";
9
9
 
10
10
  /**
11
11
  * Available sheet side variants
12
+ * - top: Sheet slides in from the top
13
+ * - right: Sheet slides in from the right (default)
14
+ * - bottom: Sheet slides in from the bottom
15
+ * - left: Sheet slides in from the left
12
16
  */
13
- export enum SheetSide {
14
- /** Sheet slides in from the top */
15
- TOP = "top",
16
- /** Sheet slides in from the right (default) */
17
- RIGHT = "right",
18
- /** Sheet slides in from the bottom */
19
- BOTTOM = "bottom",
20
- /** Sheet slides in from the left */
21
- LEFT = "left",
22
- }
17
+ export type SheetSide = "top" | "right" | "bottom" | "left";
23
18
 
24
19
  const sheetContentVariants = cva(
25
20
  [
@@ -6,7 +6,7 @@ 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
 
@@ -46,20 +46,17 @@ type ToastProps = {
46
46
  icon?: ToastIconType | null;
47
47
  };
48
48
 
49
- export enum SonnerIcon {
50
- INFO = "info",
51
- SUCCESS = "success",
52
- WARNING = "warning",
53
- ERROR = "error",
54
- LOADING = "loading",
55
- }
49
+ /**
50
+ * Icon type variants for toast notifications
51
+ */
52
+ export type SonnerIcon = "info" | "success" | "warning" | "error" | "loading";
56
53
 
57
54
  export type ToastIconType = SonnerIcon | null;
58
55
 
59
- export enum SonnerColorSchema {
60
- DEFAULT = "default",
61
- SUCCESS = "success",
62
- }
56
+ /**
57
+ * Color schema variants for toast notifications
58
+ */
59
+ export type SonnerColorSchema = "default" | "success";
63
60
 
64
61
  type SonnerCustomOptions = {
65
62
  className?: string;
@@ -146,19 +143,19 @@ const ICON_VARIANTS = cva("size-5", {
146
143
  */
147
144
  function renderToastIcon(type: ToastIconType, schema: "default" | "success") {
148
145
  switch (type) {
149
- case SonnerIcon.INFO:
146
+ case "info":
150
147
  return <Info className={cn(ICON_VARIANTS({ colorSchema: schema }))} />;
151
- case SonnerIcon.SUCCESS:
148
+ case "success":
152
149
  return (
153
150
  <CheckCircle2 className={cn(ICON_VARIANTS({ colorSchema: schema }))} />
154
151
  );
155
- case SonnerIcon.WARNING:
152
+ case "warning":
156
153
  return (
157
154
  <AlertTriangle className={cn(ICON_VARIANTS({ colorSchema: schema }))} />
158
155
  );
159
- case SonnerIcon.ERROR:
156
+ case "error":
160
157
  return <XCircle className={cn(ICON_VARIANTS({ colorSchema: schema }))} />;
161
- case SonnerIcon.LOADING:
158
+ case "loading":
162
159
  return (
163
160
  <Loader2
164
161
  className={cn(ICON_VARIANTS({ colorSchema: schema }), "animate-spin")}
@@ -217,7 +214,7 @@ function Toast(props: ToastProps) {
217
214
  const { button, description, icon, title, colorSchema } = props;
218
215
 
219
216
  const resolveSchema = (schema?: SonnerColorSchema): "default" | "success" =>
220
- schema === SonnerColorSchema.SUCCESS ? "success" : "default";
217
+ schema === "success" ? "success" : "default";
221
218
 
222
219
  const schema = resolveSchema(colorSchema);
223
220
 
@@ -310,13 +307,13 @@ function Toast(props: ToastProps) {
310
307
  *
311
308
  * @example
312
309
  * // Then use sonner() anywhere in your app
313
- * import { sonner, SonnerIcon } from '@brightlocal/ui-components/sonner';
310
+ * import { sonner } from '@brightlocal/ui-components/sonner';
314
311
  *
315
312
  * function MyComponent() {
316
313
  * const handleClick = () => {
317
314
  * sonner({
318
315
  * title: "Success!",
319
- * icon: SonnerIcon.SUCCESS
316
+ * icon: "success"
320
317
  * });
321
318
  * };
322
319
  *
@@ -348,7 +345,7 @@ Sonner.displayName = "Sonner";
348
345
  * <Sonner />
349
346
  *
350
347
  * // 2. Show toasts anywhere in your app
351
- * import { sonner, SonnerIcon, SonnerColorSchema } from '@brightlocal/ui-components/sonner';
348
+ * import { sonner } from '@brightlocal/ui-components/sonner';
352
349
  *
353
350
  * // Simple toast
354
351
  * sonner({ title: "Hello world" });
@@ -357,8 +354,8 @@ Sonner.displayName = "Sonner";
357
354
  * sonner({
358
355
  * title: "Changes saved",
359
356
  * description: "Your changes have been saved successfully.",
360
- * icon: SonnerIcon.SUCCESS,
361
- * colorSchema: SonnerColorSchema.SUCCESS,
357
+ * icon: "success",
358
+ * colorSchema: "success",
362
359
  * button: {
363
360
  * label: "Undo",
364
361
  * onClick: () => undoChanges()
@@ -373,7 +370,7 @@ Sonner.displayName = "Sonner";
373
370
  * sonner({
374
371
  * title: "Uploading...",
375
372
  * description: "Please wait while we upload your file.",
376
- * icon: SonnerIcon.LOADING,
373
+ * icon: "loading",
377
374
  * id: loadingToastId
378
375
  * });
379
376
  *
@@ -383,15 +380,15 @@ Sonner.displayName = "Sonner";
383
380
  * toast.dismiss(loadingToastId);
384
381
  * sonner({
385
382
  * title: "Upload complete!",
386
- * icon: SonnerIcon.SUCCESS,
387
- * colorSchema: SonnerColorSchema.SUCCESS
383
+ * icon: "success",
384
+ * colorSchema: "success"
388
385
  * });
389
386
  * } catch (error) {
390
387
  * toast.dismiss(loadingToastId);
391
388
  * sonner({
392
389
  * title: "Upload failed",
393
390
  * description: error.message,
394
- * icon: SonnerIcon.ERROR
391
+ * icon: "error"
395
392
  * });
396
393
  * }
397
394
  * ```
@@ -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>(