@vela-ui/react
Version:
Vela UI React components
769 lines (753 loc) • 27.4 kB
JavaScript
;
"use client";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/components/combobox.tsx
var combobox_exports = {};
__export(combobox_exports, {
Combobox: () => Combobox,
ComboboxDescription: () => ComboboxDescription,
ComboboxInput: () => ComboboxInput,
ComboboxItem: () => ComboboxItem,
ComboboxLabel: () => ComboboxLabel,
ComboboxList: () => ComboboxList,
ComboboxPopover: () => ComboboxPopover,
ComboboxSection: () => ComboboxSection
});
module.exports = __toCommonJS(combobox_exports);
var import_react_aria_components7 = require("react-aria-components");
// src/icons/check.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var CheckIcon = (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"svg",
{
fill: "none",
stroke: "currentColor",
strokeWidth: 2,
strokeLinecap: "round",
strokeLinejoin: "round",
width: "1em",
height: "1em",
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
...props,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20 6 9 17l-5-5" })
}
);
};
// src/icons/chevrons-up-down.tsx
var import_jsx_runtime2 = require("react/jsx-runtime");
var ChevronsUpDownIcon = (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
"svg",
{
fill: "none",
stroke: "currentColor",
strokeWidth: 2,
strokeLinecap: "round",
strokeLinejoin: "round",
width: "1em",
height: "1em",
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
...props,
children: [
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m7 15 5 5 5-5" }),
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m7 9 5-5 5 5" })
]
}
);
};
// src/icons/loader-circle.tsx
var import_jsx_runtime3 = require("react/jsx-runtime");
var LoaderCircleIcon = (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"svg",
{
fill: "none",
stroke: "currentColor",
strokeWidth: 2,
strokeLinecap: "round",
strokeLinejoin: "round",
width: "1em",
height: "1em",
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
...props,
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
}
);
};
// src/icons/loader-ring.tsx
var import_jsx_runtime4 = require("react/jsx-runtime");
var LoaderRingIcon = (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
"svg",
{
fill: "none",
width: "1em",
height: "1em",
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
...props,
children: [
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
"path",
{
stroke: "currentColor",
strokeOpacity: "0.25",
strokeWidth: "3.636",
d: "M11.909 21a9.09 9.09 0 1 0 0-18.182 9.09 9.09 0 0 0 0 18.182Z"
}
),
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
"path",
{
fill: "currentColor",
d: "M4.636 11.91a7.273 7.273 0 0 1 7.273-7.274V1C5.885 1 1 5.885 1 11.91zm1.819 4.81a7.24 7.24 0 0 1-1.819-4.81H1c0 2.764 1.032 5.294 2.727 7.215z"
}
)
]
}
);
};
// src/lib/utils.ts
var import_clsx = require("clsx");
var import_react_aria_components = require("react-aria-components");
var import_tailwind_merge = require("tailwind-merge");
var cn = (...inputs) => (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(...inputs));
function composeTailwindRenderProps(className, tailwind) {
return (0, import_react_aria_components.composeRenderProps)(className, (className2) => (0, import_tailwind_merge.twMerge)(tailwind, className2));
}
// src/components/button.tsx
var import_react_aria_components2 = require("react-aria-components");
var import_tailwind_variants3 = require("tailwind-variants");
// src/lib/classes.ts
var import_tailwind_variants = require("tailwind-variants");
var focusRing = (0, import_tailwind_variants.tv)({
base: "outline-hidden",
variants: {
isFocusVisible: {
true: "border-ring ring-ring/50 ring-[3px]"
},
isInvalid: {
true: "ring-destructive/20 dark:ring-destructive/40 border-destructive"
}
}
});
// src/components/loader.tsx
var import_tailwind_variants2 = require("tailwind-variants");
var import_jsx_runtime5 = require("react/jsx-runtime");
var loaderVariants = (0, import_tailwind_variants2.tv)({
base: "relative",
variants: {
size: {
sm: "size-4",
md: "size-6",
lg: "size-8",
xl: "size-10"
}
},
defaultVariants: {
size: "sm"
}
});
function Default({ className, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
LoaderCircleIcon,
{
className: cn("size-4 animate-spin", className),
"data-slot": "icon",
...props
}
);
}
var Ring = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LoaderRingIcon, { className: cn("size-4 animate-spin", className), "data-slot": "icon", ...props });
function Spin({ className, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
"svg",
{
className: cn("size-4 stroke-current", className),
"data-slot": "icon",
viewBox: "0 0 2400 2400",
...props,
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { strokeWidth: "200", strokeLinecap: "round", fill: "none", children: [
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: "1200", y1: "600", x2: "1200", y2: "100" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.5", x1: "1200", y1: "2300", x2: "1200", y2: "1800" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.917", x1: "900", y1: "680.4", x2: "650", y2: "247.4" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.417", x1: "1750", y1: "2152.6", x2: "1500", y2: "1719.6" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.833", x1: "680.4", y1: "900", x2: "247.4", y2: "650" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.333", x1: "2152.6", y1: "1750", x2: "1719.6", y2: "1500" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.75", x1: "600", y1: "1200", x2: "100", y2: "1200" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.25", x1: "2300", y1: "1200", x2: "1800", y2: "1200" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.667", x1: "680.4", y1: "1500", x2: "247.4", y2: "1750" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.167", x1: "2152.6", y1: "650", x2: "1719.6", y2: "900" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.583", x1: "900", y1: "1719.6", x2: "650", y2: "2152.6" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { opacity: "0.083", x1: "1750", y1: "247.4", x2: "1500", y2: "680.4" }),
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
"animateTransform",
{
attributeName: "transform",
attributeType: "XML",
type: "rotate",
keyTimes: "0;0.08333;0.16667;0.25;0.33333;0.41667;0.5;0.58333;0.66667;0.75;0.83333;0.91667",
values: "0 1199 1199;30 1199 1199;60 1199 1199;90 1199 1199;120 1199 1199;150 1199 1199;180 1199 1199;210 1199 1199;240 1199 1199;270 1199 1199;300 1199 1199;330 1199 1199",
dur: "0.83333s",
begin: "0.08333s",
repeatCount: "indefinite",
calcMode: "discrete"
}
)
] })
}
);
}
var LOADERS = {
default: Default,
ring: Ring,
spin: Spin
};
var DEFAULT_VARIANT = "default";
function Loader(props) {
const { className, size, ref, variant, ...otherProps } = props;
const LoaderComponent = LOADERS[variant != null ? variant : DEFAULT_VARIANT];
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
LoaderComponent,
{
role: "presentation",
ref,
className: loaderVariants({ size, className }),
...otherProps
}
);
}
// src/components/button.tsx
var import_jsx_runtime6 = require("react/jsx-runtime");
var buttonVariants = (0, import_tailwind_variants3.tv)({
extend: focusRing,
base: "inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap transition-all [&_svg]:pointer-events-none [&_svg]:shrink-0",
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90 shadow-xs",
destructive: "bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white shadow-xs",
outline: "bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-xs",
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
link: "text-primary underline-offset-4 hover:underline"
},
size: {
xs: "size-8 gap-1 text-xs [&_svg:not([class*='size-'])]:size-4",
sm: "size-9 gap-2 text-sm [&_svg:not([class*='size-'])]:size-4",
md: "size-10 gap-2 text-sm [&_svg:not([class*='size-'])]:size-5",
lg: "size-11 gap-2.5 text-base [&_svg:not([class*='size-'])]:size-5",
xl: "size-12 gap-2.5 text-base [&_svg:not([class*='size-'])]:size-5"
},
shape: {
rectangle: "",
square: "",
circle: "rounded-full"
},
isDisabled: {
true: "pointer-events-none opacity-50"
},
isPending: {
true: "pointer-events-none opacity-50"
}
},
compoundVariants: [
{
size: "xs",
shape: "rectangle",
className: "w-auto px-2.5"
},
{
size: "sm",
shape: "rectangle",
className: "w-auto px-3.5"
},
{
size: "md",
shape: "rectangle",
className: "w-auto px-4"
},
{
size: "lg",
shape: "rectangle",
className: "w-auto px-5"
},
{
size: "xl",
shape: "rectangle",
className: "w-auto px-5"
}
],
defaultVariants: {
variant: "default",
size: "md",
shape: "rectangle"
}
});
function Button({ className, variant, size, shape, loader = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Loader, {}), ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
import_react_aria_components2.Button,
{
"data-slot": "button",
className: (0, import_react_aria_components2.composeRenderProps)(
className,
(className2, renderProps) => buttonVariants({
...renderProps,
variant,
size,
shape,
className: className2
})
),
...props,
children: (0, import_react_aria_components2.composeRenderProps)(props.children, (children) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
props.isPending && loader,
children
] }))
}
);
}
// src/components/dropdown.tsx
var import_react_aria_components3 = require("react-aria-components");
var import_tailwind_merge2 = require("tailwind-merge");
var import_tailwind_variants4 = require("tailwind-variants");
var import_jsx_runtime7 = require("react/jsx-runtime");
var dropdownItemVariants = (0, import_tailwind_variants4.tv)({
base: "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[selection-mode]:pr-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
variants: {
variant: {
default: "",
destructive: "text-destructive *:[svg]:!text-destructive"
},
isFocused: {
true: "bg-accent text-accent-foreground"
},
isHovered: {
true: "bg-accent text-accent-foreground"
},
isDisabled: {
true: "pointer-events-none opacity-50"
}
},
compoundVariants: [
{
variant: "destructive",
isFocused: true,
className: "bg-destructive/10 dark:bg-destructive/20 text-destructive"
}
]
});
function DropdownSection({ className, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_aria_components3.ListBoxSection, { className, children: [
"title" in props && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_aria_components3.Header, { className: "text-muted-foreground px-2 py-1.5 text-xs", children: props.title }),
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_aria_components3.Collection, { items: props.items, children: props.children })
] });
}
function DropdownItem({ className, variant, ...props }) {
const textValue = props.textValue || (typeof props.children === "string" ? props.children : void 0);
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
import_react_aria_components3.ListBoxItem,
{
textValue,
className: (0, import_react_aria_components3.composeRenderProps)(
className,
(className2, renderProps) => dropdownItemVariants({ ...renderProps, variant, className: className2 })
),
...props,
children: (0, import_react_aria_components3.composeRenderProps)(props.children, (children, { isSelected }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
isSelected && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CheckIcon, {}) }),
children
] }))
}
);
}
function DropdownLabel({ className, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_aria_components3.Text, { slot: "label", className, ...props });
}
function DropdownDescription({ className, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
import_react_aria_components3.Text,
{
slot: "description",
className: (0, import_tailwind_merge2.twMerge)("text-muted-foreground text-sm", className),
...props
}
);
}
// src/components/field.tsx
var import_react_aria_components4 = require("react-aria-components");
var import_tailwind_variants5 = require("tailwind-variants");
var import_jsx_runtime8 = require("react/jsx-runtime");
var fieldVariants = (0, import_tailwind_variants5.tv)({
slots: {
label: "group-data-[invalid]:text-destructive flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",
description: "text-muted-foreground text-sm",
fieldError: "text-destructive text-sm"
}
});
var { label, description, fieldError } = fieldVariants();
function Label({ className, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_aria_components4.Label, { "data-slot": "label", className: label({ className }), ...props });
}
function Description({ className, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_aria_components4.Text, { slot: "description", className: description({ className }), ...props });
}
function FieldError({ className, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
import_react_aria_components4.FieldError,
{
className: (0, import_react_aria_components4.composeRenderProps)(className, (className2) => fieldError({ className: className2 })),
...props
}
);
}
var fieldGroupVariants = (0, import_tailwind_variants5.tv)({
extend: focusRing,
base: "group border-input relative flex h-10 items-center overflow-hidden rounded-lg border shadow-xs",
variants: {
isFocusWithin: {
true: "border-ring"
},
isInvalid: {
true: "border-destructive"
},
isDisabled: {
true: "opacity-50"
}
}
});
// src/components/input.tsx
var import_react = require("react");
var import_react_aria_components5 = require("react-aria-components");
var import_tailwind_variants6 = require("tailwind-variants");
var import_jsx_runtime9 = require("react/jsx-runtime");
var inputVariants = (0, import_tailwind_variants6.tv)({
extend: focusRing,
base: "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input relative flex w-full min-w-0 rounded-md border bg-transparent py-1 shadow-xs transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
variants: {
size: {
xs: "h-8 px-2 text-xs",
sm: "h-9 px-2.5 text-sm",
md: "h-10 px-3 text-sm",
lg: "h-11 px-4 text-base",
xl: "h-12 px-4.5 text-base"
},
isFocused: focusRing.variants.isFocusVisible,
hasStartElement: {
true: ""
},
hasEndElement: {
true: ""
}
},
compoundVariants: [
{
hasStartElement: true,
size: "xs",
className: "pl-8"
},
{
hasStartElement: true,
size: "sm",
className: "pl-9"
},
{
hasStartElement: true,
size: "md",
className: "pl-10"
},
{
hasStartElement: true,
size: "lg",
className: "pl-11"
},
{
hasStartElement: true,
size: "xl",
className: "pl-12"
},
{
hasEndElement: true,
size: "xs",
className: "pr-8"
},
{
hasEndElement: true,
size: "sm",
className: "pr-9"
},
{
hasEndElement: true,
size: "md",
className: "pr-10"
},
{
hasEndElement: true,
size: "lg",
className: "pr-11"
},
{
hasEndElement: true,
size: "xl",
className: "pr-12"
}
],
defaultVariants: {
size: "md"
}
});
function Input({ className, size, hasStartElement, hasEndElement, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
import_react_aria_components5.Input,
{
"data-slot": "input",
className: (0, import_react_aria_components5.composeRenderProps)(
className,
(className2, renderProps) => inputVariants({
...renderProps,
size,
hasStartElement,
hasEndElement,
className: className2
})
),
...props
}
);
}
var inputGroupVariants = (0, import_tailwind_variants6.tv)({
slots: {
root: [
"relative isolate flex w-full flex-row items-center justify-start !gap-0",
"has-[[data-slot=input-addon]]:[&_:not(:first-child)]:-ml-px",
"has-[[data-slot=input-addon]]:[&_:not(:first-child)]:rounded-ss-none has-[[data-slot=input-addon]]:[&_:not(:first-child)]:rounded-es-none",
"has-[[data-slot=input-addon]]:[&_:not(:last-child)]:rounded-se-none has-[[data-slot=input-addon]]:[&_:not(:last-child)]:rounded-ee-none"
],
addon: "border-input bg-accent flex w-auto items-center self-stretch rounded-md border whitespace-nowrap",
element: "text-muted-foreground absolute inset-y-0 z-50 flex items-center has-[button]:px-0 [&_button]:scale-75"
},
variants: {
size: {
xs: {
root: "text-xs",
addon: "px-2.5",
element: "px-2.5"
},
sm: {
root: "text-sm",
addon: "px-3",
element: "px-3"
},
md: {
root: "text-sm",
addon: "px-3",
element: "px-3"
},
lg: {
root: "text-base",
addon: "px-3.5",
element: "px-3.5"
},
xl: {
root: "text-base",
addon: "px-4",
element: "px-4"
}
}
},
defaultVariants: {
size: "md"
}
});
var { root, addon, element } = inputGroupVariants();
var InputGroup = ({
children,
startElement,
endElement,
startAddon,
endAddon,
size,
className,
...props
}) => {
const child = import_react.Children.only(children);
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
import_react_aria_components5.Group,
{
"data-slot": "input-group",
className: (0, import_react_aria_components5.composeRenderProps)(className, (className2) => root({ size, className: className2 })),
...props,
children: [
startElement && !startAddon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputElement, { size, className: "left-0", children: startElement }),
startAddon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputAddon, { size, children: startAddon }),
(0, import_react.cloneElement)(child, {
hasStartElement: !!startElement,
hasEndElement: !!endElement,
size,
...child.props
}),
endElement && !endAddon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputElement, { size, className: "right-0", children: endElement }),
endAddon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputAddon, { size, children: endAddon })
]
}
);
};
function InputAddon({
className,
size,
...props
}) {
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { "data-slot": "input-addon", className: addon({ size, className }), ...props });
}
function InputElement({
className,
size,
...props
}) {
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { "data-slot": "input-element", className: element({ size, className }), ...props });
}
// src/components/popover.tsx
var import_react_aria_components6 = require("react-aria-components");
var import_tailwind_variants7 = require("tailwind-variants");
var import_jsx_runtime10 = require("react/jsx-runtime");
var popoverVariants = (0, import_tailwind_variants7.tv)({
base: "bg-popover text-popover-foreground z-50 rounded-md border shadow-md outline-hidden transition duration-200",
variants: {
isEntering: {
true: [
"animate-in fade-in-0 zoom-in-95",
"data-[placement=left]:slide-in-from-right-2 data-[placement=right]:slide-in-from-left-2 data-[placement=top]:slide-in-from-bottom-2 data-[placement=bottom]:slide-in-from-top-2"
]
},
isExiting: {
true: [
"animate-out fade-out-0 zoom-out-95",
"data-[placement=left]:slide-out-to-right-2 data-[placement=right]:slide-out-to-left-2 data-[placement=top]:slide-out-to-bottom-2 data-[placement=bottom]:slide-out-to-top-2"
]
}
}
});
var Popover = ({ className, showArrow, ...props }) => {
const popoverContext = (0, import_react_aria_components6.useSlottedContext)(import_react_aria_components6.PopoverContext);
const isSubmenu = (popoverContext == null ? void 0 : popoverContext.trigger) === "SubmenuTrigger";
let offset = showArrow ? 12 : 8;
offset = isSubmenu ? offset - 6 : offset;
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
import_react_aria_components6.Popover,
{
"data-slot": "popover",
offset,
className: (0, import_react_aria_components6.composeRenderProps)(
className,
(className2, renderProps) => popoverVariants({
...renderProps,
className: className2
})
),
...props,
children: (0, import_react_aria_components6.composeRenderProps)(props.children, (children) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
showArrow && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_aria_components6.OverlayArrow, { className: "group", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
"svg",
{
width: 12,
height: 12,
viewBox: "0 0 12 12",
className: "fill-popover stroke-border block stroke-1 group-data-[placement=bottom]:rotate-180 group-data-[placement=left]:-rotate-90 group-data-[placement=right]:rotate-90",
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M0 0 L6 6 L12 0" })
}
) }),
children
] }))
}
);
};
// src/components/combobox.tsx
var import_jsx_runtime11 = require("react/jsx-runtime");
function Combobox({
label: label2,
description: description2,
errorMessage,
children,
className,
...props
}) {
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
import_react_aria_components7.ComboBox,
{
"data-slot": "combobox",
...props,
className: composeTailwindRenderProps(className, "group flex w-full flex-col gap-2"),
children: (0, import_react_aria_components7.composeRenderProps)(children, (children2) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
label2 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Label, { children: label2 }),
children2,
description2 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Description, { children: description2 }),
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FieldError, { children: errorMessage })
] }))
}
);
}
function ComboboxPopover({ className, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
Popover,
{
showArrow: false,
className,
style: { minWidth: "var(--trigger-width)" },
...props
}
);
}
function ComboboxList({ className, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
import_react_aria_components7.ListBox,
{
className: composeTailwindRenderProps(
className,
"max-h-[inherit] min-w-[inherit] overflow-auto p-1 outline-hidden"
),
...props
}
);
}
function ComboboxInput({
size,
endElementProps,
endElement = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { variant: "ghost", shape: "square", size, ...endElementProps, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChevronsUpDownIcon, {}) }),
...props
}) {
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(InputGroup, { size, endElement, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Input, { ...props }) });
}
var ComboboxSection = DropdownSection;
var ComboboxItem = DropdownItem;
var ComboboxLabel = DropdownLabel;
var ComboboxDescription = DropdownDescription;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Combobox,
ComboboxDescription,
ComboboxInput,
ComboboxItem,
ComboboxLabel,
ComboboxList,
ComboboxPopover,
ComboboxSection
});