UNPKG

@payfit/unity-components

Version:

42 lines (41 loc) • 1.8 kB
import { MultiSelectContext as e } from "../Multiselect.context.js"; import { MultiSelectSeparator as t } from "./MultiSelectSeparator.js"; import { MultiSelectSelectAllOption as n } from "./MultiSelectSelectAllOption.js"; import { useContext as r } from "react"; import { uyTv as i } from "@payfit/unity-themes"; import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime"; import { Header as c } from "react-aria-components/Header"; import { ListBoxSection as l } from "react-aria-components/ListBox"; import { Collection as u } from "react-aria-components/Collection"; //#region src/core/components/multi-select/parts/MultiSelectOptGroup.tsx var d = i({ slots: { base: "uy:flex uy:flex-col uy:bg-surface-neutral", label: "uy:px-150 uy:py-100 uy:typography-body-strong uy:text-content-neutral" }, variants: { showSelectAll: { true: { base: ["uy:**:data-[unity-slot=multi-select-option]:ps-[calc(var(--uy-spacing-150)+var(--uy-spacing-300))]", "uy:**:data-[unity-slot=multi-select-option]:py-125"] } } } }); function f(e) { return "items" in e && Array.isArray(e.items) && typeof e.children == "function"; } function p(i) { let { showSelectAll: p } = r(e), { base: m, label: h } = d({ showSelectAll: p }), { label: g, withSeparator: _, className: v, ...y } = i; return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ s(l, { ...y, id: g, className: m({ className: v }), children: [p ? /* @__PURE__ */ o(c, { "aria-label": g, children: /* @__PURE__ */ o(n, { groupLabel: g }) }) : /* @__PURE__ */ o(c, { className: h(), children: g }), f(i) ? /* @__PURE__ */ o(u, { items: i.items, children: i.children }) : i.children] }), _ && /* @__PURE__ */ o(t, {})] }); } p.displayName = "MultiSelectOptGroup"; //#endregion export { p as MultiSelectOptGroup };