@brightlocal/ui-components 2.10.0 → 2.12.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 (163) hide show
  1. package/README.md +3 -1
  2. package/component-meta.json +200 -17
  3. package/dist/badge.cjs +1 -1
  4. package/dist/badge.d.ts.map +1 -1
  5. package/dist/badge.js +42 -25
  6. package/dist/blocks/data-table.cjs +1 -1
  7. package/dist/blocks/data-table.d.ts +16 -4
  8. package/dist/blocks/data-table.d.ts.map +1 -1
  9. package/dist/blocks/data-table.js +57 -53
  10. package/dist/blocks/input-list.cjs +2 -2
  11. package/dist/blocks/input-list.d.ts +7 -1
  12. package/dist/blocks/input-list.d.ts.map +1 -1
  13. package/dist/blocks/input-list.js +82 -81
  14. package/dist/blocks/sidebar.cjs +1 -1
  15. package/dist/blocks/sidebar.d.ts +19 -10
  16. package/dist/blocks/sidebar.d.ts.map +1 -1
  17. package/dist/blocks/sidebar.js +173 -169
  18. package/dist/breadcrumb.cjs +1 -1
  19. package/dist/breadcrumb.d.ts +14 -2
  20. package/dist/breadcrumb.d.ts.map +1 -1
  21. package/dist/breadcrumb.js +37 -37
  22. package/dist/button.cjs +1 -1
  23. package/dist/button.js +25 -25
  24. package/dist/callout.cjs +1 -1
  25. package/dist/callout.d.ts +3 -3
  26. package/dist/callout.d.ts.map +1 -1
  27. package/dist/callout.js +2 -1
  28. package/dist/card.cjs +1 -1
  29. package/dist/card.d.ts +10 -1
  30. package/dist/card.d.ts.map +1 -1
  31. package/dist/card.js +85 -82
  32. package/dist/carousel.cjs +1 -1
  33. package/dist/carousel.d.ts +37 -4
  34. package/dist/carousel.d.ts.map +1 -1
  35. package/dist/carousel.js +213 -163
  36. package/dist/chip.cjs +1 -1
  37. package/dist/chip.d.ts +11 -0
  38. package/dist/chip.d.ts.map +1 -1
  39. package/dist/chip.js +43 -38
  40. package/dist/combobox.cjs +3 -3
  41. package/dist/combobox.d.ts +12 -2
  42. package/dist/combobox.d.ts.map +1 -1
  43. package/dist/combobox.js +235 -230
  44. package/dist/command.cjs +1 -1
  45. package/dist/command.d.ts +106 -1
  46. package/dist/command.d.ts.map +1 -1
  47. package/dist/command.js +385 -120
  48. package/dist/date-picker.cjs +1 -1
  49. package/dist/date-picker.d.ts +10 -0
  50. package/dist/date-picker.d.ts.map +1 -1
  51. package/dist/date-picker.js +96 -96
  52. package/dist/dialog.cjs +1 -1
  53. package/dist/dialog.d.ts +7 -2
  54. package/dist/dialog.d.ts.map +1 -1
  55. package/dist/dialog.js +38 -30
  56. package/dist/drawer.d.ts +2 -2
  57. package/dist/global-layout.cjs +1 -1
  58. package/dist/global-layout.d.ts +5 -0
  59. package/dist/global-layout.d.ts.map +1 -1
  60. package/dist/global-layout.js +15 -7
  61. package/dist/hooks/use-breakpoint.cjs +1 -1
  62. package/dist/hooks/use-breakpoint.d.ts.map +1 -1
  63. package/dist/hooks/use-breakpoint.js +10 -10
  64. package/dist/index.cjs +1 -1
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +406 -395
  68. package/dist/input-chip.cjs +1 -1
  69. package/dist/input-chip.d.ts +8 -5
  70. package/dist/input-chip.d.ts.map +1 -1
  71. package/dist/input-chip.js +164 -170
  72. package/dist/input-group.d.ts +1 -1
  73. package/dist/input-password.cjs +1 -1
  74. package/dist/input-password.d.ts +10 -0
  75. package/dist/input-password.d.ts.map +1 -1
  76. package/dist/input-password.js +108 -106
  77. package/dist/link.cjs +1 -1
  78. package/dist/link.d.ts +1 -1
  79. package/dist/link.d.ts.map +1 -1
  80. package/dist/link.js +36 -37
  81. package/dist/list.d.ts +1 -1
  82. package/dist/logo.cjs +1 -1
  83. package/dist/logo.d.ts +6 -1
  84. package/dist/logo.d.ts.map +1 -1
  85. package/dist/logo.js +25 -22
  86. package/dist/map.cjs +1 -0
  87. package/dist/map.d.ts +207 -0
  88. package/dist/map.d.ts.map +1 -0
  89. package/dist/map.js +256 -0
  90. package/dist/pagination.cjs +1 -1
  91. package/dist/pagination.d.ts +29 -3
  92. package/dist/pagination.d.ts.map +1 -1
  93. package/dist/pagination.js +26 -25
  94. package/dist/rating.cjs +1 -1
  95. package/dist/rating.d.ts +6 -0
  96. package/dist/rating.d.ts.map +1 -1
  97. package/dist/rating.js +27 -19
  98. package/dist/resizable.d.ts +1 -1
  99. package/dist/select.cjs +2 -2
  100. package/dist/select.d.ts +7 -1
  101. package/dist/select.d.ts.map +1 -1
  102. package/dist/select.js +52 -51
  103. package/dist/separator.cjs +1 -1
  104. package/dist/separator.d.ts +16 -4
  105. package/dist/separator.d.ts.map +1 -1
  106. package/dist/separator.js +38 -35
  107. package/dist/sheet.cjs +1 -1
  108. package/dist/sheet.d.ts +6 -1
  109. package/dist/sheet.d.ts.map +1 -1
  110. package/dist/sheet.js +42 -41
  111. package/dist/skeleton.cjs +1 -1
  112. package/dist/skeleton.d.ts +5 -0
  113. package/dist/skeleton.d.ts.map +1 -1
  114. package/dist/skeleton.js +13 -11
  115. package/dist/sonner.cjs +1 -1
  116. package/dist/sonner.d.ts.map +1 -1
  117. package/dist/sonner.js +32 -30
  118. package/dist/tabs.cjs +1 -1
  119. package/dist/tabs.d.ts +4 -0
  120. package/dist/tabs.d.ts.map +1 -1
  121. package/dist/tabs.js +101 -52
  122. package/dist/text-reveal-motion.cjs +1 -1
  123. package/dist/text-reveal-motion.d.ts +5 -0
  124. package/dist/text-reveal-motion.d.ts.map +1 -1
  125. package/dist/text-reveal-motion.js +111 -110
  126. package/dist/typography.cjs +1 -1
  127. package/dist/typography.d.ts +1 -2
  128. package/dist/typography.d.ts.map +1 -1
  129. package/dist/typography.js +49 -50
  130. package/package.json +4 -5
  131. package/src/blocks/data-table.tsx +26 -9
  132. package/src/blocks/input-list.tsx +12 -1
  133. package/src/blocks/sidebar.tsx +61 -44
  134. package/src/components/badge.tsx +22 -5
  135. package/src/components/breadcrumb.tsx +43 -26
  136. package/src/components/button.tsx +13 -13
  137. package/src/components/callout.tsx +5 -4
  138. package/src/components/card.tsx +35 -19
  139. package/src/components/carousel.tsx +134 -13
  140. package/src/components/chip.tsx +22 -2
  141. package/src/components/combobox.tsx +18 -3
  142. package/src/components/command.tsx +644 -17
  143. package/src/components/date-picker.tsx +17 -3
  144. package/src/components/dialog.tsx +17 -4
  145. package/src/components/drawer.tsx +2 -2
  146. package/src/components/global-layout.tsx +15 -2
  147. package/src/components/input-chip.tsx +114 -66
  148. package/src/components/input-password.tsx +73 -49
  149. package/src/components/link.tsx +29 -17
  150. package/src/components/logo.tsx +10 -2
  151. package/src/components/map.tsx +597 -0
  152. package/src/components/pagination.tsx +44 -11
  153. package/src/components/rating.tsx +20 -2
  154. package/src/components/select.tsx +9 -1
  155. package/src/components/separator.tsx +40 -25
  156. package/src/components/sheet.tsx +28 -20
  157. package/src/components/skeleton.tsx +13 -2
  158. package/src/components/sonner.tsx +9 -3
  159. package/src/components/tabs.tsx +118 -22
  160. package/src/components/text-reveal-motion.tsx +7 -1
  161. package/src/components/typography.tsx +6 -7
  162. package/src/hooks/use-breakpoint.ts +2 -3
  163. package/src/index.ts +1 -0
