@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 { Command as CommandPrimitive } from "cmdk";
5
- import { CheckIcon, SearchIcon, XIcon } from "lucide-react";
5
+ import { CheckIcon, SearchIcon, XIcon } from "@brightlocal/icons";
6
6
 
7
7
  import { Button } from "@brightlocal/ui-components/button";
8
8
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import * as React from "react";
3
3
  import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
4
- import { Check, ChevronRight, Circle } from "lucide-react";
4
+ import { Check, ChevronRight, Circle } from "@brightlocal/icons";
5
5
 
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
7
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import { format } from "date-fns";
5
- import { Calendar as CalendarIcon } from "lucide-react";
5
+ import { Calendar as CalendarIcon } from "@brightlocal/icons";
6
6
  import type { DateRange } from "react-day-picker";
7
7
 
8
8
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import * as DialogPrimitive from "@radix-ui/react-dialog";
5
- import { XIcon } from "lucide-react";
5
+ import { XIcon } from "@brightlocal/icons";
6
6
 
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
5
- import { Check, ChevronRight, Circle, ChevronsUpDown } from "lucide-react";
5
+ import { Check, ChevronRight, Circle, ChevronsUpDown } from "@brightlocal/icons";
6
6
 
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
8
 
@@ -18,6 +18,8 @@ function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
18
18
  );
19
19
  }
20
20
 
21
+ FieldSet.displayName = "FieldSet";
22
+
21
23
  interface FieldLegendProps extends React.ComponentProps<"legend"> {
22
24
  /**
23
25
  * Visual style variant of the legend
@@ -16,9 +16,17 @@ const inputGroupVariants = cva(
16
16
  sm: "h-8",
17
17
  lg: "h-10",
18
18
  },
19
+ error: {
20
+ true: [
21
+ "border-red-600/40 dark:border-red-400/60",
22
+ "has-[:focus-visible]:border-destructive has-[:focus-visible]:shadow-destructive",
23
+ ],
24
+ false: "",
25
+ },
19
26
  },
20
27
  defaultVariants: {
21
28
  size: "default",
29
+ error: false,
22
30
  },
23
31
  }
24
32
  );
@@ -39,14 +47,18 @@ interface InputGroupProps
39
47
  * Tracking label for analytics context
40
48
  */
41
49
  trackingLabel?: string;
50
+ /**
51
+ * Whether the input group has an error state
52
+ */
53
+ error?: boolean;
42
54
  }
43
55
 
44
56
  const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
