geoiq-frontend-ui-kit
Version:
This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.
58 lines (57 loc) • 1.81 kB
JavaScript
import e from "react";
import * as f from "@radix-ui/react-select";
import { SelectTrigger as g, SelectValue as d, SelectContent as S, SelectGroup as E, SelectItem as u } from "./index.es87.js";
import { Typography as n } from "./index.es19.js";
import { SelectStates as b } from "./index.es88.js";
import { cn as N } from "./index.es85.js";
const O = e.forwardRef(
({
// className,
// children,
placeholder: m,
onValueChange: s,
items: l,
value: a,
// defaultValue,
...r
}) => {
const c = l.find((t) => t.value === a), [o, i] = e.useState(!1);
return /* @__PURE__ */ e.createElement(
f.Root,
{
onValueChange: s,
value: a,
onOpenChange: i,
...r
},
/* @__PURE__ */ e.createElement(
g,
{
className: N(b({ isOpen: o, isValue: !!a })),
...r.triggerProps
},
/* @__PURE__ */ e.createElement(d, { placeholder: m }, /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-2" }, c?.icon, /* @__PURE__ */ e.createElement(
n,
{
variant: "body2",
className: a ? "text-light-2" : "text-light-4"
},
c?.label
)))
),
/* @__PURE__ */ e.createElement(S, { className: "bg-light-1" }, /* @__PURE__ */ e.createElement(E, null, l.map((t, p) => /* @__PURE__ */ e.createElement(
u,
{
value: t.value,
disabled: t.disabled ?? !1,
key: p
},
/* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-2" }, t.icon, /* @__PURE__ */ e.createElement(n, { variant: "body2", className: "capitalize" }, t.label))
))))
);
}
);
export {
O as SingleSelect
};
//# sourceMappingURL=index.es29.js.map