synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
104 lines (103 loc) • 3.47 kB
JavaScript
import { jsx as e, Fragment as S, jsxs as s } from "react/jsx-runtime";
import { CheckIcon as y } from "../../assets/icons/terms/CheckIcon.js";
import { useGetPresignedUrlContentFromFHA as v } from "../../synapse-queries/file/useFiles.js";
import { Skeleton as d, Link as F } from "@mui/material";
import { FileHandleAssociateType as L } from "@sage-bionetworks/synapse-types";
import { times as T } from "lodash-es";
import { useState as h, useEffect as D } from "react";
import { Markdown as p } from "../Markdown/MarkdownSynapse.js";
import "@mui/material/Skeleton";
import { SkeletonParagraph as H } from "../Skeleton/SkeletonParagraph.js";
function U(a) {
const { id: t, item: r, enabled: n, checked: c, onChange: f, termsAndConditionsTableID: u } = a, { iconFileHandleId: k, label: g, description: i } = r, { data: b } = v(
{
associateObjectId: u,
associateObjectType: L.TableEntity,
fileHandleId: k
},
!0
// force this query to be run as the anonymous user (without an access token)
), [o, w] = h(!1), [x, C] = h(!1);
let l = !0;
D(() => (l && C(c), () => {
l = !1;
}), [n, c]);
const I = (m) => {
m.preventDefault(), n && w(!o);
}, N = (m) => {
n && f(t);
};
return /* @__PURE__ */ s("li", { className: n ? "terms-enabled" : "", children: [
/* @__PURE__ */ e(
"span",
{
className: "terms-icon",
dangerouslySetInnerHTML: { __html: b ?? "" }
}
),
/* @__PURE__ */ s("span", { className: "terms-desc", children: [
/* @__PURE__ */ e("label", { id: `toc-item-${t}`, children: /* @__PURE__ */ e(p, { markdown: g }) }),
o && i && /* @__PURE__ */ e("div", { className: "terms-desc-content", children: /* @__PURE__ */ e(p, { markdown: i }) }),
i && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
F,
{
className: "terms-show-desc highlight-link",
href: "",
onClick: I,
children: o ? "Show Less" : "Show More"
}
) })
] }),
/* @__PURE__ */ s("span", { className: "terms-checkbox", children: [
/* @__PURE__ */ e(
"span",
{
role: "checkbox",
"aria-labelledby": `toc-item-${t}`,
className: x ? "terms-circle terms-checked" : "terms-circle",
onClick: N,
children: /* @__PURE__ */ e(y, {})
}
),
"I agree"
] })
] });
}
function q(a) {
const { numLoadingItems: t } = a;
return /* @__PURE__ */ e(S, { children: T(t).map((r) => /* @__PURE__ */ s(
"li",
{
"aria-busy": "true",
"aria-live": "polite",
"data-testid": "loading-terms-and-conditions",
children: [
/* @__PURE__ */ e("span", { className: "terms-icon", children: /* @__PURE__ */ e(
d,
{
variant: "rectangular",
height: "30px",
width: "30px",
sx: { margin: "auto" }
}
) }),
/* @__PURE__ */ e("span", { className: "terms-desc", children: /* @__PURE__ */ e(H, { numRows: 5 }) }),
/* @__PURE__ */ e("span", { className: "terms-checkbox", children: /* @__PURE__ */ e(
d,
{
variant: "circular",
height: "40px",
width: "40px",
sx: { margin: "auto" }
}
) })
]
},
r
)) });
}
export {
q as LoadingItem,
U as default
};
//# sourceMappingURL=TermsAndConditionsItem.js.map