@react-form-builder/core
Version:
React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required
25 lines (24 loc) • 1.19 kB
JavaScript
import { jsx as p, Fragment as c } from "react/jsx-runtime";
import { useCallback as l, createElement as u } from "react";
import { useComponentData as f } from "../../utils/contexts/ComponentDataContext.js";
import { useStore as T } from "../../utils/contexts/StoreContext.js";
import { namedObserver as n } from "../../utils/namedObserver.js";
import { useTooltipType as w } from "../../utils/useTooltipType.js";
import { useWrapperState as C } from "../../utils/useWrapperState.js";
import { useViewerProps as S } from "../form-viewer/components/ViewerPropsContext.js";
function d() {
const o = S(), t = w();
if (t)
return o.view.get(t);
}
const P = ({ tooltipDefinition: o, children: t }) => {
const r = T(), e = f(), m = e.store, i = l((a) => r.localizeComponent("tooltip", e.dataRoot, a), [r, e]), s = C(e, o, m.tooltipProps, i);
return u(o.component, s.ownProps, t);
}, W = n("ComponentTooltip", P), v = ({ children: o }) => {
const t = d();
return t ? /* @__PURE__ */ p(W, { tooltipDefinition: t, children: o }) : /* @__PURE__ */ p(c, { children: o });
}, j = n("TooltipWrapper", v);
export {
j as TooltipWrapper
};
//# sourceMappingURL=TooltipWrapper.js.map