@overmap-ai/blocks 1.0.17 → 1.0.19-master.0

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.
@@ -11,4 +11,5 @@ export interface ConfirmEditInputProps extends InputProps {
11
11
  iconClassName?: string;
12
12
  mode?: "buttons" | "keys";
13
13
  buttonVariant?: ButtonProps["variant"];
14
+ buttonAlwaysVisible?: boolean;
14
15
  }
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface ErrorBoundaryProps extends React.PropsWithChildren {
3
+ absoluteCentering?: boolean;
4
+ }
5
+ export declare const OvermapErrorBoundary: React.MemoExoticComponent<(props: ErrorBoundaryProps) => import("react/jsx-runtime").JSX.Element>;
6
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./OvermapErrorBoundary";
package/dist/blocks.js CHANGED
@@ -5,6 +5,7 @@ import React, { useMemo, useState, useLayoutEffect, useCallback, useEffect, Chil
5
5
  import { useMediaQuery } from "react-responsive";
6
6
  import { Cross1Icon, MagnifyingGlassIcon, CheckIcon, DragHandleDots2Icon, Cross2Icon, DividerHorizontalIcon, CaretSortIcon, ArrowUpIcon, ArrowDownIcon, MixerHorizontalIcon, Pencil1Icon, TrashIcon, DoubleArrowLeftIcon, ChevronLeftIcon, ChevronRightIcon, DoubleArrowRightIcon } from "@radix-ui/react-icons";
7
7
  import * as RadixDropdownMenu from "@radix-ui/react-dropdown-menu";
8
+ import { isMobile } from "react-device-detect";
8
9
  import * as RadixDialogPrimitive from "@radix-ui/react-dialog";
9
10
  import { Resizable } from "re-resizable";
10
11
  import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
@@ -13,13 +14,14 @@ import { Root as Root$1, Item as Item$1 } from "@radix-ui/react-toggle-group";
13
14
  import { Root as Root$2 } from "@radix-ui/react-toolbar";
14
15
  import * as RadixToast from "@radix-ui/react-toast";
15
16
  import { ToastProvider as ToastProvider$1, ToastViewport as ToastViewport$1 } from "@radix-ui/react-toast";
17
+ import { useErrorBoundary, ErrorBoundary } from "react-error-boundary";
18
+ import FeatherIcon from "feather-icons-react";
16
19
  import { flushSync } from "react-dom";
17
20
  import { HeaderCell, Table as Table$1, Header, HeaderRow, Body, Cell, Row } from "@table-library/react-table-library/table.js";
18
21
  import { useTheme } from "@table-library/react-table-library/theme.js";
19
22
  import { useSort, HeaderCellSort } from "@table-library/react-table-library/sort.js";
20
23
  import { useRowSelect, SelectTypes, SelectClickTypes, HeaderCellSelect, CellSelect } from "@table-library/react-table-library/select.js";
21
24
  import { usePagination } from "@table-library/react-table-library/pagination.js";
22
- import { isMobile } from "react-device-detect";
23
25
  function getDefaultExportFromCjs(x) {
24
26
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
25
27
  }
@@ -1082,12 +1084,12 @@ const DropdownMultiSelect = memo(
1082
1084
  )
1083
1085
  );
