@rowsncolumns/ui 16.0.5 → 16.1.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.
Files changed (57) hide show
  1. package/dist/cjs/dialog/index.d.ts +6 -0
  2. package/dist/cjs/dialog/index.d.ts.map +1 -1
  3. package/dist/cjs/dialog/index.js +4 -2
  4. package/dist/cjs/dropdown/index.d.ts +4 -1
  5. package/dist/cjs/dropdown/index.d.ts.map +1 -1
  6. package/dist/cjs/dropdown/index.js +22 -3
  7. package/dist/cjs/editor-pm/prosemirror-editor.d.ts.map +1 -1
  8. package/dist/cjs/editor-pm/prosemirror-editor.js +46 -4
  9. package/dist/cjs/editor-pm/schema.d.ts +1 -1
  10. package/dist/cjs/hooks/use-menu-opening-release-guard.d.ts +28 -0
  11. package/dist/cjs/hooks/use-menu-opening-release-guard.d.ts.map +1 -0
  12. package/dist/cjs/hooks/use-menu-opening-release-guard.js +108 -0
  13. package/dist/cjs/index.d.ts +2 -0
  14. package/dist/cjs/index.d.ts.map +1 -1
  15. package/dist/cjs/index.js +2 -0
  16. package/dist/cjs/popover/index.d.ts +4 -1
  17. package/dist/cjs/popover/index.d.ts.map +1 -1
  18. package/dist/cjs/popover/index.js +7 -1
  19. package/dist/cjs/portal-container/index.d.ts +23 -0
  20. package/dist/cjs/portal-container/index.d.ts.map +1 -0
  21. package/dist/cjs/portal-container/index.js +22 -0
  22. package/dist/cjs/select/index.d.ts +7 -2
  23. package/dist/cjs/select/index.d.ts.map +1 -1
  24. package/dist/cjs/select/index.js +9 -3
  25. package/dist/cjs/tooltip/index.d.ts +5 -1
  26. package/dist/cjs/tooltip/index.d.ts.map +1 -1
  27. package/dist/cjs/tooltip/index.js +9 -2
  28. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  29. package/dist/esm/dialog/index.d.ts +6 -0
  30. package/dist/esm/dialog/index.d.ts.map +1 -1
  31. package/dist/esm/dialog/index.js +6 -2
  32. package/dist/esm/dropdown/index.d.ts +4 -1
  33. package/dist/esm/dropdown/index.d.ts.map +1 -1
  34. package/dist/esm/dropdown/index.js +22 -2
  35. package/dist/esm/editor-pm/prosemirror-editor.d.ts.map +1 -1
  36. package/dist/esm/editor-pm/prosemirror-editor.js +46 -4
  37. package/dist/esm/editor-pm/schema.d.ts +1 -1
  38. package/dist/esm/hooks/use-menu-opening-release-guard.d.ts +28 -0
  39. package/dist/esm/hooks/use-menu-opening-release-guard.d.ts.map +1 -0
  40. package/dist/esm/hooks/use-menu-opening-release-guard.js +102 -0
  41. package/dist/esm/index.d.ts +2 -0
  42. package/dist/esm/index.d.ts.map +1 -1
  43. package/dist/esm/index.js +2 -0
  44. package/dist/esm/popover/index.d.ts +4 -1
  45. package/dist/esm/popover/index.d.ts.map +1 -1
  46. package/dist/esm/popover/index.js +6 -1
  47. package/dist/esm/portal-container/index.d.ts +23 -0
  48. package/dist/esm/portal-container/index.d.ts.map +1 -0
  49. package/dist/esm/portal-container/index.js +17 -0
  50. package/dist/esm/select/index.d.ts +7 -2
  51. package/dist/esm/select/index.d.ts.map +1 -1
  52. package/dist/esm/select/index.js +7 -2
  53. package/dist/esm/tooltip/index.d.ts +5 -1
  54. package/dist/esm/tooltip/index.d.ts.map +1 -1
  55. package/dist/esm/tooltip/index.js +8 -2
  56. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  57. package/package.json +5 -5
@@ -3,10 +3,14 @@ import React from "react";
3
3
  declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
4
4
  declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
5
5
  declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const TooltipPortal: {
7
+ ({ container, ...props }: TooltipPrimitive.TooltipPortalProps): React.JSX.Element;
8
+ displayName: string | undefined;
9
+ };
6
10
  declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
11
  type SimpleTooltipProps = React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {
8
12
  tooltip: React.ReactNode;
9
13
  };
10
14
  export declare const SimpleTooltip: ({ children, tooltip }: SimpleTooltipProps) => React.JSX.Element;
11
- export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
15
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipPortal, TooltipProvider, };
12
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../tooltip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,eAAe,iDAA4B,CAAC;AAElD,QAAA,MAAM,OAAO,yCAAwB,CAAC;AAEtC,QAAA,MAAM,cAAc,gHAA2B,CAAC;AAEhD,QAAA,MAAM,cAAc,gKAclB,CAAC;AAGH,KAAK,kBAAkB,GAAG,KAAK,CAAC,wBAAwB,CACtD,OAAO,gBAAgB,CAAC,OAAO,CAChC,GAAG;IACF,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,uBAAuB,kBAAkB,sBAOtE,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../tooltip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,QAAA,MAAM,eAAe,iDAA4B,CAAC;AAElD,QAAA,MAAM,OAAO,yCAAwB,CAAC;AAEtC,QAAA,MAAM,cAAc,gHAA2B,CAAC;AAEhD,QAAA,MAAM,aAAa;8BAGhB,gBAAgB,CAAC,kBAAkB;;CAQrC,CAAC;AAGF,QAAA,MAAM,cAAc,gKAclB,CAAC;AAGH,KAAK,kBAAkB,GAAG,KAAK,CAAC,wBAAwB,CACtD,OAAO,gBAAgB,CAAC,OAAO,CAChC,GAAG;IACF,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,uBAAuB,kBAAkB,sBAOtE,CAAC;AAEF,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,aAAa,EACb,eAAe,GAChB,CAAC"}
@@ -1,10 +1,17 @@
1
1
  import { __assign, __rest } from "tslib";
2
2
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
3
  import React from "react";
4
+ import { usePortalContainer } from "../portal-container";
4
5
  import { cn } from "../utils";
