@overmap-ai/blocks 1.0.24 → 1.0.25-alpha.1

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,5 +1,4 @@
1
- import { ComponentProps, ReactElement, ReactNode } from "react";
2
- import { DropdownMenu as RadixDropdownMenu } from "@radix-ui/themes";
1
+ import { ReactElement, ReactNode } from "react";
3
2
  import { AllOrNone } from "../utils.ts";
4
3
  export interface BaseMenuGroupProps<TItemProps> {
5
4
  closeOnSelect?: boolean;
@@ -30,8 +29,4 @@ export type BaseMenuProps = {
30
29
  * @default false
31
30
  */
32
31
  disabled?: boolean;
33
- /** determines on which side of the trigger the dropdown select renders on, if open space
34
- * @default "bottom"
35
- * */
36
- side?: ComponentProps<typeof RadixDropdownMenu.Content>["side"];
37
32
  };
@@ -1,8 +1,9 @@
1
1
  import { FC } from "react";
2
- import { DropdownMenuItemGroupItemProps, DropdownMenuItemGroupProps } from "../DropdownMenu/DropdownMenuGroups.tsx";
2
+ import { DropdownMenuItemGroupItemProps, DropdownMenuItemGroupProps } from "../DropdownMenu";
3
3
  import { BaseMenuProps } from "../BaseMenuGroups";
4
+ import { DropdownMenuContentProps } from "@radix-ui/react-dropdown-menu";
4
5
  export type DropdownItemMenuItemProps = DropdownMenuItemGroupItemProps;
5
- export type DropdownItemMenuProps = DropdownMenuItemGroupProps & BaseMenuProps;
6
+ export type DropdownItemMenuProps = DropdownMenuItemGroupProps & BaseMenuProps & DropdownMenuContentProps;
6
7
  /** The DropdownItemMenu component is a user interface element that provides a list of options for the user to choose from.
7
8
  * It is commonly used in web applications to present a set of related choices in a compact and organized manner.
8
9
  * This DropdownItemMenu component is a wrapper around the Radix-UI DropdownItemMenu component that can be found here https://www.radix-ui.com/themes/docs/components/dropdown-menu */
@@ -1,8 +1,9 @@
1
1
  import { FC, PropsWithChildren } from "react";
2
2
  import { DropdownMenuItemGroupItemProps } from "./DropdownMenuGroups.tsx";
3
3
  import { BaseMenuProps } from "../BaseMenuGroups";
4
+ import { DropdownMenuContentProps } from "@radix-ui/react-dropdown-menu";
4
5
  export type DropdownMenuItemProps = DropdownMenuItemGroupItemProps;
5
- export type DropdownMenuProps = PropsWithChildren & BaseMenuProps;
6
+ export type DropdownMenuProps = PropsWithChildren & BaseMenuProps & DropdownMenuContentProps;
6
7
  /** The DropdownMenu component is a user interface element that provides a list of options for the user to choose from.
7
8
  * It is commonly used in web applications to present a set of related choices in a compact and organized manner.
8
9
  * This DropdownMenu component is a wrapper around the Radix-UI DropdownMenu component that can be found here https://www.radix-ui.com/themes/docs/components/dropdown-menu */
@@ -1,6 +1,7 @@
1
1
  import { FC } from "react";
2
2
  import { DropdownMenuMultiSelectGroupItemProps, DropdownMenuMultiSelectGroupProps } from "../DropdownMenu";
3
3
  import { BaseMenuProps } from "../BaseMenuGroups";
4
+ import { DropdownMenuContentProps } from "@radix-ui/react-dropdown-menu";
4
5
  export type DropdownMultiSelectItemProps = DropdownMenuMultiSelectGroupItemProps;
5
- export type DropdownMultiSelectProps = DropdownMenuMultiSelectGroupProps & BaseMenuProps;
6
+ export type DropdownMultiSelectProps = DropdownMenuMultiSelectGroupProps & BaseMenuProps & DropdownMenuContentProps;
6
7
  export declare const DropdownMultiSelect: FC<DropdownMultiSelectProps>;
@@ -1,6 +1,7 @@
1
1
  import { FC } from "react";
2
- import { DropdownMenuItemGroupItemProps, DropdownMenuSelectGroupProps } from "../DropdownMenu/DropdownMenuGroups.tsx";
2
+ import { DropdownMenuItemGroupItemProps, DropdownMenuSelectGroupProps } from "../DropdownMenu";
3
3
  import { BaseMenuProps } from "../BaseMenuGroups";
4
+ import { DropdownMenuContentProps } from "@radix-ui/react-dropdown-menu";
4
5
  export type DropdownSelectItemProps = DropdownMenuItemGroupItemProps;
5
- export type DropdownSelectProps = DropdownMenuSelectGroupProps & BaseMenuProps;
6
+ export type DropdownSelectProps = DropdownMenuSelectGroupProps & BaseMenuProps & DropdownMenuContentProps;
6
7
  export declare const DropdownSelect: FC<DropdownSelectProps>;
@@ -2,5 +2,6 @@ import { PropsWithChildren } from "react";
2
2
  import { SlideOutV3Props } from "../SlideOutV3";
3
3
  export interface SlideOutTriggerProps extends PropsWithChildren {
4
4
  side: SlideOutV3Props["side"];
5
+ type?: "toggle" | "open" | "close";
5
6
  }
6
7
  export declare const SlideOutTrigger: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<SlideOutTriggerProps & import("react").RefAttributes<HTMLButtonElement>>>;
@@ -38,7 +38,7 @@ export interface SlideOutV3Props extends PropsWithChildren, PropsWithClassNameAn
38
38
  /** overlay to be rendered when the SlideOut is open*/
39
39
  overlayComponent?: ReactNode;
40
40
  /** content to be rendered within the SlideOut */
41
- content: ReactNode;
41
+ content: ReactNode | null;
42
42
  }
