@yamada-ui/menu 1.3.12 → 1.3.13-dev-20240917033401
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-5ZWRZF6M.mjs → chunk-DPC5A6DV.mjs} +2 -2
- package/dist/chunk-DPC5A6DV.mjs.map +1 -0
- package/dist/{chunk-AG6UJA7D.mjs → chunk-HVOHR2NQ.mjs} +2 -2
- package/dist/chunk-HVOHR2NQ.mjs.map +1 -0
- package/dist/{chunk-G4OMCC2Y.mjs → chunk-M4PPRRRC.mjs} +5 -3
- package/dist/chunk-M4PPRRRC.mjs.map +1 -0
- package/dist/chunk-NNSVX2GX.mjs +170 -0
- package/dist/chunk-NNSVX2GX.mjs.map +1 -0
- package/dist/{chunk-73KHS3JD.mjs → chunk-O5D4LR5P.mjs} +2 -2
- package/dist/chunk-O5D4LR5P.mjs.map +1 -0
- package/dist/chunk-OFCEMPQW.mjs +29 -0
- package/dist/chunk-OFCEMPQW.mjs.map +1 -0
- package/dist/{chunk-6YBKZRIZ.mjs → chunk-SI3WI4AI.mjs} +3 -3
- package/dist/chunk-SI3WI4AI.mjs.map +1 -0
- package/dist/chunk-T7CXLEBW.mjs +243 -0
- package/dist/chunk-T7CXLEBW.mjs.map +1 -0
- package/dist/chunk-ZUOFHOX6.mjs +43 -0
- package/dist/chunk-ZUOFHOX6.mjs.map +1 -0
- package/dist/chunk-ZV73JKM5.mjs +21 -0
- package/dist/chunk-ZV73JKM5.mjs.map +1 -0
- package/dist/context-menu-trigger.d.mts +2 -1
- package/dist/context-menu-trigger.d.ts +2 -1
- package/dist/context-menu-trigger.js +32 -17
- package/dist/context-menu-trigger.js.map +1 -1
- package/dist/context-menu-trigger.mjs +2 -2
- package/dist/context-menu.d.mts +4 -10
- package/dist/context-menu.d.ts +4 -10
- package/dist/context-menu.js +43 -264
- package/dist/context-menu.js.map +1 -1
- package/dist/context-menu.mjs +5 -5
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +259 -255
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -11
- package/dist/menu-button.d.mts +4 -3
- package/dist/menu-button.d.ts +4 -3
- package/dist/menu-button.js +55 -58
- package/dist/menu-button.js.map +1 -1
- package/dist/menu-button.mjs +3 -2
- package/dist/menu-context.d.mts +210 -0
- package/dist/menu-context.d.ts +210 -0
- package/dist/menu-context.js +77 -0
- package/dist/menu-context.js.map +1 -0
- package/dist/menu-context.mjs +30 -0
- package/dist/menu-context.mjs.map +1 -0
- package/dist/menu-divider.d.mts +3 -2
- package/dist/menu-divider.d.ts +3 -2
- package/dist/menu-divider.js +26 -21
- package/dist/menu-divider.js.map +1 -1
- package/dist/menu-divider.mjs +2 -2
- package/dist/menu-group.d.mts +3 -3
- package/dist/menu-group.d.ts +3 -3
- package/dist/menu-group.js +17 -14
- package/dist/menu-group.js.map +1 -1
- package/dist/menu-group.mjs +2 -2
- package/dist/menu-item.d.mts +14 -19
- package/dist/menu-item.d.ts +14 -19
- package/dist/menu-item.js +40 -45
- package/dist/menu-item.js.map +1 -1
- package/dist/menu-item.mjs +4 -7
- package/dist/menu-list.d.mts +2 -2
- package/dist/menu-list.d.ts +2 -2
- package/dist/menu-list.js +23 -20
- package/dist/menu-list.js.map +1 -1
- package/dist/menu-list.mjs +2 -2
- package/dist/menu-option-group.d.mts +6 -7
- package/dist/menu-option-group.d.ts +6 -7
- package/dist/menu-option-group.js +97 -100
- package/dist/menu-option-group.js.map +1 -1
- package/dist/menu-option-group.mjs +4 -3
- package/dist/menu.d.mts +7 -87
- package/dist/menu.d.ts +7 -87
- package/dist/menu.js +41 -274
- package/dist/menu.js.map +1 -1
- package/dist/menu.mjs +4 -13
- package/package.json +11 -11
- package/dist/chunk-5ZWRZF6M.mjs.map +0 -1
- package/dist/chunk-6IPLI42Z.mjs +0 -447
- package/dist/chunk-6IPLI42Z.mjs.map +0 -1
- package/dist/chunk-6YBKZRIZ.mjs.map +0 -1
- package/dist/chunk-73KHS3JD.mjs.map +0 -1
- package/dist/chunk-AG6UJA7D.mjs.map +0 -1
- package/dist/chunk-G4OMCC2Y.mjs.map +0 -1
- package/dist/chunk-ZOUBZWDN.mjs +0 -27
- package/dist/chunk-ZOUBZWDN.mjs.map +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/menu-context.ts"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\nimport type {\n Dispatch,\n KeyboardEventHandler,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { MenuOptions } from \"./menu\"\n\nexport const {\n DescendantsContextProvider,\n useDescendantsContext: useMenuDescendantsContext,\n useDescendants,\n useDescendant: useMenuDescendant,\n} = createDescendant()\n\ninterface MenuContext extends MenuOptions {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onUpstreamClose?: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<number | null>\n isNested: boolean\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [MenuProvider, useMenu] = createContext<MenuContext>({\n name: \"MenuContext\",\n errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in \"<Menu />\"`,\n})\n\ninterface ContextMenuContext {\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [ContextMenuProvider, useContextMenu] =\n createContext<ContextMenuContext>({\n strict: false,\n name: \"ContextMenuContext\",\n })\n\ninterface UpstreamMenuContext {\n relatedRef: RefObject<HTMLElement>\n onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>\n onUpstreamClose: () => void\n}\n\nexport const [UpstreamMenuProvider, useUpstreamMenu] =\n createContext<UpstreamMenuContext>({\n strict: false,\n name: \"UpstreamMenuContext\",\n })\n\ninterface UpstreamMenuItemContext {\n onUpstreamRestoreFocus: () => void\n onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>\n setDownstreamOpen: Dispatch<SetStateAction<boolean>>\n hasDownstreamRef: MutableRefObject<boolean>\n}\n\nexport const [UpstreamMenuItemProvider, useUpstreamMenuItem] =\n createContext<UpstreamMenuItemContext>({\n strict: false,\n name: \"UpstreamMenuItemContext\",\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,4BAAiC;AACjC,mBAA8B;AAUvB,IAAM;AAAA,EACX;AAAA,EACA,uBAAuB;AAAA,EACvB;AAAA,EACA,eAAe;AACjB,QAAI,wCAAiB;AAiBd,IAAM,CAAC,cAAc,OAAO,QAAI,4BAA2B;AAAA,EAChE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAMM,IAAM,CAAC,qBAAqB,cAAc,QAC/C,4BAAkC;AAAA,EAChC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AAQI,IAAM,CAAC,sBAAsB,eAAe,QACjD,4BAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AASI,IAAM,CAAC,0BAA0B,mBAAmB,QACzD,4BAAuC;AAAA,EACrC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;","names":[]}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use client"
|
2
|
+
import {
|
3
|
+
ContextMenuProvider,
|
4
|
+
DescendantsContextProvider,
|
5
|
+
MenuProvider,
|
6
|
+
UpstreamMenuItemProvider,
|
7
|
+
UpstreamMenuProvider,
|
8
|
+
useContextMenu,
|
9
|
+
useDescendants,
|
10
|
+
useMenu,
|
11
|
+
useMenuDescendant,
|
12
|
+
useMenuDescendantsContext,
|
13
|
+
useUpstreamMenu,
|
14
|
+
useUpstreamMenuItem
|
15
|
+
} from "./chunk-ZUOFHOX6.mjs";
|
16
|
+
export {
|
17
|
+
ContextMenuProvider,
|
18
|
+
DescendantsContextProvider,
|
19
|
+
MenuProvider,
|
20
|
+
UpstreamMenuItemProvider,
|
21
|
+
UpstreamMenuProvider,
|
22
|
+
useContextMenu,
|
23
|
+
useDescendants,
|
24
|
+
useMenu,
|
25
|
+
useMenuDescendant,
|
26
|
+
useMenuDescendantsContext,
|
27
|
+
useUpstreamMenu,
|
28
|
+
useUpstreamMenuItem
|
29
|
+
};
|
30
|
+
//# sourceMappingURL=menu-context.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/menu-divider.d.mts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
2
2
|
import { HTMLUIProps } from '@yamada-ui/core';
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
interface MenuDividerProps extends HTMLUIProps<"hr"> {
|
5
|
+
}
|
6
|
+
declare const MenuDivider: _yamada_ui_core.Component<"hr", MenuDividerProps>;
|
6
7
|
|
7
8
|
export { MenuDivider, type MenuDividerProps };
|
package/dist/menu-divider.d.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
2
2
|
import { HTMLUIProps } from '@yamada-ui/core';
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
interface MenuDividerProps extends HTMLUIProps<"hr"> {
|
5
|
+
}
|
6
|
+
declare const MenuDivider: _yamada_ui_core.Component<"hr", MenuDividerProps>;
|
6
7
|
|
7
8
|
export { MenuDivider, type MenuDividerProps };
|
package/dist/menu-divider.js
CHANGED
@@ -24,17 +24,12 @@ __export(menu_divider_exports, {
|
|
24
24
|
MenuDivider: () => MenuDivider
|
25
25
|
});
|
26
26
|
module.exports = __toCommonJS(menu_divider_exports);
|
27
|
-
var
|
27
|
+
var import_core = require("@yamada-ui/core");
|
28
28
|
var import_utils2 = require("@yamada-ui/utils");
|
29
29
|
|
30
|
-
// src/menu.
|
31
|
-
var import_core = require("@yamada-ui/core");
|
32
|
-
var import_popover = require("@yamada-ui/popover");
|
30
|
+
// src/menu-context.ts
|
33
31
|
var import_use_descendant = require("@yamada-ui/use-descendant");
|
34
|
-
var import_use_disclosure = require("@yamada-ui/use-disclosure");
|
35
32
|
var import_utils = require("@yamada-ui/utils");
|
36
|
-
var import_react = require("react");
|
37
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
38
33
|
var {
|
39
34
|
DescendantsContextProvider,
|
40
35
|
useDescendantsContext: useMenuDescendantsContext,
|
@@ -45,26 +40,36 @@ var [MenuProvider, useMenu] = (0, import_utils.createContext)({
|
|
45
40
|
name: "MenuContext",
|
46
41
|
errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in "<Menu />"`
|
47
42
|
});
|
43
|
+
var [ContextMenuProvider, useContextMenu] = (0, import_utils.createContext)({
|
44
|
+
strict: false,
|
45
|
+
name: "ContextMenuContext"
|
46
|
+
});
|
48
47
|
var [UpstreamMenuProvider, useUpstreamMenu] = (0, import_utils.createContext)({
|
49
48
|
strict: false,
|
50
49
|
name: "UpstreamMenuContext"
|
51
50
|
});
|
51
|
+
var [UpstreamMenuItemProvider, useUpstreamMenuItem] = (0, import_utils.createContext)({
|
52
|
+
strict: false,
|
53
|
+
name: "UpstreamMenuItemContext"
|
54
|
+
});
|
52
55
|
|
53
56
|
// src/menu-divider.tsx
|
54
|
-
var
|
55
|
-
var MenuDivider = (0,
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
57
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
58
|
+
var MenuDivider = (0, import_core.forwardRef)(
|
59
|
+
({ className, ...rest }, ref) => {
|
60
|
+
const { styles } = useMenu();
|
61
|
+
const css = { ...styles.divider };
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
63
|
+
import_core.ui.hr,
|
64
|
+
{
|
65
|
+
ref,
|
66
|
+
className: (0, import_utils2.cx)("ui-menu__divider", className),
|
67
|
+
__css: css,
|
68
|
+
...rest
|
69
|
+
}
|
70
|
+
);
|
71
|
+
}
|
72
|
+
);
|
68
73
|
// Annotate the CommonJS export names for ESM import in node:
|
69
74
|
0 && (module.exports = {
|
70
75
|
MenuDivider
|
package/dist/menu-divider.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/menu-divider.tsx","../src/menu.
|
1
|
+
{"version":3,"sources":["../src/menu-divider.tsx","../src/menu-context.ts"],"sourcesContent":["import type { HTMLUIProps, CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMenu } from \"./menu-context\"\n\nexport interface MenuDividerProps extends HTMLUIProps<\"hr\"> {}\n\nexport const MenuDivider = forwardRef<MenuDividerProps, \"hr\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = { ...styles.divider }\n\n return (\n <ui.hr\n ref={ref}\n className={cx(\"ui-menu__divider\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\nimport type {\n Dispatch,\n KeyboardEventHandler,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { MenuOptions } from \"./menu\"\n\nexport const {\n DescendantsContextProvider,\n useDescendantsContext: useMenuDescendantsContext,\n useDescendants,\n useDescendant: useMenuDescendant,\n} = createDescendant()\n\ninterface MenuContext extends MenuOptions {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onUpstreamClose?: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<number | null>\n isNested: boolean\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [MenuProvider, useMenu] = createContext<MenuContext>({\n name: \"MenuContext\",\n errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in \"<Menu />\"`,\n})\n\ninterface ContextMenuContext {\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [ContextMenuProvider, useContextMenu] =\n createContext<ContextMenuContext>({\n strict: false,\n name: \"ContextMenuContext\",\n })\n\ninterface UpstreamMenuContext {\n relatedRef: RefObject<HTMLElement>\n onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>\n onUpstreamClose: () => void\n}\n\nexport const [UpstreamMenuProvider, useUpstreamMenu] =\n createContext<UpstreamMenuContext>({\n strict: false,\n name: \"UpstreamMenuContext\",\n })\n\ninterface UpstreamMenuItemContext {\n onUpstreamRestoreFocus: () => void\n onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>\n setDownstreamOpen: Dispatch<SetStateAction<boolean>>\n hasDownstreamRef: MutableRefObject<boolean>\n}\n\nexport const [UpstreamMenuItemProvider, useUpstreamMenuItem] =\n createContext<UpstreamMenuItemContext>({\n strict: false,\n name: \"UpstreamMenuItemContext\",\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAC/B,IAAAA,gBAAmB;;;ACDnB,4BAAiC;AACjC,mBAA8B;AAUvB,IAAM;AAAA,EACX;AAAA,EACA,uBAAuB;AAAA,EACvB;AAAA,EACA,eAAe;AACjB,QAAI,wCAAiB;AAiBd,IAAM,CAAC,cAAc,OAAO,QAAI,4BAA2B;AAAA,EAChE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAMM,IAAM,CAAC,qBAAqB,cAAc,QAC/C,4BAAkC;AAAA,EAChC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AAQI,IAAM,CAAC,sBAAsB,eAAe,QACjD,4BAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AASI,IAAM,CAAC,0BAA0B,mBAAmB,QACzD,4BAAuC;AAAA,EACrC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;;;AD1DG;AAPC,IAAM,kBAAc;AAAA,EACzB,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,UAAM,EAAE,OAAO,IAAI,QAAQ;AAE3B,UAAM,MAAmB,EAAE,GAAG,OAAO,QAAQ;AAE7C,WACE;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,oBAAoB,SAAS;AAAA,QAC3C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;","names":["import_utils"]}
|
package/dist/menu-divider.mjs
CHANGED
package/dist/menu-group.d.mts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
2
2
|
import { HTMLUIProps } from '@yamada-ui/core';
|
3
3
|
|
4
|
-
|
4
|
+
interface MenuGroupProps extends HTMLUIProps<"li"> {
|
5
5
|
/**
|
6
6
|
* The label of the group.
|
7
7
|
*/
|
@@ -10,7 +10,7 @@ type MenuGroupProps = HTMLUIProps<"div"> & {
|
|
10
10
|
* Props for menu group element.
|
11
11
|
*/
|
12
12
|
labelProps?: HTMLUIProps<"span">;
|
13
|
-
}
|
14
|
-
declare const MenuGroup: _yamada_ui_core.Component<"
|
13
|
+
}
|
14
|
+
declare const MenuGroup: _yamada_ui_core.Component<"li", MenuGroupProps>;
|
15
15
|
|
16
16
|
export { MenuGroup, type MenuGroupProps };
|
package/dist/menu-group.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
2
2
|
import { HTMLUIProps } from '@yamada-ui/core';
|
3
3
|
|
4
|
-
|
4
|
+
interface MenuGroupProps extends HTMLUIProps<"li"> {
|
5
5
|
/**
|
6
6
|
* The label of the group.
|
7
7
|
*/
|
@@ -10,7 +10,7 @@ type MenuGroupProps = HTMLUIProps<"div"> & {
|
|
10
10
|
* Props for menu group element.
|
11
11
|
*/
|
12
12
|
labelProps?: HTMLUIProps<"span">;
|
13
|
-
}
|
14
|
-
declare const MenuGroup: _yamada_ui_core.Component<"
|
13
|
+
}
|
14
|
+
declare const MenuGroup: _yamada_ui_core.Component<"li", MenuGroupProps>;
|
15
15
|
|
16
16
|
export { MenuGroup, type MenuGroupProps };
|
package/dist/menu-group.js
CHANGED
@@ -24,17 +24,12 @@ __export(menu_group_exports, {
|
|
24
24
|
MenuGroup: () => MenuGroup
|
25
25
|
});
|
26
26
|
module.exports = __toCommonJS(menu_group_exports);
|
27
|
-
var
|
27
|
+
var import_core = require("@yamada-ui/core");
|
28
28
|
var import_utils2 = require("@yamada-ui/utils");
|
29
29
|
|
30
|
-
// src/menu.
|
31
|
-
var import_core = require("@yamada-ui/core");
|
32
|
-
var import_popover = require("@yamada-ui/popover");
|
30
|
+
// src/menu-context.ts
|
33
31
|
var import_use_descendant = require("@yamada-ui/use-descendant");
|
34
|
-
var import_use_disclosure = require("@yamada-ui/use-disclosure");
|
35
32
|
var import_utils = require("@yamada-ui/utils");
|
36
|
-
var import_react = require("react");
|
37
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
38
33
|
var {
|
39
34
|
DescendantsContextProvider,
|
40
35
|
useDescendantsContext: useMenuDescendantsContext,
|
@@ -45,19 +40,27 @@ var [MenuProvider, useMenu] = (0, import_utils.createContext)({
|
|
45
40
|
name: "MenuContext",
|
46
41
|
errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in "<Menu />"`
|
47
42
|
});
|
43
|
+
var [ContextMenuProvider, useContextMenu] = (0, import_utils.createContext)({
|
44
|
+
strict: false,
|
45
|
+
name: "ContextMenuContext"
|
46
|
+
});
|
48
47
|
var [UpstreamMenuProvider, useUpstreamMenu] = (0, import_utils.createContext)({
|
49
48
|
strict: false,
|
50
49
|
name: "UpstreamMenuContext"
|
51
50
|
});
|
51
|
+
var [UpstreamMenuItemProvider, useUpstreamMenuItem] = (0, import_utils.createContext)({
|
52
|
+
strict: false,
|
53
|
+
name: "UpstreamMenuItemContext"
|
54
|
+
});
|
52
55
|
|
53
56
|
// src/menu-group.tsx
|
54
|
-
var
|
55
|
-
var MenuGroup = (0,
|
57
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
58
|
+
var MenuGroup = (0, import_core.forwardRef)(
|
56
59
|
({ className, label, children, labelProps, ...rest }, ref) => {
|
57
60
|
const { styles } = useMenu();
|
58
61
|
const css = { ...styles.group };
|
59
|
-
return /* @__PURE__ */ (0,
|
60
|
-
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
63
|
+
import_core.ui.li,
|
61
64
|
{
|
62
65
|
ref,
|
63
66
|
className: (0, import_utils2.cx)("ui-menu__item", "ui-menu__item--group", className),
|
@@ -65,8 +68,8 @@ var MenuGroup = (0, import_core2.forwardRef)(
|
|
65
68
|
__css: css,
|
66
69
|
...rest,
|
67
70
|
children: [
|
68
|
-
label ? /* @__PURE__ */ (0,
|
69
|
-
|
71
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
72
|
+
import_core.ui.span,
|
70
73
|
{
|
71
74
|
className: (0, import_utils2.cx)("ui-menu__item--group-label"),
|
72
75
|
__css: styles.groupLabel,
|
@@ -74,7 +77,7 @@ var MenuGroup = (0, import_core2.forwardRef)(
|
|
74
77
|
children: label
|
75
78
|
}
|
76
79
|
) : null,
|
77
|
-
/* @__PURE__ */ (0,
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.ul, { className: "ui-menu__item__group", children })
|
78
81
|
]
|
79
82
|
}
|
80
83
|
);
|
package/dist/menu-group.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/menu-group.tsx","../src/menu.
|
1
|
+
{"version":3,"sources":["../src/menu-group.tsx","../src/menu-context.ts"],"sourcesContent":["import type { HTMLUIProps, CSSUIObject } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useMenu } from \"./menu-context\"\n\nexport interface MenuGroupProps extends HTMLUIProps<\"li\"> {\n /**\n * The label of the group.\n */\n label?: string\n /**\n * Props for menu group element.\n */\n labelProps?: HTMLUIProps<\"span\">\n}\n\nexport const MenuGroup = forwardRef<MenuGroupProps, \"li\">(\n ({ className, label, children, labelProps, ...rest }, ref) => {\n const { styles } = useMenu()\n\n const css: CSSUIObject = { ...styles.group }\n\n return (\n <ui.li\n ref={ref}\n className={cx(\"ui-menu__item\", \"ui-menu__item--group\", className)}\n role=\"group\"\n __css={css}\n {...rest}\n >\n {label ? (\n <ui.span\n className={cx(\"ui-menu__item--group-label\")}\n __css={styles.groupLabel}\n {...labelProps}\n >\n {label}\n </ui.span>\n ) : null}\n\n <ui.ul className=\"ui-menu__item__group\">{children}</ui.ul>\n </ui.li>\n )\n },\n)\n","import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { createDescendant } from \"@yamada-ui/use-descendant\"\nimport { createContext } from \"@yamada-ui/utils\"\nimport type {\n Dispatch,\n KeyboardEventHandler,\n MutableRefObject,\n RefObject,\n SetStateAction,\n} from \"react\"\nimport type { MenuOptions } from \"./menu\"\n\nexport const {\n DescendantsContextProvider,\n useDescendantsContext: useMenuDescendantsContext,\n useDescendants,\n useDescendant: useMenuDescendant,\n} = createDescendant()\n\ninterface MenuContext extends MenuOptions {\n isOpen: boolean\n onOpen: () => void\n onClose: () => void\n onUpstreamClose?: () => void\n onFocusFirstItem: () => void\n onFocusLastItem: () => void\n focusedIndex: number\n setFocusedIndex: Dispatch<SetStateAction<number>>\n menuRef: RefObject<HTMLDivElement>\n requestAnimationFrameId: MutableRefObject<number | null>\n isNested: boolean\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [MenuProvider, useMenu] = createContext<MenuContext>({\n name: \"MenuContext\",\n errorMessage: `useMenu returned is 'undefined'. Seems you forgot to wrap the components in \"<Menu />\"`,\n})\n\ninterface ContextMenuContext {\n styles: { [key: string]: CSSUIObject }\n}\n\nexport const [ContextMenuProvider, useContextMenu] =\n createContext<ContextMenuContext>({\n strict: false,\n name: \"ContextMenuContext\",\n })\n\ninterface UpstreamMenuContext {\n relatedRef: RefObject<HTMLElement>\n onDownstreamCloseMapRef: MutableRefObject<Map<string, () => void>>\n onUpstreamClose: () => void\n}\n\nexport const [UpstreamMenuProvider, useUpstreamMenu] =\n createContext<UpstreamMenuContext>({\n strict: false,\n name: \"UpstreamMenuContext\",\n })\n\ninterface UpstreamMenuItemContext {\n onUpstreamRestoreFocus: () => void\n onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>\n setDownstreamOpen: Dispatch<SetStateAction<boolean>>\n hasDownstreamRef: MutableRefObject<boolean>\n}\n\nexport const [UpstreamMenuItemProvider, useUpstreamMenuItem] =\n createContext<UpstreamMenuItemContext>({\n strict: false,\n name: \"UpstreamMenuItemContext\",\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA+B;AAC/B,IAAAA,gBAAmB;;;ACDnB,4BAAiC;AACjC,mBAA8B;AAUvB,IAAM;AAAA,EACX;AAAA,EACA,uBAAuB;AAAA,EACvB;AAAA,EACA,eAAe;AACjB,QAAI,wCAAiB;AAiBd,IAAM,CAAC,cAAc,OAAO,QAAI,4BAA2B;AAAA,EAChE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAMM,IAAM,CAAC,qBAAqB,cAAc,QAC/C,4BAAkC;AAAA,EAChC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AAQI,IAAM,CAAC,sBAAsB,eAAe,QACjD,4BAAmC;AAAA,EACjC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;AASI,IAAM,CAAC,0BAA0B,mBAAmB,QACzD,4BAAuC;AAAA,EACrC,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;;;ADjDG;AAPC,IAAM,gBAAY;AAAA,EACvB,CAAC,EAAE,WAAW,OAAO,UAAU,YAAY,GAAG,KAAK,GAAG,QAAQ;AAC5D,UAAM,EAAE,OAAO,IAAI,QAAQ;AAE3B,UAAM,MAAmB,EAAE,GAAG,OAAO,MAAM;AAE3C,WACE;AAAA,MAAC,eAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,iBAAiB,wBAAwB,SAAS;AAAA,QAChE,MAAK;AAAA,QACL,OAAO;AAAA,QACN,GAAG;AAAA,QAEH;AAAA,kBACC;AAAA,YAAC,eAAG;AAAA,YAAH;AAAA,cACC,eAAW,kBAAG,4BAA4B;AAAA,cAC1C,OAAO,OAAO;AAAA,cACb,GAAG;AAAA,cAEH;AAAA;AAAA,UACH,IACE;AAAA,UAEJ,4CAAC,eAAG,IAAH,EAAM,WAAU,wBAAwB,UAAS;AAAA;AAAA;AAAA,IACpD;AAAA,EAEJ;AACF;","names":["import_utils"]}
|
package/dist/menu-group.mjs
CHANGED
package/dist/menu-item.d.mts
CHANGED
@@ -1,17 +1,8 @@
|
|
1
1
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
2
2
|
import { HTMLUIProps } from '@yamada-ui/core';
|
3
|
-
import
|
4
|
-
import { RefObject, KeyboardEventHandler, Dispatch, SetStateAction, MutableRefObject, ReactElement } from 'react';
|
3
|
+
import { ReactElement } from 'react';
|
5
4
|
|
6
|
-
|
7
|
-
onUpstreamRestoreFocus: () => void;
|
8
|
-
onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>;
|
9
|
-
setDownstreamOpen: Dispatch<SetStateAction<boolean>>;
|
10
|
-
hasDownstreamRef: MutableRefObject<boolean>;
|
11
|
-
};
|
12
|
-
declare const UpstreamMenuItemProvider: react.Provider<UpstreamMenuItemContext>;
|
13
|
-
declare const useUpstreamMenuItem: () => UpstreamMenuItemContext;
|
14
|
-
type MenuItemOptions = {
|
5
|
+
interface MenuItemOptions {
|
15
6
|
/**
|
16
7
|
* If `true`, the menu item will be disabled.
|
17
8
|
*
|
@@ -38,10 +29,11 @@ type MenuItemOptions = {
|
|
38
29
|
* Right-aligned label text content, useful for displaying hotkeys.
|
39
30
|
*/
|
40
31
|
command?: string;
|
41
|
-
}
|
42
|
-
|
32
|
+
}
|
33
|
+
interface MenuItemProps extends HTMLUIProps<"li">, MenuItemOptions {
|
34
|
+
}
|
43
35
|
declare const MenuItem: _yamada_ui_core.Component<"li", MenuItemProps>;
|
44
|
-
|
36
|
+
interface MenuOptionItemOptions {
|
45
37
|
/**
|
46
38
|
* The menu option item icon to use.
|
47
39
|
*/
|
@@ -60,12 +52,15 @@ type MenuOptionItemOptions = {
|
|
60
52
|
* The type of the menu option item.
|
61
53
|
*/
|
62
54
|
type?: "radio" | "checkbox";
|
63
|
-
}
|
64
|
-
|
55
|
+
}
|
56
|
+
interface MenuOptionItemProps extends Omit<MenuItemProps, "icon" | "command" | "value">, MenuOptionItemOptions {
|
57
|
+
}
|
65
58
|
declare const MenuOptionItem: _yamada_ui_core.Component<"button", MenuOptionItemProps>;
|
66
|
-
|
59
|
+
interface MenuIconProps extends HTMLUIProps<"span"> {
|
60
|
+
}
|
67
61
|
declare const MenuIcon: _yamada_ui_core.Component<"span", MenuIconProps>;
|
68
|
-
|
62
|
+
interface MenuCommandProps extends HTMLUIProps<"span"> {
|
63
|
+
}
|
69
64
|
declare const MenuCommand: _yamada_ui_core.Component<"span", MenuCommandProps>;
|
70
65
|
|
71
|
-
export { MenuCommand, type MenuCommandProps, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MenuOptionItem, type MenuOptionItemProps
|
66
|
+
export { MenuCommand, type MenuCommandProps, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MenuOptionItem, type MenuOptionItemProps };
|
package/dist/menu-item.d.ts
CHANGED
@@ -1,17 +1,8 @@
|
|
1
1
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
2
2
|
import { HTMLUIProps } from '@yamada-ui/core';
|
3
|
-
import
|
4
|
-
import { RefObject, KeyboardEventHandler, Dispatch, SetStateAction, MutableRefObject, ReactElement } from 'react';
|
3
|
+
import { ReactElement } from 'react';
|
5
4
|
|
6
|
-
|
7
|
-
onUpstreamRestoreFocus: () => void;
|
8
|
-
onKeyDownRef: RefObject<KeyboardEventHandler<HTMLLIElement>>;
|
9
|
-
setDownstreamOpen: Dispatch<SetStateAction<boolean>>;
|
10
|
-
hasDownstreamRef: MutableRefObject<boolean>;
|
11
|
-
};
|
12
|
-
declare const UpstreamMenuItemProvider: react.Provider<UpstreamMenuItemContext>;
|
13
|
-
declare const useUpstreamMenuItem: () => UpstreamMenuItemContext;
|
14
|
-
type MenuItemOptions = {
|
5
|
+
interface MenuItemOptions {
|
15
6
|
/**
|
16
7
|
* If `true`, the menu item will be disabled.
|
17
8
|
*
|
@@ -38,10 +29,11 @@ type MenuItemOptions = {
|
|
38
29
|
* Right-aligned label text content, useful for displaying hotkeys.
|
39
30
|
*/
|
40
31
|
command?: string;
|
41
|
-
}
|
42
|
-
|
32
|
+
}
|
33
|
+
interface MenuItemProps extends HTMLUIProps<"li">, MenuItemOptions {
|
34
|
+
}
|
43
35
|
declare const MenuItem: _yamada_ui_core.Component<"li", MenuItemProps>;
|
44
|
-
|
36
|
+
interface MenuOptionItemOptions {
|
45
37
|
/**
|
46
38
|
* The menu option item icon to use.
|
47
39
|
*/
|
@@ -60,12 +52,15 @@ type MenuOptionItemOptions = {
|
|
60
52
|
* The type of the menu option item.
|
61
53
|
*/
|
62
54
|
type?: "radio" | "checkbox";
|
63
|
-
}
|
64
|
-
|
55
|
+
}
|
56
|
+
interface MenuOptionItemProps extends Omit<MenuItemProps, "icon" | "command" | "value">, MenuOptionItemOptions {
|
57
|
+
}
|
65
58
|
declare const MenuOptionItem: _yamada_ui_core.Component<"button", MenuOptionItemProps>;
|
66
|
-
|
59
|
+
interface MenuIconProps extends HTMLUIProps<"span"> {
|
60
|
+
}
|
67
61
|
declare const MenuIcon: _yamada_ui_core.Component<"span", MenuIconProps>;
|
68
|
-
|
62
|
+
interface MenuCommandProps extends HTMLUIProps<"span"> {
|
63
|
+
}
|
69
64
|
declare const MenuCommand: _yamada_ui_core.Component<"span", MenuCommandProps>;
|
70
65
|
|
71
|
-
export { MenuCommand, type MenuCommandProps, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MenuOptionItem, type MenuOptionItemProps
|
66
|
+
export { MenuCommand, type MenuCommandProps, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MenuOptionItem, type MenuOptionItemProps };
|