@brightlocal/ui-components 1.4.0 → 1.4.2

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.
@@ -187,7 +187,6 @@ const comboboxTriggerVariants = cva(
187
187
 
188
188
  // Disabled state
189
189
  "disabled:cursor-not-allowed disabled:opacity-50",
190
- "disabled:hover:bg-neutral-50",
191
190
 
192
191
  // Transitions
193
192
  "transition-[background-color,border-color,box-shadow] duration-200 ease-out",
@@ -468,14 +467,18 @@ function ComboboxContent({
468
467
  align={align}
469
468
  aria-label="Options"
470
469
  avoidCollisions={avoidCollisions}
471
- className={cn("w-[var(--radix-popover-trigger-width)] p-0", className)}
470
+ className={cn(
471
+ "flex max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)] flex-col overflow-hidden p-0",
472
+ className
473
+ )}
472
474
  data-slot="combobox-popover"
473
475
  side={lockedSide ?? side}
474
476
  sideOffset={sideOffset}
475
477
  >
476
478
  <Command
477
479
  className={cn(
478
- "border-0 shadow-none",
480
+ "min-h-0 flex-1 border-0 shadow-none",
481
+ "[&_[data-slot='command-input-wrapper']]:shrink-0",
479
482
  hideList && "[&_[data-slot='command-input-wrapper']]:border-b-0"
480
483
  )}
481
484
  data-slot="combobox-command"
@@ -519,8 +522,15 @@ export type ComboboxListProps = React.ComponentProps<typeof CommandList>;
519
522
  const ComboboxList = React.forwardRef<
520
523
  React.ComponentRef<typeof CommandList>,
521
524
  ComboboxListProps
522
- >((props, ref) => {
523
- return <CommandList ref={ref} data-slot="combobox-list" {...props} />;
525
+ >(({ className, ...props }, ref) => {
526
+ return (
527
+ <CommandList
528
+ ref={ref}
529
+ className={cn("min-h-0 flex-1", className)}
530
+ data-slot="combobox-list"
531
+ {...props}
532
+ />
533
+ );
524
534
  });
525
535
  ComboboxList.displayName = "ComboboxList";
526
536
 
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
2
3
  import { cva } from "class-variance-authority";
3
4
 
4
5
  import { cn } from "@brightlocal/ui-components/lib/utils";
@@ -26,7 +27,7 @@ const itemVariants = cva(
26
27
  variant: {
27
28
  filled: ["bg-card"],
28
29
  outline: ["bg-background", "border", "border-border"],
29
- loading: ["flex-col", "gap-2", "px-0", "pt-0", "pb-2"],
30
+ loading: ["flex-col", "gap-2", "px-0", "pt-0", "pb-3"],
30
31
  },
31
32
  },
32
33
  defaultVariants: {
@@ -99,6 +100,11 @@ List.displayName = "List";
99
100
  * Extends native `<li>` props with CVA variant styling and optional testing/analytics attributes.
100
101
  */
101
102
  export type ItemProps = React.ComponentProps<"li"> & {
103
+ /**
104
+ * Render as the child element instead of `<li>`.
105
+ * Useful when the item is wrapped by another element (e.g. `<motion.li>`).
106
+ */
107
+ asChild?: boolean;
102
108
  /**
103
109
  * Visual style of the item row.
104
110
  * - `filled` — card background (default)
@@ -128,6 +134,7 @@ export type ItemProps = React.ComponentProps<"li"> & {
128
134
  const Item = React.forwardRef<HTMLLIElement, ItemProps>(
129
135
  (
130
136
  {
137
+ asChild = false,
131
138
  className,
132
139
  variant,
133
140
  dataHook,
@@ -137,26 +144,30 @@ const Item = React.forwardRef<HTMLLIElement, ItemProps>(
137
144
  ...props
138
145
  },
139
146
  ref
140
- ) => (
141
- <li
142
- ref={ref}
143
- className={cn(itemVariants({ variant }), className)}
144
- data-hook={dataHook}
145
- data-slot="item"
146
- data-tracking-el={trackingEl}
147
- data-tracking-label={trackingLabel}
148
- {...props}
149
- >
150
- {variant === "loading" ? (
151
- <>
152
- <Skeleton className="h-4 w-full" />
153
- <Skeleton className="h-4 w-full" />
154
- </>
155
- ) : (
156
- children
157
- )}
158
- </li>
159
- )
147
+ ) => {
148
+ const Comp = asChild ? Slot : "li";
149
+
150
+ return (
151
+ <Comp
152
+ ref={ref}
153
+ className={cn(itemVariants({ variant }), className)}
154
+ data-hook={dataHook}
155
+ data-slot="item"
156
+ data-tracking-el={trackingEl}
157
+ data-tracking-label={trackingLabel}
158
+ {...props}
159
+ >
160
+ {variant === "loading" ? (
161
+ <>
162
+ <Skeleton className="h-4 w-full" />
163
+ <Skeleton className="h-4 w-full" />
164
+ </>
165
+ ) : (
166
+ children
167
+ )}
168
+ </Comp>
169
+ );
170
+ }
160
171
  );
161
172
  Item.displayName = "Item";
162
173
 
@@ -147,7 +147,7 @@ function SelectTrigger({
147
147
  const ariaLabel = props["aria-label"] || placeholder || "Select an option";
148
148
 
149
149
  const errorStyles = isError
150
- ? "border-destructive-40 " +
150
+ ? "border-destructive-40 dark:border-destructive-40 " +
151
151
  "focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive " +
152
152
  "data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive"
153
153
  : "";