@trackunit/react-components 0.1.86 → 0.1.87
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/index.cjs +3 -3
- package/index.js +3 -3
- package/package.json +1 -1
- package/src/components/Menu/MoreMenu/MoreMenu.d.ts +2 -4
package/index.cjs
CHANGED
|
@@ -1344,8 +1344,9 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
1344
1344
|
* @param {MoreMenuProps} props - The props for the MoreMenu component
|
|
1345
1345
|
* @returns {JSX.Element} MoreMenu component
|
|
1346
1346
|
*/
|
|
1347
|
-
const MoreMenu = ({ className, dataTestId,
|
|
1347
|
+
const MoreMenu = ({ className, dataTestId, menuPlacement, iconProps = {
|
|
1348
1348
|
size: "medium",
|
|
1349
|
+
name: "EllipsisHorizontalIcon",
|
|
1349
1350
|
}, iconButtonProps = {
|
|
1350
1351
|
size: "small",
|
|
1351
1352
|
circular: true,
|
|
@@ -1353,12 +1354,11 @@ const MoreMenu = ({ className, dataTestId, dotsDirection = "horizontal", menuPla
|
|
|
1353
1354
|
color: "tertiary",
|
|
1354
1355
|
}, children, }) => {
|
|
1355
1356
|
const [actionMenuIsOpen, setActionMenuIsOpen] = React.useState(false);
|
|
1356
|
-
const dotsName = dotsDirection === "horizontal" ? "EllipsisHorizontalIcon" : "EllipsisVerticalIcon";
|
|
1357
1357
|
const actionMenuRef = React.useRef(null);
|
|
1358
1358
|
useClickOutside(actionMenuRef, () => {
|
|
1359
1359
|
setActionMenuIsOpen(false);
|
|
1360
1360
|
});
|
|
1361
|
-
return (jsxRuntime.jsx(Root$3, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxRuntime.jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsxRuntime.jsx(Icon, Object.assign({ name:
|
|
1361
|
+
return (jsxRuntime.jsx(Root$3, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxRuntime.jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsxRuntime.jsx(PopoverTrigger, { children: jsxRuntime.jsx(IconButton, Object.assign({}, iconButtonProps, { icon: iconProps.name ? jsxRuntime.jsx(Icon, Object.assign({}, iconProps, { name: iconProps.name })) : null, onClick: () => {
|
|
1362
1362
|
setActionMenuIsOpen(!actionMenuIsOpen);
|
|
1363
1363
|
} })) }), jsxRuntime.jsx(PopoverContent, { children: close => (typeof children === "function" ? children(close) : children) })] })) })));
|
|
1364
1364
|
};
|
package/index.js
CHANGED
|
@@ -1317,8 +1317,9 @@ const useTimeout = ({ onTimeout, duration }) => {
|
|
|
1317
1317
|
* @param {MoreMenuProps} props - The props for the MoreMenu component
|
|
1318
1318
|
* @returns {JSX.Element} MoreMenu component
|
|
1319
1319
|
*/
|
|
1320
|
-
const MoreMenu = ({ className, dataTestId,
|
|
1320
|
+
const MoreMenu = ({ className, dataTestId, menuPlacement, iconProps = {
|
|
1321
1321
|
size: "medium",
|
|
1322
|
+
name: "EllipsisHorizontalIcon",
|
|
1322
1323
|
}, iconButtonProps = {
|
|
1323
1324
|
size: "small",
|
|
1324
1325
|
circular: true,
|
|
@@ -1326,12 +1327,11 @@ const MoreMenu = ({ className, dataTestId, dotsDirection = "horizontal", menuPla
|
|
|
1326
1327
|
color: "tertiary",
|
|
1327
1328
|
}, children, }) => {
|
|
1328
1329
|
const [actionMenuIsOpen, setActionMenuIsOpen] = useState(false);
|
|
1329
|
-
const dotsName = dotsDirection === "horizontal" ? "EllipsisHorizontalIcon" : "EllipsisVerticalIcon";
|
|
1330
1330
|
const actionMenuRef = useRef(null);
|
|
1331
1331
|
useClickOutside(actionMenuRef, () => {
|
|
1332
1332
|
setActionMenuIsOpen(false);
|
|
1333
1333
|
});
|
|
1334
|
-
return (jsx(Root$3, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsx(PopoverTrigger, { children: jsx(IconButton, Object.assign({}, iconButtonProps, { icon: jsx(Icon, Object.assign({ name:
|
|
1334
|
+
return (jsx(Root$3, Object.assign({ ref: actionMenuRef, className: className, "data-testid": dataTestId }, { children: jsxs(Popover, Object.assign({ placement: menuPlacement }, { children: [jsx(PopoverTrigger, { children: jsx(IconButton, Object.assign({}, iconButtonProps, { icon: iconProps.name ? jsx(Icon, Object.assign({}, iconProps, { name: iconProps.name })) : null, onClick: () => {
|
|
1335
1335
|
setActionMenuIsOpen(!actionMenuIsOpen);
|
|
1336
1336
|
} })) }), jsx(PopoverContent, { children: close => (typeof children === "function" ? children(close) : children) })] })) })));
|
|
1337
1337
|
};
|
package/package.json
CHANGED
|
@@ -3,13 +3,11 @@ import { CommonProps } from "../../../common/CommonProps";
|
|
|
3
3
|
import { IconButtonProps } from "../../buttons";
|
|
4
4
|
import { IconProps } from "../../Icon/Icon";
|
|
5
5
|
import { PopoverContentChildren, PopoverPlacement } from "../../Popover";
|
|
6
|
-
export type DotsDirection = "horizontal" | "vertical";
|
|
7
6
|
export type MenuPlacement = "above" | "below";
|
|
8
|
-
type FilteredIconProps = Omit<IconProps, "name">;
|
|
7
|
+
type FilteredIconProps = Omit<IconProps, "onClick" | "name"> & Pick<Partial<IconProps>, "name">;
|
|
9
8
|
type FilteredIconButtonProps = Omit<IconButtonProps, "icon" | "onClick">;
|
|
10
9
|
export interface MoreMenuProps extends CommonProps {
|
|
11
10
|
children: PopoverContentChildren;
|
|
12
|
-
dotsDirection?: DotsDirection;
|
|
13
11
|
menuPlacement?: PopoverPlacement;
|
|
14
12
|
iconProps?: FilteredIconProps;
|
|
15
13
|
iconButtonProps?: FilteredIconButtonProps;
|
|
@@ -21,5 +19,5 @@ export interface MoreMenuProps extends CommonProps {
|
|
|
21
19
|
* @param {MoreMenuProps} props - The props for the MoreMenu component
|
|
22
20
|
* @returns {JSX.Element} MoreMenu component
|
|
23
21
|
*/
|
|
24
|
-
export declare const MoreMenu: ({ className, dataTestId,
|
|
22
|
+
export declare const MoreMenu: ({ className, dataTestId, menuPlacement, iconProps, iconButtonProps, children, }: MoreMenuProps) => JSX.Element;
|
|
25
23
|
export {};
|