@@ -254,6 +254,11 @@ export interface DatePickerTriggerProps extends Omit<
254
254
  * Whether the trigger has an error state
255
255
  */
256
256
  error?: boolean;
257
+ /**
258
+ * Accessible label for the trigger button.
259
+ * @default "Select date" (single) or "Select date range" (range)
260
+ */
261
+ triggerLabel?: string;
257
262
  }
258
263
 
259
264
  /**
@@ -262,7 +267,7 @@ export interface DatePickerTriggerProps extends Omit<
262
267
  const DatePickerTrigger = React.forwardRef<
263
268
  HTMLButtonElement,
264
269
  DatePickerTriggerProps
265
- >(({ className, children, id, error, ...props }, ref) => {
270
+ >(({ className, children, id, error, triggerLabel, ...props }, ref) => {
266
271
  const {
267
272
  mode,
268
273
  date,
@@ -315,6 +320,7 @@ const DatePickerTrigger = React.forwardRef<
315
320
  ref={combinedRef}
316
321
  aria-label={
317
322
  props["aria-label"] ??
323
+ triggerLabel ??
318
324
  (mode === "single" ? "Select date" : "Select date range")
319
325
  }
320
326
  className={cn(
@@ -360,6 +366,11 @@ export interface DatePickerContentProps extends Omit<
360
366
  * Children to render inside the popover
361
367
  */
