@jamsrui/menu 0.0.7 → 0.0.9
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.mts +11 -3
- package/dist/index.mjs +1 -1
- package/dist/{menu-CptFvNqD.d.mts → menu-BQP9o4yc.d.mts} +13 -13
- package/dist/menu-checkbox-item.d.mts +25 -0
- package/dist/menu-checkbox-item.mjs +1 -0
- package/dist/menu-config.d.mts +9 -5
- package/dist/menu-content.mjs +1 -1
- package/dist/menu-content2.d.mts +10 -0
- package/dist/menu-content2.mjs +1 -0
- package/dist/menu-context.d.mts +6 -3
- package/dist/menu-group-label.d.mts +10 -0
- package/dist/menu-group-label.mjs +1 -0
- package/dist/menu-group.d.mts +10 -0
- package/dist/menu-group.mjs +1 -0
- package/dist/menu-item.d.mts +6 -3
- package/dist/menu-radio-group-context.d.mts +13 -0
- package/dist/menu-radio-group-context.mjs +1 -0
- package/dist/menu-radio-group.d.mts +14 -0
- package/dist/menu-radio-group.mjs +1 -0
- package/dist/menu-radio-item.d.mts +23 -0
- package/dist/menu-radio-item.mjs +1 -0
- package/dist/menu-root.d.mts +10 -0
- package/dist/menu-root.mjs +1 -0
- package/dist/menu-separator.d.mts +5 -0
- package/dist/menu-separator.mjs +1 -0
- package/dist/menu.d.mts +7 -4
- package/dist/styles.d.mts +13 -8
- package/dist/styles.mjs +1 -1
- package/dist/use-menu.d.mts +7 -4
- package/dist/use-menu.mjs +1 -1
- package/package.json +7 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
export { M as Menu, a as MenuItem } from './menu-
|
|
1
|
+
export { M as Menu, a as MenuItem } from './menu-BQP9o4yc.mjs';
|
|
2
|
+
export { MenuCheckboxItem } from './menu-checkbox-item.mjs';
|
|
2
3
|
export { MenuConfig, useMenuConfig } from './menu-config.mjs';
|
|
3
4
|
export { MenuContent } from './menu-content.mjs';
|
|
5
|
+
export { MenuGroup } from './menu-group.mjs';
|
|
6
|
+
export { MenuGroupLabel } from './menu-group-label.mjs';
|
|
7
|
+
export { MenuRadioGroup } from './menu-radio-group.mjs';
|
|
8
|
+
export { MenuRadioItem } from './menu-radio-item.mjs';
|
|
9
|
+
export { MenuSeparator } from './menu-separator.mjs';
|
|
4
10
|
export { MenuTrigger } from './menu-trigger.mjs';
|
|
5
11
|
import 'react/jsx-runtime';
|
|
6
|
-
import 'react';
|
|
7
12
|
import '@floating-ui/react';
|
|
8
13
|
import '@jamsrui/utils';
|
|
14
|
+
import 'react';
|
|
15
|
+
import './menu-content2.mjs';
|
|
16
|
+
import 'motion/react';
|
|
9
17
|
import './menu-floating-context.mjs';
|
|
10
18
|
import './menu-item-inner.mjs';
|
|
19
|
+
import './menu-root.mjs';
|
|
11
20
|
import './styles.mjs';
|
|
12
|
-
import 'tailwind-variants';
|
|
13
21
|
import '@jamsrui/core';
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Menu as r}from"./menu";import{MenuConfig as
|
|
1
|
+
"use client";import{Menu as r}from"./menu";import{MenuCheckboxItem as n}from"./menu-checkbox-item";import{MenuConfig as p,useMenuConfig as m}from"./menu-config";import{MenuContent as x}from"./menu-content";import{MenuGroup as i}from"./menu-group";import{MenuGroupLabel as g}from"./menu-group-label";import{MenuItem as G}from"./menu-item";import{MenuRadioGroup as b}from"./menu-radio-group";import{MenuRadioItem as d}from"./menu-radio-item";import{MenuSeparator as s}from"./menu-separator";import{MenuTrigger as h}from"./menu-trigger";export{r as Menu,n as MenuCheckboxItem,p as MenuConfig,x as MenuContent,i as MenuGroup,g as MenuGroupLabel,G as MenuItem,b as MenuRadioGroup,d as MenuRadioItem,s as MenuSeparator,h as MenuTrigger,m as useMenuConfig};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import { ComponentProps } from 'react';
|
|
4
2
|
import { FloatingOverlayProps, FloatingFocusManagerProps, FloatingArrowProps, FloatingNodeProps, FloatingList, Placement } from '@floating-ui/react';
|
|
5
3
|
import { UIProps, PropGetter, SlotsToClassNames } from '@jamsrui/utils';
|
|
6
|
-
import
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import { ComponentProps } from 'react';
|
|
6
|
+
import { MenuContent2 } from './menu-content2.mjs';
|
|
7
7
|
import { MenuFloatingContext } from './menu-floating-context.mjs';
|
|
8
|
+
import { MenuGroup } from './menu-group.mjs';
|
|
9
|
+
import { MenuGroupLabel } from './menu-group-label.mjs';
|
|
8
10
|
import { MenuItemInner } from './menu-item-inner.mjs';
|
|
11
|
+
import { MenuRoot } from './menu-root.mjs';
|
|
9
12
|
import { MenuVariantProps, MenuSlots } from './styles.mjs';
|
|
10
13
|
|
|
11
14
|
declare const MenuItem: (props: MenuItem.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
@@ -23,24 +26,21 @@ declare namespace MenuItem {
|
|
|
23
26
|
declare const useMenu: (props: useMenu.Props) => {
|
|
24
27
|
getOverlayProps: () => FloatingOverlayProps & UIProps<"div">;
|
|
25
28
|
getFocusManagerProps: () => Omit<FloatingFocusManagerProps, "children">;
|
|
26
|
-
getContentProps: PropGetter<
|
|
29
|
+
getContentProps: PropGetter<MenuContent2.Props>;
|
|
27
30
|
getArrowProps: () => FloatingArrowProps;
|
|
28
31
|
getNodeProps: () => FloatingNodeProps;
|
|
29
32
|
isOpen: boolean;
|
|
30
33
|
getTriggerProps: () => UIProps<"div">;
|
|
31
34
|
getFloatingListProps: () => Omit<ComponentProps<typeof FloatingList>, "children">;
|
|
32
|
-
|
|
35
|
+
hideArrow: boolean;
|
|
33
36
|
floatingCtx: MenuFloatingContext.Props;
|
|
34
|
-
getRootProps:
|
|
35
|
-
"data-component": string | undefined;
|
|
36
|
-
"data-slot": string | undefined;
|
|
37
|
-
className: string;
|
|
38
|
-
ref: ((node: HTMLElement | null) => void) & ((node: HTMLElement | null) => void);
|
|
39
|
-
style: react.CSSProperties;
|
|
40
|
-
};
|
|
37
|
+
getRootProps: PropGetter<MenuRoot.Props>;
|
|
41
38
|
getMenuItemProps: PropGetter<MenuItem.Props>;
|
|
42
39
|
isNested: boolean;
|
|
43
40
|
getMenuItemInnerProps: PropGetter<MenuItemInner.Props>;
|
|
41
|
+
getMenuGroupProps: PropGetter<MenuGroup.Props>;
|
|
42
|
+
getMenuGroupLabelProps: PropGetter<MenuGroupLabel.Props>;
|
|
43
|
+
placement: Placement;
|
|
44
44
|
};
|
|
45
45
|
declare namespace useMenu {
|
|
46
46
|
interface Props extends MenuVariantProps {
|
|
@@ -56,7 +56,7 @@ declare namespace useMenu {
|
|
|
56
56
|
lockScroll?: boolean;
|
|
57
57
|
placement?: Placement;
|
|
58
58
|
offset?: number;
|
|
59
|
-
|
|
59
|
+
hideArrow?: boolean;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { a as MenuItem } from './menu-BQP9o4yc.mjs';
|
|
3
|
+
import '@floating-ui/react';
|
|
4
|
+
import '@jamsrui/utils';
|
|
5
|
+
import 'react';
|
|
6
|
+
import './menu-content2.mjs';
|
|
7
|
+
import 'motion/react';
|
|
8
|
+
import './menu-floating-context.mjs';
|
|
9
|
+
import './menu-group.mjs';
|
|
10
|
+
import './menu-group-label.mjs';
|
|
11
|
+
import './menu-item-inner.mjs';
|
|
12
|
+
import './menu-root.mjs';
|
|
13
|
+
import './styles.mjs';
|
|
14
|
+
|
|
15
|
+
declare const MenuCheckboxItem: (props: MenuCheckboxItem.Props) => react_jsx_runtime.JSX.Element;
|
|
16
|
+
declare namespace MenuCheckboxItem {
|
|
17
|
+
interface Props extends MenuItem.Props {
|
|
18
|
+
isChecked?: boolean;
|
|
19
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
20
|
+
defaultChecked?: boolean;
|
|
21
|
+
tickPlacement?: "start" | "end";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { MenuCheckboxItem };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useCallback as i}from"react";import{useControlledState as l}from"@jamsrui/hooks";import{CheckIcon as p}from"@jamsrui/icons";import{MenuItem as m}from"./menu-item";const d=n=>{const{isChecked:o}=n;return e("span",{className:"size-4",children:o?e(p,{}):null})},P=n=>{const{isChecked:o,onCheckedChange:C,defaultChecked:r,tickPlacement:t,...a}=n,[c=!1,s]=l({defaultProp:r,onChange:C,prop:o}),k=i(()=>{s(h=>!h)},[s]);return e(m,{preventCloseOnClick:!0,onClick:k,endContent:t==="end"?e(d,{isChecked:c}):void 0,startContent:t==="start"?e(d,{isChecked:c}):void 0,...a})};export{P as MenuCheckboxItem};
|
package/dist/menu-config.d.mts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { GlobalConfigProps } from '@jamsrui/core';
|
|
3
|
-
import { M as Menu } from './menu-
|
|
4
|
-
import 'react';
|
|
3
|
+
import { M as Menu } from './menu-BQP9o4yc.mjs';
|
|
5
4
|
import '@floating-ui/react';
|
|
6
5
|
import '@jamsrui/utils';
|
|
7
|
-
import '
|
|
6
|
+
import 'react';
|
|
7
|
+
import './menu-content2.mjs';
|
|
8
|
+
import 'motion/react';
|
|
8
9
|
import './menu-floating-context.mjs';
|
|
10
|
+
import './menu-group.mjs';
|
|
11
|
+
import './menu-group-label.mjs';
|
|
9
12
|
import './menu-item-inner.mjs';
|
|
13
|
+
import './menu-root.mjs';
|
|
10
14
|
import './styles.mjs';
|
|
11
|
-
import 'tailwind-variants';
|
|
12
15
|
|
|
13
16
|
declare const useMenuConfig: () => MenuConfig.Props;
|
|
14
|
-
declare const MenuConfig: (props: MenuConfig.Props & {
|
|
17
|
+
declare const MenuConfig: (props: Omit<Partial<MenuConfig.Props>, "children"> & {
|
|
15
18
|
merge?: boolean;
|
|
19
|
+
children: React.ReactNode;
|
|
16
20
|
}) => react_jsx_runtime.JSX.Element;
|
|
17
21
|
declare namespace MenuConfig {
|
|
18
22
|
interface Props extends Menu.Props, GlobalConfigProps<Menu.Props> {
|
package/dist/menu-content.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as o,jsxs as t}from"react/jsx-runtime";import{FloatingArrow as m,FloatingFocusManager as F,FloatingList as M,FloatingOverlay as P,FloatingPortal as c}from"@floating-ui/react";import{AnimatePresence as f}from"motion/react";import{MenuContent2 as C}from"./menu-content2";import{useMenuContext as x}from"./menu-context";import{MenuFloatingContext as d}from"./menu-floating-context";import{MenuRoot as A}from"./menu-root";const I=n=>{const{getFloatingListProps:e,isOpen:r,getFocusManagerProps:i,getOverlayProps:a,hideArrow:s,getArrowProps:l,floatingCtx:p,isNested:u}=x(),{children:g}=n;return o(d,{value:p,children:o(M,{...e(),children:o(f,{children:r?t(c,{children:[u?null:o(P,{...a()}),o(F,{...i(),children:o(A,{children:t(C,{children:[s?null:o(m,{...l()}),g]})})})]}):null})})})};export{I as MenuContent};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { HTMLMotionProps } from 'motion/react';
|
|
3
|
+
|
|
4
|
+
declare const MenuContent2: (props: MenuContent2.Props) => react_jsx_runtime.JSX.Element;
|
|
5
|
+
declare namespace MenuContent2 {
|
|
6
|
+
interface Props extends HTMLMotionProps<"div"> {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { MenuContent2 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as p}from"react/jsx-runtime";import{motion as s}from"motion/react";import{useMenuContext as r}from"./menu-context";const m=t=>{const{children:o,...e}=t,{getContentProps:n,isNested:i}=r();return p(s.div,{...i?{}:{exit:{opacity:0,scale:.8},initial:{opacity:0,scale:.8},transition:{type:"spring",stiffness:300,damping:25},animate:{opacity:1,scale:1,x:0,y:0}},...n(e),children:o})};export{m as MenuContent2};
|
package/dist/menu-context.d.mts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { u as useMenu } from './menu-
|
|
2
|
+
import { u as useMenu } from './menu-BQP9o4yc.mjs';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import '@floating-ui/react';
|
|
5
5
|
import '@jamsrui/utils';
|
|
6
|
-
import './menu-
|
|
6
|
+
import './menu-content2.mjs';
|
|
7
|
+
import 'motion/react';
|
|
7
8
|
import './menu-floating-context.mjs';
|
|
9
|
+
import './menu-group.mjs';
|
|
10
|
+
import './menu-group-label.mjs';
|
|
8
11
|
import './menu-item-inner.mjs';
|
|
12
|
+
import './menu-root.mjs';
|
|
9
13
|
import './styles.mjs';
|
|
10
|
-
import 'tailwind-variants';
|
|
11
14
|
|
|
12
15
|
declare const useMenuContext: () => MenuContext.Props;
|
|
13
16
|
declare const MenuContext: react.Context<MenuContext.Props | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { UIProps } from '@jamsrui/utils';
|
|
3
|
+
|
|
4
|
+
declare const MenuGroupLabel: (props: MenuGroupLabel.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
5
|
+
declare namespace MenuGroupLabel {
|
|
6
|
+
interface Props extends UIProps<"div"> {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { MenuGroupLabel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useRenderElement as o}from"@jamsrui/hooks";import{useMenuContext as t}from"./menu-context";const u=e=>{const{getMenuGroupLabelProps:r}=t();return o("div",{props:[r(e)]})};export{u as MenuGroupLabel};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { UIProps } from '@jamsrui/utils';
|
|
3
|
+
|
|
4
|
+
declare const MenuGroup: (props: MenuGroup.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
5
|
+
declare namespace MenuGroup {
|
|
6
|
+
interface Props extends UIProps<"div"> {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { MenuGroup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useRenderElement as o}from"@jamsrui/hooks";import{useMenuContext as t}from"./menu-context";const u=e=>{const{getMenuGroupProps:r}=t();return o("div",{props:[r(e)]})};export{u as MenuGroup};
|
package/dist/menu-item.d.mts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
import '@jamsrui/utils';
|
|
3
|
-
export { a as MenuItem } from './menu-
|
|
3
|
+
export { a as MenuItem } from './menu-BQP9o4yc.mjs';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import '@floating-ui/react';
|
|
6
|
-
import './menu-
|
|
6
|
+
import './menu-content2.mjs';
|
|
7
|
+
import 'motion/react';
|
|
7
8
|
import './menu-floating-context.mjs';
|
|
9
|
+
import './menu-group.mjs';
|
|
10
|
+
import './menu-group-label.mjs';
|
|
8
11
|
import './menu-item-inner.mjs';
|
|
12
|
+
import './menu-root.mjs';
|
|
9
13
|
import './styles.mjs';
|
|
10
|
-
import 'tailwind-variants';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
declare const useMenuRadioGroupContext: () => MenuRadioGroupContext.Props;
|
|
4
|
+
declare const MenuRadioGroupContext: react.Context<MenuRadioGroupContext.Props | null>;
|
|
5
|
+
declare namespace MenuRadioGroupContext {
|
|
6
|
+
interface Props {
|
|
7
|
+
isDisabled: boolean | undefined;
|
|
8
|
+
value: string;
|
|
9
|
+
setValue: React.Dispatch<React.SetStateAction<string>>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { MenuRadioGroupContext, useMenuRadioGroupContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as t,use as o}from"react";const n=t(null),u=()=>{const e=o(n);if(!e)throw new Error("useMenuRadioGroupContext must be used within a MenuRadioGroup");return e};export{n as MenuRadioGroupContext,u as useMenuRadioGroupContext};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare const MenuRadioGroup: (props: MenuRadioGroup.Props) => react_jsx_runtime.JSX.Element;
|
|
4
|
+
declare namespace MenuRadioGroup {
|
|
5
|
+
interface Props {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
value?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
onValueChange?: (value: string) => void;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { MenuRadioGroup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as c}from"react/jsx-runtime";import{useMemo as i}from"react";import{useControlledState as s}from"@jamsrui/hooks";import{MenuRadioGroupContext as d}from"./menu-radio-group-context";const v=t=>{const{children:u,defaultValue:n,isDisabled:e,onValueChange:r,value:l}=t,[o="",a]=s({defaultProp:n,onChange:r,prop:l}),p=i(()=>({isDisabled:e,value:o,setValue:a}),[e,a,o]);return c(d,{value:p,children:u})};export{v as MenuRadioGroup};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { a as MenuItem } from './menu-BQP9o4yc.mjs';
|
|
3
|
+
import '@floating-ui/react';
|
|
4
|
+
import '@jamsrui/utils';
|
|
5
|
+
import 'react';
|
|
6
|
+
import './menu-content2.mjs';
|
|
7
|
+
import 'motion/react';
|
|
8
|
+
import './menu-floating-context.mjs';
|
|
9
|
+
import './menu-group.mjs';
|
|
10
|
+
import './menu-group-label.mjs';
|
|
11
|
+
import './menu-item-inner.mjs';
|
|
12
|
+
import './menu-root.mjs';
|
|
13
|
+
import './styles.mjs';
|
|
14
|
+
|
|
15
|
+
declare const MenuRadioItem: (props: MenuRadioItem.Props) => react_jsx_runtime.JSX.Element;
|
|
16
|
+
declare namespace MenuRadioItem {
|
|
17
|
+
interface Props extends MenuItem.Props {
|
|
18
|
+
value: string;
|
|
19
|
+
tickPlacement?: "start" | "end";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { MenuRadioItem };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import{useCallback as l}from"react";import{CheckIcon as u}from"@jamsrui/icons";import{MenuItem as m}from"./menu-item";import{useMenuRadioGroupContext as p}from"./menu-radio-group-context";const r=t=>{const{isChecked:e}=t;return n("span",{className:"size-4",children:e?n(u,{}):null})},M=t=>{const{value:e,tickPlacement:o,...c}=t,{value:s,isDisabled:a,setValue:i}=p(),d=l(()=>{a||i(e)},[a,e,i]);return n(m,{preventCloseOnClick:!0,onClick:d,endContent:o==="end"?n(r,{isChecked:s===e}):void 0,startContent:o==="start"?n(r,{isChecked:s===e}):void 0,...c})};export{M as MenuRadioItem};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { UIProps } from '@jamsrui/utils';
|
|
3
|
+
|
|
4
|
+
declare const MenuRoot: (props: MenuRoot.Props) => react.ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
5
|
+
declare namespace MenuRoot {
|
|
6
|
+
interface Props extends UIProps<"div"> {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { MenuRoot };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useRenderElement as r}from"@jamsrui/hooks";import{useMenuContext as t}from"./menu-context";const m=e=>{const{getRootProps:o}=t();return r("div",{props:[o(e)]})};export{m as MenuRoot};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{Divider as r}from"@jamsrui/divider";const a=()=>o(r,{className:"my-1.5"});export{a as MenuSeparator};
|
package/dist/menu.d.mts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import 'react/jsx-runtime';
|
|
2
|
-
export { M as Menu } from './menu-
|
|
3
|
-
import 'react';
|
|
2
|
+
export { M as Menu } from './menu-BQP9o4yc.mjs';
|
|
4
3
|
import '@floating-ui/react';
|
|
5
4
|
import '@jamsrui/utils';
|
|
6
|
-
import '
|
|
5
|
+
import 'react';
|
|
6
|
+
import './menu-content2.mjs';
|
|
7
|
+
import 'motion/react';
|
|
7
8
|
import './menu-floating-context.mjs';
|
|
9
|
+
import './menu-group.mjs';
|
|
10
|
+
import './menu-group-label.mjs';
|
|
8
11
|
import './menu-item-inner.mjs';
|
|
12
|
+
import './menu-root.mjs';
|
|
9
13
|
import './styles.mjs';
|
|
10
|
-
import 'tailwind-variants';
|
package/dist/styles.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _jamsrui_utils from '@jamsrui/utils';
|
|
2
2
|
import { VariantProps } from '@jamsrui/utils';
|
|
3
3
|
|
|
4
|
-
declare const
|
|
5
|
-
declare const menuVariants: tailwind_variants.TVReturnType<{
|
|
4
|
+
declare const menuVariants: _jamsrui_utils.TVReturnType<{
|
|
6
5
|
radius: {
|
|
7
6
|
sm: {};
|
|
8
7
|
md: {};
|
|
@@ -48,8 +47,10 @@ declare const menuVariants: tailwind_variants.TVReturnType<{
|
|
|
48
47
|
arrow: string;
|
|
49
48
|
backdrop: string;
|
|
50
49
|
root: string;
|
|
51
|
-
content: string;
|
|
50
|
+
content: string[];
|
|
52
51
|
menuItem: string[];
|
|
52
|
+
menuGroup: string[];
|
|
53
|
+
menuGroupLabel: string;
|
|
53
54
|
menuItemInner: string;
|
|
54
55
|
}, undefined, {
|
|
55
56
|
radius: {
|
|
@@ -97,10 +98,12 @@ declare const menuVariants: tailwind_variants.TVReturnType<{
|
|
|
97
98
|
arrow: string;
|
|
98
99
|
backdrop: string;
|
|
99
100
|
root: string;
|
|
100
|
-
content: string;
|
|
101
|
+
content: string[];
|
|
101
102
|
menuItem: string[];
|
|
103
|
+
menuGroup: string[];
|
|
104
|
+
menuGroupLabel: string;
|
|
102
105
|
menuItemInner: string;
|
|
103
|
-
},
|
|
106
|
+
}, _jamsrui_utils.TVReturnType<{
|
|
104
107
|
radius: {
|
|
105
108
|
sm: {};
|
|
106
109
|
md: {};
|
|
@@ -146,11 +149,13 @@ declare const menuVariants: tailwind_variants.TVReturnType<{
|
|
|
146
149
|
arrow: string;
|
|
147
150
|
backdrop: string;
|
|
148
151
|
root: string;
|
|
149
|
-
content: string;
|
|
152
|
+
content: string[];
|
|
150
153
|
menuItem: string[];
|
|
154
|
+
menuGroup: string[];
|
|
155
|
+
menuGroupLabel: string;
|
|
151
156
|
menuItemInner: string;
|
|
152
157
|
}, undefined, unknown, unknown, undefined>>;
|
|
153
158
|
type MenuVariantProps = VariantProps<typeof menuVariants>;
|
|
154
159
|
type MenuSlots = keyof ReturnType<typeof menuVariants>;
|
|
155
160
|
|
|
156
|
-
export { type MenuSlots, type MenuVariantProps, menuVariants
|
|
161
|
+
export { type MenuSlots, type MenuVariantProps, menuVariants };
|
package/dist/styles.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{radiusVariant as e,tv as r}from"@jamsrui/utils";const
|
|
1
|
+
import{radiusVariant as e,tv as r}from"@jamsrui/utils";const n=r({slots:{arrow:"fill-background-secondary",backdrop:"z-backdrop",root:"min-w-[150px] z-popover outline-none outline-0",content:["relative z-popover box-border inline-flex w-full flex-col justify-center bg-surface p-1 text-sm shadow-md outline-none","shadow-lg origin-(--transform-origin)"],menuItem:["relative box-border flex size-full select-none items-center gap-2 px-2 py-1.5 text-left outline-none ui-disabled:cursor-not-allowed ui-disabled:opacity-60","ui-active:bg-surface-secondary"],menuGroup:[""],menuGroupLabel:"pl-2 text-foreground-secondary py-1",menuItemInner:"grow"},variants:{radius:e(["content","menuItem"]),backdrop:{transparent:{backdrop:""},opaque:{backdrop:"bg-black/50"},blur:{backdrop:"bg-black/30 backdrop-blur-md backdrop-saturate-150"}},color:{default:{menuItem:"ui-hover:bg-surface-secondary ui-hover:text-foreground"},primary:{menuItem:"ui-hover:bg-primary ui-hover:text-primary-foreground"},secondary:{menuItem:"ui-hover:bg-secondary ui-hover:text-secondary-foreground"},success:{menuItem:"ui-hover:bg-success ui-hover:text-success-foreground"},warning:{menuItem:"ui-hover:bg-warning ui-hover:text-warning-foreground"},danger:{menuItem:"ui-hover:bg-danger ui-hover:text-danger-foreground"}}},defaultVariants:{backdrop:"transparent",radius:"md",color:"default"}});export{n as menuVariants};
|
package/dist/use-menu.d.mts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import 'react';
|
|
2
1
|
import '@floating-ui/react';
|
|
3
2
|
import '@jamsrui/utils';
|
|
4
|
-
import '
|
|
3
|
+
import 'react';
|
|
4
|
+
import './menu-content2.mjs';
|
|
5
5
|
import './menu-floating-context.mjs';
|
|
6
|
-
|
|
6
|
+
import './menu-group.mjs';
|
|
7
|
+
import './menu-group-label.mjs';
|
|
8
|
+
export { u as useMenu } from './menu-BQP9o4yc.mjs';
|
|
7
9
|
import './menu-item-inner.mjs';
|
|
10
|
+
import './menu-root.mjs';
|
|
8
11
|
import './styles.mjs';
|
|
9
12
|
import 'react/jsx-runtime';
|
|
10
|
-
import '
|
|
13
|
+
import 'motion/react';
|
package/dist/use-menu.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as
|
|
1
|
+
import{useCallback as s,useEffect as J,useMemo as Q,useRef as v,useState as W}from"react";import{arrow as Ie,autoUpdate as ye,flip as Me,offset as be,safePolygon as ve,shift as Ne,size as Fe,useClick as he,useDismiss as Oe,useFloating as xe,useFloatingNodeId as Ce,useFloatingParentNodeId as Ge,useFloatingTree as we,useHover as Re,useInteractions as ke,useListItem as Le,useListNavigation as Se,useRole as Ee,useTypeahead as Ae}from"@floating-ui/react";import{useControlledState as De,useMergeRefs as Te}from"@jamsrui/hooks";import{cn as c,dataAttrDev as i,mapPropsVariants as He}from"@jamsrui/utils";import{useMenuFloatingContext as Ve}from"./menu-floating-context";import{menuVariants as X}from"./styles";const Je=Y=>{const p=Ge(),t=p!==null,[Z,_]=He(Y,X.variantKeys),{closeDelay:ee=0,closeOnEscapeKey:te=!0,closeOnOutsidePress:oe=!0,isOpen:ne,lockScroll:N=!0,offset:se=4,openDelay:re=75,placement:I=t?"right-start":"bottom",defaultOpen:ae=!1,onOpenChange:le,triggerOn:ie="click",classNames:o,hideArrow:y=!!t}=Z,l=we(),u=Ce(),M=Le(),ue=y?0:7,[r=!1,d]=De({defaultProp:ae,onChange:le,prop:ne}),[me,F]=W(!1),[g,h]=W(null),O=v(null),x=v([]),C=v([]),{floatingStyles:G,refs:b,context:a}=xe({nodeId:u,open:r,onOpenChange:d,placement:I,middleware:[be({mainAxis:se+ue,alignmentAxis:t?-4:0}),Me(),Ne({padding:5}),Ie({element:O}),Fe({apply({availableHeight:e,elements:m,availableWidth:P}){m.floating.style.setProperty("--available-width",`${P}px`),m.floating.style.setProperty("--available-height",`${e}px`),m.floating.style.setProperty("--transform-origin","top center")}})],whileElementsMounted:ye}),pe=Re(a,{enabled:ie==="hover"||t,delay:{open:re,close:ee},handleClose:ve({blockPointerEvents:!0})}),ce=he(a,{event:"mousedown",toggle:!t,ignoreMouse:t}),de=Ee(a,{role:"menu"}),ge=Oe(a,{bubbles:!0,escapeKey:te,outsidePress:oe}),fe=Se(a,{listRef:x,activeIndex:g,nested:t,onNavigate:h}),Pe=Ae(a,{enabled:r,listRef:C,onMatch:h,activeIndex:g}),{getReferenceProps:w,getFloatingProps:R,getItemProps:k}=ke([pe,ce,de,ge,fe,Pe]);J(()=>{if(!l)return;function e(){d(!1)}function m(P){P.nodeId!==u&&P.parentId===p&&d(!1)}return l.events.on("click",e),l.events.on("menuopen",m),()=>{l.events.off("click",e),l.events.off("menuopen",m)}},[l,u,p,d,r]),J(()=>{r&&l&&l.events.emit("menuopen",{parentId:p,nodeId:u})},[l,r,u,p]);const n=X(_),L=r&&me&&t,S=Te([b.setReference,M.ref]),f=Ve(),E=s(()=>({ref:S,tabIndex:t?f.activeIndex===M.index?0:-1:void 0,"data-slot":i("trigger"),role:t?"menuitem":void 0,"data-active":L,"data-nested":t,"data-open":r,...w({...f.getItemProps({onMouseEnter(){F(!1),f.setHasFocusInside(!0)}})})}),[w,L,t,r,M.index,S,f]),A=s(()=>({lockScroll:N,"data-slot":i("overlay"),className:n.backdrop({className:o?.backdrop})}),[o?.backdrop,N,n]),D=s(()=>({context:a,modal:!0,initialFocus:1,returnFocus:!t,disabled:!1}),[a,t]),T=s(e=>({...e,"data-component":i("menu"),"data-slot":i("root"),className:n.root({className:o?.root}),ref:b.setFloating,style:G,...R()}),[o?.root,G,R,b.setFloating,n]),H=s(()=>({className:n.content({className:c(o?.content)})}),[o?.content,n]),V=s(()=>({context:a,ref:O,className:n.arrow({className:o?.arrow})}),[o?.arrow,a,n]),K=s(()=>({id:u}),[u]),U=s(()=>({elementsRef:x,labelsRef:C}),[]),$=Q(()=>({activeIndex:g,getItemProps:k,setHasFocusInside:F}),[g,k]),j=s(e=>({...e,"data-slot":i("menu-item"),className:n.menuItem({className:c(o?.menuItem,e.className),color:e.color}),role:"menuitem"}),[o?.menuItem,n]),z=s(e=>({...e,"data-slot":i("menu-item-inner"),className:n.menuItemInner({className:c(o?.menuItemInner,e.className)})}),[o?.menuItemInner,n]),q=s(e=>({...e,"data-slot":i("menu-group"),className:n.menuItemInner({className:c(o?.menuGroup,e.className)})}),[o?.menuGroup,n]),B=s(e=>({...e,"data-slot":i("menu-group-label"),className:n.menuGroupLabel({className:c(o?.menuGroupLabel,e.className)})}),[o?.menuGroupLabel,n]);return Q(()=>({getOverlayProps:A,getFocusManagerProps:D,getContentProps:H,getArrowProps:V,getNodeProps:K,isOpen:r,getTriggerProps:E,getFloatingListProps:U,hideArrow:y,floatingCtx:$,getRootProps:T,getMenuItemProps:j,isNested:t,getMenuItemInnerProps:z,getMenuGroupProps:q,getMenuGroupLabelProps:B,placement:I}),[A,D,H,V,K,r,E,U,y,$,T,j,t,z,q,B,I])};export{Je as useMenu};
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jamsrui/menu",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
+
"motion": ">=12",
|
|
5
6
|
"react": ">=19"
|
|
6
7
|
},
|
|
7
8
|
"dependencies": {
|
|
8
9
|
"@floating-ui/react": ">=0.27",
|
|
9
|
-
"@jamsrui/core": "^0.0.
|
|
10
|
-
"@jamsrui/hooks": "^0.0.
|
|
11
|
-
"@jamsrui/
|
|
10
|
+
"@jamsrui/core": "^0.0.8",
|
|
11
|
+
"@jamsrui/hooks": "^0.0.9",
|
|
12
|
+
"@jamsrui/icons": "^0.0.8",
|
|
13
|
+
"@jamsrui/divider": "^0.0.9",
|
|
14
|
+
"@jamsrui/utils": "^0.0.9"
|
|
12
15
|
},
|
|
13
16
|
"exports": {
|
|
14
17
|
".": {
|