@overmap-ai/blocks 1.0.30-softer-icon-error.0 → 1.0.30

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.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # overmap-ai blocks
2
-
3
- Contains basic components used by overmap-ai libraries.
1
+ # overmap-ai blocks
2
+
3
+ Contains basic components used by overmap-ai libraries.
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  interface ErrorBoundaryProps extends React.PropsWithChildren {
3
3
  absoluteCentering?: boolean;
4
+ message?: string;
4
5
  }
5
- export declare const OvermapErrorBoundary: React.MemoExoticComponent<(props: ErrorBoundaryProps) => import("react/jsx-runtime").JSX.Element>;
6
- export {};
6
+ declare const OvermapErrorBoundary: React.MemoExoticComponent<(props: ErrorBoundaryProps) => import("react/jsx-runtime").JSX.Element>;
7
+ export default OvermapErrorBoundary;
package/dist/blocks.js CHANGED
@@ -2727,20 +2727,24 @@ const _Separator = forwardRef(function Separator2({
2727
2727
  const Separator$1 = memo(_Separator);
2728
2728
  const centerStyles = { placeSelf: "center" };
2729
2729
  const ErrorFallback = memo((props) => {
2730
- const { absoluteCentering } = props;
2730
+ const { absoluteCentering, message = "Something went wrong", onRetry } = props;
2731
2731
  const { resetBoundary } = useErrorBoundary();
2732
2732
  const height = "20px";
2733
2733
  const outerFlexStyles = absoluteCentering ? { position: "absolute", top: "50%", transform: "translateY(-50%)" } : void 0;
2734
+ const handleRetry = useCallback(() => {
2735
+ resetBoundary();
2736
+ onRetry();
2737
+ }, [onRetry, resetBoundary]);
2734
2738
  return /* @__PURE__ */ jsxs(Flex, { gap: "2", direction: "row", width: "100%", style: outerFlexStyles, children: [
2735
2739
  /* @__PURE__ */ jsx("div", { style: { flexGrow: 1 } }),
2736
2740
  /* @__PURE__ */ jsx(RiIcon, { icon: "RiAlertLine", size: height, style: centerStyles }),
2737
- /* @__PURE__ */ jsx(Text$1, { style: { lineHeight: height, ...centerStyles }, children: "Something went wrong" }),
2741
+ /* @__PURE__ */ jsx(Text$1, { style: { lineHeight: height, ...centerStyles }, children: message }),
2738
2742
  /* @__PURE__ */ jsx(
2739
2743
  IconButton,
2740
2744
  {
2741
2745
  "aria-label": "Try again",
2742
2746
  variant: "soft",
2743
- onClick: resetBoundary,
2747
+ onClick: handleRetry,
2744
2748
  style: centerStyles,
2745
2749
  hoverEffects: ["spin180Clockwise"],
2746
2750
  children: /* @__PURE__ */ jsx(RiIcon, { icon: "RiLoopLeftLine", size: height })
@@ -2751,11 +2755,24 @@ const ErrorFallback = memo((props) => {
2751
2755
  });
2752
2756
  ErrorFallback.displayName = "ErrorFallback";
2753
2757
  const OvermapErrorBoundary = memo((props) => {
2754
- const { absoluteCentering } = props;
2758
+ const { absoluteCentering, message } = props;
2759
+ const [attempt, setAttempt] = React.useState(0);
2755
2760
  const logError = useCallback((error, info) => {
2756
2761
  console.error(error, info);
2762
+ setAttempt((prev) => prev + 1);
2757
2763
  }, []);
2758
- return /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(ErrorFallback, { absoluteCentering }), onError: logError, children: props.children });
2764
+ const handleRetry = useCallback(() => {
2765
+ setAttempt((prev) => prev + 1);
2766
+ }, []);
2767
+ return /* @__PURE__ */ jsx(
2768
+ ErrorBoundary,
2769
+ {
2770
+ fallback: /* @__PURE__ */ jsx(ErrorFallback, { absoluteCentering, message, onRetry: handleRetry }),
2771
+ onError: logError,
2772
+ children: props.children
2773
+ },
2774
+ attempt
2775
+ );
2759
2776
  });
2760
2777
  OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
2761
2778
  const OvermapInputItem$1 = "_OvermapInputItem_1jgzv_1";
@@ -5040,7 +5057,6 @@ export {
5040
5057
  DropdownMenu as OvermapDropdownMenu,
5041
5058
  DropdownMultiSelect as OvermapDropdownMultiSelect,
5042
5059
  DropdownSelect as OvermapDropdownSelect,
5043
- OvermapErrorBoundary,
5044
5060
  OvermapInputItem,
5045
5061
  OvermapItem,
5046
5062
  OvermapItemGroup,