@elliemae/ds-shuttle-v2 3.14.2 → 3.15.0-rc.1

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 (111) hide show
  1. package/dist/cjs/config/DSShuttleV2Definitions.js +1 -2
  2. package/dist/cjs/config/DSShuttleV2Definitions.js.map +2 -2
  3. package/dist/cjs/config/itemMovementHelpers.js +52 -29
  4. package/dist/cjs/config/itemMovementHelpers.js.map +2 -2
  5. package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js +9 -6
  6. package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js.map +2 -2
  7. package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js +49 -16
  8. package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js.map +2 -2
  9. package/dist/cjs/config/useFocusTracker/useFocusRegionTrackers.js +5 -1
  10. package/dist/cjs/config/useFocusTracker/useFocusRegionTrackers.js.map +2 -2
  11. package/dist/cjs/config/useStore/createAtomInStore.bak +18 -0
  12. package/dist/cjs/config/useStore/useStore.js +0 -13
  13. package/dist/cjs/config/useStore/useStore.js.map +3 -3
  14. package/dist/cjs/constants/index.js +3 -1
  15. package/dist/cjs/constants/index.js.map +2 -2
  16. package/dist/cjs/parts/Dnd/DndHandle.js +1 -5
  17. package/dist/cjs/parts/Dnd/DndHandle.js.map +2 -2
  18. package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js +12 -14
  19. package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
  20. package/dist/cjs/parts/Item/Item.js +38 -39
  21. package/dist/cjs/parts/Item/Item.js.map +2 -2
  22. package/dist/cjs/parts/Item/ItemActions/ItemActions.js +3 -3
  23. package/dist/cjs/parts/Item/ItemActions/ItemActions.js.map +2 -2
  24. package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js +23 -8
  25. package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js.map +2 -2
  26. package/dist/cjs/parts/Item/ItemOverlay.js +1 -2
  27. package/dist/cjs/parts/Item/ItemOverlay.js.map +2 -2
  28. package/dist/cjs/parts/Item/useItemArrowNavigation.js +22 -7
  29. package/dist/cjs/parts/Item/useItemArrowNavigation.js.map +2 -2
  30. package/dist/cjs/parts/Item/useSelectionLogic.js +1 -1
  31. package/dist/cjs/parts/Item/useSelectionLogic.js.map +2 -2
  32. package/dist/cjs/parts/MainContent.js +2 -2
  33. package/dist/cjs/parts/MainContent.js.map +2 -2
  34. package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js +8 -2
  35. package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
  36. package/dist/cjs/parts/Panel/bottom/useInnerRefHandlers.js +12 -7
  37. package/dist/cjs/parts/Panel/bottom/useInnerRefHandlers.js.map +2 -2
  38. package/dist/cjs/parts/Panel/middle/ItemListWrapper/Index.js +12 -3
  39. package/dist/cjs/parts/Panel/middle/ItemListWrapper/Index.js.map +2 -2
  40. package/dist/cjs/parts/Panel/middle/MultipleSelectionAction.js +7 -3
  41. package/dist/cjs/parts/Panel/middle/MultipleSelectionAction.js.map +2 -2
  42. package/dist/cjs/parts/Panel/middle/PanelContentMiddleSection.js +19 -21
  43. package/dist/cjs/parts/Panel/middle/PanelContentMiddleSection.js.map +2 -2
  44. package/dist/cjs/parts/Panel/top/SelectionHeader.js +3 -3
  45. package/dist/cjs/parts/Panel/top/SelectionHeader.js.map +2 -2
  46. package/dist/esm/config/DSShuttleV2Definitions.js +1 -2
  47. package/dist/esm/config/DSShuttleV2Definitions.js.map +2 -2
  48. package/dist/esm/config/itemMovementHelpers.js +53 -30
  49. package/dist/esm/config/itemMovementHelpers.js.map +2 -2
  50. package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js +9 -6
  51. package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js.map +2 -2
  52. package/dist/esm/config/useFocusTracker/useFocusItemTracker.js +49 -16
  53. package/dist/esm/config/useFocusTracker/useFocusItemTracker.js.map +2 -2
  54. package/dist/esm/config/useFocusTracker/useFocusRegionTrackers.js +5 -1
  55. package/dist/esm/config/useFocusTracker/useFocusRegionTrackers.js.map +2 -2
  56. package/dist/esm/config/useStore/createAtomInStore.bak +18 -0
  57. package/dist/esm/config/useStore/useStore.js +0 -13
  58. package/dist/esm/config/useStore/useStore.js.map +2 -2
  59. package/dist/esm/constants/index.js +3 -1
  60. package/dist/esm/constants/index.js.map +2 -2
  61. package/dist/esm/parts/Dnd/DndHandle.js +1 -5
  62. package/dist/esm/parts/Dnd/DndHandle.js.map +2 -2
  63. package/dist/esm/parts/HoC/withConditionalDnDRowContext.js +12 -14
  64. package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
  65. package/dist/esm/parts/Item/Item.js +38 -39
  66. package/dist/esm/parts/Item/Item.js.map +2 -2
  67. package/dist/esm/parts/Item/ItemActions/ItemActions.js +3 -3
  68. package/dist/esm/parts/Item/ItemActions/ItemActions.js.map +2 -2
  69. package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js +23 -8
  70. package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js.map +2 -2
  71. package/dist/esm/parts/Item/ItemOverlay.js +1 -2
  72. package/dist/esm/parts/Item/ItemOverlay.js.map +2 -2
  73. package/dist/esm/parts/Item/useItemArrowNavigation.js +22 -7
  74. package/dist/esm/parts/Item/useItemArrowNavigation.js.map +2 -2
  75. package/dist/esm/parts/Item/useSelectionLogic.js +1 -1
  76. package/dist/esm/parts/Item/useSelectionLogic.js.map +2 -2
  77. package/dist/esm/parts/MainContent.js +3 -3
  78. package/dist/esm/parts/MainContent.js.map +2 -2
  79. package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js +8 -2
  80. package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
  81. package/dist/esm/parts/Panel/bottom/useInnerRefHandlers.js +12 -7
  82. package/dist/esm/parts/Panel/bottom/useInnerRefHandlers.js.map +2 -2
  83. package/dist/esm/parts/Panel/middle/ItemListWrapper/Index.js +13 -4
  84. package/dist/esm/parts/Panel/middle/ItemListWrapper/Index.js.map +2 -2
  85. package/dist/esm/parts/Panel/middle/MultipleSelectionAction.js +7 -3
  86. package/dist/esm/parts/Panel/middle/MultipleSelectionAction.js.map +2 -2
  87. package/dist/esm/parts/Panel/middle/PanelContentMiddleSection.js +19 -21
  88. package/dist/esm/parts/Panel/middle/PanelContentMiddleSection.js.map +2 -2
  89. package/dist/esm/parts/Panel/top/SelectionHeader.js +4 -4
  90. package/dist/esm/parts/Panel/top/SelectionHeader.js.map +2 -2
  91. package/dist/types/config/DSShuttleV2Definitions.d.ts +0 -1
  92. package/dist/types/config/useFocusTracker/useFocusActionTrackers.d.ts +2 -0
  93. package/dist/types/config/useFocusTracker/useFocusItemTracker.d.ts +6 -2
  94. package/dist/types/config/useFocusTracker/useFocusRegionTrackers.d.ts +2 -0
  95. package/dist/types/config/useFocusTracker/useFocusTracker.d.ts +8 -2
  96. package/dist/types/config/useStore/useStore.d.ts +57 -33
  97. package/dist/types/constants/index.d.ts +3 -1
  98. package/dist/types/parts/Dnd/DndHandle.d.ts +3 -3
  99. package/dist/types/parts/Item/ItemActions/useInnerRefHandlers.d.ts +2 -0
  100. package/dist/types/parts/Panel/bottom/useInnerRefHandlers.d.ts +1 -0
  101. package/package.json +17 -17
  102. package/dist/cjs/config/useStore/focusAndTabIndexManager.js +0 -73
  103. package/dist/cjs/config/useStore/focusAndTabIndexManager.js.map +0 -7
  104. package/dist/cjs/config/useStore/types.js +0 -24
  105. package/dist/cjs/config/useStore/types.js.map +0 -7
  106. package/dist/esm/config/useStore/focusAndTabIndexManager.js +0 -47
  107. package/dist/esm/config/useStore/focusAndTabIndexManager.js.map +0 -7
  108. package/dist/esm/config/useStore/types.js +0 -2
  109. package/dist/esm/config/useStore/types.js.map +0 -7
  110. package/dist/types/config/useStore/focusAndTabIndexManager.d.ts +0 -10
  111. package/dist/types/config/useStore/types.d.ts +0 -28
@@ -62,8 +62,7 @@ const DSShuttleV2Slots = {
62
62
  AREA_SEARCH_WRAPPER: "area-search-wrapper",
63
63
  AREA_SEARCH_BAR: "area-search-bar",
64
64
  AREA_SELECTION_HEADER: "area-selection-header",
65
- AREA_SELECTION_HEADER_COUNT_LABEL: "area-selection-header-count-label",
66
- DRAG_AND_DROP_HANDLE: "drag-and-drop-handle"
65
+ AREA_SELECTION_HEADER_COUNT_LABEL: "area-selection-header-count-label"
67
66
  };
68
67
  const DSShuttleV2DataTestIds = (0, import_ds_system.slotObjectToDataTestIds)(DSShuttleV2Name, DSShuttleV2Slots);
