@codezee/sixtify-brahma 0.2.157 → 0.2.158

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.
Files changed (30) hide show
  1. package/package.json +1 -1
  2. package/packages/shared-components/dist/AgGrid/ActionCell/ActionButtonsWrapper.d.ts +7 -0
  3. package/packages/shared-components/dist/AgGrid/ActionCell/ActionButtonsWrapper.d.ts.map +1 -0
  4. package/packages/shared-components/dist/AgGrid/ActionCell/ActionButtonsWrapper.js +122 -0
  5. package/packages/shared-components/dist/AgGrid/ActionCell/index.d.ts +3 -0
  6. package/packages/shared-components/dist/AgGrid/ActionCell/index.d.ts.map +1 -0
  7. package/packages/shared-components/dist/AgGrid/ActionCell/index.js +18 -0
  8. package/packages/shared-components/dist/AgGrid/AgGrid.d.ts +1 -1
  9. package/packages/shared-components/dist/AgGrid/AgGrid.d.ts.map +1 -1
  10. package/packages/shared-components/dist/AgGrid/AgGrid.js +1 -1
  11. package/packages/shared-components/dist/AgGrid/RedirectionCell/index.d.ts +1 -0
  12. package/packages/shared-components/dist/AgGrid/RedirectionCell/index.d.ts.map +1 -1
  13. package/packages/shared-components/dist/AgGrid/RedirectionCell/index.js +1 -0
  14. package/packages/shared-components/dist/AgGrid/index.d.ts +1 -1
  15. package/packages/shared-components/dist/AgGrid/index.d.ts.map +1 -1
  16. package/packages/shared-components/dist/AgGrid/index.js +1 -1
  17. package/packages/shared-components/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  18. package/packages/shared-components/dist/Breadcrumbs/Breadcrumbs.js +8 -4
  19. package/packages/shared-components/dist/FormFields/FileUpload/FileUpload.d.ts.map +1 -1
  20. package/packages/shared-components/dist/FormFields/FileUpload/FileUpload.js +14 -9
  21. package/packages/shared-components/dist/FormFields/ImageUpload/ImageUpload.d.ts.map +1 -1
  22. package/packages/shared-components/dist/FormFields/ImageUpload/ImageUpload.js +19 -6
  23. package/packages/shared-components/dist/FormFields/PhoneInputField/PhoneInputField.d.ts.map +1 -1
  24. package/packages/shared-components/dist/FormFields/PhoneInputField/PhoneInputField.js +26 -11
  25. package/packages/shared-components/dist/UserProfileMenu/UserProfileMenu.d.ts.map +1 -1
  26. package/packages/shared-components/dist/UserProfileMenu/UserProfileMenu.js +13 -16
  27. package/packages/shared-components/dist/utils/hooks/useFormFieldFocus.d.ts.map +1 -1
  28. package/packages/shared-components/dist/utils/hooks/useFormFieldFocus.js +71 -3
  29. package/packages/shared-components/dist/utils/hooks/useGlobalKeyboardShortcut.d.ts.map +1 -1
  30. package/packages/shared-components/dist/utils/hooks/useGlobalKeyboardShortcut.js +27 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codezee/sixtify-brahma",