5
6
  var TooltipProvider = TooltipPrimitive.Provider;
6
7
  var Tooltip = TooltipPrimitive.Root;
7
8
  var TooltipTrigger = TooltipPrimitive.Trigger;
9
+ var TooltipPortal = function (_a) {
10
+ var container = _a.container, props = __rest(_a, ["container"]);
11
+ var portalContainer = usePortalContainer();
12
+ return (React.createElement(TooltipPrimitive.Portal, __assign({ container: container !== null && container !== void 0 ? container : portalContainer }, props)));
13
+ };
14
+ TooltipPortal.displayName = TooltipPrimitive.Portal.displayName;
8
15
  var TooltipContent = React.forwardRef(function (_a, ref) {
9
16
  var className = _a.className, _b = _a.sideOffset, sideOffset = _b === void 0 ? 4 : _b, props = __rest(_a, ["className", "sideOffset"]);
10
17
  return (React.createElement(TooltipPrimitive.Content, __assign({ ref: ref, sideOffset: sideOffset, className: cn("z-50 overflow-hidden rounded-sm border-rnc-border border-solid border px-2 py-1 text-xs shadow-md animate-in fade-in-50 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 font-system", "bg-zinc-950 text-white", className) }, props)));
@@ -14,7 +21,7 @@ export var SimpleTooltip = function (_a) {
14
21
  var children = _a.children, tooltip = _a.tooltip;
15
22
  return (React.createElement(Tooltip, { delayDuration: 300, disableHoverableContent: true },
16
23
  React.createElement(TooltipTrigger, { asChild: true }, children),
17
- React.createElement(TooltipPrimitive.Portal, null,
24
+ React.createElement(TooltipPortal, null,
18
25
  React.createElement(TooltipContent, null, tooltip))));
19
26
  };
20
- export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
27
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipPortal, TooltipProvider, };
@@ -1 +1 @@
1
- {"root":["../../index.ts","../../utils.ts","../../vitest.config.ts","../../arrow/index.tsx","../../button/index.tsx","../../calendar/index.tsx","../../card/index.tsx","../../cell-tooltip/index.tsx","../../circular-loader/index.tsx","../../color-picker/index.tsx","../../color-picker/style.tsx","../../command/index.tsx","../../conditional-wrapper/index.tsx","../../dialog/index.tsx","../../dropdown/index.tsx","../../editor/constants.ts","../../editor/editor-error-boundary.tsx","../../editor/style.tsx","../../editor/suggestions-dropdown.tsx","../../editor-pm/constants.ts","../../editor-pm/decoration-plugin.ts","../../editor-pm/helpers.ts","../../editor-pm/index.tsx","../../editor-pm/mention-nodeview.tsx","../../editor-pm/mentions-dropdown.tsx","../../editor-pm/mentions-plugin.ts","../../editor-pm/placeholder-plugin.ts","../../editor-pm/prosemirror-editor.tsx","../../editor-pm/schema.ts","../../editor-pm/types.ts","../../editor-pm/unfocused-selection-plugin.ts","../../editor-pm/use-dropdown-change-pm.ts","../../editor-pm/use-editor-change-pm.ts","../../editor-pm/use-editor-decorator-pm.ts","../../editor-pm/use-editor-keydown-pm.ts","../../editor-pm/use-mention-keydown.ts","../../editor-pm/use-parameter-suggestions.ts","../../eye-dropper/index.tsx","../../function-info/helpers.ts","../../function-info/index.tsx","../../function-info/style.tsx","../../hex-color-picker/index.tsx","../../hooks/use-cycle-reference.ts","../../hooks/use-dropdown-categories.ts","../../hooks/use-dropdown.ts","../../hooks/use-isomorphic-layout-effect.ts.ts","../../hooks/use-modal.tsx","../../hooks/use-visibility.ts","../../icon-button/index.tsx","../../input/index.tsx","../../popover/index.tsx","../../progress/index.tsx","../../select/index.tsx","../../separator/index.tsx","../../skeleton/index.tsx","../../stack/index.tsx","../../tabs/index.tsx","../../tooltip/index.tsx"],"version":"5.8.3"}
1
+ {"root":["../../index.ts","../../utils.ts","../../vitest.config.ts","../../arrow/index.tsx","../../button/index.tsx","../../calendar/index.tsx","../../card/index.tsx","../../cell-tooltip/index.tsx","../../circular-loader/index.tsx","../../color-picker/index.tsx","../../color-picker/style.tsx","../../command/index.tsx","../../conditional-wrapper/index.tsx","../../dialog/index.tsx","../../dropdown/index.tsx","../../editor/constants.ts","../../editor/editor-error-boundary.tsx","../../editor/style.tsx","../../editor/suggestions-dropdown.tsx","../../editor-pm/constants.ts","../../editor-pm/decoration-plugin.ts","../../editor-pm/helpers.ts","../../editor-pm/index.tsx","../../editor-pm/mention-nodeview.tsx","../../editor-pm/mentions-dropdown.tsx","../../editor-pm/mentions-plugin.ts","../../editor-pm/placeholder-plugin.ts","../../editor-pm/prosemirror-editor.tsx","../../editor-pm/schema.ts","../../editor-pm/types.ts","../../editor-pm/unfocused-selection-plugin.ts","../../editor-pm/use-dropdown-change-pm.ts","../../editor-pm/use-editor-change-pm.ts","../../editor-pm/use-editor-decorator-pm.ts","../../editor-pm/use-editor-keydown-pm.ts","../../editor-pm/use-mention-keydown.ts","../../editor-pm/use-parameter-suggestions.ts","../../eye-dropper/index.tsx","../../function-info/helpers.ts","../../function-info/index.tsx","../../function-info/style.tsx","../../hex-color-picker/index.tsx","../../hooks/use-cycle-reference.ts","../../hooks/use-dropdown-categories.ts","../../hooks/use-dropdown.ts","../../hooks/use-isomorphic-layout-effect.ts.ts","../../hooks/use-menu-opening-release-guard.ts","../../hooks/use-modal.tsx","../../hooks/use-visibility.ts","../../icon-button/index.tsx","../../input/index.tsx","../../popover/index.tsx","../../portal-container/index.tsx","../../progress/index.tsx","../../select/index.tsx","../../separator/index.tsx","../../skeleton/index.tsx","../../stack/index.tsx","../../tabs/index.tsx","../../tooltip/index.tsx"],"version":"5.8.3"}
@@ -1,5 +1,11 @@
1
1
  import * as DialogPrimitive from "@radix-ui/react-dialog";
2
2
  import React from "react";
3
+ export declare const DialogPortal: {
4
+ ({ children, className, container, ...props }: DialogPrimitive.DialogPortalProps & {
5
+ className?: string;
6
+ }): React.JSX.Element;
7
+ displayName: string | undefined;
8
+ };
3
9
  export declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
4
10
  export declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
5
11
  export declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AA6C1B,eAAO,MAAM,WAAW,oKAYtB,CAAC;AAGH,eAAO,MAAM,iBAAiB,8KAY5B,CAAC;AAkBH,eAAO,MAAM,aAAa;sBAGJ,MAAM;gBACZ,WAAW,GAAG,IAAI;wCA8ChC,CAAC;AAGH,eAAO,MAAM,MAAM,uCAAuB,CAAC;AAC3C,eAAO,MAAM,aAAa,8GAA0B,CAAC;AACrD,eAAO,MAAM,WAAW,4GAAwB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,4KAS5B,CAAC;AAGH,eAAO,MAAM,UAAU,GAAI,0BAGxB;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,sBAEA,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AA2B1B,eAAO,MAAM,YAAY;mDAKtB,eAAe,CAAC,iBAAiB,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;;CAc5D,CAAC;AAGF,eAAO,MAAM,WAAW,oKAYtB,CAAC;AAGH,eAAO,MAAM,iBAAiB,8KAY5B,CAAC;AAkBH,eAAO,MAAM,aAAa;sBAGJ,MAAM;gBACZ,WAAW,GAAG,IAAI;wCA8ChC,CAAC;AAGH,eAAO,MAAM,MAAM,uCAAuB,CAAC;AAC3C,eAAO,MAAM,aAAa,8GAA0B,CAAC;AACrD,eAAO,MAAM,WAAW,4GAAwB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,4KAS5B,CAAC;AAGH,eAAO,MAAM,UAAU,GAAI,0BAGxB;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,sBAEA,CAAC"}
@@ -3,6 +3,7 @@ import { useRef } from "react";
3
3
  import React from "react";
4
4
  import Draggable from "react-draggable";
5
5
  import { IconButton } from "./../icon-button";
6
+ import { usePortalContainer } from "./../portal-container";
6
7
  import { cn } from "./../utils";
7
8
  const FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, [tabindex], [contenteditable]";
8
9
  const TEXT_ENTRY_SELECTOR = 'input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), textarea, [contenteditable]:not([contenteditable="false"])';
@@ -16,8 +17,11 @@ const firstTabbable = (container) => {
16
17
  }
17
18
  return null;
18
19
  };
19
- const DialogPortal = ({ children, className, container, ...props }) => (React.createElement(DialogPrimitive.Portal, { container: container, ...props },
20
- React.createElement("div", { className: cn("fixed inset-0 z-50 flex items-start justify-center sm:items-center pointer-events-none", className) }, children)));
20
+ export const DialogPortal = ({ children, className, container, ...props }) => {
21
+ const portalContainer = usePortalContainer();
22
+ return (React.createElement(DialogPrimitive.Portal, { container: container ?? portalContainer, ...props },
23
+ React.createElement("div", { className: cn("fixed inset-0 z-50 flex items-start justify-center sm:items-center pointer-events-none", className) }, children)));
24
+ };
21
25
  DialogPortal.displayName = DialogPrimitive.Portal.displayName;
22
26
  export const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (React.createElement(DialogPrimitive.Title, { ref: ref, className: cn("m-0 p-4 pb-1 text-lg font-semibold leading-none tracking-tight font-system rnc-drag-handle cursor-move", className), ...props })));