362
368
  children: React.ReactNode;
369
+ /**
370
+ * Accessible label for the date picker popover.
371
+ * @default "Date picker" (single) or "Date range picker" (range)
372
+ */
373
+ contentLabel?: string;
363
374
  }
364
375
 
365
376
  /**
@@ -368,14 +379,17 @@ export interface DatePickerContentProps extends Omit<
368
379
  const DatePickerContent = React.forwardRef<
369
380
  HTMLDivElement,
370
381
  DatePickerContentProps
371
- >(({ className, children, ...props }, ref) => {
382
+ >(({ className, children, contentLabel, ...props }, ref) => {
372
383
  const { dataHook, mode } = useDatePickerContext();
373
384
 
374
385
  return (
375
386
  <PopoverContent
376
387
  ref={ref}
377
388
  align="start"
378
- aria-label={mode === "single" ? "Date picker" : "Date range picker"}
389
+ aria-label={
390
+ contentLabel ??
391
+ (mode === "single" ? "Date picker" : "Date range picker")
392
+ }
379
393
  className={cn("w-auto rounded-lg p-0", className)}
380
394
  dataHook={`${dataHook}-content`}
381
395
  {...props}
@@ -103,6 +103,11 @@ interface DialogContentProps extends React.ComponentProps<
103
103
  * Tracking label for analytics context
104
104
  */
105
105
  trackingLabel?: string;
106
+ /**
107
+ * Accessible label for the close button.
108
+ * @default "Close"
109
+ */
110
+ closeLabel?: string;
106
111
  }
107
112
 
108
113
  /**
@@ -111,7 +116,15 @@ interface DialogContentProps extends React.ComponentProps<
111
116
  */
112
117
  const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
