UNPKG

@react-form-builder/core

Version:

React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required

30 lines (29 loc) 1.3 kB
import { jsx as l } from "react/jsx-runtime"; import m from "clsx"; import { useRef as f, useEffect as p } from "react"; import { useStore as w } from "../../utils/contexts/StoreContext.js"; import { namedObserver as v } from "../../utils/namedObserver.js"; import { AsyncQueue as h } from "./AsyncQueue.js"; import y from "./ViewerLocalizationProvider.module.css.js"; const L = "optimajet-formviewer", P = m(L, y.localizationProvider), d = ([o, ...t], e, r) => o ? /* @__PURE__ */ l(o, { language: e, children: d(t, e, r) }) : r, a = new h(), V = (o) => { const t = w(), e = t.displayedLanguage, r = e.bidi, i = f([]), { view: c } = t.formViewerPropsStore; p(() => (c.getCssLoaders(r).forEach((n) => { a.add(async () => { const s = await n(); typeof s == "function" && i.current.push(s); }).catch(console.error); }), () => { const n = i.current; i.current = [], n.forEach((s) => { a.add(async () => { await s(); }).catch(console.error); }); }), [r, c]); const u = /* @__PURE__ */ l("div", { dir: r, lang: e.fullCode, className: P, children: o.children }); return d(c.viewerWrappers, e, u); }, j = v("ViewerLocalizationProvider", V); export { j as ViewerLocalizationProvider }; //# sourceMappingURL=ViewerLocalizationProvider.js.map