@codezee/sixtify-brahma 0.2.156 → 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 (52) 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/ActionCell.d.ts +1 -1
  6. package/packages/shared-components/dist/AgGrid/ActionCell/ActionCell.d.ts.map +1 -1
  7. package/packages/shared-components/dist/AgGrid/ActionCell/ActionCell.js +15 -11
  8. package/packages/shared-components/dist/AgGrid/ActionCell/index.d.ts +3 -0
  9. package/packages/shared-components/dist/AgGrid/ActionCell/index.d.ts.map +1 -0
  10. package/packages/shared-components/dist/AgGrid/ActionCell/index.js +18 -0
  11. package/packages/shared-components/dist/AgGrid/AgGrid.d.ts +1 -1
  12. package/packages/shared-components/dist/AgGrid/AgGrid.d.ts.map +1 -1
  13. package/packages/shared-components/dist/AgGrid/AgGrid.js +2 -5
  14. package/packages/shared-components/dist/AgGrid/RedirectionCell/ClickableCell.d.ts +12 -0
  15. package/packages/shared-components/dist/AgGrid/RedirectionCell/ClickableCell.d.ts.map +1 -0
  16. package/packages/shared-components/dist/AgGrid/RedirectionCell/ClickableCell.js +28 -0
  17. package/packages/shared-components/dist/AgGrid/RedirectionCell/RedirectionCell.d.ts +13 -0
  18. package/packages/shared-components/dist/AgGrid/RedirectionCell/RedirectionCell.d.ts.map +1 -0
  19. package/packages/shared-components/dist/AgGrid/RedirectionCell/RedirectionCell.js +31 -0
  20. package/packages/shared-components/dist/AgGrid/RedirectionCell/index.d.ts +3 -0
  21. package/packages/shared-components/dist/AgGrid/RedirectionCell/index.d.ts.map +1 -0
  22. package/packages/shared-components/dist/AgGrid/RedirectionCell/index.js +18 -0
  23. package/packages/shared-components/dist/AgGrid/hooks/index.d.ts +3 -3
  24. package/packages/shared-components/dist/AgGrid/hooks/index.d.ts.map +1 -1
  25. package/packages/shared-components/dist/AgGrid/hooks/index.js +3 -3
  26. package/packages/shared-components/dist/AgGrid/hooks/useAgGridRowSelectionConfig.d.ts.map +1 -1
  27. package/packages/shared-components/dist/AgGrid/hooks/useAgGridRowSelectionConfig.js +2 -0
  28. package/packages/shared-components/dist/AgGrid/hooks/useCellEnterClick.d.ts +8 -0
  29. package/packages/shared-components/dist/AgGrid/hooks/useCellEnterClick.d.ts.map +1 -0
  30. package/packages/shared-components/dist/AgGrid/hooks/useCellEnterClick.js +39 -0
  31. package/packages/shared-components/dist/AgGrid/index.d.ts +4 -3
  32. package/packages/shared-components/dist/AgGrid/index.d.ts.map +1 -1
  33. package/packages/shared-components/dist/AgGrid/index.js +4 -3
  34. package/packages/shared-components/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  35. package/packages/shared-components/dist/Breadcrumbs/Breadcrumbs.js +8 -4
  36. package/packages/shared-components/dist/CellSelectionTable/CellSelectionTable.d.ts.map +1 -1
  37. package/packages/shared-components/dist/CellSelectionTable/CellSelectionTable.js +145 -54
  38. package/packages/shared-components/dist/FormFields/FileUpload/FileUpload.d.ts.map +1 -1
  39. package/packages/shared-components/dist/FormFields/FileUpload/FileUpload.js +14 -9
  40. package/packages/shared-components/dist/FormFields/ImageUpload/ImageUpload.d.ts.map +1 -1
  41. package/packages/shared-components/dist/FormFields/ImageUpload/ImageUpload.js +19 -6
  42. package/packages/shared-components/dist/FormFields/PhoneInputField/PhoneInputField.d.ts.map +1 -1
  43. package/packages/shared-components/dist/FormFields/PhoneInputField/PhoneInputField.js +26 -11
  44. package/packages/shared-components/dist/UserProfileMenu/UserProfileMenu.d.ts.map +1 -1
  45. package/packages/shared-components/dist/UserProfileMenu/UserProfileMenu.js +13 -16
  46. package/packages/shared-components/dist/utils/hooks/useFormFieldFocus.d.ts.map +1 -1
  47. package/packages/shared-components/dist/utils/hooks/useFormFieldFocus.js +71 -3
  48. package/packages/shared-components/dist/utils/hooks/useGlobalKeyboardShortcut.d.ts.map +1 -1
  49. package/packages/shared-components/dist/utils/hooks/useGlobalKeyboardShortcut.js +27 -0
  50. package/packages/shared-components/dist/AgGrid/hooks/useAgGridFocusManagement.d.ts +0 -2
  51. package/packages/shared-components/dist/AgGrid/hooks/useAgGridFocusManagement.d.ts.map +0 -1
  52. package/packages/shared-components/dist/AgGrid/hooks/useAgGridFocusManagement.js +0 -105
