UNPKG

@arolariu/components

Version:

🎨 70+ beautiful, accessible React components built on Radix UI. TypeScript-first, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡

93 lines (92 loc) • 5.59 kB
"use client"; import { jsx, jsxs } from "react/jsx-runtime"; import { Content, Group, Icon, Item, ItemIndicator, ItemText, Label, Portal, Root, ScrollDownButton, ScrollUpButton, Separator, Trigger, Value, Viewport } from "@radix-ui/react-select"; import { Check, ChevronDown, ChevronUp } from "lucide-react"; import { forwardRef } from "react"; import { cn } from "../../lib/utilities.js"; const Select = Root; const SelectGroup = Group; const SelectValue = Value; const SelectTrigger = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>/*#__PURE__*/ jsxs(Trigger, { ref: ref, className: cn("flex h-9 w-full items-center justify-between rounded-md border border-neutral-200 bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-sm ring-offset-white focus:ring-1 focus:ring-neutral-950 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-neutral-500 dark:border-neutral-800 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[placeholder]:text-neutral-400 [&>span]:line-clamp-1", className), ...props, children: [ children, /*#__PURE__*/ jsx(Icon, { asChild: true, children: /*#__PURE__*/ jsx(ChevronDown, { className: "h-4 w-4 opacity-50" }) }) ] })); SelectTrigger.displayName = Trigger.displayName; const SelectScrollUpButton = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ScrollUpButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: /*#__PURE__*/ jsx(ChevronUp, { className: "h-4 w-4" }) })); SelectScrollUpButton.displayName = ScrollUpButton.displayName; const SelectScrollDownButton = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ScrollDownButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: /*#__PURE__*/ jsx(ChevronDown, { className: "h-4 w-4" }) })); SelectScrollDownButton.displayName = ScrollDownButton.displayName; const SelectContent = /*#__PURE__*/ forwardRef(({ className, children, position = "popper", ...props }, ref)=>/*#__PURE__*/ jsx(Portal, { children: /*#__PURE__*/ jsxs(Content, { ref: ref, className: cn("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-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-x-hidden overflow-y-auto rounded-md border border-neutral-200 bg-white text-neutral-950 shadow-md dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50", "popper" === position && "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), position: position, ...props, children: [ /*#__PURE__*/ jsx(SelectScrollUpButton, {}), /*#__PURE__*/ jsx(Viewport, { className: cn("p-1", "popper" === position && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"), children: children }), /*#__PURE__*/ jsx(SelectScrollDownButton, {}) ] }) })); SelectContent.displayName = Content.displayName; const SelectLabel = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Label, { ref: ref, className: cn("px-2 py-1.5 text-sm font-semibold", className), ...props })); SelectLabel.displayName = Label.displayName; const SelectItem = /*#__PURE__*/ forwardRef(({ className, children, ...props }, ref)=>/*#__PURE__*/ jsxs(Item, { ref: ref, className: cn("relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50", className), ...props, children: [ /*#__PURE__*/ jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /*#__PURE__*/ jsx(ItemIndicator, { children: /*#__PURE__*/ jsx(Check, { className: "h-4 w-4" }) }) }), /*#__PURE__*/ jsx(ItemText, { children: children }) ] })); SelectItem.displayName = Item.displayName; const SelectSeparator = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-neutral-100 dark:bg-neutral-800", className), ...props })); SelectSeparator.displayName = Separator.displayName; export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue }; //# sourceMappingURL=select.js.map