@cerberus-design/react
Version:
The Cerberus Design React component library.
37 lines (35 loc) • 1.46 kB
JavaScript
import {
SelectParts
} from "./chunk-SP7TSFMZ.js";
import {
Portal
} from "./chunk-PLPYBCZQ.js";
import {
Show
} from "./chunk-NUXMADXV.js";
import {
useCerberusContext
} from "./chunk-GITT5645.js";
// src/components/select/select.tsx
import { HStack } from "styled-system/jsx";
import { jsx, jsxs } from "react/jsx-runtime";
function Select(props) {
const { collection, container, placeholder, ...rootProps } = props;
const { icons } = useCerberusContext();
const { selectArrow: SelectArrow, invalid: InvalidIcon } = icons;
return /* @__PURE__ */ jsxs(SelectParts.Root, { collection, ...rootProps, children: [
/* @__PURE__ */ jsx(SelectParts.Control, { children: /* @__PURE__ */ jsxs(SelectParts.Trigger, { children: [
/* @__PURE__ */ jsx(SelectParts.ValueText, { placeholder }),
/* @__PURE__ */ jsxs(HStack, { children: [
/* @__PURE__ */ jsx(Show, { when: props.invalid, children: /* @__PURE__ */ jsx(InvalidIcon, { "data-part": "invalid-icon" }) }),
/* @__PURE__ */ jsx(SelectParts.Indicator, { children: /* @__PURE__ */ jsx(SelectArrow, {}) })
] })
] }) }),
/* @__PURE__ */ jsx(Portal, { container, children: /* @__PURE__ */ jsx(SelectParts.Positioner, { children: /* @__PURE__ */ jsx(SelectParts.Content, { size: rootProps.size, children: props.children }) }) }),
/* @__PURE__ */ jsx(SelectParts.HiddenSelect, {})
] });
}
export {
Select
};
//# sourceMappingURL=chunk-HCH5I26B.js.map