UNPKG

@kit-data-manager/react-search-component

Version:

All-in-one component for rendering an elastic search UI for searching anything. Built-in support for visualizing related items in a graph and resolving unique identifiers.

25 lines 5.01 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import * as React from "react"; import * as SelectPrimitive from "@radix-ui/react-select"; import { Check, ChevronDown, ChevronUp } from "lucide-react"; import { cn } from "../../lib/utils"; const Select = SelectPrimitive.Root; const SelectGroup = SelectPrimitive.Group; const SelectValue = SelectPrimitive.Value; const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn("rfs:flex rfs:h-10 rfs:w-full rfs:items-center rfs:justify-between rfs:rounded-md rfs:border rfs:border-input rfs:bg-background rfs:px-3 rfs:py-2 rfs:text-sm rfs:ring-offset-background rfs:data-[placeholder]:text-muted-foreground rfs:focus:outline-none rfs:focus:ring-2 rfs:focus:ring-ring rfs:focus:ring-offset-2 rfs:disabled:cursor-not-allowed rfs:disabled:opacity-50 rfs:[&>span]:line-clamp-1", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: "rfs:h-4 rfs:w-4 rfs:opacity-50" }) })] }))); SelectTrigger.displayName = SelectPrimitive.Trigger.displayName; const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn("rfs:flex rfs:cursor-default rfs:items-center rfs:justify-center rfs:py-1", className), ...props, children: _jsx(ChevronUp, { className: "rfs:h-4 rfs:w-4" }) }))); SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName; const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollDownButton, { ref: ref, className: cn("rfs:flex rfs:cursor-default rfs:items-center rfs:justify-center rfs:py-1", className), ...props, children: _jsx(ChevronDown, { className: "rfs:h-4 rfs:w-4" }) }))); SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName; const SelectContent = React.forwardRef(({ className, children, position = "popper", ...props }, ref) => (_jsx(SelectPrimitive.Portal, { children: _jsx("div", { className: "rfs:contents rfs-root", children: _jsxs(SelectPrimitive.Content, { ref: ref, className: cn("rfs:relative rfs:z-50 rfs:max-h-[--radix-select-content-available-height] rfs:min-w-[8rem] rfs:overflow-y-auto rfs:overflow-x-hidden rfs:rounded-md rfs:border rfs:border-input rfs:bg-popover rfs:text-popover-foreground rfs:shadow-md rfs:data-[state=open]:animate-in rfs:data-[state=closed]:animate-out rfs:data-[state=closed]:fade-out-0 rfs:data-[state=open]:fade-in-0 rfs:data-[state=closed]:zoom-out-95 rfs:data-[state=open]:zoom-in-95 rfs:data-[side=bottom]:slide-in-from-top-2 rfs:data-[side=left]:slide-in-from-right-2 rfs:data-[side=right]:slide-in-from-left-2 rfs:data-[side=top]:slide-in-from-bottom-2 rfs:origin-[--radix-select-content-transform-origin]", position === "popper" && "rfs:data-[side=bottom]:translate-y-1 rfs:data-[side=left]:-translate-x-1 rfs:data-[side=right]:translate-x-1 rfs:data-[side=top]:-translate-y-1", className), position: position, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { className: cn("rfs:p-1", position === "popper" && "rfs:h-[var(--radix-select-trigger-height)] rfs:w-full rfs:min-w-[var(--radix-select-trigger-width)]"), children: children }), _jsx(SelectScrollDownButton, {})] }) }) }))); SelectContent.displayName = SelectPrimitive.Content.displayName; const SelectLabel = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Label, { ref: ref, className: cn("rfs:py-1.5 rfs:pl-8 rfs:pr-2 rfs:text-sm rfs:font-semibold", className), ...props }))); SelectLabel.displayName = SelectPrimitive.Label.displayName; const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref, className: cn("rfs:relative rfs:flex rfs:w-full rfs:cursor-default rfs:select-none rfs:items-center rfs:rounded-sm rfs:py-1.5 rfs:pl-8 rfs:pr-2 rfs:text-sm rfs:outline-none rfs:focus:bg-accent rfs:focus:text-accent-foreground rfs:data-[disabled]:pointer-events-none rfs:data-[disabled]:opacity-50", className), ...props, children: [_jsx("span", { className: "rfs:absolute rfs:left-2 rfs:flex rfs:h-3.5 rfs:w-3.5 rfs:items-center rfs:justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Check, { className: "rfs:h-4 rfs:w-4" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] }))); SelectItem.displayName = SelectPrimitive.Item.displayName; const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Separator, { ref: ref, className: cn("rfs:-mx-1 rfs:my-1 rfs:h-px rfs:bg-muted", className), ...props }))); SelectSeparator.displayName = SelectPrimitive.Separator.displayName; export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton }; //# sourceMappingURL=select.js.map