@cerberus-design/react
Version:
The Cerberus Design React component library.
52 lines (50 loc) • 1.8 kB
JavaScript
import {
ComboboxParts
} from "./chunk-AQNXQVXP.js";
import {
ComboboxStartIcon
} from "./chunk-5RLQNM73.js";
import {
Portal
} from "./chunk-PLPYBCZQ.js";
import {
Show
} from "./chunk-NUXMADXV.js";
import {
splitProps
} from "./chunk-BL7G3577.js";
import {
useCerberusContext
} from "./chunk-GITT5645.js";
// src/components/combobox/combobox.tsx
import { jsx, jsxs } from "react/jsx-runtime";
function Combobox(props) {
const [{ startIcon, label, ...elProps }, rootProps] = splitProps(props, [
"label",
"children",
"startIcon",
"container"
]);
const { icons } = useCerberusContext();
const { selectArrow: SelectArrow, close: CloseIcon } = icons;
const hasStartIcon = Boolean(startIcon);
return /* @__PURE__ */ jsxs(ComboboxParts.Root, { ...rootProps, children: [
/* @__PURE__ */ jsx(Show, { when: label, children: /* @__PURE__ */ jsx(ComboboxParts.Label, { children: label }) }),
/* @__PURE__ */ jsxs(ComboboxParts.Control, { children: [
/* @__PURE__ */ jsx(Show, { when: hasStartIcon, children: /* @__PURE__ */ jsx(ComboboxStartIcon, { children: startIcon }) }),
/* @__PURE__ */ jsx(
ComboboxParts.Input,
{
...hasStartIcon && { "data-has": "start-indicator" }
}
),
/* @__PURE__ */ jsx(ComboboxParts.ClearTrigger, { children: /* @__PURE__ */ jsx(CloseIcon, {}) }),
/* @__PURE__ */ jsx(ComboboxParts.Trigger, { children: /* @__PURE__ */ jsx(SelectArrow, {}) })
] }),
/* @__PURE__ */ jsx(Portal, { container: elProps.container, children: /* @__PURE__ */ jsx(ComboboxParts.Positioner, { children: /* @__PURE__ */ jsx(ComboboxParts.Content, { size: rootProps.size, children: elProps.children }) }) })
] });
}
export {
Combobox
};
//# sourceMappingURL=chunk-2D6BHWPB.js.map