@koine/react 1.1.11 → 1.1.12

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/Menu/MenuMui.js CHANGED
@@ -1,78 +1,165 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Menu = void 0;
4
- var tslib_1 = require("tslib");
5
- var jsx_runtime_1 = require("react/jsx-runtime");
6
- var react_1 = require("react");
7
- var utils_1 = require("@mui/utils");
8
- var framer_motion_1 = require("framer-motion");
9
- var MenuUnstyled_1 = require("@mui/base/MenuUnstyled");
10
- var ModalUnstyled_1 = tslib_1.__importDefault(require("@mui/base/ModalUnstyled"));
11
- var ClickAwayListener_1 = tslib_1.__importDefault(require("@mui/base/ClickAwayListener"));
12
- var react_popper_1 = require("react-popper");
13
- var clsx_1 = tslib_1.__importDefault(require("@koine/utils/clsx"));
14
- var MenuRoot = framer_motion_1.motion.div;
15
- var MenuBackdrop = function () { return (0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0" }); };
16
- exports.Menu = (0, react_1.forwardRef)(function Menu(props, ref) {
17
- var Button = props.Button, placement = props.placement, children = props.children, className = props.className, htmlAttributes = tslib_1.__rest(props, ["Button", "placement", "children", "className"]);
18
- var id = (0, react_1.useId)();
19
- var buttonRef = (0, react_1.useRef)(null);
20
- var menuActions = (0, react_1.useRef)(null);
21
- var _a = (0, react_1.useState)(null), popperElement = _a[0], setPopperElement = _a[1];
22
- var _b = (0, react_1.useState)(null), anchorEl = _b[0], setAnchorEl = _b[1];
23
- var open = Boolean(anchorEl);
24
- var styles = (0, react_popper_1.usePopper)(anchorEl, popperElement, {
25
- placement: placement,
26
- // strategy: "absolute",
27
- }).styles;
28
- var _c = (0, MenuUnstyled_1.useMenu)({
29
- listboxId: id,
30
- listboxRef: setPopperElement,
31
- // these two make the Tab key behaviour correct, closing the menu on Tab
32
- // press and re-focusing the Button trigger element
33
- open: open,
34
- onClose: function () { return setAnchorEl(null); },
35
- }), registerItem = _c.registerItem, unregisterItem = _c.unregisterItem, getListboxProps = _c.getListboxProps, getItemProps = _c.getItemProps, getItemState = _c.getItemState;
36
- var contextValue = {
37
- registerItem: registerItem,
38
- unregisterItem: unregisterItem,
39
- getItemState: getItemState,
40
- getItemProps: getItemProps,
41
- open: open,
42
- };
43
- var handleButtonClick = function (event) {
44
- if (open) {
45
- setAnchorEl(null);
46
- }
47
- else {
48
- setAnchorEl(event.currentTarget);
49
- }
50
- };
51
- var handleButtonKeyDown = function (event) {
52
- var _a;
53
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
54
- event.preventDefault();
55
- setAnchorEl(event.currentTarget);
56
- if (event.key === "ArrowUp") {
57
- (_a = menuActions.current) === null || _a === void 0 ? void 0 : _a.highlightLastItem();
58
- }
59
- }
60
- };
61
- var close = (0, utils_1.unstable_useEventCallback)(function () {
62
- var _a;
63
- setAnchorEl(null);
64
- (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
65
- });
66
- var renderChildren = (0, react_1.useMemo)(function () {
67
- var childrenProps = { close: close };
68
- return children(childrenProps);
69
- }, [children, close]);
70
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button, { ref: buttonRef, id: id, "aria-haspopup": "true", "aria-controls": open ? id : undefined, "aria-expanded": open ? "true" : undefined, onClick: handleButtonClick, onKeyDown: handleButtonKeyDown }), (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, { children: open && ((0, jsx_runtime_1.jsx)(ModalUnstyled_1.default, tslib_1.__assign({ slots: { backdrop: MenuBackdrop }, onClose: close, onBackdropClick: close, open: open }, { children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(ClickAwayListener_1.default, tslib_1.__assign({ onClickAway: close }, { children: (0, jsx_runtime_1.jsx)(MenuRoot, tslib_1.__assign({ initial: {
71
- opacity: 0,
72
- }, animate: {
73
- opacity: 1,
74
- }, exit: {
75
- opacity: 0,
76
- }, className: (0, clsx_1.default)(className), style: styles["popper"] }, htmlAttributes, getListboxProps(), { "aria-labelledby": id }, { children: (0, jsx_runtime_1.jsx)(MenuUnstyled_1.MenuUnstyledContext.Provider, tslib_1.__assign({ value: contextValue }, { children: renderChildren })) })) })) }) }))) })] }));
77
- });
78
- exports.default = exports.Menu;
2
+ // import React, { forwardRef, useId, useMemo, useRef, useState } from "react";
3
+ // import { unstable_useEventCallback as useEventCallback } from "@mui/utils";
4
+ // import {
5
+ // motion as m,
6
+ // AnimatePresence,
7
+ // type HTMLMotionProps,
8
+ // } from "framer-motion";
9
+ // import {
10
+ // useMenu,
11
+ // MenuUnstyledContext,
12
+ // type MenuUnstyledContextType,
13
+ // type MenuUnstyledActions,
14
+ // } from "@mui/base/MenuUnstyled";
15
+ // import ModalUnstyled from "@mui/base/ModalUnstyled";
16
+ // import ClickAwayListener from "@mui/base/ClickAwayListener";
17
+ // import { usePopper, type PopperChildrenProps } from "react-popper";
18
+ // import clsx from "@koine/utils/clsx";
19
+ // const MenuRoot = m.div;
20
+ // const MenuBackdrop = () => <div className="fixed inset-0" />;
21
+ // /**
22
+ // * Props we control, cannot be overriden from implementers
23
+ // */
24
+ // type MenuButtonOwnProps = {
25
+ // "aria-controls"?: string;
26
+ // "aria-haspopup": true | "true";
27
+ // "aria-expanded"?: true | "true";
28
+ // onClick: (event: React.MouseEvent<HTMLButtonElement>) => unknown;
29
+ // onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => unknown;
30
+ // };
31
+ // type MenuButtonProps = Omit<
32
+ // React.ComponentPropsWithRef<"button">,
33
+ // keyof MenuButtonOwnProps
34
+ // > &
35
+ // MenuButtonOwnProps;
36
+ // export type MenuItemsProps = {
37
+ // /**
38
+ // * Closes the parent menu
39
+ // */
40
+ // close: () => unknown;
41
+ // };
42
+ // /**
43
+ // * Props we control, cannot be overriden from implementers
44
+ // */
45
+ // type MenuOwnProps = ReturnType<typeof useMenu>["getListboxProps"] & {
46
+ // onKeyDown: (event: React.KeyboardEvent) => unknown;
47
+ // style: React.StyleHTMLAttributes<HTMLDivElement>;
48
+ // };
49
+ // export type MenuProps = Omit<
50
+ // Omit<HTMLMotionProps<"div">, "children"> & {
51
+ // placement?: PopperChildrenProps["placement"];
52
+ // Button: (props: MenuButtonProps) => JSX.Element;
53
+ // children: (props: MenuItemsProps) => React.ReactNode;
54
+ // },
55
+ // keyof MenuOwnProps
56
+ // >;
57
+ // export const Menu = forwardRef(function Menu(props: MenuProps, ref) {
58
+ // const { Button, placement, children, className, ...htmlAttributes } = props;
59
+ // const id = useId();
60
+ // const buttonRef = useRef<HTMLButtonElement>(null);
61
+ // const menuActions = useRef<MenuUnstyledActions>(null);
62
+ // const [popperElement, setPopperElement] = useState(null);
63
+ // const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
64
+ // const open = Boolean(anchorEl);
65
+ // const { styles } = usePopper(anchorEl, popperElement, {
66
+ // placement,
67
+ // // strategy: "absolute",
68
+ // });
69
+ // const {
70
+ // registerItem,
71
+ // unregisterItem,
72
+ // getListboxProps,
73
+ // getItemProps,
74
+ // getItemState,
75
+ // } = useMenu({
76
+ // listboxId: id,
77
+ // listboxRef: setPopperElement,
78
+ // // these two make the Tab key behaviour correct, closing the menu on Tab
79
+ // // press and re-focusing the Button trigger element
80
+ // open,
81
+ // onClose: () => setAnchorEl(null),
82
+ // });
83
+ // const contextValue: MenuUnstyledContextType = {
84
+ // registerItem,
85
+ // unregisterItem,
86
+ // getItemState,
87
+ // getItemProps,
88
+ // open,
89
+ // };
90
+ // const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
91
+ // if (open) {
92
+ // setAnchorEl(null);
93
+ // } else {
94
+ // setAnchorEl(event.currentTarget);
95
+ // }
96
+ // };
97
+ // const handleButtonKeyDown = (
98
+ // event: React.KeyboardEvent<HTMLButtonElement>
99
+ // ) => {
100
+ // if (event.key === "ArrowDown" || event.key === "ArrowUp") {
101
+ // event.preventDefault();
102
+ // setAnchorEl(event.currentTarget);
103
+ // if (event.key === "ArrowUp") {
104
+ // menuActions.current?.highlightLastItem();
105
+ // }
106
+ // }
107
+ // };
108
+ // const close = useEventCallback(() => {
109
+ // setAnchorEl(null);
110
+ // buttonRef.current?.focus();
111
+ // });
112
+ // const renderChildren = useMemo(() => {
113
+ // const childrenProps: MenuItemsProps = { close };
114
+ // return children(childrenProps);
115
+ // }, [children, close]);
116
+ // return (
117
+ // <>
118
+ // <Button
119
+ // ref={buttonRef}
120
+ // id={id}
121
+ // aria-haspopup="true"
122
+ // aria-controls={open ? id : undefined}
123
+ // aria-expanded={open ? "true" : undefined}
124
+ // onClick={handleButtonClick}
125
+ // onKeyDown={handleButtonKeyDown}
126
+ // />
127
+ // <AnimatePresence>
128
+ // {open && (
129
+ // <ModalUnstyled
130
+ // slots={{ backdrop: MenuBackdrop }}
131
+ // onClose={close}
132
+ // onBackdropClick={close}
133
+ // open={open}
134
+ // >
135
+ // <div>
136
+ // <ClickAwayListener onClickAway={close}>
137
+ // <MenuRoot
138
+ // initial={{
139
+ // opacity: 0,
140
+ // }}
141
+ // animate={{
142
+ // opacity: 1,
143
+ // }}
144
+ // exit={{
145
+ // opacity: 0,
146
+ // }}
147
+ // className={clsx(className)}
148
+ // style={styles["popper"]}
149
+ // {...htmlAttributes}
150
+ // {...getListboxProps()}
151
+ // aria-labelledby={id}
152
+ // >
153
+ // <MenuUnstyledContext.Provider value={contextValue}>
154
+ // {renderChildren}
155
+ // </MenuUnstyledContext.Provider>
156
+ // </MenuRoot>
157
+ // </ClickAwayListener>
158
+ // </div>
159
+ // </ModalUnstyled>
160
+ // )}
161
+ // </AnimatePresence>
162
+ // </>
163
+ // );
164
+ // });
165
+ // export default Menu;
package/Menu/MenuMui.mjs CHANGED
@@ -1,75 +1,165 @@
1
- import { __assign, __rest } from "tslib";
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { forwardRef, useId, useMemo, useRef, useState } from "react";
4
- import { unstable_useEventCallback as useEventCallback } from "@mui/utils";
5
- import { motion as m, AnimatePresence, } from "framer-motion";
6
- import { useMenu, MenuUnstyledContext, } from "@mui/base/MenuUnstyled";
7
- import ModalUnstyled from "@mui/base/ModalUnstyled";
8
- import ClickAwayListener from "@mui/base/ClickAwayListener";
9
- import { usePopper } from "react-popper";
10
- import clsx from "@koine/utils/clsx";
11
- var MenuRoot = m.div;
12
- var MenuBackdrop = function () { return _jsx("div", { className: "fixed inset-0" }); };
13
- export var Menu = forwardRef(function Menu(props, ref) {
14
- var Button = props.Button, placement = props.placement, children = props.children, className = props.className, htmlAttributes = __rest(props, ["Button", "placement", "children", "className"]);
15
- var id = useId();
16
- var buttonRef = useRef(null);
17
- var menuActions = useRef(null);
18
- var _a = useState(null), popperElement = _a[0], setPopperElement = _a[1];
19
- var _b = useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
20
- var open = Boolean(anchorEl);
21
- var styles = usePopper(anchorEl, popperElement, {
22
- placement: placement,
23
- // strategy: "absolute",
24
- }).styles;
25
- var _c = useMenu({
26
- listboxId: id,
27
- listboxRef: setPopperElement,
28
- // these two make the Tab key behaviour correct, closing the menu on Tab
29
- // press and re-focusing the Button trigger element
30
- open: open,
31
- onClose: function () { return setAnchorEl(null); },
32
- }), registerItem = _c.registerItem, unregisterItem = _c.unregisterItem, getListboxProps = _c.getListboxProps, getItemProps = _c.getItemProps, getItemState = _c.getItemState;
33
- var contextValue = {
34
- registerItem: registerItem,
35
- unregisterItem: unregisterItem,
36
- getItemState: getItemState,
37
- getItemProps: getItemProps,
38
- open: open,
39
- };
40
- var handleButtonClick = function (event) {
41
- if (open) {
42
- setAnchorEl(null);
43
- }
44
- else {
45
- setAnchorEl(event.currentTarget);
46
- }
47
- };
48
- var handleButtonKeyDown = function (event) {
49
- var _a;
50
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
51
- event.preventDefault();
52
- setAnchorEl(event.currentTarget);
53
- if (event.key === "ArrowUp") {
54
- (_a = menuActions.current) === null || _a === void 0 ? void 0 : _a.highlightLastItem();
55
- }
56
- }
57
- };
58
- var close = useEventCallback(function () {
59
- var _a;
60
- setAnchorEl(null);
61
- (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
62
- });
63
- var renderChildren = useMemo(function () {
64
- var childrenProps = { close: close };
65
- return children(childrenProps);
66
- }, [children, close]);
67
- return (_jsxs(_Fragment, { children: [_jsx(Button, { ref: buttonRef, id: id, "aria-haspopup": "true", "aria-controls": open ? id : undefined, "aria-expanded": open ? "true" : undefined, onClick: handleButtonClick, onKeyDown: handleButtonKeyDown }), _jsx(AnimatePresence, { children: open && (_jsx(ModalUnstyled, __assign({ slots: { backdrop: MenuBackdrop }, onClose: close, onBackdropClick: close, open: open }, { children: _jsx("div", { children: _jsx(ClickAwayListener, __assign({ onClickAway: close }, { children: _jsx(MenuRoot, __assign({ initial: {
68
- opacity: 0,
69
- }, animate: {
70
- opacity: 1,
71
- }, exit: {
72
- opacity: 0,
73
- }, className: clsx(className), style: styles["popper"] }, htmlAttributes, getListboxProps(), { "aria-labelledby": id }, { children: _jsx(MenuUnstyledContext.Provider, __assign({ value: contextValue }, { children: renderChildren })) })) })) }) }))) })] }));
74
- });
75
- export default Menu;
1
+ "use strict";
2
+ // import React, { forwardRef, useId, useMemo, useRef, useState } from "react";
3
+ // import { unstable_useEventCallback as useEventCallback } from "@mui/utils";
4
+ // import {
5
+ // motion as m,
6
+ // AnimatePresence,
7
+ // type HTMLMotionProps,
8
+ // } from "framer-motion";
9
+ // import {
10
+ // useMenu,
11
+ // MenuUnstyledContext,
12
+ // type MenuUnstyledContextType,
13
+ // type MenuUnstyledActions,
14
+ // } from "@mui/base/MenuUnstyled";
15
+ // import ModalUnstyled from "@mui/base/ModalUnstyled";
16
+ // import ClickAwayListener from "@mui/base/ClickAwayListener";
17
+ // import { usePopper, type PopperChildrenProps } from "react-popper";
18
+ // import clsx from "@koine/utils/clsx";
19
+ // const MenuRoot = m.div;
20
+ // const MenuBackdrop = () => <div className="fixed inset-0" />;
21
+ // /**
22
+ // * Props we control, cannot be overriden from implementers
23
+ // */
24
+ // type MenuButtonOwnProps = {
25
+ // "aria-controls"?: string;
26
+ // "aria-haspopup": true | "true";
27
+ // "aria-expanded"?: true | "true";
28
+ // onClick: (event: React.MouseEvent<HTMLButtonElement>) => unknown;
29
+ // onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => unknown;
30
+ // };
31
+ // type MenuButtonProps = Omit<
32
+ // React.ComponentPropsWithRef<"button">,
33
+ // keyof MenuButtonOwnProps
34
+ // > &
35
+ // MenuButtonOwnProps;
36
+ // export type MenuItemsProps = {
37
+ // /**
38
+ // * Closes the parent menu
39
+ // */
40
+ // close: () => unknown;
41
+ // };
42
+ // /**
43
+ // * Props we control, cannot be overriden from implementers
44
+ // */
45
+ // type MenuOwnProps = ReturnType<typeof useMenu>["getListboxProps"] & {
46
+ // onKeyDown: (event: React.KeyboardEvent) => unknown;
47
+ // style: React.StyleHTMLAttributes<HTMLDivElement>;
48
+ // };
49
+ // export type MenuProps = Omit<
50
+ // Omit<HTMLMotionProps<"div">, "children"> & {
51
+ // placement?: PopperChildrenProps["placement"];
52
+ // Button: (props: MenuButtonProps) => JSX.Element;
53
+ // children: (props: MenuItemsProps) => React.ReactNode;
54
+ // },
55
+ // keyof MenuOwnProps
56
+ // >;
57
+ // export const Menu = forwardRef(function Menu(props: MenuProps, ref) {
58
+ // const { Button, placement, children, className, ...htmlAttributes } = props;
59
+ // const id = useId();
60
+ // const buttonRef = useRef<HTMLButtonElement>(null);
61
+ // const menuActions = useRef<MenuUnstyledActions>(null);
62
+ // const [popperElement, setPopperElement] = useState(null);
63
+ // const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
64
+ // const open = Boolean(anchorEl);
65
+ // const { styles } = usePopper(anchorEl, popperElement, {
66
+ // placement,
67
+ // // strategy: "absolute",
68
+ // });
69
+ // const {
70
+ // registerItem,
71
+ // unregisterItem,
72
+ // getListboxProps,
73
+ // getItemProps,
74
+ // getItemState,
75
+ // } = useMenu({
76
+ // listboxId: id,
77
+ // listboxRef: setPopperElement,
78
+ // // these two make the Tab key behaviour correct, closing the menu on Tab
79
+ // // press and re-focusing the Button trigger element
80
+ // open,
81
+ // onClose: () => setAnchorEl(null),
82
+ // });
83
+ // const contextValue: MenuUnstyledContextType = {
84
+ // registerItem,
85
+ // unregisterItem,
86
+ // getItemState,
87
+ // getItemProps,
88
+ // open,
89
+ // };
90
+ // const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
91
+ // if (open) {
92
+ // setAnchorEl(null);
93
+ // } else {
94
+ // setAnchorEl(event.currentTarget);
95
+ // }
96
+ // };
97
+ // const handleButtonKeyDown = (
98
+ // event: React.KeyboardEvent<HTMLButtonElement>
99
+ // ) => {
100
+ // if (event.key === "ArrowDown" || event.key === "ArrowUp") {
101
+ // event.preventDefault();
102
+ // setAnchorEl(event.currentTarget);
103
+ // if (event.key === "ArrowUp") {
104
+ // menuActions.current?.highlightLastItem();
105
+ // }
106
+ // }
107
+ // };
108
+ // const close = useEventCallback(() => {
109
+ // setAnchorEl(null);
110
+ // buttonRef.current?.focus();
111
+ // });
112
+ // const renderChildren = useMemo(() => {
113
+ // const childrenProps: MenuItemsProps = { close };
114
+ // return children(childrenProps);
115
+ // }, [children, close]);
116
+ // return (
117
+ // <>
118
+ // <Button
119
+ // ref={buttonRef}
120
+ // id={id}
121
+ // aria-haspopup="true"
122
+ // aria-controls={open ? id : undefined}
123
+ // aria-expanded={open ? "true" : undefined}
124
+ // onClick={handleButtonClick}
125
+ // onKeyDown={handleButtonKeyDown}
126
+ // />
127
+ // <AnimatePresence>
128
+ // {open && (
129
+ // <ModalUnstyled
130
+ // slots={{ backdrop: MenuBackdrop }}
131
+ // onClose={close}
132
+ // onBackdropClick={close}
133
+ // open={open}
134
+ // >
135
+ // <div>
136
+ // <ClickAwayListener onClickAway={close}>
137
+ // <MenuRoot
138
+ // initial={{
139
+ // opacity: 0,
140
+ // }}
141
+ // animate={{
142
+ // opacity: 1,
143
+ // }}
144
+ // exit={{
145
+ // opacity: 0,
146
+ // }}
147
+ // className={clsx(className)}
148
+ // style={styles["popper"]}
149
+ // {...htmlAttributes}
150
+ // {...getListboxProps()}
151
+ // aria-labelledby={id}
152
+ // >
153
+ // <MenuUnstyledContext.Provider value={contextValue}>
154
+ // {renderChildren}
155
+ // </MenuUnstyledContext.Provider>
156
+ // </MenuRoot>
157
+ // </ClickAwayListener>
158
+ // </div>
159
+ // </ModalUnstyled>
160
+ // )}
161
+ // </AnimatePresence>
162
+ // </>
163
+ // );
164
+ // });
165
+ // export default Menu;
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- import { type MenuItemsProps } from "../Menu/MenuMui";
3
- import { Polymorphic } from "../typings";
4
- export type MenuItemProps = React.PropsWithChildren<Partial<MenuItemsProps>>;
5
- export declare const MenuItem: Polymorphic.ComponentForwarded<"button", MenuItemProps>;
6
- export default MenuItem;
@@ -1,18 +1,32 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MenuItem = void 0;
4
- var tslib_1 = require("tslib");
5
- var jsx_runtime_1 = require("react/jsx-runtime");
6
- var react_1 = require("react");
7
- var MenuItemUnstyled_1 = require("@mui/base/MenuItemUnstyled");
8
- // import { useMenuItem } from "./useMenuItem";
9
- var clsx_1 = tslib_1.__importDefault(require("@koine/utils/clsx"));
10
- exports.MenuItem = (0, react_1.forwardRef)(function MenuItem(props, ref) {
11
- var _a = props.as, As = _a === void 0 ? "button" : _a, children = props.children, className = props.className, disabledProp = props.disabled, other = tslib_1.__rest(props, ["as", "children", "className", "disabled"]);
12
- var _b = (0, MenuItemUnstyled_1.useMenuItem)({
13
- ref: ref,
14
- disabled: disabledProp,
15
- }), getRootProps = _b.getRootProps, disabled = _b.disabled, focusVisible = _b.focusVisible;
16
- return ((0, jsx_runtime_1.jsx)(As, tslib_1.__assign({ className: (0, clsx_1.default)(focusVisible && "", disabled && "", className) }, getRootProps(other), { children: children })));
17
- });
18
- exports.default = exports.MenuItem;
2
+ // import React, { forwardRef } from "react";
3
+ // import { useMenuItem } from "@mui/base/MenuItemUnstyled";
4
+ // // import { useMenuItem } from "./useMenuItem";
5
+ // import clsx from "@koine/utils/clsx";
6
+ // import { type MenuItemsProps } from "../Menu/MenuMui";
7
+ // import { Polymorphic } from "../typings";
8
+ // export type MenuItemProps = React.PropsWithChildren<Partial<MenuItemsProps>>;
9
+ // export const MenuItem = forwardRef(function MenuItem<
10
+ // T extends React.ElementType = "button"
11
+ // >(props: Polymorphic.Props<T, MenuItemProps>, ref: Polymorphic.Ref<T>) {
12
+ // const {
13
+ // as: As = "button",
14
+ // children,
15
+ // className,
16
+ // disabled: disabledProp,
17
+ // ...other
18
+ // } = props;
19
+ // const { getRootProps, disabled, focusVisible } = useMenuItem({
20
+ // ref,
21
+ // disabled: disabledProp,
22
+ // });
23
+ // return (
24
+ // <As
25
+ // className={clsx(focusVisible && "", disabled && "", className)}
26
+ // {...getRootProps(other)}
27
+ // >
28
+ // {children}
29
+ // </As>
30
+ // );
31
+ // }) as Polymorphic.ComponentForwarded<"button", MenuItemProps>;
32
+ // export default MenuItem;
@@ -1,15 +1,32 @@
1
- import { __assign, __rest } from "tslib";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { forwardRef } from "react";
4
- import { useMenuItem } from "@mui/base/MenuItemUnstyled";
5
- // import { useMenuItem } from "./useMenuItem";
6
- import clsx from "@koine/utils/clsx";
7
- export var MenuItem = forwardRef(function MenuItem(props, ref) {
8
- var _a = props.as, As = _a === void 0 ? "button" : _a, children = props.children, className = props.className, disabledProp = props.disabled, other = __rest(props, ["as", "children", "className", "disabled"]);
9
- var _b = useMenuItem({
10
- ref: ref,
11
- disabled: disabledProp,
12
- }), getRootProps = _b.getRootProps, disabled = _b.disabled, focusVisible = _b.focusVisible;
13
- return (_jsx(As, __assign({ className: clsx(focusVisible && "", disabled && "", className) }, getRootProps(other), { children: children })));
14
- });
15
- export default MenuItem;
1
+ "use strict";
2
+ // import React, { forwardRef } from "react";
3
+ // import { useMenuItem } from "@mui/base/MenuItemUnstyled";
4
+ // // import { useMenuItem } from "./useMenuItem";
5
+ // import clsx from "@koine/utils/clsx";
6
+ // import { type MenuItemsProps } from "../Menu/MenuMui";
7
+ // import { Polymorphic } from "../typings";
8
+ // export type MenuItemProps = React.PropsWithChildren<Partial<MenuItemsProps>>;
9
+ // export const MenuItem = forwardRef(function MenuItem<
10
+ // T extends React.ElementType = "button"
11
+ // >(props: Polymorphic.Props<T, MenuItemProps>, ref: Polymorphic.Ref<T>) {
12
+ // const {
13
+ // as: As = "button",
14
+ // children,
15
+ // className,
16
+ // disabled: disabledProp,
17
+ // ...other
18
+ // } = props;
19
+ // const { getRootProps, disabled, focusVisible } = useMenuItem({
20
+ // ref,
21
+ // disabled: disabledProp,
22
+ // });
23
+ // return (
24
+ // <As
25
+ // className={clsx(focusVisible && "", disabled && "", className)}
26
+ // {...getRootProps(other)}
27
+ // >
28
+ // {children}
29
+ // </As>
30
+ // );
31
+ // }) as Polymorphic.ComponentForwarded<"button", MenuItemProps>;
32
+ // export default MenuItem;