@@ -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) {
@@ -1,2 +0,0 @@
1
- export declare const useAgGridFocusManagement: (containerRef: React.RefObject<HTMLElement>) => void;
2
- //# sourceMappingURL=useAgGridFocusManagement.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAgGridFocusManagement.d.ts","sourceRoot":"","sources":["../../../src/AgGrid/hooks/useAgGridFocusManagement.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,wBAAwB,GACnC,cAAc,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,SAuJ3C,CAAC"}
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useAgGridFocusManagement = void 0;
4
- /* eslint-disable sonarjs/cognitive-complexity */
5
- /* eslint-disable sonarjs/no-nested-functions */
6
- const react_1 = require("react");
7
- const useAgGridFocusManagement = (containerRef) => {
8
- const rafRef = (0, react_1.useRef)(null);
9
- const secondHeaderCellRef = (0, react_1.useRef)(null);
10
- (0, react_1.useEffect)(() => {
11
- const container = containerRef.current;
12
- if (!container) {
13
- return;
14
- }
15
- const getSecondHeaderCell = () => {
16
- const cached = secondHeaderCellRef.current;
17
- if (cached && container.contains(cached)) {
18
- return cached;
19
- }
20
- const headerCells = container.querySelectorAll(".ag-header-cell:not(.ag-column-first)");
21
- const cell = headerCells.length > 0 ? headerCells[0] : null;
22
- secondHeaderCellRef.current = cell ?? null;
23
- return cell ?? null;
24
- };
25
- const preventUnwantedFocus = () => {
26
- if (rafRef.current !== null) {
27
- return;
28
- }
29
- rafRef.current = requestAnimationFrame(() => {
30
- rafRef.current = null;
31
- const firstHeaderCells = container.querySelectorAll(".ag-header-cell.ag-column-first:not(.ag-floating-filter)");
32
- firstHeaderCells.forEach((cell) => {
33
- if (cell.tabIndex !== -1) {
34
- cell.tabIndex = -1;
35
- }
36
- const interactiveElements = cell.querySelectorAll("input, button, select, textarea, [tabindex]:not([tabindex='-1'])");
37
- interactiveElements.forEach((el) => {
38
- if (el.tabIndex !== -1) {
39
- el.tabIndex = -1;
40
- }
41
- });
42
- });
43
- secondHeaderCellRef.current = null;
44
- });
45
- };
46
- const handleFocusRedirect = (e) => {
47
- const target = e.target;
48
- if (!container.contains(target)) {
49
- return;
50
- }
51
- const isFirstHeader = target.closest(".ag-header-cell.ag-column-first:not(.ag-floating-filter)") !== null;
52
- if (!isFirstHeader) {
53
- return;
54
- }
55
- const secondCell = getSecondHeaderCell();
56
- if (!secondCell) {
57
- return;
58
- }
59
- e.preventDefault();
60
- e.stopPropagation();
61
- requestAnimationFrame(() => {
62
- secondCell.focus();
63
- });
64
- };
65
- const observer = new MutationObserver((mutations) => {
66
- const shouldUpdate = mutations.some((mutation) => {
67
- const target = mutation.target;
68
- if (target.classList?.contains("ag-header") ||
69
- target.classList?.contains("ag-header-cell") ||
70
- target.classList?.contains("ag-header-row")) {
71
- return true;
72
- }
73
- const hasHeaderNodes = Array.from(mutation.addedNodes).some((node) => node instanceof HTMLElement &&
74
- (node.classList.contains("ag-header-cell") ||
75
- node.classList.contains("ag-header-row") ||
76
- node.querySelector(".ag-header-cell, .ag-header-row")));
77
- return hasHeaderNodes;
78
- });
79
- if (shouldUpdate) {
80
- preventUnwantedFocus();
81
- }
82
- });
83
- const header = container.querySelector(".ag-header");
84
- if (header instanceof HTMLElement) {
85
- observer.observe(header, {
86
- childList: true,
87
- subtree: true,
88
- attributes: true,
89
- attributeFilter: ["class", "tabindex"],
90
- });
91
- }
92
- observer.observe(container, { childList: true });
93
- container.addEventListener("focusin", handleFocusRedirect, true);
94
- preventUnwantedFocus();
95
- return () => {
96
- if (rafRef.current !== null) {
97
- cancelAnimationFrame(rafRef.current);
98
- }
99
- observer.disconnect();
100
- container.removeEventListener("focusin", handleFocusRedirect, true);
101
- secondHeaderCellRef.current = null;
102
- };
103
- }, [containerRef]);
104
- };
105
- exports.useAgGridFocusManagement = useAgGridFocusManagement;