@codezee/sixtify-brahma 0.2.147 → 0.2.148

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.147",
3
+ "version": "0.2.148",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hardikranpariya/sixtify-brahma.git"
@@ -1 +1 @@
1
- {"version":3,"file":"ActionButtons.d.ts","sourceRoot":"","sources":["../../src/ActionButtons/ActionButtons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAKzD,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;IAC9C,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,cAAsB,EACtB,EAAE,EACF,QAAQ,EACR,wBAAgC,EAChC,OAAe,EACf,WAAiB,GAClB,EAAE,kBAAkB,2CA2IpB"}
1
+ {"version":3,"file":"ActionButtons.d.ts","sourceRoot":"","sources":["../../src/ActionButtons/ActionButtons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAKzD,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;IAC9C,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,cAAsB,EACtB,EAAE,EACF,QAAQ,EACR,wBAAgC,EAChC,OAAe,EACf,WAAiB,GAClB,EAAE,kBAAkB,2CA8KpB"}
@@ -13,6 +13,7 @@ function ActionButtons({ buttons, justifyContent = "end", sx, buttonSx, shouldOp
13
13
  const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
14
14
  const [openMenuKey, setOpenMenuKey] = (0, react_1.useState)(null);
15
15
  const buttonRefs = (0, react_1.useRef)({});
16
+ const uniqueId = (0, react_1.useId)();
16
17
  const handleMenuOpen = (event, key) => {
17
18
  const element = event instanceof HTMLElement ? event : event.currentTarget;
18
19
  setAnchorEl(element);
@@ -22,19 +23,39 @@ function ActionButtons({ buttons, justifyContent = "end", sx, buttonSx, shouldOp
22
23
  setAnchorEl(null);
23
24
  setOpenMenuKey(null);
24
25
  };
26
+ const hasValidButton = buttons.some((button) => {
27
+ const hasVisibleMenuItems = button.menuItems?.some((item) => !item.hidden);
28
+ return (!!button.menuItems?.length &&
29
+ !button.hidden &&
30
+ !button.disabled &&
31
+ hasVisibleMenuItems);
32
+ });
33
+ const shouldRegisterShortcut = shouldOpenMenuOnShortcut && hasValidButton && !disable;
34
+ const effectiveShortcutKey = shouldRegisterShortcut
35
+ ? shortcutKey
36
+ : `disabled-${uniqueId}`;
25
37
  (0, utils_1.useGlobalKeyboardShortcut)({
26
- key: shortcutKey,
38
+ key: effectiveShortcutKey,
27
39
  modifierKeys: ["ctrl", "shift"],
28
40
  onTrigger: () => {
29
- if (shouldOpenMenuOnShortcut && !disable) {
30
- const buttonWithMenu = buttons.find((button) => !!button.menuItems?.length && !button.hidden);
31
- if (buttonWithMenu) {
32
- const buttonElement = buttonRefs.current[buttonWithMenu.key];
33
- if (buttonElement) {
34
- handleMenuOpen(buttonElement, buttonWithMenu.key);
35
- }
41
+ if (!shouldRegisterShortcut) {
42
+ return false;
43
+ }
44
+ const buttonWithMenu = buttons.find((button) => {
45
+ const hasVisibleMenuItems = button.menuItems?.some((item) => !item.hidden);
46
+ return (!!button.menuItems?.length &&
47
+ !button.hidden &&
48
+ !button.disabled &&
49
+ hasVisibleMenuItems);
50
+ });
51
+ if (buttonWithMenu) {
52
+ const buttonElement = buttonRefs.current[buttonWithMenu.key];
53
+ if (buttonElement && document.contains(buttonElement)) {
54
+ handleMenuOpen(buttonElement, buttonWithMenu.key);
55
+ return true;
36
56
  }
37
57
  }
58
+ return false;
38
59
  },
39
60
  });
40
61
  return ((0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", sx: sx, gap: "1.6rem", justifyContent: justifyContent, children: buttons
@@ -0,0 +1,9 @@
1
+ import type { BoxProps } from "@mui/material";
2
+ import type { ReactNode } from "react";
3
+ type CodeSnippetBoxProps = {
4
+ children: ReactNode;
5
+ component?: BoxProps["component"];
6
+ };
7
+ export declare const CodeSnippetBox: ({ children, component, }: CodeSnippetBoxProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=CodeSnippetBox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeSnippetBox.d.ts","sourceRoot":"","sources":["../../src/codeSnippetBox/CodeSnippetBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,0BAG5B,mBAAmB,4CAMrB,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CodeSnippetBox = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const CodeSnippetBox_styled_1 = require("./CodeSnippetBox.styled");
6
+ const CodeSnippetBox = ({ children, component = "pre", }) => {
7
+ return ((0, jsx_runtime_1.jsx)(CodeSnippetBox_styled_1.StyledCodeSnippetBox, { component: component, children: children }));
8
+ };
9
+ exports.CodeSnippetBox = CodeSnippetBox;
@@ -0,0 +1,4 @@
1
+ import type { StyledComponent } from "@emotion/styled";
2
+ import { type BoxProps } from "@mui/material";
3
+ export declare const StyledCodeSnippetBox: StyledComponent<BoxProps>;
4
+ //# sourceMappingURL=CodeSnippetBox.styled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeSnippetBox.styled.d.ts","sourceRoot":"","sources":["../../src/codeSnippetBox/CodeSnippetBox.styled.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGnD,eAAO,MAAM,oBAAoB,EAAE,eAAe,CAAC,QAAQ,CA+BzD,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StyledCodeSnippetBox = void 0;
4
+ const material_1 = require("@mui/material");
5
+ const styles_1 = require("@mui/material/styles");
6
+ exports.StyledCodeSnippetBox = (0, styles_1.styled)(material_1.Box)(({ theme, }) => {
7
+ const { app: { color }, } = theme.palette;
8
+ const { slate, iron, claude } = color;
9
+ return {
10
+ backgroundColor: slate[900],
11
+ borderRadius: "4px",
12
+ boxShadow: `0 4px 16px ${slate[800]}40`,
13
+ color: iron[600],
14
+ padding: theme.spacing(2),
15
+ fontSize: "0.85rem",
16
+ overflow: "auto",
17
+ fontFamily: "SFMono-Regular, Menlo, Monaco, Consolas, monospace",
18
+ lineHeight: 1.5,
19
+ "& code": {
20
+ fontFamily: "inherit",
21
+ },
22
+ "& pre": {
23
+ margin: 0,
24
+ fontFamily: "inherit",
25
+ },
26
+ "& ::selection": {
27
+ backgroundColor: claude[300],
28
+ color: slate[900],
29
+ },
30
+ };
31
+ });
@@ -0,0 +1,2 @@
1
+ export * from "./CodeSnippetBox";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codeSnippetBox/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,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("./CodeSnippetBox"), exports);
@@ -8,6 +8,7 @@ export * from "./Button";
8
8
  export * from "./Card";
9
9
  export * from "./CellSelectionTable";
10
10
  export * from "./Charts";
11
+ export * from "./codeSnippetBox";
11
12
  export * from "./Chips";
12
13
  export * from "./ColumnArranger";
13
14
  export * from "./ContentBox";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,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,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,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,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -24,6 +24,7 @@ __exportStar(require("./Button"), exports);
24
24
  __exportStar(require("./Card"), exports);
25
25
  __exportStar(require("./CellSelectionTable"), exports);
26
26
  __exportStar(require("./Charts"), exports);
27
+ __exportStar(require("./codeSnippetBox"), exports);
27
28
  __exportStar(require("./Chips"), exports);
28
29
  __exportStar(require("./ColumnArranger"), exports);
29
30
  __exportStar(require("./ContentBox"), exports);