@radix-ui/react-menu 0.0.21 → 0.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.
package/dist/index.d.ts CHANGED
@@ -1,57 +1,63 @@
1
1
  import * as React from "react";
2
2
  import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
3
3
  import { FocusScope } from "@radix-ui/react-focus-scope";
4
+ import * as Radix from "@radix-ui/react-primitive";
4
5
  import { Primitive } from "@radix-ui/react-primitive";
5
6
  import * as PopperPrimitive from "@radix-ui/react-popper";
6
- import { RovingFocusGroup, RovingFocusItem } from "@radix-ui/react-roving-focus";
7
- import * as Polymorphic from "@radix-ui/react-polymorphic";
7
+ import { RovingFocusGroup } from "@radix-ui/react-roving-focus";
8
8
  type Direction = 'ltr' | 'rtl';
9
- type MenuOwnProps = {
9
+ export interface MenuProps {
10
10
  open?: boolean;
11
11
  onOpenChange?(open: boolean): void;
12
12
  dir?: Direction;
13
- };
14
- export const Menu: React.FC<MenuOwnProps>;
15
- type MenuSubOwnProps = {
13
+ modal?: boolean;
14
+ }
15
+ export const Menu: React.FC<MenuProps>;
16
+ export interface MenuSubProps {
16
17
  open?: boolean;
17
18
  onOpenChange?(open: boolean): void;
18
- };
19
- export const MenuSub: React.FC<MenuSubOwnProps>;
19
+ }
20
+ export const MenuSub: React.FC<MenuSubProps>;
21
+ type PopperAnchorProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;
22
+ export interface MenuAnchorProps extends PopperAnchorProps {
23
+ }
24
+ export const MenuAnchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
20
25
  /**
21
26
  * We purposefully don't union MenuRootContent and MenuSubContent props here because
22
27
  * they have conflicting prop types. We agreed that we would allow MenuSubContent to
23
28
  * accept props that it would just ignore.
24
29
  */
25
- type MenuContentOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof MenuRootContent>, {
30
+ export interface MenuContentProps extends MenuRootContentProps {
26
31
  /**
27
32
  * Used to force mounting when more control is needed. Useful when
28
33
  * controlling animation with React animation libraries.
29
34
  */
30
35
  forceMount?: true;
31
- }>;
32
- export type MenuContentPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof MenuRootContent>, MenuContentOwnProps>;
33
- export const MenuContent: MenuContentPrimitive;
34
- type MenuRootContentOwnProps = Omit<Polymorphic.OwnProps<typeof MenuContentImpl>, keyof MenuContentImplPrivateProps>;
35
- type MenuRootContentPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof MenuContentImpl>, MenuRootContentOwnProps>;
36
- declare const MenuRootContent: MenuRootContentPrimitive;
37
- type FocusScopeOwnProps = Polymorphic.OwnProps<typeof FocusScope>;
38
- type DismissableLayerOwnProps = Polymorphic.OwnProps<typeof DismissableLayer>;
39
- type RovingFocusGroupOwnProps = Polymorphic.OwnProps<typeof RovingFocusGroup>;
36
+ }
37
+ export const MenuContent: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
38
+ interface MenuRootContentProps extends Omit<MenuRootContentTypeProps, keyof MenuContentImplPrivateProps> {
39
+ }
40
+ interface MenuRootContentTypeProps extends Omit<MenuContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents' | 'disableOutsideScroll'> {
41
+ }
42
+ type FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;
43
+ type DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;
44
+ type RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup>;
45
+ type PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;
40
46
  type MenuContentImplPrivateProps = {
41
- onOpenAutoFocus?: FocusScopeOwnProps['onMountAutoFocus'];
42
- onDismiss?: DismissableLayerOwnProps['onDismiss'];
47
+ onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
48
+ onDismiss?: DismissableLayerProps['onDismiss'];
43
49
  };
44
- type MenuContentImplOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof PopperPrimitive.Content>, Omit<DismissableLayerOwnProps, 'onDismiss'> & MenuContentImplPrivateProps & {
50
+ interface MenuContentImplProps extends MenuContentImplPrivateProps, PopperContentProps, Omit<DismissableLayerProps, 'onDismiss'> {
45
51
  /**
46
52
  * Whether focus should be trapped within the `MenuContent`
47
53
  * (default: false)
48
54
  */
49
- trapFocus?: FocusScopeOwnProps['trapped'];
55
+ trapFocus?: FocusScopeProps['trapped'];
50
56
  /**
51
57
  * Event handler called when auto-focusing on close.
52
58
  * Can be prevented.
53
59
  */
54
- onCloseAutoFocus?: FocusScopeOwnProps['onUnmountAutoFocus'];
60
+ onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
55
61
  /**
56
62
  * Whether scrolling outside the `MenuContent` should be prevented
57
63
  * (default: `false`)
@@ -61,80 +67,79 @@ type MenuContentImplOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Pop
61
67
  * The direction of navigation between menu items.
62
68
  * @defaultValue ltr
63
69
  */
64
- dir?: RovingFocusGroupOwnProps['dir'];
70
+ dir?: RovingFocusGroupProps['dir'];
65
71
  /**
66
72
  * Whether keyboard navigation should loop around
67
73
  * @defaultValue false
68
74
  */
69
- loop?: RovingFocusGroupOwnProps['loop'];
75
+ loop?: RovingFocusGroupProps['loop'];
70
76
  /**
71
77
  * Whether the `MenuContent` should render in a `Portal`
72
78
  * (default: `true`)
73
79
  */
74
80
  portalled?: boolean;
75
- }>;
76
- type MenuContentImplPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof PopperPrimitive.Content>, MenuContentImplOwnProps>;
77
- declare const MenuContentImpl: MenuContentImplPrimitive;
78
- declare const ITEM_DEFAULT_TAG = "div";
79
- type MenuItemOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof MenuItemImpl>, {
81
+ }
82
+ type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
83
+ export interface MenuGroupProps extends PrimitiveDivProps {
84
+ }
85
+ export const MenuGroup: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
86
+ export interface MenuLabelProps extends PrimitiveDivProps {
87
+ }
88
+ export const MenuLabel: React.ForwardRefExoticComponent<MenuLabelProps & React.RefAttributes<HTMLDivElement>>;
89
+ export interface MenuItemProps extends Omit<MenuItemImplProps, 'onSelect'> {
80
90
  onSelect?: (event: Event) => void;
81
- }>;
82
- export type MenuItemPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof MenuItemImpl>, MenuItemOwnProps>;
83
- export const MenuItem: MenuItemPrimitive;
84
- type MenuSubTriggerOwnProps = Polymorphic.OwnProps<typeof MenuItemImpl>;
85
- export type MenuSubTriggerPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof MenuItemImpl>, MenuSubTriggerOwnProps>;
86
- export const MenuSubTrigger: MenuSubTriggerPrimitive;
87
- type MenuItemImplOwnProps = Polymorphic.Merge<Omit<Polymorphic.OwnProps<typeof RovingFocusItem>, 'focusable' | 'active'>, {
91
+ }
92
+ export const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement>>;
93
+ export interface MenuSubTriggerProps extends MenuItemImplProps {
94
+ }
95
+ export const MenuSubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
96
+ interface MenuItemImplProps extends PrimitiveDivProps {
88
97
  disabled?: boolean;
89
98
  textValue?: string;
90
- }>;
91
- type MenuItemImplPrimitive = Polymorphic.ForwardRefComponent<typeof ITEM_DEFAULT_TAG, MenuItemImplOwnProps>;
92
- declare const MenuItemImpl: MenuItemImplPrimitive;
93
- type MenuCheckboxItemOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof MenuItem>, {
99
+ }
100
+ export interface MenuCheckboxItemProps extends MenuItemProps {
94
101
  checked?: boolean;
95
102
  onCheckedChange?: (checked: boolean) => void;
96
- }>;
97
- export type MenuCheckboxItemPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof MenuItem>, MenuCheckboxItemOwnProps>;
98
- export const MenuCheckboxItem: MenuCheckboxItemPrimitive;
99
- type MenuRadioGroupOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof MenuGroup>, {
103
+ }
104
+ export const MenuCheckboxItem: React.ForwardRefExoticComponent<MenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
105
+ export interface MenuRadioGroupProps extends MenuGroupProps {
100
106
  value?: string;
101
107
  onValueChange?: (value: string) => void;
102
- }>;
103
- export type MenuRadioGroupPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof MenuGroup>, MenuRadioGroupOwnProps>;
104
- export const MenuRadioGroup: MenuRadioGroupPrimitive;
105
- type MenuRadioItemOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof MenuItem>, {
108
+ }
109
+ export const MenuRadioGroup: React.ForwardRefExoticComponent<MenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
110
+ export interface MenuRadioItemProps extends MenuItemProps {
106
111
  value: string;
107
- }>;
108
- export type MenuRadioItemPrimitive = Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof MenuItem>, MenuRadioItemOwnProps>;
109
- export const MenuRadioItem: MenuRadioItemPrimitive;
110
- declare const ITEM_INDICATOR_DEFAULT_TAG = "span";
111
- type MenuItemIndicatorOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Primitive>, {
112
+ }
113
+ export const MenuRadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
114
+ type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
115
+ export interface MenuItemIndicatorProps extends PrimitiveSpanProps {
112
116
  /**
113
117
  * Used to force mounting when more control is needed. Useful when
114
118
  * controlling animation with React animation libraries.
115
119
  */
116
120
  forceMount?: true;
117
- }>;
118
- export type MenuItemIndicatorPrimitive = Polymorphic.ForwardRefComponent<typeof ITEM_INDICATOR_DEFAULT_TAG, MenuItemIndicatorOwnProps>;
119
- export const MenuItemIndicator: MenuItemIndicatorPrimitive;
120
- export const MenuAnchor: import("@radix-ui/react-primitive").ExtendedPrimitive<PopperPrimitive.PopperAnchorPrimitive, "div">;
121
- export const MenuGroup: import("@radix-ui/react-primitive").ExtendedPrimitive<import("@radix-ui/react-primitive").PrimitivePrimitive, "div">;
122
- export const MenuLabel: import("@radix-ui/react-primitive").ExtendedPrimitive<import("@radix-ui/react-primitive").PrimitivePrimitive, "div">;
123
- export const MenuSeparator: import("@radix-ui/react-primitive").ExtendedPrimitive<import("@radix-ui/react-primitive").PrimitivePrimitive, "div">;
124
- export const MenuArrow: import("@radix-ui/react-primitive").ExtendedPrimitive<PopperPrimitive.PopperArrowPrimitive, "svg">;
125
- export const Root: React.FC<MenuOwnProps>;
126
- export const Sub: React.FC<MenuSubOwnProps>;
127
- export const Anchor: import("@radix-ui/react-primitive").ExtendedPrimitive<PopperPrimitive.PopperAnchorPrimitive, "div">;
128
- export const SubTrigger: MenuSubTriggerPrimitive;
129
- export const Content: MenuContentPrimitive;
130
- export const Group: import("@radix-ui/react-primitive").ExtendedPrimitive<import("@radix-ui/react-primitive").PrimitivePrimitive, "div">;
131
- export const Label: import("@radix-ui/react-primitive").ExtendedPrimitive<import("@radix-ui/react-primitive").PrimitivePrimitive, "div">;
132
- export const Item: MenuItemPrimitive;
133
- export const CheckboxItem: MenuCheckboxItemPrimitive;
134
- export const RadioGroup: MenuRadioGroupPrimitive;
135
- export const RadioItem: MenuRadioItemPrimitive;
136
- export const ItemIndicator: MenuItemIndicatorPrimitive;
137
- export const Separator: import("@radix-ui/react-primitive").ExtendedPrimitive<import("@radix-ui/react-primitive").PrimitivePrimitive, "div">;
138
- export const Arrow: import("@radix-ui/react-primitive").ExtendedPrimitive<PopperPrimitive.PopperArrowPrimitive, "svg">;
121
+ }
122
+ export const MenuItemIndicator: React.ForwardRefExoticComponent<MenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
123
+ export interface MenuSeparatorProps extends PrimitiveDivProps {
124
+ }
125
+ export const MenuSeparator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
126
+ type PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;
127
+ export interface MenuArrowProps extends PopperArrowProps {
128
+ }
129
+ export const MenuArrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
130
+ export const Root: React.FC<MenuProps>;
131
+ export const Sub: React.FC<MenuSubProps>;
132
+ export const Anchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
133
+ export const SubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
134
+ export const Content: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
135
+ export const Group: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
136
+ export const Label: React.ForwardRefExoticComponent<MenuLabelProps & React.RefAttributes<HTMLDivElement>>;
137
+ export const Item: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement>>;
138
+ export const CheckboxItem: React.ForwardRefExoticComponent<MenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
139
+ export const RadioGroup: React.ForwardRefExoticComponent<MenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
140
+ export const RadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
141
+ export const ItemIndicator: React.ForwardRefExoticComponent<MenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
142
+ export const Separator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
143
+ export const Arrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
139
144
 