3
- "version": "0.2.157",
3
+ "version": "0.2.158",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hardikranpariya/sixtify-brahma.git"
@@ -0,0 +1,7 @@
1
+ type ActionButtonsWrapperProps = {
2
+ readonly children: React.ReactNode;
3
+ readonly disabled?: boolean;
4
+ };
5
+ export declare function ActionButtonsWrapper({ children, disabled, }: Readonly<ActionButtonsWrapperProps>): import("react/jsx-runtime").JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=ActionButtonsWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionButtonsWrapper.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/ActionCell/ActionButtonsWrapper.tsx"],"names":[],"mappings":"AAEA,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,QAAQ,GACT,EAAE,QAAQ,CAAC,yBAAyB,CAAC,2CA8LrC"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionButtonsWrapper = ActionButtonsWrapper;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ function ActionButtonsWrapper({ children, disabled, }) {
7
+ const containerRef = (0, react_1.useRef)(null);
8
+ (0, react_1.useEffect)(() => {
9
+ const container = containerRef.current;
10
+ if (!container || disabled) {
11
+ return;
12
+ }
13
+ const getAllButtons = () => {
14
+ return Array.from(container.querySelectorAll("button, [role='button'], [tabindex='0']"));
15
+ };
16
+ const handleCellKeyDown = (event) => {
17
+ if (event.key !== "Enter" ||
18
+ event.shiftKey ||
19
+ event.ctrlKey ||
20
+ event.metaKey ||
21
+ event.altKey ||
22
+ disabled) {
23
+ return;
24
+ }
25
+ const activeElement = document.activeElement;
26
+ const cell = activeElement?.closest(".ag-cell");
27
+ if (!cell || !container || !cell.contains(container)) {
28
+ return;
29
+ }
30
+ const isEditing = cell.classList.contains("ag-cell-inline-editing");
31
+ if (isEditing) {
32
+ return;
33
+ }
34
+ const focusedButton = container.querySelector("button:focus, [role='button']:focus, [tabindex='0']:focus");
35
+ if (focusedButton) {
36
+ focusedButton.click();
37
+ event.preventDefault();
38
+ event.stopPropagation();
39
+ return;
40
+ }
41
+ const firstButton = container.querySelector("button, [role='button'], [tabindex='0']");
42
+ if (firstButton) {
43
+ event.preventDefault();
44
+ event.stopPropagation();
45
+ firstButton.focus();
46
+ }
47
+ };
48
+ const handleEnterOrSpace = (event, target) => {
49
+ if ((event.key === "Enter" || event.key === " ") &&
50
+ (target.tagName === "BUTTON" ||
51
+ (target.hasAttribute("role") &&
52
+ target.getAttribute("role") === "button"))) {
53
+ event.preventDefault();
54
+ event.stopPropagation();
55
+ target.click();
56
+ }
57
+ };
58
+ const handleTabForward = (event, target, allButtons, currentIndex) => {
59
+ const isLastButton = currentIndex === allButtons.length - 1;
60
+ if (isLastButton) {
61
+ event.preventDefault();
62
+ event.stopPropagation();
63
+ target.blur();
64
+ const agCell = container.closest(".ag-cell");
65
+ if (agCell) {
66
+ agCell.focus();
67
+ }
68
+ return;
69
+ }
70
+ const nextButton = allButtons[currentIndex + 1];
71
+ if (nextButton) {
72
+ event.preventDefault();
73
+ event.stopPropagation();
74
+ nextButton.focus();
75
+ }
76
+ };
77
+ const handleTabBackward = (event, target, allButtons, currentIndex) => {
78
+ const isFirstButton = currentIndex === 0;
79
+ if (isFirstButton) {
80
+ event.preventDefault();
81
+ event.stopPropagation();
82
+ target.blur();
83
+ const agCell = container.closest(".ag-cell");
84
+ if (agCell) {
85
+ agCell.focus();
86
+ }
87
+ return;
88
+ }
89
+ const previousButton = allButtons[currentIndex - 1];
90
+ if (previousButton) {
91
+ event.preventDefault();
92
+ event.stopPropagation();
93
+ previousButton.focus();
94
+ }
95
+ };
96
+ const handleButtonKeyDown = (event) => {
97
+ const target = event.target;
98
+ if (!container?.contains(target)) {
99
+ return;
100
+ }
101
+ const allButtons = getAllButtons();
102
+ const currentIndex = allButtons.indexOf(target);
103
+ handleEnterOrSpace(event, target);
104
+ if (event.key === "Tab" && !event.shiftKey && currentIndex !== -1) {
105
+ handleTabForward(event, target, allButtons, currentIndex);
106
+ }
107
+ if (event.key === "Tab" && event.shiftKey && currentIndex !== -1) {
108
+ handleTabBackward(event, target, allButtons, currentIndex);
109
+ }
110
+ };
111
+ const cell = container.closest(".ag-cell");
112
+ if (cell) {
113
+ cell.addEventListener("keydown", handleCellKeyDown, true);
114
+ container.addEventListener("keydown", handleButtonKeyDown);
115
+ return () => {
116
+ cell.removeEventListener("keydown", handleCellKeyDown, true);
117
+ container.removeEventListener("keydown", handleButtonKeyDown);
118
+ };
119
+ }
120
+ }, [disabled]);
121
+ return ((0, jsx_runtime_1.jsx)("div", { ref: containerRef, style: { display: "contents" }, children: children }));
122
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./ActionCell";
2
+ export * from "./ActionButtonsWrapper";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/ActionCell/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,18 @@
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("./ActionCell"), exports);
18
+ __exportStar(require("./ActionButtonsWrapper"), exports);
@@ -4,7 +4,7 @@ import { AgGridReact } from "ag-grid-react";
4
4
  import type { Ref } from "react";
5
5
  import "./registerAgGridModules";
6
6
  export declare const showNoRowsOverlay: (api: GridApi<unknown>) => void;
7
- export declare const defaultPageSize = 50;
7
+ export declare const defaultPageSize = 100;
8
8
  export declare const pageSizeOptions: number[];
9
9
  export type AgGridProps<T = unknown> = AgGridReactProps<T> & {
10
10
  height?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AgGrid.d.ts","sourceRoot":"","sources":["../../src/AgGrid/AgGrid.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,OAAO,EAGR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAOjC,OAAO,yBAAyB,CAAC;AAUjC,eAAO,MAAM,iBAAiB,GAAI,KAAK,OAAO,CAAC,OAAO,CAAC,KAAG,IAczD,CAAC;AAEF,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,eAAO,MAAM,eAAe,UAAqB,CAAC;AAGlD,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,KAAK,UAAU,GAAG,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,GAC5D,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;AAElE,eAAO,MAAM,MAAM,EAwPd,UAAU,CAAC"}
1
+ {"version":3,"file":"AgGrid.d.ts","sourceRoot":"","sources":["../../src/AgGrid/AgGrid.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,OAAO,EAGR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAOjC,OAAO,yBAAyB,CAAC;AAUjC,eAAO,MAAM,iBAAiB,GAAI,KAAK,OAAO,CAAC,OAAO,CAAC,KAAG,IAczD,CAAC;AAEF,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,eAAO,MAAM,eAAe,UAAqB,CAAC;AAGlD,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,KAAK,UAAU,GAAG,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,GAC5D,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;AAElE,eAAO,MAAM,MAAM,EAwPd,UAAU,CAAC"}
@@ -31,7 +31,7 @@ const showNoRowsOverlay = (api) => {
31
31
  }
32
32
  };
33
33
  exports.showNoRowsOverlay = showNoRowsOverlay;
34
- exports.defaultPageSize = 50;
34
+ exports.defaultPageSize = 100;
35
35
  exports.pageSizeOptions = [20, 50, 100, 200];
36
36
  exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
37
37
  const { layout } = (0, utils_1.useGetDeviceType)();
@@ -1,2 +1,3 @@
1
1
  export * from "./RedirectionCell";
2
+ export * from "./ClickableCell";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/RedirectionCell/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/RedirectionCell/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC"}
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./RedirectionCell"), exports);
18
+ __exportStar(require("./ClickableCell"), exports);
@@ -1,4 +1,4 @@
1
- export * from "./ActionCell/ActionCell";
1
+ export * from "./ActionCell";
2
2
  export * from "./AgGrid";
3
3
  export * from "./hooks";
4
4
  export * from "./LoadingCell";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AgGrid/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AgGrid/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -14,7 +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("./ActionCell/ActionCell"), exports);