43
43
  /** The SlideOut component is a UI element that allows you to create a slide-in/slide-out effect for content within
44
44
  * your application. It provides a smooth transition animation for revealing and hiding content. */
package/dist/blocks.js CHANGED
@@ -666,7 +666,7 @@ const DropdownMenu = memo(
666
666
  const infoColor = useSeverityColor("info");
667
667
  return /* @__PURE__ */ jsxs(DropdownMenu$1.Root, { children: [
668
668
  /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled: disabled2, children: trigger }),
669
- /* @__PURE__ */ jsx(DropdownMenu$1.Content, { variant: "soft", color: infoColor, ...rest, children })
669
+ /* @__PURE__ */ jsx(DropdownMenu$1.Content, { variant: "soft", ...rest, color: infoColor, children })
670
670
  ] });
671
671
  })
672
672
  );
@@ -1027,12 +1027,12 @@ const DropdownSelect = memo(
1027
1027
  onFilterValueChange,
1028
1028
  closeOnSelect = true,
1029
1029
  icons,
1030
- side
1030
+ ...rest
1031
1031
  }, ref) => {
1032
1032
  const infoColor = useSeverityColor("info");
1033
1033
  return /* @__PURE__ */ jsxs(DropdownMenu$1.Root, { children: [
1034
1034
  /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled: disabled2, children: trigger }),
1035
- /* @__PURE__ */ jsx(DropdownMenu$1.Content, { ref, variant: "soft", color: infoColor, side, children: /* @__PURE__ */ jsx(
1035
+ /* @__PURE__ */ jsx(DropdownMenu$1.Content, { ref, variant: "soft", ...rest, color: infoColor, children: /* @__PURE__ */ jsx(
1036
1036
  DropdownMenuSelectGroup,
1037
1037
  {
1038
1038
  value,
@@ -1062,12 +1062,12 @@ const DropdownMultiSelect = memo(
1062
1062
  onFilterValueChange,
1063
1063
  closeOnSelect = false,
1064
1064
  icons,
1065
- side
1065
+ ...rest
1066
1066
  }, ref) => {
1067
1067
  const infoColor = useSeverityColor("info");
1068
1068
  return /* @__PURE__ */ jsxs(DropdownMenu$1.Root, { children: [
1069
1069
  /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, { disabled: disabled2, children: trigger }),
1070
- /* @__PURE__ */ jsx(DropdownMenu$1.Content, { ref, variant: "soft", color: infoColor, side, children: /* @__PURE__ */ jsx(
1070
+ /* @__PURE__ */ jsx(DropdownMenu$1.Content, { ref, variant: "soft", ...rest, color: infoColor, children: /* @__PURE__ */ jsx(
1071
1071
  DropdownMenuMultiSelectGroup,
1072
1072
  {
1073
1073
  values,
@@ -1659,18 +1659,18 @@ const SlideOutV3 = memo(
1659
1659
  height: "100%",
1660
1660
  direction: "row",
1661
1661
  position: "relative",
1662
- style: { overflow: "hidden" },
1662
+ style: { overflow: "hidden", maxWidth: "100%", maxHeight: "100%" },
1663
1663
  children: [
1664
1664
  side === "left" && /* @__PURE__ */ jsxs(Fragment, { children: [
1665
1665
  open && overlayComponent,
1666
1666
  " ",
1667
- SlideOut2
1667
+ content && SlideOut2
1668
1668
  ] }),
1669
- /* @__PURE__ */ jsx(Flex$1, { ref: childrenContainerRef, grow: "1", height: "100%", children }),
1669
+ /* @__PURE__ */ jsx(Flex$1, { ref: childrenContainerRef, grow: "1", height: "100%", style: { maxWidth: "100%" }, children }),
1670
1670
  side === "right" && /* @__PURE__ */ jsxs(Fragment, { children: [
1671
1671
  open && overlayComponent,
1672
1672
  " ",
1673
- SlideOut2
1673
+ content && SlideOut2
1674
1674
  ] })
1675
1675
  ]
1676
1676
  }
@@ -1748,17 +1748,24 @@ const RightSlideOut = memo(
1748
1748
  );
1749
1749
  })
1750
1750
  );
1751
+ function nextStateBasedOnType(prevState, type) {
1752
+ switch (type) {
1753
+ case "toggle":
1754
+ return !prevState;
1755
+ case "open":
1756
+ return true;
1757
+ case "close":
1758
+ return false;
1759
+ }
1760
+ }
1751
1761
  const SlideOutTrigger = memo(
1752
1762
  forwardRef((props, ref) => {
1753
- const { side, children } = props;
1763
+ const { side, type = "toggle", children } = props;
1754
1764
  const { setShowLeftSlideOut, setShowRightSlideOut } = useLayoutContext();
1755
1765
  const handleClick = useCallback(() => {
1756
- if (side === "left") {
1757
- setShowLeftSlideOut((prevState) => !prevState);
1758
- } else {
1759
- setShowRightSlideOut((prevState) => !prevState);
1760
- }
1761
- }, [setShowLeftSlideOut, setShowRightSlideOut, side]);
1766
+ const setShowSlideOut = side === "left" ? setShowLeftSlideOut : setShowRightSlideOut;
1767
+ setShowSlideOut((prevState) => nextStateBasedOnType(prevState, type));
1768
+ }, [setShowLeftSlideOut, setShowRightSlideOut, side, type]);
1762
1769
  return /* @__PURE__ */ jsx(Slot, { ref, onClick: handleClick, children });
1763
1770
  })
1764
1771
  );