UNPKG

@payfit/unity-components

Version:

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