UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

43 lines (42 loc) 1.56 kB
"use client"; import { jsxs as r, jsx as t } from "react/jsx-runtime"; import { Select as h, SelectTrigger as C, SelectValue as i, SelectContent as B, SelectItem as w } from "./select.js"; import { SelectGroup as T, SelectLabel as U, SelectScrollDownButton as V, SelectScrollUpButton as b, SelectSeparator as v } from "./select.js"; function G({ options: o, placeholder: u, children: m, label: d, className: x, labelKey: n, valueKey: S, descriptionKey: a, isOptionDisabled: c, ...A }) { return /* @__PURE__ */ r(h, { ...A, label: d, className: x, children: [ m || /* @__PURE__ */ t(C, { className: "w-full", children: /* @__PURE__ */ t(i, { placeholder: u }) }), /* @__PURE__ */ t(B, { children: o.map((e) => { const l = n && S, p = String(l ? e[S] : e.value), f = l ? String(e[n]) : e.label, s = l && a ? String(e[a]) : null, g = l ? (c == null ? void 0 : c(e)) ?? !1 : e.disabled; return /* @__PURE__ */ t(w, { value: p, disabled: g, children: /* @__PURE__ */ r("span", { className: "flex flex-col", children: [ /* @__PURE__ */ t("span", { children: f }), s && /* @__PURE__ */ r("span", { className: "text-muted-foreground text-d-tertiary text-xs", children: [ "- ", s ] }) ] }) }, p); }) }) ] }); } export { G as AppSelect, B as AppSelectContent, T as AppSelectGroup, w as AppSelectItem, U as AppSelectLabel, V as AppSelectScrollDownButton, b as AppSelectScrollUpButton, v as AppSelectSeparator, C as AppSelectTrigger, i as AppSelectValue };