geoiq-frontend-ui-kit
Version:
This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.
59 lines (58 loc) • 1.85 kB
JavaScript
import e from "react";
import * as g from "@radix-ui/react-select";
import { SelectTrigger as d, SelectValue as S, SelectContent as E, SelectGroup as u, SelectItem as b } from "./index90.es.js";
import { Typography as n } from "./index19.es.js";
import { SelectStates as N } from "./index91.es.js";
import { cn as h } from "./index88.es.js";
const O = e.forwardRef(
({
// className,
// children,
placeholder: m,
onValueChange: o,
items: l,
value: a,
container: s,
// defaultValue,
...r
}) => {
const c = l.find((t) => t.value === a), [i, p] = e.useState(!1);
return /* @__PURE__ */ e.createElement(
g.Root,
{
onValueChange: o,
value: a,
onOpenChange: p,
...r
},
/* @__PURE__ */ e.createElement(
d,
{
className: h(N({ isOpen: i, isValue: !!a })),
...r.triggerProps
},
/* @__PURE__ */ e.createElement(S, { 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(E, { className: "bg-light-1", portalContainer: s }, /* @__PURE__ */ e.createElement(u, null, l.map((t, f) => /* @__PURE__ */ e.createElement(
b,
{
value: t.value,
disabled: t.disabled ?? !1,
key: f
},
/* @__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=index29.es.js.map