sag_components 2.0.0-beta246 → 2.0.0-beta247

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -10581,24 +10581,23 @@ const QuarterPopupPicker = ({
10581
10581
  };
10582
10582
 
10583
10583
  /* eslint-disable import/no-extraneous-dependencies */
10584
- const QuarterPicker = _ref => {
10585
- let {
10586
- availableQuarters,
10587
- // ["Q1-2024"]
10588
- label,
10589
- onChange,
10590
- borderRadius,
10591
- required,
10592
- width,
10593
- height,
10594
- placeholder,
10595
- disabled,
10596
- borderColor,
10597
- borderColorFocus,
10598
- textColor,
10599
- selectedValue,
10600
- startYear
10601
- } = _ref;
10584
+ const QuarterPicker = ({
10585
+ availableQuarters,
10586
+ // ["Q1-2024"]
10587
+ label,
10588
+ onChange,
10589
+ borderRadius,
10590
+ required,
10591
+ width,
10592
+ height,
10593
+ placeholder,
10594
+ disabled,
10595
+ borderColor,
10596
+ borderColorFocus,
10597
+ textColor,
10598
+ selectedValue,
10599
+ startYear
10600
+ }) => {
10602
10601
  const [isFocused, setIsFocused] = useState(false);
10603
10602
  const [isOpen, setIsOpen] = useState(false);
10604
10603
  const [value, setValue] = useState('');
@@ -11040,23 +11039,22 @@ const MonthPopupPicker = ({
11040
11039
  };
11041
11040
 
11042
11041
  /* eslint-disable import/no-extraneous-dependencies */
11043
- const MonthPicker = _ref => {
11044
- let {
11045
- availableMonths,
11046
- label,
11047
- onChange,
11048
- borderRadius,
11049
- required,
11050
- width,
11051
- height,
11052
- placeholder,
11053
- disabled,
11054
- borderColor,
11055
- borderColorFocus,
11056
- textColor,
11057
- selectedValue,
11058
- startYear
11059
- } = _ref;
11042
+ const MonthPicker = ({
11043
+ availableMonths,
11044
+ label,
11045
+ onChange,
11046
+ borderRadius,
11047
+ required,
11048
+ width,
11049
+ height,
11050
+ placeholder,
11051
+ disabled,
11052
+ borderColor,
11053
+ borderColorFocus,
11054
+ textColor,
11055
+ selectedValue,
11056
+ startYear
11057
+ }) => {
11060
11058
  const [isFocused, setIsFocused] = useState(false);
11061
11059
  const [isOpen, setIsOpen] = useState(false);
11062
11060
  const [value, setValue] = useState('');
@@ -24167,22 +24165,21 @@ const DeleteIcon = styled.div`
24167
24165
  position: absolute;
24168
24166
  `;
24169
24167
 
24170
- const QuickFilterDropdownSingle = _ref => {
24171
- let {
24172
- label,
24173
- hoverColor,
24174
- options,
24175
- selectedValue,
24176
- placeHolder,
24177
- onChange,
24178
- disabled,
24179
- width,
24180
- error,
24181
- errorMessage,
24182
- xIconShow,
24183
- labelColor,
24184
- showLabelOnTop
24185
- } = _ref;
24168
+ const QuickFilterDropdownSingle = ({
24169
+ label,
24170
+ hoverColor,
24171
+ options,
24172
+ selectedValue,
24173
+ placeHolder,
24174
+ onChange,
24175
+ disabled,
24176
+ width,
24177
+ error,
24178
+ errorMessage,
24179
+ xIconShow,
24180
+ labelColor,
24181
+ showLabelOnTop
24182
+ }) => {
24186
24183
  const [isFocused, setIsFocused] = useState(false);
24187
24184
  const [showOptions, setShowOptions] = useState(false);
24188
24185
  const [inputValue, setInputValue] = useState("");
@@ -24639,26 +24636,25 @@ const IconContainer$2 = styled.div`
24639
24636
  cursor: pointer;
24640
24637
  `;
24641
24638
 
24642
- const QuickFilterDropdownMultiSelection = _ref => {
24643
- let {
24644
- label,
24645
- labelEmptyValue,
24646
- options,
24647
- selectedValue,
24648
- placeHolder,
24649
- onChange,
24650
- required,
24651
- disabled,
24652
- width,
24653
- height,
24654
- error,
24655
- errorMessage,
24656
- labelColor,
24657
- xIconShow,
24658
- checkBoxColor,
24659
- showLabelOnTop,
24660
- dropdownHeight
24661
- } = _ref;
24639
+ const QuickFilterDropdownMultiSelection = ({
24640
+ label,
24641
+ labelEmptyValue,
24642
+ options,
24643
+ selectedValue,
24644
+ placeHolder,
24645
+ onChange,
24646
+ required,
24647
+ disabled,
24648
+ width,
24649
+ height,
24650
+ error,
24651
+ errorMessage,
24652
+ labelColor,
24653
+ xIconShow,
24654
+ checkBoxColor,
24655
+ showLabelOnTop,
24656
+ dropdownHeight
24657
+ }) => {
24662
24658
  const [isFocused, setIsFocused] = useState(false);
24663
24659
  const [showOptions, setShowOptions] = useState(false);
24664
24660
  const [inputValue, setInputValue] = useState('');
@@ -36112,19 +36108,15 @@ const ToggleInput = styled.input`
36112
36108
  const ToggleSlider = styled.span`
36113
36109
  display: block;
36114
36110
  position: relative;
36115
- background: ${_ref => {
36116
- let {
36117
- checked,
36118
- disabled
36119
- } = _ref;
36120
- return checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0";
36121
- }};
36111
+ background: ${({
36112
+ checked,
36113
+ disabled
36114
+ }) => checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0"};
36122
36115
  border-radius: 999px;
36123
36116
  transition: background 0.2s;
36124
- ${_ref2 => {
36125
- let {
36126
- size
36127
- } = _ref2;
36117
+ ${({
36118
+ size
36119
+ }) => {
36128
36120
  switch (size) {
36129
36121
  case "s":
36130
36122
  return css`width: 40px; height: 20px;`;
@@ -36140,18 +36132,14 @@ const ToggleSlider = styled.span`
36140
36132
  left: 3px;
36141
36133
  top: 50%;
36142
36134
  transform: translateY(-50%);
36143
- background: ${_ref3 => {
36144
- let {
36145
- disabled
36146
- } = _ref3;
36147
- return disabled ? "#D0D0D0" : "#fff";
36148
- }};
36135
+ background: ${({
36136
+ disabled
36137
+ }) => disabled ? "#D0D0D0" : "#fff"};
36149
36138
  border-radius: 50%;
36150
36139
  transition: left 0.2s, width 0.2s, height 0.2s;
36151
- ${_ref4 => {
36152
- let {
36153
- size
36154
- } = _ref4;
36140
+ ${({
36141
+ size
36142
+ }) => {
36155
36143
  switch (size) {
36156
36144
  case "s":
36157
36145
  return css`width: 14px; height: 14px;`;
@@ -36161,11 +36149,10 @@ const ToggleSlider = styled.span`
36161
36149
  return css`width: 20px; height: 20px;`;
36162
36150
  }
36163
36151
  }}
36164
- left: ${_ref5 => {
36165
- let {
36166
- checked,
36167
- size
36168
- } = _ref5;
36152
+ left: ${({
36153
+ checked,
36154
+ size
36155
+ }) => {
36169
36156
  if (!checked) return "3px";
36170
36157
  switch (size) {
36171
36158
  case "s":
@@ -36179,9 +36166,9 @@ const ToggleSlider = styled.span`
36179
36166
  }
36180
36167
  `;
36181
36168
 
36182
- /**
36183
- * ToggleSwitch component for on/off states.
36184
- * Supports small/large sizes and disabled state.
36169
+ /**
36170
+ * ToggleSwitch component for on/off states.
36171
+ * Supports small/large sizes and disabled state.
36185
36172
  */
36186
36173
  function ToggleSwitch(_ref) {
36187
36174
  let {
@@ -40799,7 +40786,8 @@ const TableHeader = ({
40799
40786
  activeSorts = [],
40800
40787
  expandable = false,
40801
40788
  onHeaderCheckboxClick = () => {},
40802
- headerCheckboxStates = {}
40789
+ headerCheckboxStates = {},
40790
+ resetFiltersKey = 0 // NEW: Add this prop
40803
40791
  }) => {
40804
40792
  const [focusedFilter, setFocusedFilter] = useState(null);
40805
40793
  const [focusedSort, setFocusedSort] = useState(null);
@@ -40810,21 +40798,46 @@ const TableHeader = ({
40810
40798
  left: 0
40811
40799
  });
40812
40800
  const [filterState, setFilterState] = useState({});
40813
-
40814
- // Add persistent filter selections state
40815
40801
  const [filterSelections, setFilterSelections] = useState({});
40802
+ const [activeSortColumn, setActiveSortColumn] = useState(null);
40803
+ const [activeSortValue, setActiveSortValue] = useState(null);
40804
+ const iconRefs = useRef({});
40805
+ const popupRef = useRef(null);
40816
40806
 
40817
- // MODIFIED: Changed to track only ONE active sort (single column key and value)
40818
- const [activeSortColumn, setActiveSortColumn] = useState(null); // Only one column key
40819
- const [activeSortValue, setActiveSortValue] = useState(null); // Only one sort value
40807
+ // NEW: Reset internal state when resetFiltersKey changes
40808
+ useEffect(() => {
40809
+ if (resetFiltersKey > 0) {
40810
+ // Reset filter selections to default (all selected)
40811
+ const resetSelections = {};
40812
+ columns.forEach(column => {
40813
+ if (column.filter && column.filterOptions) {
40814
+ const initialState = {};
40815
+ const fullList = [{
40816
+ value: 'All',
40817
+ label: 'Select All'
40818
+ }, ...column.filterOptions];
40819
+ fullList.forEach(item => {
40820
+ initialState[item.value] = true;
40821
+ });
40822
+ resetSelections[column.key] = initialState;
40823
+ }
40824
+ });
40825
+ setFilterSelections(resetSelections);
40820
40826
 
40821
- // Refs to track icon button positions
40822
- const iconRefs = useRef({});
40827
+ // Reset filter state
40828
+ setFilterState({});
40823
40829
 
40824
- // Ref for the popup content to measure its dimensions
40825
- const popupRef = useRef(null);
40830
+ // Reset sort state
40831
+ setActiveSortColumn(null);
40832
+ setActiveSortValue(null);
40833
+
40834
+ // Close any open popups
40835
+ setVisibleFilterPopWrapper(null);
40836
+ setVisibleSortPopWrapper(null);
40837
+ }
40838
+ }, [resetFiltersKey, columns]);
40826
40839
 
40827
- // FIXED: Initialize filter selections ONLY for new columns, preserve existing selections
40840
+ // Initialize filter selections for new columns
40828
40841
  useEffect(() => {
40829
40842
  setFilterSelections(prevSelections => {
40830
40843
  const newSelections = {
@@ -40832,7 +40845,6 @@ const TableHeader = ({
40832
40845
  };
40833
40846
  let hasChanges = false;
40834
40847
  columns.forEach(column => {
40835
- // Only initialize if column doesn't exist in state yet
40836
40848
  if (column.filter && column.filterOptions && !newSelections[column.key]) {
40837
40849
  const initialState = {};
40838
40850
  const fullList = [{
@@ -40845,69 +40857,48 @@ const TableHeader = ({
40845
40857
  newSelections[column.key] = initialState;
40846
40858
  hasChanges = true;
40847
40859
  } else if (column.filter && column.filterOptions && newSelections[column.key]) {
40848
- // Column exists - check if we need to add new options that appeared
40849
40860
  const currentSelections = newSelections[column.key];
40850
40861
  const newOptions = column.filterOptions.filter(opt => currentSelections[opt.value] === undefined);
40851
-
40852
- // Only update if there are genuinely new options
40853
40862
  if (newOptions.length > 0) {
40854
40863
  const updatedSelections = {
40855
40864
  ...currentSelections
40856
40865
  };
40857
40866
  newOptions.forEach(opt => {
40858
- updatedSelections[opt.value] = true; // New options start selected
40867
+ updatedSelections[opt.value] = true;
40859
40868
  });
40860
40869
  newSelections[column.key] = updatedSelections;
40861
40870
  hasChanges = true;
40862
40871
  }
40863
40872
  }
40864
40873
  });
40865
-
40866
- // Only return new object if there were actual changes
40867
40874
  return hasChanges ? newSelections : prevSelections;
40868
40875
  });
40869
40876
  }, [columns]);
40870
-
40871
- // Helper function to check if filter is in default state (all items selected)
40872
40877
  const isFilterInDefaultState = columnKey => {
40873
40878
  const filterData = filterState[columnKey];
40874
40879
  if (!filterData) {
40875
- return true; // No filter applied
40880
+ return true;
40876
40881
  }
40877
-
40878
- // For range filters, check if "All weeks" is selected
40879
40882
  if (filterData.selectedRadio) {
40880
40883
  return filterData.selectedRadio === 'all weeks';
40881
40884
  }
40882
-
40883
- // Check if it's in "select all" state with no exclusions
40884
40885
  return filterData.isSelectAll && filterData.excluded?.length === 0 && filterData.included?.length === 0;
40885
40886
  };
40886
-
40887
- // Helper function to determine filter icon state
40888
40887
  const getFilterIconState = columnKey => {
40889
40888
  const isFocused = focusedFilter === columnKey;
40890
40889
  const isActive = activeFilters.includes(columnKey);
40891
40890
  const isDefault = isFilterInDefaultState(columnKey);
40892
-
40893
- // If it's in default state (all selected), show as default
40894
40891
  if (isDefault) {
40895
40892
  return 'default';
40896
40893
  }
40897
-
40898
- // If focused or active and not in default state, show as active
40899
40894
  if (isFocused || isActive) {
40900
40895
  return 'active';
40901
40896
  }
40902
-
40903
- // If has filter applied but not default, show as active
40904
40897
  if (filterState[columnKey]) {
40905
40898
  return 'active';
40906
40899
  }
40907
40900
  return 'default';
40908
40901
  };
40909
-
40910
- // Enhanced function to calculate position with viewport boundary detection
40911
40902
  const calculatePopPosition = (iconElement, popupWidth = 300, popupHeight = 400) => {
40912
40903
  if (!iconElement) return {
40913
40904
  top: 0,
@@ -40918,32 +40909,20 @@ const TableHeader = ({
40918
40909
  const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
40919
40910
  const viewportWidth = window.innerWidth;
40920
40911
  const viewportHeight = window.innerHeight;
40921
- let top = rect.bottom + scrollTop + 4; // 4px gap below the icon
40912
+ let top = rect.bottom + scrollTop + 4;
40922
40913
  let left = rect.left + scrollLeft;
40923
-
40924
- // Check if popup would overflow right edge of viewport
40925
40914
  if (left + popupWidth > viewportWidth) {
40926
- // Position to the left of the icon instead
40927
40915
  left = rect.right + scrollLeft - popupWidth;
40928
-
40929
- // If it still overflows on the left, clamp to viewport
40930
40916
  if (left < 0) {
40931
- left = 8; // Small margin from edge
40917
+ left = 8;
40932
40918
  }
40933
40919
  }
40934
-
40935
- // Check if popup would overflow bottom edge of viewport
40936
40920
  if (rect.bottom + popupHeight > viewportHeight) {
40937
- // Position above the icon instead
40938
- top = rect.top + scrollTop - popupHeight - 4; // 4px gap above the icon
40939
-
40940
- // If it still overflows on the top, clamp to viewport
40921
+ top = rect.top + scrollTop - popupHeight - 4;
40941
40922
  if (top < scrollTop) {
40942
- top = scrollTop + 8; // Small margin from top
40923
+ top = scrollTop + 8;
40943
40924
  }
40944
40925
  }
40945
-
40946
- // Ensure left position doesn't go negative
40947
40926
  if (left < 0) {
40948
40927
  left = 8;
40949
40928
  }
@@ -40952,16 +40931,12 @@ const TableHeader = ({
40952
40931
  left
40953
40932
  };
40954
40933
  };
40955
-
40956
- // Function to estimate popup dimensions based on content type
40957
40934
  const getEstimatedPopupDimensions = columnKey => {
40958
40935
  const column = columns.find(col => col.key === columnKey);
40959
40936
  if (!column) return {
40960
40937
  width: 300,
40961
40938
  height: 400
40962
40939
  };
40963
-
40964
- // Default dimensions
40965
40940
  let width = 300;
40966
40941
  let height = 400;
40967
40942
  if (column.freeTextFilter) {
@@ -40971,8 +40946,7 @@ const TableHeader = ({
40971
40946
  width = 300;
40972
40947
  height = 300;
40973
40948
  } else if (column.filterOptions) {
40974
- // Estimate height based on number of options
40975
- const optionCount = column.filterOptions.length + 1; // +1 for "Select All"
40949
+ const optionCount = column.filterOptions.length + 1;
40976
40950
  height = Math.min(Math.max(optionCount * 32 + 100, 200), 500);
40977
40951
  } else if (column.sortOptions) {
40978
40952
  const optionCount = column.sortOptions.length;
@@ -40983,8 +40957,6 @@ const TableHeader = ({
40983
40957
  height
40984
40958
  };
40985
40959
  };
40986
-
40987
- // Update handleSort to remove onSort call (only opens/closes popup)
40988
40960
  const handleSort = key => {
40989
40961
  const iconElement = iconRefs.current[`sort-${key}`];
40990
40962
  if (iconElement) {
@@ -40992,7 +40964,7 @@ const TableHeader = ({
40992
40964
  setPopPosition(calculatePopPosition(iconElement, dimensions.width, dimensions.height));
40993
40965
  }
40994
40966
  setVisibleSortPopWrapper(prevKey => prevKey === key ? null : key);
40995
- setVisibleFilterPopWrapper(null); // Hide filter PopWrapper when sort PopWrapper is shown
40967
+ setVisibleFilterPopWrapper(null);
40996
40968
  };
40997
40969
  useEffect(() => {
40998
40970
  if (Object.keys(filterState).length > 0) {
@@ -41006,46 +40978,29 @@ const TableHeader = ({
41006
40978
  setPopPosition(calculatePopPosition(iconElement, dimensions.width, dimensions.height));
41007
40979
  }
41008
40980
  setVisibleFilterPopWrapper(prevKey => prevKey === key ? null : key);
41009
- setVisibleSortPopWrapper(null); // Hide sort PopWrapper when filter PopWrapper is shown
40981
+ setVisibleSortPopWrapper(null);
41010
40982
  };
41011
-
41012
- // MODIFIED: Handle sort selection - Reset previous sort and apply new one
41013
40983
  const handleSortSelectionChange = (columnKey, sortValue) => {
41014
- // If selecting a new column, reset the previous sort
41015
40984
  if (activeSortColumn && activeSortColumn !== columnKey) {
41016
- // Clear the previous sort
41017
40985
  setActiveSortColumn(columnKey);
41018
40986
  setActiveSortValue(sortValue);
41019
40987
  } else {
41020
- // Same column or first sort
41021
40988
  setActiveSortColumn(columnKey);
41022
40989
  setActiveSortValue(sortValue);
41023
40990
  }
41024
-
41025
- // Close the popup after selection
41026
40991
  setVisibleSortPopWrapper(null);
41027
-
41028
- // Call onSort with both column key and selected sort value
41029
40992
  if (onSort) {
41030
40993
  onSort(columnKey, sortValue);
41031
40994
  }
41032
40995
  };
41033
-
41034
- // MODIFIED: Handle sort reset - Clear the active sort
41035
40996
  const handleSortReset = columnKey => {
41036
- // Clear the active sort state
41037
40997
  setActiveSortColumn(null);
41038
40998
  setActiveSortValue(null);
41039
-
41040
- // Call onSort to notify that sort was reset
41041
40999
  if (onSort) {
41042
41000
  onSort(columnKey, null);
41043
41001
  }
41044
41002
  };
41045
-
41046
- // Handle filter selection changes - Updated to work with stateless FilterPop
41047
41003
  const handleFilterSelectionChange = (columnKey, selectionData) => {
41048
- // Force immediate synchronous update using callback form
41049
41004
  setFilterSelections(prev => {
41050
41005
  const updated = {
41051
41006
  ...prev,
@@ -41053,15 +41008,11 @@ const TableHeader = ({
41053
41008
  };
41054
41009
  return updated;
41055
41010
  });
41056
-
41057
- // Also update filter state
41058
41011
  setFilterState(prev => ({
41059
41012
  ...prev,
41060
41013
  [columnKey]: selectionData.filterData
41061
41014
  }));
41062
41015
  };
41063
-
41064
- // Handle filter reset - Updated to work with stateless FilterPop
41065
41016
  const handleFilterReset = columnKey => {
41066
41017
  const column = columns.find(col => col.key === columnKey);
41067
41018
  if (column && column.filterOptions) {
@@ -41073,14 +41024,10 @@ const TableHeader = ({
41073
41024
  fullList.forEach(item => {
41074
41025
  resetState[item.value] = true;
41075
41026
  });
41076
-
41077
- // Update filter selections immediately
41078
41027
  setFilterSelections(prev => ({
41079
41028
  ...prev,
41080
41029
  [columnKey]: resetState
41081
41030
  }));
41082
-
41083
- // Set filter state to "select all" structure
41084
41031
  const resetFilterData = {
41085
41032
  excluded: [],
41086
41033
  included: [],
@@ -41092,8 +41039,6 @@ const TableHeader = ({
41092
41039
  }));
41093
41040
  }
41094
41041
  };
41095
-
41096
- // Update the click outside handlers
41097
41042
  useEffect(() => {
41098
41043
  const handleClickOutside = event => {
41099
41044
  if (!event.target.closest(`[data-column="${visibleFilterPopWrapper}"]`) && !event.target.closest('.pop-wrapper')) {
@@ -41116,8 +41061,6 @@ const TableHeader = ({
41116
41061
  document.removeEventListener('mousedown', handleClickOutside);
41117
41062
  };
41118
41063
  }, [visibleSortPopWrapper]);
41119
-
41120
- // Enhanced position update with better dimension handling
41121
41064
  useEffect(() => {
41122
41065
  const updatePosition = () => {
41123
41066
  if (visibleSortPopWrapper) {
@@ -41134,12 +41077,10 @@ const TableHeader = ({
41134
41077
  }
41135
41078
  }
41136
41079
  };
41137
-
41138
- // Debounce the position update for better performance
41139
41080
  let timeoutId;
41140
41081
  const debouncedUpdatePosition = () => {
41141
41082
  clearTimeout(timeoutId);
41142
- timeoutId = setTimeout(updatePosition, 16); // ~60fps
41083
+ timeoutId = setTimeout(updatePosition, 16);
41143
41084
  };
41144
41085
  window.addEventListener('scroll', debouncedUpdatePosition, {
41145
41086
  passive: true
@@ -41167,21 +41108,14 @@ const TableHeader = ({
41167
41108
  const shouldShowActiveIcon = key => {
41168
41109
  return isFilterActive(key) || isFilterFocused(key);
41169
41110
  };
41170
-
41171
- // MODIFIED: Check if THIS specific column has an active sort
41172
41111
  const shouldShowActiveSortIcon = key => {
41173
41112
  const isFocused = focusedSort === key;
41174
41113
  const isActive = activeSorts.includes(key);
41175
41114
  const hasSelection = activeSortColumn === key && activeSortValue !== null;
41176
41115
  return isFocused || isActive || hasSelection;
41177
41116
  };
41178
-
41179
- // Handle header checkbox click
41180
41117
  const handleHeaderCheckboxClick = (columnKey, event) => {
41181
- // Don't prevent the default checkbox behavior
41182
41118
  const newValue = event.target.checked;
41183
-
41184
- // Fire the callback with column info and new value - let parent handle state
41185
41119
  if (onHeaderCheckboxClick) {
41186
41120
  onHeaderCheckboxClick({
41187
41121
  columnName: columnKey,
@@ -41189,8 +41123,6 @@ const TableHeader = ({
41189
41123
  });
41190
41124
  }
41191
41125
  };
41192
-
41193
- // UPDATED: showColumnFilter with fixed RangePop integration
41194
41126
  const showColumnFilter = column => {
41195
41127
  const {
41196
41128
  key,
@@ -41225,7 +41157,6 @@ const TableHeader = ({
41225
41157
  }
41226
41158
  });
41227
41159
  } else if (rangeFilter) {
41228
- // Get the current filter state for this column to persist values
41229
41160
  const currentFilterState = filterState[key];
41230
41161
  return /*#__PURE__*/React$1.createElement(RangePop, {
41231
41162
  menuName: title,
@@ -41269,8 +41200,6 @@ const TableHeader = ({
41269
41200
  });
41270
41201
  }
41271
41202
  };
41272
-
41273
- // MODIFIED: Pass the selected value only for the active sort column
41274
41203
  const showColumnSort = column => {
41275
41204
  const {
41276
41205
  key,
@@ -41280,8 +41209,6 @@ const TableHeader = ({
41280
41209
  if (!sortOptions || sortOptions.length === 0) {
41281
41210
  return null;
41282
41211
  }
41283
-
41284
- // Only show selected value if this is the active sort column
41285
41212
  const selectedValue = activeSortColumn === key ? activeSortValue : null;
41286
41213
  return /*#__PURE__*/React$1.createElement(SortPop, {
41287
41214
  width: "300px",
@@ -46928,7 +46855,6 @@ const Table = props => {
46928
46855
  noDataInSearchMessage = "Try to refine your query and search again",
46929
46856
  noDataIcon = "Plus",
46930
46857
  noDataSearchIcon = "Plus",
46931
- // NEW: Props for NoEventsParent section
46932
46858
  noEventsTitle = "You haven't created any events yet",
46933
46859
  noEventsSubtitle = "Let's get started and create your first one!",
46934
46860
  noEventsButtonText = "New Event",
@@ -46940,17 +46866,14 @@ const Table = props => {
46940
46866
  changeFocusIndex,
46941
46867
  onTableFocusChange = () => {},
46942
46868
  clearFocusOnOutsideClick = true,
46943
- // NEW: Props for edit mode focus management
46944
46869
  isEditMode = false,
46945
46870
  editRowIndex = -1,
46946
46871
  onCommentSave = () => {},
46947
- // NEW: Props for expand functionality
46948
46872
  expandable = false,
46949
46873
  expandedRows = {},
46950
46874
  expandedContent = {},
46951
46875
  onExpandRow = () => {},
46952
46876
  expandedBackgroundColor = '#E6F0F0',
46953
- // New prop
46954
46877
  onDropdownSelected = () => {},
46955
46878
  onCheckboxClick = () => {},
46956
46879
  onHeaderCheckboxClick = () => {},
@@ -46958,32 +46881,25 @@ const Table = props => {
46958
46881
  onHeroClick = () => {},
46959
46882
  dotIndicatorColor = '#34D399',
46960
46883
  onEditableClick = () => {},
46961
- // Accept ref as a regular prop
46884
+ resetFiltersKey = 0,
46885
+ // NEW: Add this prop
46962
46886
  ref = null
46963
46887
  } = props;
46964
46888
  const scrollWrapperRef = useRef(null);
46965
46889
  const tableBodyRef = useRef(null);
46966
46890
  const tableContainerRef = useRef(null);
46967
46891
  const [hasTriggered, setHasTriggered] = useState(false);
46968
-
46969
- // Expose method to clear table focus to parent components
46970
46892
  const clearTableFocus = () => {
46971
46893
  if (tableBodyRef.current) {
46972
46894
  tableBodyRef.current.clearFocus();
46973
46895
  }
46974
46896
  };
46975
-
46976
- // Handle focus change from TableBody
46977
46897
  const handleTableFocusChange = focusedRowIndex => {
46978
46898
  onTableFocusChange(focusedRowIndex);
46979
46899
  };
46980
-
46981
- // Handle comment save - pass through to parent
46982
46900
  const handleCommentSave = (rowIndex, commentText) => {
46983
46901
  onCommentSave(rowIndex, commentText);
46984
46902
  };
46985
-
46986
- // Expose methods to parent components via ref (if ref is provided)
46987
46903
  useImperativeHandle(ref, () => ({
46988
46904
  clearTableFocus,
46989
46905
  getTableBodyRef: () => tableBodyRef.current
@@ -46997,17 +46913,13 @@ const Table = props => {
46997
46913
  scrollHeight,
46998
46914
  clientHeight
46999
46915
  } = scrollWrapper;
47000
-
47001
- // Calculate if we're near the bottom
47002
46916
  const isNearBottom = scrollTop + clientHeight >= scrollHeight - 56 * lastRowsThreshold;
47003
46917
  if (isNearBottom && data.length > 0) {
47004
- // Trigger event only if it hasn't been triggered yet
47005
46918
  if (!hasTriggered) {
47006
46919
  onLastRowsReached();
47007
46920
  setHasTriggered(true);
47008
46921
  }
47009
46922
  } else {
47010
- // Reset trigger when user scrolls back up outside the threshold
47011
46923
  if (hasTriggered) {
47012
46924
  setHasTriggered(false);
47013
46925
  }
@@ -47016,14 +46928,10 @@ const Table = props => {
47016
46928
  scrollWrapper.addEventListener('scroll', handleScroll);
47017
46929
  return () => scrollWrapper.removeEventListener('scroll', handleScroll);
47018
46930
  }, [onLastRowsReached, data.length, lastRowsThreshold, hasTriggered]);
47019
-
47020
- // Handle outside click to clear focus - UPDATED to respect edit mode
47021
46931
  useEffect(() => {
47022
- if (!clearFocusOnOutsideClick || isEditMode) return; // Don't clear focus during edit mode
47023
-
46932
+ if (!clearFocusOnOutsideClick || isEditMode) return;
47024
46933
  const handleOutsideClick = event => {
47025
46934
  if (tableContainerRef.current && !tableContainerRef.current.contains(event.target)) {
47026
- // Click is outside the table container
47027
46935
  if (tableBodyRef.current) {
47028
46936
  tableBodyRef.current.clearFocus();
47029
46937
  }
@@ -47033,8 +46941,7 @@ const Table = props => {
47033
46941
  return () => {
47034
46942
  document.removeEventListener('mousedown', handleOutsideClick);
47035
46943
  };
47036
- }, [clearFocusOnOutsideClick, isEditMode]); // Added isEditMode to dependency array
47037
-
46944
+ }, [clearFocusOnOutsideClick, isEditMode]);
47038
46945
  const getNoDataIcon = icon => {
47039
46946
  switch (icon) {
47040
46947
  case "Event":
@@ -47052,7 +46959,6 @@ const Table = props => {
47052
46959
  case "Upc":
47053
46960
  return /*#__PURE__*/React$1.createElement(NoSearchUpcIcon, null);
47054
46961
  case "Ntt":
47055
- // Nothing to Track
47056
46962
  return /*#__PURE__*/React$1.createElement(NothingToTrackIcon, null);
47057
46963
  default:
47058
46964
  return null;
@@ -47086,7 +46992,8 @@ const Table = props => {
47086
46992
  onSelectAll: onSelectAll,
47087
46993
  expandable: expandable,
47088
46994
  onHeaderCheckboxClick: onHeaderCheckboxClick,
47089
- headerCheckboxStates: headerCheckboxStates
46995
+ headerCheckboxStates: headerCheckboxStates,
46996
+ resetFiltersKey: resetFiltersKey
47090
46997
  }), columns.length > 0 && data.length > 0 && /*#__PURE__*/React$1.createElement(TableBody, {
47091
46998
  ref: tableBodyRef,
47092
46999
  columns: columns,
@@ -47137,8 +47044,6 @@ const Table = props => {
47137
47044
  id: "LoaderWrapper"
47138
47045
  }, /*#__PURE__*/React$1.createElement(Loader, null)))));
47139
47046
  };
47140
-
47141
- // Add displayName for better debugging
47142
47047
  Table.displayName = 'Table';
47143
47048
 
47144
47049
  const Card = styled$1.div`