69
68
  //# sourceMappingURL=DSShuttleV2Definitions.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/config/DSShuttleV2Definitions.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSShuttleV2Name = 'DSShuttleV2' as const;\n\nexport const DSShuttleV2Slots = {\n HEADER_SEARCH_ICON: 'header-search-icon',\n WRAPPER: 'wrapper',\n PANEL_WRAPPER: 'panel-wrapper',\n LIST_WRAPPER: 'list-wrapper',\n ITEM_WRAPPER: 'item-wrapper',\n ITEM_ICON_WRAPPER: 'item-icon-wrapper',\n ITEM_LABEL_WRAPPER: 'item-label-wrapper',\n ITEM_MIDSECTION_WRAPPER: 'item-midsection-wrapper',\n ITEM_SELECTION: 'item-selection',\n ITEM_ACTIONS_WRAPPER: 'item-actions-wrapper',\n ITEM_ACTION_WRAPPER: 'item-action-wrapper',\n ITEM_ACTION_BTN: 'item-action-btn',\n ITEM_ACTION_BTN_DRILLDOWN_ICON: 'item-action-btn-drilldown-icon',\n ITEM_ACTION_BTN_TO_SOURCE_ICON: 'item-action-btn-to-source-icon',\n ITEM_ACTION_BTN_TO_DESTINATION_ICON: 'item-action-btn-to-destination-icon',\n LIST_BOTTOM_LOADING_MORE: 'list-bottom-loading-more',\n LIST_BOTTOM_LOAD_MORE_BTN: 'list-bottom-load-more-btn',\n LIST_WRAPPER_BOTTOM: 'list-wrapper-bottom',\n EMPTY_LIST_WRAPPER: 'empty-list-wrapper',\n ITEMS_WRAPPER: 'items-wrapper',\n LOADING_LIST_WRAPPER: 'loading-list-wrapper',\n MOVE_MULTIPLE_WRAPPER: 'move-multiple-wrapper',\n MOVE_MULTIPLE_BTN: 'move-multiple-btn',\n LIST_WRAPPER_MID: 'list-wrapper-mid',\n LIST_WRAPPER_MID_SCROLLER: 'list-wrapper-mid-scroller',\n LIST_WRAPPER_TOP: 'list-wrapper-top',\n AREA_SEARCH_WRAPPER: 'area-search-wrapper',\n AREA_SEARCH_BAR: 'area-search-bar',\n AREA_SELECTION_HEADER: 'area-selection-header',\n AREA_SELECTION_HEADER_COUNT_LABEL: 'area-selection-header-count-label',\n DRAG_AND_DROP_HANDLE: 'drag-and-drop-handle',\n} as const;\n\nexport const DSShuttleV2DataTestIds = slotObjectToDataTestIds(DSShuttleV2Name, DSShuttleV2Slots);\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,kBAAkB;AAExB,MAAM,mBAAmB;AAAA,EAC9B,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,eAAe;AAAA,EACf,cAAc;AAAA,EACd,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,gCAAgC;AAAA,EAChC,gCAAgC;AAAA,EAChC,qCAAqC;AAAA,EACrC,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,mCAAmC;AAAA,EACnC,sBAAsB;AACxB;AAEO,MAAM,6BAAyB,0CAAwB,iBAAiB,gBAAgB;",
4
+ "sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSShuttleV2Name = 'DSShuttleV2' as const;\n\nexport const DSShuttleV2Slots = {\n HEADER_SEARCH_ICON: 'header-search-icon',\n WRAPPER: 'wrapper',\n PANEL_WRAPPER: 'panel-wrapper',\n LIST_WRAPPER: 'list-wrapper',\n ITEM_WRAPPER: 'item-wrapper',\n ITEM_ICON_WRAPPER: 'item-icon-wrapper',\n ITEM_LABEL_WRAPPER: 'item-label-wrapper',\n ITEM_MIDSECTION_WRAPPER: 'item-midsection-wrapper',\n ITEM_SELECTION: 'item-selection',\n ITEM_ACTIONS_WRAPPER: 'item-actions-wrapper',\n ITEM_ACTION_WRAPPER: 'item-action-wrapper',\n ITEM_ACTION_BTN: 'item-action-btn',\n ITEM_ACTION_BTN_DRILLDOWN_ICON: 'item-action-btn-drilldown-icon',\n ITEM_ACTION_BTN_TO_SOURCE_ICON: 'item-action-btn-to-source-icon',\n ITEM_ACTION_BTN_TO_DESTINATION_ICON: 'item-action-btn-to-destination-icon',\n LIST_BOTTOM_LOADING_MORE: 'list-bottom-loading-more',\n LIST_BOTTOM_LOAD_MORE_BTN: 'list-bottom-load-more-btn',\n LIST_WRAPPER_BOTTOM: 'list-wrapper-bottom',\n EMPTY_LIST_WRAPPER: 'empty-list-wrapper',\n ITEMS_WRAPPER: 'items-wrapper',\n LOADING_LIST_WRAPPER: 'loading-list-wrapper',\n MOVE_MULTIPLE_WRAPPER: 'move-multiple-wrapper',\n MOVE_MULTIPLE_BTN: 'move-multiple-btn',\n LIST_WRAPPER_MID: 'list-wrapper-mid',\n LIST_WRAPPER_MID_SCROLLER: 'list-wrapper-mid-scroller',\n LIST_WRAPPER_TOP: 'list-wrapper-top',\n AREA_SEARCH_WRAPPER: 'area-search-wrapper',\n AREA_SEARCH_BAR: 'area-search-bar',\n AREA_SELECTION_HEADER: 'area-selection-header',\n AREA_SELECTION_HEADER_COUNT_LABEL: 'area-selection-header-count-label',\n} as const;\n\nexport const DSShuttleV2DataTestIds = slotObjectToDataTestIds(DSShuttleV2Name, DSShuttleV2Slots) as const;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,kBAAkB;AAExB,MAAM,mBAAmB;AAAA,EAC9B,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,eAAe;AAAA,EACf,cAAc;AAAA,EACd,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,gCAAgC;AAAA,EAChC,gCAAgC;AAAA,EAChC,qCAAqC;AAAA,EACrC,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,mCAAmC;AACrC;AAEO,MAAM,6BAAyB,0CAAwB,iBAAiB,gBAAgB;",
6
6
  "names": []
7
7
  }
