@codezee/sixtify-brahma 0.2.55 → 0.2.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codezee/sixtify-brahma",
3
- "version": "0.2.55",
3
+ "version": "0.2.56",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hardikranpariya/sixtify-brahma.git"
@@ -0,0 +1,8 @@
1
+ import type { StackProps } from "@mui/material";
2
+ import type { ActionButton, DataProps } from "./types";
3
+ export type ActionButtonsProps = DataProps & {
4
+ buttons: ActionButton[];
5
+ justifyContent?: StackProps["justifyContent"];
6
+ };
7
+ export declare function ActionButtons({ buttons, justifyContent, }: ActionButtonsProps): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=ActionButtons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionButtons.d.ts","sourceRoot":"","sources":["../../src/ActionButtons/ActionButtons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAKhD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG;IAC3C,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAGF,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,cAAsB,GACvB,EAAE,kBAAkB,2CAmGpB"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ActionButtons = ActionButtons;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const material_1 = require("@mui/material");
9
+ const noop_1 = __importDefault(require("lodash/noop"));
10
+ const react_1 = require("react");
11
+ const Button_1 = require("../Button");
12
+ // COMPONENT
13
+ function ActionButtons({ buttons, justifyContent = "end", }) {
14
+ const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
15
+ const [openMenuKey, setOpenMenuKey] = (0, react_1.useState)(null);
16
+ const handleMenuOpen = (event, key) => {
17
+ setAnchorEl(event.currentTarget);
18
+ setOpenMenuKey(key);
19
+ };
20
+ const handleMenuClose = () => {
21
+ setAnchorEl(null);
22
+ setOpenMenuKey(null);
23
+ };
24
+ return ((0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", gap: "1.6rem", justifyContent: justifyContent, children: buttons
25
+ .filter((button) => !button.hidden)
26
+ .map(({ menuItems, ...button }) => {
27
+ const visibleMenuItems = menuItems?.filter((menuItem) => !menuItem.hidden);
28
+ const isMenuOpen = openMenuKey === button.key;
29
+ const onClick = visibleMenuItems && visibleMenuItems.length > 0
30
+ ? (e) => handleMenuOpen(e, button.key)
31
+ : (button.onClick ?? noop_1.default);
32
+ const buttonProps = {
33
+ ...button,
34
+ dataPTag: button.dataPTag,
35
+ dataCy: button.dataCy,
36
+ onClick,
37
+ };
38
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [button.label ? ((0, jsx_runtime_1.jsx)(Button_1.Button, { ...buttonProps, children: button.label })) : ((0, jsx_runtime_1.jsx)(material_1.IconButton, { ...buttonProps, children: button.icon })), isMenuOpen && visibleMenuItems && ((0, jsx_runtime_1.jsx)(material_1.Menu, { anchorEl: anchorEl, open: Boolean(anchorEl && isMenuOpen), onClose: handleMenuClose, anchorOrigin: {
39
+ vertical: "bottom",
40
+ horizontal: button.menuPlacement === "left" ? "left" : "right",
41
+ }, children: visibleMenuItems.map((item) => {
42
+ if (item.subMenuItems && item.subMenuItems.length > 0) {
43
+ return item.subMenuItems.map((sub) => ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, {
44
+ // eslint-disable-next-line sonarjs/no-nested-functions
45
+ onClick: () => {
46
+ handleMenuClose();
47
+ sub.onClick?.();
48
+ }, children: [sub.icon, sub.label] }, sub.key)));
49
+ }
50
+ return ((0, jsx_runtime_1.jsxs)(material_1.MenuItem, { onClick: () => {
51
+ handleMenuClose();
52
+ item.onClick?.();
53
+ }, children: [item.icon, item.label] }, item.key));
54
+ }) }))] }));
55
+ }) }));
56
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./ActionButtons";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ActionButtons/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ActionButtons"), exports);
@@ -0,0 +1,42 @@
1
+ import type { MouseEventHandler, ReactNode } from "react";
2
+ export type SubMenuItem = {
3
+ key: string;
4
+ label: ReactNode;
5
+ onClick?: () => void;
6
+ icon?: ReactNode;
7
+ dataPTag?: string;
8
+ dataCy?: string;
9
+ hidden?: boolean;
10
+ };
11
+ export type MenuItem = {
12
+ key: string;
13
+ label: ReactNode;
14
+ onClick?: () => void;
15
+ icon?: ReactNode;
16
+ dataPTag?: string;
17
+ dataCy?: string;
18
+ divider?: boolean;
19
+ hidden?: boolean;
20
+ subMenuItems?: SubMenuItem[];
21
+ };
22
+ export type ActionButton = {
23
+ key: string;
24
+ label?: ReactNode;
25
+ icon?: ReactNode;
26
+ tooltip?: string;
27
+ onClick?: MouseEventHandler<HTMLButtonElement>;
28
+ menuItems?: MenuItem[];
29
+ endIcon?: ReactNode;
30
+ menuPlacement?: "left" | "right";
31
+ size?: "small" | "medium" | "large";
32
+ dataPTag?: string;
33
+ dataCy?: string;
34
+ hidden?: boolean;
35
+ disableElevation?: boolean;
36
+ [x: string]: any;
37
+ };
38
+ export type DataProps = {
39
+ dataPTag?: string;
40
+ dataCy?: string;
41
+ };
42
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ActionButtons/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC/C,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ export * from "./ActionButtons";
1
2
  export * from "./Actions";
2
3
  export * from "./AgGrid";
3
4
  export * from "./AppBar";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,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c,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ActionButtons"), exports);
17
18
  __exportStar(require("./Actions"), exports);
18
19
  __exportStar(require("./AgGrid"), exports);
19
20
  __exportStar(require("./AppBar"), exports);