17
+ __exportStar(require("./ActionCell"), exports);
18
18
  __exportStar(require("./AgGrid"), exports);
19
19
  __exportStar(require("./hooks"), exports);
20
20
  __exportStar(require("./LoadingCell"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,KAAK,cAAc,GAAG;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,WAAW,eAAe,4CAuErD,CAAC"}
1
+ {"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,KAAK,cAAc,GAAG;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,WAAW,eAAe,4CA0ErD,CAAC"}
@@ -25,10 +25,14 @@ const Breadcrumbs = ({ items }) => {
25
25
  }, children: items.map((item) => {
26
26
  const { icon, text, onClick } = item;
27
27
  if (onClick) {
28
- return ((0, jsx_runtime_1.jsxs)(material_1.Link, { underline: "hover", sx: { display: "flex", alignItems: "center" }, onClick: (e) => {
29
- e.preventDefault();
30
- onClick();
31
- }, href: "#", children: [icon && ((0, jsx_runtime_1.jsx)(material_1.IconButton, { sx: {
28
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { onClick: onClick, style: {
29
+ background: "none",
30
+ border: "none",
31
+ padding: 0,
32
+ cursor: "pointer",
33
+ display: "flex",
34
+ alignItems: "center",
35
+ }, children: [icon && ((0, jsx_runtime_1.jsx)(material_1.IconButton, { sx: {
32
36
  color: butterflyBlue[900],
33
37
  }, children: icon })), text && (0, jsx_runtime_1.jsx)(material_1.Typography, { children: text })] }, (0, uuid_1.v4)()));
34
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../src/FormFields/FileUpload/FileUpload.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAIrB,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC7B,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,CAAC,EACb,KAAK,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KACnD,IAAI,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,wBAAgB,UAAU,CAAC,CAAC,SAAS,WAAW,EAAE,EAChD,OAAe,EACf,QAAQ,EACR,UAAU,EACV,QAAgB,EAChB,QAAgB,EAChB,KAAK,EACL,UAAU,EACV,KAAK,EACL,SAAS,EACT,IAAS,EACT,IAAI,EACJ,QAAQ,EACR,MAA6B,EAC7B,WAAsD,EACtD,GAAG,SAAS,EACb,EAAE,eAAe,CAAC,CAAC,CAAC,2CA6RpB"}
1
+ {"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../src/FormFields/FileUpload/FileUpload.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAKrB,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC7B,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,CAAC,EACb,KAAK,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KACnD,IAAI,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,wBAAgB,UAAU,CAAC,CAAC,SAAS,WAAW,EAAE,EAChD,OAAe,EACf,QAAQ,EACR,UAAU,EACV,QAAgB,EAChB,QAAgB,EAChB,KAAK,EACL,UAAU,EACV,KAAK,EACL,SAAS,EACT,IAAS,EACT,IAAI,EACJ,QAAQ,EACR,MAA6B,EAC7B,WAAsD,EACtD,GAAG,SAAS,EACb,EAAE,eAAe,CAAC,CAAC,CAAC,2CAoSpB"}
@@ -14,14 +14,15 @@ const react_i18next_1 = require("react-i18next");
14
14
  const PadBox_1 = require("../../PadBox");
15
15
  const Svgs_1 = require("../../Svgs");
16
16
  const utils_1 = require("../../utils");
17
+ const useFormFieldFocus_1 = require("../../utils/hooks/useFormFieldFocus");
17
18
  const FileUpload_styled_1 = require("./FileUpload.styled");
18
19
  const Skeleton_1 = require("./Skeleton");
19
20
  exports.error_with_transaltion = "error_with_transaltion";
20
21
  function FileUpload({ loading = false, onChange, isDisabled, multiple = false, required = false, error, helperText, label, fileNames, size = 10, name, setError, accept = utils_1.SUPPORTED_FILE_TYPES, acceptTitle = "Only JPG, PNG, PDF files are accepted.", ...restProps }) {
21
22
  const theme = (0, material_1.useTheme)();
22
- const { red, iron, black } = theme.palette.app.color;
23
+ const { red, iron, black, butterflyBlue } = theme.palette.app.color;
23
24
  const { t } = (0, react_i18next_1.useTranslation)();
24
- const inputRef = (0, react_1.useRef)(null);
25
+ const { inputRef, setInputRef } = (0, useFormFieldFocus_1.useFormFieldFocus)();
25
26
  const dragCounter = (0, react_1.useRef)(0);
26
27
  const rafRef = (0, react_1.useRef)(null);
27
28
  const animStartRef = (0, react_1.useRef)(null);
@@ -60,9 +61,6 @@ function FileUpload({ loading = false, onChange, isDisabled, multiple = false, r
60
61
  return;
61
62
  }
62
63
  onChange(validFiles);
63
- if (inputRef.current) {
64
- inputRef.current.value = "";
65
- }
66
64
  };
67
65
  const handleFileChange = (event) => {
68
66
  const files = event.target.files;
@@ -160,8 +158,11 @@ function FileUpload({ loading = false, onChange, isDisabled, multiple = false, r
160
158
  }
161
159
  const fileArray = Array.from(files);
162
160
  processFiles(fileArray);
163
- if (inputRef.current) {
164
- inputRef.current.value = "";
161
+ };
162
+ const handleContainerKeyDown = (event) => {
163
+ if (event.key === "Enter" || event.key === " ") {
164
+ event.preventDefault();
165
+ inputRef.current?.click();
165
166
  }
166
167
  };
167
168
  if (loading) {
@@ -169,12 +170,16 @@ function FileUpload({ loading = false, onChange, isDisabled, multiple = false, r
169
170
  }
170
171
  const boxShadowIntensity = 0.08 + 0.12 * dragProgress;
171
172
  const scale = 1 + 0.02 * dragProgress;
172
- return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "5px", children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { disabled: isDisabled, required: required, children: label }), (0, jsx_runtime_1.jsx)(FileUpload_styled_1.FileUploadContainer, { onClick: () => inputRef.current?.click(), onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, error: error, disabled: isDisabled, sx: {
173
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "5px", children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { disabled: isDisabled, required: required, children: label }), (0, jsx_runtime_1.jsx)(FileUpload_styled_1.FileUploadContainer, { onClick: () => inputRef.current?.click(), onKeyDown: handleContainerKeyDown, onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, error: error, disabled: isDisabled, tabIndex: isDisabled ? -1 : 0, role: "button", "aria-label": label ?? "Upload files", sx: {
173
174
  transform: `scale(${scale})`,
174
175
  transition: "transform 30ms linear",
175
176
  boxShadow: `0 0px ${12 * dragProgress}px ${(0, material_1.alpha)(black[900], boxShadowIntensity)}`,
176
177
  cursor: isDisabled ? "not-allowed" : "pointer",
177
- }, ...restProps, children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "20px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "4px", alignItems: "center", justifyContent: "center", children: [(0, jsx_runtime_1.jsx)(FileUpload_styled_1.FileInput, { disabled: isDisabled, type: "file", accept: accept.toString(), ref: inputRef, onChange: handleFileChange, multiple: multiple }), (0, jsx_runtime_1.jsx)(Svgs_1.SvgDrop, { disabled: isDisabled }), (0, jsx_runtime_1.jsx)(material_1.Typography, { color: isDisabled ? iron[800] : "revert-layer", children: "Drag & drop files or Browse" }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", color: isDisabled ? iron[800] : "revert-layer", children: acceptTitle })] }) }) }), error && ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", sx: {
178
+ "&:focus-visible": {
179
+ outline: `2px solid ${butterflyBlue[900]}`,
180
+ outlineOffset: "2px",
181
+ },
182
+ }, ...restProps, children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "20px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "4px", alignItems: "center", justifyContent: "center", children: [(0, jsx_runtime_1.jsx)(FileUpload_styled_1.FileInput, { disabled: isDisabled, type: "file", accept: accept.toString(), ref: setInputRef, onChange: handleFileChange, multiple: multiple }), (0, jsx_runtime_1.jsx)(Svgs_1.SvgDrop, { disabled: isDisabled }), (0, jsx_runtime_1.jsx)(material_1.Typography, { color: isDisabled ? iron[800] : "revert-layer", children: "Drag & drop files or Browse" }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", color: isDisabled ? iron[800] : "revert-layer", children: acceptTitle })] }) }) }), error && ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", sx: {
178
183
  color: `${red[900]}`,
