fumadocs-openapi
Version:
Generate MDX docs for your OpenAPI spec
75 lines (73 loc) • 3.75 kB
JavaScript
import { cn } from "../../utils/cn.js";
import { forwardRef } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
import { Check, ChevronDown, ChevronUp } from "lucide-react";
import * as SelectPrimitive from "@radix-ui/react-select";
//#region src/ui/components/select.tsx
const Select = SelectPrimitive.Root;
const SelectGroup = SelectPrimitive.Group;
const SelectValue = SelectPrimitive.Value;
const SelectTrigger = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
ref,
className: cn("flex items-center w-full rounded-md border p-2 gap-2 text-start text-sm text-fd-secondary-foreground bg-fd-secondary hover:bg-fd-accent focus:outline-none focus:ring focus:ring-fd-ring disabled:cursor-not-allowed disabled:opacity-50", className),
...props,
children: [children, /* @__PURE__ */ jsx(SelectPrimitive.Icon, {
asChild: true,
children: /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto size-3.5 text-fd-muted-foreground shrink-0" })
})]
}));
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
const SelectScrollUpButton = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.ScrollUpButton, {
ref,
className: cn("flex items-center justify-center py-1", className),
...props,
children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-4" })
}));
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
const SelectScrollDownButton = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, {
ref,
className: cn("flex items-center justify-center py-1", className),
...props,
children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" })
}));
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
const SelectContent = forwardRef(({ className, children, position, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(SelectPrimitive.Content, {
ref,
className: cn("z-50 overflow-hidden rounded-lg border bg-fd-popover text-fd-popover-foreground shadow-md", className),
position,
...props,
children: [
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
/* @__PURE__ */ jsx(SelectPrimitive.Viewport, {
className: "p-1",
children
}),
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
]
}) }));
SelectContent.displayName = SelectPrimitive.Content.displayName;
const SelectLabel = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Label, {
ref,
className: cn("py-1.5 pe-2 ps-6 text-sm font-semibold", className),
...props
}));
SelectLabel.displayName = SelectPrimitive.Label.displayName;
const SelectItem = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
ref,
className: cn("flex select-none flex-row items-center rounded-md py-1.5 px-2 text-sm outline-none focus:bg-fd-accent focus:text-fd-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
...props,
children: [/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children }), /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, {
className: "ms-auto",
children: /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-fd-primary" })
})]
}));
SelectItem.displayName = SelectPrimitive.Item.displayName;
const SelectSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Separator, {
ref,
className: cn("my-1 h-px bg-fd-muted", className),
...props
}));
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
//#endregion
export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue };
//# sourceMappingURL=select.js.map