UNPKG

@primer/react-brand

Version:

Primer Brand is a GitHub's design system for creating React-based marketing websites and digital experiences.

71 lines (70 loc) 2.3 kB
import e from "../node_modules/clsx/dist/clsx.js"; import { Text as t } from "../Text/Text.js"; import { Heading as n } from "../Heading/Heading.js"; import { ReplyIcon as r } from "../node_modules/@primer/octicons-react/dist/index.esm.js"; import { InlineLink as i } from "../InlineLink/InlineLink.js"; import a from "./Footnotes.module.js"; import { getTextContent as o } from "../utils/getTextContent.js"; import s from "react"; import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime"; //#region src/Footnotes/Footnotes.tsx var d = ["div", "ol"]; function f({ as: t = "ol", className: r, children: i, visuallyHiddenHeading: o = "Footnotes", ...d }) { let f = s.useMemo(() => s.Children.toArray(i), [i]); if (t === "div") { let t = f.map((e) => s.isValidElement(e) && e.type === m ? s.cloneElement(e, { _variant: "disclaimer", ...e.props }) : null); return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(n, { className: "visually-hidden", as: "h2", id: "footnote-label", children: o }), /* @__PURE__ */ l("div", { className: e(a.Footnotes, a["Footnotes--variant-disclaimer"], r), ...d, children: t })] }); } return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(n, { className: "visually-hidden", as: "h2", id: "footnote-label", children: o }), /* @__PURE__ */ l("ol", { className: e(a.Footnotes, a["Footnotes--variant-citations"], r), ...d, children: i })] }); } var p = ["a", "p"]; function m({ className: n, children: s, _variant: c = "citation", ...d }) { if (c === "disclaimer") return /* @__PURE__ */ l(t, { as: "p", variant: "muted", size: "100", className: e(a.FootnotesItem, n), children: s }); let { href: f, ...p } = d; return /* @__PURE__ */ l("li", { className: e(a.FootnotesItem, n), ...p, children: /* @__PURE__ */ u(t, { as: "p", variant: "muted", size: "100", className: e(a.FootnotesItem__citationText), children: [s, f && /* @__PURE__ */ l(i, { href: f, "aria-label": `Back to content ${o(s)}`, children: /* @__PURE__ */ l(r, { className: a.FootnotesItem__citationIcon }) })] }) }); } var h = Object.assign(f, { Item: m }); //#endregion export { h as Footnotes, p as FootnotesItemTags, d as FootnotesTags }; //# sourceMappingURL=Footnotes.js.map