UNPKG

@payfit/unity-components

Version:

54 lines (53 loc) 1.61 kB
import { Icon as e } from "../../icon/Icon.js"; import { Text as t } from "../../text/Text.js"; import { collapsibleTitle as n } from "../Collapsible.variants.js"; import { forwardRef as r, useContext as i } from "react"; import { jsx as a, jsxs as o } from "react/jsx-runtime"; import { Button as s } from "react-aria-components/Button"; import { Heading as c } from "react-aria-components/Heading"; import { DisclosureStateContext as l } from "react-aria-components/Disclosure"; //#region src/components/collapsible/parts/CollapsibleTitle.tsx var u = r(({ children: r, prefix: u, suffix: d, level: f, disclosurePosition: p = "left", ...m }, h) => { let { base: g, button: _, title: v, icon: y } = n({ isExpanded: i(l)?.isExpanded }); return /* @__PURE__ */ a(c, { level: f, "data-dd-privacy": "allow", ...m, ref: h, className: g(), children: /* @__PURE__ */ o(s, { className: _(), slot: "trigger", children: [ p === "left" && /* @__PURE__ */ a(e, { src: "CaretDownOutlined", className: y(), role: "presentation" }), u ? /* @__PURE__ */ a(t, { variant: "body", asElement: "span", children: u }) : null, /* @__PURE__ */ a(t, { variant: "bodyStrong", className: v(), children: r }), d ? /* @__PURE__ */ a(t, { variant: "body", asElement: "span", children: d }) : null, p === "right" && /* @__PURE__ */ a(e, { src: "CaretDownOutlined", className: y(), role: "presentation" }) ] }) }); }); u.displayName = "CollapsibleTitle"; //#endregion export { u as CollapsibleTitle };