@@ -30,6 +30,7 @@ __export(itemMovementHelpers_exports, {
30
30
  module.exports = __toCommonJS(itemMovementHelpers_exports);
31
31
  var React = __toESM(require("react"));
32
32
  var import_react = __toESM(require("react"));
33
+ var import_ds_utilities = require("@elliemae/ds-utilities");
33
34
  var import_useStore = require("./useStore");
34
35
  const useHandleMoveSelection = ({ isDestinationPanel }) => {
35
36
  const currOnRemove = (0, import_useStore.usePropsStore)(
@@ -47,45 +48,55 @@ const useHandleMoveSelection = ({ isDestinationPanel }) => {
47
48
  const otherOnSoftDelete = (0, import_useStore.usePropsStore)(
48
49
  (state) => isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete
49
50
  );
50
- const currSelectionMap = (0, import_useStore.usePropsStore)(
51
+ const currSelectionMap = (0, import_useStore.useInternalStore)(
51
52
  (store) => isDestinationPanel ? store.destinationSelectionArray : store.sourceSelectionArray
52
53
  );
53
54
  const currOnSelectionChange = (0, import_useStore.usePropsStore)(
54
55
  (state) => isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange
55
56
  );
56
57
  const otherPanelOnAdd = (0, import_useStore.usePropsStore)((state) => isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd);
57
- const destinationSelectionArray = (0, import_useStore.usePropsStore)((store) => store.destinationSelectionItemArray);
58
- const sourceSelectionArray = (0, import_useStore.usePropsStore)((store) => store.sourceSelectionItemArray);
58
+ const destinationSelectionArray = (0, import_useStore.useInternalStore)((store) => store.destinationSelectionItemArray);
59
+ const sourceSelectionArray = (0, import_useStore.useInternalStore)((store) => store.sourceSelectionItemArray);
59
60
  const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;
61
+ const mutableSelectedItems = (0, import_ds_utilities.useMakeMutable)(selectedItems);
62
+ const mutableCurrSelectionMap = (0, import_ds_utilities.useMakeMutable)(currSelectionMap);
63
+ const mutableCurrOnSelectionChange = (0, import_ds_utilities.useMakeMutable)(currOnSelectionChange);
64
+ const mutableCurrOnRemove = (0, import_ds_utilities.useMakeMutable)(currOnRemove);
65
+ const mutableOtherOnAdd = (0, import_ds_utilities.useMakeMutable)(otherPanelOnAdd);
66
+ const mutableCurrOnSoftDelete = (0, import_ds_utilities.useMakeMutable)(currOnSoftDelete);
67
+ const mutableOtherOnSoftDelete = (0, import_ds_utilities.useMakeMutable)(otherOnSoftDelete);
68
+ const mutableCurrSoftDeletedItems = (0, import_ds_utilities.useMakeMutable)(currSoftDeletedItems);
69
+ const mutableOtherSoftDeletedItems = (0, import_ds_utilities.useMakeMutable)(otherSoftDeletedItems);
60
70
  const moveSelection = import_react.default.useCallback(
61
71
  (event) => {
62
72
  event.preventDefault();
63
73
  event.stopPropagation();
64
- currOnRemove(selectedItems, { event });
65
- otherPanelOnAdd(selectedItems, { event });
74
+ mutableCurrOnRemove.current(mutableSelectedItems.current, { event });
75
+ mutableOtherOnAdd.current(mutableSelectedItems.current, { event });
66
76
  const currSoftDeletedMap = {};
67
77
  const otherSoftDeletedMap = {};
68
- currSelectionMap.forEach((id) => {
78
+ mutableCurrSelectionMap.current.forEach((id) => {
69
79
  currSoftDeletedMap[id] = true;
70
80
  otherSoftDeletedMap[id] = false;
71
81
  });
72
- currOnSoftDelete({ ...currSoftDeletedItems, ...currSoftDeletedMap }, { event });
73
- otherOnSoftDelete({ ...otherSoftDeletedItems, ...otherSoftDeletedMap }, { event });
74
- currOnSelectionChange({}, { event });
82
+ mutableCurrOnSoftDelete.current({ ...mutableCurrSoftDeletedItems.current, ...currSoftDeletedMap }, { event });
83
+ mutableOtherOnSoftDelete.current({ ...mutableOtherSoftDeletedItems.current, ...otherSoftDeletedMap }, { event });
84
+ mutableCurrOnSelectionChange.current({}, { event });
75
85
  },
76
86
  [
77
- currOnRemove,
78
- selectedItems,
79
- otherPanelOnAdd,
80
- currSelectionMap,
81
- currOnSoftDelete,
82
- currSoftDeletedItems,
83
- otherOnSoftDelete,
84
- otherSoftDeletedItems,
85
- currOnSelectionChange
87
+ mutableCurrSelectionMap,
88
+ mutableCurrOnRemove,
89
+ mutableCurrOnSelectionChange,
90
+ mutableCurrOnSoftDelete,
91
+ mutableCurrSoftDeletedItems,
92
+ mutableOtherOnAdd,
93
+ mutableOtherOnSoftDelete,
94
+ mutableOtherSoftDeletedItems,
95
+ mutableSelectedItems
86
96
  ]
87
97
  );
88
- return import_react.default.useMemo(() => ({ moveSelection }), [moveSelection]);
98
+ const mutableMoveSelection = (0, import_ds_utilities.useMakeMutable)(moveSelection);
99
+ return import_react.default.useMemo(() => ({ moveSelection: mutableMoveSelection.current }), [mutableMoveSelection]);
89
100
  };
90
101
  const useHandleMoveItem = ({ datum, datumInternalMeta, isDestinationPanel }) => {
91
102
  const currSoftDeletedItems = (0, import_useStore.usePropsStore)(
@@ -104,24 +115,36 @@ const useHandleMoveItem = ({ datum, datumInternalMeta, isDestinationPanel }) =>
104
115
  (state) => isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove
105
116
  );
106
117
  const otherPanelOnAdd = (0, import_useStore.usePropsStore)((state) => isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd);
118
+ const mutableCurrOnRemove = (0, import_ds_utilities.useMakeMutable)(currOnRemove);
119
+ const mutableOtherOnAdd = (0, import_ds_utilities.useMakeMutable)(otherPanelOnAdd);
120
+ const mutableCurrOnSoftDelete = (0, import_ds_utilities.useMakeMutable)(currOnSoftDelete);
121
+ const mutableOtherOnSoftDelete = (0, import_ds_utilities.useMakeMutable)(otherOnSoftDelete);
122
+ const mutableCurrSoftDeletedItems = (0, import_ds_utilities.useMakeMutable)(currSoftDeletedItems);
123
+ const mutableOtherSoftDeletedItems = (0, import_ds_utilities.useMakeMutable)(otherSoftDeletedItems);
107
124
  const moveItem = import_react.default.useCallback(
108
125
  (event) => {
109
126
  event.preventDefault();
110
127
  event.stopPropagation();
111
- currOnRemove([datum], { event });
112
- otherPanelOnAdd([datum], { event });
113
- currOnSoftDelete({ ...currSoftDeletedItems, [datumInternalMeta.hydratedId]: true }, { event });
114
- otherOnSoftDelete({ ...otherSoftDeletedItems, [datumInternalMeta.hydratedId]: false }, { event });
128
+ mutableCurrOnRemove.current([datum], { event });
129
+ mutableOtherOnAdd.current([datum], { event });
130
+ mutableCurrOnSoftDelete.current(
131
+ { ...mutableCurrSoftDeletedItems.current, [datumInternalMeta.hydratedId]: true },
132
+ { event }
133
+ );
134
+ mutableOtherOnSoftDelete.current(
135
+ { ...mutableOtherSoftDeletedItems.current, [datumInternalMeta.hydratedId]: false },
136
+ { event }
137
+ );
115
138
  },
116
139
  [
117
- currOnRemove,
118
- currOnSoftDelete,
119
- currSoftDeletedItems,
120
140
  datum,
121
141
  datumInternalMeta.hydratedId,
122
- otherOnSoftDelete,
123
- otherPanelOnAdd,
124
- otherSoftDeletedItems
142
+ mutableCurrOnRemove,
143
+ mutableCurrOnSoftDelete,
144
+ mutableCurrSoftDeletedItems,
145
+ mutableOtherOnAdd,
146
+ mutableOtherOnSoftDelete,
147
+ mutableOtherSoftDeletedItems
125
148
  ]
126
149
  );
127
150
  return moveItem;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/config/itemMovementHelpers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport React from 'react';\nimport { type DSButtonT } from '@elliemae/ds-button-v2';\nimport { type DSShuttleV2T } from '../react-desc-prop-types';\nimport { usePropsStore } from './useStore';\n\nexport const useHandleMoveSelection = ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const currOnRemove = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove,\n );\n const currSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.destinationSoftDeletedItems : state.sourceSoftDeletedItems,\n );\n const currOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSoftDelete : state.onSourceSoftDelete,\n );\n const otherSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.sourceSoftDeletedItems : state.destinationSoftDeletedItems,\n );\n const otherOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete,\n );\n const currSelectionMap = usePropsStore((store) =>\n isDestinationPanel ? store.destinationSelectionArray : store.sourceSelectionArray,\n );\n const currOnSelectionChange = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange,\n );\n\n const otherPanelOnAdd = usePropsStore((state) => (isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd));\n\n const destinationSelectionArray = usePropsStore((store) => store.destinationSelectionItemArray);\n const sourceSelectionArray = usePropsStore((store) => store.sourceSelectionItemArray);\n const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;\n\n const moveSelection = React.useCallback(\n (event: Parameters<Required<DSButtonT.Props>['onClick']>[0]) => {\n event.preventDefault();\n event.stopPropagation();\n // movement\n currOnRemove(selectedItems, { event });\n otherPanelOnAdd(selectedItems, { event });\n // soft delete\n const currSoftDeletedMap: DSShuttleV2T.SoftDeletedMap = {};\n const otherSoftDeletedMap: DSShuttleV2T.SoftDeletedMap = {};\n currSelectionMap.forEach((id) => {\n currSoftDeletedMap[id] = true;\n otherSoftDeletedMap[id] = false;\n });\n currOnSoftDelete({ ...currSoftDeletedItems, ...currSoftDeletedMap }, { event });\n otherOnSoftDelete({ ...otherSoftDeletedItems, ...otherSoftDeletedMap }, { event });\n // cleanup\n currOnSelectionChange({}, { event });\n },\n [\n currOnRemove,\n selectedItems,\n otherPanelOnAdd,\n currSelectionMap,\n currOnSoftDelete,\n currSoftDeletedItems,\n otherOnSoftDelete,\n otherSoftDeletedItems,\n currOnSelectionChange,\n ],\n );\n return React.useMemo(() => ({ moveSelection: moveSelection }), [moveSelection]);\n};\n\nexport const useHandleMoveItem = ({ datum, datumInternalMeta, isDestinationPanel }: DSShuttleV2T.ItemMeta) => {\n const currSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.destinationSoftDeletedItems : state.sourceSoftDeletedItems,\n );\n const otherSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.sourceSoftDeletedItems : state.destinationSoftDeletedItems,\n );\n const currOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSoftDelete : state.onSourceSoftDelete,\n );\n const otherOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete,\n );\n\n const currOnRemove = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove,\n );\n const otherPanelOnAdd = usePropsStore((state) => (isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd));\n\n const moveItem = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n currOnRemove([datum], { event });\n otherPanelOnAdd([datum], { event });\n currOnSoftDelete({ ...currSoftDeletedItems, [datumInternalMeta.hydratedId]: true }, { event });\n otherOnSoftDelete({ ...otherSoftDeletedItems, [datumInternalMeta.hydratedId]: false }, { event });\n },\n [\n currOnRemove,\n currOnSoftDelete,\n currSoftDeletedItems,\n datum,\n datumInternalMeta.hydratedId,\n otherOnSoftDelete,\n otherPanelOnAdd,\n otherSoftDeletedItems,\n ],\n );\n return moveItem;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAkB;AAGlB,sBAA8B;AAEvB,MAAM,yBAAyB,CAAC,EAAE,mBAAmB,MAAkC;AAC5F,QAAM,mBAAe;AAAA,IAAc,CAAC,UAClC,qBAAqB,MAAM,sBAAsB,MAAM;AAAA,EACzD;AACA,QAAM,2BAAuB;AAAA,IAAc,CAAC,UAC1C,qBAAqB,MAAM,8BAA8B,MAAM;AAAA,EACjE;AACA,QAAM,uBAAmB;AAAA,IAAc,CAAC,UACtC,qBAAqB,MAAM,0BAA0B,MAAM;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React from 'react';\nimport { useMakeMutable } from '@elliemae/ds-utilities';\nimport { type DSButtonT } from '@elliemae/ds-button-v2';\nimport { type DSShuttleV2T } from '../react-desc-prop-types';\nimport { usePropsStore, useInternalStore } from './useStore';\n\nexport const useHandleMoveSelection = ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const currOnRemove = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove,\n );\n const currSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.destinationSoftDeletedItems : state.sourceSoftDeletedItems,\n );\n const currOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSoftDelete : state.onSourceSoftDelete,\n );\n const otherSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.sourceSoftDeletedItems : state.destinationSoftDeletedItems,\n );\n const otherOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete,\n );\n const currSelectionMap = useInternalStore((store) =>\n isDestinationPanel ? store.destinationSelectionArray : store.sourceSelectionArray,\n );\n const currOnSelectionChange = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange,\n );\n\n const otherPanelOnAdd = usePropsStore((state) => (isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd));\n\n const destinationSelectionArray = useInternalStore((store) => store.destinationSelectionItemArray);\n const sourceSelectionArray = useInternalStore((store) => store.sourceSelectionItemArray);\n const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;\n\n const mutableSelectedItems = useMakeMutable(selectedItems);\n const mutableCurrSelectionMap = useMakeMutable(currSelectionMap);\n const mutableCurrOnSelectionChange = useMakeMutable(currOnSelectionChange);\n const mutableCurrOnRemove = useMakeMutable(currOnRemove);\n const mutableOtherOnAdd = useMakeMutable(otherPanelOnAdd);\n const mutableCurrOnSoftDelete = useMakeMutable(currOnSoftDelete);\n const mutableOtherOnSoftDelete = useMakeMutable(otherOnSoftDelete);\n const mutableCurrSoftDeletedItems = useMakeMutable(currSoftDeletedItems);\n const mutableOtherSoftDeletedItems = useMakeMutable(otherSoftDeletedItems);\n\n const moveSelection = React.useCallback(\n (event: Parameters<Required<DSButtonT.Props>['onClick']>[0]) => {\n event.preventDefault();\n event.stopPropagation();\n // movement\n mutableCurrOnRemove.current(mutableSelectedItems.current, { event });\n mutableOtherOnAdd.current(mutableSelectedItems.current, { event });\n // soft delete\n const currSoftDeletedMap: DSShuttleV2T.SoftDeletedMap = {};\n const otherSoftDeletedMap: DSShuttleV2T.SoftDeletedMap = {};\n mutableCurrSelectionMap.current.forEach((id) => {\n currSoftDeletedMap[id] = true;\n otherSoftDeletedMap[id] = false;\n });\n mutableCurrOnSoftDelete.current({ ...mutableCurrSoftDeletedItems.current, ...currSoftDeletedMap }, { event });\n mutableOtherOnSoftDelete.current({ ...mutableOtherSoftDeletedItems.current, ...otherSoftDeletedMap }, { event });\n // cleanup\n mutableCurrOnSelectionChange.current({}, { event });\n },\n [\n mutableCurrSelectionMap,\n mutableCurrOnRemove,\n mutableCurrOnSelectionChange,\n mutableCurrOnSoftDelete,\n mutableCurrSoftDeletedItems,\n mutableOtherOnAdd,\n mutableOtherOnSoftDelete,\n mutableOtherSoftDeletedItems,\n mutableSelectedItems,\n ],\n );\n // optimization ...\n const mutableMoveSelection = useMakeMutable(moveSelection);\n return React.useMemo(() => ({ moveSelection: mutableMoveSelection.current }), [mutableMoveSelection]);\n};\n\nexport const useHandleMoveItem = ({ datum, datumInternalMeta, isDestinationPanel }: DSShuttleV2T.ItemMeta) => {\n const currSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.destinationSoftDeletedItems : state.sourceSoftDeletedItems,\n );\n const otherSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.sourceSoftDeletedItems : state.destinationSoftDeletedItems,\n );\n const currOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSoftDelete : state.onSourceSoftDelete,\n );\n const otherOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete,\n );\n\n const currOnRemove = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove,\n );\n const otherPanelOnAdd = usePropsStore((state) => (isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd));\n\n const mutableCurrOnRemove = useMakeMutable(currOnRemove);\n const mutableOtherOnAdd = useMakeMutable(otherPanelOnAdd);\n const mutableCurrOnSoftDelete = useMakeMutable(currOnSoftDelete);\n const mutableOtherOnSoftDelete = useMakeMutable(otherOnSoftDelete);\n const mutableCurrSoftDeletedItems = useMakeMutable(currSoftDeletedItems);\n const mutableOtherSoftDeletedItems = useMakeMutable(otherSoftDeletedItems);\n\n const moveItem = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n mutableCurrOnRemove.current([datum], { event });\n mutableOtherOnAdd.current([datum], { event });\n mutableCurrOnSoftDelete.current(\n { ...mutableCurrSoftDeletedItems.current, [datumInternalMeta.hydratedId]: true },\n { event },\n );\n mutableOtherOnSoftDelete.current(\n { ...mutableOtherSoftDeletedItems.current, [datumInternalMeta.hydratedId]: false },\n { event },\n );\n },\n [\n datum,\n datumInternalMeta.hydratedId,\n mutableCurrOnRemove,\n mutableCurrOnSoftDelete,\n mutableCurrSoftDeletedItems,\n mutableOtherOnAdd,\n mutableOtherOnSoftDelete,\n mutableOtherSoftDeletedItems,\n ],\n );\n return moveItem;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAkB;AAClB,0BAA+B;AAG/B,sBAAgD;AAEzC,MAAM,yBAAyB,CAAC,EAAE,mBAAmB,MAAkC;AAC5F,QAAM,mBAAe;AAAA,IAAc,CAAC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;AACA,QAAM,sBAAkB,+BAAc,CAAC,UAAW,qBAAqB,MAAM,cAAc,MAAM,gBAAiB;AAElH,QAAM,0BAAsB,oCAAe,YAAY;AACvD,QAAM,wBAAoB,oCAAe,eAAe;AACxD,QAAM,8BAA0B,oCAAe,gBAAgB;AAC/D,QAAM,+BAA2B,oCAAe,iBAAiB;AACjE,QAAM,kCAA8B,oCAAe,oBAAoB;AACvE,QAAM,mCAA+B,oCAAe,qBAAqB;AAEzE,QAAM,WAAW,aAAAA,QAAM;AAAA,IACrB,CAAC,UAAwF;AACvF,YAAM,eAAe;AACrB,YAAM,gBAAgB;AACtB,0BAAoB,QAAQ,CAAC,KAAK,GAAG,EAAE,MAAM,CAAC;AAC9C,wBAAkB,QAAQ,CAAC,KAAK,GAAG,EAAE,MAAM,CAAC;AAC5C,8BAAwB;AAAA,QACtB,EAAE,GAAG,4BAA4B,SAAS,CAAC,kBAAkB,aAAa,KAAK;AAAA,QAC/E,EAAE,MAAM;AAAA,MACV;AACA,+BAAyB;AAAA,QACvB,EAAE,GAAG,6BAA6B,SAAS,CAAC,kBAAkB,aAAa,MAAM;AAAA,QACjF,EAAE,MAAM;AAAA,MACV;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA,kBAAkB;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": ["React"]
7
7
  }
@@ -29,6 +29,7 @@ __export(useFocusActionTrackers_exports, {
29
29
  module.exports = __toCommonJS(useFocusActionTrackers_exports);
30
30
  var React = __toESM(require("react"));
31
31
  var import_react = require("react");
32
+ var import_ds_utilities = require("@elliemae/ds-utilities");
32
33
  var import_constants = require("../../constants");
33
34
  var import_useStore = require("../useStore");
34
35
  const getMoveBtnActionByProxymity = (flags) => {
@@ -99,7 +100,8 @@ const getActionByProxymity = ({ flags, currentAction }) => {
99
100
  return getParenBtnActionByProxymity(flags);
100
101
  };
101
102
  const useFocusActionTrackers = () => {
102
- const getFocusItemAction = (0, import_useStore.useInternalStore)((state) => state.getFocusItemAction);
103
+ const focusItemAction = (0, import_useStore.useInternalStore)((state) => state.focusItemAction);
104
+ const mutableFocusItemAction = (0, import_ds_utilities.useMakeMutable)(focusItemAction);
103
105
  const setFocusItemAction = (0, import_useStore.useInternalStore)((state) => state.setFocusItemAction);
104
106
  const removeDragAndDropFromDestination = (0, import_useStore.usePropsStore)((state) => state.removeDragAndDropFromDestination);
105
107
  const addDragAndDropFromSource = (0, import_useStore.usePropsStore)((state) => state.addDragAndDropFromSource);
@@ -110,11 +112,11 @@ const useFocusActionTrackers = () => {
110
112
  const withDragAndDrop = isDestinationPanel && !removeDragAndDropFromDestination || !isDestinationPanel && addDragAndDropFromSource;
111
113
  const { prevAction } = getActionByProxymity({
112
114
  flags: { preventMove, preventDrilldown, withDragAndDrop },
113
- currentAction: getFocusItemAction()
115
+ currentAction: mutableFocusItemAction.current
114
116
  });
115
117
  setFocusItemAction(prevAction);
116
118
  },
117
- [addDragAndDropFromSource, getFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
119
+ [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
118
120
  );
119
121
  const trackFocusNextAction = (0, import_react.useCallback)(
120
122
  ({ isDestinationPanel, datumHydratables }) => {
@@ -123,14 +125,15 @@ const useFocusActionTrackers = () => {
123
125
  const withDragAndDrop = isDestinationPanel && !removeDragAndDropFromDestination || !isDestinationPanel && addDragAndDropFromSource;
124
126
  const { nextAction } = getActionByProxymity({
125
127
  flags: { preventMove, preventDrilldown, withDragAndDrop },
126
- currentAction: getFocusItemAction()
128
+ currentAction: mutableFocusItemAction.current
127
129
  });
128
130
  setFocusItemAction(nextAction);
129
131
  },
130
- [addDragAndDropFromSource, getFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
132
+ [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
131
133
  );
132
134
  return (0, import_react.useMemo)(
133
135
  () => ({
136
+ mutableFocusItemAction,
134
137
  trackFocusActionMove: () => setFocusItemAction("move-btn"),
135
138
  trackFocusActionDrilldown: () => setFocusItemAction("drilldown-btn"),
136
139
  trackFocusActionDragAndDrop: () => setFocusItemAction("drag-n-drop"),
@@ -139,7 +142,7 @@ const useFocusActionTrackers = () => {
139
142
  trackFocusPrevAction,
140
143
  trackFocusNextAction
141
144
  }),
142
- [setFocusItemAction, trackFocusNextAction, trackFocusPrevAction]
145
+ [mutableFocusItemAction, setFocusItemAction, trackFocusNextAction, trackFocusPrevAction]
143
146
  );
144
147
  };
145
148
  //# sourceMappingURL=useFocusActionTrackers.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/config/useFocusTracker/useFocusActionTrackers.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { useMemo, useCallback } from 'react';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\nimport { ACTIONS_FOCUSES } from '../../constants';\nimport { useInternalStore, usePropsStore } from '../useStore';\n\ntype ActionFlags = {\n preventDrilldown: boolean;\n withDragAndDrop: boolean;\n preventMove: boolean;\n};\ntype ActionByProxymity = {\n prevAction: (typeof ACTIONS_FOCUSES)[keyof typeof ACTIONS_FOCUSES];\n nextAction: (typeof ACTIONS_FOCUSES)[keyof typeof ACTIONS_FOCUSES];\n};\nconst getMoveBtnActionByProxymity = (flags: ActionFlags) => {\n // move button\n const { preventDrilldown, withDragAndDrop } = flags;\n const actionMap = { prevAction: '', nextAction: '' } as ActionByProxymity;\n // prev\n // drilldown if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else if (withDragAndDrop) actionMap.prevAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n // next\n // drag n drop if it exist\n // else parent\n if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getDragAndDropBtnActionByProxymity = (flags: ActionFlags) => {\n // Drag and drop handler\n const { preventMove, preventDrilldown } = flags;\n // next\n // always parent\n const actionMap = { prevAction: '', nextAction: ACTIONS_FOCUSES.PARENT } as ActionByProxymity;\n // prev\n // move if it exist\n // else drilldown if it exist\n // else parent\n if (!preventMove) actionMap.prevAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getDrilldownBtnActionByProxymity = (flags: ActionFlags) => {\n // Drilldown handler\n const { withDragAndDrop, preventMove } = flags;\n // prev\n // always parent\n const actionMap = { prevAction: ACTIONS_FOCUSES.PARENT, nextAction: '' } as ActionByProxymity;\n // next\n // move if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventMove) actionMap.nextAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getParenBtnActionByProxymity = (flags: ActionFlags) => {\n // Parent handler\n const { preventDrilldown, withDragAndDrop, preventMove } = flags;\n const actionMap = { prevAction: '', nextAction: '' } as ActionByProxymity;\n // prev\n // drag n drop if it exist\n // else move if it exist\n // else drilldown if it exist\n // else parent\n if (withDragAndDrop) actionMap.prevAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else if (!preventMove) actionMap.prevAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n // next\n // drilldown if it exist\n // else move if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventDrilldown) actionMap.nextAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else if (!preventMove) actionMap.nextAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getActionByProxymity = ({ flags, currentAction }: { flags: ActionFlags; currentAction: string }) => {\n if (currentAction === ACTIONS_FOCUSES.MOVE_BTN) return getMoveBtnActionByProxymity(flags);\n if (currentAction === ACTIONS_FOCUSES.DRAG_N_DROP) return getDragAndDropBtnActionByProxymity(flags);\n if (currentAction === ACTIONS_FOCUSES.DRILLDOWN_BTN) return getDrilldownBtnActionByProxymity(flags);\n return getParenBtnActionByProxymity(flags);\n};\nexport const useFocusActionTrackers = () => {\n const getFocusItemAction = useInternalStore((state) => state.getFocusItemAction);\n const setFocusItemAction = useInternalStore((state) => state.setFocusItemAction);\n const removeDragAndDropFromDestination = usePropsStore((state) => state.removeDragAndDropFromDestination);\n const addDragAndDropFromSource = usePropsStore((state) => state.addDragAndDropFromSource);\n const trackFocusPrevAction = useCallback(\n ({ isDestinationPanel, datumHydratables }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(datumHydratables.preventMove);\n const preventDrilldown = Boolean(datumHydratables.preventDrilldown);\n const withDragAndDrop =\n (isDestinationPanel && !removeDragAndDropFromDestination) || (!isDestinationPanel && addDragAndDropFromSource);\n const { prevAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: getFocusItemAction(),\n });\n setFocusItemAction(prevAction);\n },\n [addDragAndDropFromSource, getFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n const trackFocusNextAction = useCallback(\n ({ isDestinationPanel, datumHydratables }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(datumHydratables.preventMove);\n const preventDrilldown = Boolean(datumHydratables.preventDrilldown);\n const withDragAndDrop =\n (isDestinationPanel && !removeDragAndDropFromDestination) || (!isDestinationPanel && addDragAndDropFromSource);\n const { nextAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: getFocusItemAction(),\n });\n setFocusItemAction(nextAction);\n },\n [addDragAndDropFromSource, getFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n return useMemo(\n () => ({\n trackFocusActionMove: () => setFocusItemAction('move-btn'),\n trackFocusActionDrilldown: () => setFocusItemAction('drilldown-btn'),\n trackFocusActionDragAndDrop: () => setFocusItemAction('drag-n-drop'),\n trackFocusActionParent: () => setFocusItemAction('parent'),\n trackFocusActionReset: () => setFocusItemAction(''),\n trackFocusPrevAction,\n trackFocusNextAction,\n }),\n [setFocusItemAction, trackFocusNextAction, trackFocusPrevAction],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAqC;AAErC,uBAAgC;AAChC,sBAAgD;AAWhD,MAAM,8BAA8B,CAAC,UAAuB;AAE1D,QAAM,EAAE,kBAAkB,gBAAgB,IAAI;AAC9C,QAAM,YAAY,EAAE,YAAY,IAAI,YAAY,GAAG;AAKnD,MAAI,CAAC;AAAkB,cAAU,aAAa,iCAAgB;AAAA,WACrD;AAAiB,cAAU,aAAa,iCAAgB;AAAA;AAC5D,cAAU,aAAa,iCAAgB;AAI5C,MAAI;AAAiB,cAAU,aAAa,iCAAgB;AAAA;AACvD,cAAU,aAAa,iCAAgB;AAC5C,SAAO;AACT;AACA,MAAM,qCAAqC,CAAC,UAAuB;AAEjE,QAAM,EAAE,aAAa,iBAAiB,IAAI;AAG1C,QAAM,YAAY,EAAE,YAAY,IAAI,YAAY,iCAAgB,OAAO;AAKvE,MAAI,CAAC;AAAa,cAAU,aAAa,iCAAgB;AAAA,WAChD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F;AAAA,IACA,CAAC,oBAAoB,sBAAsB,oBAAoB;AAAA,EACjE;AACF;",
4
+ "sourcesContent": ["import { useMemo, useCallback } from 'react';\nimport { useMakeMutable } from '@elliemae/ds-utilities';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\nimport { ACTIONS_FOCUSES } from '../../constants';\nimport { useInternalStore, usePropsStore } from '../useStore';\n\ntype ActionFlags = {\n preventDrilldown: boolean;\n withDragAndDrop: boolean;\n preventMove: boolean;\n};\ntype ActionByProxymity = {\n prevAction: (typeof ACTIONS_FOCUSES)[keyof typeof ACTIONS_FOCUSES];\n nextAction: (typeof ACTIONS_FOCUSES)[keyof typeof ACTIONS_FOCUSES];\n};\nconst getMoveBtnActionByProxymity = (flags: ActionFlags) => {\n // move button\n const { preventDrilldown, withDragAndDrop } = flags;\n const actionMap = { prevAction: '', nextAction: '' } as ActionByProxymity;\n // prev\n // drilldown if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else if (withDragAndDrop) actionMap.prevAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n // next\n // drag n drop if it exist\n // else parent\n if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getDragAndDropBtnActionByProxymity = (flags: ActionFlags) => {\n // Drag and drop handler\n const { preventMove, preventDrilldown } = flags;\n // next\n // always parent\n const actionMap = { prevAction: '', nextAction: ACTIONS_FOCUSES.PARENT } as ActionByProxymity;\n // prev\n // move if it exist\n // else drilldown if it exist\n // else parent\n if (!preventMove) actionMap.prevAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getDrilldownBtnActionByProxymity = (flags: ActionFlags) => {\n // Drilldown handler\n const { withDragAndDrop, preventMove } = flags;\n // prev\n // always parent\n const actionMap = { prevAction: ACTIONS_FOCUSES.PARENT, nextAction: '' } as ActionByProxymity;\n // next\n // move if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventMove) actionMap.nextAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getParenBtnActionByProxymity = (flags: ActionFlags) => {\n // Parent handler\n const { preventDrilldown, withDragAndDrop, preventMove } = flags;\n const actionMap = { prevAction: '', nextAction: '' } as ActionByProxymity;\n // prev\n // drag n drop if it exist\n // else move if it exist\n // else drilldown if it exist\n // else parent\n if (withDragAndDrop) actionMap.prevAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else if (!preventMove) actionMap.prevAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n // next\n // drilldown if it exist\n // else move if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventDrilldown) actionMap.nextAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else if (!preventMove) actionMap.nextAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getActionByProxymity = ({ flags, currentAction }: { flags: ActionFlags; currentAction: string }) => {\n if (currentAction === ACTIONS_FOCUSES.MOVE_BTN) return getMoveBtnActionByProxymity(flags);\n if (currentAction === ACTIONS_FOCUSES.DRAG_N_DROP) return getDragAndDropBtnActionByProxymity(flags);\n if (currentAction === ACTIONS_FOCUSES.DRILLDOWN_BTN) return getDrilldownBtnActionByProxymity(flags);\n return getParenBtnActionByProxymity(flags);\n};\nexport const useFocusActionTrackers = () => {\n const focusItemAction = useInternalStore((state) => state.focusItemAction);\n // tracking actions are always triggered as user action callbacks\n // this means it should always be invoked after all the useEffect execute\n // since this is the case, we can avoid re-declaring the function with mutable pattern\n // this way we avoid useless re-renders\n const mutableFocusItemAction = useMakeMutable(focusItemAction);\n const setFocusItemAction = useInternalStore((state) => state.setFocusItemAction);\n const removeDragAndDropFromDestination = usePropsStore((state) => state.removeDragAndDropFromDestination);\n const addDragAndDropFromSource = usePropsStore((state) => state.addDragAndDropFromSource);\n const trackFocusPrevAction = useCallback(\n ({ isDestinationPanel, datumHydratables }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(datumHydratables.preventMove);\n const preventDrilldown = Boolean(datumHydratables.preventDrilldown);\n const withDragAndDrop =\n (isDestinationPanel && !removeDragAndDropFromDestination) || (!isDestinationPanel && addDragAndDropFromSource);\n const { prevAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: mutableFocusItemAction.current,\n });\n setFocusItemAction(prevAction);\n },\n [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n const trackFocusNextAction = useCallback(\n ({ isDestinationPanel, datumHydratables }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(datumHydratables.preventMove);\n const preventDrilldown = Boolean(datumHydratables.preventDrilldown);\n const withDragAndDrop =\n (isDestinationPanel && !removeDragAndDropFromDestination) || (!isDestinationPanel && addDragAndDropFromSource);\n const { nextAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: mutableFocusItemAction.current,\n });\n setFocusItemAction(nextAction);\n },\n [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n return useMemo(\n () => ({\n mutableFocusItemAction,\n trackFocusActionMove: () => setFocusItemAction('move-btn'),\n trackFocusActionDrilldown: () => setFocusItemAction('drilldown-btn'),\n trackFocusActionDragAndDrop: () => setFocusItemAction('drag-n-drop'),\n trackFocusActionParent: () => setFocusItemAction('parent'),\n trackFocusActionReset: () => setFocusItemAction(''),\n trackFocusPrevAction,\n trackFocusNextAction,\n }),\n [mutableFocusItemAction, setFocusItemAction, trackFocusNextAction, trackFocusPrevAction],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAqC;AACrC,0BAA+B;AAE/B,uBAAgC;AAChC,sBAAgD;AAWhD,MAAM,8BAA8B,CAAC,UAAuB;AAE1D,QAAM,EAAE,kBAAkB,gBAAgB,IAAI;AAC9C,QAAM,YAAY,EAAE,YAAY,IAAI,YAAY,GAAG;AAKnD,MAAI,CAAC;AAAkB,cAAU,aAAa,iCAAgB;AAAA,WACrD;AAAiB,cAAU,aAAa,iCAAgB;AAAA;AAC5D,cAAU,aAAa,iCAAgB;AAI5C,MAAI;AAAiB,cAAU,aAAa,iCAAgB;AAAA;AACvD,cAAU,aAAa,iCAAgB;AAC5C,SAAO;AACT;AACA,MAAM,qCAAqC,CAAC,UAAuB;AAEjE,QAAM,EAAE,aAAa,iBAAiB,IAAI;AAG1C,QAAM,YAAY,EAAE,YAAY,IAAI,YAAY,iCAAgB,OAAO;AAKvE,MAAI,CAAC;AAAa,cAAU,aAAa,iCAAgB;AAAA,WAChD,CAAC;AAAkB,cAAU,aAAa,iCAAgB;AAAA;AAC9D,cAAU,aAAa,iCAAgB;AAC5C,SAAO;AACT;AACA,MAAM,mCAAmC,CAAC,UAAuB;AAE/D,QAAM,EAAE,iBAAiB,YAAY,IAAI;AAGzC,QAAM,YAAY,EAAE,YAAY,iCAAgB,QAAQ,YAAY,GAAG;AAKvE,MAAI,CAAC;AAAa,cAAU,aAAa,iCAAgB;AAAA,WAChD;AAAi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AgB;AAClE,YAAM,kBACH,sBAAsB,CAAC,oCAAsC,CAAC,sBAAsB;AACvF,YAAM,EAAE,WAAW,IAAI,qBAAqB;AAAA,QAC1C,OAAO,EAAE,aAAa,kBAAkB,gBAAgB;AAAA,QACxD,eAAe,uBAAuB;AAAA,MACxC,CAAC;AACD,yBAAmB,UAAU;AAAA,IAC/B;AAAA,IACA,CAAC,0BAA0B,wBAAwB,kCAAkC,kBAAkB;AAAA,EACzG;AACA,QAAM,2BAAuB;AAAA,IAC3B,CAAC,EAAE,oBAAoB,iBAAiB,MAA6B;AACnE,YAAM,cAAc,QAAQ,iBAAiB,WAAW;AACxD,YAAM,mBAAmB,QAAQ,iBAAiB,gBAAgB;AAClE,YAAM,kBACH,sBAAsB,CAAC,oCAAsC,CAAC,sBAAsB;AACvF,YAAM,EAAE,WAAW,IAAI,qBAAqB;AAAA,QAC1C,OAAO,EAAE,aAAa,kBAAkB,gBAAgB;AAAA,QACxD,eAAe,uBAAuB;AAAA,MACxC,CAAC;AACD,yBAAmB,UAAU;AAAA,IAC/B;AAAA,IACA,CAAC,0BAA0B,wBAAwB,kCAAkC,kBAAkB;AAAA,EACzG;AACA,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,sBAAsB,MAAM,mBAAmB,UAAU;AAAA,MACzD,2BAA2B,MAAM,mBAAmB,eAAe;AAAA,MACnE,6BAA6B,MAAM,mBAAmB,aAAa;AAAA,MACnE,wBAAwB,MAAM,mBAAmB,QAAQ;AAAA,MACzD,uBAAuB,MAAM,mBAAmB,EAAE;AAAA,MAClD;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,wBAAwB,oBAAoB,sBAAsB,oBAAoB;AAAA,EACzF;AACF;",
6
6
  "names": []
7
7
  }
@@ -29,21 +29,40 @@ __export(useFocusItemTracker_exports, {
29
29
  module.exports = __toCommonJS(useFocusItemTracker_exports);
30
30
  var React = __toESM(require("react"));
31
31
  var import_react = require("react");
32
+ var import_ds_utilities = require("@elliemae/ds-utilities");
32
33
  var import_useStore = require("../useStore");
33
34
  var import_constants = require("../../constants/index");
34
35
  const useFocusItemTracker = () => {
35
- const getFocusItem = (0, import_useStore.useInternalStore)((state) => state.getFocusItem);
36
+ const focusItem = (0, import_useStore.useInternalStore)((state) => state.focusItem);
37
+ const mutableFocusItem = (0, import_ds_utilities.useMakeMutable)(focusItem);
36
38
  const setFocusItem = (0, import_useStore.useInternalStore)((state) => state.setFocusItem);
37
- const sourceData = (0, import_useStore.usePropsStore)((state) => state.sourceConfiguredData);
38
- const destinationData = (0, import_useStore.usePropsStore)((state) => state.destinationConfiguredData);
39
+ const sourceData = (0, import_useStore.useInternalStore)((state) => state.sourceConfiguredData);
40
+ const destinationData = (0, import_useStore.useInternalStore)((state) => state.destinationConfiguredData);
39
41
  const sourceWithLoadMore = (0, import_useStore.usePropsStore)((state) => state.sourceWithLoadMore);
40
42
  const destinationWithLoadMore = (0, import_useStore.usePropsStore)((state) => state.destinationWithLoadMore);
41
43
  const trackFocusPrevItem = (0, import_react.useCallback)(
42
44
  ({ isDestinationPanel }) => {
43
- const focusItem = getFocusItem();
44
45
  const referenceData = isDestinationPanel ? destinationData : sourceData;
45
46
  const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;
46
- const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);
47
+ if (mutableFocusItem.current === import_constants.ITEMS_FOCUSES.FIRST) {
48
+ if (withLoadMore)
49
+ setFocusItem(
50
+ isDestinationPanel ? import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE
51
+ );
52
+ else {
53
+ const prevItemIndex = referenceData.length > 1 ? referenceData.length - 1 : 0;
54
+ const prevItem = referenceData[prevItemIndex];
55
+ setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));
56
+ }
57
+ return;
58
+ }
59
+ if (mutableFocusItem.current === import_constants.ITEMS_FOCUSES.LAST) {
60
+ const prevItemIndex = referenceData.length > 2 ? referenceData.length - 2 : 0;
61
+ const prevItem = referenceData[prevItemIndex];
62
+ setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));
63
+ return;
64
+ }
65
+ const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);
47
66
  if (currentItemIndex === 0 && withLoadMore)
48
67
  setFocusItem(isDestinationPanel ? import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);
49
68
  else if (currentItemIndex !== -1) {
@@ -56,14 +75,31 @@ const useFocusItemTracker = () => {
56
75
  setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));
57
76
  }
58
77
  },
59
- [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
78
+ [destinationData, destinationWithLoadMore, mutableFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
60
79
  );
61
80
  const trackFocusNextItem = (0, import_react.useCallback)(
62
81
  ({ isDestinationPanel }) => {
63
- const focusItem = getFocusItem();
64
82
  const referenceData = isDestinationPanel ? destinationData : sourceData;
65
83
  const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;
66
- const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);
84
+ if (mutableFocusItem.current === import_constants.ITEMS_FOCUSES.FIRST) {
85
+ const nextItemIndex = referenceData.length > 1 ? 1 : 0;
86
+ const nextItem = referenceData[nextItemIndex];
87
+ setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));
88
+ return;
89
+ }
90
+ if (mutableFocusItem.current === import_constants.ITEMS_FOCUSES.LAST) {
91
+ if (withLoadMore)
92
+ setFocusItem(
93
+ isDestinationPanel ? import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE
94
+ );
95
+ else {
96
+ const nextItemIndex = 0;
97
+ const nextItem = referenceData[nextItemIndex];
98
+ setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));
99
+ }
100
+ return;
101
+ }
102
+ const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);
67
103
  if (currentItemIndex === referenceData.length - 1 && withLoadMore)
68
104
  setFocusItem(isDestinationPanel ? import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);
69
105
  else if (currentItemIndex !== -1) {
@@ -76,24 +112,21 @@ const useFocusItemTracker = () => {
76
112
  setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));
77
113
  }
78
114
  },
79
- [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
115
+ [destinationData, destinationWithLoadMore, mutableFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
80
116
  );
81
117
  return (0, import_react.useMemo)(
82
118
  () => ({
119
+ mutableFocusItem,
83
120
  trackFocusItem: (item) => setFocusItem(item.hydratedId),
84
121
  trackFocusItemReset: () => setFocusItem(import_constants.ITEMS_FOCUSES.RESET),
85
- trackFocusItemFirst: ({ isDestinationPanel }) => setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(isDestinationPanel ? destinationData[0] : sourceData[0])),
86
- trackFocusItemLast: ({ isDestinationPanel }) => setFocusItem(
87
- import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(
88
- isDestinationPanel ? destinationData[destinationData.length - 1] : sourceData[sourceData.length - 1]
89
- )
90
- ),
122
+ trackFocusItemFirst: () => setFocusItem(import_constants.ITEMS_FOCUSES.FIRST),
123
+ trackFocusItemLast: () => setFocusItem(import_constants.ITEMS_FOCUSES.LAST),
91
124
  trackFocusLoadMoreBtnDestination: () => setFocusItem(import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION),
92
125
  trackFocusLoadMoreBtn: () => setFocusItem(import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE),
93
126
  trackFocusPrevItem,
94
127
  trackFocusNextItem
95
128
  }),
96
- [destinationData, setFocusItem, sourceData, trackFocusNextItem, trackFocusPrevItem]
129
+ [mutableFocusItem, setFocusItem, trackFocusNextItem, trackFocusPrevItem]
97
130
  );
98
131
  };
99
132
  //# sourceMappingURL=useFocusItemTracker.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/config/useFocusTracker/useFocusItemTracker.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useMemo, useCallback } from 'react';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\nimport { useInternalStore, usePropsStore } from '../useStore';\nimport { ITEMS_FOCUSES } from '../../constants/index';\n\nexport const useFocusItemTracker = () => {\n const getFocusItem = useInternalStore((state) => state.getFocusItem);\n const setFocusItem = useInternalStore((state) => state.setFocusItem);\n const sourceData = usePropsStore((state) => state.sourceConfiguredData);\n const destinationData = usePropsStore((state) => state.destinationConfiguredData);\n const sourceWithLoadMore = usePropsStore((state) => state.sourceWithLoadMore);\n const destinationWithLoadMore = usePropsStore((state) => state.destinationWithLoadMore);\n const trackFocusPrevItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const focusItem = getFocusItem();\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n // loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);\n if (currentItemIndex === 0 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const prevItemIndex = currentItemIndex === 0 ? referenceData.length - 1 : currentItemIndex - 1;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n } else {\n const prevItemIndex = 0;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n }\n },\n [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n const trackFocusNextItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const focusItem = getFocusItem();\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n // focus loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);\n if (currentItemIndex === referenceData.length - 1 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const nextItemIndex = currentItemIndex === referenceData.length - 1 ? 0 : currentItemIndex + 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n } else {\n const nextItemIndex = referenceData.length - 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n }\n },\n [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n return useMemo(\n () => ({\n trackFocusItem: (item: DSShuttleV2T.ConfiguredDatum) => setFocusItem(item.hydratedId),\n trackFocusItemReset: () => setFocusItem(ITEMS_FOCUSES.RESET),\n trackFocusItemFirst: ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) =>\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(isDestinationPanel ? destinationData[0] : sourceData[0])),\n trackFocusItemLast: ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) =>\n setFocusItem(\n ITEMS_FOCUSES.GET_SPECIFIC_ITEM(\n isDestinationPanel ? destinationData[destinationData.length - 1] : sourceData[sourceData.length - 1],\n ),\n ),\n trackFocusLoadMoreBtnDestination: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION),\n trackFocusLoadMoreBtn: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE),\n trackFocusPrevItem,\n trackFocusNextItem,\n }),\n [destinationData, setFocusItem, sourceData, trackFocusNextItem, trackFocusPrevItem],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAqC;AAErC,sBAAgD;AAChD,uBAA8B;AAEvB,MAAM,sBAAsB,MAAM;AACvC,QAAM,mBAAe,kCAAiB,CAAC,UAAU,MAAM,YAAY;AACnE,QAAM,mBAAe,kCAAiB,CAAC,UAAU,MAAM,YAAY;AACnE,QAAM,iBAAa,+BAAc,CAAC,UAAU,MAAM,oBAAoB;AACtE,QAAM,sBAAkB,+BAAc,CAAC,UAAU,MAAM,yBAAyB;AAChF,QAAM,yBAAqB,+BAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,8BAA0B,+BAAc,CAAC,UAAU,MAAM,uBAAuB;AACtF,QAAM,yBAAqB;AAAA,IACzB,CAAC,EAAE,mBAAmB,MAAkC;AACtD,YAAM,YAAY,aAAa;AAC/B,YAAM,gBAAgB,qBAAqB,kBAAkB;AAC7D,YAAM,eAAe,qBAAqB,0BAA0B;AAEpE,YAAM,mBAAmB,cAAc,UAAU,CAAC,aAAa,SAAS,eAAe,SAAS;AAChG,UAAI,qBAAqB,KAA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qBAAqB,CAAC,EAAE,mBAAmB,MACzC,aAAa,+BAAc,kBAAkB,qBAAqB,gBAAgB,KAAK,WAAW,EAAE,CAAC;AAAA,MACvG,oBAAoB,CAAC,EAAE,mBAAmB,MACxC;AAAA,QACE,+BAAc;AAAA,UACZ,qBAAqB,gBAAgB,gBAAgB,SAAS,KAAK,WAAW,WAAW,SAAS;AAAA,QACpG;AAAA,MACF;AAAA,MACF,kCAAkC,MAAM,aAAa,+BAAc,yBAAyB;AAAA,MAC5F,uBAAuB,MAAM,aAAa,+BAAc,oBAAoB;AAAA,MAC5E;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,iBAAiB,cAAc,YAAY,oBAAoB,kBAAkB;AAAA,EACpF;AACF;",
4
+ "sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useMemo, useCallback } from 'react';\nimport { useMakeMutable } from '@elliemae/ds-utilities';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\nimport { useInternalStore, usePropsStore } from '../useStore';\nimport { ITEMS_FOCUSES } from '../../constants/index';\n\nexport const useFocusItemTracker = () => {\n const focusItem = useInternalStore((state) => state.focusItem);\n // tracking actions are always triggered as user action callbacks\n // this means it should always be invoked after all the useEffect execute\n // since this is the case, we can avoid re-declaring the function with mutable pattern\n // this way we avoid useless re-renders\n const mutableFocusItem = useMakeMutable(focusItem);\n const setFocusItem = useInternalStore((state) => state.setFocusItem);\n const sourceData = useInternalStore((state) => state.sourceConfiguredData);\n const destinationData = useInternalStore((state) => state.destinationConfiguredData);\n const sourceWithLoadMore = usePropsStore((state) => state.sourceWithLoadMore);\n const destinationWithLoadMore = usePropsStore((state) => state.destinationWithLoadMore);\n const trackFocusPrevItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n if (mutableFocusItem.current === ITEMS_FOCUSES.FIRST) {\n if (withLoadMore)\n setFocusItem(\n isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE,\n );\n else {\n const prevItemIndex = referenceData.length > 1 ? referenceData.length - 1 : 0;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n }\n return;\n }\n if (mutableFocusItem.current === ITEMS_FOCUSES.LAST) {\n const prevItemIndex = referenceData.length > 2 ? referenceData.length - 2 : 0;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n return;\n }\n // loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);\n if (currentItemIndex === 0 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const prevItemIndex = currentItemIndex === 0 ? referenceData.length - 1 : currentItemIndex - 1;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n } else {\n const prevItemIndex = 0;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n }\n },\n [destinationData, destinationWithLoadMore, mutableFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n const trackFocusNextItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n if (mutableFocusItem.current === ITEMS_FOCUSES.FIRST) {\n // \"next\" after the first is position 1,\n // if position 1 exist,\n // else is the \"first\" (position 0) looped back\n const nextItemIndex = referenceData.length > 1 ? 1 : 0;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n return;\n }\n if (mutableFocusItem.current === ITEMS_FOCUSES.LAST) {\n if (withLoadMore)\n setFocusItem(\n isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE,\n );\n else {\n const nextItemIndex = 0;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n }\n return;\n }\n // focus loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);\n if (currentItemIndex === referenceData.length - 1 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const nextItemIndex = currentItemIndex === referenceData.length - 1 ? 0 : currentItemIndex + 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n } else {\n const nextItemIndex = referenceData.length - 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n }\n },\n [destinationData, destinationWithLoadMore, mutableFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n return useMemo(\n () => ({\n mutableFocusItem,\n trackFocusItem: (item: DSShuttleV2T.ConfiguredDatum) => setFocusItem(item.hydratedId),\n trackFocusItemReset: () => setFocusItem(ITEMS_FOCUSES.RESET),\n trackFocusItemFirst: () => setFocusItem(ITEMS_FOCUSES.FIRST),\n trackFocusItemLast: () => setFocusItem(ITEMS_FOCUSES.LAST),\n trackFocusLoadMoreBtnDestination: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION),\n trackFocusLoadMoreBtn: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE),\n trackFocusPrevItem,\n trackFocusNextItem,\n }),\n [mutableFocusItem, setFocusItem, trackFocusNextItem, trackFocusPrevItem],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAqC;AACrC,0BAA+B;AAE/B,sBAAgD;AAChD,uBAA8B;AAEvB,MAAM,sBAAsB,MAAM;AACvC,QAAM,gBAAY,kCAAiB,CAAC,UAAU,MAAM,SAAS;AAK7D,QAAM,uBAAmB,oCAAe,SAAS;AACjD,QAAM,mBAAe,kCAAiB,CAAC,UAAU,MAAM,YAAY;AACnE,QAAM,iBAAa,kCAAiB,CAAC,UAAU,MAAM,oBAAoB;AACzE,QAAM,sBAAkB,kCAAiB,CAAC,UAAU,MAAM,yBAAyB;AACnF,QAAM,yBAAqB,+BAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,8BAA0B,+BAAc,CAAC,UAAU,MAAM,uBAAuB;AACtF,QAAM,yBAAqB;AAAA,IACzB,CAAC,EAAE,mBAAmB,MAAkC;AACtD,YAAM,gBAAgB,qBAAqB,kBAAkB;AAC7D,YAAM,eAAe,qBAAqB,0BAA0B;AACpE,UAAI,iBAAiB,YAAY,+BAAc,OAAO;AACpD,YAAI;AACF;AAAA,YACE,qBAAqB,+BAAc,4BAA4B,+BAAc;AAAA,UAC/E;AAAA,aACG;AACH,gBAAM,gBAAgB,cAAc,SAAS,IAAI,cAAc,SAAS,IAAI;AAC5E,gBAAM,WAAW,cAAc;AAC/B,uBAAa,+BAAc,kBAAkB,QAAQ,CAAC;AAAA,QACxD;AACA;AAAA,MACF;AACA,UAAI,iBAAiB,YAAY,+BAAc,MAAM;AACnD,cAAM,gBAAgB,cAAc,SAAS,IAAI,cAAc,SAAS,IAAI;AAC5E,cAAM,WAAW,cAAc;AAC/B,qBA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B,+BAAc,4BAA4B,+BAAc,oBAAoB;AAAA,eACvG,qBAAqB,IAAI;AAChC,cAAM,gBAAgB,qBAAqB,cAAc,SAAS,IAAI,IAAI,mBAAmB;AAC7F,cAAM,WAAW,cAAc;AAC/B,qBAAa,+BAAc,kBAAkB,QAAQ,CAAC;AAAA,MACxD,OAAO;AACL,cAAM,gBAAgB,cAAc,SAAS;AAC7C,cAAM,WAAW,cAAc;AAC/B,qBAAa,+BAAc,kBAAkB,QAAQ,CAAC;AAAA,MACxD;AAAA,IACF;AAAA,IACA,CAAC,iBAAiB,yBAAyB,kBAAkB,cAAc,YAAY,kBAAkB;AAAA,EAC3G;AACA,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,gBAAgB,CAAC,SAAuC,aAAa,KAAK,UAAU;AAAA,MACpF,qBAAqB,MAAM,aAAa,+BAAc,KAAK;AAAA,MAC3D,qBAAqB,MAAM,aAAa,+BAAc,KAAK;AAAA,MAC3D,oBAAoB,MAAM,aAAa,+BAAc,IAAI;AAAA,MACzD,kCAAkC,MAAM,aAAa,+BAAc,yBAAyB;AAAA,MAC5F,uBAAuB,MAAM,aAAa,+BAAc,oBAAoB;AAAA,MAC5E;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,cAAc,oBAAoB,kBAAkB;AAAA,EACzE;AACF;",
6
6
  "names": []
7
7
  }
@@ -29,12 +29,16 @@ __export(useFocusRegionTrackers_exports, {
29
29
  module.exports = __toCommonJS(useFocusRegionTrackers_exports);
30
30
  var React = __toESM(require("react"));
31
31
  var import_react = require("react");
32
+ var import_ds_utilities = require("@elliemae/ds-utilities");
32
33
  var import_useStore = require("../useStore");
33
34
  var import_constants = require("../../constants/index");
34
35
  const useFocusRegionTrackers = () => {
36
+ const focusRegion = (0, import_useStore.useInternalStore)((state) => state.focusRegion);
37
+ const mutableFocusRegion = (0, import_ds_utilities.useMakeMutable)(focusRegion);
35
38
  const setFocusRegion = (0, import_useStore.useInternalStore)((state) => state.setFocusRegion);
36
39
  return (0, import_react.useMemo)(
37
40
  () => ({
41
+ mutableFocusRegion,
38
42
  trackFocusRegionSourceHeader: () => setFocusRegion(import_constants.REGIONS_FOCUSES.SOURCE_HEADER),
39
43
  trackFocusRegionSourcePanel: () => setFocusRegion(import_constants.REGIONS_FOCUSES.SOURCE_PANEL),
40
44
  trackFocusRegionSourceBottom: () => setFocusRegion(import_constants.REGIONS_FOCUSES.SOURCE_BOTTOM),
@@ -77,7 +81,7 @@ const useFocusRegionTrackers = () => {
77
81
  },
78
82
  trackFocusRegionReset: () => setFocusRegion("")
79
83
  }),
80
- [setFocusRegion]
84
+ [mutableFocusRegion, setFocusRegion]
81
85
  );
82
86
  };
83
87
  //# sourceMappingURL=useFocusRegionTrackers.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/config/useFocusTracker/useFocusRegionTrackers.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { useMemo } from 'react';\nimport { useInternalStore } from '../useStore';\nimport { REGIONS_FOCUSES } from '../../constants/index';\n\nexport const useFocusRegionTrackers = () => {\n const setFocusRegion = useInternalStore((state) => state.setFocusRegion);\n return useMemo(\n () => ({\n trackFocusRegionSourceHeader: () => setFocusRegion(REGIONS_FOCUSES.SOURCE_HEADER),\n trackFocusRegionSourcePanel: () => setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL),\n trackFocusRegionSourceBottom: () => setFocusRegion(REGIONS_FOCUSES.SOURCE_BOTTOM),\n trackFocusRegionSourcePanelItem: () => setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL_ITEM),\n trackFocusRegionSourcePanelFocusAll: () => setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL_ITEM_MOVE_ALL),\n trackFocusRegionDestinationHeader: () => setFocusRegion(REGIONS_FOCUSES.DESTINATION_HEADER),\n trackFocusRegionDestinationPanel: () => setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL),\n trackFocusRegionDestinationBottom: () => setFocusRegion(REGIONS_FOCUSES.DESTINATION_BOTTOM),\n trackFocusRegionDestinationPanelItem: () => setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL_ITEM),\n trackFocusRegionDestinationPanelFocusMoveAll: () =>\n setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL_ITEM_MOVE_ALL),\n trackFocusRegionHeader: (isDestinationPanel: boolean) => {\n if (isDestinationPanel) setFocusRegion(REGIONS_FOCUSES.DESTINATION_HEADER);\n else setFocusRegion(REGIONS_FOCUSES.SOURCE_HEADER);\n },\n trackFocusRegionBottom: (isDestinationPanel: boolean) => {\n if (isDestinationPanel) setFocusRegion(REGIONS_FOCUSES.DESTINATION_BOTTOM);\n else setFocusRegion(REGIONS_FOCUSES.SOURCE_BOTTOM);\n },\n trackFocusRegionPanel: (isDestinationPanel: boolean) => {\n if (isDestinationPanel) setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL);\n else setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL);\n },\n trackFocusRegionPanelItem: (isDestinationPanel: boolean) => {\n if (isDestinationPanel) setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL_ITEM);\n else setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL_ITEM);\n },\n trackFocusRegionPanelFocusMoveAll: (isDestinationPanel: boolean) => {\n if (isDestinationPanel) setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL_ITEM_MOVE_ALL);\n else setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL_ITEM_MOVE_ALL);\n },\n trackFocusRegionReset: () => setFocusRegion(''),\n }),\n [setFocusRegion],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AACxB,sBAAiC;AACjC,uBAAgC;AAEzB,MAAM,yBAAyB,MAAM;AAC1C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AChD;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AACF;",
4
+ "sourcesContent": ["import { useMemo } from 'react';\nimport { useMakeMutable } from '@elliemae/ds-utilities';\nimport { useInternalStore } from '../useStore';\nimport { REGIONS_FOCUSES } from '../../constants/index';\n\nexport const useFocusRegionTrackers = () => {\n const focusRegion = useInternalStore((state) => state.focusRegion);\n // tracking actions are always triggered as user action callbacks\n // this means it should always be invoked after all the useEffect execute\n // since this is the case, we can avoid re-declaring the function with mutable pattern\n // this way we avoid useless re-renders\n const mutableFocusRegion = useMakeMutable(focusRegion);\n const setFocusRegion = useInternalStore((state) => state.setFocusRegion);\n return useMemo(\n () => ({\n mutableFocusRegion,\n trackFocusRegionSourceHeader: () => setFocusRegion(REGIONS_FOCUSES.SOURCE_HEADER),\n trackFocusRegionSourcePanel: () => setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL),\n trackFocusRegionSourceBottom: () => setFocusRegion(REGIONS_FOCUSES.SOURCE_BOTTOM),\n trackFocusRegionSourcePanelItem: () => setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL_ITEM),\n trackFocusRegionSourcePanelFocusAll: () => setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL_ITEM_MOVE_ALL),\n trackFocusRegionDestinationHeader: () => setFocusRegion(REGIONS_FOCUSES.DESTINATION_HEADER),\n trackFocusRegionDestinationPanel: () => setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL),\n trackFocusRegionDestinationBottom: () => setFocusRegion(REGIONS_FOCUSES.DESTINATION_BOTTOM),\n trackFocusRegionDestinationPanelItem: () => setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL_ITEM),\n trackFocusRegionDestinationPanelFocusMoveAll: () =>\n setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL_ITEM_MOVE_ALL),\n trackFocusRegionHeader: (isDestinationPanel: boolean) => {\n if (isDestinationPanel) setFocusRegion(REGIONS_FOCUSES.DESTINATION_HEADER);\n else setFocusRegion(REGIONS_FOCUSES.SOURCE_HEADER);\n },\n trackFocusRegionBottom: (isDestinationPanel: boolean) => {\n if (isDestinationPanel) setFocusRegion(REGIONS_FOCUSES.DESTINATION_BOTTOM);\n else setFocusRegion(REGIONS_FOCUSES.SOURCE_BOTTOM);\n },\n trackFocusRegionPanel: (isDestinationPanel: boolean) => {\n if (isDestinationPanel) setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL);\n else setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL);\n },\n trackFocusRegionPanelItem: (isDestinationPanel: boolean) => {\n if (isDestinationPanel) setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL_ITEM);\n else setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL_ITEM);\n },\n trackFocusRegionPanelFocusMoveAll: (isDestinationPanel: boolean) => {\n if (isDestinationPanel) setFocusRegion(REGIONS_FOCUSES.DESTINATION_PANEL_ITEM_MOVE_ALL);\n else setFocusRegion(REGIONS_FOCUSES.SOURCE_PANEL_ITEM_MOVE_ALL);\n },\n trackFocusRegionReset: () => setFocusRegion(''),\n }),\n [mutableFocusRegion, setFocusRegion],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AACxB,0BAA+B;AAC/B,sBAAiC;AACjC,uBAAgC;AAEzB,MAAM,yBAAyB,MAAM;AAC1C,QAAM,kBAAc,kCAAiB,CAAC,UAAU,MAAM,WAAW;AAKjE,QAAM,yBAAqB,oCAAe,WAAW;AACrD,QAAM,qBAAiB,kCAAiB,CAAC,UAAU,MAAM,cAAc;AACvE,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,8BAA8B,MAAM,eAAe,iCAAgB,aAAa;AAAA,MAChF,6BAA6B,MAAM,eAAe,iCAAgB,YAAY;AAAA,MAC9E,8BAA8B,MAAM,eAAe,iCAAgB,aAAa;AAAA,MAChF,iCAAiC,MAAM,eAAe,iCAAgB,iBAAiB;AAAA,MACvF,qCAAqC,MAAM,eAAe,iCAAgB,0BAA0B;AAAA,MACpG,mCAAmC,MAAM,eAAe,iCAAgB,kBAAkB;AAAA,MAC1F,kCAAkC,MAAM,eAAe,iCAAgB,iBAAiB;AAAA,MACxF,mCAAmC,MAAM,eAAe,iCAAgB,kBAAkB;AAAA,MAC1F,sCAAsC,MAAM,eAAe,iCAAgB,sBAAsB;AAAA,MACjG,8CAA8C,MAC5C,eAAe,iCAAgB,+BAA+B;AAAA,MAChE,wBAAwB,CAAC,uBAAgC;AACvD,YAAI;AAAoB,yBAAe,iCAAgB,kBAAkB;AAAA;AACpE,yBAAe,iCAAgB,aAAa;AAAA,MACnD;AAAA,MACA,wBAAwB,CAAC,uBAAgC;AACvD,YAAI;AAAoB,yBAAe,iCAAgB,kBAAkB;AAAA;AACpE,yBAAe,iCAAgB,aAAa;AAAA,MACnD;AAAA,MACA,uBAAuB,CAAC,uBAAgC;AACtD,YAAI;AAAoB,yBAAe,iCAAgB,iBAAiB;AAAA;AACnE,yBAAe,iCAAgB,YAAY;AAAA,MAClD;AAAA,MACA,2BAA2B,CAAC,uBAAgC;AAC1D,YAAI;AAAoB,yBAAe,iCAAgB,sBAAsB;AAAA;AACxE,yBAAe,iCAAgB,iBAAiB;AAAA,MACvD;AAAA,MACA,mCAAmC,CAAC,uBAAgC;AAClE,YAAI;AAAoB,yBAAe,iCAAgB,+BAA+B;AAAA;AACjF,yBAAe,iCAAgB,0BAA0B;AAAA,MAChE;AAAA,MACA,uBAAuB,MAAM,eAAe,EAAE;AAAA,IAChD;AAAA,IACA,CAAC,oBAAoB,cAAc;AAAA,EACrC;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,18 @@
1
+ import { type StoreApi } from 'zustand';
2
+ import type { InternalAtoms, Store } from './useStore';
3
+
4
+ type StateSetterNewVal =
5
+ | InternalAtoms[keyof InternalAtoms][0]
6
+ | ((oldVal: InternalAtoms[keyof InternalAtoms][0]) => InternalAtoms[keyof InternalAtoms][0]);
7
+ export const createAtomInStore = (
8
+ defaultVal: InternalAtoms[keyof InternalAtoms][0],
9
+ stateKey: keyof InternalAtoms,
10
+ set: StoreApi<Store>['setState'],
11
+ get: StoreApi<Store>['getState'],
12
+ ) => {
13
+ const stateSetter = (newVal: StateSetterNewVal) => {
14
+ if (typeof newVal === 'function') set({ [stateKey]: [newVal(get()[stateKey][0]), stateSetter] });
15
+ else set({ [stateKey]: [newVal, stateSetter] });
16
+ };
17
+ return [defaultVal, stateSetter] as const;
18
+ };
@@ -33,16 +33,13 @@ __export(useStore_exports, {
33
33
  module.exports = __toCommonJS(useStore_exports);
34
34
  var React = __toESM(require("react"));
35
35
  var import_ds_zustand_helpers = require("@elliemae/ds-zustand-helpers");
36
- var import_react = __toESM(require("fast-deep-equal/react"));
37
36
  var import_react_desc_prop_types = require("../../react-desc-prop-types");
38
37
  var import_constants = require("../../constants");
39
38
  var import_useAutoCalculated = require("../useAutoCalculated");
40
- var import_focusAndTabIndexManager = require("./focusAndTabIndexManager");
41
39
  const internalAtomDefaultValues = {
42
40
  focusRegion: import_constants.REGIONS_FOCUSES.RESET,
43
41
  focusItem: import_constants.ITEMS_FOCUSES.RESET,
44
42
  focusItemAction: import_constants.ACTIONS_FOCUSES.RESET,
45
- shouldFocusItemOnRender: false,
46
43
  dropIndicatorPosition: 0,
47
44
  overId: "",
48
45
  lastActiveId: "",
@@ -57,15 +54,6 @@ const selectors = (get) => ({
57
54
  getPanelLastSelectedItem: (isDestinationPanel) => isDestinationPanel ? get()?.destinationPanelLastSelectedItem : get()?.sourcePanelLastSelectedItem
58
55
  });
59
56
  const reducers = () => ({});
60
- const subscribers = (api) => {
61
- api.subscribe(
62
- (state) => [state.focusRegion, state.focusItem, state.focusItemAction, state.get],
63
- import_focusAndTabIndexManager.focusAndTabIndexManager,
64
- {
65
- equalityFn: import_react.default
66
- }
67
- );
68
- };
69
57
  const { PropsProvider, usePropsStore, InternalProvider, useInternalStore } = (0, import_ds_zustand_helpers.createInternalAndPropsContext)();
70
58
  const config = {
71
59
  defaultProps: import_react_desc_prop_types.defaultProps,
@@ -73,7 +61,6 @@ const config = {
73
61
  useAutoCalculated: import_useAutoCalculated.useAutoCalculated,
74
62
  selectors,
75
63
  reducers,
76
- subscribers,
77
64
  PropsProvider,
78
65
  usePropsStore,
79
66
  InternalProvider,