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

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.
@@ -0,0 +1 @@
1
+ export * from "./OvermapErrorBoundary";
package/dist/blocks.js CHANGED
@@ -13,6 +13,8 @@ import { Root as Root$1, Item as Item$1 } from "@radix-ui/react-toggle-group";
13
13
  import { Root as Root$2 } from "@radix-ui/react-toolbar";
14
14
  import * as RadixToast from "@radix-ui/react-toast";
15
15
  import { ToastProvider as ToastProvider$1, ToastViewport as ToastViewport$1 } from "@radix-ui/react-toast";
16
+ import { useErrorBoundary, ErrorBoundary } from "react-error-boundary";
17
+ import FeatherIcon from "feather-icons-react";
16
18
  import { flushSync } from "react-dom";
17
19
  import { HeaderCell, Table as Table$1, Header, HeaderRow, Body, Cell, Row } from "@table-library/react-table-library/table.js";
18
20
  import { useTheme } from "@table-library/react-table-library/theme.js";
@@ -2260,6 +2262,36 @@ const _Separator = forwardRef(function Separator2({
2260
2262
  );
2261
2263
  });
2262
2264
  const Separator = memo(_Separator);
2265
+ const ErrorFallback = memo(() => {
2266
+ const { resetBoundary } = useErrorBoundary();
2267
+ const height = "20px";
2268
+ const centerStyles = { placeSelf: "center" };
2269
+ return /* @__PURE__ */ jsxs(Flex, { gap: "2", direction: "row", children: [
2270
+ /* @__PURE__ */ jsx("div", { style: { flexGrow: 1 } }),
2271
+ /* @__PURE__ */ jsx(FeatherIcon, { icon: "alert-triangle", size: height, style: centerStyles }),
2272
+ /* @__PURE__ */ jsx(Text$1, { style: { lineHeight: height, ...centerStyles }, children: "Something went wrong" }),
2273
+ /* @__PURE__ */ jsx(
2274
+ IconButton,
2275
+ {
2276
+ "aria-label": "Try again",
2277
+ variant: "soft",
2278
+ onClick: resetBoundary,
2279
+ style: centerStyles,
2280
+ hoverEffects: ["spin180Clockwise"],
2281
+ children: /* @__PURE__ */ jsx(FeatherIcon, { icon: "refresh-ccw", size: height })
2282
+ }
2283
+ ),
2284
+ /* @__PURE__ */ jsx("div", { style: { flexGrow: 1 } })
2285
+ ] });
2286
+ });
2287
+ ErrorFallback.displayName = "ErrorFallback";
2288
+ const OvermapErrorBoundary = memo((props) => {
2289
+ const logError = useCallback((error, info) => {
2290
+ console.error(error, info);
2291
+ }, []);
2292
+ return /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(ErrorFallback, {}), onError: logError, children: props.children });
2293
+ });
2294
+ OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
2263
2295
  function _extends() {
2264
2296
  _extends = Object.assign ? Object.assign.bind() : function(target) {
2265
2297
  for (var i = 1; i < arguments.length; i++) {
@@ -3672,6 +3704,7 @@ export {
3672
3704
  LeftAndRightPanels,
3673
3705
  MultiPagePopover,
3674
3706
  MultiSelect,
3707
+ OvermapErrorBoundary,
3675
3708
  Popover,
3676
3709
  Root2 as Root,
3677
3710
  Select,