@overmap-ai/blocks 1.0.17-add-error-boundary-component.2 → 1.0.17-add-error-boundary-component.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,6 @@
1
1
  import React from "react";
2
- type ErrorBoundaryProps = React.PropsWithChildren;
2
+ interface ErrorBoundaryProps extends React.PropsWithChildren {
3
+ absoluteCentering?: boolean;
4
+ }
3
5
  export declare const OvermapErrorBoundary: React.MemoExoticComponent<(props: ErrorBoundaryProps) => import("react/jsx-runtime").JSX.Element>;
4
6
  export {};
package/dist/blocks.js CHANGED
@@ -2262,11 +2262,13 @@ const _Separator = forwardRef(function Separator2({
2262
2262
  );
2263
2263
  });
2264
2264
  const Separator = memo(_Separator);
2265
- const ErrorFallback = memo(() => {
2265
+ const centerStyles = { placeSelf: "center" };
2266
+ const ErrorFallback = memo((props) => {
2267
+ const { absoluteCentering } = props;
2266
2268
  const { resetBoundary } = useErrorBoundary();
2267
2269
  const height = "20px";
2268
- const centerStyles = { placeSelf: "center" };
2269
- return /* @__PURE__ */ jsxs(Flex, { gap: "2", direction: "row", children: [
2270
+ const outerFlexStyles = absoluteCentering ? { position: "absolute", top: "50%", transform: "translateY(-50%)" } : void 0;
2271
+ return /* @__PURE__ */ jsxs(Flex, { gap: "2", direction: "row", width: "100%", style: outerFlexStyles, children: [
2270
2272
  /* @__PURE__ */ jsx("div", { style: { flexGrow: 1 } }),
2271
2273
  /* @__PURE__ */ jsx(FeatherIcon, { icon: "alert-triangle", size: height, style: centerStyles }),
2272
2274
  /* @__PURE__ */ jsx(Text$1, { style: { lineHeight: height, ...centerStyles }, children: "Something went wrong" }),
@@ -2286,10 +2288,11 @@ const ErrorFallback = memo(() => {
2286
2288
  });
2287
2289
  ErrorFallback.displayName = "ErrorFallback";
2288
2290
  const OvermapErrorBoundary = memo((props) => {
2291
+ const { absoluteCentering } = props;
2289
2292
  const logError = useCallback((error, info) => {
2290
2293
  console.error(error, info);
2291
2294
  }, []);
2292
- return /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(ErrorFallback, {}), onError: logError, children: props.children });
2295
+ return /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(ErrorFallback, { absoluteCentering }), onError: logError, children: props.children });
2293
2296
  });
2294
2297
  OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
2295
2298
  function _extends() {