UNPKG

@llamaindex/ui

Version:

A comprehensive UI component library built with React, TypeScript, and Tailwind CSS for LlamaIndex applications

232 lines (229 loc) 8.76 kB
import { cn } from './chunk-MG2ARK3A.mjs'; import { __objRest, __spreadValues, __spreadProps } from './chunk-FWCSY2DS.mjs'; import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'; import { CheckIcon, CircleIcon, ChevronRightIcon } from 'lucide-react'; import { jsx, jsxs } from 'react/jsx-runtime'; function DropdownMenu(_a) { var props = __objRest(_a, []); return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, __spreadValues({ "data-slot": "dropdown-menu" }, props)); } function DropdownMenuPortal(_a) { var props = __objRest(_a, []); return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, __spreadValues({ "data-slot": "dropdown-menu-portal" }, props)); } function DropdownMenuTrigger(_a) { var props = __objRest(_a, []); return /* @__PURE__ */ jsx( DropdownMenuPrimitive.Trigger, __spreadValues({ "data-slot": "dropdown-menu-trigger" }, props) ); } function DropdownMenuContent(_a) { var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, [ "className", "sideOffset" ]); return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx( DropdownMenuPrimitive.Content, __spreadValues({ "data-slot": "dropdown-menu-content", sideOffset, className: cn( "bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", className ) }, props) ) }); } function DropdownMenuGroup(_a) { var props = __objRest(_a, []); return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Group, __spreadValues({ "data-slot": "dropdown-menu-group" }, props)); } function DropdownMenuItem(_a) { var _b = _a, { className, inset, variant = "default" } = _b, props = __objRest(_b, [ "className", "inset", "variant" ]); return /* @__PURE__ */ jsx( DropdownMenuPrimitive.Item, __spreadValues({ "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: cn( "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className ) }, props) ); } function DropdownMenuCheckboxItem(_a) { var _b = _a, { className, children, checked } = _b, props = __objRest(_b, [ "className", "children", "checked" ]); return /* @__PURE__ */ jsxs( DropdownMenuPrimitive.CheckboxItem, __spreadProps(__spreadValues({ "data-slot": "dropdown-menu-checkbox-item", className: cn( "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className ), checked }, props), { children: [ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }), children ] }) ); } function DropdownMenuRadioGroup(_a) { var props = __objRest(_a, []); return /* @__PURE__ */ jsx( DropdownMenuPrimitive.RadioGroup, __spreadValues({ "data-slot": "dropdown-menu-radio-group" }, props) ); } function DropdownMenuRadioItem(_a) { var _b = _a, { className, children } = _b, props = __objRest(_b, [ "className", "children" ]); return /* @__PURE__ */ jsxs( DropdownMenuPrimitive.RadioItem, __spreadProps(__spreadValues({ "data-slot": "dropdown-menu-radio-item", className: cn( "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className ) }, props), { children: [ /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) }) }), children ] }) ); } function DropdownMenuLabel(_a) { var _b = _a, { className, inset } = _b, props = __objRest(_b, [ "className", "inset" ]); return /* @__PURE__ */ jsx( DropdownMenuPrimitive.Label, __spreadValues({ "data-slot": "dropdown-menu-label", "data-inset": inset, className: cn( "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className ) }, props) ); } function DropdownMenuSeparator(_a) { var _b = _a, { className } = _b, props = __objRest(_b, [ "className" ]); return /* @__PURE__ */ jsx( DropdownMenuPrimitive.Separator, __spreadValues({ "data-slot": "dropdown-menu-separator", className: cn("bg-border -mx-1 my-1 h-px", className) }, props) ); } function DropdownMenuShortcut(_a) { var _b = _a, { className } = _b, props = __objRest(_b, [ "className" ]); return /* @__PURE__ */ jsx( "span", __spreadValues({ "data-slot": "dropdown-menu-shortcut", className: cn( "text-muted-foreground ml-auto text-xs tracking-widest", className ) }, props) ); } function DropdownMenuSub(_a) { var props = __objRest(_a, []); return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, __spreadValues({ "data-slot": "dropdown-menu-sub" }, props)); } function DropdownMenuSubTrigger(_a) { var _b = _a, { className, inset, children } = _b, props = __objRest(_b, [ "className", "inset", "children" ]); return /* @__PURE__ */ jsxs( DropdownMenuPrimitive.SubTrigger, __spreadProps(__spreadValues({ "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: cn( "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8", className ) }, props), { children: [ children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4" }) ] }) ); } function DropdownMenuSubContent(_a) { var _b = _a, { className } = _b, props = __objRest(_b, [ "className" ]); return /* @__PURE__ */ jsx( DropdownMenuPrimitive.SubContent, __spreadValues({ "data-slot": "dropdown-menu-sub-content", className: cn( "bg-popover text-popover-foreground 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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", className ) }, props) ); } export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };