@overmap-ai/blocks 1.0.33-menu-styling-updates.6 → 1.0.33

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.
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { SlideOutV2Props } from "../SlideOut";
3
- import { SlideOutV3Props } from "../SlideOutV3";
4
- interface SlideOutProps extends Omit<SlideOutV3Props, "open" | "initialWidth"> {
2
+ import { SlideOutProps } from "../SlideOut";
3
+ interface SlideOutImplProps extends Omit<SlideOutProps, "open" | "initialWidth"> {
5
4
  /** controls if the SlideOut is initially open once mounted when NOT in smallMode.
6
5
  * NOTE: changing the value of this will cause the SlideOut to open/close after mounting NOT in smallMode depending on
7
6
  * its passed in value.
@@ -11,13 +10,13 @@ interface SlideOutProps extends Omit<SlideOutV3Props, "open" | "initialWidth"> {
11
10
  large?: boolean;
12
11
  };
13
12
  /** optional prop to control the open state of the SlideOut */
14
- open?: SlideOutV2Props["open"];
13
+ open?: SlideOutProps["open"];
15
14
  /** optional prop to control the initialWidth of the SlideOut
16
15
  * @default "30%" */
17
- initialWidth?: SlideOutV2Props["initialWidth"];
16
+ initialWidth?: SlideOutProps["initialWidth"];
18
17
  }
19
18
  /** Type used for both Layout.LeftSlideOut and Layout.RightSlideOut */
20
- export interface LayoutSlideOutProps extends Omit<SlideOutProps, "side"> {
19
+ export interface LayoutSlideOutProps extends Omit<SlideOutImplProps, "side"> {
21
20
  }
22
21
  /** TODO: Document */
23
22
  export declare const LeftSlideOut: import("react").NamedExoticComponent<LayoutSlideOutProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,8 @@
1
1
  import { ComponentProps, PropsWithoutRef } from "react";
2
- import { SlideOutV3Props } from "../SlideOutV3";
2
+ import { SlideOutProps } from "../SlideOut";
3
3
  export interface LayoutOverlayProps extends PropsWithoutRef<ComponentProps<"div">> {
4
4
  active?: boolean;
5
- side: SlideOutV3Props["side"];
5
+ side: SlideOutProps["side"];
6
6
  smallModeOnly?: boolean;
7
7
  }
8
8
  export declare const SlideOutOverlay: import("react").NamedExoticComponent<LayoutOverlayProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren } from "react";
2
- import { SlideOutV3Props } from "../SlideOutV3";
2
+ import { SlideOutProps } from "../SlideOut";
3
3
  export interface SlideOutTriggerProps extends PropsWithChildren {
4
- side: SlideOutV3Props["side"];
4
+ side: SlideOutProps["side"];
5
5
  type?: "toggle" | "open" | "close";
6
6
  }
7
7
  export declare const SlideOutTrigger: import("react").NamedExoticComponent<SlideOutTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,6 +1,6 @@
1
1
  import { PropsWithChildren, ReactNode } from "react";
2
2
  import { PropsWithClassNameAndStyle } from "../typings";
3
- export interface SlideOutV3Props extends PropsWithChildren, PropsWithClassNameAndStyle {
3
+ export interface SlideOutProps extends PropsWithChildren, PropsWithClassNameAndStyle {
4
4
  /** The controlled open state of the SlideOut */
5
5
  open: boolean;
6
6
  /** specifies if the SlideOut is in modal mode or not.
@@ -47,4 +47,4 @@ export interface SlideOutV3Props extends PropsWithChildren, PropsWithClassNameAn
47
47
  }
48
48
  /** The SlideOut component is a UI element that allows you to create a slide-in/slide-out effect for content within
49
49
  * your application. It provides a smooth transition animation for revealing and hiding content. */
50
- export declare const SlideOutV3: import("react").NamedExoticComponent<SlideOutV3Props & import("react").RefAttributes<HTMLDivElement>>;
50
+ export declare const SlideOut: import("react").NamedExoticComponent<SlideOutProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- export * from "./SlideOutV2";
1
+ export * from "./SlideOut";
package/dist/blocks.js CHANGED
@@ -22,8 +22,6 @@ import { useErrorBoundary, ErrorBoundary } from "react-error-boundary";
22
22
  import * as RadixPopover from "@radix-ui/react-popover";
23
23
  import * as RadixRadioGroup from "@radix-ui/react-radio-group";
24
24
  import * as RadixToggleGroup from "@radix-ui/react-toggle-group";
25
- import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
26
- import { Resizable } from "re-resizable";
27
25
  import * as RadixSwitch from "@radix-ui/react-switch";
28
26
  import * as RadixTabs from "@radix-ui/react-tabs";
29
27
  import * as RadixToast from "@radix-ui/react-toast";
@@ -1659,8 +1657,8 @@ function useCallbackRef(callback) {
1659
1657
  return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
1660
1658
  }, []);
1661
1659
  }
1662
- const TIMEOUT_DURATION$1 = 200;
1663
- const SlideOutV3 = memo(
1660
+ const TIMEOUT_DURATION = 200;
1661
+ const SlideOut = memo(
1664
1662
  forwardRef((props, ref) => {
1665
1663
  const {
1666
1664
  className,
@@ -1779,7 +1777,7 @@ const SlideOutV3 = memo(
1779
1777
  {
1780
1778
  classNames: CSSTransitionClassNames,
1781
1779
  in: open,
1782
- timeout: TIMEOUT_DURATION$1,
1780
+ timeout: TIMEOUT_DURATION,
1783
1781
  unmountOnExit: true,
1784
1782
  mountOnEnter: true,
1785
1783
  onEntering: onOpening,
@@ -1859,7 +1857,7 @@ const SlideOutV3 = memo(
1859
1857
  })
1860
1858
  );
1861
1859
  const DEFAULT_INITIAL_WIDTH = "30%";
1862
- const SlideOut = memo(
1860
+ const SlideOutImpl = memo(
1863
1861
  forwardRef((props, ref) => {
1864
1862
  const { small, hideLayout } = useLayoutContext();
1865
1863
  const { className, showSlideOut, setShowSlideOut, defaultOpen, side, ...rest } = props;
@@ -1889,7 +1887,7 @@ const SlideOut = memo(
1889
1887
  [handleDismiss, rest, showSlideOut, small]
1890
1888
  );
1891
1889
  return !hideLayout && /* @__PURE__ */ jsx(
1892
- SlideOutV3,
1890
+ SlideOut,
1893
1891
  {
1894
1892
  className: cx(`overmap-layout-slideOut-${side}`, className),
1895
1893
  side,
@@ -1903,7 +1901,7 @@ const LeftSlideOut = memo(
1903
1901
  forwardRef((props, ref) => {
1904
1902
  const { showLeftSlideOut, setShowLeftSlideOut } = useLayoutContext();
1905
1903
  return /* @__PURE__ */ jsx(
1906
- SlideOut,
1904
+ SlideOutImpl,
1907
1905
  {
1908
1906
  side: "left",
1909
1907
  showSlideOut: showLeftSlideOut,
@@ -1918,7 +1916,7 @@ const RightSlideOut = memo(
1918
1916
  forwardRef((props, ref) => {
1919
1917
  const { showRightSlideOut, setShowRightSlideOut } = useLayoutContext();
1920
1918
  return /* @__PURE__ */ jsx(
1921
- SlideOut,
1919
+ SlideOutImpl,
1922
1920
  {
1923
1921
  side: "right",
1924
1922
  showSlideOut: showRightSlideOut,
@@ -3535,125 +3533,6 @@ const Separator = forwardRef((props, ref) => {
3535
3533
  );
3536
3534
  });
3537
3535
  Separator.displayName = "Separator";
3538
- const TIMEOUT_DURATION = 200;
3539
- const SlideOutV2 = memo(
3540
- forwardRef((props, ref) => {
3541
- const {
3542
- className,
3543
- style,
3544
- children,
3545
- open,
3546
- modal = false,
3547
- resizeable = true,
3548
- side,
3549
- position = "relative",
3550
- initialWidth,
3551
- minWidth,
3552
- maxWidth,
3553
- onDismiss,
3554
- onOpening,
3555
- onClosed
3556
- } = props;
3557
- const isLeft = side === "left";
3558
- const [slideOutWidth, setSlideOutWidth] = useState(initialWidth);
3559
- const handleResize = useCallback(
3560
- (_event, _dir, ref2, _delta) => {
3561
- setSlideOutWidth(ref2.clientWidth);
3562
- },
3563
- []
3564
- );
3565
- const handleDismiss = useCallback(() => {
3566
- if (modal && onDismiss) {
3567
- onDismiss();
3568
- }
3569
- }, [modal, onDismiss]);
3570
- useEffect(() => {
3571
- setSlideOutWidth(initialWidth);
3572
- }, [initialWidth]);
3573
- const CSSTransitionClassNames = useMemo(
3574
- () => ({
3575
- enter: isLeft ? "-ml-(--slide-out-width)" : "-mr-(--slide-out-width)",
3576
- enterActive: isLeft ? "ease-linear duration-200 transition-[margin-left] ml-0" : "ease-linear duration-200 transition-[margin-right] mr-0",
3577
- enterDone: isLeft ? "ml-0" : "mr-0",
3578
- exitActive: isLeft ? "ease-linear duration-200 transition-[margin-left] -ml-(--slide-out-width)" : "ease-linear duration-200 transition-[margin-right] -mr-(--slide-out-width)",
3579
- exitDone: isLeft ? "-ml-(--slide-out-width)" : "-mr-(--slide-out-width)"
3580
- }),
3581
- [isLeft]
3582
- );
3583
- return (
3584
- /** The DismissableLayer Component is strictly a functionality-based component for emulating an overlay. Its main use is for
3585
- * detecting interactions OUTSIDE whatever content is placed within it, allowing the developer to decide what to do with that
3586
- * content when it is 'dismissed' (i.e closed, to be hidden, etc.).
3587
- *
3588
- * There are three main events that trigger this 'dismissal' behavior
3589
- * 1) Focus is given to an element outside the content rendered within the DismissableLayer component
3590
- * 2) PointerEvent occurs on an element outside the content rendered within the DismissableLayer component
3591
- * 3) Escape key is pressed
3592
- *
3593
- * The 'disableOutsidePointerEvents' prop is used for disabling focus and PointerEvents on outside elements.
3594
- * The dismissal behavior will still eb trigger, it just won't allow any elements to be interacted with until
3595
- * the DismissableLayer is removed from the DOM, or 'disableOutsidePointerEvents' is set to false
3596
- *
3597
- * In this use case, Overmap's SlideOut will have two specific behaviors
3598
- * 1) Modal mode - the SlideOut has modal-like behavior where it will dismiss PointerEvents and Focus of
3599
- * outside elements
3600
- * 2) Non-modal mode - the SlideOut behaves like a side panel the co-exists with content outside of it
3601
- * */
3602
- /* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
3603
- /* @ts-ignore */
3604
- /* @__PURE__ */ jsx(
3605
- CSSTransition,
3606
- {
3607
- classNames: CSSTransitionClassNames,
3608
- in: open,
3609
- timeout: TIMEOUT_DURATION,
3610
- unmountOnExit: true,
3611
- mountOnEnter: true,
3612
- onEntering: onOpening,
3613
- onExited: onClosed,
3614
- children: /* @__PURE__ */ jsx(
3615
- DismissableLayer,
3616
- {
3617
- disableOutsidePointerEvents: modal,
3618
- style,
3619
- onInteractOutside: handleDismiss,
3620
- onEscapeKeyDown: handleDismiss,
3621
- asChild: true,
3622
- children: /* @__PURE__ */ jsx(
3623
- Slot,
3624
- {
3625
- className: cx(className, "top-0", "bottom-0", {
3626
- "left-0": isLeft,
3627
- "right-0": !isLeft,
3628
- absolute: position === "absolute",
3629
- relative: position === "relative"
3630
- }),
3631
- ref,
3632
- children: /* @__PURE__ */ jsx(
3633
- Resizable,
3634
- {
3635
- onResize: handleResize,
3636
- size: { width: slideOutWidth, height: "100%" },
3637
- style: {
3638
- position,
3639
- "--slide-out-width": `${slideOutWidth}${typeof slideOutWidth === "number" ? "px" : ""}`
3640
- },
3641
- minWidth,
3642
- maxWidth,
3643
- enable: { left: resizeable && !isLeft, right: resizeable && isLeft },
3644
- children
3645
- }
3646
- )
3647
- }
3648
- )
3649
- },
3650
- modal ? "1" : "0"
3651
- )
3652
- }
3653
- )
3654
- );
3655
- })
3656
- );
3657
3536
  const Spinner = memo(() => {
3658
3537
  return /* @__PURE__ */ jsx("div", { className: "size-5 animate-spin rounded-full border-2 border-(--base-a12) border-b-transparent" });
3659
3538
  });
@@ -4553,8 +4432,7 @@ export {
4553
4432
  SegmentedControlRoot,
4554
4433
  SelectedIndicatorContext,
4555
4434
  Separator,
4556
- SlideOutV2,
4557
- SlideOutV3,
4435
+ SlideOut,
4558
4436
  Spinner,
4559
4437
  Switch,
4560
4438
  SwitchRoot,