geoiq-frontend-ui-kit
Version:
This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.
71 lines (70 loc) • 2.06 kB
JavaScript
import r from "react";
import { FormStep as R } from "./index.es107.js";
import { FormNavigation as x } from "./index.es108.js";
import { FormReadOnlyView as O } from "./index.es109.js";
import { FormStructureProvider as B } from "./index.es110.js";
import { FormValuesProvider as I } from "./index.es111.js";
function f(n, l) {
if (typeof document > "u") return null;
const i = document.cookie.split("; ").find((t) => t.startsWith(`${n}=`));
if (!i) return null;
const m = decodeURIComponent(i.split("=").slice(1).join("=").trim());
try {
const t = JSON.parse(m), c = l.split(".");
let e = t;
for (const a of c)
e = e?.[a];
return typeof e == "string" ? e : null;
} catch {
return null;
}
}
const _ = ({
structure: n,
initialValues: l = {},
onSubmit: i,
onAssetUpload: m,
readOnly: t = !1,
onGoToNextStep: c,
onGoToPreviousStep: e,
onToggleImageEditor: a,
isSubmitting: u = !1,
testMode: p = !1,
getRequestHeaders: g,
authCookieName: s,
authCookieTokenPath: v = "in.token",
authCookieEmailPath: d,
getCreateOptionExtraBody: E
}) => {
const F = g ?? (s ? () => {
const o = f(s, v);
return o ? { Authorization: `Bearer ${o}` } : {};
} : void 0), y = E ?? (s && d ? () => {
const o = f(s, d);
return o ? { email: o } : {};
} : void 0);
return t ? /* @__PURE__ */ r.createElement(O, { structure: n, values: l }) : /* @__PURE__ */ r.createElement(B, { structure: n }, /* @__PURE__ */ r.createElement(
I,
{
initialValues: l,
onSubmit: i,
onAssetUpload: m,
onToggleImageEditor: a,
getRequestHeaders: F,
getCreateOptionExtraBody: y
},
/* @__PURE__ */ r.createElement("div", { id: "form-renderer", className: " flex flex-col h-full " }, /* @__PURE__ */ r.createElement(R, null), /* @__PURE__ */ r.createElement(
x,
{
isSubmitting: u,
onGoToNextStep: c,
onGoToPreviousStep: e,
testMode: p
}
))
));
};
export {
_ as FormRenderer
};
//# sourceMappingURL=index.es66.js.map