1084
1086
  const HoverUtility = memo(function Root({ children }) {
1085
- const [isHovered, setIsHovered] = useState(false);
1087
+ const [isHovered, setIsHovered] = useState(isMobile);
1086
1088
  const handlePointerEnter = useCallback(() => {
1087
1089
  setIsHovered(true);
1088
1090
  }, []);
1089
1091
  const handlePointerLeave = useCallback(() => {
1090
- setIsHovered(false);
1092
+ setIsHovered(isMobile);
1091
1093
  }, []);
1092
1094
  return children({
1093
1095
  isHovered,
@@ -2260,6 +2262,39 @@ const _Separator = forwardRef(function Separator2({
2260
2262
  );
2261
2263
  });
2262
2264
  const Separator = memo(_Separator);
2265
+ const centerStyles = { placeSelf: "center" };
2266
+ const ErrorFallback = memo((props) => {
2267
+ const { absoluteCentering } = props;
2268
+ const { resetBoundary } = useErrorBoundary();
2269
+ const height = "20px";
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: [
2272
+ /* @__PURE__ */ jsx("div", { style: { flexGrow: 1 } }),
2273
+ /* @__PURE__ */ jsx(FeatherIcon, { icon: "alert-triangle", size: height, style: centerStyles }),
2274
+ /* @__PURE__ */ jsx(Text$1, { style: { lineHeight: height, ...centerStyles }, children: "Something went wrong" }),
2275
+ /* @__PURE__ */ jsx(
2276
+ IconButton,
2277
+ {
2278
+ "aria-label": "Try again",
2279
+ variant: "soft",
2280
+ onClick: resetBoundary,
2281
+ style: centerStyles,
2282
+ hoverEffects: ["spin180Clockwise"],
2283
+ children: /* @__PURE__ */ jsx(FeatherIcon, { icon: "refresh-ccw", size: height })
2284
+ }
2285
+ ),
2286
+ /* @__PURE__ */ jsx("div", { style: { flexGrow: 1 } })
2287
+ ] });
2288
+ });
2289
+ ErrorFallback.displayName = "ErrorFallback";
2290
+ const OvermapErrorBoundary = memo((props) => {
2291
+ const { absoluteCentering } = props;
2292
+ const logError = useCallback((error, info) => {
2293
+ console.error(error, info);
2294
+ }, []);
2295
+ return /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(ErrorFallback, { absoluteCentering }), onError: logError, children: props.children });
2296
+ });
2297
+ OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
2263
2298
  function _extends() {
2264
2299
  _extends = Object.assign ? Object.assign.bind() : function(target) {
2265
2300
  for (var i = 1; i < arguments.length; i++) {
@@ -2973,23 +3008,23 @@ const SelectAllCheckbox = memo(function SelectAllCheckbox2({
2973
3008
  childrenWithProps
2974
3009
  ] });
2975
3010
  });
2976
- const outerTableContainer = "_outerTableContainer_1wqc9_1";
2977
- const headerContainer = "_headerContainer_1wqc9_13";
2978
- const tableTopContainer = "_tableTopContainer_1wqc9_17";
2979
- const tableContainer = "_tableContainer_1wqc9_21";
2980
- const searchContainer = "_searchContainer_1wqc9_26";
2981
- const columnFilterSelect = "_columnFilterSelect_1wqc9_36";
2982
- const table = "_table_1wqc9_17";
2983
- const tableHeaderCell = "_tableHeaderCell_1wqc9_54";
2984
- const showSortIcon = "_showSortIcon_1wqc9_70";
2985
- const tableRow = "_tableRow_1wqc9_74";
2986
- const tableCell = "_tableCell_1wqc9_89";
2987
- const noDataTextContainer = "_noDataTextContainer_1wqc9_99";
2988
- const tableBottomContainer = "_tableBottomContainer_1wqc9_105";
2989
- const rowsPerPageContainer = "_rowsPerPageContainer_1wqc9_109";
2990
- const rowsPerPageText = "_rowsPerPageText_1wqc9_119";
2991
- const pageText = "_pageText_1wqc9_124";
2992
- const descriptionSecondLine = "_descriptionSecondLine_1wqc9_128";
3011
+ const outerTableContainer = "_outerTableContainer_kx4ca_1";
3012
+ const headerContainer = "_headerContainer_kx4ca_13";
3013
+ const tableTopContainer = "_tableTopContainer_kx4ca_17";
3014
+ const tableContainer = "_tableContainer_kx4ca_21";
3015
+ const searchContainer = "_searchContainer_kx4ca_26";
3016
+ const columnFilterSelect = "_columnFilterSelect_kx4ca_36";
3017
+ const table = "_table_kx4ca_17";
3018
+ const tableHeaderCell = "_tableHeaderCell_kx4ca_54";
3019
+ const showSortIcon = "_showSortIcon_kx4ca_70";
3020
+ const tableRow = "_tableRow_kx4ca_74";
3021
+ const tableCell = "_tableCell_kx4ca_89";
3022
+ const noDataTextContainer = "_noDataTextContainer_kx4ca_99";
3023
+ const tableBottomContainer = "_tableBottomContainer_kx4ca_105";
3024
+ const rowsPerPageContainer = "_rowsPerPageContainer_kx4ca_109";
3025
+ const rowsPerPageText = "_rowsPerPageText_kx4ca_119";
3026
+ const pageText = "_pageText_kx4ca_124";
3027
+ const descriptionSecondLine = "_descriptionSecondLine_kx4ca_128";
2993
3028
  const styles$1 = {
2994
3029
  outerTableContainer,
2995
3030
  headerContainer,
@@ -3514,6 +3549,7 @@ const _ConfirmEditInput = forwardRef(function ConfirmEditInput2({
3514
3549
  inputClassName,
3515
3550
  iconClassName,
3516
3551
  buttonVariant,
3552
+ buttonAlwaysVisible = false,
3517
3553
  variant,
3518
3554
  severity,
3519
3555
  size,
@@ -3572,7 +3608,7 @@ const _ConfirmEditInput = forwardRef(function ConfirmEditInput2({
3572
3608
  },
3573
3609
  [onCheckClick, onCancelClick, isConfirmDisabled, mode]
3574
3610
  );
3575
- return /* @__PURE__ */ jsx(HoverUtility, { children: ({ isHovered, ...props }) => /* @__PURE__ */ jsxs(Flex, { className: styles.editableTextContainer, gap: "3", ...props, children: [
3611
+ return /* @__PURE__ */ jsx(HoverUtility, { children: ({ isHovered, ...props }) => /* @__PURE__ */ jsxs(Flex, { className: styles.editableTextContainer, gap: "2", ...props, children: [
3576
3612
  /* @__PURE__ */ jsx(
3577
3613
  Input,
3578
3614
  {
@@ -3600,7 +3636,11 @@ const _ConfirmEditInput = forwardRef(function ConfirmEditInput2({
3600
3636
  /* @__PURE__ */ jsx(
3601
3637
  IconButton,
3602
3638
  {
3603
- className: classNames(iconClassName, styles.icon, !isHovered && styles.iconHidden),
3639
+ className: classNames(
3640
+ iconClassName,
3641
+ styles.icon,
3642
+ !buttonAlwaysVisible && !isHovered && styles.iconHidden
3643
+ ),
3604
3644
  size,
3605
3645
  variant: buttonVariant,
3606
3646
  severity,
@@ -3613,7 +3653,11 @@ const _ConfirmEditInput = forwardRef(function ConfirmEditInput2({
3613
3653
  /* @__PURE__ */ jsx(
3614
3654
  IconButton,
3615
3655
  {
3616
- className: classNames(iconClassName, styles.icon, !isHovered && styles.iconHidden),
3656
+ className: classNames(
3657
+ iconClassName,
3658
+ styles.icon,
3659
+ !buttonAlwaysVisible && !isHovered && styles.iconHidden
3660
+ ),
3617
3661
  color: "red",
3618
3662
  size,
3619
3663
  variant: buttonVariant,
@@ -3630,7 +3674,7 @@ const _ConfirmEditInput = forwardRef(function ConfirmEditInput2({
3630
3674
  iconClassName,
3631
3675
  styles.editIcon,
3632
3676
  styles.icon,
3633
- !isHovered && styles.iconHidden
3677
+ !buttonAlwaysVisible && !isHovered && styles.iconHidden
3634
3678
  ),
3635
3679
  size,
3636
3680
  variant: buttonVariant,
@@ -3672,6 +3716,7 @@ export {
3672
3716
  LeftAndRightPanels,
3673
3717
  MultiPagePopover,
3674
3718
  MultiSelect,
3719
+ OvermapErrorBoundary,
3675
3720
  Popover,
3676
3721
  Root2 as Root,
3677
3722
  Select,