45
- ({ className, size, dataHook, trackingEl, trackingLabel, ...props }, ref) => {
57
+ ({ className, size, error, dataHook, trackingEl, trackingLabel, ...props }, ref) => {
46
58
  return (
47
59
  <div
48
60
  ref={ref}
49
- className={cn(inputGroupVariants({ size }), className)}
61
+ className={cn(inputGroupVariants({ size, error }), className)}
50
62
  data-hook={dataHook}
51
63
  data-slot="input-group"
52
64
  data-tracking-el={trackingEl}
@@ -9,7 +9,7 @@ import {
9
9
  REGEXP_ONLY_CHARS,
10
10
  REGEXP_ONLY_DIGITS_AND_CHARS,
11
11
  } from "input-otp";
12
- import { MinusIcon } from "lucide-react";
12
+ import { MinusIcon } from "@brightlocal/icons";
13
13
 
14
14
  import { cn } from "@brightlocal/ui-components/lib/utils";
15
15
  import { Label } from "@brightlocal/ui-components/label";
@@ -19,11 +19,13 @@ type InputOTPProps = React.ComponentProps<typeof OTPInput> & {
19
19
  trackingEl?: string;
20
20
  dataHook: string;
21
21
  trackingLabel?: string;
22
+ /** Whether the input has an error state */
23
+ error?: boolean;
22
24
  };
23
25
 
24
26
  const InputOTP = React.forwardRef<HTMLInputElement, InputOTPProps>(
25
27
  (
26
- { trackingEl, trackingLabel, dataHook, containerClassName, ...props },
28
+ { trackingEl, trackingLabel, dataHook, containerClassName, error, ...props },
27
29
  ref
28
30
  ) => {
29
31
  // Ensure we always have an accessible label if none is provided
@@ -32,9 +34,16 @@ const InputOTP = React.forwardRef<HTMLInputElement, InputOTPProps>(
32
34
  ? "One-time password"
33
35
  : props["aria-label"];
34
36
 
37
+ // Support both error prop and aria-invalid for backwards compatibility
38
+ const hasError =
39
+ error ||
40
+ props["aria-invalid"] === true ||
41
+ props["aria-invalid"] === "true";
42
+
35
43
  return (
36
44
  <OTPInput
37
45
  ref={ref}
46
+ aria-invalid={hasError ? "true" : undefined}
38
47
  aria-label={effectiveAriaLabel}
39
48
  className="disabled:cursor-not-allowed"
40
49
  containerClassName={cn(
@@ -132,6 +141,8 @@ interface InputOTPFieldProps {
132
141
  disabled?: boolean;
133
142
  className?: string;
134
143
  "aria-label"?: string;
144
+ /** Whether the input has an error state */
145
+ error?: boolean;
135
146
  }
136
147
 
137
148
  const InputOTPField = React.forwardRef<HTMLInputElement, InputOTPFieldProps>(
@@ -144,6 +155,7 @@ const InputOTPField = React.forwardRef<HTMLInputElement, InputOTPFieldProps>(
144
155
  trackingLabel,
145
156
  containerClassName,
146
157
  children,
158
+ error,
147
159
  "aria-label": ariaLabel,
148
160
  ...props
149
161
  },
@@ -172,6 +184,7 @@ const InputOTPField = React.forwardRef<HTMLInputElement, InputOTPFieldProps>(
172
184
  aria-label={effectiveAriaLabel}
173
185
  containerClassName={containerClassName}
174
186
  dataHook={dataHook}
187
+ error={error}
175
188
  id={label ? inputId : undefined}
176
189
  trackingEl={trackingEl}
177
190
  trackingLabel={trackingLabel}
@@ -198,6 +211,8 @@ interface VariantInputOTPProps extends Omit<
198
211
  autoFocus?: boolean;
199
212
  pattern?: string;
200
213
  "aria-label"?: string;
214
+ /** Whether the input has an error state */
215
+ error?: boolean;
201
216
  }
202
217
 
203
218
  const InputOTPDigitsOnly = React.forwardRef<
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import * as React from "react";
4
- import { Eye, EyeOff } from "lucide-react";
4
+ import { Eye, EyeOff } from "@brightlocal/icons";
5
5
 
6
6
  import { Progress } from "@brightlocal/ui-components/progress";
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -52,6 +52,10 @@ interface InputPasswordProps extends Omit<
52
52
  * Optional tracking label
53
53
  */
54
54
  trackingLabel?: string;
55
+ /**
56
+ * Whether the input has an error state
57
+ */
58
+ error?: boolean;
55
59
  }
56
60
 
57
61
  /**
@@ -93,6 +97,7 @@ const InputPassword = React.forwardRef<HTMLInputElement, InputPasswordProps>(
93
97
  onChange,
94
98
  value,
95
99
  id,
100
+ error,
96
101
  ...props
97
102
  },
98
103
  ref
@@ -129,7 +134,7 @@ const InputPassword = React.forwardRef<HTMLInputElement, InputPasswordProps>(
129
134
 
130
135
  return (
131
136
  <div className="w-full">
132
- <InputGroup className={className} dataHook={dataHook}>
137
+ <InputGroup className={className} dataHook={dataHook} error={error}>
133
138
  <InputGroupInput
134
139
  ref={ref}
135
140
  id={inputId}
@@ -78,6 +78,10 @@ export interface InputProps
78
78
  * Required data-hook attribute for automated testing
79
79
  */
80
80
  dataHook: string;
81
+ /**
82
+ * Whether the input has an error state
83
+ */
84
+ error?: boolean;
81
85
  /**
82
86
  * Optional tracking element identifier for analytics
83
87
  */
@@ -95,23 +99,27 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
95
99
  hasIcon = false,
96
100
  hasSecondaryIcon = false,
97
101
  dataHook,
102
+ error,
98
103
  trackingEl,
99
104
  trackingLabel,
100
105
  ...props
101
106
  },
102
107
  ref
103
108
  ) => {
104
- // Check for error state from aria-invalid attribute
109
+ // Support both error prop and aria-invalid for backwards compatibility
105
110
  const hasError =
106
- props["aria-invalid"] === true || props["aria-invalid"] === "true";
111
+ error ||
112
+ props["aria-invalid"] === true ||
113
+ props["aria-invalid"] === "true";
107
114
 
108
115
  return (
109
116
  <input
110
117
  ref={ref}
118
+ aria-invalid={hasError ? "true" : undefined}
111
119
  className={cn(
112
120
  inputVariants({ hasIcon, hasSecondaryIcon }),
113
121
  hasError &&
114
- "border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive",
122
+ "border-red-600/40 dark:border-red-400/60 focus-visible:border-destructive focus-visible:shadow-destructive",
115
123
  className
116
124
  )}
117
125
  data-hook={dataHook}
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { ExternalLink } from "lucide-react";
2
+ import { ExternalLink } from "@brightlocal/icons";
3
3
  import { Slot } from "@radix-ui/react-slot";
4
4
  import { cva, type VariantProps } from "class-variance-authority";
5
5
 
@@ -1,12 +1,14 @@
1
1
  import { cva, VariantProps } from "class-variance-authority";
2
2
  import { cn } from "@brightlocal/ui-components/lib/utils";
3
3
 
4
- export enum LogoVariant {
5
- LOGOTYPE = "logotype",
6
- MARK = "mark",
7
- }
4
+ /**
5
+ * Visual style variants for the Logo component.
6
+ * - `logotype`: Full BrightLocal logo with text
7
+ * - `mark`: Icon-only logo mark
8
+ */
9
+ export type LogoVariant = "logotype" | "mark";
8
10
 
9
- const logoVariants = cva("inline-flex [&_path]:fill-primary", {
11
+ const logoVariants = cva("inline-flex [&_path]:fill-brand-primary-foreground", {
10
12
  variants: {
11
13
  variant: {
12
14
  logotype: "h-6",
@@ -14,7 +16,7 @@ const logoVariants = cva("inline-flex [&_path]:fill-primary", {
14
16
  },
15
17
  },
16
18
  defaultVariants: {
17
- variant: LogoVariant.LOGOTYPE,
19
+ variant: "logotype",
18
20
  },
19
21
  });
20
22
 
@@ -55,7 +57,7 @@ function Logo({
55
57
  role="img"
56
58
  {...props}
57
59
  >
58
- {variant === LogoVariant.LOGOTYPE && (
60
+ {variant === "logotype" && (
59
61
  <svg
60
62
  fill="none"
61
63
  height="30"
@@ -73,7 +75,7 @@ function Logo({
73
75
  </defs>
74
76
  </svg>
75
77
  )}
76
- {variant === LogoVariant.MARK && (
78
+ {variant === "mark" && (
77
79
  <svg
78
80
  fill="none"
79
81
  height="21"
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import * as React from "react";
3
3
  import * as MenubarPrimitive from "@radix-ui/react-menubar";
4
- import { Check, ChevronRight, Circle } from "lucide-react";
4
+ import { Check, ChevronRight, Circle } from "@brightlocal/icons";
5
5
 
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
7
 
@@ -53,6 +53,8 @@ function Menubar({
53
53
  );
54
54
  }
55
55
 
56
+ Menubar.displayName = "Menubar";
57
+
56
58
  /**
57
59
  * MenubarMenu - Individual menu within the menubar
58
60
  */
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
5
- import { ChevronDown } from "lucide-react";
5
+ import { ChevronDown } from "@brightlocal/icons";
6
6
 
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
8
 
@@ -78,25 +78,9 @@ NavigationMenuItem.displayName = "NavigationMenuItem";
78
78
  /**
79
79
  * Props for NavigationMenuTrigger component
80
80
  */
81
- interface NavigationMenuTriggerProps extends React.ComponentPropsWithoutRef<
81
+ type NavigationMenuTriggerProps = React.ComponentPropsWithoutRef<
82
82
  typeof NavigationMenuPrimitive.Trigger
83
- > {
84
- /**
85
- * Data hook for automated testing (REQUIRED)
86
- * Used to identify component in tests and E2E automation
87
- */
88
- dataHook: string;
89
- /**
90
- * Tracking element identifier for analytics
91
- * Defaults to component name if not provided
92
- */
93
- trackingEl?: string;
94
- /**
95
- * Tracking label for analytics context
96
- * Additional context for tracking events
97
- */
98
- trackingLabel?: string;
99
- }
83
+ >;
100
84
 
101
85
  /**
102
86
  * Trigger button that opens a dropdown menu
@@ -105,67 +89,43 @@ interface NavigationMenuTriggerProps extends React.ComponentPropsWithoutRef<
105
89
  const NavigationMenuTrigger = React.forwardRef<
106
90
  React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
107
91
  NavigationMenuTriggerProps
108
- >(
109
- (
110
- { className, children, dataHook, trackingEl, trackingLabel, ...props },
111
- ref
112
- ) => (
113
- <NavigationMenuPrimitive.Trigger
114
- ref={ref}
115
- className={cn(
116
- [
117
- "group inline-flex h-9 w-max items-center justify-center gap-1",
118
- "rounded-md px-4 py-2",
119
- "text-sm font-medium",
120
- "text-foreground",
121
- "transition-colors",
122
- "hover:bg-accent hover:text-accent-foreground",
123
- "focus:bg-accent focus:text-accent-foreground",
124
- "focus-visible:bg-accent focus-visible:ring-ring focus-visible:shadow-[0_0_0_4px_rgba(163,163,163,0.1)] focus-visible:ring-1 focus-visible:outline-none",
125
- "disabled:pointer-events-none disabled:opacity-50",
126
- "data-[state=open]:bg-accent/50",
127
- ],
128
- className
129
- )}
130
- data-hook={dataHook}
131
- data-slot="navigation-menu-trigger"
132
- data-tracking-el={trackingEl || "navigation-menu-trigger"}
133
- data-tracking-label={trackingLabel}
134
- {...props}
135
- >
136
- {children}
137
- <ChevronDown
138
- aria-hidden="true"
139
- className="relative top-[1px] ml-1 h-3 w-3 transition duration-300 group-data-[state=open]:rotate-180"
140
- />
141
- </NavigationMenuPrimitive.Trigger>
142
- )
143
- );
92
+ >(({ className, children, ...props }, ref) => (
93
+ <NavigationMenuPrimitive.Trigger
94
+ ref={ref}
95
+ className={cn(
96
+ [
97
+ "group inline-flex h-9 w-max items-center justify-center gap-1",
98
+ "rounded-md px-4 py-2",
99
+ "text-sm font-medium",
100
+ "text-foreground",
101
+ "transition-colors",
102
+ "hover:bg-accent hover:text-accent-foreground",
103
+ "focus:bg-accent focus:text-accent-foreground",
104
+ "focus-visible:bg-accent focus-visible:ring-ring focus-visible:shadow-[0_0_0_4px_rgba(163,163,163,0.1)] focus-visible:ring-1 focus-visible:outline-none",
105
+ "disabled:pointer-events-none disabled:opacity-50",
106
+ "data-[state=open]:bg-accent/50",
107
+ ],
108
+ className
109
+ )}
110
+ data-slot="navigation-menu-trigger"
111
+ {...props}
112
+ >
113
+ {children}
114
+ <ChevronDown
115
+ aria-hidden="true"
116
+ className="relative top-[1px] ml-1 h-3 w-3 transition duration-300 group-data-[state=open]:rotate-180"
117
+ />
118
+ </NavigationMenuPrimitive.Trigger>
119
+ ));
144
120
 
145
121
  NavigationMenuTrigger.displayName = "NavigationMenuTrigger";
146
122
 
147
123
  /**
148
124
  * Props for NavigationMenuContent component
149
125
  */
150
- interface NavigationMenuContentProps extends React.ComponentPropsWithoutRef<
126
+ type NavigationMenuContentProps = React.ComponentPropsWithoutRef<
151
127
  typeof NavigationMenuPrimitive.Content
152
- > {
153
- /**
154
- * Data hook for automated testing (REQUIRED)
155
- * Used to identify component in tests and E2E automation
156
- */
157
- dataHook: string;
158
- /**
159
- * Tracking element identifier for analytics
160
- * Defaults to component name if not provided
161
- */
162
- trackingEl?: string;
163
- /**
164
- * Tracking label for analytics context
165
- * Additional context for tracking events
166
- */
167
- trackingLabel?: string;
168
- }
128
+ >;
169
129
 
170
130
  /**
171
131
  * Dropdown content container
@@ -174,7 +134,7 @@ interface NavigationMenuContentProps extends React.ComponentPropsWithoutRef<
174
134
  const NavigationMenuContent = React.forwardRef<
175
135
  React.ElementRef<typeof NavigationMenuPrimitive.Content>,
176
136
  NavigationMenuContentProps
177
- >(({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => (
137
+ >(({ className, ...props }, ref) => (
178
138
  <NavigationMenuPrimitive.Content
179
139
  ref={ref}
180
140
  className={cn(
@@ -187,10 +147,7 @@ const NavigationMenuContent = React.forwardRef<
187
147
  ],
188
148
  className
189
149
  )}
190
- data-hook={dataHook}
191
150
  data-slot="navigation-menu-content"
192
- data-tracking-el={trackingEl || "navigation-menu-content"}
193
- data-tracking-label={trackingLabel}
194
151
  {...props}
195
152
  />
196
153
  ));
@@ -200,25 +157,9 @@ NavigationMenuContent.displayName = "NavigationMenuContent";
200
157
  /**
201
158
  * Props for NavigationMenuLink component
202
159
  */
203
- interface NavigationMenuLinkProps extends React.ComponentPropsWithoutRef<
160
+ type NavigationMenuLinkProps = React.ComponentPropsWithoutRef<
204
161
  typeof NavigationMenuPrimitive.Link
205
- > {
206
- /**
207
- * Data hook for automated testing (REQUIRED)
208
- * Used to identify component in tests and E2E automation
209
- */
210
- dataHook: string;
211
- /**
212
- * Tracking element identifier for analytics
213
- * Defaults to component name if not provided
214
- */
215
- trackingEl?: string;
216
- /**
217
- * Tracking label for analytics context
218
- * Additional context for tracking events
219
- */
220
- trackingLabel?: string;
221
- }
162
+ >;
222
163
 
223
164
  /**
224
165
  * Navigation link within the menu
@@ -227,7 +168,7 @@ interface NavigationMenuLinkProps extends React.ComponentPropsWithoutRef<
227
168
  const NavigationMenuLink = React.forwardRef<
228
169
  React.ElementRef<typeof NavigationMenuPrimitive.Link>,
229
170
  NavigationMenuLinkProps
230
- >(({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => (
171
+ >(({ className, ...props }, ref) => (
231
172
  <NavigationMenuPrimitive.Link
232
173
  ref={ref}
233
174
  className={cn(
@@ -240,10 +181,7 @@ const NavigationMenuLink = React.forwardRef<
240
181
  ],
241
182
  className
242
183
  )}
243
- data-hook={dataHook}
244
184
  data-slot="navigation-menu-link"
245
- data-tracking-el={trackingEl || "navigation-menu-link"}
246
- data-tracking-label={trackingLabel}
247
185
  {...props}
248
186
  />
249
187
  ));
@@ -3,23 +3,18 @@ import {
3
3
  ChevronLeftIcon,
4
4
  ChevronRightIcon,
5
5
  MoreHorizontalIcon,
6
- } from "lucide-react";
6
+ } from "@brightlocal/icons";
7
7
  import { cva, type VariantProps } from "class-variance-authority";
8
8
  import { cn } from "@brightlocal/ui-components/lib/utils";
9
9
 
10
10
  /**
11
11
  * Pagination item variants
12
+ * - `previous`: Previous navigation button
13
+ * - `next`: Next navigation button
14
+ * - `link`: Page number link
15
+ * - `ellipsis`: Ellipsis indicator for skipped pages
12
16
  */
13
- export enum PaginationVariant {
14
- /** Previous navigation button */
15
- PREVIOUS = "previous",
16
- /** Next navigation button */
17
- NEXT = "next",
18
- /** Page number link */
19
- LINK = "link",
20
- /** Ellipsis indicator for skipped pages */
21
- ELLIPSIS = "ellipsis",
22
- }
17
+ export type PaginationVariant = "previous" | "next" | "link" | "ellipsis";
23
18
 
24
19
  /**
25
20
  * Pagination hook parameters
@@ -167,7 +162,7 @@ const paginationItemVariants = cva(
167
162
  },
168
163
  },
169
164
  defaultVariants: {
170
- variant: PaginationVariant.LINK,
165
+ variant: "link",
171
166
  },
172
167
  }
173
168
  );
@@ -205,6 +200,8 @@ function Pagination({
205
200
  );
206
201
  }
207
202
 
203
+ Pagination.displayName = "Pagination";
204
+
208
205
  function PaginationContent({
209
206
  className,
210
207
  ...props
@@ -270,7 +267,7 @@ const PaginationPrevious = React.forwardRef<
270
267
  aria-label="Go to previous page"
271
268
  className={className}
272
269
  disabled={disabled}
273
- variant={PaginationVariant.PREVIOUS}
270
+ variant="previous"
274
271
  {...props}
275
272
  >
276
273
  <ChevronLeftIcon className="size-4" />
@@ -294,7 +291,7 @@ const PaginationNext = React.forwardRef<HTMLButtonElement, PaginationNextProps>(
294
291
  aria-label="Go to next page"
295
292
  className={className}
296
293
  disabled={disabled}
297
- variant={PaginationVariant.NEXT}
294
+ variant="next"
298
295
  {...props}
299
296
  >
300
297
  <ChevronRightIcon className="size-4" />
@@ -318,7 +315,7 @@ const PaginationLink = React.forwardRef<HTMLButtonElement, PaginationLinkProps>(
318
315
  aria-label={`Go to page ${page}`}
319
316
  className={className}
320
317
  isActive={isActive}
321
- variant={PaginationVariant.LINK}
318
+ variant="link"
322
319
  {...props}
323
320
  >
324
321
  {page}
@@ -336,10 +333,7 @@ function PaginationEllipsis({
336
333
  return (
337
334
  <span
338
335
  aria-hidden="true"
339
- className={cn(
340
- paginationItemVariants({ variant: PaginationVariant.ELLIPSIS }),
341
- className
342
- )}
336
+ className={cn(paginationItemVariants({ variant: "ellipsis" }), className)}
343
337
  data-slot="pagination-ellipsis"
344
338
  {...props}
345
339
  >