Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

fix(web): port shadcn v4 styles for select, tooltip, inputs and command (#3169)

Mohamed Bassem3482c27b82c2
diff --git a/apps/web/components/dashboard/bookmarks/EditorCard.tsx b/apps/web/components/dashboard/bookmarks/EditorCard.tsx
index 76424a38..a4e139dd 100644
--- a/apps/web/components/dashboard/bookmarks/EditorCard.tsx
+++ b/apps/web/components/dashboard/bookmarks/EditorCard.tsx
@@ -206,7 +206,7 @@ export default function EditorCard({ className }: { className?: string }) {
ref={inputRef}
disabled={isPending}
className={cn(
- "text-md h-full w-full border-none p-0 font-light focus-visible:ring-0",
+ "h-full w-full border-none p-0 text-base font-light shadow-none focus-visible:ring-0 dark:bg-transparent md:text-base",
{ "resize-none": bookmarkLayout !== "list" },
)}
placeholder={t("editor.placeholder_v2")}
diff --git a/apps/web/components/dashboard/lists/BookmarkListSelector.tsx b/apps/web/components/dashboard/lists/BookmarkListSelector.tsx
index 154732c4..4b6fd0a1 100644
--- a/apps/web/components/dashboard/lists/BookmarkListSelector.tsx
+++ b/apps/web/components/dashboard/lists/BookmarkListSelector.tsx
@@ -112,7 +112,7 @@ function ListSelectorComponent({
>
<Check
className={cn(
- "mr-2 h-4 w-4",
+ "h-4 w-4",
isItemSelected(l.id) ? "opacity-100" : "opacity-0",
)}
/>
diff --git a/apps/web/components/dashboard/rules/RuleEngineActionBuilder.tsx b/apps/web/components/dashboard/rules/RuleEngineActionBuilder.tsx
index c66cbdb2..82ed3304 100644
--- a/apps/web/components/dashboard/rules/RuleEngineActionBuilder.tsx
+++ b/apps/web/components/dashboard/rules/RuleEngineActionBuilder.tsx
@@ -127,7 +127,7 @@ export function ActionBuilder({ value, onChange }: ActionBuilderProps) {
)
}
>
- <SelectTrigger className="ml-2 h-8 w-auto border-none bg-transparent px-2">
+ <SelectTrigger className="ml-2 h-8 w-auto border-none bg-transparent px-2 shadow-none dark:bg-transparent dark:hover:bg-transparent">
<SelectValue />
</SelectTrigger>
<SelectContent>
diff --git a/apps/web/components/dashboard/rules/RuleEngineConditionBuilder.tsx b/apps/web/components/dashboard/rules/RuleEngineConditionBuilder.tsx
index 12b0a0d9..d8a27cf2 100644
--- a/apps/web/components/dashboard/rules/RuleEngineConditionBuilder.tsx
+++ b/apps/web/components/dashboard/rules/RuleEngineConditionBuilder.tsx
@@ -312,7 +312,7 @@ export function ConditionBuilder({
const conditionSelector = (
<Select value={value.type} onValueChange={handleTypeChange}>
- <SelectTrigger className="ml-2 h-8 border-none bg-transparent px-2">
+ <SelectTrigger className="ml-2 h-8 border-none bg-transparent px-2 shadow-none dark:bg-transparent dark:hover:bg-transparent">
<SelectValue />
</SelectTrigger>
<SelectContent>
diff --git a/apps/web/components/dashboard/search/QueryExplainerTooltip.tsx b/apps/web/components/dashboard/search/QueryExplainerTooltip.tsx
index 3acfadb3..0d2c3a0a 100644
--- a/apps/web/components/dashboard/search/QueryExplainerTooltip.tsx
+++ b/apps/web/components/dashboard/search/QueryExplainerTooltip.tsx
@@ -260,7 +260,7 @@ export default function QueryExplainerTooltip({
const body = (
<>
{header}
- <Table>
+ <Table className="[&_tr:hover]:bg-transparent">
<TableBody>
{parsedSearchQuery.text && (
<TableRow>
diff --git a/apps/web/components/dashboard/search/SearchInput.tsx b/apps/web/components/dashboard/search/SearchInput.tsx
index ed3aeb1e..57791053 100644
--- a/apps/web/components/dashboard/search/SearchInput.tsx
+++ b/apps/web/components/dashboard/search/SearchInput.tsx
@@ -289,7 +289,7 @@ const SearchInput = React.forwardRef<
}}
className="cursor-pointer"
>
- <item.Icon className="mr-2 h-4 w-4" />
+ <item.Icon className="h-4 w-4" />
<span>{item.label}</span>
</CommandItem>
);
@@ -302,7 +302,7 @@ const SearchInput = React.forwardRef<
onSelect={() => handleSuggestionSelect(item)}
className="cursor-pointer"
>
- <item.Icon className="mr-2 h-4 w-4" />
+ <item.Icon className="h-4 w-4" />
<div className="flex flex-col">
<span>{item.label}</span>
{item.description && (
diff --git a/apps/web/components/dashboard/tags/TagAutocomplete.tsx b/apps/web/components/dashboard/tags/TagAutocomplete.tsx
index 656d4c5a..80cc265d 100644
--- a/apps/web/components/dashboard/tags/TagAutocomplete.tsx
+++ b/apps/web/components/dashboard/tags/TagAutocomplete.tsx
@@ -117,7 +117,7 @@ export function TagAutocomplete({
>
<Check
className={cn(
- "mr-2 h-4 w-4",
+ "h-4 w-4",
selectedTag?.id === tag.id ? "opacity-100" : "opacity-0",
)}
/>
diff --git a/apps/web/components/ui/command.tsx b/apps/web/components/ui/command.tsx
index d6ed6ba1..4e9c4b0e 100644
--- a/apps/web/components/ui/command.tsx
+++ b/apps/web/components/ui/command.tsx
@@ -40,8 +40,8 @@ const CommandInput = React.forwardRef<
>(({ className, ...props }, ref) => (
// https://github.com/shadcn-ui/ui/issues/3366
// eslint-disable-next-line react/no-unknown-property
- <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
- <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
+ <div className="flex items-center gap-2 border-b px-3" cmdk-input-wrapper="">
+ <Search className="size-4 shrink-0 opacity-50" />
<CommandPrimitive.Input
ref={ref}
className={cn(
@@ -61,7 +61,10 @@ const CommandList = React.forwardRef<
>(({ className, ...props }, ref) => (
<CommandPrimitive.List
ref={ref}
- className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
+ className={cn(
+ "max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden",
+ className,
+ )}
{...props}
/>
));
@@ -116,7 +119,7 @@ const CommandItem = React.forwardRef<
<CommandPrimitive.Item
ref={ref}
className={cn(
- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
className,
)}
{...props}
diff --git a/apps/web/components/ui/dialog.tsx b/apps/web/components/ui/dialog.tsx
index c748a22a..ad415008 100644
--- a/apps/web/components/ui/dialog.tsx
+++ b/apps/web/components/ui/dialog.tsx
@@ -76,7 +76,7 @@ const DialogFooter = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
className,
)}
{...props}
diff --git a/apps/web/components/ui/input.tsx b/apps/web/components/ui/input.tsx
index ff52d19b..8bfbf2d7 100644
--- a/apps/web/components/ui/input.tsx
+++ b/apps/web/components/ui/input.tsx
@@ -18,7 +18,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
<input
type={type}
className={cn(
- "flex h-10 w-full rounded-md border border-input bg-background px-4 py-2 text-sm transition-[color,box-shadow] file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",
+ "flex h-10 w-full rounded-md border border-input bg-background px-4 py-2 text-base shadow-sm transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/20 dark:bg-input/30 dark:aria-[invalid=true]:ring-destructive/40 md:text-sm",
startIcon ? "pl-8" : "",
endIcon ? "pr-8" : "",
className,
diff --git a/apps/web/components/ui/select.tsx b/apps/web/components/ui/select.tsx
index 6d434fb2..e4460c3e 100644
--- a/apps/web/components/ui/select.tsx
+++ b/apps/web/components/ui/select.tsx
@@ -18,7 +18,7 @@ const SelectTrigger = React.forwardRef<
<SelectPrimitive.Trigger
ref={ref}
className={cn(
- "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm transition-[color,box-shadow] placeholder:text-muted-foreground focus:outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
+ "flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-[color,box-shadow] focus:outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/20 data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 dark:aria-[invalid=true]:ring-destructive/40 [&>span]:line-clamp-1 [&_svg]:pointer-events-none [&_svg]:shrink-0",
className,
)}
{...props}
@@ -74,7 +74,7 @@ const SelectContent = React.forwardRef<
<SelectPrimitive.Content
ref={ref}
className={cn(
- "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ "relative z-50 max-h-96 min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className,
@@ -104,7 +104,7 @@ const SelectLabel = React.forwardRef<
>(({ className, ...props }, ref) => (
<SelectPrimitive.Label
ref={ref}
- className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
+ className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
{...props}
/>
));
@@ -117,12 +117,12 @@ const SelectItem = React.forwardRef<
<SelectPrimitive.Item
ref={ref}
className={cn(
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>span:last-child]:flex [&>span:last-child]:items-center [&>span:last-child]:gap-2 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
className,
)}
{...props}
>
- <span className="absolute left-2 flex size-3.5 items-center justify-center">
+ <span className="absolute end-2 flex size-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<Check className="size-4" />
</SelectPrimitive.ItemIndicator>
@@ -139,7 +139,7 @@ const SelectSeparator = React.forwardRef<
>(({ className, ...props }, ref) => (
<SelectPrimitive.Separator
ref={ref}
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
+ className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
{...props}
/>
));
diff --git a/apps/web/components/ui/skeleton.tsx b/apps/web/components/ui/skeleton.tsx
index 2cdf440d..41a92776 100644
--- a/apps/web/components/ui/skeleton.tsx
+++ b/apps/web/components/ui/skeleton.tsx
@@ -6,7 +6,7 @@ function Skeleton({
}: React.HTMLAttributes<HTMLDivElement>) {
return (
<div
- className={cn("animate-pulse rounded-md bg-muted", className)}
+ className={cn("animate-pulse rounded-md bg-accent", className)}
{...props}
/>
);
diff --git a/apps/web/components/ui/sonner.tsx b/apps/web/components/ui/sonner.tsx
index d281f4ae..0d180f65 100644
--- a/apps/web/components/ui/sonner.tsx
+++ b/apps/web/components/ui/sonner.tsx
@@ -29,7 +29,7 @@ const Toaster = ({ ...props }: ToasterProps) => {
toastOptions={{
classNames: {
toast:
- "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
+ "group toast group-[.toaster]:bg-popover group-[.toaster]:text-popover-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
description: "group-[.toast]:text-muted-foreground",
actionButton:
"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
diff --git a/apps/web/components/ui/tooltip.tsx b/apps/web/components/ui/tooltip.tsx
index 020f6151..6f546051 100644
--- a/apps/web/components/ui/tooltip.tsx
+++ b/apps/web/components/ui/tooltip.tsx
@@ -14,16 +14,19 @@ const TooltipPortal = TooltipPrimitive.Portal;
const TooltipContent = React.forwardRef<
React.ElementRef<typeof TooltipPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
->(({ className, sideOffset = 4, ...props }, ref) => (
+>(({ className, sideOffset = 0, children, ...props }, ref) => (
<TooltipPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={cn(
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ "z-50 w-fit origin-[--radix-tooltip-content-transform-origin] text-balance rounded-md bg-foreground px-3 py-1.5 text-xs text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className,
)}
{...props}
- />
+ >
+ {children}
+ <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
+ </TooltipPrimitive.Content>
));
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
diff --git a/packages/shared-react/components/ui/button.tsx b/packages/shared-react/components/ui/button.tsx
index ecb2a717..287c40c0 100644
--- a/packages/shared-react/components/ui/button.tsx
+++ b/packages/shared-react/components/ui/button.tsx
@@ -5,7 +5,7 @@ import { Slot } from "@radix-ui/react-slot";
import { cva } from "class-variance-authority";
const buttonVariants = cva(
- "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50",
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/20 dark:aria-[invalid=true]:ring-destructive/40",
{
variants: {
variant: {
diff --git a/packages/shared-react/components/ui/popover.tsx b/packages/shared-react/components/ui/popover.tsx
index 30645cc8..3f03dcf5 100644
--- a/packages/shared-react/components/ui/popover.tsx
+++ b/packages/shared-react/components/ui/popover.tsx
@@ -18,7 +18,7 @@ const PopoverContent = React.forwardRef<
align={align}
sideOffset={sideOffset}
className={cn(
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ "z-50 w-72 origin-[--radix-popover-content-transform-origin] rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className,
)}
{...props}
diff --git a/packages/shared-react/components/ui/textarea.tsx b/packages/shared-react/components/ui/textarea.tsx
index 242f5f8c..db2e377e 100644
--- a/packages/shared-react/components/ui/textarea.tsx
+++ b/packages/shared-react/components/ui/textarea.tsx
@@ -8,7 +8,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
return (
<textarea
className={cn(
- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",
+ "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base shadow-sm transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/20 dark:bg-input/30 dark:aria-[invalid=true]:ring-destructive/40 md:text-sm",
className,
)}
ref={ref}