UNPKG

@uva-glass/component-library

Version:

React components UvA

56 lines (55 loc) 1.64 kB
import { jsx as t, jsxs as y } from "react/jsx-runtime"; import { useState as o, Children as B, isValidElement as O, cloneElement as g } from "react"; import { SelectProvider as j } from "./SelectProvider.js"; import { SelectButton as v } from "./components/SelectButton.js"; import { SelectContainer as C } from "./components/SelectContainer.js"; import { SelectOptionBox as F } from "./components/SelectOptionBox.js"; import { SelectOption as z } from "./components/SelectOption.js"; import { usePositionedFloaters as H } from "../hooks/usePositionedFloaters.js"; const L = ({ options: r, variant: i, fullWidth: n = !1, size: l = "default", optionPositionRight: m, defaultValue: s = -1, maxOptionHeight: f, disabled: c, buttonLabelProp: p = "label", buttonLabelBold: a, onChange: u, dividerAfter: S, children: d }) => { const [x, E] = o(null), [h, P] = o(null), { style: b } = H(x, h, { mouseEvent: "click", offset: 4, maxFixedHeight: f, horizontalPosition: m ? "right" : "left", mobileBreakpoint: "28rem", fullWidth: n }); return /* @__PURE__ */ t(j, { options: r, defaultValue: s, children: /* @__PURE__ */ y(C, { children: [ /* @__PURE__ */ t( v, { disabled: c, buttonLabelProp: p, buttonLabelBold: a, variant: i, size: l, onChange: u, ref: P } ), /* @__PURE__ */ t(F, { ref: E, ...b, children: B.map(d, (e, k) => O(e) ? g(e, { dividerAfter: S, key: k }) : e) }) ] }) }); }; L.SelectOption = z; export { L as SelectListbox }; //# sourceMappingURL=SelectListbox.js.map