113
118
  (
114
- { className, children, dataHook, trackingEl, trackingLabel, ...props },
119
+ {
120
+ className,
121
+ children,
122
+ dataHook,
123
+ trackingEl,
124
+ trackingLabel,
125
+ closeLabel,
126
+ ...props
127
+ },
115
128
  ref
116
129
  ) => {
117
130
  return (
@@ -132,7 +145,7 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
132
145
  {children}
133
146
  <DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-8 right-8 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0">
134
147
  <X />
135
- <span className="sr-only">Close</span>
148
+ <span className="sr-only">{closeLabel ?? "Close"}</span>
136
149
  </DialogPrimitive.Close>
137
150
  </DialogPrimitive.Content>
138
151
  </DialogPortal>
@@ -142,7 +155,7 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
142
155
  DialogContent.displayName = "DialogContent";
143
156
 
144
157
  /**
145
- * DialogHeader - Container for dialog title and description
158
+ * DialogHeader - Container for dialog title and description.
146
159
  * @description Groups the title and description at the top of the dialog
147
160
  */
148
161
  const DialogHeader = React.forwardRef<
@@ -159,7 +172,7 @@ const DialogHeader = React.forwardRef<
159
172
  DialogHeader.displayName = "DialogHeader";
160
173
 
161
174
  /**
162
- * DialogFooter - Container for dialog action buttons
175
+ * DialogFooter - Container for dialog action buttons.
163
176
  * @description Groups action buttons at the bottom of the dialog
164
177
  */
165
178
  const DialogFooter = React.forwardRef<
@@ -132,7 +132,7 @@ function DrawerContent({
132
132
  DrawerContent.displayName = "DrawerContent";
133
133
 
134
134
  /**
135
- * DrawerHeader - Container for drawer title and description
135
+ * DrawerHeader - Container for drawer title and description.
136
136
  * @description Groups the title and description at the top of the drawer
137
137
  */
138
138
  function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
@@ -169,7 +169,7 @@ function DrawerBody({ className, ...props }: React.ComponentProps<"div">) {
169
169
  DrawerBody.displayName = "DrawerBody";
170
170
 
171
171
  /**
172
- * DrawerFooter - Container for drawer action buttons
172
+ * DrawerFooter - Container for drawer action buttons.
173
173
  * @description Groups action buttons at the bottom of the drawer
174
174
  */
175
175
  function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
@@ -251,6 +251,11 @@ interface GlobalLayoutMobileHeaderProps extends React.ComponentProps<"div"> {
251
251
  * Data hook for automated testing (required)
252
252
  */
253
253
  dataHook: string;
254
+ /**
255
+ * Accessible label for the mobile navigation toolbar.
256
+ * @default "Mobile navigation"
257
+ */
258
+ ariaLabel?: string;
254
259
  /**
255
260
  * Tracking element identifier for analytics
256
261
  */
@@ -266,13 +271,21 @@ const GlobalLayoutMobileHeader = React.forwardRef<
266
271
  GlobalLayoutMobileHeaderProps
267
272
  >(
268
273
  (
269
- { className, dataHook, trackingEl, trackingLabel, children, ...props },
274
+ {
275
+ className,
276
+ dataHook,
277
+ ariaLabel,
278
+ trackingEl,
279
+ trackingLabel,
280
+ children,
281
+ ...props
282
+ },
270
283
  ref
271
284
  ) => {
272
285
  return (
273
286
  <div
274
287
  ref={ref}
275
- aria-label="Mobile navigation"
288
+ aria-label={ariaLabel ?? "Mobile navigation"}
276
289
  className={cn(
277
290
  "flex w-full items-center justify-start gap-2.5 py-2 lg:hidden",
278
291
  className
@@ -28,18 +28,70 @@ interface InputChipContextValue {
28
28
  chipRefs: React.RefObject<(HTMLDivElement | null)[]>;
29
29
  }
30
30
 
31
- const InputChipContext = React.createContext<InputChipContextValue | null>(
32
- null
33
- );
31
+ interface InputChipDispatchContextValue {
32
+ onValueChange: (value: string[]) => void;
33
+ setInputValue: (value: string) => void;
34
+ addItem: (item: string) => void;
35
+ removeItem: (index: number) => void;
36
+ inputRef: React.RefObject<HTMLInputElement | null>;
37
+ setFocusedChipIndex: (index: number) => void;
38
+ chipRefs: React.RefObject<(HTMLDivElement | null)[]>;
39
+ }
40
+
41
+ interface InputChipValueContextValue {
42
+ value: string[];
43
+ disabled: boolean;
44
+ }
45
+
46
+ interface InputChipInputContextValue {
47
+ inputValue: string;
48
+ focusedChipIndex: number;
49
+ }
50
+
51
+ const InputChipDispatchContext =
52
+ React.createContext<InputChipDispatchContextValue | null>(null);
53
+ const InputChipValueContext =
54
+ React.createContext<InputChipValueContextValue | null>(null);
55
+ const InputChipInputContext =
56
+ React.createContext<InputChipInputContextValue | null>(null);
57
+
58
+ function useInputChipDispatch() {
59
+ const context = React.useContext(InputChipDispatchContext);
60
+ if (!context) {
61
+ throw new Error("InputChip components must be used within an <InputChip>");
62
+ }
63
+ return context;
64
+ }
65
+
66
+ function useInputChipValue() {
67
+ const context = React.useContext(InputChipValueContext);
68
+ if (!context) {
69
+ throw new Error("InputChip components must be used within an <InputChip>");
70
+ }
71
+ return context;
72
+ }
34
73
 
35
- function useInputChipContext() {
36
- const context = React.useContext(InputChipContext);
74
+ function useInputChipInput() {
75
+ const context = React.useContext(InputChipInputContext);
37
76
  if (!context) {
38
77
  throw new Error("InputChip components must be used within an <InputChip>");
39
78
  }
40
79
  return context;
41
80
  }
42
81
 
82
+ function useInputChipContext(): InputChipContextValue {
83
+ const dispatch = useInputChipDispatch();
84
+ const { value, disabled } = useInputChipValue();
85
+ const { inputValue, focusedChipIndex } = useInputChipInput();
86
+ return {
87
+ ...dispatch,
88
+ value,
89
+ disabled,
90
+ inputValue,
91
+ focusedChipIndex,
92
+ };
93
+ }
94
+
43
95
  /* -------------------------------------------------------------------------------------------------
44
96
  * InputChip (Context provider)
45
97
  * -----------------------------------------------------------------------------------------------*/
@@ -98,12 +150,20 @@ function InputChip({
98
150
  const isControlled = controlledValue !== undefined;
99
151
  const value = isControlled ? controlledValue : uncontrolledValue;
100
152
 
153
+ const valueRef = React.useRef(value);
154
+ const controlledOnValueChangeRef = React.useRef(controlledOnValueChange);
155
+ const disabledRef = React.useRef(disabled);
156
+ React.useLayoutEffect(() => {
157
+ valueRef.current = value;
158
+ controlledOnValueChangeRef.current = controlledOnValueChange;
159
+ disabledRef.current = disabled;
160
+ });
161
+
101
162
  // Cleanup when chips are removed: trim refs and reset stale focus index
102
163
  React.useEffect(() => {
103
164
  if (chipRefs.current.length > value.length) {
104
165
  chipRefs.current.length = value.length;
105
166
  }
106
- // Reset focus index if it's out of bounds (e.g., chip was removed externally)
107
167
  if (focusedChipIndex >= value.length) {
108
168
  setFocusedChipIndex(-1);
109
169
  }
@@ -114,64 +174,62 @@ function InputChip({
114
174
  if (!isControlled) {
115
175
  setUncontrolledValue(newValue);
116
176
  }
117
- controlledOnValueChange?.(newValue);
177
+ controlledOnValueChangeRef.current?.(newValue);
118
178
  },
119
- [isControlled, controlledOnValueChange]
179
+ [isControlled]
120
180
  );
121
181
 
122
182
  const addItem = React.useCallback(
123
183
  (item: string) => {
124
- if (disabled) return;
184
+ if (disabledRef.current) return;
125
185
  const trimmed = item.trim();
126
- if (trimmed && (allowDuplicates || !value.includes(trimmed))) {
127
- onValueChange([...value, trimmed]);
186
+ if (trimmed && (allowDuplicates || !valueRef.current.includes(trimmed))) {
187
+ onValueChange([...valueRef.current, trimmed]);
128
188
  setInputValue("");
129
189
  }
130
190
  },
131
- [value, onValueChange, allowDuplicates, disabled]
191
+ [allowDuplicates, onValueChange]
132
192
  );
133
193
 
134
194
  const removeItem = React.useCallback(
135
195
  (index: number) => {
136
- if (disabled) return;
137
- onValueChange(value.filter((_, i) => i !== index));
196
+ if (disabledRef.current) return;
197
+ onValueChange(valueRef.current.filter((_, i) => i !== index));
138
198
  },
139
- [value, onValueChange, disabled]
199
+ [onValueChange]
140
200
  );
141
201
 
142
- const contextValue = React.useMemo<InputChipContextValue>(
202
+ const dispatchValue = React.useMemo<InputChipDispatchContextValue>(
143
203
  () => ({
144
- value,
145
204
  onValueChange,
146
- inputValue,
147
205
  setInputValue,
148
- disabled,
149
206
  addItem,
150
207
  removeItem,
151
208
  inputRef,
152
- focusedChipIndex,
153
209
  setFocusedChipIndex,
154
210
  chipRefs,
155
211
  }),
156
- [
157
- value,
158
- onValueChange,
159
- inputValue,
160
- setInputValue,
161
- disabled,
162
- addItem,
163
- removeItem,
164
- inputRef,
165
- focusedChipIndex,
166
- setFocusedChipIndex,
167
- chipRefs,
168
- ]
212
+ [onValueChange, addItem, removeItem]
213
+ );
214
+
215
+ const valueContextValue = React.useMemo<InputChipValueContextValue>(
216
+ () => ({ value, disabled }),
217
+ [value, disabled]
218
+ );
219
+
220
+ const inputContextValue = React.useMemo<InputChipInputContextValue>(
221
+ () => ({ inputValue, focusedChipIndex }),
222
+ [inputValue, focusedChipIndex]
169
223
  );
170
224
 
171
225
  return (
172
- <InputChipContext.Provider value={contextValue}>
173
- {children}
174
- </InputChipContext.Provider>
226
+ <InputChipDispatchContext.Provider value={dispatchValue}>
227
+ <InputChipValueContext.Provider value={valueContextValue}>
228
+ <InputChipInputContext.Provider value={inputContextValue}>
229
+ {children}
230
+ </InputChipInputContext.Provider>
231
+ </InputChipValueContext.Provider>
232
+ </InputChipDispatchContext.Provider>
175
233
  );
176
234
  }
177
235
 
@@ -290,16 +348,10 @@ const InputChipInput = React.forwardRef<HTMLDivElement, InputChipInputProps>(
290
348
  },
291
349
  ref
292
350
  ) => {
293
- const {
294
- value,
295
- inputValue,
296
- setInputValue,
297
- disabled,
298
- addItem,
299
- inputRef,
300
- setFocusedChipIndex,
301
- chipRefs,
302
- } = useInputChipContext();
351
+ const { setInputValue, addItem, inputRef, setFocusedChipIndex, chipRefs } =
352
+ useInputChipDispatch();
353
+ const { value, disabled } = useInputChipValue();
354
+ const { inputValue } = useInputChipInput();
303
355
 
304
356
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
305
357
  setInputValue(e.target.value);
@@ -368,6 +420,12 @@ export interface InputChipItemsProps {
368
420
  className?: string;
369
421
  /** Data hook prefix for chips */
370
422
  dataHookPrefix?: string;
423
+ /**
424
+ * Accessible label for each chip item.
425
+ * Supports `{item}` placeholder for interpolation.
426
+ * @default "{item}, press Delete to remove"
427
+ */
428
+ itemAriaLabel?: string;
371
429
  }
372
430
 
373
431
  /**
@@ -377,15 +435,11 @@ export interface InputChipItemsProps {
377
435
  function InputChipItems({
378
436
  className,
379
437
  dataHookPrefix = "chip",
438
+ itemAriaLabel,
380
439
  }: InputChipItemsProps) {
381
- const {
382
- value,
383
- disabled,
384
- removeItem,
385
- inputRef,
386
- setFocusedChipIndex,
387
- chipRefs,
388
- } = useInputChipContext();
440
+ const { removeItem, inputRef, setFocusedChipIndex, chipRefs } =
441
+ useInputChipDispatch();
442
+ const { value, disabled } = useInputChipValue();
389
443
 
390
444
  // Track pending focus to apply after DOM updates (avoids race conditions with rapid deletions)
391
445
  const pendingFocusRef = React.useRef<number | "input" | null>(null);
@@ -511,7 +565,11 @@ function InputChipItems({
511
565
  ref={(el) => {
512
566
  chipRefs.current[index] = el;
513
567
  }}
514
- aria-label={`${item}, press Delete to remove`}
568
+ aria-label={
569
+ itemAriaLabel
570
+ ? itemAriaLabel.replace("{item}", item)
571
+ : `${item}, press Delete to remove`
572
+ }
515
573
  dataHook={`${dataHookPrefix}-${index}`}
516
574
  disabled={disabled}
517
575
  role="group"
@@ -532,14 +590,4 @@ function InputChipItems({
532
590
  * Exports
533
591
  * -----------------------------------------------------------------------------------------------*/
534
592
 
535
- // Keep for backwards compatibility
536
- const inputChipVariants = inputChipInputVariants;
537
-
538
- export {
539
- InputChip,
540
- InputChipInput,
541
- InputChipItems,
542
- inputChipVariants,
543
- inputChipInputVariants,
544
- useInputChipContext,
545
- };
593
+ export { InputChip, InputChipInput, InputChipItems, useInputChipContext };
@@ -5,6 +5,7 @@ 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";
8
+
8
9
  import {
9
10
  InputGroup,
10
11
  InputGroupInput,
@@ -336,6 +337,16 @@ export interface InputPasswordFieldProps extends Omit<
336
337
  * Additional class name for the InputGroup wrapper
337
338
  */
338
339
  groupClassName?: string;
340
+ /**
341
+ * Accessible label for the toggle button when password is hidden.
342
+ * @default "Show password"
343
+ */
344
+ showLabel?: string;
345
+ /**
346
+ * Accessible label for the toggle button when password is visible.
347
+ * @default "Hide password"
348
+ */
349
+ hideLabel?: string;
339
350
  }
340
351
 
341
352
  /**
@@ -345,54 +356,63 @@ export interface InputPasswordFieldProps extends Omit<
345
356
  const InputPasswordField = React.forwardRef<
346
357
  HTMLInputElement,
347
358
  InputPasswordFieldProps
348
- >(({ className, groupClassName, onChange, ...props }, ref) => {
349
- const {
350
- showPassword,
351
- toggleVisibility,
352
- password,
353
- setPassword,
354
- disabled,
355
- dataHook,
356
- trackingEl,
357
- trackingLabel,
358
- inputId,
359
- error,
360
- } = useInputPasswordContext();
361
-
362
- const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
363
- setPassword(e.target.value);
364
- onChange?.(e);
365
- };
359
+ >(
360
+ (
361
+ { className, groupClassName, onChange, showLabel, hideLabel, ...props },
362
+ ref
363
+ ) => {
364
+ const {
365
+ showPassword,
366
+ toggleVisibility,
367
+ password,
368
+ setPassword,
369
+ disabled,
370
+ dataHook,
371
+ trackingEl,
372
+ trackingLabel,
373
+ inputId,
374
+ error,
375
+ } = useInputPasswordContext();
366
376
 
367
- return (
368
- <InputGroup className={groupClassName} dataHook={dataHook} error={error}>
369
- <InputGroupInput
370
- ref={ref}
371
- className={className}
372
- disabled={disabled}
373
- id={inputId}
374
- trackingEl={trackingEl}
375
- trackingLabel={trackingLabel}
376
- type={showPassword ? "text" : "password"}
377
- value={password}
378
- onChange={handleChange}
379
- {...props}
380
- />
381
- <InputGroupAddon align="inline-end">
382
- <InputGroupButton
383
- aria-label={showPassword ? "Hide password" : "Show password"}
384
- data-hook={`${dataHook}-toggle`}
377
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
378
+ setPassword(e.target.value);
379
+ onChange?.(e);
380
+ };
381
+
382
+ return (
383
+ <InputGroup className={groupClassName} dataHook={dataHook} error={error}>
384
+ <InputGroupInput
385
+ ref={ref}
386
+ className={className}
385
387
  disabled={disabled}
386
- size="icon-sm"
387
- variant="ghost"
388
- onClick={toggleVisibility}
389
- >
390
- {showPassword ? <EyeOff /> : <Eye />}
391
- </InputGroupButton>
392
- </InputGroupAddon>
393
- </InputGroup>
394
- );
395
- });
388
+ id={inputId}
389
+ trackingEl={trackingEl}
390
+ trackingLabel={trackingLabel}
391
+ type={showPassword ? "text" : "password"}
392
+ value={password}
393
+ onChange={handleChange}
394
+ {...props}
395
+ />
396
+ <InputGroupAddon align="inline-end">
397
+ <InputGroupButton
398
+ aria-label={
399
+ showPassword
400
+ ? (hideLabel ?? "Hide password")
401
+ : (showLabel ?? "Show password")
402
+ }
403
+ data-hook={`${dataHook}-toggle`}
404
+ disabled={disabled}
405
+ size="icon-sm"
406
+ variant="ghost"
407
+ onClick={toggleVisibility}
408
+ >
409
+ {showPassword ? <EyeOff /> : <Eye />}
410
+ </InputGroupButton>
411
+ </InputGroupAddon>
412
+ </InputGroup>
413
+ );
414
+ }
415
+ );
396
416
 
397
417
  InputPasswordField.displayName = "InputPasswordField";
398
418
 
@@ -427,8 +447,8 @@ const InputPasswordToggle = React.forwardRef<
427
447
  (
428
448
  {
429
449
  className,
430
- showLabel = "Show password",
431
- hideLabel = "Hide password",
450
+ showLabel,
451
+ hideLabel,
432
452
  size = "icon",
433
453
  variant = "ghost",
434
454
  ...props
@@ -441,7 +461,11 @@ const InputPasswordToggle = React.forwardRef<
441
461
  return (
442
462
  <InputGroupButton
443
463
  ref={ref}
444
- aria-label={showPassword ? hideLabel : showLabel}
464
+ aria-label={
465
+ showPassword
466
+ ? (hideLabel ?? "Hide password")
467
+ : (showLabel ?? "Show password")
468
+ }
445
469
  className={className}
446
470
  data-hook={`${dataHook}-toggle`}
447
471
  disabled={disabled}
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { ExternalLink } from "@brightlocal/icons";
3
- import { Slot } from "@radix-ui/react-slot";
3
+ import { Slot, Slottable } from "@radix-ui/react-slot";
4
4
  import { cva, type VariantProps } from "class-variance-authority";
5
5
 
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -55,7 +55,7 @@ export interface LinkProps
55
55
  */
56
56
  external?: boolean;
57
57
  /**
58
- * If true, shows the external link icon when external is true
58
+ * If true, shows the external link icon when external is true.
59
59
  * @default true
60
60
  */
61
61
  showExternalIcon?: boolean;
@@ -76,27 +76,39 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
76
76
  },
77
77
  ref
78
78
  ) => {
79
- const Comp = asChild ? Slot : "a";
80
79
  const externalProps = external
81
80
  ? { target: "_blank", rel: "noopener noreferrer" }
82
81
  : {};
83
82
 
83
+ const sharedProps = {
84
+ ref,
85
+ className: cn(linkVariants(), className),
86
+ "data-hook": dataHook,
87
+ "data-slot": "link" as const,
88
+ "data-tracking-el": trackingEl || "link-default",
89
+ "data-tracking-label": trackingLabel,
90
+ ...externalProps,
91
+ ...props,
92
+ };
93
+
94
+ const externalIcon = external && showExternalIcon && (
95
+ <ExternalLink aria-hidden="true" data-slot="external-icon" />
96
+ );
97
+
98
+ if (asChild) {
99
+ return (
100
+ <Slot {...sharedProps}>
101
+ <Slottable>{children}</Slottable>
102
+ {externalIcon}
103
+ </Slot>
104
+ );
105
+ }
106
+
84
107
  return (
85
- <Comp
86
- ref={ref}
87
- className={cn(linkVariants(), className)}
88
- data-hook={dataHook}
89
- data-slot="link"
90
- data-tracking-el={trackingEl || "link-default"}
91
- data-tracking-label={trackingLabel}
92
- {...externalProps}
93
- {...props}
94
- >
108
+ <a {...sharedProps}>
95
109
  {children}
96
- {external && showExternalIcon && (
97
- <ExternalLink aria-hidden="true" data-slot="external-icon" />
98
- )}
99
- </Comp>
110
+ {externalIcon}
111
+ </a>
100
112
  );
101
113
  }
102
114
  );