140
145
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"mappings":"A;A;A;A;A;A;A;AAsBA,iBAAiB,KAAK,GAAG,KAAK,CAAC;AA4C/B,oBAAoB;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,OAAA,MAAM,MAAM,MAAM,EAAE,CAAC,YAAY,CAsChC,CAAC;AAQF,uBAAuB;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;CACpC,CAAC;AAEF,OAAA,MAAM,SAAS,MAAM,EAAE,CAAC,eAAe,CAiCtC,CAAC;AA8BF;A;A;A;GAIG;AACH,2BAA2B,YAAY,KAAK,CAC1C,YAAY,QAAQ,CAAC,sBAAsB,CAAC,EAC5C;IACE;A;A;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB,CACF,CAAC;AAEF,mCAA4B,YAAY,mBAAmB,CACzD,YAAY,gBAAgB,CAAC,sBAAsB,CAAC,EACpD,mBAAmB,CACpB,CAAC;AAEF,OAAA,MAAM,iCAcoB,CAAC;AAI3B,+BAA+B,IAAI,CACjC,YAAY,QAAQ,CAAC,sBAAsB,CAAC,EAC5C,MAAM,2BAA2B,CAClC,CAAC;AACF,gCAAgC,YAAY,mBAAmB,CAC7D,YAAY,gBAAgB,CAAC,sBAAsB,CAAC,EACpD,uBAAuB,CACxB,CAAC;AAEF,QAAA,MAAM,yCAcwB,CAAC;AAmE/B,0BAA0B,YAAY,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAClE,gCAAgC,YAAY,QAAQ,CAAC,uBAAuB,CAAC,CAAC;AAC9E,gCAAgC,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AAE,CAClB,CAAC;AACF,qCAA8B,YAAY,mBAAmB,CAC3D,YAAY,gBAAgB,CAAC,eAAe,CAAC,EAC7C,qBAAqB,CACtB,CAAC;AAEF,OAAA,MAAM,qCAoBsB,CAAC;AAS7B,QAAA,MAAM,mCAAmC,CAAC;AAI1C,iCAAiC,YAAY,KAAK,CAChD,YAAY,QAAQ,CAAC,gBAAgB,CAAC,EACtC;IACE;A;A;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB,CACF,CAAC;AAEF,yCAAkC,YAAY,mBAAmB,CAC/D,iCAAiC,EACjC,yBAAyB,CAC1B,CAAC;AAEF,OAAA,MAAM,6CAa0B,CAAC;AAMjC,OAAA,MAAM,mIAAmF,CAAC;AAC1F,OAAA,MAAM,iKAGJ,CAAC;AACH,OAAA,MAAM,iKAAoE,CAAC;AAC3E,OAAA,MAAM,qKAGJ,CAAC;AACH,OAAA,MAAM,iIAAgF,CAAC;AAkGvF,OAAA,MAAM,4BAAW,CAAC;AAClB,OAAA,MAAM,8BAAa,CAAC;AACpB,OAAA,MAAM,+HAAmB,CAAC;AAC1B,OAAA,MAAM,mCAA2B,CAAC;AAClC,OAAA,MAAM,6BAAqB,CAAC;AAC5B,OAAA,MAAM,6JAAiB,CAAC;AACxB,OAAA,MAAM,6JAAiB,CAAC;AACxB,OAAA,MAAM,uBAAe,CAAC;AACtB,OAAA,MAAM,uCAA+B,CAAC;AACtC,OAAA,MAAM,mCAA2B,CAAC;AAClC,OAAA,MAAM,iCAAyB,CAAC;AAChC,OAAA,MAAM,yCAAiC,CAAC;AACxC,OAAA,MAAM,iKAAyB,CAAC;AAChC,OAAA,MAAM,6HAAiB,CAAC","sources":["./packages/react/menu/src/packages/react/menu/src/Menu.tsx","./packages/react/menu/src/packages/react/menu/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
1
+ {"mappings":"A;A;A;A;A;A;A;AAqBA,iBAAiB,KAAK,GAAG,KAAK,CAAC;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ClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,OAAA,MAAM,0GAcL,CAAC;AAWF,mCAA6B,SAAQ,aAAa;IAChD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,OAAA,MAAM,wGAsBL,CAAC;AAaF,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,UAAU,IAAI,CAAC,CAAC;AAChF,uCAAiC,SAAQ,kBAAkB;IACzD;A;A;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB;AAED,OAAA,MAAM,iHAcL,CAAC;AAWF,mCAA6B,SAAQ,iBAAiB;CAAG;AAEzD,OAAA,MAAM,wGAIL,CAAC;AAWF,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,+BAAyB,SAAQ,gBAAgB;CAAG;AAEpD,OAAA,MAAM,+FAEJ,CAAC;AAgGH,OAAA,MAAM,yBAAW,CAAC;AAClB,OAAA,MAAM,2BAAa,CAAC;AACpB,OAAA,MAAM,8FAAmB,CAAC;AAC1B,OAAA,MAAM,sGAA2B,CAAC;AAClC,OAAA,MAAM,gGAAqB,CAAC;AAC5B,OAAA,MAAM,4FAAiB,CAAC;AACxB,OAAA,MAAM,4FAAiB,CAAC;AACxB,OAAA,MAAM,0FAAe,CAAC;AACtB,OAAA,MAAM,0GAA+B,CAAC;AACtC,OAAA,MAAM,sGAA2B,CAAC;AAClC,OAAA,MAAM,oGAAyB,CAAC;AAChC,OAAA,MAAM,6GAAiC,CAAC;AACxC,OAAA,MAAM,oGAAyB,CAAC;AAChC,OAAA,MAAM,2FAAiB,CAAC","sources":["./packages/react/menu/src/packages/react/menu/src/Menu.tsx","./packages/react/menu/src/packages/react/menu/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var e,t=require("@radix-ui/react-id").useId,n=require("@radix-ui/react-focus-guards").useFocusGuards,r=require("@radix-ui/react-use-callback-ref").useCallbackRef,o=require("@radix-ui/react-use-direction").useDirection,u=require("@radix-ui/react-slot").Slot,a=require("@radix-ui/react-roving-focus"),c=a.RovingFocusGroup,i=a.RovingFocusItem,s=require("@radix-ui/react-portal").Portal,l=I({},require("@radix-ui/react-popper")),d=require("@radix-ui/react-primitive"),f=d.Primitive,p=d.extendPrimitive,m=require("@radix-ui/react-presence").Presence,v=require("@radix-ui/react-focus-scope").FocusScope,g=require("@radix-ui/react-dismissable-layer").DismissableLayer,h=require("@radix-ui/react-context").createContext,x=require("@radix-ui/react-compose-refs"),b=x.useComposedRefs,C=x.composeRefs,E=require("@radix-ui/react-collection").createCollection,w=require("@radix-ui/primitive").composeEventHandlers,y=require("aria-hidden").hideOthers,R=require("react-remove-scroll").RemoveScroll,P=I({},require("react")),M=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function I(e,t){return Object.keys(t).forEach((function(n){"default"!==n&&"__esModule"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),e}const k=["Enter"," "],D=["ArrowUp","PageDown","End"],S=["ArrowDown","PageUp","Home",...D],T={ltr:[...k,"ArrowRight"],rtl:[...k,"ArrowLeft"]},O={ltr:["ArrowLeft"],rtl:["ArrowRight"]},[L,F]=h("Menu"),A=e=>{const{open:t=!1,children:n,onOpenChange:u}=e,[a,c]=P.useState(null),i=P.useRef(!1),s=r(u),d=o(a,e.dir);return P.useEffect((()=>{const e=()=>i.current=!0,t=()=>i.current=!1;return document.addEventListener("keydown",e,{capture:!0}),document.addEventListener("pointerdown",t,{capture:!0}),document.addEventListener("pointermove",t,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}}),[]),/*#__PURE__*/P.createElement(l.Root,null,/*#__PURE__*/P.createElement(L,{isSubmenu:!1,isUsingKeyboardRef:i,dir:d,open:t,onOpenChange:s,content:a,onContentChange:c,onRootClose:P.useCallback((()=>s(!1)),[s])},n))};exports.Menu=A;const K=e=>{const{children:n,open:o=!1,onOpenChange:u}=e,a=F("MenuSub"),[c,i]=P.useState(null),[s,d]=P.useState(null),f=r(u);return P.useEffect((()=>(!1===a.open&&f(!1),()=>f(!1))),[a.open,f]),/*#__PURE__*/P.createElement(l.Root,null,/*#__PURE__*/P.createElement(L,{isSubmenu:!0,isUsingKeyboardRef:a.isUsingKeyboardRef,dir:a.dir,open:o,onOpenChange:f,content:s,onContentChange:d,onRootClose:a.onRootClose,contentId:t(),trigger:c,onTriggerChange:i,triggerId:t()},n))};exports.MenuSub=K;const[q,G,U]=E(),[V,N]=h("MenuContent"),X=/*#__PURE__*/P.forwardRef(((e,t)=>{const{forceMount:n,...r}=e,o=F("MenuContent");/*#__PURE__*/return P.createElement(m,{present:n||o.open},/*#__PURE__*/P.createElement(q,null,o.isSubmenu?/*#__PURE__*/P.createElement(B,M({},r,{ref:t})):/*#__PURE__*/P.createElement(_,M({},r,{ref:t}))))}));exports.MenuContent=X;const _=/*#__PURE__*/P.forwardRef(((e,t)=>{const n=F("MenuContent"),r=P.useRef(null),o=b(t,r);return P.useEffect((()=>{const e=r.current;if(e)return y(e)}),[]),/*#__PURE__*/P.createElement(j,M({},e,{ref:o,onDismiss:()=>n.onOpenChange(!1)}))})),B=/*#__PURE__*/P.forwardRef(((e,t)=>{const n=F("MenuContent"),r=P.useRef(null),o=b(t,r);return n.isSubmenu?/*#__PURE__*/P.createElement(j,M({id:n.contentId,"aria-labelledby":n.triggerId},e,{ref:o,align:"start",side:"rtl"===n.dir?"left":"right",portalled:!0,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;n.isUsingKeyboardRef.current&&(null===(t=r.current)||void 0===t||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:w(e.onFocusOutside,(e=>{e.target!==n.trigger&&n.onOpenChange(!1)})),onEscapeKeyDown:w(e.onEscapeKeyDown,n.onRootClose),onKeyDown:w(e.onKeyDown,(e=>{const t=e.currentTarget.contains(e.target),r=O[n.dir].includes(e.key);var o;t&&r&&(n.onOpenChange(!1),null===(o=n.trigger)||void 0===o||o.focus())}))})):null})),j=/*#__PURE__*/P.forwardRef(((e,t)=>{const{loop:r=!1,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:h,onDismiss:x,disableOutsideScroll:C,portalled:E,...y}=e,I=F("MenuContent"),{getItems:k}=U(),[T,O]=P.useState(null),L=P.useRef(null),A=b(t,L,I.onContentChange),K=P.useRef(!1),q=P.useRef(0),G=P.useRef(""),N=P.useRef(0),X=P.useRef(null),_=P.useRef("right"),B=P.useRef(0),j=E?s:P.Fragment,H=C?R:P.Fragment,Y=e=>{var t,n;const r=G.current+e,o=k().filter((e=>!e.disabled)),u=document.activeElement,a=null===(t=o.find((e=>e.ref.current===u)))||void 0===t?void 0:t.textValue,c=function(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,o=n?e.indexOf(n):-1;let u=(a=e,c=Math.max(o,0),a.map(((e,t)=>a[(c+t)%a.length])));var a,c;1===r.length&&(u=u.filter((e=>e!==n)));const i=u.find((e=>e.toLowerCase().startsWith(r.toLowerCase())));return i!==n?i:void 0}(o.map((e=>e.textValue)),r,a),i=null===(n=o.find((e=>e.textValue===c)))||void 0===n?void 0:n.ref.current;!function e(t){G.current=t,window.clearTimeout(q.current),""!==t&&(q.current=window.setTimeout((()=>e("")),1e3))}(r),i&&setTimeout((()=>i.focus()))};P.useEffect((()=>()=>window.clearTimeout(q.current)),[]),n();const z=P.useCallback((e=>{var t,n;return _.current===(null===(t=X.current)||void 0===t?void 0:t.side)&&function(e,t){if(!t)return!1;return function(e,t){const{x:n,y:r}=e;let o=!1;for(let e=0,u=t.length-1;e<t.length;u=e++){const a=t[e].x,c=t[e].y,i=t[u].x,s=t[u].y;c>r!=s>r&&n<(i-a)*(r-c)/(s-c)+a&&(o=!o)}return o}({x:e.clientX,y:e.clientY},t)}(e,null===(n=X.current)||void 0===n?void 0:n.area)}),[]);/*#__PURE__*/return P.createElement(j,null,/*#__PURE__*/P.createElement(H,null,/*#__PURE__*/P.createElement(V,{searchRef:G,onItemEnter:P.useCallback((e=>{z(e)&&e.preventDefault()}),[z]),onItemLeave:P.useCallback((e=>{var t;z(e)||(null===(t=L.current)||void 0===t||t.focus(),O(null))}),[z]),onTriggerLeave:P.useCallback((e=>{z(e)&&e.preventDefault()}),[z]),pointerGraceTimerRef:N,onPointerGraceIntentChange:P.useCallback((e=>{X.current=e}),[])},/*#__PURE__*/P.createElement(v,{as:u,trapped:o&&I.open,onMountAutoFocus:w(a,(e=>{var t;e.preventDefault(),null===(t=L.current)||void 0===t||t.focus()})),onUnmountAutoFocus:e=>{!d&&K.current?e.preventDefault():null==i||i(e)}},/*#__PURE__*/P.createElement(g,{as:u,disableOutsidePointerEvents:d,onEscapeKeyDown:w(f,(()=>{K.current=!1})),onPointerDownOutside:w(p,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!1===t.ctrlKey;K.current=n}),{checkForDefaultPrevented:!1}),onFocusOutside:w(m,(e=>{o&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onInteractOutside:h,onDismiss:x},/*#__PURE__*/P.createElement(c,{as:u,dir:I.dir,orientation:"vertical",loop:r,currentTabStopId:T,onCurrentTabStopIdChange:O,onEntryFocus:e=>{I.isUsingKeyboardRef.current||e.preventDefault()}},/*#__PURE__*/P.createElement(l.Content,M({role:"menu",dir:I.dir,"data-state":ie(I.open)},y,{ref:A,style:{outline:"none",...y.style},onKeyDown:w(y.onKeyDown,(e=>{const t=e.target,n=e.currentTarget.contains(t),r=e.ctrlKey||e.altKey||e.metaKey;n&&!r&&1===e.key.length&&Y(e.key),"Tab"===e.key&&e.preventDefault();const o=L.current;if(e.target!==o)return;if(!S.includes(e.key))return;e.preventDefault();const u=k().filter((e=>!e.disabled)).map((e=>e.ref.current));D.includes(e.key)&&u.reverse(),function(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}(u)})),onBlur:w(e.onBlur,(e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(q.current),G.current="")})),onPointerMove:w(e.onPointerMove,le((e=>{const t=e.target,n=B.current!==e.clientX;if(e.currentTarget.contains(t)&&n){const t=e.clientX>B.current?"right":"left";_.current=t,B.current=e.clientX}})))}))))))))})),H="div",Y=/*#__PURE__*/P.forwardRef(((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,u=P.useRef(null),a=F("MenuItem"),c=N("MenuItem"),i=b(t,u),s=()=>{const e=u.current;if(!n&&e){const t=new Event("menu.itemSelect",{bubbles:!0,cancelable:!0});if(e.addEventListener("menu.itemSelect",(e=>null==r?void 0:r(e)),{once:!0}),e.dispatchEvent(t),t.defaultPrevented)return;a.onRootClose()}};/*#__PURE__*/return P.createElement(W,M({},o,{ref:i,disabled:n,onPointerUp:w(e.onPointerUp,s),onKeyDown:w(e.onKeyDown,(e=>{const t=""!==c.searchRef.current;n||t&&" "===e.key||k.includes(e.key)&&(" "===e.key&&e.preventDefault(),s())}))}))}));exports.MenuItem=Y;const z=/*#__PURE__*/P.forwardRef(((e,t)=>{const n=F("MenuSubTrigger"),r=N("MenuSubTrigger"),o=P.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=r,i=P.useCallback((()=>{o.current&&window.clearTimeout(o.current),o.current=null}),[]);return P.useEffect((()=>i),[i]),P.useEffect((()=>{const e=a.current;return()=>{window.clearTimeout(e),c(null)}}),[a,c]),n.isSubmenu?/*#__PURE__*/P.createElement(re,{as:u},/*#__PURE__*/P.createElement(W,M({id:n.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":ie(n.open)},e,{ref:C(t,n.onTriggerChange),onPointerUp:w(e.onPointerUp,(s=t=>{r.onItemEnter(t),t.defaultPrevented||e.disabled||n.open||n.onOpenChange(!0)},e=>"mouse"!==e.pointerType?s(e):void 0)),onPointerMove:w(e.onPointerMove,le((t=>{r.onItemEnter(t),t.defaultPrevented||e.disabled||n.open||o.current||(r.onPointerGraceIntentChange(null),o.current=window.setTimeout((()=>{n.onOpenChange(!0),i()}),100))}))),onPointerLeave:w(e.onPointerLeave,le((e=>{var t;i();const o=null===(t=n.content)||void 0===t?void 0:t.getBoundingClientRect();if(o){var u;const t=null===(u=n.content)||void 0===u?void 0:u.dataset.side,c="right"===t,i=c?-5:5,s=o[c?"left":"right"],l=o[c?"right":"left"];r.onPointerGraceIntentChange({area:[{x:e.clientX+i,y:e.clientY},{x:s,y:o.top},{x:l,y:o.top},{x:l,y:o.bottom},{x:s,y:o.bottom}],side:t}),window.clearTimeout(a.current),a.current=window.setTimeout((()=>r.onPointerGraceIntentChange(null)),300)}else{if(r.onTriggerLeave(e),e.defaultPrevented)return;r.onPointerGraceIntentChange(null)}}))),onKeyDown:w(e.onKeyDown,(t=>{const o=""!==r.searchRef.current;var u;e.disabled||o&&" "===t.key||T[n.dir].includes(t.key)&&(n.onOpenChange(!0),null===(u=n.content)||void 0===u||u.focus())}))}))):null;var s}));exports.MenuSubTrigger=z;const W=/*#__PURE__*/P.forwardRef(((e,t)=>{const{as:n=H,disabled:r=!1,textValue:o,...u}=e,a=P.useRef(null),c=b(t,a),s=N("MenuItem"),[l,d]=P.useState("");return P.useEffect((()=>{const e=a.current;var t;e&&d((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}),[u.children]),/*#__PURE__*/P.createElement(G,{disabled:r,textValue:null!=o?o:l},/*#__PURE__*/P.createElement(i,M({role:"menuitem","aria-disabled":r||void 0,"data-disabled":r?"":void 0,focusable:!r},u,{as:n,ref:c,onPointerMove:w(e.onPointerMove,le((e=>{if(r)s.onItemLeave(e);else if(s.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus()}}))),onPointerLeave:w(e.onPointerLeave,le((e=>s.onItemLeave(e))))})))})),J=/*#__PURE__*/P.forwardRef(((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;/*#__PURE__*/return P.createElement(te.Provider,{value:n},/*#__PURE__*/P.createElement(Y,M({role:"menuitemcheckbox","aria-checked":n},o,{ref:t,"data-state":se(n),onSelect:w(o.onSelect,(()=>null==r?void 0:r(!n)),{checkForDefaultPrevented:!1})})))}));exports.MenuCheckboxItem=J;const Q=/*#__PURE__*/P.createContext({}),Z=/*#__PURE__*/P.forwardRef(((e,t)=>{const{value:n,onValueChange:o,...u}=e,a=r(o),c=P.useMemo((()=>({value:n,onValueChange:a})),[n,a]);/*#__PURE__*/return P.createElement(Q.Provider,{value:c},/*#__PURE__*/P.createElement(oe,M({},u,{ref:t})))}));exports.MenuRadioGroup=Z;const $=/*#__PURE__*/P.forwardRef(((e,t)=>{const{value:n,...r}=e,o=P.useContext(Q),u=n===o.value;/*#__PURE__*/return P.createElement(te.Provider,{value:u},/*#__PURE__*/P.createElement(Y,M({role:"menuitemradio","aria-checked":u},r,{ref:t,"data-state":se(u),onSelect:w(r.onSelect,(()=>{var e;return null===(e=o.onValueChange)||void 0===e?void 0:e.call(o,n)}),{checkForDefaultPrevented:!1})})))}));exports.MenuRadioItem=$;const ee="span",te=/*#__PURE__*/P.createContext(!1),ne=/*#__PURE__*/P.forwardRef(((e,t)=>{const{as:n=ee,forceMount:r,...o}=e,u=P.useContext(te);/*#__PURE__*/return P.createElement(m,{present:r||u},/*#__PURE__*/P.createElement(f,M({},o,{as:n,ref:t,"data-state":se(u)})))}));exports.MenuItemIndicator=ne;const re=p(l.Anchor,{displayName:"MenuAnchor"});exports.MenuAnchor=re;const oe=p(f,{defaultProps:{role:"group"},displayName:"MenuGroup"});exports.MenuGroup=oe;const ue=p(f,{displayName:"MenuLabel"});exports.MenuLabel=ue;const ae=p(f,{defaultProps:{role:"separator","aria-orientation":"horizontal"},displayName:"MenuSeparator "});exports.MenuSeparator=ae;const ce=p(l.Arrow,{displayName:"MenuArrow"});function ie(e){return e?"open":"closed"}function se(e){return e?"checked":"unchecked"}function le(e){return t=>"mouse"===t.pointerType?e(t):void 0}exports.MenuArrow=ce;const de=A;exports.Root=de;const fe=K;exports.Sub=fe;const pe=re;exports.Anchor=pe;const me=z;exports.SubTrigger=me;const ve=X;exports.Content=ve;const ge=oe;exports.Group=ge;const he=ue;exports.Label=he;const xe=Y;exports.Item=xe;const be=J;exports.CheckboxItem=be;const Ce=Z;exports.RadioGroup=Ce;const Ee=$;exports.RadioItem=Ee;const we=ne;exports.ItemIndicator=we;const ye=ae;exports.Separator=ye;const Re=ce;exports.Arrow=Re;
1
+ var e,t=require("@radix-ui/react-id").useId,n=require("@radix-ui/react-focus-guards").useFocusGuards,r=require("@radix-ui/react-use-callback-ref").useCallbackRef,o=require("@radix-ui/react-use-direction").useDirection,u=require("@radix-ui/react-roving-focus"),a=u.RovingFocusGroup,c=u.RovingFocusItem,i=require("@radix-ui/react-portal").Portal,l=y({},require("@radix-ui/react-popper")),s=require("@radix-ui/react-primitive").Primitive,d=require("@radix-ui/react-presence").Presence,f=require("@radix-ui/react-focus-scope").FocusScope,m=require("@radix-ui/react-dismissable-layer").DismissableLayer,p=require("@radix-ui/react-context").createContext,v=require("@radix-ui/react-compose-refs"),g=v.useComposedRefs,C=v.composeRefs,h=require("@radix-ui/react-collection").createCollection,E=require("@radix-ui/primitive").composeEventHandlers,x=require("aria-hidden").hideOthers,b=require("react-remove-scroll").RemoveScroll,w=y({},require("react")),R=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function y(e,t){return Object.keys(t).forEach((function(n){"default"!==n&&"__esModule"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),e}const P=["Enter"," "],M=["ArrowUp","PageDown","End"],k=["ArrowDown","PageUp","Home",...M],I={ltr:[...P,"ArrowRight"],rtl:[...P,"ArrowLeft"]},D={ltr:["ArrowLeft"],rtl:["ArrowRight"]},[O,S]=p("Menu"),T=e=>{const{open:t=!1,children:n,onOpenChange:u,modal:a=!0}=e,[c,i]=w.useState(null),s=w.useRef(!1),d=r(u),f=o(c,e.dir);return w.useEffect((()=>{const e=()=>s.current=!0,t=()=>s.current=!1;return document.addEventListener("keydown",e,{capture:!0}),document.addEventListener("pointerdown",t,{capture:!0}),document.addEventListener("pointermove",t,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}}),[]),/*#__PURE__*/w.createElement(l.Root,null,/*#__PURE__*/w.createElement(O,{isSubmenu:!1,isUsingKeyboardRef:s,dir:f,open:t,onOpenChange:d,content:c,onContentChange:i,onRootClose:w.useCallback((()=>d(!1)),[d]),modal:a},n))};exports.Menu=T;const F=e=>{const{children:n,open:o=!1,onOpenChange:u}=e,a=S("MenuSub"),[c,i]=w.useState(null),[s,d]=w.useState(null),f=r(u);return w.useEffect((()=>(!1===a.open&&f(!1),()=>f(!1))),[a.open,f]),/*#__PURE__*/w.createElement(l.Root,null,/*#__PURE__*/w.createElement(O,{isSubmenu:!0,isUsingKeyboardRef:a.isUsingKeyboardRef,dir:a.dir,open:o,onOpenChange:f,content:s,onContentChange:d,onRootClose:a.onRootClose,contentId:t(),trigger:c,onTriggerChange:i,triggerId:t(),modal:!1},n))};exports.MenuSub=F;const L=/*#__PURE__*/w.forwardRef(((e,t)=>/*#__PURE__*/w.createElement(l.Anchor,R({},e,{ref:t}))));exports.MenuAnchor=L;const[K,q,A,G]=h(),[U,V]=p("MenuContent"),X=/*#__PURE__*/w.forwardRef(((e,t)=>{const{forceMount:n,...r}=e,o=S("MenuContent");/*#__PURE__*/return w.createElement(K,null,/*#__PURE__*/w.createElement(d,{present:n||o.open},/*#__PURE__*/w.createElement(q,null,o.isSubmenu?/*#__PURE__*/w.createElement(H,R({},r,{ref:t})):/*#__PURE__*/w.createElement(_,R({},r,{ref:t})))))}));exports.MenuContent=X;const _=/*#__PURE__*/w.forwardRef(((e,t)=>S("MenuContent").modal?/*#__PURE__*/w.createElement(B,R({},e,{ref:t})):/*#__PURE__*/w.createElement(j,R({},e,{ref:t})))),B=/*#__PURE__*/w.forwardRef(((e,t)=>{const n=S("MenuContent"),r=w.useRef(null),o=g(t,r);return w.useEffect((()=>{const e=r.current;if(e)return x(e)}),[]),/*#__PURE__*/w.createElement(Y,R({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:E(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))})),j=/*#__PURE__*/w.forwardRef(((e,t)=>{const n=S("MenuContent");/*#__PURE__*/return w.createElement(Y,R({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))})),H=/*#__PURE__*/w.forwardRef(((e,t)=>{const n=S("MenuContent"),r=w.useRef(null),o=g(t,r);return n.isSubmenu?/*#__PURE__*/w.createElement(Y,R({id:n.contentId,"aria-labelledby":n.triggerId},e,{ref:o,align:"start",side:"rtl"===n.dir?"left":"right",portalled:!0,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;n.isUsingKeyboardRef.current&&(null===(t=r.current)||void 0===t||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:E(e.onFocusOutside,(e=>{e.target!==n.trigger&&n.onOpenChange(!1)})),onEscapeKeyDown:E(e.onEscapeKeyDown,n.onRootClose),onKeyDown:E(e.onKeyDown,(e=>{const t=e.currentTarget.contains(e.target),r=D[n.dir].includes(e.key);var o;t&&r&&(n.onOpenChange(!1),null===(o=n.trigger)||void 0===o||o.focus())}))})):null})),Y=/*#__PURE__*/w.forwardRef(((e,t)=>{const{loop:r=!1,trapFocus:o,onOpenAutoFocus:u,onCloseAutoFocus:c,disableOutsidePointerEvents:s,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:v,onInteractOutside:C,onDismiss:h,disableOutsideScroll:x,portalled:y,...P}=e,I=S("MenuContent"),{getItems:D}=G(),[O,T]=w.useState(null),F=w.useRef(null),L=g(t,F,I.onContentChange),K=w.useRef(0),q=w.useRef(""),A=w.useRef(0),V=w.useRef(null),X=w.useRef("right"),_=w.useRef(0),B=y?i:w.Fragment,j=x?b:w.Fragment,H=e=>{var t,n;const r=q.current+e,o=D().filter((e=>!e.disabled)),u=document.activeElement,a=null===(t=o.find((e=>e.ref.current===u)))||void 0===t?void 0:t.textValue,c=function(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,o=n?e.indexOf(n):-1;let u=(a=e,c=Math.max(o,0),a.map(((e,t)=>a[(c+t)%a.length])));var a,c;1===r.length&&(u=u.filter((e=>e!==n)));const i=u.find((e=>e.toLowerCase().startsWith(r.toLowerCase())));return i!==n?i:void 0}(o.map((e=>e.textValue)),r,a),i=null===(n=o.find((e=>e.textValue===c)))||void 0===n?void 0:n.ref.current;!function e(t){q.current=t,window.clearTimeout(K.current),""!==t&&(K.current=window.setTimeout((()=>e("")),1e3))}(r),i&&setTimeout((()=>i.focus()))};w.useEffect((()=>()=>window.clearTimeout(K.current)),[]),n();const Y=w.useCallback((e=>{var t,n;return X.current===(null===(t=V.current)||void 0===t?void 0:t.side)&&function(e,t){if(!t)return!1;return function(e,t){const{x:n,y:r}=e;let o=!1;for(let e=0,u=t.length-1;e<t.length;u=e++){const a=t[e].x,c=t[e].y,i=t[u].x,l=t[u].y;c>r!=l>r&&n<(i-a)*(r-c)/(l-c)+a&&(o=!o)}return o}({x:e.clientX,y:e.clientY},t)}(e,null===(n=V.current)||void 0===n?void 0:n.area)}),[]);/*#__PURE__*/return w.createElement(B,null,/*#__PURE__*/w.createElement(j,null,/*#__PURE__*/w.createElement(U,{searchRef:q,onItemEnter:w.useCallback((e=>{Y(e)&&e.preventDefault()}),[Y]),onItemLeave:w.useCallback((e=>{var t;Y(e)||(null===(t=F.current)||void 0===t||t.focus(),T(null))}),[Y]),onTriggerLeave:w.useCallback((e=>{Y(e)&&e.preventDefault()}),[Y]),pointerGraceTimerRef:A,onPointerGraceIntentChange:w.useCallback((e=>{V.current=e}),[])},/*#__PURE__*/w.createElement(f,{asChild:!0,trapped:o,onMountAutoFocus:E(u,(e=>{var t;e.preventDefault(),null===(t=F.current)||void 0===t||t.focus()})),onUnmountAutoFocus:c},/*#__PURE__*/w.createElement(m,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:v,onInteractOutside:C,onDismiss:h},/*#__PURE__*/w.createElement(a,{asChild:!0,dir:I.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:T,onEntryFocus:e=>{I.isUsingKeyboardRef.current||e.preventDefault()}},/*#__PURE__*/w.createElement(l.Content,R({role:"menu",dir:I.dir,"data-state":ae(I.open)},P,{ref:L,style:{outline:"none",...P.style},onKeyDown:E(P.onKeyDown,(e=>{const t=e.target,n=e.currentTarget.contains(t),r=e.ctrlKey||e.altKey||e.metaKey;n&&!r&&1===e.key.length&&H(e.key),"Tab"===e.key&&e.preventDefault();const o=F.current;if(e.target!==o)return;if(!k.includes(e.key))return;e.preventDefault();const u=D().filter((e=>!e.disabled)).map((e=>e.ref.current));M.includes(e.key)&&u.reverse(),function(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}(u)})),onBlur:E(e.onBlur,(e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(K.current),q.current="")})),onPointerMove:E(e.onPointerMove,ie((e=>{const t=e.target,n=_.current!==e.clientX;if(e.currentTarget.contains(t)&&n){const t=e.clientX>_.current?"right":"left";X.current=t,_.current=e.clientX}})))}))))))))})),z=/*#__PURE__*/w.forwardRef(((e,t)=>/*#__PURE__*/w.createElement(s.div,R({role:"group"},e,{ref:t}))));exports.MenuGroup=z;const W=/*#__PURE__*/w.forwardRef(((e,t)=>/*#__PURE__*/w.createElement(s.div,R({},e,{ref:t}))));exports.MenuLabel=W;const J=/*#__PURE__*/w.forwardRef(((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,u=w.useRef(null),a=S("MenuItem"),c=V("MenuItem"),i=g(t,u),l=w.useRef(!1);/*#__PURE__*/return w.createElement(Q,R({},o,{ref:i,disabled:n,onClick:E(e.onClick,(()=>{const e=u.current;if(!n&&e){const t=new Event("menu.itemSelect",{bubbles:!0,cancelable:!0});e.addEventListener("menu.itemSelect",(e=>null==r?void 0:r(e)),{once:!0}),e.dispatchEvent(t),t.defaultPrevented?l.current=!1:a.onRootClose()}})),onPointerDown:t=>{var n;null===(n=e.onPointerDown)||void 0===n||n.call(e,t),l.current=!0},onPointerUp:E(e.onPointerUp,(e=>{var t;l.current||null===(t=e.currentTarget)||void 0===t||t.click()})),onKeyDown:E(e.onKeyDown,(e=>{const t=""!==c.searchRef.current;n||t&&" "===e.key||P.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())}))}))}));exports.MenuItem=J;const N=/*#__PURE__*/w.forwardRef(((e,t)=>{const n=S("MenuSubTrigger"),r=V("MenuSubTrigger"),o=w.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:a}=r,c=w.useCallback((()=>{o.current&&window.clearTimeout(o.current),o.current=null}),[]);return w.useEffect((()=>c),[c]),w.useEffect((()=>{const e=u.current;return()=>{window.clearTimeout(e),a(null)}}),[u,a]),n.isSubmenu?/*#__PURE__*/w.createElement(L,{asChild:!0},/*#__PURE__*/w.createElement(Q,R({id:n.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":ae(n.open)},e,{ref:C(t,n.onTriggerChange),onClick:t=>{var r;null===(r=e.onClick)||void 0===r||r.call(e,t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:E(e.onPointerMove,ie((t=>{r.onItemEnter(t),t.defaultPrevented||e.disabled||n.open||o.current||(r.onPointerGraceIntentChange(null),o.current=window.setTimeout((()=>{n.onOpenChange(!0),c()}),100))}))),onPointerLeave:E(e.onPointerLeave,ie((e=>{var t;c();const o=null===(t=n.content)||void 0===t?void 0:t.getBoundingClientRect();if(o){var a;const t=null===(a=n.content)||void 0===a?void 0:a.dataset.side,c="right"===t,i=c?-5:5,l=o[c?"left":"right"],s=o[c?"right":"left"];r.onPointerGraceIntentChange({area:[{x:e.clientX+i,y:e.clientY},{x:l,y:o.top},{x:s,y:o.top},{x:s,y:o.bottom},{x:l,y:o.bottom}],side:t}),window.clearTimeout(u.current),u.current=window.setTimeout((()=>r.onPointerGraceIntentChange(null)),300)}else{if(r.onTriggerLeave(e),e.defaultPrevented)return;r.onPointerGraceIntentChange(null)}}))),onKeyDown:E(e.onKeyDown,(t=>{const o=""!==r.searchRef.current;var u;e.disabled||o&&" "===t.key||I[n.dir].includes(t.key)&&(n.onOpenChange(!0),null===(u=n.content)||void 0===u||u.focus())}))}))):null}));exports.MenuSubTrigger=N;const Q=/*#__PURE__*/w.forwardRef(((e,t)=>{const{disabled:n=!1,textValue:r,...o}=e,u=w.useRef(null),a=g(t,u),i=V("MenuItem"),[l,d]=w.useState("");return w.useEffect((()=>{const e=u.current;var t;e&&d((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}),[o.children]),/*#__PURE__*/w.createElement(A,{disabled:n,textValue:null!=r?r:l},/*#__PURE__*/w.createElement(c,{asChild:!0,focusable:!n},/*#__PURE__*/w.createElement(s.div,R({role:"menuitem","aria-disabled":n||void 0,"data-disabled":n?"":void 0},o,{ref:a,onPointerMove:E(e.onPointerMove,ie((e=>{if(n)i.onItemLeave(e);else if(i.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus()}}))),onPointerLeave:E(e.onPointerLeave,ie((e=>i.onItemLeave(e))))}))))})),Z=/*#__PURE__*/w.forwardRef(((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;/*#__PURE__*/return w.createElement(ne.Provider,{value:n},/*#__PURE__*/w.createElement(J,R({role:"menuitemcheckbox","aria-checked":n},o,{ref:t,"data-state":ce(n),onSelect:E(o.onSelect,(()=>null==r?void 0:r(!n)),{checkForDefaultPrevented:!1})})))}));exports.MenuCheckboxItem=Z;const $=/*#__PURE__*/w.createContext({}),ee=/*#__PURE__*/w.forwardRef(((e,t)=>{const{value:n,onValueChange:o,...u}=e,a=r(o),c=w.useMemo((()=>({value:n,onValueChange:a})),[n,a]);/*#__PURE__*/return w.createElement($.Provider,{value:c},/*#__PURE__*/w.createElement(z,R({},u,{ref:t})))}));exports.MenuRadioGroup=ee;const te=/*#__PURE__*/w.forwardRef(((e,t)=>{const{value:n,...r}=e,o=w.useContext($),u=n===o.value;/*#__PURE__*/return w.createElement(ne.Provider,{value:u},/*#__PURE__*/w.createElement(J,R({role:"menuitemradio","aria-checked":u},r,{ref:t,"data-state":ce(u),onSelect:E(r.onSelect,(()=>{var e;return null===(e=o.onValueChange)||void 0===e?void 0:e.call(o,n)}),{checkForDefaultPrevented:!1})})))}));exports.MenuRadioItem=te;const ne=/*#__PURE__*/w.createContext(!1),re=/*#__PURE__*/w.forwardRef(((e,t)=>{const{forceMount:n,...r}=e,o=w.useContext(ne);/*#__PURE__*/return w.createElement(d,{present:n||o},/*#__PURE__*/w.createElement(s.span,R({},r,{ref:t,"data-state":ce(o)})))}));exports.MenuItemIndicator=re;const oe=/*#__PURE__*/w.forwardRef(((e,t)=>/*#__PURE__*/w.createElement(s.div,R({role:"separator","aria-orientation":"horizontal"},e,{ref:t}))));exports.MenuSeparator=oe;const ue=/*#__PURE__*/w.forwardRef(((e,t)=>/*#__PURE__*/w.createElement(l.Arrow,R({},e,{ref:t}))));function ae(e){return e?"open":"closed"}function ce(e){return e?"checked":"unchecked"}function ie(e){return t=>"mouse"===t.pointerType?e(t):void 0}exports.MenuArrow=ue;const le=T;exports.Root=le;const se=F;exports.Sub=se;const de=L;exports.Anchor=de;const fe=N;exports.SubTrigger=fe;const me=X;exports.Content=me;const pe=z;exports.Group=pe;const ve=W;exports.Label=ve;const ge=J;exports.Item=ge;const Ce=Z;exports.CheckboxItem=Ce;const he=ee;exports.RadioGroup=he;const Ee=te;exports.RadioItem=Ee;const xe=re;exports.ItemIndicator=xe;const be=oe;exports.Separator=be;const we=ue;exports.Arrow=we;
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":"IAAgCA,++BAAAA,8CAClBA,EAAEC,WAAaD,EAAEE,QAAUF,EAWzC,SAASG,EAAuBC,EAAMC,GAcpC,OAbAC,OAAOC,KAAKF,GAAQG,SAAQ,SAASC,GACvB,YAARA,GAA6B,eAARA,GAIzBH,OAAOI,eAAeN,EAAMK,EAAK,CAC/BE,YAAY,EACZC,IAAK,WACH,OAAOP,EAAOI,SAKbL,ECFT,MAAMS,EAAiB,CAAC,QAAS,KAE3BC,EAAY,CAAC,UAAW,WAAY,OACpCC,EAAkB,CAFJ,YAAa,SAAU,UAEAD,GACrCE,EAA6C,CACjDC,IAAK,IAAIJ,EAAgB,cACzBK,IAAK,IAAIL,EAAgB,cAErBM,EAA8C,CAClDF,IAAK,CAAC,aACNC,IAAK,CAAC,gBA4BDE,EAAcC,GAAkBC,EArBrB,QA+BZC,EAAgCC,IACpC,MAAMC,KAAEA,GAAO,EAATC,SAAgBA,EAAhBC,aAA0BA,GAAiBH,GAC1CI,EAASC,GAAcC,EAAMC,SAAoC,MAClEC,EAAqBF,EAAMG,QAAO,GAClCC,EAAmBC,EAAeR,GAClCS,EAAoBC,EAAaT,EAASJ,EAAMc,KAiBtD,OAfAR,EAAMS,WAAU,KACd,MAAMC,EAAgB,IAAOR,EAAmBS,SAAU,EACpDC,EAAgB,IAAOV,EAAmBS,SAAU,EAM1D,OAHAE,SAASC,iBAAiB,UAAWJ,EAAe,CAAEK,SAAS,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AY,YAiF/B,SAASvD,GAAa6B,GACpB,OAAQ1K,GAAiC,UAAtBA,EAAM2K,YAA0BD,EAAQ1K,QAASuE,uBAOtE,MAAMxH,GAAO3B,kBACb,MAAMmT,GAAMlR,iBACZ,MAAM0Q,GAAS1D,qBACf,MAAMmE,GAAavE,wBACnB,MAAMrC,GAAUzJ,qBAChB,MAAMsQ,GAAQvB,oBACd,MAAMwB,GAAQR,oBACd,MAAMS,GAAO1F,kBACb,MAAM2F,GAAezC,0BACrB,MAAM0C,GAAajC,wBACnB,MAAMkC,GAAY3B,uBAClB,MAAM4B,GAAgBrB,4BACtB,MAAMsB,GAAYb,wBAClB,MAAMG,GAAQD","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/menu/src/Menu.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs, composeRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive, extendPrimitive } from '@radix-ui/react-primitive';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { Portal } from '@radix-ui/react-portal';\nimport { RovingFocusGroup, RovingFocusItem } from '@radix-ui/react-roving-focus';\nimport { Slot } from '@radix-ui/react-slot';\nimport { useDirection } from '@radix-ui/react-use-direction';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { useId } from '@radix-ui/react-id';\n\nimport type * as Polymorphic from '@radix-ui/react-polymorphic';\n\ntype Direction = 'ltr' | 'rtl';\n\nconst SELECTION_KEYS = ['Enter', ' '];\nconst FIRST_KEYS = ['ArrowDown', 'PageUp', 'Home'];\nconst LAST_KEYS = ['ArrowUp', 'PageDown', 'End'];\nconst FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];\nconst SUB_OPEN_KEYS: Record<Direction, string[]> = {\n ltr: [...SELECTION_KEYS, 'ArrowRight'],\n rtl: [...SELECTION_KEYS, 'ArrowLeft'],\n};\nconst SUB_CLOSE_KEYS: Record<Direction, string[]> = {\n ltr: ['ArrowLeft'],\n rtl: ['ArrowRight'],\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Menu\n * -----------------------------------------------------------------------------------------------*/\n\nconst MENU_NAME = 'Menu';\n\ntype MenuRootContextValue = {\n isSubmenu: false;\n isUsingKeyboardRef: React.RefObject<boolean>;\n dir: Direction;\n open: boolean;\n onOpenChange(open: boolean): void;\n content: MenuContentElement | null;\n onContentChange(content: MenuContentElement | null): void;\n onRootClose(): void;\n};\n\ntype MenuSubContextValue = Omit<MenuRootContextValue, 'isSubmenu'> & {\n isSubmenu: true;\n contentId: string;\n triggerId: string;\n trigger: MenuSubTriggerElement | null;\n onTriggerChange(trigger: MenuSubTriggerElement | null): void;\n};\n\nconst [MenuProvider, useMenuContext] = createContext<MenuRootContextValue | MenuSubContextValue>(\n MENU_NAME\n);\n\ntype MenuOwnProps = {\n open?: boolean;\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n};\n\nconst Menu: React.FC<MenuOwnProps> = (props) => {\n const { open = false, children, onOpenChange } = props;\n const [content, setContent] = React.useState<MenuContentElement | null>(null);\n const isUsingKeyboardRef = React.useRef(false);\n const handleOpenChange = useCallbackRef(onOpenChange);\n const computedDirection = useDirection(content, props.dir);\n\n React.useEffect(() => {\n const handleKeyDown = () => (isUsingKeyboardRef.current = true);\n const handlePointer = () => (isUsingKeyboardRef.current = false);\n // Capture phase ensures we set the boolean before any side effects execute\n // in response to the key or pointer event as they might depend on this value.\n document.addEventListener('keydown', handleKeyDown, { capture: true });\n document.addEventListener('pointerdown', handlePointer, { capture: true });\n document.addEventListener('pointermove', handlePointer, { capture: true });\n return () => {\n document.removeEventListener('keydown', handleKeyDown, { capture: true });\n document.removeEventListener('pointerdown', handlePointer, { capture: true });\n document.removeEventListener('pointermove', handlePointer, { capture: true });\n };\n }, []);\n\n return (\n <PopperPrimitive.Root>\n <MenuProvider\n isSubmenu={false}\n isUsingKeyboardRef={isUsingKeyboardRef}\n dir={computedDirection}\n open={open}\n onOpenChange={handleOpenChange}\n content={content}\n onContentChange={setContent}\n onRootClose={React.useCallback(() => handleOpenChange(false), [handleOpenChange])}\n >\n {children}\n </MenuProvider>\n </PopperPrimitive.Root>\n );\n};\n\nMenu.displayName = MENU_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst SUB_NAME = 'MenuSub';\n\ntype MenuSubOwnProps = {\n open?: boolean;\n onOpenChange?(open: boolean): void;\n};\n\nconst MenuSub: React.FC<MenuSubOwnProps> = (props) => {\n const { children, open = false, onOpenChange } = props;\n const parentMenuContext = useMenuContext(SUB_NAME);\n const [trigger, setTrigger] = React.useState<MenuSubTriggerElement | null>(null);\n const [content, setContent] = React.useState<MenuContentElement | null>(null);\n const handleOpenChange = useCallbackRef(onOpenChange);\n\n // Prevent the parent menu from reopening with open submenus.\n React.useEffect(() => {\n if (parentMenuContext.open === false) handleOpenChange(false);\n return () => handleOpenChange(false);\n }, [parentMenuContext.open, handleOpenChange]);\n\n return (\n <PopperPrimitive.Root>\n <MenuProvider\n isSubmenu={true}\n isUsingKeyboardRef={parentMenuContext.isUsingKeyboardRef}\n dir={parentMenuContext.dir}\n open={open}\n onOpenChange={handleOpenChange}\n content={content}\n onContentChange={setContent}\n onRootClose={parentMenuContext.onRootClose}\n contentId={useId()}\n trigger={trigger}\n onTriggerChange={setTrigger}\n triggerId={useId()}\n >\n {children}\n </MenuProvider>\n </PopperPrimitive.Root>\n );\n};\n\nMenuSub.displayName = SUB_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'MenuContent';\n\ntype MenuContentElement = React.ElementRef<typeof MenuContent>;\ntype ItemData = { disabled: boolean; textValue: string };\n\nconst [CollectionSlot, CollectionItemSlot, useCollection] = createCollection<\n React.ElementRef<typeof MenuItem>,\n ItemData\n>();\n\ntype MenuContentContextValue = {\n onItemEnter(event: React.PointerEvent): void;\n onItemLeave(event: React.PointerEvent): void;\n onTriggerLeave(event: React.PointerEvent): void;\n searchRef: React.RefObject<string>;\n pointerGraceTimerRef: React.MutableRefObject<number>;\n onPointerGraceIntentChange(intent: GraceIntent | null): void;\n};\nconst [MenuContentProvider, useMenuContentContext] = createContext<MenuContentContextValue>(\n CONTENT_NAME\n);\n\n/**\n * We purposefully don't union MenuRootContent and MenuSubContent props here because\n * they have conflicting prop types. We agreed that we would allow MenuSubContent to\n * accept props that it would just ignore.\n */\ntype MenuContentOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof MenuRootContent>,\n {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n }\n>;\n\ntype MenuContentPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuRootContent>,\n MenuContentOwnProps\n>;\n\nconst MenuContent = React.forwardRef((props, forwardedRef) => {\n const { forceMount, ...contentProps } = props;\n const context = useMenuContext(CONTENT_NAME);\n return (\n <Presence present={forceMount || context.open}>\n <CollectionSlot>\n {context.isSubmenu ? (\n <MenuSubContent {...contentProps} ref={forwardedRef} />\n ) : (\n <MenuRootContent {...contentProps} ref={forwardedRef} />\n )}\n </CollectionSlot>\n </Presence>\n );\n}) as MenuContentPrimitive;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuRootContentOwnProps = Omit<\n Polymorphic.OwnProps<typeof MenuContentImpl>,\n keyof MenuContentImplPrivateProps\n>;\ntype MenuRootContentPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuContentImpl>,\n MenuRootContentOwnProps\n>;\n\nconst MenuRootContent = React.forwardRef((props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n const ref = React.useRef<React.ElementRef<typeof MenuContentImpl>>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n // Hide everything from ARIA except the `MenuContent`\n React.useEffect(() => {\n const content = ref.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <MenuContentImpl {...props} ref={composedRefs} onDismiss={() => context.onOpenChange(false)} />\n );\n}) as MenuRootContentPrimitive;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuSubContentOwnProps = Omit<\n Polymorphic.OwnProps<typeof MenuContentImpl>,\n | keyof MenuContentImplPrivateProps\n | 'align'\n | 'side'\n | 'portalled'\n | 'disabledOutsidePointerEvents'\n | 'disableOutsideScroll'\n | 'trapFocus'\n | 'onCloseAutoFocus'\n>;\n\ntype MenuSubContentPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuContentImpl>,\n MenuSubContentOwnProps\n>;\n\nconst MenuSubContent = React.forwardRef((props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n const ref = React.useRef<MenuContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n return context.isSubmenu ? (\n <MenuContentImpl\n id={context.contentId}\n aria-labelledby={context.triggerId}\n {...props}\n ref={composedRefs}\n align=\"start\"\n side={context.dir === 'rtl' ? 'left' : 'right'}\n portalled\n disableOutsidePointerEvents={false}\n disableOutsideScroll={false}\n trapFocus={false}\n onOpenAutoFocus={(event) => {\n // when opening a submenu, focus content for keyboard users only\n if (context.isUsingKeyboardRef.current) ref.current?.focus();\n event.preventDefault();\n }}\n // The menu might close because of focusing another menu item in the parent menu. We\n // don't want it to refocus the trigger in that case so we handle trigger focus ourselves.\n onCloseAutoFocus={(event) => event.preventDefault()}\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) => {\n // We prevent closing when the trigger is focused to avoid triggering a re-open animation\n // on pointer interaction.\n if (event.target !== context.trigger) context.onOpenChange(false);\n })}\n onEscapeKeyDown={composeEventHandlers(props.onEscapeKeyDown, context.onRootClose)}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Submenu key events bubble through portals. We only care about keys in this menu.\n const isKeyDownInside = event.currentTarget.contains(event.target as HTMLElement);\n const isCloseKey = SUB_CLOSE_KEYS[context.dir].includes(event.key);\n if (isKeyDownInside && isCloseKey) {\n context.onOpenChange(false);\n // We focus manually because we prevented it in `onCloseAutoFocus`\n context.trigger?.focus();\n }\n })}\n />\n ) : null;\n}) as MenuSubContentPrimitive;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype FocusScopeOwnProps = Polymorphic.OwnProps<typeof FocusScope>;\ntype DismissableLayerOwnProps = Polymorphic.OwnProps<typeof DismissableLayer>;\ntype RovingFocusGroupOwnProps = Polymorphic.OwnProps<typeof RovingFocusGroup>;\n\ntype MenuContentImplPrivateProps = {\n onOpenAutoFocus?: FocusScopeOwnProps['onMountAutoFocus'];\n onDismiss?: DismissableLayerOwnProps['onDismiss'];\n};\n\ntype MenuContentImplOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof PopperPrimitive.Content>,\n Omit<DismissableLayerOwnProps, 'onDismiss'> &\n MenuContentImplPrivateProps & {\n /**\n * Whether focus should be trapped within the `MenuContent`\n * (default: false)\n */\n trapFocus?: FocusScopeOwnProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeOwnProps['onUnmountAutoFocus'];\n\n /**\n * Whether scrolling outside the `MenuContent` should be prevented\n * (default: `false`)\n */\n disableOutsideScroll?: boolean;\n\n /**\n * The direction of navigation between menu items.\n * @defaultValue ltr\n */\n dir?: RovingFocusGroupOwnProps['dir'];\n\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: RovingFocusGroupOwnProps['loop'];\n\n /**\n * Whether the `MenuContent` should render in a `Portal`\n * (default: `true`)\n */\n portalled?: boolean;\n }\n>;\n\ntype MenuContentImplPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof PopperPrimitive.Content>,\n MenuContentImplOwnProps\n>;\n\nconst MenuContentImpl = React.forwardRef((props, forwardedRef) => {\n const {\n loop = false,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n disableOutsideScroll,\n portalled,\n ...contentProps\n } = props;\n const context = useMenuContext(CONTENT_NAME);\n const { getItems } = useCollection();\n const [currentItemId, setCurrentItemId] = React.useState<string | null>(null);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef, context.onContentChange);\n const isPointerDownOutsideRef = React.useRef(false);\n const timerRef = React.useRef(0);\n const searchRef = React.useRef('');\n const pointerGraceTimerRef = React.useRef(0);\n const pointerGraceIntentRef = React.useRef<GraceIntent | null>(null);\n const pointerDirRef = React.useRef<Side>('right');\n const lastPointerXRef = React.useRef(0);\n\n const PortalWrapper = portalled ? Portal : React.Fragment;\n const ScrollLockWrapper = disableOutsideScroll ? RemoveScroll : React.Fragment;\n\n const handleTypeaheadSearch = (key: string) => {\n const search = searchRef.current + key;\n const items = getItems().filter((item) => !item.disabled);\n const currentItem = document.activeElement;\n const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;\n const values = items.map((item) => item.textValue);\n const nextMatch = getNextMatch(values, search, currentMatch);\n const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;\n\n // Reset `searchRef` 1 second after it was last updated\n (function updateSearch(value: string) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n if (value !== '') timerRef.current = window.setTimeout(() => updateSearch(''), 1000);\n })(search);\n\n if (newItem) {\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => (newItem as HTMLElement).focus());\n }\n };\n\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n\n // Make sure the whole tree has focus guards as our `MenuContent` may be\n // the last element in the DOM (beacuse of the `Portal`)\n useFocusGuards();\n\n const isPointerMovingToSubmenu = React.useCallback((event: React.PointerEvent) => {\n const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;\n return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);\n }, []);\n\n return (\n <PortalWrapper>\n <ScrollLockWrapper>\n <MenuContentProvider\n searchRef={searchRef}\n onItemEnter={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n )}\n onItemLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) return;\n contentRef.current?.focus();\n setCurrentItemId(null);\n },\n [isPointerMovingToSubmenu]\n )}\n onTriggerLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n )}\n pointerGraceTimerRef={pointerGraceTimerRef}\n onPointerGraceIntentChange={React.useCallback((intent) => {\n pointerGraceIntentRef.current = intent;\n }, [])}\n >\n <FocusScope\n as={Slot}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapped={trapFocus && context.open}\n onMountAutoFocus={composeEventHandlers(onOpenAutoFocus, (event) => {\n // when opening, explicitly focus the content area only and leave\n // `onEntryFocus` in control of focusing first item\n event.preventDefault();\n contentRef.current?.focus();\n })}\n onUnmountAutoFocus={(event) => {\n // skip autofocus on unmount if clicking outside is permitted and it happened\n if (!disableOutsidePointerEvents && isPointerDownOutsideRef.current) {\n event.preventDefault();\n } else {\n onCloseAutoFocus?.(event);\n }\n }}\n >\n <DismissableLayer\n as={Slot}\n disableOutsidePointerEvents={disableOutsidePointerEvents}\n onEscapeKeyDown={composeEventHandlers(onEscapeKeyDown, () => {\n isPointerDownOutsideRef.current = false;\n })}\n onPointerDownOutside={composeEventHandlers(\n onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent as MouseEvent;\n const isLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === false;\n isPointerDownOutsideRef.current = isLeftClick;\n },\n { checkForDefaultPrevented: false }\n )}\n onFocusOutside={composeEventHandlers(\n onFocusOutside,\n (event) => {\n // When focus is trapped, a focusout event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n if (trapFocus) event.preventDefault();\n },\n { checkForDefaultPrevented: false }\n )}\n onInteractOutside={onInteractOutside}\n onDismiss={onDismiss}\n >\n <RovingFocusGroup\n as={Slot}\n dir={context.dir}\n orientation=\"vertical\"\n loop={loop}\n currentTabStopId={currentItemId}\n onCurrentTabStopIdChange={setCurrentItemId}\n onEntryFocus={(event) => {\n // only focus first item when using keyboard\n if (!context.isUsingKeyboardRef.current) event.preventDefault();\n }}\n >\n <PopperPrimitive.Content\n role=\"menu\"\n dir={context.dir}\n data-state={getOpenState(context.open)}\n {...contentProps}\n ref={composedRefs}\n style={{ outline: 'none', ...contentProps.style }}\n onKeyDown={composeEventHandlers(contentProps.onKeyDown, (event) => {\n // submenu key events bubble through portals. We only care about keys in this menu.\n const target = event.target as HTMLElement;\n const isKeyDownInside = event.currentTarget.contains(target);\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n if (isKeyDownInside && !isModifierKey && event.key.length === 1) {\n handleTypeaheadSearch(event.key);\n }\n // menus should not be navigated using tab key so we prevent it\n if (event.key === 'Tab') event.preventDefault();\n // focus first/last item based on key pressed\n const content = contentRef.current;\n if (event.target !== content) return;\n if (!FIRST_LAST_KEYS.includes(event.key)) return;\n event.preventDefault();\n const items = getItems().filter((item) => !item.disabled);\n const candidateNodes = items.map((item) => item.ref.current!);\n if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();\n focusFirst(candidateNodes);\n })}\n onBlur={composeEventHandlers(props.onBlur, (event) => {\n // clear search buffer when leaving the menu\n if (!event.currentTarget.contains(event.target)) {\n window.clearTimeout(timerRef.current);\n searchRef.current = '';\n }\n })}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n const target = event.target as HTMLElement;\n const pointerXHasChanged = lastPointerXRef.current !== event.clientX;\n\n // We don't use `event.movementX` for this check because Safari will\n // always return `0` on a pointer event.\n if (event.currentTarget.contains(target) && pointerXHasChanged) {\n const newDir = event.clientX > lastPointerXRef.current ? 'right' : 'left';\n pointerDirRef.current = newDir;\n lastPointerXRef.current = event.clientX;\n }\n })\n )}\n />\n </RovingFocusGroup>\n </DismissableLayer>\n </FocusScope>\n </MenuContentProvider>\n </ScrollLockWrapper>\n </PortalWrapper>\n );\n}) as MenuContentImplPrimitive;\n\nMenuContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'MenuItem';\nconst ITEM_DEFAULT_TAG = 'div';\nconst ITEM_SELECT = 'menu.itemSelect';\n\ntype MenuItemOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof MenuItemImpl>,\n { onSelect?: (event: Event) => void }\n>;\n\ntype MenuItemPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuItemImpl>,\n MenuItemOwnProps\n>;\n\nconst MenuItem = React.forwardRef((props, forwardedRef) => {\n const { disabled = false, onSelect, ...itemProps } = props;\n const ref = React.useRef<HTMLDivElement>(null);\n const context = useMenuContext(ITEM_NAME);\n const contentContext = useMenuContentContext(ITEM_NAME);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n const handleSelect = () => {\n const menuItem = ref.current;\n if (!disabled && menuItem) {\n const itemSelectEvent = new Event(ITEM_SELECT, { bubbles: true, cancelable: true });\n menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });\n menuItem.dispatchEvent(itemSelectEvent);\n if (itemSelectEvent.defaultPrevented) return;\n context.onRootClose();\n }\n };\n\n return (\n <MenuItemImpl\n {...itemProps}\n ref={composedRefs}\n disabled={disabled}\n // we handle selection on `pointerUp` rather than `click` to match native menus implementation\n onPointerUp={composeEventHandlers(props.onPointerUp, handleSelect)}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (disabled || (isTypingAhead && event.key === ' ')) return;\n if (SELECTION_KEYS.includes(event.key)) {\n // prevent page scroll if using the space key to select an item\n if (event.key === ' ') event.preventDefault();\n handleSelect();\n }\n })}\n />\n );\n}) as MenuItemPrimitive;\n\nMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'MenuSubTrigger';\n\ntype MenuSubTriggerElement = React.ElementRef<typeof MenuSubTrigger>;\ntype MenuSubTriggerOwnProps = Polymorphic.OwnProps<typeof MenuItemImpl>;\ntype MenuSubTriggerPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuItemImpl>,\n MenuSubTriggerOwnProps\n>;\n\nconst MenuSubTrigger = React.forwardRef((props, forwardedRef) => {\n const context = useMenuContext(SUB_TRIGGER_NAME);\n const contentContext = useMenuContentContext(SUB_TRIGGER_NAME);\n const openTimerRef = React.useRef<number | null>(null);\n const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;\n\n const clearOpenTimer = React.useCallback(() => {\n if (openTimerRef.current) window.clearTimeout(openTimerRef.current);\n openTimerRef.current = null;\n }, []);\n\n React.useEffect(() => clearOpenTimer, [clearOpenTimer]);\n\n React.useEffect(() => {\n const pointerGraceTimer = pointerGraceTimerRef.current;\n return () => {\n window.clearTimeout(pointerGraceTimer);\n onPointerGraceIntentChange(null);\n };\n }, [pointerGraceTimerRef, onPointerGraceIntentChange]);\n\n return context.isSubmenu ? (\n <MenuAnchor as={Slot}>\n <MenuItemImpl\n id={context.triggerId}\n aria-haspopup=\"menu\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getOpenState(context.open)}\n {...props}\n ref={composeRefs(forwardedRef, context.onTriggerChange)}\n onPointerUp={composeEventHandlers(\n props.onPointerUp,\n whenTouchOrPen((event) => {\n contentContext.onItemEnter(event);\n if (event.defaultPrevented) return;\n if (!props.disabled && !context.open) context.onOpenChange(true);\n })\n )}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n contentContext.onItemEnter(event);\n if (event.defaultPrevented) return;\n if (!props.disabled && !context.open && !openTimerRef.current) {\n contentContext.onPointerGraceIntentChange(null);\n openTimerRef.current = window.setTimeout(() => {\n context.onOpenChange(true);\n clearOpenTimer();\n }, 100);\n }\n })\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => {\n clearOpenTimer();\n\n const contentRect = context.content?.getBoundingClientRect();\n if (contentRect) {\n // TODO: make sure to update this when we change positioning logic\n const side = context.content?.dataset.side as Side;\n const rightSide = side === 'right';\n const bleed = rightSide ? -5 : +5;\n const contentNearEdge = contentRect[rightSide ? 'left' : 'right'];\n const contentFarEdge = contentRect[rightSide ? 'right' : 'left'];\n\n contentContext.onPointerGraceIntentChange({\n area: [\n // Apply a bleed on clientX to ensure that our exit point is\n // consistently within polygon bounds\n { x: event.clientX + bleed, y: event.clientY },\n { x: contentNearEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.bottom },\n { x: contentNearEdge, y: contentRect.bottom },\n ],\n side,\n });\n\n window.clearTimeout(pointerGraceTimerRef.current);\n pointerGraceTimerRef.current = window.setTimeout(\n () => contentContext.onPointerGraceIntentChange(null),\n 300\n );\n } else {\n contentContext.onTriggerLeave(event);\n if (event.defaultPrevented) return;\n\n // There's 100ms where the user may leave an item before the submenu was opened.\n contentContext.onPointerGraceIntentChange(null);\n }\n })\n )}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (props.disabled || (isTypingAhead && event.key === ' ')) return;\n if (SUB_OPEN_KEYS[context.dir].includes(event.key)) {\n context.onOpenChange(true);\n // The trigger may hold focus if opened via pointer interaction\n // so we ensure content is given focus again when switching to keyboard.\n context.content?.focus();\n }\n })}\n />\n </MenuAnchor>\n ) : null;\n}) as MenuSubTriggerPrimitive;\n\nMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuItemImplOwnProps = Polymorphic.Merge<\n Omit<Polymorphic.OwnProps<typeof RovingFocusItem>, 'focusable' | 'active'>,\n {\n disabled?: boolean;\n textValue?: string;\n }\n>;\n\ntype MenuItemImplPrimitive = Polymorphic.ForwardRefComponent<\n typeof ITEM_DEFAULT_TAG,\n MenuItemImplOwnProps\n>;\n\nconst MenuItemImpl = React.forwardRef((props, forwardedRef) => {\n const { as = ITEM_DEFAULT_TAG, disabled = false, textValue, ...itemProps } = props;\n const ref = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const contentContext = useMenuContentContext(ITEM_NAME);\n\n // get the item's `.textContent` as default strategy for typeahead `textValue`\n const [textContent, setTextContent] = React.useState('');\n React.useEffect(() => {\n const menuItem = ref.current;\n if (menuItem) {\n setTextContent((menuItem.textContent ?? '').trim());\n }\n }, [itemProps.children]);\n\n return (\n <CollectionItemSlot disabled={disabled} textValue={textValue ?? textContent}>\n <RovingFocusItem\n role=\"menuitem\"\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n focusable={!disabled}\n {...itemProps}\n as={as}\n ref={composedRefs}\n /**\n * We focus items on `pointerMove` to achieve the following:\n *\n * - Mouse over an item (it focuses)\n * - Leave mouse where it is and use keyboard to focus a different item\n * - Wiggle mouse without it leaving previously focused item\n * - Previously focused item should re-focus\n *\n * If we used `mouseOver`/`mouseEnter` it would not re-focus when the mouse\n * wiggles. This is to match native menu implementation.\n */\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n if (disabled) {\n contentContext.onItemLeave(event);\n } else {\n contentContext.onItemEnter(event);\n if (!event.defaultPrevented) {\n const item = event.currentTarget;\n item.focus();\n }\n }\n })\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => contentContext.onItemLeave(event))\n )}\n />\n </CollectionItemSlot>\n );\n}) as MenuItemImplPrimitive;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'MenuCheckboxItem';\n\ntype MenuCheckboxItemOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof MenuItem>,\n {\n checked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n }\n>;\n\ntype MenuCheckboxItemPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuItem>,\n MenuCheckboxItemOwnProps\n>;\n\nconst MenuCheckboxItem = React.forwardRef((props, forwardedRef) => {\n const { checked = false, onCheckedChange, ...checkboxItemProps } = props;\n return (\n <ItemIndicatorContext.Provider value={checked}>\n <MenuItem\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n {...checkboxItemProps}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n onSelect={composeEventHandlers(\n checkboxItemProps.onSelect,\n () => onCheckedChange?.(!checked),\n { checkForDefaultPrevented: false }\n )}\n />\n </ItemIndicatorContext.Provider>\n );\n}) as MenuCheckboxItemPrimitive;\n\nMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'MenuRadioGroup';\n\nconst RadioGroupContext = React.createContext<MenuRadioGroupOwnProps>({} as any);\n\ntype MenuRadioGroupOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof MenuGroup>,\n {\n value?: string;\n onValueChange?: (value: string) => void;\n }\n>;\n\ntype MenuRadioGroupPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuGroup>,\n MenuRadioGroupOwnProps\n>;\n\nconst MenuRadioGroup = React.forwardRef((props, forwardedRef) => {\n const { value, onValueChange, ...groupProps } = props;\n const handleValueChange = useCallbackRef(onValueChange);\n const context = React.useMemo(() => ({ value, onValueChange: handleValueChange }), [\n value,\n handleValueChange,\n ]);\n return (\n <RadioGroupContext.Provider value={context}>\n <MenuGroup {...groupProps} ref={forwardedRef} />\n </RadioGroupContext.Provider>\n );\n}) as MenuRadioGroupPrimitive;\n\nMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'MenuRadioItem';\n\ntype MenuRadioItemOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof MenuItem>,\n { value: string }\n>;\ntype MenuRadioItemPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuItem>,\n MenuRadioItemOwnProps\n>;\n\nconst MenuRadioItem = React.forwardRef((props, forwardedRef) => {\n const { value, ...radioItemProps } = props;\n const context = React.useContext(RadioGroupContext);\n const checked = value === context.value;\n return (\n <ItemIndicatorContext.Provider value={checked}>\n <MenuItem\n role=\"menuitemradio\"\n aria-checked={checked}\n {...radioItemProps}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n onSelect={composeEventHandlers(\n radioItemProps.onSelect,\n () => context.onValueChange?.(value),\n { checkForDefaultPrevented: false }\n )}\n />\n </ItemIndicatorContext.Provider>\n );\n}) as MenuRadioItemPrimitive;\n\nMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'MenuItemIndicator';\nconst ITEM_INDICATOR_DEFAULT_TAG = 'span';\n\nconst ItemIndicatorContext = React.createContext(false);\n\ntype MenuItemIndicatorOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof Primitive>,\n {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n }\n>;\n\ntype MenuItemIndicatorPrimitive = Polymorphic.ForwardRefComponent<\n typeof ITEM_INDICATOR_DEFAULT_TAG,\n MenuItemIndicatorOwnProps\n>;\n\nconst MenuItemIndicator = React.forwardRef((props, forwardedRef) => {\n const { as = ITEM_INDICATOR_DEFAULT_TAG, forceMount, ...indicatorProps } = props;\n const checked = React.useContext(ItemIndicatorContext);\n return (\n <Presence present={forceMount || checked}>\n <Primitive\n {...indicatorProps}\n as={as}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n />\n </Presence>\n );\n}) as MenuItemIndicatorPrimitive;\n\nMenuItemIndicator.displayName = ITEM_INDICATOR_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst MenuAnchor = extendPrimitive(PopperPrimitive.Anchor, { displayName: 'MenuAnchor' });\nconst MenuGroup = extendPrimitive(Primitive, {\n defaultProps: { role: 'group' },\n displayName: 'MenuGroup',\n});\nconst MenuLabel = extendPrimitive(Primitive, { displayName: 'MenuLabel' });\nconst MenuSeparator = extendPrimitive(Primitive, {\n defaultProps: { role: 'separator', 'aria-orientation': 'horizontal' },\n displayName: 'MenuSeparator ',\n});\nconst MenuArrow = extendPrimitive(PopperPrimitive.Arrow, { displayName: 'MenuArrow' });\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getOpenState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nfunction getCheckedState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray<T>(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\n\n/**\n * This is the \"meat\" of the typeahead matching logic. It takes in all the values,\n * the search and the current match, and returns the next match (or `undefined`).\n *\n * We normalize the search because if a user has repeatedly pressed a character,\n * we want the exact same behavior as if we only had that one character\n * (ie. cycle through options starting with that character)\n *\n * We also reorder the values by wrapping the array around the current match.\n * This is so we always look forward from the current match, and picking the first\n * match will always be the correct one.\n *\n * Finally, if the normalized search is exactly one character, we exclude the\n * current match from the values because otherwise it would be the first to match always\n * and focus would never move. This is as opposed to the regular case, where we\n * don't want focus to move if the current match still matches.\n */\nfunction getNextMatch(values: string[], search: string, currentMatch?: string) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0] : search;\n const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;\n let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));\n const excludeCurrentMatch = normalizedSearch.length === 1;\n if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);\n const nextMatch = wrappedValues.find((value) =>\n value.toLowerCase().startsWith(normalizedSearch.toLowerCase())\n );\n return nextMatch !== currentMatch ? nextMatch : undefined;\n}\n\ntype Point = { x: number; y: number };\ntype Polygon = Point[];\ntype Side = 'left' | 'right';\ntype GraceIntent = { area: Polygon; side: Side };\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\nfunction isPointerInGraceArea(event: React.PointerEvent, area?: Polygon) {\n if (!area) return false;\n const cursorPos = { x: event.clientX, y: event.clientY };\n return isPointInPolygon(cursorPos, area);\n}\n\nfunction whenMouse<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType === 'mouse' ? handler(event) : undefined);\n}\n\nfunction whenTouchOrPen<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType !== 'mouse' ? handler(event) : undefined);\n}\n\nconst Root = Menu;\nconst Sub = MenuSub;\nconst Anchor = MenuAnchor;\nconst SubTrigger = MenuSubTrigger;\nconst Content = MenuContent;\nconst Group = MenuGroup;\nconst Label = MenuLabel;\nconst Item = MenuItem;\nconst CheckboxItem = MenuCheckboxItem;\nconst RadioGroup = MenuRadioGroup;\nconst RadioItem = MenuRadioItem;\nconst ItemIndicator = MenuItemIndicator;\nconst Separator = MenuSeparator;\nconst Arrow = MenuArrow;\n\nexport {\n Menu,\n MenuSub,\n MenuAnchor,\n MenuSubTrigger,\n MenuContent,\n MenuGroup,\n MenuLabel,\n MenuItem,\n MenuCheckboxItem,\n MenuRadioGroup,\n MenuRadioItem,\n MenuItemIndicator,\n MenuSeparator,\n MenuArrow,\n //\n Root,\n Sub,\n Anchor,\n SubTrigger,\n Content,\n Group,\n Label,\n Item,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n};\nexport type {\n MenuSubTriggerPrimitive,\n MenuContentPrimitive,\n MenuItemPrimitive,\n MenuCheckboxItemPrimitive,\n MenuRadioGroupPrimitive,\n MenuRadioItemPrimitive,\n MenuItemIndicatorPrimitive,\n};\n"],"names":["a","__esModule","default","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","SELECTION_KEYS","LAST_KEYS","FIRST_LAST_KEYS","SUB_OPEN_KEYS","ltr","rtl","SUB_CLOSE_KEYS","MenuProvider","useMenuContext","createContext","Menu","props","open","children","onOpenChange","content","setContent","React","useState","isUsingKeyboardRef","useRef","handleOpenChange","useCallbackRef","computedDirection","useDirection","dir","useEffect","handleKeyDown","current","handlePointer","document","addEventListener","capture","removeEventListener","_react","createElement","_radixUiReactPopper","Root","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuProvider","isSubmenu","onContentChange","onRootClose","useCallback","MenuSub","parentMenuContext","trigger","setTrigger","contentId","useId","onTriggerChange","triggerId","CollectionSlot","CollectionItemSlot","useCollection","createCollection","MenuContentProvider","useMenuContentContext","MenuContent","forwardRef","forwardedRef","forceMount","contentProps","context","Presence","present","$e032a19b6af7c9eb10e1f9f631421ad$var$CollectionSlot","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuSubContent","_babelRuntimeHelpersExtends","ref","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuRootContent","MenuRootContent","composedRefs","useComposedRefs","hideOthers","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuContentImpl","onDismiss","MenuSubContent","id","aria-labelledby","align","side","portalled","disableOutsidePointerEvents","disableOutsideScroll","trapFocus","onOpenAutoFocus","event","_ref$current","focus","preventDefault","onCloseAutoFocus","onFocusOutside","composeEventHandlers","target","onEscapeKeyDown","onKeyDown","isKeyDownInside","currentTarget","contains","isCloseKey","includes","_context$trigger","MenuContentImpl","loop","onPointerDownOutside","onInteractOutside","getItems","currentItemId","setCurrentItemId","contentRef","isPointerDownOutsideRef","timerRef","searchRef","pointerGraceTimerRef","pointerGraceIntentRef","pointerDirRef","lastPointerXRef","PortalWrapper","Portal","Fragment","ScrollLockWrapper","RemoveScroll","handleTypeaheadSearch","_items$find","_items$find2","search","items","filter","item","disabled","currentItem","activeElement","currentMatch","find","textValue","nextMatch","values","normalizedSearch","length","Array","from","every","char","currentMatchIndex","indexOf","wrappedValues","array","startIndex","Math","max","map","_","index","v","value","toLowerCase","startsWith","undefined","getNextMatch","newItem","updateSearch","window","clearTimeout","setTimeout","useFocusGuards","isPointerMovingToSubmenu","_pointerGraceIntentRe","_pointerGraceIntentRe2","area","point","polygon","x","y","inside","i","j","xi","yi","xj","yj","isPointInPolygon","clientX","clientY","isPointerInGraceArea","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuContentProvider","onItemEnter","onItemLeave","_contentRef$current","onTriggerLeave","onPointerGraceIntentChange","intent","FocusScope","as","Slot","trapped","onMountAutoFocus","_contentRef$current2","onUnmountAutoFocus","DismissableLayer","originalEvent","detail","isLeftClick","button","ctrlKey","checkForDefaultPrevented","RovingFocusGroup","orientation","currentTabStopId","onCurrentTabStopIdChange","onEntryFocus","Content","role","data-state","getOpenState","style","outline","isModifierKey","altKey","metaKey","candidateNodes","reverse","candidates","PREVIOUSLY_FOCUSED_ELEMENT","candidate","focusFirst","onBlur","onPointerMove","whenMouse","pointerXHasChanged","newDir","ITEM_DEFAULT_TAG","MenuItem","onSelect","itemProps","contentContext","handleSelect","menuItem","itemSelectEvent","Event","bubbles","cancelable","once","dispatchEvent","defaultPrevented","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuItemImpl","onPointerUp","isTypingAhead","MenuSubTrigger","openTimerRef","clearOpenTimer","pointerGraceTimer","MenuAnchor","aria-haspopup","aria-expanded","aria-controls","composeRefs","handler","pointerType","onPointerLeave","_context$content","contentRect","getBoundingClientRect","_context$content2","dataset","rightSide","bleed","contentNearEdge","contentFarEdge","top","bottom","_context$content3","MenuItemImpl","textContent","setTextContent","_menuItem$textContent","trim","$e032a19b6af7c9eb10e1f9f631421ad$var$CollectionItemSlot","RovingFocusItem","aria-disabled","data-disabled","focusable","MenuCheckboxItem","checked","onCheckedChange","checkboxItemProps","$e032a19b6af7c9eb10e1f9f631421ad$var$ItemIndicatorContext","Provider","aria-checked","getCheckedState","RadioGroupContext","MenuRadioGroup","onValueChange","groupProps","handleValueChange","useMemo","$e032a19b6af7c9eb10e1f9f631421ad$var$RadioGroupContext","MenuGroup","MenuRadioItem","radioItemProps","useContext","_context$onValueChang","call","ITEM_INDICATOR_DEFAULT_TAG","ItemIndicatorContext","MenuItemIndicator","indicatorProps","Primitive","extendPrimitive","PopperPrimitive","Anchor","displayName","defaultProps","MenuLabel","MenuSeparator","aria-orientation","MenuArrow","Arrow","Sub","SubTrigger","Group","Label","Item","CheckboxItem","RadioGroup","RadioItem","ItemIndicator","Separator"],"version":3,"file":"index.js.map"}
1
+ {"mappings":"IAAgCA,g7BAAAA,8CAClBA,EAAEC,WAAaD,EAAEE,QAAUF,EAWzC,SAASG,EAAuBC,EAAMC,GAcpC,OAbAC,OAAOC,KAAKF,GAAQG,SAAQ,SAASC,GACvB,YAARA,GAA6B,eAARA,GAIzBH,OAAOI,eAAeN,EAAMK,EAAK,CAC/BE,YAAY,EACZC,IAAK,WACH,OAAOP,EAAOI,SAKbL,ECHT,MAAMS,EA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ACoM,EAAUC,IAAXjL,EAAA,CAAe4J,KAAK,YAAY,mBAAiB,cAAiBzM,EAAlE,CAAyE8C,IAAKH,gCAUlF,MAMM6P,gBAAYjS,EAAMmC,YAA6C,CAAC1C,EAAO2C,iBAC3EnB,EAAAC,cAACC,EAAgB+Q,MAAjB5P,EAAA,GAA2B7C,EAA3B,CAAkC8C,IAAKH,OAOzC,SAAS+J,GAAazM,GACpB,OAAOA,EAAO,OAAS,SAGzB,SAASsR,GAAgBL,GACvB,OAAOA,EAAU,UAAY,YAiF/B,SAASzD,GAAaiF,GACpB,OAAQ7N,GAAiC,UAAtBA,EAAM8N,YAA0BD,EAAQ7N,QAAS6E,uBAGtE,MAAM/H,GAAO5B,kBACb,MAAM6S,GAAM3Q,iBACZ,MAAMW,GAASH,oBACf,MAAMoQ,GAAavD,wBACnB,MAAM9C,GAAUlJ,qBAChB,MAAMwP,GAAQlF,mBACd,MAAMmF,GAAQhF,mBACd,MAAMiF,GAAOhF,kBACb,MAAMiF,GAAehC,0BACrB,MAAMiC,GAAazB,yBACnB,MAAM0B,GAAYpB,wBAClB,MAAMqB,GAAgBhB,4BACtB,MAAMiB,GAAYd,wBAClB,MAAME,GAAQD","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/menu/src/Menu.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs, composeRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { Portal } from '@radix-ui/react-portal';\nimport { RovingFocusGroup, RovingFocusItem } from '@radix-ui/react-roving-focus';\nimport { useDirection } from '@radix-ui/react-use-direction';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { useId } from '@radix-ui/react-id';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\ntype Direction = 'ltr' | 'rtl';\n\nconst SELECTION_KEYS = ['Enter', ' '];\nconst FIRST_KEYS = ['ArrowDown', 'PageUp', 'Home'];\nconst LAST_KEYS = ['ArrowUp', 'PageDown', 'End'];\nconst FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];\nconst SUB_OPEN_KEYS: Record<Direction, string[]> = {\n ltr: [...SELECTION_KEYS, 'ArrowRight'],\n rtl: [...SELECTION_KEYS, 'ArrowLeft'],\n};\nconst SUB_CLOSE_KEYS: Record<Direction, string[]> = {\n ltr: ['ArrowLeft'],\n rtl: ['ArrowRight'],\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Menu\n * -----------------------------------------------------------------------------------------------*/\n\nconst MENU_NAME = 'Menu';\n\ntype MenuRootContextValue = {\n isSubmenu: false;\n isUsingKeyboardRef: React.RefObject<boolean>;\n dir: Direction;\n open: boolean;\n onOpenChange(open: boolean): void;\n content: MenuContentElement | null;\n onContentChange(content: MenuContentElement | null): void;\n onRootClose(): void;\n modal: boolean;\n};\n\ntype MenuSubContextValue = Omit<MenuRootContextValue, 'isSubmenu'> & {\n isSubmenu: true;\n contentId: string;\n triggerId: string;\n trigger: MenuSubTriggerElement | null;\n onTriggerChange(trigger: MenuSubTriggerElement | null): void;\n};\n\nconst [MenuProvider, useMenuContext] = createContext<MenuRootContextValue | MenuSubContextValue>(\n MENU_NAME\n);\n\ninterface MenuProps {\n open?: boolean;\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n modal?: boolean;\n}\n\nconst Menu: React.FC<MenuProps> = (props) => {\n const { open = false, children, onOpenChange, modal = true } = props;\n const [content, setContent] = React.useState<MenuContentElement | null>(null);\n const isUsingKeyboardRef = React.useRef(false);\n const handleOpenChange = useCallbackRef(onOpenChange);\n const computedDirection = useDirection(content, props.dir);\n\n React.useEffect(() => {\n const handleKeyDown = () => (isUsingKeyboardRef.current = true);\n const handlePointer = () => (isUsingKeyboardRef.current = false);\n // Capture phase ensures we set the boolean before any side effects execute\n // in response to the key or pointer event as they might depend on this value.\n document.addEventListener('keydown', handleKeyDown, { capture: true });\n document.addEventListener('pointerdown', handlePointer, { capture: true });\n document.addEventListener('pointermove', handlePointer, { capture: true });\n return () => {\n document.removeEventListener('keydown', handleKeyDown, { capture: true });\n document.removeEventListener('pointerdown', handlePointer, { capture: true });\n document.removeEventListener('pointermove', handlePointer, { capture: true });\n };\n }, []);\n\n return (\n <PopperPrimitive.Root>\n <MenuProvider\n isSubmenu={false}\n isUsingKeyboardRef={isUsingKeyboardRef}\n dir={computedDirection}\n open={open}\n onOpenChange={handleOpenChange}\n content={content}\n onContentChange={setContent}\n onRootClose={React.useCallback(() => handleOpenChange(false), [handleOpenChange])}\n modal={modal}\n >\n {children}\n </MenuProvider>\n </PopperPrimitive.Root>\n );\n};\n\nMenu.displayName = MENU_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst SUB_NAME = 'MenuSub';\n\ninterface MenuSubProps {\n open?: boolean;\n onOpenChange?(open: boolean): void;\n}\n\nconst MenuSub: React.FC<MenuSubProps> = (props) => {\n const { children, open = false, onOpenChange } = props;\n const parentMenuContext = useMenuContext(SUB_NAME);\n const [trigger, setTrigger] = React.useState<MenuSubTriggerElement | null>(null);\n const [content, setContent] = React.useState<MenuContentElement | null>(null);\n const handleOpenChange = useCallbackRef(onOpenChange);\n\n // Prevent the parent menu from reopening with open submenus.\n React.useEffect(() => {\n if (parentMenuContext.open === false) handleOpenChange(false);\n return () => handleOpenChange(false);\n }, [parentMenuContext.open, handleOpenChange]);\n\n return (\n <PopperPrimitive.Root>\n <MenuProvider\n isSubmenu={true}\n isUsingKeyboardRef={parentMenuContext.isUsingKeyboardRef}\n dir={parentMenuContext.dir}\n open={open}\n onOpenChange={handleOpenChange}\n content={content}\n onContentChange={setContent}\n onRootClose={parentMenuContext.onRootClose}\n contentId={useId()}\n trigger={trigger}\n onTriggerChange={setTrigger}\n triggerId={useId()}\n modal={false}\n >\n {children}\n </MenuProvider>\n </PopperPrimitive.Root>\n );\n};\n\nMenuSub.displayName = SUB_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'MenuAnchor';\n\ntype MenuAnchorElement = React.ElementRef<typeof PopperPrimitive.Anchor>;\ntype PopperAnchorProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;\ninterface MenuAnchorProps extends PopperAnchorProps {}\n\nconst MenuAnchor = React.forwardRef<MenuAnchorElement, MenuAnchorProps>((props, forwardedRef) => (\n <PopperPrimitive.Anchor {...props} ref={forwardedRef} />\n));\n\nMenuAnchor.displayName = ANCHOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'MenuContent';\n\ntype ItemData = { disabled: boolean; textValue: string };\n\nconst [CollectionProvider, CollectionSlot, CollectionItemSlot, useCollection] = createCollection<\n MenuItemElement,\n ItemData\n>();\n\ntype MenuContentContextValue = {\n onItemEnter(event: React.PointerEvent): void;\n onItemLeave(event: React.PointerEvent): void;\n onTriggerLeave(event: React.PointerEvent): void;\n searchRef: React.RefObject<string>;\n pointerGraceTimerRef: React.MutableRefObject<number>;\n onPointerGraceIntentChange(intent: GraceIntent | null): void;\n};\nconst [MenuContentProvider, useMenuContentContext] =\n createContext<MenuContentContextValue>(CONTENT_NAME);\n\ntype MenuContentElement = MenuRootContentElement | MenuSubContentElement;\n/**\n * We purposefully don't union MenuRootContent and MenuSubContent props here because\n * they have conflicting prop types. We agreed that we would allow MenuSubContent to\n * accept props that it would just ignore.\n */\ninterface MenuContentProps extends MenuRootContentProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst MenuContent = React.forwardRef<MenuContentElement, MenuContentProps>(\n (props, forwardedRef) => {\n const { forceMount, ...contentProps } = props;\n const context = useMenuContext(CONTENT_NAME);\n return (\n <CollectionProvider>\n <Presence present={forceMount || context.open}>\n <CollectionSlot>\n {context.isSubmenu ? (\n <MenuSubContent {...contentProps} ref={forwardedRef} />\n ) : (\n <MenuRootContent {...contentProps} ref={forwardedRef} />\n )}\n </CollectionSlot>\n </Presence>\n </CollectionProvider>\n );\n }\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuRootContentElement = MenuRootContentTypeElement;\ninterface MenuRootContentProps\n extends Omit<MenuRootContentTypeProps, keyof MenuContentImplPrivateProps> {}\n\nconst MenuRootContent = React.forwardRef<MenuRootContentElement, MenuRootContentProps>(\n (props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n return context.modal ? (\n <MenuRootContentModal {...props} ref={forwardedRef} />\n ) : (\n <MenuRootContentNonModal {...props} ref={forwardedRef} />\n );\n }\n);\n\ntype MenuRootContentTypeElement = MenuContentImplElement;\ninterface MenuRootContentTypeProps\n extends Omit<\n MenuContentImplProps,\n 'trapFocus' | 'disableOutsidePointerEvents' | 'disableOutsideScroll'\n > {}\n\nconst MenuRootContentModal = React.forwardRef<MenuRootContentTypeElement, MenuRootContentTypeProps>(\n (props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n const ref = React.useRef<MenuRootContentTypeElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n // Hide everything from ARIA except the `MenuContent`\n React.useEffect(() => {\n const content = ref.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <MenuContentImpl\n {...props}\n ref={composedRefs}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n // make sure to only disable pointer events when open\n // this avoids blocking interactions while animating out\n disableOutsidePointerEvents={context.open}\n disableOutsideScroll\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false }\n )}\n onDismiss={() => context.onOpenChange(false)}\n />\n );\n }\n);\n\nconst MenuRootContentNonModal = React.forwardRef<\n MenuRootContentTypeElement,\n MenuRootContentTypeProps\n>((props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n return (\n <MenuContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n disableOutsideScroll={false}\n onDismiss={() => context.onOpenChange(false)}\n />\n );\n});\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuSubContentElement = MenuContentImplElement;\ninterface MenuSubContentProps\n extends Omit<\n MenuContentImplProps,\n | keyof MenuContentImplPrivateProps\n | 'align'\n | 'side'\n | 'portalled'\n | 'disabledOutsidePointerEvents'\n | 'disableOutsideScroll'\n | 'trapFocus'\n | 'onCloseAutoFocus'\n > {}\n\nconst MenuSubContent = React.forwardRef<MenuSubContentElement, MenuSubContentProps>(\n (props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n const ref = React.useRef<MenuSubContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n return context.isSubmenu ? (\n <MenuContentImpl\n id={context.contentId}\n aria-labelledby={context.triggerId}\n {...props}\n ref={composedRefs}\n align=\"start\"\n side={context.dir === 'rtl' ? 'left' : 'right'}\n portalled\n disableOutsidePointerEvents={false}\n disableOutsideScroll={false}\n trapFocus={false}\n onOpenAutoFocus={(event) => {\n // when opening a submenu, focus content for keyboard users only\n if (context.isUsingKeyboardRef.current) ref.current?.focus();\n event.preventDefault();\n }}\n // The menu might close because of focusing another menu item in the parent menu. We\n // don't want it to refocus the trigger in that case so we handle trigger focus ourselves.\n onCloseAutoFocus={(event) => event.preventDefault()}\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) => {\n // We prevent closing when the trigger is focused to avoid triggering a re-open animation\n // on pointer interaction.\n if (event.target !== context.trigger) context.onOpenChange(false);\n })}\n onEscapeKeyDown={composeEventHandlers(props.onEscapeKeyDown, context.onRootClose)}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Submenu key events bubble through portals. We only care about keys in this menu.\n const isKeyDownInside = event.currentTarget.contains(event.target as HTMLElement);\n const isCloseKey = SUB_CLOSE_KEYS[context.dir].includes(event.key);\n if (isKeyDownInside && isCloseKey) {\n context.onOpenChange(false);\n // We focus manually because we prevented it in `onCloseAutoFocus`\n context.trigger?.focus();\n }\n })}\n />\n ) : null;\n }\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ntype MenuContentImplPrivateProps = {\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];\n onDismiss?: DismissableLayerProps['onDismiss'];\n};\ninterface MenuContentImplProps\n extends MenuContentImplPrivateProps,\n PopperContentProps,\n Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * Whether focus should be trapped within the `MenuContent`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n\n /**\n * Whether scrolling outside the `MenuContent` should be prevented\n * (default: `false`)\n */\n disableOutsideScroll?: boolean;\n\n /**\n * The direction of navigation between menu items.\n * @defaultValue ltr\n */\n dir?: RovingFocusGroupProps['dir'];\n\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: RovingFocusGroupProps['loop'];\n\n /**\n * Whether the `MenuContent` should render in a `Portal`\n * (default: `true`)\n */\n portalled?: boolean;\n}\n\nconst MenuContentImpl = React.forwardRef<MenuContentImplElement, MenuContentImplProps>(\n (props, forwardedRef) => {\n const {\n loop = false,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n disableOutsideScroll,\n portalled,\n ...contentProps\n } = props;\n const context = useMenuContext(CONTENT_NAME);\n const { getItems } = useCollection();\n const [currentItemId, setCurrentItemId] = React.useState<string | null>(null);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef, context.onContentChange);\n const timerRef = React.useRef(0);\n const searchRef = React.useRef('');\n const pointerGraceTimerRef = React.useRef(0);\n const pointerGraceIntentRef = React.useRef<GraceIntent | null>(null);\n const pointerDirRef = React.useRef<Side>('right');\n const lastPointerXRef = React.useRef(0);\n\n const PortalWrapper = portalled ? Portal : React.Fragment;\n const ScrollLockWrapper = disableOutsideScroll ? RemoveScroll : React.Fragment;\n\n const handleTypeaheadSearch = (key: string) => {\n const search = searchRef.current + key;\n const items = getItems().filter((item) => !item.disabled);\n const currentItem = document.activeElement;\n const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;\n const values = items.map((item) => item.textValue);\n const nextMatch = getNextMatch(values, search, currentMatch);\n const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;\n\n // Reset `searchRef` 1 second after it was last updated\n (function updateSearch(value: string) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n if (value !== '') timerRef.current = window.setTimeout(() => updateSearch(''), 1000);\n })(search);\n\n if (newItem) {\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => (newItem as HTMLElement).focus());\n }\n };\n\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n\n // Make sure the whole tree has focus guards as our `MenuContent` may be\n // the last element in the DOM (beacuse of the `Portal`)\n useFocusGuards();\n\n const isPointerMovingToSubmenu = React.useCallback((event: React.PointerEvent) => {\n const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;\n return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);\n }, []);\n\n return (\n <PortalWrapper>\n <ScrollLockWrapper>\n <MenuContentProvider\n searchRef={searchRef}\n onItemEnter={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n )}\n onItemLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) return;\n contentRef.current?.focus();\n setCurrentItemId(null);\n },\n [isPointerMovingToSubmenu]\n )}\n onTriggerLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n )}\n pointerGraceTimerRef={pointerGraceTimerRef}\n onPointerGraceIntentChange={React.useCallback((intent) => {\n pointerGraceIntentRef.current = intent;\n }, [])}\n >\n <FocusScope\n asChild\n trapped={trapFocus}\n onMountAutoFocus={composeEventHandlers(onOpenAutoFocus, (event) => {\n // when opening, explicitly focus the content area only and leave\n // `onEntryFocus` in control of focusing first item\n event.preventDefault();\n contentRef.current?.focus();\n })}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={disableOutsidePointerEvents}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onInteractOutside={onInteractOutside}\n onDismiss={onDismiss}\n >\n <RovingFocusGroup\n asChild\n dir={context.dir}\n orientation=\"vertical\"\n loop={loop}\n currentTabStopId={currentItemId}\n onCurrentTabStopIdChange={setCurrentItemId}\n onEntryFocus={(event) => {\n // only focus first item when using keyboard\n if (!context.isUsingKeyboardRef.current) event.preventDefault();\n }}\n >\n <PopperPrimitive.Content\n role=\"menu\"\n dir={context.dir}\n data-state={getOpenState(context.open)}\n {...contentProps}\n ref={composedRefs}\n style={{ outline: 'none', ...contentProps.style }}\n onKeyDown={composeEventHandlers(contentProps.onKeyDown, (event) => {\n // submenu key events bubble through portals. We only care about keys in this menu.\n const target = event.target as HTMLElement;\n const isKeyDownInside = event.currentTarget.contains(target);\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n if (isKeyDownInside && !isModifierKey && event.key.length === 1) {\n handleTypeaheadSearch(event.key);\n }\n // menus should not be navigated using tab key so we prevent it\n if (event.key === 'Tab') event.preventDefault();\n // focus first/last item based on key pressed\n const content = contentRef.current;\n if (event.target !== content) return;\n if (!FIRST_LAST_KEYS.includes(event.key)) return;\n event.preventDefault();\n const items = getItems().filter((item) => !item.disabled);\n const candidateNodes = items.map((item) => item.ref.current!);\n if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();\n focusFirst(candidateNodes);\n })}\n onBlur={composeEventHandlers(props.onBlur, (event) => {\n // clear search buffer when leaving the menu\n if (!event.currentTarget.contains(event.target)) {\n window.clearTimeout(timerRef.current);\n searchRef.current = '';\n }\n })}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n const target = event.target as HTMLElement;\n const pointerXHasChanged = lastPointerXRef.current !== event.clientX;\n\n // We don't use `event.movementX` for this check because Safari will\n // always return `0` on a pointer event.\n if (event.currentTarget.contains(target) && pointerXHasChanged) {\n const newDir = event.clientX > lastPointerXRef.current ? 'right' : 'left';\n pointerDirRef.current = newDir;\n lastPointerXRef.current = event.clientX;\n }\n })\n )}\n />\n </RovingFocusGroup>\n </DismissableLayer>\n </FocusScope>\n </MenuContentProvider>\n </ScrollLockWrapper>\n </PortalWrapper>\n );\n }\n);\n\nMenuContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'MenuGroup';\n\ntype MenuGroupElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface MenuGroupProps extends PrimitiveDivProps {}\n\nconst MenuGroup = React.forwardRef<MenuGroupElement, MenuGroupProps>((props, forwardedRef) => (\n <Primitive.div role=\"group\" {...props} ref={forwardedRef} />\n));\n\nMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'MenuLabel';\n\ntype MenuLabelElement = React.ElementRef<typeof Primitive.div>;\ninterface MenuLabelProps extends PrimitiveDivProps {}\n\nconst MenuLabel = React.forwardRef<MenuLabelElement, MenuLabelProps>((props, forwardedRef) => (\n <Primitive.div {...props} ref={forwardedRef} />\n));\n\nMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'MenuItem';\nconst ITEM_SELECT = 'menu.itemSelect';\n\ntype MenuItemElement = MenuItemImplElement;\ninterface MenuItemProps extends Omit<MenuItemImplProps, 'onSelect'> {\n onSelect?: (event: Event) => void;\n}\n\nconst MenuItem = React.forwardRef<MenuItemElement, MenuItemProps>((props, forwardedRef) => {\n const { disabled = false, onSelect, ...itemProps } = props;\n const ref = React.useRef<HTMLDivElement>(null);\n const context = useMenuContext(ITEM_NAME);\n const contentContext = useMenuContentContext(ITEM_NAME);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const isPointerDownRef = React.useRef(false);\n\n const handleSelect = () => {\n const menuItem = ref.current;\n if (!disabled && menuItem) {\n const itemSelectEvent = new Event(ITEM_SELECT, { bubbles: true, cancelable: true });\n menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });\n menuItem.dispatchEvent(itemSelectEvent);\n if (itemSelectEvent.defaultPrevented) {\n isPointerDownRef.current = false;\n } else {\n context.onRootClose();\n }\n }\n };\n\n return (\n <MenuItemImpl\n {...itemProps}\n ref={composedRefs}\n disabled={disabled}\n onClick={composeEventHandlers(props.onClick, handleSelect)}\n onPointerDown={(event) => {\n props.onPointerDown?.(event);\n isPointerDownRef.current = true;\n }}\n onPointerUp={composeEventHandlers(props.onPointerUp, (event) => {\n // Pointer down can move to a different menu item which should activate it on pointer up.\n // We dispatch a click for selection to allow composition with click based triggers and to\n // prevent Firefox from getting stuck in text selection mode when the menu closes.\n if (!isPointerDownRef.current) event.currentTarget?.click();\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (disabled || (isTypingAhead && event.key === ' ')) return;\n if (SELECTION_KEYS.includes(event.key)) {\n event.currentTarget.click();\n /**\n * We prevent default browser behaviour for selection keys as they should trigger\n * a selection only:\n * - prevents space from scrolling the page.\n * - if keydown causes focus to move, prevents keydown from firing on the new target.\n */\n event.preventDefault();\n }\n })}\n />\n );\n});\n\nMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'MenuSubTrigger';\n\ntype MenuSubTriggerElement = MenuItemImplElement;\ninterface MenuSubTriggerProps extends MenuItemImplProps {}\n\nconst MenuSubTrigger = React.forwardRef<MenuSubTriggerElement, MenuSubTriggerProps>(\n (props, forwardedRef) => {\n const context = useMenuContext(SUB_TRIGGER_NAME);\n const contentContext = useMenuContentContext(SUB_TRIGGER_NAME);\n const openTimerRef = React.useRef<number | null>(null);\n const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;\n\n const clearOpenTimer = React.useCallback(() => {\n if (openTimerRef.current) window.clearTimeout(openTimerRef.current);\n openTimerRef.current = null;\n }, []);\n\n React.useEffect(() => clearOpenTimer, [clearOpenTimer]);\n\n React.useEffect(() => {\n const pointerGraceTimer = pointerGraceTimerRef.current;\n return () => {\n window.clearTimeout(pointerGraceTimer);\n onPointerGraceIntentChange(null);\n };\n }, [pointerGraceTimerRef, onPointerGraceIntentChange]);\n\n return context.isSubmenu ? (\n <MenuAnchor asChild>\n <MenuItemImpl\n id={context.triggerId}\n aria-haspopup=\"menu\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getOpenState(context.open)}\n {...props}\n ref={composeRefs(forwardedRef, context.onTriggerChange)}\n // This is redundant for mouse users but we cannot determine pointer type from\n // click event and we cannot use pointerup event (see git history for reasons why)\n onClick={(event) => {\n props.onClick?.(event);\n if (props.disabled || event.defaultPrevented) return;\n /**\n * We manually focus because iOS Safari doesn't always focus on click (e.g. buttons)\n * and we rely heavily on `onFocusOutside` for submenus to close when switching\n * between separate submenus.\n */\n event.currentTarget.focus();\n if (!context.open) context.onOpenChange(true);\n }}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n contentContext.onItemEnter(event);\n if (event.defaultPrevented) return;\n if (!props.disabled && !context.open && !openTimerRef.current) {\n contentContext.onPointerGraceIntentChange(null);\n openTimerRef.current = window.setTimeout(() => {\n context.onOpenChange(true);\n clearOpenTimer();\n }, 100);\n }\n })\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => {\n clearOpenTimer();\n\n const contentRect = context.content?.getBoundingClientRect();\n if (contentRect) {\n // TODO: make sure to update this when we change positioning logic\n const side = context.content?.dataset.side as Side;\n const rightSide = side === 'right';\n const bleed = rightSide ? -5 : +5;\n const contentNearEdge = contentRect[rightSide ? 'left' : 'right'];\n const contentFarEdge = contentRect[rightSide ? 'right' : 'left'];\n\n contentContext.onPointerGraceIntentChange({\n area: [\n // Apply a bleed on clientX to ensure that our exit point is\n // consistently within polygon bounds\n { x: event.clientX + bleed, y: event.clientY },\n { x: contentNearEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.bottom },\n { x: contentNearEdge, y: contentRect.bottom },\n ],\n side,\n });\n\n window.clearTimeout(pointerGraceTimerRef.current);\n pointerGraceTimerRef.current = window.setTimeout(\n () => contentContext.onPointerGraceIntentChange(null),\n 300\n );\n } else {\n contentContext.onTriggerLeave(event);\n if (event.defaultPrevented) return;\n\n // There's 100ms where the user may leave an item before the submenu was opened.\n contentContext.onPointerGraceIntentChange(null);\n }\n })\n )}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (props.disabled || (isTypingAhead && event.key === ' ')) return;\n if (SUB_OPEN_KEYS[context.dir].includes(event.key)) {\n context.onOpenChange(true);\n // The trigger may hold focus if opened via pointer interaction\n // so we ensure content is given focus again when switching to keyboard.\n context.content?.focus();\n }\n })}\n />\n </MenuAnchor>\n ) : null;\n }\n);\n\nMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuItemImplElement = React.ElementRef<typeof Primitive.div>;\ninterface MenuItemImplProps extends PrimitiveDivProps {\n disabled?: boolean;\n textValue?: string;\n}\n\nconst MenuItemImpl = React.forwardRef<MenuItemImplElement, MenuItemImplProps>(\n (props, forwardedRef) => {\n const { disabled = false, textValue, ...itemProps } = props;\n const ref = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const contentContext = useMenuContentContext(ITEM_NAME);\n\n // get the item's `.textContent` as default strategy for typeahead `textValue`\n const [textContent, setTextContent] = React.useState('');\n React.useEffect(() => {\n const menuItem = ref.current;\n if (menuItem) {\n setTextContent((menuItem.textContent ?? '').trim());\n }\n }, [itemProps.children]);\n\n return (\n <CollectionItemSlot disabled={disabled} textValue={textValue ?? textContent}>\n <RovingFocusItem asChild focusable={!disabled}>\n <Primitive.div\n role=\"menuitem\"\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n {...itemProps}\n ref={composedRefs}\n /**\n * We focus items on `pointerMove` to achieve the following:\n *\n * - Mouse over an item (it focuses)\n * - Leave mouse where it is and use keyboard to focus a different item\n * - Wiggle mouse without it leaving previously focused item\n * - Previously focused item should re-focus\n *\n * If we used `mouseOver`/`mouseEnter` it would not re-focus when the mouse\n * wiggles. This is to match native menu implementation.\n */\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n if (disabled) {\n contentContext.onItemLeave(event);\n } else {\n contentContext.onItemEnter(event);\n if (!event.defaultPrevented) {\n const item = event.currentTarget;\n item.focus();\n }\n }\n })\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => contentContext.onItemLeave(event))\n )}\n />\n </RovingFocusItem>\n </CollectionItemSlot>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'MenuCheckboxItem';\n\ntype MenuCheckboxItemElement = MenuItemElement;\ninterface MenuCheckboxItemProps extends MenuItemProps {\n checked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst MenuCheckboxItem = React.forwardRef<MenuCheckboxItemElement, MenuCheckboxItemProps>(\n (props, forwardedRef) => {\n const { checked = false, onCheckedChange, ...checkboxItemProps } = props;\n return (\n <ItemIndicatorContext.Provider value={checked}>\n <MenuItem\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n {...checkboxItemProps}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n onSelect={composeEventHandlers(\n checkboxItemProps.onSelect,\n () => onCheckedChange?.(!checked),\n { checkForDefaultPrevented: false }\n )}\n />\n </ItemIndicatorContext.Provider>\n );\n }\n);\n\nMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'MenuRadioGroup';\n\nconst RadioGroupContext = React.createContext<MenuRadioGroupProps>({} as any);\n\ntype MenuRadioGroupElement = React.ElementRef<typeof MenuGroup>;\ninterface MenuRadioGroupProps extends MenuGroupProps {\n value?: string;\n onValueChange?: (value: string) => void;\n}\n\nconst MenuRadioGroup = React.forwardRef<MenuRadioGroupElement, MenuRadioGroupProps>(\n (props, forwardedRef) => {\n const { value, onValueChange, ...groupProps } = props;\n const handleValueChange = useCallbackRef(onValueChange);\n const context = React.useMemo(\n () => ({ value, onValueChange: handleValueChange }),\n [value, handleValueChange]\n );\n return (\n <RadioGroupContext.Provider value={context}>\n <MenuGroup {...groupProps} ref={forwardedRef} />\n </RadioGroupContext.Provider>\n );\n }\n);\n\nMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'MenuRadioItem';\n\ntype MenuRadioItemElement = React.ElementRef<typeof MenuItem>;\ninterface MenuRadioItemProps extends MenuItemProps {\n value: string;\n}\n\nconst MenuRadioItem = React.forwardRef<MenuRadioItemElement, MenuRadioItemProps>(\n (props, forwardedRef) => {\n const { value, ...radioItemProps } = props;\n const context = React.useContext(RadioGroupContext);\n const checked = value === context.value;\n return (\n <ItemIndicatorContext.Provider value={checked}>\n <MenuItem\n role=\"menuitemradio\"\n aria-checked={checked}\n {...radioItemProps}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n onSelect={composeEventHandlers(\n radioItemProps.onSelect,\n () => context.onValueChange?.(value),\n { checkForDefaultPrevented: false }\n )}\n />\n </ItemIndicatorContext.Provider>\n );\n }\n);\n\nMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'MenuItemIndicator';\n\nconst ItemIndicatorContext = React.createContext(false);\n\ntype MenuItemIndicatorElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface MenuItemIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst MenuItemIndicator = React.forwardRef<MenuItemIndicatorElement, MenuItemIndicatorProps>(\n (props, forwardedRef) => {\n const { forceMount, ...indicatorProps } = props;\n const checked = React.useContext(ItemIndicatorContext);\n return (\n <Presence present={forceMount || checked}>\n <Primitive.span\n {...indicatorProps}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n />\n </Presence>\n );\n }\n);\n\nMenuItemIndicator.displayName = ITEM_INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'MenuSeparator';\n\ntype MenuSeparatorElement = React.ElementRef<typeof Primitive.div>;\ninterface MenuSeparatorProps extends PrimitiveDivProps {}\n\nconst MenuSeparator = React.forwardRef<MenuSeparatorElement, MenuSeparatorProps>(\n (props, forwardedRef) => (\n <Primitive.div role=\"separator\" aria-orientation=\"horizontal\" {...props} ref={forwardedRef} />\n )\n);\n\nMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'MenuArrow';\n\ntype MenuArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface MenuArrowProps extends PopperArrowProps {}\n\nconst MenuArrow = React.forwardRef<MenuArrowElement, MenuArrowProps>((props, forwardedRef) => (\n <PopperPrimitive.Arrow {...props} ref={forwardedRef} />\n));\n\nMenuArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getOpenState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nfunction getCheckedState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray<T>(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\n\n/**\n * This is the \"meat\" of the typeahead matching logic. It takes in all the values,\n * the search and the current match, and returns the next match (or `undefined`).\n *\n * We normalize the search because if a user has repeatedly pressed a character,\n * we want the exact same behavior as if we only had that one character\n * (ie. cycle through options starting with that character)\n *\n * We also reorder the values by wrapping the array around the current match.\n * This is so we always look forward from the current match, and picking the first\n * match will always be the correct one.\n *\n * Finally, if the normalized search is exactly one character, we exclude the\n * current match from the values because otherwise it would be the first to match always\n * and focus would never move. This is as opposed to the regular case, where we\n * don't want focus to move if the current match still matches.\n */\nfunction getNextMatch(values: string[], search: string, currentMatch?: string) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0] : search;\n const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;\n let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));\n const excludeCurrentMatch = normalizedSearch.length === 1;\n if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);\n const nextMatch = wrappedValues.find((value) =>\n value.toLowerCase().startsWith(normalizedSearch.toLowerCase())\n );\n return nextMatch !== currentMatch ? nextMatch : undefined;\n}\n\ntype Point = { x: number; y: number };\ntype Polygon = Point[];\ntype Side = 'left' | 'right';\ntype GraceIntent = { area: Polygon; side: Side };\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\nfunction isPointerInGraceArea(event: React.PointerEvent, area?: Polygon) {\n if (!area) return false;\n const cursorPos = { x: event.clientX, y: event.clientY };\n return isPointInPolygon(cursorPos, area);\n}\n\nfunction whenMouse<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType === 'mouse' ? handler(event) : undefined);\n}\n\nconst Root = Menu;\nconst Sub = MenuSub;\nconst Anchor = MenuAnchor;\nconst SubTrigger = MenuSubTrigger;\nconst Content = MenuContent;\nconst Group = MenuGroup;\nconst Label = MenuLabel;\nconst Item = MenuItem;\nconst CheckboxItem = MenuCheckboxItem;\nconst RadioGroup = MenuRadioGroup;\nconst RadioItem = MenuRadioItem;\nconst ItemIndicator = MenuItemIndicator;\nconst Separator = MenuSeparator;\nconst Arrow = MenuArrow;\n\nexport {\n Menu,\n MenuSub,\n MenuAnchor,\n MenuSubTrigger,\n MenuContent,\n MenuGroup,\n MenuLabel,\n MenuItem,\n MenuCheckboxItem,\n MenuRadioGroup,\n MenuRadioItem,\n MenuItemIndicator,\n MenuSeparator,\n MenuArrow,\n //\n Root,\n Sub,\n Anchor,\n SubTrigger,\n Content,\n Group,\n Label,\n Item,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n};\nexport type {\n MenuProps,\n MenuSubProps,\n MenuAnchorProps,\n MenuSubTriggerProps,\n MenuContentProps,\n MenuGroupProps,\n MenuLabelProps,\n MenuItemProps,\n MenuCheckboxItemProps,\n MenuRadioGroupProps,\n MenuRadioItemProps,\n MenuItemIndicatorProps,\n MenuSeparatorProps,\n MenuArrowProps,\n};\n"],"names":["a","__esModule","default","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","SELECTION_KEYS","LAST_KEYS","FIRST_LAST_KEYS","SUB_OPEN_KEYS","ltr","rtl","SUB_CLOSE_KEYS","MenuProvider","useMenuContext","createContext","Menu","props","open","children","onOpenChange","modal","content","setContent","React","useState","isUsingKeyboardRef","useRef","handleOpenChange","useCallbackRef","computedDirection","useDirection","dir","useEffect","handleKeyDown","current","handlePointer","document","addEventListener","capture","removeEventListener","_react","createElement","_radixUiReactPopper","Root","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuProvider","isSubmenu","onContentChange","onRootClose","useCallback","MenuSub","parentMenuContext","trigger","setTrigger","contentId","useId","onTriggerChange","triggerId","MenuAnchor","forwardRef","forwardedRef","Anchor","_babelRuntimeHelpersExtends","ref","CollectionProvider","CollectionSlot","CollectionItemSlot","useCollection","createCollection","MenuContentProvider","useMenuContentContext","MenuContent","forceMount","contentProps","context","$e032a19b6af7c9eb10e1f9f631421ad$var$CollectionProvider","Presence","present","$e032a19b6af7c9eb10e1f9f631421ad$var$CollectionSlot","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuSubContent","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuRootContent","MenuRootContent","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuRootContentModal","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuRootContentNonModal","MenuRootContentModal","composedRefs","useComposedRefs","hideOthers","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuContentImpl","trapFocus","disableOutsidePointerEvents","disableOutsideScroll","onFocusOutside","composeEventHandlers","event","preventDefault","checkForDefaultPrevented","onDismiss","MenuRootContentNonModal","MenuSubContent","id","align","side","portalled","onOpenAutoFocus","_ref$current","focus","onCloseAutoFocus","target","onEscapeKeyDown","onKeyDown","isKeyDownInside","currentTarget","contains","isCloseKey","includes","_context$trigger","MenuContentImpl","loop","onPointerDownOutside","onInteractOutside","getItems","currentItemId","setCurrentItemId","contentRef","timerRef","searchRef","pointerGraceTimerRef","pointerGraceIntentRef","pointerDirRef","lastPointerXRef","PortalWrapper","Portal","Fragment","ScrollLockWrapper","RemoveScroll","handleTypeaheadSearch","_items$find","_items$find2","search","items","filter","item","disabled","currentItem","activeElement","currentMatch","find","textValue","nextMatch","values","normalizedSearch","length","Array","from","every","char","currentMatchIndex","indexOf","wrappedValues","array","startIndex","Math","max","map","_","index","v","value","toLowerCase","startsWith","undefined","getNextMatch","newItem","updateSearch","window","clearTimeout","setTimeout","useFocusGuards","isPointerMovingToSubmenu","_pointerGraceIntentRe","_pointerGraceIntentRe2","area","point","polygon","x","y","inside","i","j","xi","yi","xj","yj","isPointInPolygon","clientX","clientY","isPointerInGraceArea","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuContentProvider","onItemEnter","onItemLeave","_contentRef$current","onTriggerLeave","onPointerGraceIntentChange","intent","FocusScope","asChild","trapped","onMountAutoFocus","_contentRef$current2","onUnmountAutoFocus","DismissableLayer","RovingFocusGroup","orientation","currentTabStopId","onCurrentTabStopIdChange","onEntryFocus","Content","role","getOpenState","style","outline","isModifierKey","ctrlKey","altKey","metaKey","candidateNodes","reverse","candidates","PREVIOUSLY_FOCUSED_ELEMENT","candidate","focusFirst","onBlur","onPointerMove","whenMouse","pointerXHasChanged","newDir","MenuGroup","Primitive","div","MenuLabel","MenuItem","onSelect","itemProps","contentContext","isPointerDownRef","$e032a19b6af7c9eb10e1f9f631421ad$var$MenuItemImpl","onClick","menuItem","itemSelectEvent","Event","bubbles","cancelable","once","dispatchEvent","defaultPrevented","onPointerDown","_props$onPointerDown","call","onPointerUp","_event$currentTarget","click","isTypingAhead","MenuSubTrigger","openTimerRef","clearOpenTimer","pointerGraceTimer","composeRefs","_props$onClick","onPointerLeave","_context$content","contentRect","getBoundingClientRect","_context$content2","dataset","rightSide","bleed","contentNearEdge","contentFarEdge","top","bottom","_context$content3","MenuItemImpl","textContent","setTextContent","_menuItem$textContent","trim","$e032a19b6af7c9eb10e1f9f631421ad$var$CollectionItemSlot","RovingFocusItem","focusable","MenuCheckboxItem","checked","onCheckedChange","checkboxItemProps","$e032a19b6af7c9eb10e1f9f631421ad$var$ItemIndicatorContext","Provider","getCheckedState","RadioGroupContext","MenuRadioGroup","onValueChange","groupProps","handleValueChange","useMemo","$e032a19b6af7c9eb10e1f9f631421ad$var$RadioGroupContext","MenuRadioItem","radioItemProps","useContext","_context$onValueChang","ItemIndicatorContext","MenuItemIndicator","indicatorProps","span","MenuSeparator","MenuArrow","Arrow","handler","pointerType","Sub","SubTrigger","Group","Label","Item","CheckboxItem","RadioGroup","RadioItem","ItemIndicator","Separator"],"version":3,"file":"index.js.map"}
@@ -1,2 +1,2 @@
1
- import{useId as e}from"@radix-ui/react-id";import{useFocusGuards as t}from"@radix-ui/react-focus-guards";import{useCallbackRef as n}from"@radix-ui/react-use-callback-ref";import{useDirection as r}from"@radix-ui/react-use-direction";import{Slot as o}from"@radix-ui/react-slot";import{RovingFocusGroup as u,RovingFocusItem as a}from"@radix-ui/react-roving-focus";import{Portal as c}from"@radix-ui/react-portal";import*as i from"@radix-ui/react-popper";import{Primitive as l,extendPrimitive as s}from"@radix-ui/react-primitive";import{Presence as d}from"@radix-ui/react-presence";import{FocusScope as m}from"@radix-ui/react-focus-scope";import{DismissableLayer as f}from"@radix-ui/react-dismissable-layer";import{createContext as p}from"@radix-ui/react-context";import{useComposedRefs as v,composeRefs as g}from"@radix-ui/react-compose-refs";import{createCollection as h}from"@radix-ui/react-collection";import{composeEventHandlers as x}from"@radix-ui/primitive";import{hideOthers as b}from"aria-hidden";import{RemoveScroll as C}from"react-remove-scroll";import*as E from"react";import w from"@babel/runtime/helpers/esm/extends";const M=["Enter"," "],y=["ArrowUp","PageDown","End"],R=["ArrowDown","PageUp","Home",...y],I={ltr:[...M,"ArrowRight"],rtl:[...M,"ArrowLeft"]},P={ltr:["ArrowLeft"],rtl:["ArrowRight"]},[k,D]=p("Menu");export const Menu=e=>{const{open:t=!1,children:o,onOpenChange:u}=e,[a,c]=E.useState(null),l=E.useRef(!1),s=n(u),d=r(a,e.dir);return E.useEffect((()=>{const e=()=>l.current=!0,t=()=>l.current=!1;return document.addEventListener("keydown",e,{capture:!0}),document.addEventListener("pointerdown",t,{capture:!0}),document.addEventListener("pointermove",t,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}}),[]),/*#__PURE__*/E.createElement(i.Root,null,/*#__PURE__*/E.createElement(k,{isSubmenu:!1,isUsingKeyboardRef:l,dir:d,open:t,onOpenChange:s,content:a,onContentChange:c,onRootClose:E.useCallback((()=>s(!1)),[s])},o))};/*#__PURE__*/export const MenuSub=t=>{const{children:r,open:o=!1,onOpenChange:u}=t,a=D("MenuSub"),[c,l]=E.useState(null),[s,d]=E.useState(null),m=n(u);return E.useEffect((()=>(!1===a.open&&m(!1),()=>m(!1))),[a.open,m]),/*#__PURE__*/E.createElement(i.Root,null,/*#__PURE__*/E.createElement(k,{isSubmenu:!0,isUsingKeyboardRef:a.isUsingKeyboardRef,dir:a.dir,open:o,onOpenChange:m,content:s,onContentChange:d,onRootClose:a.onRootClose,contentId:e(),trigger:c,onTriggerChange:l,triggerId:e()},r))};/*#__PURE__*/const[S,T,O]=h(),[A,L]=p("MenuContent");export const MenuContent=/*#__PURE__*/E.forwardRef(((e,t)=>{const{forceMount:n,...r}=e,o=D("MenuContent");/*#__PURE__*/return E.createElement(d,{present:n||o.open},/*#__PURE__*/E.createElement(S,null,o.isSubmenu?/*#__PURE__*/E.createElement(F,w({},r,{ref:t})):/*#__PURE__*/E.createElement(K,w({},r,{ref:t}))))}));const K=/*#__PURE__*/E.forwardRef(((e,t)=>{const n=D("MenuContent"),r=E.useRef(null),o=v(t,r);return E.useEffect((()=>{const e=r.current;if(e)return b(e)}),[]),/*#__PURE__*/E.createElement(G,w({},e,{ref:o,onDismiss:()=>n.onOpenChange(!1)}))})),F=/*#__PURE__*/E.forwardRef(((e,t)=>{const n=D("MenuContent"),r=E.useRef(null),o=v(t,r);return n.isSubmenu?/*#__PURE__*/E.createElement(G,w({id:n.contentId,"aria-labelledby":n.triggerId},e,{ref:o,align:"start",side:"rtl"===n.dir?"left":"right",portalled:!0,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;n.isUsingKeyboardRef.current&&(null===(t=r.current)||void 0===t||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:x(e.onFocusOutside,(e=>{e.target!==n.trigger&&n.onOpenChange(!1)})),onEscapeKeyDown:x(e.onEscapeKeyDown,n.onRootClose),onKeyDown:x(e.onKeyDown,(e=>{const t=e.currentTarget.contains(e.target),r=P[n.dir].includes(e.key);var o;t&&r&&(n.onOpenChange(!1),null===(o=n.trigger)||void 0===o||o.focus())}))})):null})),G=/*#__PURE__*/E.forwardRef(((e,n)=>{const{loop:r=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:s,disableOutsidePointerEvents:d,onEscapeKeyDown:p,onPointerDownOutside:g,onFocusOutside:h,onInteractOutside:b,onDismiss:M,disableOutsideScroll:I,portalled:P,...k}=e,S=D("MenuContent"),{getItems:T}=O(),[L,K]=E.useState(null),F=E.useRef(null),G=v(n,F,S.onContentChange),U=E.useRef(!1),V=E.useRef(0),N=E.useRef(""),X=E.useRef(0),B=E.useRef(null),z=E.useRef("right"),W=E.useRef(0),j=P?c:E.Fragment,q=I?C:E.Fragment,J=e=>{var t,n;const r=N.current+e,o=T().filter((e=>!e.disabled)),u=document.activeElement,a=null===(t=o.find((e=>e.ref.current===u)))||void 0===t?void 0:t.textValue,c=function(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,o=n?e.indexOf(n):-1;let u=(a=e,c=Math.max(o,0),a.map(((e,t)=>a[(c+t)%a.length])));var a,c;1===r.length&&(u=u.filter((e=>e!==n)));const i=u.find((e=>e.toLowerCase().startsWith(r.toLowerCase())));return i!==n?i:void 0}(o.map((e=>e.textValue)),r,a),i=null===(n=o.find((e=>e.textValue===c)))||void 0===n?void 0:n.ref.current;!function e(t){N.current=t,window.clearTimeout(V.current),""!==t&&(V.current=window.setTimeout((()=>e("")),1e3))}(r),i&&setTimeout((()=>i.focus()))};E.useEffect((()=>()=>window.clearTimeout(V.current)),[]),t();const Q=E.useCallback((e=>{var t,n;return z.current===(null===(t=B.current)||void 0===t?void 0:t.side)&&function(e,t){if(!t)return!1;return function(e,t){const{x:n,y:r}=e;let o=!1;for(let e=0,u=t.length-1;e<t.length;u=e++){const a=t[e].x,c=t[e].y,i=t[u].x,l=t[u].y;c>r!=l>r&&n<(i-a)*(r-c)/(l-c)+a&&(o=!o)}return o}({x:e.clientX,y:e.clientY},t)}(e,null===(n=B.current)||void 0===n?void 0:n.area)}),[]);/*#__PURE__*/return E.createElement(j,null,/*#__PURE__*/E.createElement(q,null,/*#__PURE__*/E.createElement(A,{searchRef:N,onItemEnter:E.useCallback((e=>{Q(e)&&e.preventDefault()}),[Q]),onItemLeave:E.useCallback((e=>{var t;Q(e)||(null===(t=F.current)||void 0===t||t.focus(),K(null))}),[Q]),onTriggerLeave:E.useCallback((e=>{Q(e)&&e.preventDefault()}),[Q]),pointerGraceTimerRef:X,onPointerGraceIntentChange:E.useCallback((e=>{B.current=e}),[])},/*#__PURE__*/E.createElement(m,{as:o,trapped:a&&S.open,onMountAutoFocus:x(l,(e=>{var t;e.preventDefault(),null===(t=F.current)||void 0===t||t.focus()})),onUnmountAutoFocus:e=>{!d&&U.current?e.preventDefault():null==s||s(e)}},/*#__PURE__*/E.createElement(f,{as:o,disableOutsidePointerEvents:d,onEscapeKeyDown:x(p,(()=>{U.current=!1})),onPointerDownOutside:x(g,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!1===t.ctrlKey;U.current=n}),{checkForDefaultPrevented:!1}),onFocusOutside:x(h,(e=>{a&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onInteractOutside:b,onDismiss:M},/*#__PURE__*/E.createElement(u,{as:o,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:K,onEntryFocus:e=>{S.isUsingKeyboardRef.current||e.preventDefault()}},/*#__PURE__*/E.createElement(i.Content,w({role:"menu",dir:S.dir,"data-state":Y(S.open)},k,{ref:G,style:{outline:"none",...k.style},onKeyDown:x(k.onKeyDown,(e=>{const t=e.target,n=e.currentTarget.contains(t),r=e.ctrlKey||e.altKey||e.metaKey;n&&!r&&1===e.key.length&&J(e.key),"Tab"===e.key&&e.preventDefault();const o=F.current;if(e.target!==o)return;if(!R.includes(e.key))return;e.preventDefault();const u=T().filter((e=>!e.disabled)).map((e=>e.ref.current));y.includes(e.key)&&u.reverse(),function(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}(u)})),onBlur:x(e.onBlur,(e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(V.current),N.current="")})),onPointerMove:x(e.onPointerMove,H((e=>{const t=e.target,n=W.current!==e.clientX;if(e.currentTarget.contains(t)&&n){const t=e.clientX>W.current?"right":"left";z.current=t,W.current=e.clientX}})))}))))))))})),U="div";export const MenuItem=/*#__PURE__*/E.forwardRef(((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,u=E.useRef(null),a=D("MenuItem"),c=L("MenuItem"),i=v(t,u),l=()=>{const e=u.current;if(!n&&e){const t=new Event("menu.itemSelect",{bubbles:!0,cancelable:!0});if(e.addEventListener("menu.itemSelect",(e=>null==r?void 0:r(e)),{once:!0}),e.dispatchEvent(t),t.defaultPrevented)return;a.onRootClose()}};/*#__PURE__*/return E.createElement(V,w({},o,{ref:i,disabled:n,onPointerUp:x(e.onPointerUp,l),onKeyDown:x(e.onKeyDown,(e=>{const t=""!==c.searchRef.current;n||t&&" "===e.key||M.includes(e.key)&&(" "===e.key&&e.preventDefault(),l())}))}))}));/*#__PURE__*/export const MenuSubTrigger=/*#__PURE__*/E.forwardRef(((e,t)=>{const n=D("MenuSubTrigger"),r=L("MenuSubTrigger"),u=E.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=r,i=E.useCallback((()=>{u.current&&window.clearTimeout(u.current),u.current=null}),[]);return E.useEffect((()=>i),[i]),E.useEffect((()=>{const e=a.current;return()=>{window.clearTimeout(e),c(null)}}),[a,c]),n.isSubmenu?/*#__PURE__*/E.createElement(MenuAnchor,{as:o},/*#__PURE__*/E.createElement(V,w({id:n.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Y(n.open)},e,{ref:g(t,n.onTriggerChange),onPointerUp:x(e.onPointerUp,(l=t=>{r.onItemEnter(t),t.defaultPrevented||e.disabled||n.open||n.onOpenChange(!0)},e=>"mouse"!==e.pointerType?l(e):void 0)),onPointerMove:x(e.onPointerMove,H((t=>{r.onItemEnter(t),t.defaultPrevented||e.disabled||n.open||u.current||(r.onPointerGraceIntentChange(null),u.current=window.setTimeout((()=>{n.onOpenChange(!0),i()}),100))}))),onPointerLeave:x(e.onPointerLeave,H((e=>{var t;i();const o=null===(t=n.content)||void 0===t?void 0:t.getBoundingClientRect();if(o){var u;const t=null===(u=n.content)||void 0===u?void 0:u.dataset.side,c="right"===t,i=c?-5:5,l=o[c?"left":"right"],s=o[c?"right":"left"];r.onPointerGraceIntentChange({area:[{x:e.clientX+i,y:e.clientY},{x:l,y:o.top},{x:s,y:o.top},{x:s,y:o.bottom},{x:l,y:o.bottom}],side:t}),window.clearTimeout(a.current),a.current=window.setTimeout((()=>r.onPointerGraceIntentChange(null)),300)}else{if(r.onTriggerLeave(e),e.defaultPrevented)return;r.onPointerGraceIntentChange(null)}}))),onKeyDown:x(e.onKeyDown,(t=>{const o=""!==r.searchRef.current;var u;e.disabled||o&&" "===t.key||I[n.dir].includes(t.key)&&(n.onOpenChange(!0),null===(u=n.content)||void 0===u||u.focus())}))}))):null;var l}));/*#__PURE__*/const V=/*#__PURE__*/E.forwardRef(((e,t)=>{const{as:n=U,disabled:r=!1,textValue:o,...u}=e,c=E.useRef(null),i=v(t,c),l=L("MenuItem"),[s,d]=E.useState("");return E.useEffect((()=>{const e=c.current;var t;e&&d((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}),[u.children]),/*#__PURE__*/E.createElement(T,{disabled:r,textValue:null!=o?o:s},/*#__PURE__*/E.createElement(a,w({role:"menuitem","aria-disabled":r||void 0,"data-disabled":r?"":void 0,focusable:!r},u,{as:n,ref:i,onPointerMove:x(e.onPointerMove,H((e=>{if(r)l.onItemLeave(e);else if(l.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus()}}))),onPointerLeave:x(e.onPointerLeave,H((e=>l.onItemLeave(e))))})))}));export const MenuCheckboxItem=/*#__PURE__*/E.forwardRef(((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;/*#__PURE__*/return E.createElement(B.Provider,{value:n},/*#__PURE__*/E.createElement(MenuItem,w({role:"menuitemcheckbox","aria-checked":n},o,{ref:t,"data-state":z(n),onSelect:x(o.onSelect,(()=>null==r?void 0:r(!n)),{checkForDefaultPrevented:!1})})))}));/*#__PURE__*/const N=/*#__PURE__*/E.createContext({});export const MenuRadioGroup=/*#__PURE__*/E.forwardRef(((e,t)=>{const{value:r,onValueChange:o,...u}=e,a=n(o),c=E.useMemo((()=>({value:r,onValueChange:a})),[r,a]);/*#__PURE__*/return E.createElement(N.Provider,{value:c},/*#__PURE__*/E.createElement(MenuGroup,w({},u,{ref:t})))}));/*#__PURE__*/export const MenuRadioItem=/*#__PURE__*/E.forwardRef(((e,t)=>{const{value:n,...r}=e,o=E.useContext(N),u=n===o.value;/*#__PURE__*/return E.createElement(B.Provider,{value:u},/*#__PURE__*/E.createElement(MenuItem,w({role:"menuitemradio","aria-checked":u},r,{ref:t,"data-state":z(u),onSelect:x(r.onSelect,(()=>{var e;return null===(e=o.onValueChange)||void 0===e?void 0:e.call(o,n)}),{checkForDefaultPrevented:!1})})))}));/*#__PURE__*/const X="span",B=/*#__PURE__*/E.createContext(!1);export const MenuItemIndicator=/*#__PURE__*/E.forwardRef(((e,t)=>{const{as:n=X,forceMount:r,...o}=e,u=E.useContext(B);/*#__PURE__*/return E.createElement(d,{present:r||u},/*#__PURE__*/E.createElement(l,w({},o,{as:n,ref:t,"data-state":z(u)})))}));/*#__PURE__*/export const MenuAnchor=s(i.Anchor,{displayName:"MenuAnchor"});export const MenuGroup=s(l,{defaultProps:{role:"group"},displayName:"MenuGroup"});export const MenuLabel=s(l,{displayName:"MenuLabel"});export const MenuSeparator=s(l,{defaultProps:{role:"separator","aria-orientation":"horizontal"},displayName:"MenuSeparator "});export const MenuArrow=s(i.Arrow,{displayName:"MenuArrow"});function Y(e){return e?"open":"closed"}function z(e){return e?"checked":"unchecked"}function H(e){return t=>"mouse"===t.pointerType?e(t):void 0}export const Root=Menu;export const Sub=MenuSub;export const Anchor=MenuAnchor;export const SubTrigger=MenuSubTrigger;export const Content=MenuContent;export const Group=MenuGroup;export const Label=MenuLabel;export const Item=MenuItem;export const CheckboxItem=MenuCheckboxItem;export const RadioGroup=MenuRadioGroup;export const RadioItem=MenuRadioItem;export const ItemIndicator=MenuItemIndicator;export const Separator=MenuSeparator;export const Arrow=MenuArrow;
1
+ import{useId as e}from"@radix-ui/react-id";import{useFocusGuards as t}from"@radix-ui/react-focus-guards";import{useCallbackRef as n}from"@radix-ui/react-use-callback-ref";import{useDirection as r}from"@radix-ui/react-use-direction";import{RovingFocusGroup as o,RovingFocusItem as u}from"@radix-ui/react-roving-focus";import{Portal as a}from"@radix-ui/react-portal";import*as c from"@radix-ui/react-popper";import{Primitive as i}from"@radix-ui/react-primitive";import{Presence as l}from"@radix-ui/react-presence";import{FocusScope as s}from"@radix-ui/react-focus-scope";import{DismissableLayer as d}from"@radix-ui/react-dismissable-layer";import{createContext as f}from"@radix-ui/react-context";import{useComposedRefs as m,composeRefs as p}from"@radix-ui/react-compose-refs";import{createCollection as v}from"@radix-ui/react-collection";import{composeEventHandlers as g}from"@radix-ui/primitive";import{hideOthers as h}from"aria-hidden";import{RemoveScroll as C}from"react-remove-scroll";import*as E from"react";import w from"@babel/runtime/helpers/esm/extends";const x=["Enter"," "],b=["ArrowUp","PageDown","End"],R=["ArrowDown","PageUp","Home",...b],M={ltr:[...x,"ArrowRight"],rtl:[...x,"ArrowLeft"]},y={ltr:["ArrowLeft"],rtl:["ArrowRight"]},[I,P]=f("Menu");export const Menu=e=>{const{open:t=!1,children:o,onOpenChange:u,modal:a=!0}=e,[i,l]=E.useState(null),s=E.useRef(!1),d=n(u),f=r(i,e.dir);return E.useEffect((()=>{const e=()=>s.current=!0,t=()=>s.current=!1;return document.addEventListener("keydown",e,{capture:!0}),document.addEventListener("pointerdown",t,{capture:!0}),document.addEventListener("pointermove",t,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}}),[]),/*#__PURE__*/E.createElement(c.Root,null,/*#__PURE__*/E.createElement(I,{isSubmenu:!1,isUsingKeyboardRef:s,dir:f,open:t,onOpenChange:d,content:i,onContentChange:l,onRootClose:E.useCallback((()=>d(!1)),[d]),modal:a},o))};/*#__PURE__*/export const MenuSub=t=>{const{children:r,open:o=!1,onOpenChange:u}=t,a=P("MenuSub"),[i,l]=E.useState(null),[s,d]=E.useState(null),f=n(u);return E.useEffect((()=>(!1===a.open&&f(!1),()=>f(!1))),[a.open,f]),/*#__PURE__*/E.createElement(c.Root,null,/*#__PURE__*/E.createElement(I,{isSubmenu:!0,isUsingKeyboardRef:a.isUsingKeyboardRef,dir:a.dir,open:o,onOpenChange:f,content:s,onContentChange:d,onRootClose:a.onRootClose,contentId:e(),trigger:i,onTriggerChange:l,triggerId:e(),modal:!1},r))};/*#__PURE__*/export const MenuAnchor=/*#__PURE__*/E.forwardRef(((e,t)=>/*#__PURE__*/E.createElement(c.Anchor,w({},e,{ref:t}))));/*#__PURE__*/const[k,D,S,O]=v(),[T,L]=f("MenuContent");export const MenuContent=/*#__PURE__*/E.forwardRef(((e,t)=>{const{forceMount:n,...r}=e,o=P("MenuContent");/*#__PURE__*/return E.createElement(k,null,/*#__PURE__*/E.createElement(l,{present:n||o.open},/*#__PURE__*/E.createElement(D,null,o.isSubmenu?/*#__PURE__*/E.createElement(G,w({},r,{ref:t})):/*#__PURE__*/E.createElement(A,w({},r,{ref:t})))))}));const A=/*#__PURE__*/E.forwardRef(((e,t)=>P("MenuContent").modal?/*#__PURE__*/E.createElement(F,w({},e,{ref:t})):/*#__PURE__*/E.createElement(K,w({},e,{ref:t})))),F=/*#__PURE__*/E.forwardRef(((e,t)=>{const n=P("MenuContent"),r=E.useRef(null),o=m(t,r);return E.useEffect((()=>{const e=r.current;if(e)return h(e)}),[]),/*#__PURE__*/E.createElement(U,w({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:g(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))})),K=/*#__PURE__*/E.forwardRef(((e,t)=>{const n=P("MenuContent");/*#__PURE__*/return E.createElement(U,w({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))})),G=/*#__PURE__*/E.forwardRef(((e,t)=>{const n=P("MenuContent"),r=E.useRef(null),o=m(t,r);return n.isSubmenu?/*#__PURE__*/E.createElement(U,w({id:n.contentId,"aria-labelledby":n.triggerId},e,{ref:o,align:"start",side:"rtl"===n.dir?"left":"right",portalled:!0,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{var t;n.isUsingKeyboardRef.current&&(null===(t=r.current)||void 0===t||t.focus()),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:g(e.onFocusOutside,(e=>{e.target!==n.trigger&&n.onOpenChange(!1)})),onEscapeKeyDown:g(e.onEscapeKeyDown,n.onRootClose),onKeyDown:g(e.onKeyDown,(e=>{const t=e.currentTarget.contains(e.target),r=y[n.dir].includes(e.key);var o;t&&r&&(n.onOpenChange(!1),null===(o=n.trigger)||void 0===o||o.focus())}))})):null})),U=/*#__PURE__*/E.forwardRef(((e,n)=>{const{loop:r=!1,trapFocus:u,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:f,onEscapeKeyDown:p,onPointerDownOutside:v,onFocusOutside:h,onInteractOutside:x,onDismiss:M,disableOutsideScroll:y,portalled:I,...k}=e,D=P("MenuContent"),{getItems:S}=O(),[L,A]=E.useState(null),F=E.useRef(null),K=m(n,F,D.onContentChange),G=E.useRef(0),U=E.useRef(""),V=E.useRef(0),X=E.useRef(null),B=E.useRef("right"),z=E.useRef(0),W=I?a:E.Fragment,j=y?C:E.Fragment,q=e=>{var t,n;const r=U.current+e,o=S().filter((e=>!e.disabled)),u=document.activeElement,a=null===(t=o.find((e=>e.ref.current===u)))||void 0===t?void 0:t.textValue,c=function(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,o=n?e.indexOf(n):-1;let u=(a=e,c=Math.max(o,0),a.map(((e,t)=>a[(c+t)%a.length])));var a,c;1===r.length&&(u=u.filter((e=>e!==n)));const i=u.find((e=>e.toLowerCase().startsWith(r.toLowerCase())));return i!==n?i:void 0}(o.map((e=>e.textValue)),r,a),i=null===(n=o.find((e=>e.textValue===c)))||void 0===n?void 0:n.ref.current;!function e(t){U.current=t,window.clearTimeout(G.current),""!==t&&(G.current=window.setTimeout((()=>e("")),1e3))}(r),i&&setTimeout((()=>i.focus()))};E.useEffect((()=>()=>window.clearTimeout(G.current)),[]),t();const J=E.useCallback((e=>{var t,n;return B.current===(null===(t=X.current)||void 0===t?void 0:t.side)&&function(e,t){if(!t)return!1;return function(e,t){const{x:n,y:r}=e;let o=!1;for(let e=0,u=t.length-1;e<t.length;u=e++){const a=t[e].x,c=t[e].y,i=t[u].x,l=t[u].y;c>r!=l>r&&n<(i-a)*(r-c)/(l-c)+a&&(o=!o)}return o}({x:e.clientX,y:e.clientY},t)}(e,null===(n=X.current)||void 0===n?void 0:n.area)}),[]);/*#__PURE__*/return E.createElement(W,null,/*#__PURE__*/E.createElement(j,null,/*#__PURE__*/E.createElement(T,{searchRef:U,onItemEnter:E.useCallback((e=>{J(e)&&e.preventDefault()}),[J]),onItemLeave:E.useCallback((e=>{var t;J(e)||(null===(t=F.current)||void 0===t||t.focus(),A(null))}),[J]),onTriggerLeave:E.useCallback((e=>{J(e)&&e.preventDefault()}),[J]),pointerGraceTimerRef:V,onPointerGraceIntentChange:E.useCallback((e=>{X.current=e}),[])},/*#__PURE__*/E.createElement(s,{asChild:!0,trapped:u,onMountAutoFocus:g(i,(e=>{var t;e.preventDefault(),null===(t=F.current)||void 0===t||t.focus()})),onUnmountAutoFocus:l},/*#__PURE__*/E.createElement(d,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:p,onPointerDownOutside:v,onFocusOutside:h,onInteractOutside:x,onDismiss:M},/*#__PURE__*/E.createElement(o,{asChild:!0,dir:D.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:A,onEntryFocus:e=>{D.isUsingKeyboardRef.current||e.preventDefault()}},/*#__PURE__*/E.createElement(c.Content,w({role:"menu",dir:D.dir,"data-state":Y(D.open)},k,{ref:K,style:{outline:"none",...k.style},onKeyDown:g(k.onKeyDown,(e=>{const t=e.target,n=e.currentTarget.contains(t),r=e.ctrlKey||e.altKey||e.metaKey;n&&!r&&1===e.key.length&&q(e.key),"Tab"===e.key&&e.preventDefault();const o=F.current;if(e.target!==o)return;if(!R.includes(e.key))return;e.preventDefault();const u=S().filter((e=>!e.disabled)).map((e=>e.ref.current));b.includes(e.key)&&u.reverse(),function(e){const t=document.activeElement;for(const n of e){if(n===t)return;if(n.focus(),document.activeElement!==t)return}}(u)})),onBlur:g(e.onBlur,(e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(G.current),U.current="")})),onPointerMove:g(e.onPointerMove,H((e=>{const t=e.target,n=z.current!==e.clientX;if(e.currentTarget.contains(t)&&n){const t=e.clientX>z.current?"right":"left";B.current=t,z.current=e.clientX}})))}))))))))}));export const MenuGroup=/*#__PURE__*/E.forwardRef(((e,t)=>/*#__PURE__*/E.createElement(i.div,w({role:"group"},e,{ref:t}))));/*#__PURE__*/export const MenuLabel=/*#__PURE__*/E.forwardRef(((e,t)=>/*#__PURE__*/E.createElement(i.div,w({},e,{ref:t}))));/*#__PURE__*/export const MenuItem=/*#__PURE__*/E.forwardRef(((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,u=E.useRef(null),a=P("MenuItem"),c=L("MenuItem"),i=m(t,u),l=E.useRef(!1);/*#__PURE__*/return E.createElement(V,w({},o,{ref:i,disabled:n,onClick:g(e.onClick,(()=>{const e=u.current;if(!n&&e){const t=new Event("menu.itemSelect",{bubbles:!0,cancelable:!0});e.addEventListener("menu.itemSelect",(e=>null==r?void 0:r(e)),{once:!0}),e.dispatchEvent(t),t.defaultPrevented?l.current=!1:a.onRootClose()}})),onPointerDown:t=>{var n;null===(n=e.onPointerDown)||void 0===n||n.call(e,t),l.current=!0},onPointerUp:g(e.onPointerUp,(e=>{var t;l.current||null===(t=e.currentTarget)||void 0===t||t.click()})),onKeyDown:g(e.onKeyDown,(e=>{const t=""!==c.searchRef.current;n||t&&" "===e.key||x.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())}))}))}));/*#__PURE__*/export const MenuSubTrigger=/*#__PURE__*/E.forwardRef(((e,t)=>{const n=P("MenuSubTrigger"),r=L("MenuSubTrigger"),o=E.useRef(null),{pointerGraceTimerRef:u,onPointerGraceIntentChange:a}=r,c=E.useCallback((()=>{o.current&&window.clearTimeout(o.current),o.current=null}),[]);return E.useEffect((()=>c),[c]),E.useEffect((()=>{const e=u.current;return()=>{window.clearTimeout(e),a(null)}}),[u,a]),n.isSubmenu?/*#__PURE__*/E.createElement(MenuAnchor,{asChild:!0},/*#__PURE__*/E.createElement(V,w({id:n.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Y(n.open)},e,{ref:p(t,n.onTriggerChange),onClick:t=>{var r;null===(r=e.onClick)||void 0===r||r.call(e,t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:g(e.onPointerMove,H((t=>{r.onItemEnter(t),t.defaultPrevented||e.disabled||n.open||o.current||(r.onPointerGraceIntentChange(null),o.current=window.setTimeout((()=>{n.onOpenChange(!0),c()}),100))}))),onPointerLeave:g(e.onPointerLeave,H((e=>{var t;c();const o=null===(t=n.content)||void 0===t?void 0:t.getBoundingClientRect();if(o){var a;const t=null===(a=n.content)||void 0===a?void 0:a.dataset.side,c="right"===t,i=c?-5:5,l=o[c?"left":"right"],s=o[c?"right":"left"];r.onPointerGraceIntentChange({area:[{x:e.clientX+i,y:e.clientY},{x:l,y:o.top},{x:s,y:o.top},{x:s,y:o.bottom},{x:l,y:o.bottom}],side:t}),window.clearTimeout(u.current),u.current=window.setTimeout((()=>r.onPointerGraceIntentChange(null)),300)}else{if(r.onTriggerLeave(e),e.defaultPrevented)return;r.onPointerGraceIntentChange(null)}}))),onKeyDown:g(e.onKeyDown,(t=>{const o=""!==r.searchRef.current;var u;e.disabled||o&&" "===t.key||M[n.dir].includes(t.key)&&(n.onOpenChange(!0),null===(u=n.content)||void 0===u||u.focus())}))}))):null}));/*#__PURE__*/const V=/*#__PURE__*/E.forwardRef(((e,t)=>{const{disabled:n=!1,textValue:r,...o}=e,a=E.useRef(null),c=m(t,a),l=L("MenuItem"),[s,d]=E.useState("");return E.useEffect((()=>{const e=a.current;var t;e&&d((null!==(t=e.textContent)&&void 0!==t?t:"").trim())}),[o.children]),/*#__PURE__*/E.createElement(S,{disabled:n,textValue:null!=r?r:s},/*#__PURE__*/E.createElement(u,{asChild:!0,focusable:!n},/*#__PURE__*/E.createElement(i.div,w({role:"menuitem","aria-disabled":n||void 0,"data-disabled":n?"":void 0},o,{ref:c,onPointerMove:g(e.onPointerMove,H((e=>{if(n)l.onItemLeave(e);else if(l.onItemEnter(e),!e.defaultPrevented){e.currentTarget.focus()}}))),onPointerLeave:g(e.onPointerLeave,H((e=>l.onItemLeave(e))))}))))}));export const MenuCheckboxItem=/*#__PURE__*/E.forwardRef(((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;/*#__PURE__*/return E.createElement(B.Provider,{value:n},/*#__PURE__*/E.createElement(MenuItem,w({role:"menuitemcheckbox","aria-checked":n},o,{ref:t,"data-state":z(n),onSelect:g(o.onSelect,(()=>null==r?void 0:r(!n)),{checkForDefaultPrevented:!1})})))}));/*#__PURE__*/const X=/*#__PURE__*/E.createContext({});export const MenuRadioGroup=/*#__PURE__*/E.forwardRef(((e,t)=>{const{value:r,onValueChange:o,...u}=e,a=n(o),c=E.useMemo((()=>({value:r,onValueChange:a})),[r,a]);/*#__PURE__*/return E.createElement(X.Provider,{value:c},/*#__PURE__*/E.createElement(MenuGroup,w({},u,{ref:t})))}));/*#__PURE__*/export const MenuRadioItem=/*#__PURE__*/E.forwardRef(((e,t)=>{const{value:n,...r}=e,o=E.useContext(X),u=n===o.value;/*#__PURE__*/return E.createElement(B.Provider,{value:u},/*#__PURE__*/E.createElement(MenuItem,w({role:"menuitemradio","aria-checked":u},r,{ref:t,"data-state":z(u),onSelect:g(r.onSelect,(()=>{var e;return null===(e=o.onValueChange)||void 0===e?void 0:e.call(o,n)}),{checkForDefaultPrevented:!1})})))}));/*#__PURE__*/const B=/*#__PURE__*/E.createContext(!1);export const MenuItemIndicator=/*#__PURE__*/E.forwardRef(((e,t)=>{const{forceMount:n,...r}=e,o=E.useContext(B);/*#__PURE__*/return E.createElement(l,{present:n||o},/*#__PURE__*/E.createElement(i.span,w({},r,{ref:t,"data-state":z(o)})))}));/*#__PURE__*/export const MenuSeparator=/*#__PURE__*/E.forwardRef(((e,t)=>/*#__PURE__*/E.createElement(i.div,w({role:"separator","aria-orientation":"horizontal"},e,{ref:t}))));/*#__PURE__*/export const MenuArrow=/*#__PURE__*/E.forwardRef(((e,t)=>/*#__PURE__*/E.createElement(c.Arrow,w({},e,{ref:t}))));/*#__PURE__*/function Y(e){return e?"open":"closed"}function z(e){return e?"checked":"unchecked"}function H(e){return t=>"mouse"===t.pointerType?e(t):void 0}export const Root=Menu;export const Sub=MenuSub;export const Anchor=MenuAnchor;export const SubTrigger=MenuSubTrigger;export const Content=MenuContent;export const Group=MenuGroup;export const Label=MenuLabel;export const Item=MenuItem;export const CheckboxItem=MenuCheckboxItem;export const RadioGroup=MenuRadioGroup;export const RadioItem=MenuRadioItem;export const ItemIndicator=MenuItemIndicator;export const Separator=MenuSeparator;export const Arrow=MenuArrow;
2
2
  //# sourceMappingURL=index.module.js.map
@@ -1 +1 @@
1
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,EAAPnP,WAAmCA,KAAesP,GAAmBvS,EACrEgR,EAAU1Q,EAAM2R,WAAWI,gBACjC,OACE9Q,EAAAC,cAAC4B,EAAD,CAAUC,QAASJ,GAAc+N,gBAC/BzP,EAAAC,cAACgR,EAADhP,EAAA,GACM+O,EADN,CAEEjH,GAAIA,EACJ7H,IAAKT,EACL0J,aAAY4E,EAAgBN,8BAUpC,MAAM/B,WAAawD,EAAgBC,EAAgBC,OAAQ,CAAEC,YAAa,sBAC1E,MAAMd,UAAYW,EAAgBD,EAAW,CAC3CK,aAAc,CAAEpG,KAAM,SACtBmG,YAAa,qBAEf,MAAME,UAAYL,EAAgBD,EAAW,CAAEI,YAAa,qBAC5D,MAAMG,cAAgBN,EAAgBD,EAAW,CAC/CK,aAAc,CAAEpG,KAAM,YAAauG,mBAAoB,cACvDJ,YAAa,0BAEf,MAAMK,UAAYR,EAAgBC,EAAgBQ,MAAO,CAAEN,YAAa,cAIxE,SAASjG,EAAa1M,GACpB,OAAOA,EAAO,OAAS,SAGzB,SAASqR,EAAgBN,GACvB,OAAOA,EAAU,UAAY,YAiF/B,SAASvD,EAAa6B,GACpB,OAAQ3K,GAAiC,UAAtBA,EAAM4K,YAA0BD,EAAQ3K,QAASwE,SAOtE,MAAMzH,KAAO3B,YACb,MAAMoT,IAAMnR,eACZ,MAAM2Q,OAAS1D,kBACf,MAAMmE,WAAavE,sBACnB,MAAMrC,QAAU1J,mBAChB,MAAMuQ,MAAQvB,iBACd,MAAMwB,MAAQR,iBACd,MAAMS,KAAO1F,gBACb,MAAM2F,aAAezC,wBACrB,MAAM0C,WAAajC,sBACnB,MAAMkC,UAAY3B,qBAClB,MAAM4B,cAAgBrB,yBACtB,MAAMsB,UAAYb,qBAClB,MAAMG,MAAQD","sources":["./packages/react/menu/src/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs, composeRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive, extendPrimitive } from '@radix-ui/react-primitive';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { Portal } from '@radix-ui/react-portal';\nimport { RovingFocusGroup, RovingFocusItem } from '@radix-ui/react-roving-focus';\nimport { Slot } from '@radix-ui/react-slot';\nimport { useDirection } from '@radix-ui/react-use-direction';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { useId } from '@radix-ui/react-id';\n\nimport type * as Polymorphic from '@radix-ui/react-polymorphic';\n\ntype Direction = 'ltr' | 'rtl';\n\nconst SELECTION_KEYS = ['Enter', ' '];\nconst FIRST_KEYS = ['ArrowDown', 'PageUp', 'Home'];\nconst LAST_KEYS = ['ArrowUp', 'PageDown', 'End'];\nconst FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];\nconst SUB_OPEN_KEYS: Record<Direction, string[]> = {\n ltr: [...SELECTION_KEYS, 'ArrowRight'],\n rtl: [...SELECTION_KEYS, 'ArrowLeft'],\n};\nconst SUB_CLOSE_KEYS: Record<Direction, string[]> = {\n ltr: ['ArrowLeft'],\n rtl: ['ArrowRight'],\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Menu\n * -----------------------------------------------------------------------------------------------*/\n\nconst MENU_NAME = 'Menu';\n\ntype MenuRootContextValue = {\n isSubmenu: false;\n isUsingKeyboardRef: React.RefObject<boolean>;\n dir: Direction;\n open: boolean;\n onOpenChange(open: boolean): void;\n content: MenuContentElement | null;\n onContentChange(content: MenuContentElement | null): void;\n onRootClose(): void;\n};\n\ntype MenuSubContextValue = Omit<MenuRootContextValue, 'isSubmenu'> & {\n isSubmenu: true;\n contentId: string;\n triggerId: string;\n trigger: MenuSubTriggerElement | null;\n onTriggerChange(trigger: MenuSubTriggerElement | null): void;\n};\n\nconst [MenuProvider, useMenuContext] = createContext<MenuRootContextValue | MenuSubContextValue>(\n MENU_NAME\n);\n\ntype MenuOwnProps = {\n open?: boolean;\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n};\n\nconst Menu: React.FC<MenuOwnProps> = (props) => {\n const { open = false, children, onOpenChange } = props;\n const [content, setContent] = React.useState<MenuContentElement | null>(null);\n const isUsingKeyboardRef = React.useRef(false);\n const handleOpenChange = useCallbackRef(onOpenChange);\n const computedDirection = useDirection(content, props.dir);\n\n React.useEffect(() => {\n const handleKeyDown = () => (isUsingKeyboardRef.current = true);\n const handlePointer = () => (isUsingKeyboardRef.current = false);\n // Capture phase ensures we set the boolean before any side effects execute\n // in response to the key or pointer event as they might depend on this value.\n document.addEventListener('keydown', handleKeyDown, { capture: true });\n document.addEventListener('pointerdown', handlePointer, { capture: true });\n document.addEventListener('pointermove', handlePointer, { capture: true });\n return () => {\n document.removeEventListener('keydown', handleKeyDown, { capture: true });\n document.removeEventListener('pointerdown', handlePointer, { capture: true });\n document.removeEventListener('pointermove', handlePointer, { capture: true });\n };\n }, []);\n\n return (\n <PopperPrimitive.Root>\n <MenuProvider\n isSubmenu={false}\n isUsingKeyboardRef={isUsingKeyboardRef}\n dir={computedDirection}\n open={open}\n onOpenChange={handleOpenChange}\n content={content}\n onContentChange={setContent}\n onRootClose={React.useCallback(() => handleOpenChange(false), [handleOpenChange])}\n >\n {children}\n </MenuProvider>\n </PopperPrimitive.Root>\n );\n};\n\nMenu.displayName = MENU_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst SUB_NAME = 'MenuSub';\n\ntype MenuSubOwnProps = {\n open?: boolean;\n onOpenChange?(open: boolean): void;\n};\n\nconst MenuSub: React.FC<MenuSubOwnProps> = (props) => {\n const { children, open = false, onOpenChange } = props;\n const parentMenuContext = useMenuContext(SUB_NAME);\n const [trigger, setTrigger] = React.useState<MenuSubTriggerElement | null>(null);\n const [content, setContent] = React.useState<MenuContentElement | null>(null);\n const handleOpenChange = useCallbackRef(onOpenChange);\n\n // Prevent the parent menu from reopening with open submenus.\n React.useEffect(() => {\n if (parentMenuContext.open === false) handleOpenChange(false);\n return () => handleOpenChange(false);\n }, [parentMenuContext.open, handleOpenChange]);\n\n return (\n <PopperPrimitive.Root>\n <MenuProvider\n isSubmenu={true}\n isUsingKeyboardRef={parentMenuContext.isUsingKeyboardRef}\n dir={parentMenuContext.dir}\n open={open}\n onOpenChange={handleOpenChange}\n content={content}\n onContentChange={setContent}\n onRootClose={parentMenuContext.onRootClose}\n contentId={useId()}\n trigger={trigger}\n onTriggerChange={setTrigger}\n triggerId={useId()}\n >\n {children}\n </MenuProvider>\n </PopperPrimitive.Root>\n );\n};\n\nMenuSub.displayName = SUB_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'MenuContent';\n\ntype MenuContentElement = React.ElementRef<typeof MenuContent>;\ntype ItemData = { disabled: boolean; textValue: string };\n\nconst [CollectionSlot, CollectionItemSlot, useCollection] = createCollection<\n React.ElementRef<typeof MenuItem>,\n ItemData\n>();\n\ntype MenuContentContextValue = {\n onItemEnter(event: React.PointerEvent): void;\n onItemLeave(event: React.PointerEvent): void;\n onTriggerLeave(event: React.PointerEvent): void;\n searchRef: React.RefObject<string>;\n pointerGraceTimerRef: React.MutableRefObject<number>;\n onPointerGraceIntentChange(intent: GraceIntent | null): void;\n};\nconst [MenuContentProvider, useMenuContentContext] = createContext<MenuContentContextValue>(\n CONTENT_NAME\n);\n\n/**\n * We purposefully don't union MenuRootContent and MenuSubContent props here because\n * they have conflicting prop types. We agreed that we would allow MenuSubContent to\n * accept props that it would just ignore.\n */\ntype MenuContentOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof MenuRootContent>,\n {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n }\n>;\n\ntype MenuContentPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuRootContent>,\n MenuContentOwnProps\n>;\n\nconst MenuContent = React.forwardRef((props, forwardedRef) => {\n const { forceMount, ...contentProps } = props;\n const context = useMenuContext(CONTENT_NAME);\n return (\n <Presence present={forceMount || context.open}>\n <CollectionSlot>\n {context.isSubmenu ? (\n <MenuSubContent {...contentProps} ref={forwardedRef} />\n ) : (\n <MenuRootContent {...contentProps} ref={forwardedRef} />\n )}\n </CollectionSlot>\n </Presence>\n );\n}) as MenuContentPrimitive;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuRootContentOwnProps = Omit<\n Polymorphic.OwnProps<typeof MenuContentImpl>,\n keyof MenuContentImplPrivateProps\n>;\ntype MenuRootContentPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuContentImpl>,\n MenuRootContentOwnProps\n>;\n\nconst MenuRootContent = React.forwardRef((props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n const ref = React.useRef<React.ElementRef<typeof MenuContentImpl>>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n // Hide everything from ARIA except the `MenuContent`\n React.useEffect(() => {\n const content = ref.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <MenuContentImpl {...props} ref={composedRefs} onDismiss={() => context.onOpenChange(false)} />\n );\n}) as MenuRootContentPrimitive;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuSubContentOwnProps = Omit<\n Polymorphic.OwnProps<typeof MenuContentImpl>,\n | keyof MenuContentImplPrivateProps\n | 'align'\n | 'side'\n | 'portalled'\n | 'disabledOutsidePointerEvents'\n | 'disableOutsideScroll'\n | 'trapFocus'\n | 'onCloseAutoFocus'\n>;\n\ntype MenuSubContentPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuContentImpl>,\n MenuSubContentOwnProps\n>;\n\nconst MenuSubContent = React.forwardRef((props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n const ref = React.useRef<MenuContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n return context.isSubmenu ? (\n <MenuContentImpl\n id={context.contentId}\n aria-labelledby={context.triggerId}\n {...props}\n ref={composedRefs}\n align=\"start\"\n side={context.dir === 'rtl' ? 'left' : 'right'}\n portalled\n disableOutsidePointerEvents={false}\n disableOutsideScroll={false}\n trapFocus={false}\n onOpenAutoFocus={(event) => {\n // when opening a submenu, focus content for keyboard users only\n if (context.isUsingKeyboardRef.current) ref.current?.focus();\n event.preventDefault();\n }}\n // The menu might close because of focusing another menu item in the parent menu. We\n // don't want it to refocus the trigger in that case so we handle trigger focus ourselves.\n onCloseAutoFocus={(event) => event.preventDefault()}\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) => {\n // We prevent closing when the trigger is focused to avoid triggering a re-open animation\n // on pointer interaction.\n if (event.target !== context.trigger) context.onOpenChange(false);\n })}\n onEscapeKeyDown={composeEventHandlers(props.onEscapeKeyDown, context.onRootClose)}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Submenu key events bubble through portals. We only care about keys in this menu.\n const isKeyDownInside = event.currentTarget.contains(event.target as HTMLElement);\n const isCloseKey = SUB_CLOSE_KEYS[context.dir].includes(event.key);\n if (isKeyDownInside && isCloseKey) {\n context.onOpenChange(false);\n // We focus manually because we prevented it in `onCloseAutoFocus`\n context.trigger?.focus();\n }\n })}\n />\n ) : null;\n}) as MenuSubContentPrimitive;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype FocusScopeOwnProps = Polymorphic.OwnProps<typeof FocusScope>;\ntype DismissableLayerOwnProps = Polymorphic.OwnProps<typeof DismissableLayer>;\ntype RovingFocusGroupOwnProps = Polymorphic.OwnProps<typeof RovingFocusGroup>;\n\ntype MenuContentImplPrivateProps = {\n onOpenAutoFocus?: FocusScopeOwnProps['onMountAutoFocus'];\n onDismiss?: DismissableLayerOwnProps['onDismiss'];\n};\n\ntype MenuContentImplOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof PopperPrimitive.Content>,\n Omit<DismissableLayerOwnProps, 'onDismiss'> &\n MenuContentImplPrivateProps & {\n /**\n * Whether focus should be trapped within the `MenuContent`\n * (default: false)\n */\n trapFocus?: FocusScopeOwnProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeOwnProps['onUnmountAutoFocus'];\n\n /**\n * Whether scrolling outside the `MenuContent` should be prevented\n * (default: `false`)\n */\n disableOutsideScroll?: boolean;\n\n /**\n * The direction of navigation between menu items.\n * @defaultValue ltr\n */\n dir?: RovingFocusGroupOwnProps['dir'];\n\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: RovingFocusGroupOwnProps['loop'];\n\n /**\n * Whether the `MenuContent` should render in a `Portal`\n * (default: `true`)\n */\n portalled?: boolean;\n }\n>;\n\ntype MenuContentImplPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof PopperPrimitive.Content>,\n MenuContentImplOwnProps\n>;\n\nconst MenuContentImpl = React.forwardRef((props, forwardedRef) => {\n const {\n loop = false,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n disableOutsideScroll,\n portalled,\n ...contentProps\n } = props;\n const context = useMenuContext(CONTENT_NAME);\n const { getItems } = useCollection();\n const [currentItemId, setCurrentItemId] = React.useState<string | null>(null);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef, context.onContentChange);\n const isPointerDownOutsideRef = React.useRef(false);\n const timerRef = React.useRef(0);\n const searchRef = React.useRef('');\n const pointerGraceTimerRef = React.useRef(0);\n const pointerGraceIntentRef = React.useRef<GraceIntent | null>(null);\n const pointerDirRef = React.useRef<Side>('right');\n const lastPointerXRef = React.useRef(0);\n\n const PortalWrapper = portalled ? Portal : React.Fragment;\n const ScrollLockWrapper = disableOutsideScroll ? RemoveScroll : React.Fragment;\n\n const handleTypeaheadSearch = (key: string) => {\n const search = searchRef.current + key;\n const items = getItems().filter((item) => !item.disabled);\n const currentItem = document.activeElement;\n const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;\n const values = items.map((item) => item.textValue);\n const nextMatch = getNextMatch(values, search, currentMatch);\n const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;\n\n // Reset `searchRef` 1 second after it was last updated\n (function updateSearch(value: string) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n if (value !== '') timerRef.current = window.setTimeout(() => updateSearch(''), 1000);\n })(search);\n\n if (newItem) {\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => (newItem as HTMLElement).focus());\n }\n };\n\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n\n // Make sure the whole tree has focus guards as our `MenuContent` may be\n // the last element in the DOM (beacuse of the `Portal`)\n useFocusGuards();\n\n const isPointerMovingToSubmenu = React.useCallback((event: React.PointerEvent) => {\n const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;\n return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);\n }, []);\n\n return (\n <PortalWrapper>\n <ScrollLockWrapper>\n <MenuContentProvider\n searchRef={searchRef}\n onItemEnter={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n )}\n onItemLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) return;\n contentRef.current?.focus();\n setCurrentItemId(null);\n },\n [isPointerMovingToSubmenu]\n )}\n onTriggerLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n )}\n pointerGraceTimerRef={pointerGraceTimerRef}\n onPointerGraceIntentChange={React.useCallback((intent) => {\n pointerGraceIntentRef.current = intent;\n }, [])}\n >\n <FocusScope\n as={Slot}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapped={trapFocus && context.open}\n onMountAutoFocus={composeEventHandlers(onOpenAutoFocus, (event) => {\n // when opening, explicitly focus the content area only and leave\n // `onEntryFocus` in control of focusing first item\n event.preventDefault();\n contentRef.current?.focus();\n })}\n onUnmountAutoFocus={(event) => {\n // skip autofocus on unmount if clicking outside is permitted and it happened\n if (!disableOutsidePointerEvents && isPointerDownOutsideRef.current) {\n event.preventDefault();\n } else {\n onCloseAutoFocus?.(event);\n }\n }}\n >\n <DismissableLayer\n as={Slot}\n disableOutsidePointerEvents={disableOutsidePointerEvents}\n onEscapeKeyDown={composeEventHandlers(onEscapeKeyDown, () => {\n isPointerDownOutsideRef.current = false;\n })}\n onPointerDownOutside={composeEventHandlers(\n onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent as MouseEvent;\n const isLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === false;\n isPointerDownOutsideRef.current = isLeftClick;\n },\n { checkForDefaultPrevented: false }\n )}\n onFocusOutside={composeEventHandlers(\n onFocusOutside,\n (event) => {\n // When focus is trapped, a focusout event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n if (trapFocus) event.preventDefault();\n },\n { checkForDefaultPrevented: false }\n )}\n onInteractOutside={onInteractOutside}\n onDismiss={onDismiss}\n >\n <RovingFocusGroup\n as={Slot}\n dir={context.dir}\n orientation=\"vertical\"\n loop={loop}\n currentTabStopId={currentItemId}\n onCurrentTabStopIdChange={setCurrentItemId}\n onEntryFocus={(event) => {\n // only focus first item when using keyboard\n if (!context.isUsingKeyboardRef.current) event.preventDefault();\n }}\n >\n <PopperPrimitive.Content\n role=\"menu\"\n dir={context.dir}\n data-state={getOpenState(context.open)}\n {...contentProps}\n ref={composedRefs}\n style={{ outline: 'none', ...contentProps.style }}\n onKeyDown={composeEventHandlers(contentProps.onKeyDown, (event) => {\n // submenu key events bubble through portals. We only care about keys in this menu.\n const target = event.target as HTMLElement;\n const isKeyDownInside = event.currentTarget.contains(target);\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n if (isKeyDownInside && !isModifierKey && event.key.length === 1) {\n handleTypeaheadSearch(event.key);\n }\n // menus should not be navigated using tab key so we prevent it\n if (event.key === 'Tab') event.preventDefault();\n // focus first/last item based on key pressed\n const content = contentRef.current;\n if (event.target !== content) return;\n if (!FIRST_LAST_KEYS.includes(event.key)) return;\n event.preventDefault();\n const items = getItems().filter((item) => !item.disabled);\n const candidateNodes = items.map((item) => item.ref.current!);\n if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();\n focusFirst(candidateNodes);\n })}\n onBlur={composeEventHandlers(props.onBlur, (event) => {\n // clear search buffer when leaving the menu\n if (!event.currentTarget.contains(event.target)) {\n window.clearTimeout(timerRef.current);\n searchRef.current = '';\n }\n })}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n const target = event.target as HTMLElement;\n const pointerXHasChanged = lastPointerXRef.current !== event.clientX;\n\n // We don't use `event.movementX` for this check because Safari will\n // always return `0` on a pointer event.\n if (event.currentTarget.contains(target) && pointerXHasChanged) {\n const newDir = event.clientX > lastPointerXRef.current ? 'right' : 'left';\n pointerDirRef.current = newDir;\n lastPointerXRef.current = event.clientX;\n }\n })\n )}\n />\n </RovingFocusGroup>\n </DismissableLayer>\n </FocusScope>\n </MenuContentProvider>\n </ScrollLockWrapper>\n </PortalWrapper>\n );\n}) as MenuContentImplPrimitive;\n\nMenuContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'MenuItem';\nconst ITEM_DEFAULT_TAG = 'div';\nconst ITEM_SELECT = 'menu.itemSelect';\n\ntype MenuItemOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof MenuItemImpl>,\n { onSelect?: (event: Event) => void }\n>;\n\ntype MenuItemPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuItemImpl>,\n MenuItemOwnProps\n>;\n\nconst MenuItem = React.forwardRef((props, forwardedRef) => {\n const { disabled = false, onSelect, ...itemProps } = props;\n const ref = React.useRef<HTMLDivElement>(null);\n const context = useMenuContext(ITEM_NAME);\n const contentContext = useMenuContentContext(ITEM_NAME);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n const handleSelect = () => {\n const menuItem = ref.current;\n if (!disabled && menuItem) {\n const itemSelectEvent = new Event(ITEM_SELECT, { bubbles: true, cancelable: true });\n menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });\n menuItem.dispatchEvent(itemSelectEvent);\n if (itemSelectEvent.defaultPrevented) return;\n context.onRootClose();\n }\n };\n\n return (\n <MenuItemImpl\n {...itemProps}\n ref={composedRefs}\n disabled={disabled}\n // we handle selection on `pointerUp` rather than `click` to match native menus implementation\n onPointerUp={composeEventHandlers(props.onPointerUp, handleSelect)}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (disabled || (isTypingAhead && event.key === ' ')) return;\n if (SELECTION_KEYS.includes(event.key)) {\n // prevent page scroll if using the space key to select an item\n if (event.key === ' ') event.preventDefault();\n handleSelect();\n }\n })}\n />\n );\n}) as MenuItemPrimitive;\n\nMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'MenuSubTrigger';\n\ntype MenuSubTriggerElement = React.ElementRef<typeof MenuSubTrigger>;\ntype MenuSubTriggerOwnProps = Polymorphic.OwnProps<typeof MenuItemImpl>;\ntype MenuSubTriggerPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuItemImpl>,\n MenuSubTriggerOwnProps\n>;\n\nconst MenuSubTrigger = React.forwardRef((props, forwardedRef) => {\n const context = useMenuContext(SUB_TRIGGER_NAME);\n const contentContext = useMenuContentContext(SUB_TRIGGER_NAME);\n const openTimerRef = React.useRef<number | null>(null);\n const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;\n\n const clearOpenTimer = React.useCallback(() => {\n if (openTimerRef.current) window.clearTimeout(openTimerRef.current);\n openTimerRef.current = null;\n }, []);\n\n React.useEffect(() => clearOpenTimer, [clearOpenTimer]);\n\n React.useEffect(() => {\n const pointerGraceTimer = pointerGraceTimerRef.current;\n return () => {\n window.clearTimeout(pointerGraceTimer);\n onPointerGraceIntentChange(null);\n };\n }, [pointerGraceTimerRef, onPointerGraceIntentChange]);\n\n return context.isSubmenu ? (\n <MenuAnchor as={Slot}>\n <MenuItemImpl\n id={context.triggerId}\n aria-haspopup=\"menu\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getOpenState(context.open)}\n {...props}\n ref={composeRefs(forwardedRef, context.onTriggerChange)}\n onPointerUp={composeEventHandlers(\n props.onPointerUp,\n whenTouchOrPen((event) => {\n contentContext.onItemEnter(event);\n if (event.defaultPrevented) return;\n if (!props.disabled && !context.open) context.onOpenChange(true);\n })\n )}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n contentContext.onItemEnter(event);\n if (event.defaultPrevented) return;\n if (!props.disabled && !context.open && !openTimerRef.current) {\n contentContext.onPointerGraceIntentChange(null);\n openTimerRef.current = window.setTimeout(() => {\n context.onOpenChange(true);\n clearOpenTimer();\n }, 100);\n }\n })\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => {\n clearOpenTimer();\n\n const contentRect = context.content?.getBoundingClientRect();\n if (contentRect) {\n // TODO: make sure to update this when we change positioning logic\n const side = context.content?.dataset.side as Side;\n const rightSide = side === 'right';\n const bleed = rightSide ? -5 : +5;\n const contentNearEdge = contentRect[rightSide ? 'left' : 'right'];\n const contentFarEdge = contentRect[rightSide ? 'right' : 'left'];\n\n contentContext.onPointerGraceIntentChange({\n area: [\n // Apply a bleed on clientX to ensure that our exit point is\n // consistently within polygon bounds\n { x: event.clientX + bleed, y: event.clientY },\n { x: contentNearEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.bottom },\n { x: contentNearEdge, y: contentRect.bottom },\n ],\n side,\n });\n\n window.clearTimeout(pointerGraceTimerRef.current);\n pointerGraceTimerRef.current = window.setTimeout(\n () => contentContext.onPointerGraceIntentChange(null),\n 300\n );\n } else {\n contentContext.onTriggerLeave(event);\n if (event.defaultPrevented) return;\n\n // There's 100ms where the user may leave an item before the submenu was opened.\n contentContext.onPointerGraceIntentChange(null);\n }\n })\n )}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (props.disabled || (isTypingAhead && event.key === ' ')) return;\n if (SUB_OPEN_KEYS[context.dir].includes(event.key)) {\n context.onOpenChange(true);\n // The trigger may hold focus if opened via pointer interaction\n // so we ensure content is given focus again when switching to keyboard.\n context.content?.focus();\n }\n })}\n />\n </MenuAnchor>\n ) : null;\n}) as MenuSubTriggerPrimitive;\n\nMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuItemImplOwnProps = Polymorphic.Merge<\n Omit<Polymorphic.OwnProps<typeof RovingFocusItem>, 'focusable' | 'active'>,\n {\n disabled?: boolean;\n textValue?: string;\n }\n>;\n\ntype MenuItemImplPrimitive = Polymorphic.ForwardRefComponent<\n typeof ITEM_DEFAULT_TAG,\n MenuItemImplOwnProps\n>;\n\nconst MenuItemImpl = React.forwardRef((props, forwardedRef) => {\n const { as = ITEM_DEFAULT_TAG, disabled = false, textValue, ...itemProps } = props;\n const ref = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const contentContext = useMenuContentContext(ITEM_NAME);\n\n // get the item's `.textContent` as default strategy for typeahead `textValue`\n const [textContent, setTextContent] = React.useState('');\n React.useEffect(() => {\n const menuItem = ref.current;\n if (menuItem) {\n setTextContent((menuItem.textContent ?? '').trim());\n }\n }, [itemProps.children]);\n\n return (\n <CollectionItemSlot disabled={disabled} textValue={textValue ?? textContent}>\n <RovingFocusItem\n role=\"menuitem\"\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n focusable={!disabled}\n {...itemProps}\n as={as}\n ref={composedRefs}\n /**\n * We focus items on `pointerMove` to achieve the following:\n *\n * - Mouse over an item (it focuses)\n * - Leave mouse where it is and use keyboard to focus a different item\n * - Wiggle mouse without it leaving previously focused item\n * - Previously focused item should re-focus\n *\n * If we used `mouseOver`/`mouseEnter` it would not re-focus when the mouse\n * wiggles. This is to match native menu implementation.\n */\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n if (disabled) {\n contentContext.onItemLeave(event);\n } else {\n contentContext.onItemEnter(event);\n if (!event.defaultPrevented) {\n const item = event.currentTarget;\n item.focus();\n }\n }\n })\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => contentContext.onItemLeave(event))\n )}\n />\n </CollectionItemSlot>\n );\n}) as MenuItemImplPrimitive;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'MenuCheckboxItem';\n\ntype MenuCheckboxItemOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof MenuItem>,\n {\n checked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n }\n>;\n\ntype MenuCheckboxItemPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuItem>,\n MenuCheckboxItemOwnProps\n>;\n\nconst MenuCheckboxItem = React.forwardRef((props, forwardedRef) => {\n const { checked = false, onCheckedChange, ...checkboxItemProps } = props;\n return (\n <ItemIndicatorContext.Provider value={checked}>\n <MenuItem\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n {...checkboxItemProps}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n onSelect={composeEventHandlers(\n checkboxItemProps.onSelect,\n () => onCheckedChange?.(!checked),\n { checkForDefaultPrevented: false }\n )}\n />\n </ItemIndicatorContext.Provider>\n );\n}) as MenuCheckboxItemPrimitive;\n\nMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'MenuRadioGroup';\n\nconst RadioGroupContext = React.createContext<MenuRadioGroupOwnProps>({} as any);\n\ntype MenuRadioGroupOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof MenuGroup>,\n {\n value?: string;\n onValueChange?: (value: string) => void;\n }\n>;\n\ntype MenuRadioGroupPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuGroup>,\n MenuRadioGroupOwnProps\n>;\n\nconst MenuRadioGroup = React.forwardRef((props, forwardedRef) => {\n const { value, onValueChange, ...groupProps } = props;\n const handleValueChange = useCallbackRef(onValueChange);\n const context = React.useMemo(() => ({ value, onValueChange: handleValueChange }), [\n value,\n handleValueChange,\n ]);\n return (\n <RadioGroupContext.Provider value={context}>\n <MenuGroup {...groupProps} ref={forwardedRef} />\n </RadioGroupContext.Provider>\n );\n}) as MenuRadioGroupPrimitive;\n\nMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'MenuRadioItem';\n\ntype MenuRadioItemOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof MenuItem>,\n { value: string }\n>;\ntype MenuRadioItemPrimitive = Polymorphic.ForwardRefComponent<\n Polymorphic.IntrinsicElement<typeof MenuItem>,\n MenuRadioItemOwnProps\n>;\n\nconst MenuRadioItem = React.forwardRef((props, forwardedRef) => {\n const { value, ...radioItemProps } = props;\n const context = React.useContext(RadioGroupContext);\n const checked = value === context.value;\n return (\n <ItemIndicatorContext.Provider value={checked}>\n <MenuItem\n role=\"menuitemradio\"\n aria-checked={checked}\n {...radioItemProps}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n onSelect={composeEventHandlers(\n radioItemProps.onSelect,\n () => context.onValueChange?.(value),\n { checkForDefaultPrevented: false }\n )}\n />\n </ItemIndicatorContext.Provider>\n );\n}) as MenuRadioItemPrimitive;\n\nMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'MenuItemIndicator';\nconst ITEM_INDICATOR_DEFAULT_TAG = 'span';\n\nconst ItemIndicatorContext = React.createContext(false);\n\ntype MenuItemIndicatorOwnProps = Polymorphic.Merge<\n Polymorphic.OwnProps<typeof Primitive>,\n {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n }\n>;\n\ntype MenuItemIndicatorPrimitive = Polymorphic.ForwardRefComponent<\n typeof ITEM_INDICATOR_DEFAULT_TAG,\n MenuItemIndicatorOwnProps\n>;\n\nconst MenuItemIndicator = React.forwardRef((props, forwardedRef) => {\n const { as = ITEM_INDICATOR_DEFAULT_TAG, forceMount, ...indicatorProps } = props;\n const checked = React.useContext(ItemIndicatorContext);\n return (\n <Presence present={forceMount || checked}>\n <Primitive\n {...indicatorProps}\n as={as}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n />\n </Presence>\n );\n}) as MenuItemIndicatorPrimitive;\n\nMenuItemIndicator.displayName = ITEM_INDICATOR_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst MenuAnchor = extendPrimitive(PopperPrimitive.Anchor, { displayName: 'MenuAnchor' });\nconst MenuGroup = extendPrimitive(Primitive, {\n defaultProps: { role: 'group' },\n displayName: 'MenuGroup',\n});\nconst MenuLabel = extendPrimitive(Primitive, { displayName: 'MenuLabel' });\nconst MenuSeparator = extendPrimitive(Primitive, {\n defaultProps: { role: 'separator', 'aria-orientation': 'horizontal' },\n displayName: 'MenuSeparator ',\n});\nconst MenuArrow = extendPrimitive(PopperPrimitive.Arrow, { displayName: 'MenuArrow' });\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getOpenState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nfunction getCheckedState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray<T>(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\n\n/**\n * This is the \"meat\" of the typeahead matching logic. It takes in all the values,\n * the search and the current match, and returns the next match (or `undefined`).\n *\n * We normalize the search because if a user has repeatedly pressed a character,\n * we want the exact same behavior as if we only had that one character\n * (ie. cycle through options starting with that character)\n *\n * We also reorder the values by wrapping the array around the current match.\n * This is so we always look forward from the current match, and picking the first\n * match will always be the correct one.\n *\n * Finally, if the normalized search is exactly one character, we exclude the\n * current match from the values because otherwise it would be the first to match always\n * and focus would never move. This is as opposed to the regular case, where we\n * don't want focus to move if the current match still matches.\n */\nfunction getNextMatch(values: string[], search: string, currentMatch?: string) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0] : search;\n const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;\n let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));\n const excludeCurrentMatch = normalizedSearch.length === 1;\n if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);\n const nextMatch = wrappedValues.find((value) =>\n value.toLowerCase().startsWith(normalizedSearch.toLowerCase())\n );\n return nextMatch !== currentMatch ? nextMatch : undefined;\n}\n\ntype Point = { x: number; y: number };\ntype Polygon = Point[];\ntype Side = 'left' | 'right';\ntype GraceIntent = { area: Polygon; side: Side };\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\nfunction isPointerInGraceArea(event: React.PointerEvent, area?: Polygon) {\n if (!area) return false;\n const cursorPos = { x: event.clientX, y: event.clientY };\n return isPointInPolygon(cursorPos, area);\n}\n\nfunction whenMouse<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType === 'mouse' ? handler(event) : undefined);\n}\n\nfunction whenTouchOrPen<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType !== 'mouse' ? handler(event) : undefined);\n}\n\nconst Root = Menu;\nconst Sub = MenuSub;\nconst Anchor = MenuAnchor;\nconst SubTrigger = MenuSubTrigger;\nconst Content = MenuContent;\nconst Group = MenuGroup;\nconst Label = MenuLabel;\nconst Item = MenuItem;\nconst CheckboxItem = MenuCheckboxItem;\nconst RadioGroup = MenuRadioGroup;\nconst RadioItem = MenuRadioItem;\nconst ItemIndicator = MenuItemIndicator;\nconst Separator = MenuSeparator;\nconst Arrow = MenuArrow;\n\nexport {\n Menu,\n MenuSub,\n MenuAnchor,\n MenuSubTrigger,\n MenuContent,\n MenuGroup,\n MenuLabel,\n MenuItem,\n MenuCheckboxItem,\n MenuRadioGroup,\n MenuRadioItem,\n MenuItemIndicator,\n MenuSeparator,\n MenuArrow,\n //\n Root,\n Sub,\n Anchor,\n SubTrigger,\n Content,\n Group,\n Label,\n Item,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n};\nexport type {\n MenuSubTriggerPrimitive,\n MenuContentPrimitive,\n MenuItemPrimitive,\n MenuCheckboxItemPrimitive,\n MenuRadioGroupPrimitive,\n MenuRadioItemPrimitive,\n MenuItemIndicatorPrimitive,\n};\n"],"names":["SELECTION_KEYS","LAST_KEYS","FIRST_LAST_KEYS","SUB_OPEN_KEYS","ltr","rtl","SUB_CLOSE_KEYS","MenuProvider","useMenuContext","createContext","Menu","props","open","children","onOpenChange","content","setContent","React","useState","isUsingKeyboardRef","useRef","handleOpenChange","useCallbackRef","computedDirection","useDirection","dir","useEffect","handleKeyDown","current","handlePointer","document","addEventListener","capture","removeEventListener","_react","createElement","_radixUiReactPopper","Root","$e9e2cf92950df0b951e7bac95d18$var$MenuProvider","isSubmenu","onContentChange","onRootClose","useCallback","MenuSub","parentMenuContext","trigger","setTrigger","contentId","useId","onTriggerChange","triggerId","CollectionSlot","CollectionItemSlot","useCollection","createCollection","MenuContentProvider","useMenuContentContext","MenuContent","forwardRef","forwardedRef","forceMount","contentProps","context","Presence","present","$e9e2cf92950df0b951e7bac95d18$var$CollectionSlot","$e9e2cf92950df0b951e7bac95d18$var$MenuSubContent","_babelRuntimeHelpersEsmExtends","ref","$e9e2cf92950df0b951e7bac95d18$var$MenuRootContent","MenuRootContent","composedRefs","useComposedRefs","hideOthers","$e9e2cf92950df0b951e7bac95d18$var$MenuContentImpl","onDismiss","MenuSubContent","id","aria-labelledby","align","side","portalled","disableOutsidePointerEvents","disableOutsideScroll","trapFocus","onOpenAutoFocus","event","_ref$current","focus","preventDefault","onCloseAutoFocus","onFocusOutside","composeEventHandlers","target","onEscapeKeyDown","onKeyDown","isKeyDownInside","currentTarget","contains","isCloseKey","includes","key","_context$trigger","MenuContentImpl","loop","onPointerDownOutside","onInteractOutside","getItems","currentItemId","setCurrentItemId","contentRef","isPointerDownOutsideRef","timerRef","searchRef","pointerGraceTimerRef","pointerGraceIntentRef","pointerDirRef","lastPointerXRef","PortalWrapper","Portal","Fragment","ScrollLockWrapper","RemoveScroll","handleTypeaheadSearch","_items$find","_items$find2","search","items","filter","item","disabled","currentItem","activeElement","currentMatch","find","textValue","nextMatch","values","normalizedSearch","length","Array","from","every","char","currentMatchIndex","indexOf","wrappedValues","array","startIndex","Math","max","map","_","index","v","value","toLowerCase","startsWith","undefined","getNextMatch","newItem","updateSearch","window","clearTimeout","setTimeout","useFocusGuards","isPointerMovingToSubmenu","_pointerGraceIntentRe","_pointerGraceIntentRe2","area","point","polygon","x","y","inside","i","j","xi","yi","xj","yj","isPointInPolygon","clientX","clientY","isPointerInGraceArea","$e9e2cf92950df0b951e7bac95d18$var$MenuContentProvider","onItemEnter","onItemLeave","_contentRef$current","onTriggerLeave","onPointerGraceIntentChange","intent","FocusScope","as","Slot","trapped","onMountAutoFocus","_contentRef$current2","onUnmountAutoFocus","DismissableLayer","originalEvent","detail","isLeftClick","button","ctrlKey","checkForDefaultPrevented","RovingFocusGroup","orientation","currentTabStopId","onCurrentTabStopIdChange","onEntryFocus","Content","role","data-state","getOpenState","style","outline","isModifierKey","altKey","metaKey","candidateNodes","reverse","candidates","PREVIOUSLY_FOCUSED_ELEMENT","candidate","focusFirst","onBlur","onPointerMove","whenMouse","pointerXHasChanged","newDir","ITEM_DEFAULT_TAG","MenuItem","onSelect","itemProps","contentContext","handleSelect","menuItem","itemSelectEvent","Event","bubbles","cancelable","once","dispatchEvent","defaultPrevented","$e9e2cf92950df0b951e7bac95d18$var$MenuItemImpl","onPointerUp","isTypingAhead","MenuSubTrigger","openTimerRef","clearOpenTimer","pointerGraceTimer","MenuAnchor","aria-haspopup","aria-expanded","aria-controls","composeRefs","handler","pointerType","onPointerLeave","_context$content","contentRect","getBoundingClientRect","_context$content2","dataset","rightSide","bleed","contentNearEdge","contentFarEdge","top","bottom","_context$content3","MenuItemImpl","textContent","setTextContent","_menuItem$textContent","trim","$e9e2cf92950df0b951e7bac95d18$var$CollectionItemSlot","RovingFocusItem","aria-disabled","data-disabled","focusable","MenuCheckboxItem","checked","onCheckedChange","checkboxItemProps","$e9e2cf92950df0b951e7bac95d18$var$ItemIndicatorContext","Provider","aria-checked","getCheckedState","RadioGroupContext","MenuRadioGroup","onValueChange","groupProps","handleValueChange","useMemo","$e9e2cf92950df0b951e7bac95d18$var$RadioGroupContext","MenuGroup","MenuRadioItem","radioItemProps","useContext","_context$onValueChang","call","ITEM_INDICATOR_DEFAULT_TAG","ItemIndicatorContext","MenuItemIndicator","indicatorProps","Primitive","extendPrimitive","PopperPrimitive","Anchor","displayName","defaultProps","MenuLabel","MenuSeparator","aria-orientation","MenuArrow","Arrow","Sub","SubTrigger","Group","Label","Item","CheckboxItem","RadioGroup","RadioItem","ItemIndicator","Separator"],"version":3,"file":"index.module.js.map"}
1
+ {"mappings":"qiCAuBA,MAAMA,EAAiB,CAAC,QAAS,KAE3BC,EAAY,CAAC,UAAW,WAAY,OACpCC,EAAkB,CAFJ,YAAa,SAAU,UAEAD,GACrCE,EAA6C,CACjDC,IAAK,IAAIJ,EAAgB,cACzBK,IAAK,IAAIL,EAAgB,cAErBM,EAA8C,CAClDF,IAAK,CAAC,aACNC,IAAK,CAAC,gBA6BDE,EAAcC,GAAkBC,EAtBrB,eAiCl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C,EAA3B,CAAkC8C,IAAKH,oBAOzC,SAASgK,EAAa1M,GACpB,OAAOA,EAAO,OAAS,SAGzB,SAASuR,EAAgBL,GACvB,OAAOA,EAAU,UAAY,YAiF/B,SAASzD,EAAaiF,GACpB,OAAQ9N,GAAiC,UAAtBA,EAAM+N,YAA0BD,EAAQ9N,QAAS8E,SAGtE,MAAMhI,KAAO5B,YACb,MAAM8S,IAAM5Q,eACZ,MAAMW,OAASH,kBACf,MAAMqQ,WAAavD,sBACnB,MAAM9C,QAAUnJ,mBAChB,MAAMyP,MAAQlF,iBACd,MAAMmF,MAAQhF,iBACd,MAAMiF,KAAOhF,gBACb,MAAMiF,aAAehC,wBACrB,MAAMiC,WAAazB,sBACnB,MAAM0B,UAAYpB,qBAClB,MAAMqB,cAAgBhB,yBACtB,MAAMiB,UAAYd,qBAClB,MAAME,MAAQD","sources":["./packages/react/menu/src/Menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs, composeRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { Portal } from '@radix-ui/react-portal';\nimport { RovingFocusGroup, RovingFocusItem } from '@radix-ui/react-roving-focus';\nimport { useDirection } from '@radix-ui/react-use-direction';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { useId } from '@radix-ui/react-id';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\ntype Direction = 'ltr' | 'rtl';\n\nconst SELECTION_KEYS = ['Enter', ' '];\nconst FIRST_KEYS = ['ArrowDown', 'PageUp', 'Home'];\nconst LAST_KEYS = ['ArrowUp', 'PageDown', 'End'];\nconst FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];\nconst SUB_OPEN_KEYS: Record<Direction, string[]> = {\n ltr: [...SELECTION_KEYS, 'ArrowRight'],\n rtl: [...SELECTION_KEYS, 'ArrowLeft'],\n};\nconst SUB_CLOSE_KEYS: Record<Direction, string[]> = {\n ltr: ['ArrowLeft'],\n rtl: ['ArrowRight'],\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Menu\n * -----------------------------------------------------------------------------------------------*/\n\nconst MENU_NAME = 'Menu';\n\ntype MenuRootContextValue = {\n isSubmenu: false;\n isUsingKeyboardRef: React.RefObject<boolean>;\n dir: Direction;\n open: boolean;\n onOpenChange(open: boolean): void;\n content: MenuContentElement | null;\n onContentChange(content: MenuContentElement | null): void;\n onRootClose(): void;\n modal: boolean;\n};\n\ntype MenuSubContextValue = Omit<MenuRootContextValue, 'isSubmenu'> & {\n isSubmenu: true;\n contentId: string;\n triggerId: string;\n trigger: MenuSubTriggerElement | null;\n onTriggerChange(trigger: MenuSubTriggerElement | null): void;\n};\n\nconst [MenuProvider, useMenuContext] = createContext<MenuRootContextValue | MenuSubContextValue>(\n MENU_NAME\n);\n\ninterface MenuProps {\n open?: boolean;\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n modal?: boolean;\n}\n\nconst Menu: React.FC<MenuProps> = (props) => {\n const { open = false, children, onOpenChange, modal = true } = props;\n const [content, setContent] = React.useState<MenuContentElement | null>(null);\n const isUsingKeyboardRef = React.useRef(false);\n const handleOpenChange = useCallbackRef(onOpenChange);\n const computedDirection = useDirection(content, props.dir);\n\n React.useEffect(() => {\n const handleKeyDown = () => (isUsingKeyboardRef.current = true);\n const handlePointer = () => (isUsingKeyboardRef.current = false);\n // Capture phase ensures we set the boolean before any side effects execute\n // in response to the key or pointer event as they might depend on this value.\n document.addEventListener('keydown', handleKeyDown, { capture: true });\n document.addEventListener('pointerdown', handlePointer, { capture: true });\n document.addEventListener('pointermove', handlePointer, { capture: true });\n return () => {\n document.removeEventListener('keydown', handleKeyDown, { capture: true });\n document.removeEventListener('pointerdown', handlePointer, { capture: true });\n document.removeEventListener('pointermove', handlePointer, { capture: true });\n };\n }, []);\n\n return (\n <PopperPrimitive.Root>\n <MenuProvider\n isSubmenu={false}\n isUsingKeyboardRef={isUsingKeyboardRef}\n dir={computedDirection}\n open={open}\n onOpenChange={handleOpenChange}\n content={content}\n onContentChange={setContent}\n onRootClose={React.useCallback(() => handleOpenChange(false), [handleOpenChange])}\n modal={modal}\n >\n {children}\n </MenuProvider>\n </PopperPrimitive.Root>\n );\n};\n\nMenu.displayName = MENU_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst SUB_NAME = 'MenuSub';\n\ninterface MenuSubProps {\n open?: boolean;\n onOpenChange?(open: boolean): void;\n}\n\nconst MenuSub: React.FC<MenuSubProps> = (props) => {\n const { children, open = false, onOpenChange } = props;\n const parentMenuContext = useMenuContext(SUB_NAME);\n const [trigger, setTrigger] = React.useState<MenuSubTriggerElement | null>(null);\n const [content, setContent] = React.useState<MenuContentElement | null>(null);\n const handleOpenChange = useCallbackRef(onOpenChange);\n\n // Prevent the parent menu from reopening with open submenus.\n React.useEffect(() => {\n if (parentMenuContext.open === false) handleOpenChange(false);\n return () => handleOpenChange(false);\n }, [parentMenuContext.open, handleOpenChange]);\n\n return (\n <PopperPrimitive.Root>\n <MenuProvider\n isSubmenu={true}\n isUsingKeyboardRef={parentMenuContext.isUsingKeyboardRef}\n dir={parentMenuContext.dir}\n open={open}\n onOpenChange={handleOpenChange}\n content={content}\n onContentChange={setContent}\n onRootClose={parentMenuContext.onRootClose}\n contentId={useId()}\n trigger={trigger}\n onTriggerChange={setTrigger}\n triggerId={useId()}\n modal={false}\n >\n {children}\n </MenuProvider>\n </PopperPrimitive.Root>\n );\n};\n\nMenuSub.displayName = SUB_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'MenuAnchor';\n\ntype MenuAnchorElement = React.ElementRef<typeof PopperPrimitive.Anchor>;\ntype PopperAnchorProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;\ninterface MenuAnchorProps extends PopperAnchorProps {}\n\nconst MenuAnchor = React.forwardRef<MenuAnchorElement, MenuAnchorProps>((props, forwardedRef) => (\n <PopperPrimitive.Anchor {...props} ref={forwardedRef} />\n));\n\nMenuAnchor.displayName = ANCHOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'MenuContent';\n\ntype ItemData = { disabled: boolean; textValue: string };\n\nconst [CollectionProvider, CollectionSlot, CollectionItemSlot, useCollection] = createCollection<\n MenuItemElement,\n ItemData\n>();\n\ntype MenuContentContextValue = {\n onItemEnter(event: React.PointerEvent): void;\n onItemLeave(event: React.PointerEvent): void;\n onTriggerLeave(event: React.PointerEvent): void;\n searchRef: React.RefObject<string>;\n pointerGraceTimerRef: React.MutableRefObject<number>;\n onPointerGraceIntentChange(intent: GraceIntent | null): void;\n};\nconst [MenuContentProvider, useMenuContentContext] =\n createContext<MenuContentContextValue>(CONTENT_NAME);\n\ntype MenuContentElement = MenuRootContentElement | MenuSubContentElement;\n/**\n * We purposefully don't union MenuRootContent and MenuSubContent props here because\n * they have conflicting prop types. We agreed that we would allow MenuSubContent to\n * accept props that it would just ignore.\n */\ninterface MenuContentProps extends MenuRootContentProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst MenuContent = React.forwardRef<MenuContentElement, MenuContentProps>(\n (props, forwardedRef) => {\n const { forceMount, ...contentProps } = props;\n const context = useMenuContext(CONTENT_NAME);\n return (\n <CollectionProvider>\n <Presence present={forceMount || context.open}>\n <CollectionSlot>\n {context.isSubmenu ? (\n <MenuSubContent {...contentProps} ref={forwardedRef} />\n ) : (\n <MenuRootContent {...contentProps} ref={forwardedRef} />\n )}\n </CollectionSlot>\n </Presence>\n </CollectionProvider>\n );\n }\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuRootContentElement = MenuRootContentTypeElement;\ninterface MenuRootContentProps\n extends Omit<MenuRootContentTypeProps, keyof MenuContentImplPrivateProps> {}\n\nconst MenuRootContent = React.forwardRef<MenuRootContentElement, MenuRootContentProps>(\n (props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n return context.modal ? (\n <MenuRootContentModal {...props} ref={forwardedRef} />\n ) : (\n <MenuRootContentNonModal {...props} ref={forwardedRef} />\n );\n }\n);\n\ntype MenuRootContentTypeElement = MenuContentImplElement;\ninterface MenuRootContentTypeProps\n extends Omit<\n MenuContentImplProps,\n 'trapFocus' | 'disableOutsidePointerEvents' | 'disableOutsideScroll'\n > {}\n\nconst MenuRootContentModal = React.forwardRef<MenuRootContentTypeElement, MenuRootContentTypeProps>(\n (props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n const ref = React.useRef<MenuRootContentTypeElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n // Hide everything from ARIA except the `MenuContent`\n React.useEffect(() => {\n const content = ref.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <MenuContentImpl\n {...props}\n ref={composedRefs}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n // make sure to only disable pointer events when open\n // this avoids blocking interactions while animating out\n disableOutsidePointerEvents={context.open}\n disableOutsideScroll\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false }\n )}\n onDismiss={() => context.onOpenChange(false)}\n />\n );\n }\n);\n\nconst MenuRootContentNonModal = React.forwardRef<\n MenuRootContentTypeElement,\n MenuRootContentTypeProps\n>((props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n return (\n <MenuContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n disableOutsideScroll={false}\n onDismiss={() => context.onOpenChange(false)}\n />\n );\n});\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuSubContentElement = MenuContentImplElement;\ninterface MenuSubContentProps\n extends Omit<\n MenuContentImplProps,\n | keyof MenuContentImplPrivateProps\n | 'align'\n | 'side'\n | 'portalled'\n | 'disabledOutsidePointerEvents'\n | 'disableOutsideScroll'\n | 'trapFocus'\n | 'onCloseAutoFocus'\n > {}\n\nconst MenuSubContent = React.forwardRef<MenuSubContentElement, MenuSubContentProps>(\n (props, forwardedRef) => {\n const context = useMenuContext(CONTENT_NAME);\n const ref = React.useRef<MenuSubContentElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n return context.isSubmenu ? (\n <MenuContentImpl\n id={context.contentId}\n aria-labelledby={context.triggerId}\n {...props}\n ref={composedRefs}\n align=\"start\"\n side={context.dir === 'rtl' ? 'left' : 'right'}\n portalled\n disableOutsidePointerEvents={false}\n disableOutsideScroll={false}\n trapFocus={false}\n onOpenAutoFocus={(event) => {\n // when opening a submenu, focus content for keyboard users only\n if (context.isUsingKeyboardRef.current) ref.current?.focus();\n event.preventDefault();\n }}\n // The menu might close because of focusing another menu item in the parent menu. We\n // don't want it to refocus the trigger in that case so we handle trigger focus ourselves.\n onCloseAutoFocus={(event) => event.preventDefault()}\n onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) => {\n // We prevent closing when the trigger is focused to avoid triggering a re-open animation\n // on pointer interaction.\n if (event.target !== context.trigger) context.onOpenChange(false);\n })}\n onEscapeKeyDown={composeEventHandlers(props.onEscapeKeyDown, context.onRootClose)}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n // Submenu key events bubble through portals. We only care about keys in this menu.\n const isKeyDownInside = event.currentTarget.contains(event.target as HTMLElement);\n const isCloseKey = SUB_CLOSE_KEYS[context.dir].includes(event.key);\n if (isKeyDownInside && isCloseKey) {\n context.onOpenChange(false);\n // We focus manually because we prevented it in `onCloseAutoFocus`\n context.trigger?.focus();\n }\n })}\n />\n ) : null;\n }\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ntype MenuContentImplPrivateProps = {\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];\n onDismiss?: DismissableLayerProps['onDismiss'];\n};\ninterface MenuContentImplProps\n extends MenuContentImplPrivateProps,\n PopperContentProps,\n Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * Whether focus should be trapped within the `MenuContent`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n\n /**\n * Whether scrolling outside the `MenuContent` should be prevented\n * (default: `false`)\n */\n disableOutsideScroll?: boolean;\n\n /**\n * The direction of navigation between menu items.\n * @defaultValue ltr\n */\n dir?: RovingFocusGroupProps['dir'];\n\n /**\n * Whether keyboard navigation should loop around\n * @defaultValue false\n */\n loop?: RovingFocusGroupProps['loop'];\n\n /**\n * Whether the `MenuContent` should render in a `Portal`\n * (default: `true`)\n */\n portalled?: boolean;\n}\n\nconst MenuContentImpl = React.forwardRef<MenuContentImplElement, MenuContentImplProps>(\n (props, forwardedRef) => {\n const {\n loop = false,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n disableOutsideScroll,\n portalled,\n ...contentProps\n } = props;\n const context = useMenuContext(CONTENT_NAME);\n const { getItems } = useCollection();\n const [currentItemId, setCurrentItemId] = React.useState<string | null>(null);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef, context.onContentChange);\n const timerRef = React.useRef(0);\n const searchRef = React.useRef('');\n const pointerGraceTimerRef = React.useRef(0);\n const pointerGraceIntentRef = React.useRef<GraceIntent | null>(null);\n const pointerDirRef = React.useRef<Side>('right');\n const lastPointerXRef = React.useRef(0);\n\n const PortalWrapper = portalled ? Portal : React.Fragment;\n const ScrollLockWrapper = disableOutsideScroll ? RemoveScroll : React.Fragment;\n\n const handleTypeaheadSearch = (key: string) => {\n const search = searchRef.current + key;\n const items = getItems().filter((item) => !item.disabled);\n const currentItem = document.activeElement;\n const currentMatch = items.find((item) => item.ref.current === currentItem)?.textValue;\n const values = items.map((item) => item.textValue);\n const nextMatch = getNextMatch(values, search, currentMatch);\n const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;\n\n // Reset `searchRef` 1 second after it was last updated\n (function updateSearch(value: string) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n if (value !== '') timerRef.current = window.setTimeout(() => updateSearch(''), 1000);\n })(search);\n\n if (newItem) {\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => (newItem as HTMLElement).focus());\n }\n };\n\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n\n // Make sure the whole tree has focus guards as our `MenuContent` may be\n // the last element in the DOM (beacuse of the `Portal`)\n useFocusGuards();\n\n const isPointerMovingToSubmenu = React.useCallback((event: React.PointerEvent) => {\n const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;\n return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);\n }, []);\n\n return (\n <PortalWrapper>\n <ScrollLockWrapper>\n <MenuContentProvider\n searchRef={searchRef}\n onItemEnter={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n )}\n onItemLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) return;\n contentRef.current?.focus();\n setCurrentItemId(null);\n },\n [isPointerMovingToSubmenu]\n )}\n onTriggerLeave={React.useCallback(\n (event) => {\n if (isPointerMovingToSubmenu(event)) event.preventDefault();\n },\n [isPointerMovingToSubmenu]\n )}\n pointerGraceTimerRef={pointerGraceTimerRef}\n onPointerGraceIntentChange={React.useCallback((intent) => {\n pointerGraceIntentRef.current = intent;\n }, [])}\n >\n <FocusScope\n asChild\n trapped={trapFocus}\n onMountAutoFocus={composeEventHandlers(onOpenAutoFocus, (event) => {\n // when opening, explicitly focus the content area only and leave\n // `onEntryFocus` in control of focusing first item\n event.preventDefault();\n contentRef.current?.focus();\n })}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={disableOutsidePointerEvents}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onInteractOutside={onInteractOutside}\n onDismiss={onDismiss}\n >\n <RovingFocusGroup\n asChild\n dir={context.dir}\n orientation=\"vertical\"\n loop={loop}\n currentTabStopId={currentItemId}\n onCurrentTabStopIdChange={setCurrentItemId}\n onEntryFocus={(event) => {\n // only focus first item when using keyboard\n if (!context.isUsingKeyboardRef.current) event.preventDefault();\n }}\n >\n <PopperPrimitive.Content\n role=\"menu\"\n dir={context.dir}\n data-state={getOpenState(context.open)}\n {...contentProps}\n ref={composedRefs}\n style={{ outline: 'none', ...contentProps.style }}\n onKeyDown={composeEventHandlers(contentProps.onKeyDown, (event) => {\n // submenu key events bubble through portals. We only care about keys in this menu.\n const target = event.target as HTMLElement;\n const isKeyDownInside = event.currentTarget.contains(target);\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n if (isKeyDownInside && !isModifierKey && event.key.length === 1) {\n handleTypeaheadSearch(event.key);\n }\n // menus should not be navigated using tab key so we prevent it\n if (event.key === 'Tab') event.preventDefault();\n // focus first/last item based on key pressed\n const content = contentRef.current;\n if (event.target !== content) return;\n if (!FIRST_LAST_KEYS.includes(event.key)) return;\n event.preventDefault();\n const items = getItems().filter((item) => !item.disabled);\n const candidateNodes = items.map((item) => item.ref.current!);\n if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();\n focusFirst(candidateNodes);\n })}\n onBlur={composeEventHandlers(props.onBlur, (event) => {\n // clear search buffer when leaving the menu\n if (!event.currentTarget.contains(event.target)) {\n window.clearTimeout(timerRef.current);\n searchRef.current = '';\n }\n })}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n const target = event.target as HTMLElement;\n const pointerXHasChanged = lastPointerXRef.current !== event.clientX;\n\n // We don't use `event.movementX` for this check because Safari will\n // always return `0` on a pointer event.\n if (event.currentTarget.contains(target) && pointerXHasChanged) {\n const newDir = event.clientX > lastPointerXRef.current ? 'right' : 'left';\n pointerDirRef.current = newDir;\n lastPointerXRef.current = event.clientX;\n }\n })\n )}\n />\n </RovingFocusGroup>\n </DismissableLayer>\n </FocusScope>\n </MenuContentProvider>\n </ScrollLockWrapper>\n </PortalWrapper>\n );\n }\n);\n\nMenuContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'MenuGroup';\n\ntype MenuGroupElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface MenuGroupProps extends PrimitiveDivProps {}\n\nconst MenuGroup = React.forwardRef<MenuGroupElement, MenuGroupProps>((props, forwardedRef) => (\n <Primitive.div role=\"group\" {...props} ref={forwardedRef} />\n));\n\nMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'MenuLabel';\n\ntype MenuLabelElement = React.ElementRef<typeof Primitive.div>;\ninterface MenuLabelProps extends PrimitiveDivProps {}\n\nconst MenuLabel = React.forwardRef<MenuLabelElement, MenuLabelProps>((props, forwardedRef) => (\n <Primitive.div {...props} ref={forwardedRef} />\n));\n\nMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'MenuItem';\nconst ITEM_SELECT = 'menu.itemSelect';\n\ntype MenuItemElement = MenuItemImplElement;\ninterface MenuItemProps extends Omit<MenuItemImplProps, 'onSelect'> {\n onSelect?: (event: Event) => void;\n}\n\nconst MenuItem = React.forwardRef<MenuItemElement, MenuItemProps>((props, forwardedRef) => {\n const { disabled = false, onSelect, ...itemProps } = props;\n const ref = React.useRef<HTMLDivElement>(null);\n const context = useMenuContext(ITEM_NAME);\n const contentContext = useMenuContentContext(ITEM_NAME);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const isPointerDownRef = React.useRef(false);\n\n const handleSelect = () => {\n const menuItem = ref.current;\n if (!disabled && menuItem) {\n const itemSelectEvent = new Event(ITEM_SELECT, { bubbles: true, cancelable: true });\n menuItem.addEventListener(ITEM_SELECT, (event) => onSelect?.(event), { once: true });\n menuItem.dispatchEvent(itemSelectEvent);\n if (itemSelectEvent.defaultPrevented) {\n isPointerDownRef.current = false;\n } else {\n context.onRootClose();\n }\n }\n };\n\n return (\n <MenuItemImpl\n {...itemProps}\n ref={composedRefs}\n disabled={disabled}\n onClick={composeEventHandlers(props.onClick, handleSelect)}\n onPointerDown={(event) => {\n props.onPointerDown?.(event);\n isPointerDownRef.current = true;\n }}\n onPointerUp={composeEventHandlers(props.onPointerUp, (event) => {\n // Pointer down can move to a different menu item which should activate it on pointer up.\n // We dispatch a click for selection to allow composition with click based triggers and to\n // prevent Firefox from getting stuck in text selection mode when the menu closes.\n if (!isPointerDownRef.current) event.currentTarget?.click();\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (disabled || (isTypingAhead && event.key === ' ')) return;\n if (SELECTION_KEYS.includes(event.key)) {\n event.currentTarget.click();\n /**\n * We prevent default browser behaviour for selection keys as they should trigger\n * a selection only:\n * - prevents space from scrolling the page.\n * - if keydown causes focus to move, prevents keydown from firing on the new target.\n */\n event.preventDefault();\n }\n })}\n />\n );\n});\n\nMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'MenuSubTrigger';\n\ntype MenuSubTriggerElement = MenuItemImplElement;\ninterface MenuSubTriggerProps extends MenuItemImplProps {}\n\nconst MenuSubTrigger = React.forwardRef<MenuSubTriggerElement, MenuSubTriggerProps>(\n (props, forwardedRef) => {\n const context = useMenuContext(SUB_TRIGGER_NAME);\n const contentContext = useMenuContentContext(SUB_TRIGGER_NAME);\n const openTimerRef = React.useRef<number | null>(null);\n const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;\n\n const clearOpenTimer = React.useCallback(() => {\n if (openTimerRef.current) window.clearTimeout(openTimerRef.current);\n openTimerRef.current = null;\n }, []);\n\n React.useEffect(() => clearOpenTimer, [clearOpenTimer]);\n\n React.useEffect(() => {\n const pointerGraceTimer = pointerGraceTimerRef.current;\n return () => {\n window.clearTimeout(pointerGraceTimer);\n onPointerGraceIntentChange(null);\n };\n }, [pointerGraceTimerRef, onPointerGraceIntentChange]);\n\n return context.isSubmenu ? (\n <MenuAnchor asChild>\n <MenuItemImpl\n id={context.triggerId}\n aria-haspopup=\"menu\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getOpenState(context.open)}\n {...props}\n ref={composeRefs(forwardedRef, context.onTriggerChange)}\n // This is redundant for mouse users but we cannot determine pointer type from\n // click event and we cannot use pointerup event (see git history for reasons why)\n onClick={(event) => {\n props.onClick?.(event);\n if (props.disabled || event.defaultPrevented) return;\n /**\n * We manually focus because iOS Safari doesn't always focus on click (e.g. buttons)\n * and we rely heavily on `onFocusOutside` for submenus to close when switching\n * between separate submenus.\n */\n event.currentTarget.focus();\n if (!context.open) context.onOpenChange(true);\n }}\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n contentContext.onItemEnter(event);\n if (event.defaultPrevented) return;\n if (!props.disabled && !context.open && !openTimerRef.current) {\n contentContext.onPointerGraceIntentChange(null);\n openTimerRef.current = window.setTimeout(() => {\n context.onOpenChange(true);\n clearOpenTimer();\n }, 100);\n }\n })\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => {\n clearOpenTimer();\n\n const contentRect = context.content?.getBoundingClientRect();\n if (contentRect) {\n // TODO: make sure to update this when we change positioning logic\n const side = context.content?.dataset.side as Side;\n const rightSide = side === 'right';\n const bleed = rightSide ? -5 : +5;\n const contentNearEdge = contentRect[rightSide ? 'left' : 'right'];\n const contentFarEdge = contentRect[rightSide ? 'right' : 'left'];\n\n contentContext.onPointerGraceIntentChange({\n area: [\n // Apply a bleed on clientX to ensure that our exit point is\n // consistently within polygon bounds\n { x: event.clientX + bleed, y: event.clientY },\n { x: contentNearEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.top },\n { x: contentFarEdge, y: contentRect.bottom },\n { x: contentNearEdge, y: contentRect.bottom },\n ],\n side,\n });\n\n window.clearTimeout(pointerGraceTimerRef.current);\n pointerGraceTimerRef.current = window.setTimeout(\n () => contentContext.onPointerGraceIntentChange(null),\n 300\n );\n } else {\n contentContext.onTriggerLeave(event);\n if (event.defaultPrevented) return;\n\n // There's 100ms where the user may leave an item before the submenu was opened.\n contentContext.onPointerGraceIntentChange(null);\n }\n })\n )}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef.current !== '';\n if (props.disabled || (isTypingAhead && event.key === ' ')) return;\n if (SUB_OPEN_KEYS[context.dir].includes(event.key)) {\n context.onOpenChange(true);\n // The trigger may hold focus if opened via pointer interaction\n // so we ensure content is given focus again when switching to keyboard.\n context.content?.focus();\n }\n })}\n />\n </MenuAnchor>\n ) : null;\n }\n);\n\nMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype MenuItemImplElement = React.ElementRef<typeof Primitive.div>;\ninterface MenuItemImplProps extends PrimitiveDivProps {\n disabled?: boolean;\n textValue?: string;\n}\n\nconst MenuItemImpl = React.forwardRef<MenuItemImplElement, MenuItemImplProps>(\n (props, forwardedRef) => {\n const { disabled = false, textValue, ...itemProps } = props;\n const ref = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const contentContext = useMenuContentContext(ITEM_NAME);\n\n // get the item's `.textContent` as default strategy for typeahead `textValue`\n const [textContent, setTextContent] = React.useState('');\n React.useEffect(() => {\n const menuItem = ref.current;\n if (menuItem) {\n setTextContent((menuItem.textContent ?? '').trim());\n }\n }, [itemProps.children]);\n\n return (\n <CollectionItemSlot disabled={disabled} textValue={textValue ?? textContent}>\n <RovingFocusItem asChild focusable={!disabled}>\n <Primitive.div\n role=\"menuitem\"\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n {...itemProps}\n ref={composedRefs}\n /**\n * We focus items on `pointerMove` to achieve the following:\n *\n * - Mouse over an item (it focuses)\n * - Leave mouse where it is and use keyboard to focus a different item\n * - Wiggle mouse without it leaving previously focused item\n * - Previously focused item should re-focus\n *\n * If we used `mouseOver`/`mouseEnter` it would not re-focus when the mouse\n * wiggles. This is to match native menu implementation.\n */\n onPointerMove={composeEventHandlers(\n props.onPointerMove,\n whenMouse((event) => {\n if (disabled) {\n contentContext.onItemLeave(event);\n } else {\n contentContext.onItemEnter(event);\n if (!event.defaultPrevented) {\n const item = event.currentTarget;\n item.focus();\n }\n }\n })\n )}\n onPointerLeave={composeEventHandlers(\n props.onPointerLeave,\n whenMouse((event) => contentContext.onItemLeave(event))\n )}\n />\n </RovingFocusItem>\n </CollectionItemSlot>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * MenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'MenuCheckboxItem';\n\ntype MenuCheckboxItemElement = MenuItemElement;\ninterface MenuCheckboxItemProps extends MenuItemProps {\n checked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nconst MenuCheckboxItem = React.forwardRef<MenuCheckboxItemElement, MenuCheckboxItemProps>(\n (props, forwardedRef) => {\n const { checked = false, onCheckedChange, ...checkboxItemProps } = props;\n return (\n <ItemIndicatorContext.Provider value={checked}>\n <MenuItem\n role=\"menuitemcheckbox\"\n aria-checked={checked}\n {...checkboxItemProps}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n onSelect={composeEventHandlers(\n checkboxItemProps.onSelect,\n () => onCheckedChange?.(!checked),\n { checkForDefaultPrevented: false }\n )}\n />\n </ItemIndicatorContext.Provider>\n );\n }\n);\n\nMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'MenuRadioGroup';\n\nconst RadioGroupContext = React.createContext<MenuRadioGroupProps>({} as any);\n\ntype MenuRadioGroupElement = React.ElementRef<typeof MenuGroup>;\ninterface MenuRadioGroupProps extends MenuGroupProps {\n value?: string;\n onValueChange?: (value: string) => void;\n}\n\nconst MenuRadioGroup = React.forwardRef<MenuRadioGroupElement, MenuRadioGroupProps>(\n (props, forwardedRef) => {\n const { value, onValueChange, ...groupProps } = props;\n const handleValueChange = useCallbackRef(onValueChange);\n const context = React.useMemo(\n () => ({ value, onValueChange: handleValueChange }),\n [value, handleValueChange]\n );\n return (\n <RadioGroupContext.Provider value={context}>\n <MenuGroup {...groupProps} ref={forwardedRef} />\n </RadioGroupContext.Provider>\n );\n }\n);\n\nMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'MenuRadioItem';\n\ntype MenuRadioItemElement = React.ElementRef<typeof MenuItem>;\ninterface MenuRadioItemProps extends MenuItemProps {\n value: string;\n}\n\nconst MenuRadioItem = React.forwardRef<MenuRadioItemElement, MenuRadioItemProps>(\n (props, forwardedRef) => {\n const { value, ...radioItemProps } = props;\n const context = React.useContext(RadioGroupContext);\n const checked = value === context.value;\n return (\n <ItemIndicatorContext.Provider value={checked}>\n <MenuItem\n role=\"menuitemradio\"\n aria-checked={checked}\n {...radioItemProps}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n onSelect={composeEventHandlers(\n radioItemProps.onSelect,\n () => context.onValueChange?.(value),\n { checkForDefaultPrevented: false }\n )}\n />\n </ItemIndicatorContext.Provider>\n );\n }\n);\n\nMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'MenuItemIndicator';\n\nconst ItemIndicatorContext = React.createContext(false);\n\ntype MenuItemIndicatorElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface MenuItemIndicatorProps extends PrimitiveSpanProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst MenuItemIndicator = React.forwardRef<MenuItemIndicatorElement, MenuItemIndicatorProps>(\n (props, forwardedRef) => {\n const { forceMount, ...indicatorProps } = props;\n const checked = React.useContext(ItemIndicatorContext);\n return (\n <Presence present={forceMount || checked}>\n <Primitive.span\n {...indicatorProps}\n ref={forwardedRef}\n data-state={getCheckedState(checked)}\n />\n </Presence>\n );\n }\n);\n\nMenuItemIndicator.displayName = ITEM_INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'MenuSeparator';\n\ntype MenuSeparatorElement = React.ElementRef<typeof Primitive.div>;\ninterface MenuSeparatorProps extends PrimitiveDivProps {}\n\nconst MenuSeparator = React.forwardRef<MenuSeparatorElement, MenuSeparatorProps>(\n (props, forwardedRef) => (\n <Primitive.div role=\"separator\" aria-orientation=\"horizontal\" {...props} ref={forwardedRef} />\n )\n);\n\nMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * MenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'MenuArrow';\n\ntype MenuArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface MenuArrowProps extends PopperArrowProps {}\n\nconst MenuArrow = React.forwardRef<MenuArrowElement, MenuArrowProps>((props, forwardedRef) => (\n <PopperPrimitive.Arrow {...props} ref={forwardedRef} />\n));\n\nMenuArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getOpenState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\nfunction getCheckedState(checked: boolean) {\n return checked ? 'checked' : 'unchecked';\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate.focus();\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray<T>(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\n\n/**\n * This is the \"meat\" of the typeahead matching logic. It takes in all the values,\n * the search and the current match, and returns the next match (or `undefined`).\n *\n * We normalize the search because if a user has repeatedly pressed a character,\n * we want the exact same behavior as if we only had that one character\n * (ie. cycle through options starting with that character)\n *\n * We also reorder the values by wrapping the array around the current match.\n * This is so we always look forward from the current match, and picking the first\n * match will always be the correct one.\n *\n * Finally, if the normalized search is exactly one character, we exclude the\n * current match from the values because otherwise it would be the first to match always\n * and focus would never move. This is as opposed to the regular case, where we\n * don't want focus to move if the current match still matches.\n */\nfunction getNextMatch(values: string[], search: string, currentMatch?: string) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0] : search;\n const currentMatchIndex = currentMatch ? values.indexOf(currentMatch) : -1;\n let wrappedValues = wrapArray(values, Math.max(currentMatchIndex, 0));\n const excludeCurrentMatch = normalizedSearch.length === 1;\n if (excludeCurrentMatch) wrappedValues = wrappedValues.filter((v) => v !== currentMatch);\n const nextMatch = wrappedValues.find((value) =>\n value.toLowerCase().startsWith(normalizedSearch.toLowerCase())\n );\n return nextMatch !== currentMatch ? nextMatch : undefined;\n}\n\ntype Point = { x: number; y: number };\ntype Polygon = Point[];\ntype Side = 'left' | 'right';\ntype GraceIntent = { area: Polygon; side: Side };\n\n// Determine if a point is inside of a polygon.\n// Based on https://github.com/substack/point-in-polygon\nfunction isPointInPolygon(point: Point, polygon: Polygon) {\n const { x, y } = point;\n let inside = false;\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n // prettier-ignore\n const intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);\n if (intersect) inside = !inside;\n }\n\n return inside;\n}\n\nfunction isPointerInGraceArea(event: React.PointerEvent, area?: Polygon) {\n if (!area) return false;\n const cursorPos = { x: event.clientX, y: event.clientY };\n return isPointInPolygon(cursorPos, area);\n}\n\nfunction whenMouse<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType === 'mouse' ? handler(event) : undefined);\n}\n\nconst Root = Menu;\nconst Sub = MenuSub;\nconst Anchor = MenuAnchor;\nconst SubTrigger = MenuSubTrigger;\nconst Content = MenuContent;\nconst Group = MenuGroup;\nconst Label = MenuLabel;\nconst Item = MenuItem;\nconst CheckboxItem = MenuCheckboxItem;\nconst RadioGroup = MenuRadioGroup;\nconst RadioItem = MenuRadioItem;\nconst ItemIndicator = MenuItemIndicator;\nconst Separator = MenuSeparator;\nconst Arrow = MenuArrow;\n\nexport {\n Menu,\n MenuSub,\n MenuAnchor,\n MenuSubTrigger,\n MenuContent,\n MenuGroup,\n MenuLabel,\n MenuItem,\n MenuCheckboxItem,\n MenuRadioGroup,\n MenuRadioItem,\n MenuItemIndicator,\n MenuSeparator,\n MenuArrow,\n //\n Root,\n Sub,\n Anchor,\n SubTrigger,\n Content,\n Group,\n Label,\n Item,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n};\nexport type {\n MenuProps,\n MenuSubProps,\n MenuAnchorProps,\n MenuSubTriggerProps,\n MenuContentProps,\n MenuGroupProps,\n MenuLabelProps,\n MenuItemProps,\n MenuCheckboxItemProps,\n MenuRadioGroupProps,\n MenuRadioItemProps,\n MenuItemIndicatorProps,\n MenuSeparatorProps,\n MenuArrowProps,\n};\n"],"names":["SELECTION_KEYS","LAST_KEYS","FIRST_LAST_KEYS","SUB_OPEN_KEYS","ltr","rtl","SUB_CLOSE_KEYS","MenuProvider","useMenuContext","createContext","Menu","props","open","children","onOpenChange","modal","content","setContent","React","useState","isUsingKeyboardRef","useRef","handleOpenChange","useCallbackRef","computedDirection","useDirection","dir","useEffect","handleKeyDown","current","handlePointer","document","addEventListener","capture","removeEventListener","_react","createElement","_radixUiReactPopper","Root","$e9e2cf92950df0b951e7bac95d18$var$MenuProvider","isSubmenu","onContentChange","onRootClose","useCallback","MenuSub","parentMenuContext","trigger","setTrigger","contentId","useId","onTriggerChange","triggerId","MenuAnchor","forwardRef","forwardedRef","Anchor","_babelRuntimeHelpersEsmExtends","ref","CollectionProvider","CollectionSlot","CollectionItemSlot","useCollection","createCollection","MenuContentProvider","useMenuContentContext","MenuContent","forceMount","contentProps","context","$e9e2cf92950df0b951e7bac95d18$var$CollectionProvider","Presence","present","$e9e2cf92950df0b951e7bac95d18$var$CollectionSlot","$e9e2cf92950df0b951e7bac95d18$var$MenuSubContent","$e9e2cf92950df0b951e7bac95d18$var$MenuRootContent","MenuRootContent","$e9e2cf92950df0b951e7bac95d18$var$MenuRootContentModal","$e9e2cf92950df0b951e7bac95d18$var$MenuRootContentNonModal","MenuRootContentModal","composedRefs","useComposedRefs","hideOthers","$e9e2cf92950df0b951e7bac95d18$var$MenuContentImpl","trapFocus","disableOutsidePointerEvents","disableOutsideScroll","onFocusOutside","composeEventHandlers","event","preventDefault","checkForDefaultPrevented","onDismiss","MenuRootContentNonModal","MenuSubContent","id","align","side","portalled","onOpenAutoFocus","_ref$current","focus","onCloseAutoFocus","target","onEscapeKeyDown","onKeyDown","isKeyDownInside","currentTarget","contains","isCloseKey","includes","key","_context$trigger","MenuContentImpl","loop","onPointerDownOutside","onInteractOutside","getItems","currentItemId","setCurrentItemId","contentRef","timerRef","searchRef","pointerGraceTimerRef","pointerGraceIntentRef","pointerDirRef","lastPointerXRef","PortalWrapper","Portal","Fragment","ScrollLockWrapper","RemoveScroll","handleTypeaheadSearch","_items$find","_items$find2","search","items","filter","item","disabled","currentItem","activeElement","currentMatch","find","textValue","nextMatch","values","normalizedSearch","length","Array","from","every","char","currentMatchIndex","indexOf","wrappedValues","array","startIndex","Math","max","map","_","index","v","value","toLowerCase","startsWith","undefined","getNextMatch","newItem","updateSearch","window","clearTimeout","setTimeout","useFocusGuards","isPointerMovingToSubmenu","_pointerGraceIntentRe","_pointerGraceIntentRe2","area","point","polygon","x","y","inside","i","j","xi","yi","xj","yj","isPointInPolygon","clientX","clientY","isPointerInGraceArea","$e9e2cf92950df0b951e7bac95d18$var$MenuContentProvider","onItemEnter","onItemLeave","_contentRef$current","onTriggerLeave","onPointerGraceIntentChange","intent","FocusScope","asChild","trapped","onMountAutoFocus","_contentRef$current2","onUnmountAutoFocus","DismissableLayer","RovingFocusGroup","orientation","currentTabStopId","onCurrentTabStopIdChange","onEntryFocus","Content","role","getOpenState","style","outline","isModifierKey","ctrlKey","altKey","metaKey","candidateNodes","reverse","candidates","PREVIOUSLY_FOCUSED_ELEMENT","candidate","focusFirst","onBlur","onPointerMove","whenMouse","pointerXHasChanged","newDir","MenuGroup","Primitive","div","MenuLabel","MenuItem","onSelect","itemProps","contentContext","isPointerDownRef","$e9e2cf92950df0b951e7bac95d18$var$MenuItemImpl","onClick","menuItem","itemSelectEvent","Event","bubbles","cancelable","once","dispatchEvent","defaultPrevented","onPointerDown","_props$onPointerDown","call","onPointerUp","_event$currentTarget","click","isTypingAhead","MenuSubTrigger","openTimerRef","clearOpenTimer","pointerGraceTimer","composeRefs","_props$onClick","onPointerLeave","_context$content","contentRect","getBoundingClientRect","_context$content2","dataset","rightSide","bleed","contentNearEdge","contentFarEdge","top","bottom","_context$content3","MenuItemImpl","textContent","setTextContent","_menuItem$textContent","trim","$e9e2cf92950df0b951e7bac95d18$var$CollectionItemSlot","RovingFocusItem","focusable","MenuCheckboxItem","checked","onCheckedChange","checkboxItemProps","$e9e2cf92950df0b951e7bac95d18$var$ItemIndicatorContext","Provider","getCheckedState","RadioGroupContext","MenuRadioGroup","onValueChange","groupProps","handleValueChange","useMemo","$e9e2cf92950df0b951e7bac95d18$var$RadioGroupContext","MenuRadioItem","radioItemProps","useContext","_context$onValueChang","ItemIndicatorContext","MenuItemIndicator","indicatorProps","span","MenuSeparator","MenuArrow","Arrow","handler","pointerType","Sub","SubTrigger","Group","Label","Item","CheckboxItem","RadioGroup","RadioItem","ItemIndicator","Separator"],"version":3,"file":"index.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-menu",
3
- "version": "0.0.21",
3
+ "version": "0.1.0",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -13,28 +13,25 @@
13
13
  "sideEffects": false,
14
14
  "scripts": {
15
15
  "clean": "rm -rf dist",
16
- "prepublish": "yarn clean",
17
16
  "version": "yarn version"
18
17
  },
19
18
  "dependencies": {
20
19
  "@babel/runtime": "^7.13.10",
21
- "@radix-ui/primitive": "0.0.5",
22
- "@radix-ui/react-collection": "0.0.14",
23
- "@radix-ui/react-compose-refs": "0.0.5",
24
- "@radix-ui/react-context": "0.0.5",
25
- "@radix-ui/react-dismissable-layer": "0.0.14",
26
- "@radix-ui/react-focus-guards": "0.0.7",
27
- "@radix-ui/react-focus-scope": "0.0.14",
28
- "@radix-ui/react-id": "0.0.6",
29
- "@radix-ui/react-polymorphic": "0.0.12",
30
- "@radix-ui/react-popper": "0.0.17",
31
- "@radix-ui/react-portal": "0.0.14",
32
- "@radix-ui/react-presence": "0.0.14",
33
- "@radix-ui/react-primitive": "0.0.14",
34
- "@radix-ui/react-roving-focus": "0.0.15",
35
- "@radix-ui/react-slot": "0.0.12",
36
- "@radix-ui/react-use-callback-ref": "0.0.5",
37
- "@radix-ui/react-use-direction": "0.0.1",
20
+ "@radix-ui/primitive": "0.1.0",
21
+ "@radix-ui/react-collection": "0.1.0",
22
+ "@radix-ui/react-compose-refs": "0.1.0",
23
+ "@radix-ui/react-context": "0.1.0",
24
+ "@radix-ui/react-dismissable-layer": "0.1.0",
25
+ "@radix-ui/react-focus-guards": "0.1.0",
26
+ "@radix-ui/react-focus-scope": "0.1.0",
27
+ "@radix-ui/react-id": "0.1.0",
28
+ "@radix-ui/react-popper": "0.1.0",
29
+ "@radix-ui/react-portal": "0.1.0",
30
+ "@radix-ui/react-presence": "0.1.0",
31
+ "@radix-ui/react-primitive": "0.1.0",
32
+ "@radix-ui/react-roving-focus": "0.1.0",
33
+ "@radix-ui/react-use-callback-ref": "0.1.0",
34
+ "@radix-ui/react-use-direction": "0.1.0",
38
35
  "aria-hidden": "^1.1.1",
39
36
  "react-remove-scroll": "^2.4.0"
40
37
  },