23
27
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
@@ -4,7 +4,10 @@ export declare const DropdownRightSlot: ({ className, ...props }: React.Componen
4
4
  export declare const DropdownLeftSlot: ({ className, ...props }: React.ComponentPropsWithoutRef<"div">) => React.JSX.Element;
5
5
  export declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
6
6
  export declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
7
- export declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
7
+ export declare const DropdownMenuPortal: {
8
+ ({ container, ...props }: DropdownMenuPrimitive.DropdownMenuPortalProps): React.JSX.Element;
9
+ displayName: string | undefined;
10
+ };
8
11
  export declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
9
12
  export declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
10
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../dropdown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,iBAAiB,GAAI,yBAG/B,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,sBAUvC,CAAC;AACF,eAAO,MAAM,gBAAgB,GAAI,yBAG9B,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,sBAOvC,CAAC;AAGF,eAAO,MAAM,YAAY,mDAA6B,CAAC;AACvD,eAAO,MAAM,mBAAmB,0HAAgC,CAAC;AACjE,eAAO,MAAM,kBAAkB,yDAA+B,CAAC;AAE/D,eAAO,MAAM,sBAAsB,0HAAmC,CAAC;AAWvE,eAAO,MAAM,mBAAmB;IAP9B;;;OAGG;iCAC0B,OAAO;wCA6BrC,CAAC;AAGF,eAAO,MAAM,gBAAgB;YAGjB,OAAO;wCAYjB,CAAC;AAGH,eAAO,MAAM,uBAAuB;YAKxB,OAAO;2CAYjB,CAAC;AAIH,eAAO,MAAM,wBAAwB,+KAenC,CAAC;AAIH,eAAO,MAAM,iBAAiB;YAGlB,OAAO;wCAYjB,CAAC;AAGH,eAAO,MAAM,qBAAqB,4KAShC,CAAC;AAGH,eAAO,MAAM,iBAAiB,sKAS5B,CAAC;AAGH,eAAO,MAAM,yBAAyB,kLAcpC,CAAC;AAIH,eAAO,MAAM,eAAe,sDAA4B,CAAC;AAEzD,eAAO,MAAM,sBAAsB;YAGvB,OAAO;wCAcjB,CAAC;AAKH,eAAO,MAAM,sBAAsB,6KAYjC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../dropdown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,eAAO,MAAM,iBAAiB,GAAI,yBAG/B,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,sBAUvC,CAAC;AACF,eAAO,MAAM,gBAAgB,GAAI,yBAG9B,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,sBAOvC,CAAC;AAGF,eAAO,MAAM,YAAY,mDAA6B,CAAC;AACvD,eAAO,MAAM,mBAAmB,0HAAgC,CAAC;AACjE,eAAO,MAAM,kBAAkB;8BAG5B,qBAAqB,CAAC,uBAAuB;;CAQ/C,CAAC;AAGF,eAAO,MAAM,sBAAsB,0HAAmC,CAAC;AAWvE,eAAO,MAAM,mBAAmB;IAP9B;;;OAGG;iCAC0B,OAAO;wCAiDrC,CAAC;AAGF,eAAO,MAAM,gBAAgB;YAGjB,OAAO;wCAYjB,CAAC;AAGH,eAAO,MAAM,uBAAuB;YAKxB,OAAO;2CAYjB,CAAC;AAIH,eAAO,MAAM,wBAAwB,+KAenC,CAAC;AAIH,eAAO,MAAM,iBAAiB;YAGlB,OAAO;wCAYjB,CAAC;AAGH,eAAO,MAAM,qBAAqB,4KAShC,CAAC;AAGH,eAAO,MAAM,iBAAiB,sKAS5B,CAAC;AAGH,eAAO,MAAM,yBAAyB,kLAcpC,CAAC;AAIH,eAAO,MAAM,eAAe,sDAA4B,CAAC;AAEzD,eAAO,MAAM,sBAAsB;YAGvB,OAAO;wCAcjB,CAAC;AAKH,eAAO,MAAM,sBAAsB,6KAYjC,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
2
2
  import React from "react";
3
+ import { useMenuOpeningReleaseGuard } from "../hooks/use-menu-opening-release-guard";
4
+ import { usePortalContainer } from "../portal-container";
3
5
  import { cn } from "../utils";
4
6
  export const DropdownRightSlot = ({ className, ...props }) => {
5
7
  return (React.createElement("div", { className: cn("ml-auto pl-2 box-border text-rnc-muted-foreground leading-none", className), ...props }));
@@ -10,9 +12,27 @@ export const DropdownLeftSlot = ({ className, ...props }) => {
10
12
  // export const DropdownMenuItemStandalone = StyledStandaloneItem;
11
13
  export const DropdownMenu = DropdownMenuPrimitive.Root;
12
14
  export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
13
- export const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
15
+ export const DropdownMenuPortal = ({ container, ...props }) => {
16
+ const portalContainer = usePortalContainer();
17
+ return (React.createElement(DropdownMenuPrimitive.Portal, { container: container ?? portalContainer, ...props }));
18
+ };
19
+ DropdownMenuPortal.displayName = DropdownMenuPrimitive.Portal.displayName;
14
20
  export const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
15
- export const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, constrainToAvailableHeight = true, ...props }, ref) => (React.createElement(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border border-solid border-rnc-border bg-rnc-popover p-1 text-rnc-popover-foreground shadow-md animate-in data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", constrainToAvailableHeight && "max-h-dropdown", "overflow-auto font-system", "rnc-dropdown", className), ...props })));
21
+ export const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, constrainToAvailableHeight = true, onPointerDownCapture, onPointerMoveCapture, onPointerUpCapture, ...props }, ref) => {
22
+ // The content mounts while the press that opened the menu is still down, and it may land under
23
+ // that press; its release must not choose an item (see the hook).
24
+ const openingRelease = useMenuOpeningReleaseGuard(ref);
25
+ return (React.createElement(DropdownMenuPrimitive.Content, { ref: openingRelease.ref, sideOffset: sideOffset, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border border-solid border-rnc-border bg-rnc-popover p-1 text-rnc-popover-foreground shadow-md animate-in data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", constrainToAvailableHeight && "max-h-dropdown", "overflow-auto font-system", "rnc-dropdown", className), onPointerDownCapture: (event) => {
26
+ onPointerDownCapture?.(event);
27
+ openingRelease.onPointerDownCapture();
28
+ }, onPointerMoveCapture: (event) => {
29
+ onPointerMoveCapture?.(event);
30
+ openingRelease.onPointerMoveCapture(event);
31
+ }, onPointerUpCapture: (event) => {
32
+ onPointerUpCapture?.(event);
33
+ openingRelease.onPointerUpCapture(event);
34
+ }, ...props }));
35
+ });
16
36
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
17
37
  export const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (React.createElement(DropdownMenuPrimitive.Item, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-xs outline-none transition-colors focus:bg-rnc-accent focus:text-rnc-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-8", className), ...props })));
18
38
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
@@ -1 +1 @@
1
- {"version":3,"file":"prosemirror-editor.d.ts","sourceRoot":"","sources":["../../../editor-pm/prosemirror-editor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAK9E,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAY7B,OAAO,KAAK,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAIhD,OAAO,KAQN,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,EACV,wBAAwB,EAAC,MAAM,gCAAgC,CAAC;AASlE,OAAO,EAOL,KAAK,gBAAgB,EAEtB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAMnE,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAoBzD,MAAM,MAAM,uB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AS,YACnB,MAAM,eACH,MAAM,GAClB,UAAU,EAAE,GAAG,SAAS;IAC3B;;;OAGG;wBACiB,OAAO;IAC3B;;OAEG;0BACmB,KAAK,CAAC,WAAW,CAAC,wBAAwB,CAAC;IACjE;;;OAGG;wBAEM,MAAM,GAAG,SAAS,GAAG,IAAI,GAC/B,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;IACxC;;OAEG;iDAEa,MAAM,kBACJ,MAAM,cACV,MAAM,EAAE,GACnB,OAAO;IACV;;OAEG;;IAEH;;OAEG;;;;IAEH;;;OAGG;qBACc,OAAO;IACxB;;;OAGG;gCACyB,OAAO;IACnC;;;;OAIG;qBACc,MAAM;4DAwoD1B,CAAC"}
@@ -23,6 +23,7 @@ import { SuggestionsDropdown as DefaultSuggestionsDropdown } from "../editor/sug
23
23
  import { useCycleFormulaReference } from "../hooks/use-cycle-reference";
24
24
  import { useDropdown } from "../hooks/use-dropdown";
25
25
  import { useIsomorphicLayoutEffect } from "../hooks/use-isomorphic-layout-effect.ts";
26
+ import { usePortalContainer } from "../portal-container";
26
27
  import { cn } from "../utils";
27
28
  import { createDecorationPlugin } from "./decoration-plugin";
28
29
  import { applyTextFormatRuns, applyTextFormatToSelection, deserializeString, getPropertyStartIndex, getSelectionFontSize, isCellToken, serializeEditorValue, } from "./helpers";
@@ -64,6 +65,9 @@ export const deleteAll = (state, dispatch) => {
64
65
  export const ProseMirrorEditorThatMayError = memo(forwardRef(({ value = "", isNewValue, formulaMode, onChange, autoFocus, className, onKeyDown, disabled, showDropdown = true, persistFocus = true, editorZeroOutline, showFormulaHelp, onHideFormulaHelp, onShowFormulaHelp, tokenizer, onCancel, onSubmit, onFormulaStateChange, dropdownStyles, options, isOptionSelected, functionDescriptions, shouldFetchFunctionParameters: shouldFetchFunctionParametersProp, getFunctionParameterSuggestions: getFunctionParameterSuggestionsProp, formulaLocale, getMentions, getNamedRanges, getTableNames, getTableColumnNames, getStructuredProperties, onTeardown, SuggestionsDropdown = DefaultSuggestionsDropdown, MentionTagComponent, MentionDropdownItemComponent, isActive, stickyEditor = true, onFocus, onBlur, onCopy, onCut, onPaste, placeholder, textFormatRuns, resolveRunColor, navigationMode, enableContinuousSelection, cellFontFamily, ...props }, forwardedRef) => {
65
66
  const editorRef = useRef(null);
66
67
  const viewRef = useRef(null);
68
+ const portalContainer = usePortalContainer();
69
+ /** The `history()` plugin instance the view was created with — see `resetUndoHistory`. */
70
+ const historyPluginRef = useRef(null);
67
71
  const cellFontFamilyRef = useRef(cellFontFamily);
68
72
  // The function token is in the editor's locale (`СУММ(`); hosts are asked about the canonical
69
73
  // name (`SUM(`) so parameter providers keyed on English names work in every locale.
@@ -301,10 +305,12 @@ export const ProseMirrorEditorThatMayError = memo(forwardRef(({ value = "", isNe
301
305
  if (!editorRef.current)
302
306
  return;
303
307
  try {
308
+ const historyPlugin = history();
309
+ historyPluginRef.current = historyPlugin;
304
310
  const state = EditorState.create({
305
311
  doc: createInitialDocument(),
306
312
  plugins: [
307
- history(),
313
+ historyPlugin,
308
314
  createUnfocusedSelectionPlugin(),
309
315
  ...(placeholder ? [createPlaceholderPlugin(placeholder)] : []),
310
316
  createMentionsPlugin({
@@ -585,6 +591,32 @@ export const ProseMirrorEditorThatMayError = memo(forwardRef(({ value = "", isNe
585
591
  }
586
592
  }
587
593
  }, [createInitialDocument]); // Re-initialize if document creation logic changes
594
+ /**
595
+ * Drop the undo/redo stacks. The grid keeps ONE editor mounted across every cell it edits
596
+ * (the sticky buffer stays alive while navigating), so without a cut the `history()` plugin
597
+ * accumulates the typing of every previous cell: editing C1 and pressing Mod-z walked back
598
+ * into B1's and then A1's text (rowsncolumns/spreadsheet#1023). Undo is scoped to what the
599
+ * user typed in THIS editor since the host last seeded it. Re-adding the plugin through two
600
+ * `reconfigure`s re-runs only its `init`; every other plugin keeps its state (decorations,
601
+ * mentions, the unfocused-selection paint).
602
+ */
603
+ const resetUndoHistory = useCallback(() => {
604
+ const view = viewRef.current;
605
+ const historyPlugin = historyPluginRef.current;
606
+ if (!view || !historyPlugin)
607
+ return;
608
+ const plugins = view.state.plugins;
609
+ if (!plugins.includes(historyPlugin))
610
+ return;
611
+ try {
612
+ view.updateState(view.state
613
+ .reconfigure({ plugins: plugins.filter((p) => p !== historyPlugin) })
614
+ .reconfigure({ plugins }));
615
+ }
616
+ catch (error) {
617
+ log("Error resetting undo history:", error);
618
+ }
619
+ }, []);
588
620
  // Update editor content when value changes
589
621
  useIsomorphicLayoutEffect(() => {
590
622
  if (viewRef.current) {
@@ -603,13 +635,23 @@ export const ProseMirrorEditorThatMayError = memo(forwardRef(({ value = "", isNe
603
635
  tr.setSelection(TextSelection.atEnd(tr.doc));
604
636
  }
605
637
  viewRef.current.dispatch(tr);
638
+ // A whole-document seed is host state, not a user edit: nothing before it may be
639
+ // undone into (#1023), and the seed itself is not undoable either.
640
+ resetUndoHistory();
606
641
  }
607
642
  }
608
643
  catch (error) {
609
644
  log("Error updating editor content:", error);
610
645
  }
611
646
  }
612
- }, [value, createInitialDocument]);
647
+ }, [value, createInitialDocument, resetUndoHistory]);
648
+ // An edit session starts and ends with `navigationMode` flipping (the grid's `use-editable`
649
+ // sets it to `!isEditInProgress`). Cut the history on both edges so a cell opened with the
650
+ // same text the buffer already held — no seed dispatched — still starts with an empty
651
+ // undo stack (#1023).
652
+ useIsomorphicLayoutEffect(() => {
653
+ resetUndoHistory();
654
+ }, [navigationMode, resetUndoHistory]);
613
655
  // Update decorations when formula mode, active state or the caret
614
656
  // position changes. A change of mode/active state re-runs the token
615
657
  // analysis (it depends on `isActive`); a caret-only refresh is tagged so
@@ -1220,10 +1262,10 @@ export const ProseMirrorEditorThatMayError = memo(forwardRef(({ value = "", isNe
1220
1262
  React.createElement("button", { tabIndex: -1, className: cn("absolute left-0 top-0 w-0 h-full overflow-hidden m-0 p-0 border-none bg-transparent shadow-none"), style: {
1221
1263
  left: showMentionDropdownEffective ? mentionPositionLeft : 0,
1222
1264
  } })),
1223
- showDropdownEffective && isDropdownOpen && (React.createElement(ConditionalWrapper, { condition: stickyEditor, wrapper: (children) => React.createElement(Portal, { asChild: true }, children) },
1265
+ showDropdownEffective && isDropdownOpen && (React.createElement(ConditionalWrapper, { condition: stickyEditor, wrapper: (children) => (React.createElement(Portal, { asChild: true, container: portalContainer }, children)) },
1224
1266
  React.createElement(Popper.Content, { side: "bottom", align: "start", className: "z-50", sideOffset: 2 },
1225
1267
  React.createElement(SuggestionsDropdown, { functionDescriptions: functionDescriptions, formulaMode: formulaMode, dropdownStyles: dropdownStyles, functionToken: functionToken, parameterIndex: parameterIndex, items: items, highlightedIndex: highlightedIndex, onSelect: onSelect, onChangeHighlightedIndex: onChangeHighlightedIndex, showFormulaHelp: showFormulaHelp, onHideFormulaHelp: onHideFormulaHelp, formulaLocale: formulaLocale })))),
1226
- showDropdownEffective && showMentionDropdownEffective && (React.createElement(ConditionalWrapper, { condition: stickyEditor, wrapper: (children) => React.createElement(Portal, { asChild: true }, children) },
1268
+ showDropdownEffective && showMentionDropdownEffective && (React.createElement(ConditionalWrapper, { condition: stickyEditor, wrapper: (children) => (React.createElement(Portal, { asChild: true, container: portalContainer }, children)) },
1227
1269
  React.createElement(Popper.Content, { side: "bottom", align: "start", className: "z-50", sideOffset: 2 },
1228
1270
  React.createElement(MentionsDropdown, { mentions: mentions, onSelect: handleInsertMention, highlightedIndex: mentionHighlightedIndex, isFetchingMentions: isFetchingMentions, MentionDropdownItemComponent: MentionDropdownItemComponent }))))));
1229
1271
  }));
@@ -1,3 +1,3 @@
1
1
  import { Schema } from "prosemirror-model";
2
- export declare const schema: Schema<"text" | "line" | "mention" | "doc", "link" | "color" | "bold" | "fontFamily" | "fontSize" | "italic" | "strikethrough" | "underline" | "superscript" | "subscript">;
2
+ export declare const schema: Schema<"text" | "line" | "mention" | "doc", "link" | "color" | "bold" | "fontFamily" | "fontSize" | "superscript" | "subscript" | "italic" | "underline" | "strikethrough">;
3
3
  //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1,28 @@
1
+ import type { ForwardedRef, PointerEvent as ReactPointerEvent, RefCallback } from "react";
2
+ /** How far the pointer may drift while the opening press is held and still not count as a drag. */
3
+ export declare const MENU_OPENING_RELEASE_SLOP_PX = 4;
4
+ /**
5
+ * Keeps the release of the press that opened a menu from choosing an item.
6
+ *
7
+ * A context menu opens on `contextmenu`, while that press is still down, with the content's corner
8
+ * at the pointer; a trigger's menu opens on its pointerdown. Near the viewport's right or bottom
9
+ * edge the content shifts or flips under the pointer to fit, and it slides in from 8 px off, so the
10
+ * release can land on an item. Radix selects an item on any pointer-up it saw no pointer-down for
11
+ * (to let a person press, drag onto an item and release), so a quick right-click there ran the item
12
+ * under the pointer and closed the menu. The content now swallows that release unless the pointer
13
+ * travelled more than {@link MENU_OPENING_RELEASE_SLOP_PX} from where the menu opened: press, drag
14
+ * and release still chooses the item it ends on, in any number of moves. A press that starts inside
15
+ * the content is a choice of its own, and a new right-click re-arms the guard.
16
+ *
17
+ * The guard arms when the content element mounts, which is when the menu opens. Spread the returned
18
+ * props on the content: `ref` arms it (and forwards the node to `forwardedRef`), and the capture
19
+ * handlers prevent the release's default action, which is what Radix's item reads
20
+ * (`composeEventHandlers` skips a default-prevented pointer-up), so nothing else loses the event.
21
+ */
22
+ export declare function useMenuOpeningReleaseGuard<T extends HTMLElement>(forwardedRef: ForwardedRef<T>): {
23
+ ref: RefCallback<T>;
24
+ onPointerDownCapture: () => void;
25
+ onPointerMoveCapture: (event: ReactPointerEvent<HTMLElement>) => void;
26
+ onPointerUpCapture: (event: ReactPointerEvent) => void;
27
+ };
28
+ //# sourceMappingURL=use-menu-opening-release-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-menu-opening-release-guard.d.ts","sourceRoot":"","sources":["../../../hooks/use-menu-opening-release-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,IAAI,iBAAiB,EACjC,WAAW,EACZ,MAAM,OAAO,CAAC;AAGf,mGAAmG;AACnG,eAAO,MAAM,4BAA4B,IAAI,CAAC;AA2B9C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,WAAW,EAC9D,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,GAC5B;IACD,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACpB,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,oBAAoB,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACtE,kBAAkB,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACxD,CAiEA"}
@@ -0,0 +1,102 @@
1
+ import { useCallback, useRef } from "react";
2
+ /** How far the pointer may drift while the opening press is held and still not count as a drag. */
3
+ export const MENU_OPENING_RELEASE_SLOP_PX = 4;
4
+ const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
5
+ /**
6
+ * Where the press that opened the menu was, as near as the content can tell: the point of its
7
+ * trigger closest to the pointer. Radix labels the content with its trigger (`aria-labelledby`).
8
+ * A context menu opens around a 0 × 0 trigger placed at the right-click, so that is the press
9
+ * itself; for a button it is the press when the press was on the button. `null` when the content
10
+ * has no trigger to read.
11
+ */
12
+ function readOpeningPoint(content, pointer) {
13
+ const triggerId = content.getAttribute("aria-labelledby");
14
+ const trigger = triggerId
15
+ ? content.ownerDocument.getElementById(triggerId)
16
+ : null;
17
+ if (!trigger)
18
+ return null;
19
+ const rect = trigger.getBoundingClientRect();
20
+ return {
21
+ x: clamp(pointer.x, rect.left, rect.right),
22
+ y: clamp(pointer.y, rect.top, rect.bottom),
23
+ };
24
+ }
25
+ /**
26
+ * Keeps the release of the press that opened a menu from choosing an item.
27
+ *
28
+ * A context menu opens on `contextmenu`, while that press is still down, with the content's corner
29
+ * at the pointer; a trigger's menu opens on its pointerdown. Near the viewport's right or bottom
30
+ * edge the content shifts or flips under the pointer to fit, and it slides in from 8 px off, so the
31
+ * release can land on an item. Radix selects an item on any pointer-up it saw no pointer-down for
32
+ * (to let a person press, drag onto an item and release), so a quick right-click there ran the item
33
+ * under the pointer and closed the menu. The content now swallows that release unless the pointer
34
+ * travelled more than {@link MENU_OPENING_RELEASE_SLOP_PX} from where the menu opened: press, drag
35
+ * and release still chooses the item it ends on, in any number of moves. A press that starts inside
36
+ * the content is a choice of its own, and a new right-click re-arms the guard.
37
+ *
38
+ * The guard arms when the content element mounts, which is when the menu opens. Spread the returned
39
+ * props on the content: `ref` arms it (and forwards the node to `forwardedRef`), and the capture
40
+ * handlers prevent the release's default action, which is what Radix's item reads
41
+ * (`composeEventHandlers` skips a default-prevented pointer-up), so nothing else loses the event.
42
+ */
43
+ export function useMenuOpeningReleaseGuard(forwardedRef) {
44
+ // Whether the press that opened the menu may still be down.
45
+ const armedRef = useRef(false);
46
+ // Where that press was, to measure a drag from; read from the trigger when first needed.
47
+ const originRef = useRef(null);
48
+ // The content element last mounted. A re-attached ref hands back the same element and is not a
49
+ // new open, so it does not re-arm; a menu that opens again mounts a new element.
50
+ const mountedRef = useRef(null);
51
+ const detachRef = useRef(null);
52
+ const ref = useCallback((node) => {
53
+ if (typeof forwardedRef === "function")
54
+ forwardedRef(node);
55
+ else if (forwardedRef)
56
+ forwardedRef.current = node;
57
+ detachRef.current?.();
58
+ detachRef.current = null;
59
+ if (!node)
60
+ return;
61
+ // A right-click while the menu is open opens it again: its release is an opening one too.
62
+ // Heard on the content's document, so a popped-out window's menu counts.
63
+ const doc = node.ownerDocument;
64
+ const onContextMenu = (event) => {
65
+ armedRef.current = true;
66
+ originRef.current = { x: event.clientX, y: event.clientY };
67
+ };
68
+ doc.addEventListener("contextmenu", onContextMenu, true);
69
+ detachRef.current = () => doc.removeEventListener("contextmenu", onContextMenu, true);
70
+ if (node === mountedRef.current)
71
+ return;
72
+ mountedRef.current = node;
73
+ // The content mounts as the menu opens: the press that opened it is still down.
74
+ armedRef.current = true;
75
+ originRef.current = null;
76
+ }, [forwardedRef]);
77
+ const onPointerMoveCapture = useCallback((event) => {
78
+ if (!armedRef.current)
79
+ return;
80
+ const pointer = { x: event.clientX, y: event.clientY };
81
+ if (!originRef.current) {
82
+ // Without a trigger to read, the first move stands in for the press.
83
+ originRef.current =
84
+ readOpeningPoint(event.currentTarget, pointer) ?? pointer;
85
+ }
86
+ const origin = originRef.current;
87
+ const travelled = Math.hypot(pointer.x - origin.x, pointer.y - origin.y);
88
+ if (travelled > MENU_OPENING_RELEASE_SLOP_PX)
89
+ armedRef.current = false;
90
+ }, []);
91
+ // A press that starts inside the menu is a choice of its own.
92
+ const onPointerDownCapture = useCallback(() => {
93
+ armedRef.current = false;
94
+ }, []);
95
+ const onPointerUpCapture = useCallback((event) => {
96
+ if (!armedRef.current)
97
+ return;
98
+ armedRef.current = false;
99
+ event.preventDefault();
100
+ }, []);
101
+ return { ref, onPointerDownCapture, onPointerMoveCapture, onPointerUpCapture };
102
+ }
@@ -16,6 +16,7 @@ export * from "./hooks/use-isomorphic-layout-effect.ts";
16
16
  export * from "./hooks/use-dropdown-categories";
17
17
  export * from "./conditional-wrapper";
18
18
  export * from "./hooks/use-dropdown";
19
+ export * from "./hooks/use-menu-opening-release-guard";
19
20
  export * from "./utils";
20
21
  export * from "./hooks/use-modal";
21
22
  export * from "./cell-tooltip";
@@ -31,4 +32,5 @@ export * from "./function-info";
31
32
  export * from "./function-info/helpers";
32
33
  export * from "./hooks/use-visibility";
33
34
  export * from "./arrow";
35
+ export * from "./portal-container";
34
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,C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c,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -16,6 +16,7 @@ export * from "./hooks/use-isomorphic-layout-effect.ts";
16
16
  export * from "./hooks/use-dropdown-categories";
17
17
  export * from "./conditional-wrapper";
18
18
  export * from "./hooks/use-dropdown";
19
+ export * from "./hooks/use-menu-opening-release-guard";
19
20
  export * from "./utils";
20
21
  export * from "./hooks/use-modal";
21
22
  export * from "./cell-tooltip";
@@ -31,3 +32,4 @@ export * from "./function-info";
31
32
  export * from "./function-info/helpers";
32
33
  export * from "./hooks/use-visibility";
33
34
  export * from "./arrow";
35
+ export * from "./portal-container";
@@ -2,7 +2,10 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
2
2
  import * as React from "react";
3
3
  declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
4
4
  declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
- declare const PopoverPortal: React.FC<PopoverPrimitive.PopoverPortalProps>;
5
+ declare const PopoverPortal: {
6
+ ({ container, ...props }: PopoverPrimitive.PopoverPortalProps): React.JSX.Element;
7
+ displayName: string | undefined;
8
+ };
6
9
  declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
7
10
  declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
11
  export declare const PopoverArrow: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverArrowProps & React.RefAttributes<SVGSVGElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../popover/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,OAAO,yCAAwB,CAAC;AAEtC,QAAA,MAAM,cAAc,gHAA2B,CAAC;AAEhD,QAAA,MAAM,aAAa,+CAA0B,CAAC;AAE9C,QAAA,MAAM,aAAa,4GAA0B,CAAC;AAE9C,QAAA,MAAM,cAAc,gKAelB,CAAC;AAGH,eAAO,MAAM,YAAY,0GAAyB,CAAC;AACnD,eAAO,MAAM,YAAY,8GAAyB,CAAC;AACnD,eAAO,MAAM,eAAe,iKAY1B,CAAC;AAIH,eAAO,MAAM,cAAc,GACzB,OAAO,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,sBAOpE,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../popover/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,QAAA,MAAM,OAAO,yCAAwB,CAAC;AAEtC,QAAA,MAAM,cAAc,gHAA2B,CAAC;AAEhD,QAAA,MAAM,aAAa;8BAGhB,gBAAgB,CAAC,kBAAkB;;CAQrC,CAAC;AAGF,QAAA,MAAM,aAAa,4GAA0B,CAAC;AAE9C,QAAA,MAAM,cAAc,gKAelB,CAAC;AAGH,eAAO,MAAM,YAAY,0GAAyB,CAAC;AACnD,eAAO,MAAM,YAAY,8GAAyB,CAAC;AACnD,eAAO,MAAM,eAAe,iKAY1B,CAAC;AAIH,eAAO,MAAM,cAAc,GACzB,OAAO,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,sBAOpE,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
@@ -1,10 +1,15 @@
1
1
  import * as PopoverPrimitive from "@radix-ui/react-popover";
2
2
  import * as React from "react";
3
3
  import { Button } from "../button";
4
+ import { usePortalContainer } from "../portal-container";
4
5
  import { cn } from "./../utils";
5
6
  const Popover = PopoverPrimitive.Root;
6
7
  const PopoverTrigger = PopoverPrimitive.Trigger;
7
- const PopoverPortal = PopoverPrimitive.Portal;
8
+ const PopoverPortal = ({ container, ...props }) => {
9
+ const portalContainer = usePortalContainer();
10
+ return (React.createElement(PopoverPrimitive.Portal, { container: container ?? portalContainer, ...props }));
11
+ };
12
+ PopoverPortal.displayName = PopoverPrimitive.Portal.displayName;
8
13
  const PopoverAnchor = PopoverPrimitive.Anchor;
9
14
  const PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => (React.createElement(PopoverPrimitive.Content, { ref: ref, align: align, sideOffset: sideOffset, className: cn("z-50 rounded-md border border-solid border-rnc-border bg-rnc-popover p-2 flex flex-col text-rnc-popover-foreground shadow-md outline-none animate-in data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 min-h-0", "max-h-popover overflow-auto rnc-popover font-system box-border text-sm", className), ...props })));
10
15
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ export type PortalContainerProviderProps = {
3
+ /**
4
+ * Where the subtree's portals mount. A host that renders the grid in a
5
+ * second window (popout, iframe) passes that window's `document.body` so
6
+ * every dialog, menu, popover, select and tooltip opens next to the grid
7
+ * instead of in the main window.
8
+ */
9
+ container?: HTMLElement | null;
10
+ children?: React.ReactNode;
11
+ };
12
+ export declare const PortalContainerProvider: {
13
+ ({ container, children, }: PortalContainerProviderProps): React.JSX.Element;
14
+ displayName: string;
15
+ };
16
+ /**
17
+ * The portal container set by the nearest {@link PortalContainerProvider},
18
+ * or `null` when none is set. Radix portals treat `undefined` and `null`
19
+ * alike (they fall back to `document.body`), so the value can be passed
20
+ * straight through as a `container` prop.
21
+ */
22
+ export declare const usePortalContainer: () => HTMLElement | null;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../portal-container/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAUzD,MAAM,MAAM,4BAA4B,GAAG;IACzC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,uBAAuB;+BAGjC,4BAA4B;;CAI9B,CAAC;AAGF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,QAAO,WAAW,GAAG,IAChB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import React, { createContext, useContext } from "react";
2
+ /**
3
+ * The element every portalled surface (dialogs, menus, popovers, selects,
4
+ * tooltips and the editor's suggestion dropdowns) mounts into when the
5
+ * surface is not given its own `container`. `null` keeps Radix's default,
6
+ * the `document.body` of the window running the JS.
7
+ */
8
+ const PortalContainerContext = createContext(null);
9
+ export const PortalContainerProvider = ({ container = null, children, }) => (React.createElement(PortalContainerContext.Provider, { value: container }, children));
10
+ PortalContainerProvider.displayName = "PortalContainerProvider";
11
+ /**
12
+ * The portal container set by the nearest {@link PortalContainerProvider},
13
+ * or `null` when none is set. Radix portals treat `undefined` and `null`
14
+ * alike (they fall back to `document.body`), so the value can be passed
15
+ * straight through as a `container` prop.
16
+ */
17
+ export const usePortalContainer = () => useContext(PortalContainerContext);
@@ -3,12 +3,17 @@ import * as React from "react";
3
3
  declare const Select: React.FC<SelectPrimitive.SelectProps>;
4
4
  declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
5
5
  declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
6
+ export declare const SelectPortal: {
7
+ ({ container, ...props }: SelectPrimitive.SelectPortalProps): React.JSX.Element;
8
+ displayName: string | undefined;
9
+ };
6
10
  declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
7
- declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
11
+ declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
12
+ container?: HTMLElement | null;
13
+ } & React.RefAttributes<HTMLDivElement>>;
8
14
  declare const SelectLabel: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
15
  declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
16
  declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
11
- export declare const SelectPortal: React.FC<SelectPrimitive.SelectPortalProps>;
12
17
  export declare const SelectViewPort: React.ForwardRefExoticComponent<SelectPrimitive.SelectViewportProps & React.RefAttributes<HTMLDivElement>>;
13
18
  export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, };
14
19
  //# sourceMappingURL=index.d.ts.map