179
184
  whiteSpace: "pre",
180
185
  textWrap: "wrap",
@@ -1 +1 @@
1
- {"version":3,"file":"ImageUpload.d.ts","sourceRoot":"","sources":["../../../src/FormFields/ImageUpload/ImageUpload.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AASH,wBAAgB,WAAW,CAAC,EAC1B,OAAkB,EAClB,WAAmB,EACnB,YAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,SAAiB,EACjB,OAAe,EACf,IAAQ,EACR,QAAiC,GAClC,EAAE,gBAAgB,2CAmLlB"}
1
+ {"version":3,"file":"ImageUpload.d.ts","sourceRoot":"","sources":["../../../src/FormFields/ImageUpload/ImageUpload.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAKlD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AASH,wBAAgB,WAAW,CAAC,EAC1B,OAAkB,EAClB,WAAmB,EACnB,YAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,SAAiB,EACjB,OAAe,EACf,IAAQ,EACR,QAAiC,GAClC,EAAE,gBAAgB,2CAuMlB"}
@@ -15,15 +15,16 @@ const Button_1 = require("../../Button");
15
15
  const PadBox_1 = require("../../PadBox");
16
16
  const Toast_1 = require("../../Toast");
17
17
  const utils_1 = require("../../utils");
18
+ const useFormFieldFocus_1 = require("../../utils/hooks/useFormFieldFocus");
18
19
  const ImageUpload_styled_1 = require("./ImageUpload.styled");
19
20
  const PhotoCaptureDialog_1 = require("./PhotoCaptureDialog");
20
21
  const Skeleton_1 = require("./Skeleton");
21
22
  const imageFileType = ["image/png", "image/jpeg", "image/jpg"];
22
23
  function ImageUpload({ variant = "square", isUploading = false, defaultValue = "", onDelete, onChange, label, isCapture = false, loading = false, size = 5, subTitle = "PNG, JPEG under 5 MB", }) {
23
24
  const { t } = (0, react_i18next_1.useTranslation)();
24
- const inputRef = (0, react_1.useRef)(null);
25
25
  const [hover, setHover] = (0, react_1.useState)(false);
26
26
  const [isOpenCaptureModal, setIsOpenCaptureModal] = (0, react_1.useState)(false);
27
+ const { inputRef, setInputRef, maintainFocusAfterClose } = (0, useFormFieldFocus_1.useFormFieldFocus)(isOpenCaptureModal);
27
28
  const theme = (0, material_1.useTheme)();
28
29
  const { butterflyBlue, iron } = theme.palette.app.color;
29
30
  const handleFileChange = (event) => {
@@ -53,15 +54,20 @@ function ImageUpload({ variant = "square", isUploading = false, defaultValue = "
53
54
  const handleFileRemove = (event) => {
54
55
  event.stopPropagation();
55
56
  onDelete();
56
- if (inputRef.current) {
57
- inputRef.current.value = "";
57
+ };
58
+ const handleContainerKeyDown = (event) => {
59
+ if (event.key === "Enter" || event.key === " ") {
60
+ event.preventDefault();
61
+ if (!defaultValue) {
62
+ inputRef.current?.click();
63
+ }
58
64
  }
59
65
  };
60
66
  const { layout } = (0, utils_1.useGetDeviceType)();
61
67
  if (loading) {
62
68
  return (0, jsx_runtime_1.jsx)(Skeleton_1.Skeleton, {});
63
69
  }
64
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { flexWrap: isCapture ? "wrap" : "nowrap", gap: "20px", direction: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { onClick: () => !defaultValue && inputRef.current?.click(), onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), sx: {
70
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { flexWrap: isCapture ? "wrap" : "nowrap", gap: "20px", direction: "row", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { onClick: () => !defaultValue && inputRef.current?.click(), onKeyDown: handleContainerKeyDown, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), tabIndex: 0, role: "button", "aria-label": label ?? "Upload image", sx: {
65
71
  height: "120px",
66
72
  width: "120px",
67
73
  position: "relative",
@@ -77,6 +83,10 @@ function ImageUpload({ variant = "square", isUploading = false, defaultValue = "
77
83
  ":hover": {
78
84
  border: `2px dashed ${butterflyBlue[900]}`,
79
85
  },
86
+ ":focus-visible": {
87
+ outline: `2px solid ${butterflyBlue[900]}`,
88
+ outlineOffset: "2px",
89
+ },
80
90
  ...(variant === "circle"
81
91
  ? {
82
92
  borderRadius: "50%",
@@ -85,9 +95,12 @@ function ImageUpload({ variant = "square", isUploading = false, defaultValue = "
85
95
  },
86
96
  }
87
97
  : {}),
88
- }, children: [(0, jsx_runtime_1.jsx)("input", { type: "file", ref: inputRef, accept: imageFileType.join(","), onChange: handleFileChange, style: { display: "none" } }), hover && !!defaultValue && ((0, jsx_runtime_1.jsxs)(ImageUpload_styled_1.DarkBackgroundContainer, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => inputRef.current?.click(), children: (0, jsx_runtime_1.jsx)(icons_material_1.Edit, { sx: { color: "white" } }) }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleFileRemove, children: (0, jsx_runtime_1.jsx)(icons_material_1.Delete, { sx: { color: "white" } }) })] })), isUploading && ((0, jsx_runtime_1.jsx)(ImageUpload_styled_1.DarkBackgroundContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, { color: iron[600], children: "Processing..." }) })), defaultValue ? ((0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "2px" }, children: (0, jsx_runtime_1.jsx)("img", { alt: "", src: defaultValue, style: {
98
+ }, children: [(0, jsx_runtime_1.jsx)("input", { type: "file", ref: setInputRef, accept: imageFileType.join(","), onChange: handleFileChange, style: { display: "none" } }), hover && !!defaultValue && ((0, jsx_runtime_1.jsxs)(ImageUpload_styled_1.DarkBackgroundContainer, { children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => inputRef.current?.click(), children: (0, jsx_runtime_1.jsx)(icons_material_1.Edit, { sx: { color: "white" } }) }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleFileRemove, children: (0, jsx_runtime_1.jsx)(icons_material_1.Delete, { sx: { color: "white" } }) })] })), isUploading && ((0, jsx_runtime_1.jsx)(ImageUpload_styled_1.DarkBackgroundContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, { color: iron[600], children: "Processing..." }) })), defaultValue ? ((0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "2px" }, children: (0, jsx_runtime_1.jsx)("img", { alt: "", src: defaultValue, style: {
89
99
  width: "100%",
90
100
  height: "100%",
91
101
  objectFit: "cover",
92
- } }) })) : ((0, jsx_runtime_1.jsx)(material_1.Stack, { justifyContent: "center", alignItems: "center", sx: { height: "100%" }, children: (0, jsx_runtime_1.jsx)(PersonAddAlt_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { noWrap: true, variant: "subtitle1", fontWeight: 500, children: label }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", color: iron[800], children: subTitle })] }), isCapture && ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: () => setIsOpenCaptureModal(true), variant: "outlined", fullWidth: layout === "mobile", children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", direction: "row", children: [(0, jsx_runtime_1.jsx)(CameraAltOutlined_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", children: "Capture photo" })] }) }))] }), isOpenCaptureModal && ((0, jsx_runtime_1.jsx)(PhotoCaptureDialog_1.PhotoCaptureDialog, { onChange: onChange, isUploading: isUploading, open: isOpenCaptureModal, onClose: () => setIsOpenCaptureModal(false) }))] }));
102
+ } }) })) : ((0, jsx_runtime_1.jsx)(material_1.Stack, { justifyContent: "center", alignItems: "center", sx: { height: "100%" }, children: (0, jsx_runtime_1.jsx)(PersonAddAlt_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { noWrap: true, variant: "subtitle1", fontWeight: 500, children: label }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", color: iron[800], children: subTitle })] }), isCapture && ((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: () => setIsOpenCaptureModal(true), variant: "outlined", fullWidth: layout === "mobile", children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "10px", direction: "row", children: [(0, jsx_runtime_1.jsx)(CameraAltOutlined_1.default, {}), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", children: "Capture photo" })] }) }))] }), isOpenCaptureModal && ((0, jsx_runtime_1.jsx)(PhotoCaptureDialog_1.PhotoCaptureDialog, { onChange: onChange, isUploading: isUploading, open: isOpenCaptureModal, onClose: () => {
103
+ setIsOpenCaptureModal(false);
104
+ maintainFocusAfterClose();
105
+ } }))] }));
93
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInputField.d.ts","sourceRoot":"","sources":["../../../src/FormFields/PhoneInputField/PhoneInputField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,WAAW,IACpD,kBAAkB,CAAC,CAAC,CAAC,GACnB,IAAI,CAAC,eAAe,EAAE,MAAM,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAAG;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEN,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EACrD,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,KAAK,EACL,QAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,OAAe,EACf,WAAgB,EAChB,KAAK,EACL,UAAU,EACV,GAAG,eAAe,EACnB,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAmMzB"}
1
+ {"version":3,"file":"PhoneInputField.d.ts","sourceRoot":"","sources":["../../../src/FormFields/PhoneInputField/PhoneInputField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,WAAW,IACpD,kBAAkB,CAAC,CAAC,CAAC,GACnB,IAAI,CAAC,eAAe,EAAE,MAAM,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAAG;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEN,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EACrD,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,KAAK,EACL,QAAgB,EAChB,QAAQ,EACR,IAAI,EACJ,OAAe,EACf,WAAgB,EAChB,KAAK,EACL,UAAU,EACV,GAAG,eAAe,EACnB,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAsNzB"}
@@ -26,7 +26,7 @@ function PhoneInputField({ control, name, defaultValue, rules, label, disabled =
26
26
  const containerRef = (0, react_1.useRef)(null);
27
27
  (0, react_1.useEffect)(() => {
28
28
  const container = containerRef.current;
29
- if (!container) {
29
+ if (!container || disabled) {
30
30
  return;
31
31
  }
32
32
  const mainInput = container.querySelector("input[type='tel']");
@@ -35,6 +35,13 @@ function PhoneInputField({ control, name, defaultValue, rules, label, disabled =
35
35
  restField.ref(mainInput);
36
36
  }
37
37
  const checkDropdownState = () => {
38
+ const selectedFlag = container.querySelector(".selected-flag");
39
+ if (selectedFlag) {
40
+ selectedFlag.setAttribute("tabindex", "-1");
41
+ selectedFlag.addEventListener("focus", () => {
42
+ selectedFlag.blur();
43
+ });
44
+ }
38
45
  const dropdown = container.querySelector(".flag-dropdown.open");
39
46
  const isOpen = !!dropdown;
40
47
  setDropdownOpen(isOpen);
@@ -75,22 +82,30 @@ function PhoneInputField({ control, name, defaultValue, rules, label, disabled =
75
82
  container.removeEventListener("click", handleClick);
76
83
  document.removeEventListener("click", handleClickOutside);
77
84
  };
78
- }, [setInputRef, restField]);
85
+ }, [setInputRef, restField, disabled]);
79
86
  if (loading) {
80
87
  return (0, jsx_runtime_1.jsx)(Skeleton_1.Skeleton, { label: label, rows: rows });
81
88
  }
82
89
  return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "4px", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "5px", children: [label && ((0, jsx_runtime_1.jsx)(material_1.InputLabel, { sx: { fontSize: { xs: "14px", md: "16px" } }, required: required, disabled: disabled, children: label })), (0, jsx_runtime_1.jsx)(material_1.Box, { ref: containerRef, sx: {
83
90
  "& .phone-input-container": {
84
- "&:focus-within": {
85
- border: error
86
- ? `2px solid ${red[900]} !important`
87
- : `2px solid ${butterflyBlue[900]} !important`,
88
- },
91
+ ...(disabled
92
+ ? {}
93
+ : {
94
+ "&:focus-within": {
95
+ border: `2px solid ${butterflyBlue[900]} !important`,
96
+ },
97
+ }),
89
98
  },
90
- "& .phone-input-field:focus": {
91
- "& ~ .flag-dropdown": {
92
- borderColor: error ? red[900] : butterflyBlue[900],
93
- },
99
+ "& .phone-input-field": {
100
+ ...(disabled
101
+ ? {}
102
+ : {
103
+ "&:focus": {
104
+ "& ~ .flag-dropdown": {
105
+ borderColor: error ? red[900] : butterflyBlue[900],
106
+ },
107
+ },
108
+ }),
94
109
  },
95
110
  "& .flag-dropdown": {
96
111
  "&.open": {
@@ -1 +1 @@
1
- {"version":3,"file":"UserProfileMenu.d.ts","sourceRoot":"","sources":["../../src/UserProfileMenu/UserProfileMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAa/C,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG;IACzE,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,SAAS,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,EAAE,CAAC,EAAE,aAAa,CAAC;QACnB,OAAO,CAAC,EAAE,QAAQ,CAAC;KACpB,EAAE,CAAC;CACL,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,SAAS,GACV,EAAE,oBAAoB,2CA2ItB"}
1
+ {"version":3,"file":"UserProfileMenu.d.ts","sourceRoot":"","sources":["../../src/UserProfileMenu/UserProfileMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAa/C,OAAO,EAGL,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG;IACzE,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,SAAS,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,EAAE,CAAC,EAAE,aAAa,CAAC;QACnB,OAAO,CAAC,EAAE,QAAQ,CAAC;KACpB,EAAE,CAAC;CACL,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,SAAS,GACV,EAAE,oBAAoB,2CA0ItB"}
@@ -13,6 +13,7 @@ const utils_1 = require("../utils");
13
13
  const UserProfileMenu_styled_1 = require("./UserProfileMenu.styled");
14
14
  function UserProfileMenu({ userDetails, menuItems, }) {
15
15
  const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
16
+ const buttonRef = (0, react_1.useRef)(null);
16
17
  const { layout } = (0, utils_1.useGetDeviceType)();
17
18
  const isDesktop = layout === "desktop";
18
19
  const theme = (0, material_1.useTheme)();
@@ -21,29 +22,27 @@ function UserProfileMenu({ userDetails, menuItems, }) {
21
22
  const handleClick = (event) => {
22
23
  setAnchorEl(event.currentTarget);
23
24
  };
24
- const handleClose = () => {
25
- setAnchorEl(null);
26
- };
25
+ const handleClose = () => setAnchorEl(null);
27
26
  const { name } = userDetails;
28
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { position: "relative", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: "flex", alignItems: "center", textAlign: "center" }, children: (0, jsx_runtime_1.jsx)(UserProfileMenu_styled_1.IconButtonStyled, { onClick: handleClick, size: "small", "aria-controls": open ? "account-menu" : undefined, "aria-haspopup": "true", "aria-expanded": open ? "true" : undefined, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: 1, color: "black", children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { src: userDetails.avatar, sx: { border: `1px solid ${iron[700]}` } }), isDesktop && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { maxWidth: 150, noWrap: true, children: name }), open ? (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowUp, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowDown, {})] }))] }) }) }), (0, jsx_runtime_1.jsx)(material_1.Menu, { anchorEl: anchorEl, id: "account-menu", open: open, onClose: handleClose, onClick: handleClose, sx: {
29
- "& .MuiPaper-root": {
30
- width: "220px",
31
- },
32
- }, slotProps: {
27
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { position: "relative", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: "flex", alignItems: "center" }, children: (0, jsx_runtime_1.jsx)(UserProfileMenu_styled_1.IconButtonStyled, { ref: buttonRef, onClick: handleClick, size: "small", "aria-haspopup": "true", children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: 1, color: "black", children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { src: userDetails.avatar, sx: { border: `1px solid ${iron[700]}` } }), isDesktop && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { maxWidth: 150, noWrap: true, children: name }), open ? (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowUp, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowDown, {})] }))] }) }) }), open && ((0, jsx_runtime_1.jsx)(material_1.Popover, { open: true, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: { vertical: "bottom", horizontal: "right" }, transformOrigin: { vertical: "top", horizontal: "right" }, slotProps: {
33
28
  paper: {
34
29
  elevation: 0,
35
30
  sx: {
31
+ width: 220,
36
32
  overflow: "visible",
37
- filter: "drop-shadow(0px 2px 8px rgba(0,0,0,0.32))",
38
33
  mt: 1.5,
34
+ px: 0,
35
+ py: 0,
36
+ filter: "drop-shadow(0px 2px 8px rgba(0,0,0,0.32))",
39
37
  "& .MuiAvatar-root": {
40
38
  width: 32,
41
39
  height: 32,
42
40
  ml: -0.5,
43
41
  mr: 1,
44
42
  },
45
- "&::before": {
46
- content: "''",
43
+ "&:before": {
44
+ // eslint-disable-next-line quotes
45
+ content: '""',
47
46
  display: "block",
48
47
  position: "absolute",
49
48
  top: 0,
@@ -56,15 +55,13 @@ function UserProfileMenu({ userDetails, menuItems, }) {
56
55
  },
57
56
  },
58
57
  },
59
- }, transformOrigin: { horizontal: "right", vertical: "top" }, anchorOrigin: { horizontal: "right", vertical: "bottom" }, children: menuItems.map(({ divider = false, onClick, icon, label, sx = {}, key }) => {
60
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [divider && (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsx)(material_1.MenuItem, { onClick: () => {
58
+ }, children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { padding: "4px 0" }, children: menuItems.map(({ key, divider, label, icon, sx, onClick }) => ((0, jsx_runtime_1.jsxs)(material_1.Box, { children: [divider && (0, jsx_runtime_1.jsx)(material_1.Divider, {}), (0, jsx_runtime_1.jsx)(material_1.ListItemButton, { onClick: () => {
61
59
  if ((0, isFunction_1.default)(onClick)) {
62
60
  onClick();
63
61
  }
64
- }, children: (icon || label) && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "1px", alignItems: "center", width: "100%", flexDirection: "row", sx: { ...sx }, children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { sx: {
62
+ }, children: (icon || label) && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "16px", alignItems: "center", width: "100%", flexDirection: "row", sx: { ...sx }, children: [(0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { sx: {
65
63
  minWidth: "20px",
66
64
  alignItems: "center",
67
65
  ...sx,
68
- }, children: icon }), label && ((0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { fontSize: "15px" }, children: label }))] })) })] }, `${key}_container`));
69
- }) })] }));
66
+ }, children: icon }), label && ((0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { fontSize: "15px" }, children: label }))] })) })] }, `${key}_container`))) }) }))] }));
70
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useFormFieldFocus.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useFormFieldFocus.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS;;uBA6CtB,gBAAgB,GAAG,IAAI;;;oBAf1D,CAAC,SAAS,WAAW,uBACb,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,YACnB,MAAM,IAAI,gBACN,OAAO;EAyB1B"}
1
+ {"version":3,"file":"useFormFieldFocus.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useFormFieldFocus.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS;;uBA8GtB,gBAAgB,GAAG,IAAI;;;oBAf1D,CAAC,SAAS,WAAW,uBACb,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,YACnB,MAAM,IAAI,gBACN,OAAO;EA8C1B"}
@@ -5,6 +5,54 @@ const react_1 = require("react");
5
5
  function useFormFieldFocus(isOpen) {
6
6
  const inputRef = (0, react_1.useRef)(null);
7
7
  const shouldMaintainFocusRef = (0, react_1.useRef)(false);
8
+ const wasFocusedRef = (0, react_1.useRef)(false);
9
+ const blurTimeoutRef = (0, react_1.useRef)(null);
10
+ const [hasInputElement, setHasInputElement] = (0, react_1.useState)(false);
11
+ (0, react_1.useEffect)(() => {
12
+ const inputElement = inputRef.current;
13
+ if (!inputElement) {
14
+ return;
15
+ }
16
+ const handleFocus = () => {
17
+ if (blurTimeoutRef.current) {
18
+ clearTimeout(blurTimeoutRef.current);
19
+ blurTimeoutRef.current = null;
20
+ }
21
+ wasFocusedRef.current = true;
22
+ };
23
+ const handleBlur = () => {
24
+ if (blurTimeoutRef.current) {
25
+ clearTimeout(blurTimeoutRef.current);
26
+ }
27
+ blurTimeoutRef.current = setTimeout(() => {
28
+ if (document.activeElement !== inputRef.current) {
29
+ wasFocusedRef.current = false;
30
+ }
31
+ blurTimeoutRef.current = null;
32
+ }, 200);
33
+ };
34
+ inputElement.addEventListener("focus", handleFocus);
35
+ inputElement.addEventListener("blur", handleBlur);
36
+ return () => {
37
+ inputElement.removeEventListener("focus", handleFocus);
38
+ inputElement.removeEventListener("blur", handleBlur);
39
+ if (blurTimeoutRef.current) {
40
+ clearTimeout(blurTimeoutRef.current);
41
+ blurTimeoutRef.current = null;
42
+ }
43
+ };
44
+ }, [hasInputElement]);
45
+ (0, react_1.useEffect)(() => {
46
+ if (wasFocusedRef.current && inputRef.current) {
47
+ requestAnimationFrame(() => {
48
+ if (inputRef.current &&
49
+ document.activeElement !== inputRef.current &&
50
+ wasFocusedRef.current) {
51
+ inputRef.current.focus();
52
+ }
53
+ });
54
+ }
55
+ });
8
56
  (0, react_1.useEffect)(() => {
9
57
  if (!isOpen && shouldMaintainFocusRef.current && inputRef.current) {
10
58
  shouldMaintainFocusRef.current = false;
@@ -18,9 +66,11 @@ function useFormFieldFocus(isOpen) {
18
66
  }
19
67
  }, [isOpen]);
20
68
  const maintainFocus = (0, react_1.useCallback)(() => {
21
- requestAnimationFrame(() => {
22
- inputRef.current?.focus();
23
- });
69
+ if (inputRef.current) {
70
+ requestAnimationFrame(() => {
71
+ inputRef.current?.focus();
72
+ });
73
+ }
24
74
  }, []);
25
75
  const maintainFocusAfterClose = (0, react_1.useCallback)(() => {
26
76
  shouldMaintainFocusRef.current = true;
@@ -35,7 +85,25 @@ function useFormFieldFocus(isOpen) {
35
85
  }, [maintainFocusAfterClose]);
36
86
  const setInputRef = (0, react_1.useCallback)((ref) => {
37
87
  if (ref) {
88
+ const wasInputFocused = document.activeElement === ref ||
89
+ ref.contains(document.activeElement) ||
90
+ wasFocusedRef.current;
91
+ if (wasInputFocused && !wasFocusedRef.current) {
92
+ wasFocusedRef.current = true;
93
+ }
38
94
  inputRef.current = ref;
95
+ setHasInputElement(true);
96
+ if (wasFocusedRef.current) {
97
+ requestAnimationFrame(() => {
98
+ if (inputRef.current && document.activeElement !== inputRef.current) {
99
+ inputRef.current.focus();
100
+ }
101
+ });
102
+ }
103
+ }
104
+ else {
105
+ inputRef.current = null;
106
+ setHasInputElement(false);
39
107
  }
40
108
  }, []);
41
109
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"useGlobalKeyboardShortcut.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useGlobalKeyboardShortcut.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD,KAAK,6BAA6B,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,qDAKvC,6BAA6B,SA8E/B,CAAC"}
1
+ {"version":3,"file":"useGlobalKeyboardShortcut.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useGlobalKeyboardShortcut.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD,KAAK,6BAA6B,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAC7C,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,qDAKvC,6BAA6B,SA8H/B,CAAC"}
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.useGlobalKeyboardShortcut = void 0;
7
+ /* eslint-disable quotes */
7
8
  const castArray_1 = __importDefault(require("lodash/castArray"));
8
9
  const every_1 = __importDefault(require("lodash/every"));
9
10
  const react_1 = require("react");
@@ -11,6 +12,32 @@ const useGlobalKeyboardShortcut = ({ key, onTrigger, modifierKeys = "ctrl", with
11
12
  (0, react_1.useEffect)(() => {
12
13
  // eslint-disable-next-line sonarjs/cognitive-complexity
13
14
  const handler = (e) => {
15
+ const dialog = document.querySelector('[role="dialog"]');
16
+ if (dialog) {
17
+ return;
18
+ }
19
+ const eventTarget = e.target;
20
+ const autocompleteRoot = eventTarget?.closest(".MuiAutocomplete-root");
21
+ if (autocompleteRoot) {
22
+ const inputRoot = autocompleteRoot.querySelector(".MuiAutocomplete-inputRoot");
23
+ const isPopupOpen = inputRoot?.getAttribute("aria-expanded") === "true" ||
24
+ document.querySelector('[role="listbox"][aria-expanded="true"]') ||
25
+ document.querySelector(".MuiAutocomplete-popper[data-popper-placement]") ||
26
+ document.querySelector(".MuiAutocomplete-paper");
27
+ if (isPopupOpen) {
28
+ return;
29
+ }
30
+ }
31
+ const activeElement = document.activeElement;
32
+ const activeAutocompleteRoot = activeElement?.closest(".MuiAutocomplete-root");
33
+ if (activeAutocompleteRoot) {
34
+ const activeInputRoot = activeAutocompleteRoot.querySelector(".MuiAutocomplete-inputRoot");
35
+ const isActivePopupOpen = activeInputRoot?.getAttribute("aria-expanded") === "true" ||
36
+ document.querySelector('[role="listbox"][aria-expanded="true"]');
37
+ if (isActivePopupOpen) {
38
+ return;
39
+ }
40
+ }
14
41
  const normalizedCode = key.length === 1 ? `Key${key.toUpperCase()}` : key;
15
42
  const keyMatch = e.code?.toLowerCase() === normalizedCode?.toLowerCase();
16
43
  if (withoutModifiers) {