@overmap-ai/blocks 1.0.26 → 1.0.27-attachment-viewers.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.
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.
@@ -0,0 +1,7 @@
1
+ import { ReactElement } from "react";
2
+ interface DownloadButtonUtilityProps {
3
+ children: ReactElement;
4
+ file: File;
5
+ }
6
+ export declare const DownloadButtonUtility: import("react").MemoExoticComponent<(props: DownloadButtonUtilityProps) => import("react/jsx-runtime").JSX.Element>;
7
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./DownloadButtonUtility";
package/dist/blocks.js CHANGED
@@ -1,17 +1,18 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useThemeContext, Badge as Badge$1, Flex as Flex$1, Box, Link, Text as Text$2, Button, IconButton as IconButton$1, Card, Inset, Dialog as Dialog$1, AlertDialog as AlertDialog$1, Kbd, ContextMenu as ContextMenu$1, DropdownMenu as DropdownMenu$1, Select as Select$1, Checkbox as Checkbox$1, Switch as Switch$1, Portal, TextField, Popover as Popover$1, TextArea as TextArea$1, Callout, Tooltip as Tooltip$1, Theme, Separator as Separator$1, TableRow } from "@radix-ui/themes";
3
3
  import { Theme as Theme2, updateThemeAppearanceClass, useThemeContext as useThemeContext2 } from "@radix-ui/themes";
4
- import React, { useMemo, useState, useLayoutEffect, useCallback, useEffect, Children, isValidElement, forwardRef, memo, createContext, useContext, cloneElement, createElement, useRef, useReducer } from "react";
4
+ import React, { useMemo, useState, useLayoutEffect, useCallback, useEffect, Children, isValidElement, forwardRef, memo, createContext, useContext, cloneElement, useRef, createElement, useReducer } from "react";
5
5
  import { useMediaQuery } from "react-responsive";
6
+ import "@react-hook/resize-observer";
6
7
  import { Cross1Icon, MagnifyingGlassIcon, CheckIcon, DragHandleDots2Icon, Cross2Icon, DividerHorizontalIcon, CaretSortIcon, ArrowUpIcon, ArrowDownIcon, MixerHorizontalIcon, Pencil1Icon, TrashIcon, DoubleArrowLeftIcon, ChevronLeftIcon, ChevronRightIcon, DoubleArrowRightIcon } from "@radix-ui/react-icons";
7
8
  import * as RadixContextMenu from "@radix-ui/react-context-menu";
8
9
  import * as RadixDropdownMenu from "@radix-ui/react-dropdown-menu";
10
+ import { Slot } from "@radix-ui/react-slot";
9
11
  import { isMobile } from "react-device-detect";
10
12
  import * as RadixDialogPrimitive from "@radix-ui/react-dialog";
11
13
  import { Resizable } from "re-resizable";
12
14
  import { CSSTransition, Transition } from "react-transition-group";
13
15
  import ReactDOM, { flushSync } from "react-dom";
14
- import { Slot } from "@radix-ui/react-slot";
15
16
  import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
16
17
  import { Root as Root$3, Item as Item$1 } from "@radix-ui/react-toggle-group";
17
18
  import { Root as Root$4 } from "@radix-ui/react-toolbar";
@@ -1220,6 +1221,20 @@ const DropdownMultiSelect = memo(
1220
1221
  }
1221
1222
  )
1222
1223
  );
1224
+ const DownloadButtonUtility = memo((props) => {
1225
+ const { children, file } = props;
1226
+ const anchorRef = useRef(null);
1227
+ const objectURL = useMemo(() => URL.createObjectURL(file), [file]);
1228
+ const handleClick = useCallback(() => {
1229
+ if (anchorRef.current)
1230
+ anchorRef.current.click();
1231
+ }, []);
1232
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1233
+ /* @__PURE__ */ jsx(Slot, { onClick: handleClick, children }),
1234
+ /* @__PURE__ */ jsx("a", { style: { display: "none" }, href: objectURL, target: "_blank", rel: "noreferrer", ref: anchorRef })
1235
+ ] });
1236
+ });
1237
+ DownloadButtonUtility.displayName = "DownloadButtonUtility";
1223
1238
  const HoverUtility = memo(function Root({ children }) {
1224
1239
  const [isHovered, setIsHovered] = useState(isMobile);
1225
1240
  const handlePointerEnter = useCallback(() => {
@@ -4274,6 +4289,7 @@ export {
4274
4289
  ContextSelectMenu,
4275
4290
  DefaultTheme,
4276
4291
  Dialog,
4292
+ DownloadButtonUtility,
4277
4293
  DropdownItemMenu,
4278
4294
  DropdownMenu,
4279
4295
  DropdownMenuItemGroup,