sag_components 2.0.0-beta253 → 2.0.0-beta255

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.js CHANGED
@@ -36120,15 +36120,19 @@ const ToggleInput = styled__default["default"].input`
36120
36120
  const ToggleSlider = styled__default["default"].span`
36121
36121
  display: block;
36122
36122
  position: relative;
36123
- background: ${({
36124
- checked,
36125
- disabled
36126
- }) => checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0"};
36123
+ background: ${_ref => {
36124
+ let {
36125
+ checked,
36126
+ disabled
36127
+ } = _ref;
36128
+ return checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0";
36129
+ }};
36127
36130
  border-radius: 999px;
36128
36131
  transition: background 0.2s;
36129
- ${({
36130
- size
36131
- }) => {
36132
+ ${_ref2 => {
36133
+ let {
36134
+ size
36135
+ } = _ref2;
36132
36136
  switch (size) {
36133
36137
  case "s":
36134
36138
  return styled.css`width: 40px; height: 20px;`;
@@ -36144,14 +36148,18 @@ const ToggleSlider = styled__default["default"].span`
36144
36148
  left: 3px;
36145
36149
  top: 50%;
36146
36150
  transform: translateY(-50%);
36147
- background: ${({
36148
- disabled
36149
- }) => disabled ? "#D0D0D0" : "#fff"};
36151
+ background: ${_ref3 => {
36152
+ let {
36153
+ disabled
36154
+ } = _ref3;
36155
+ return disabled ? "#D0D0D0" : "#fff";
36156
+ }};
36150
36157
  border-radius: 50%;
36151
36158
  transition: left 0.2s, width 0.2s, height 0.2s;
36152
- ${({
36153
- size
36154
- }) => {
36159
+ ${_ref4 => {
36160
+ let {
36161
+ size
36162
+ } = _ref4;
36155
36163
  switch (size) {
36156
36164
  case "s":
36157
36165
  return styled.css`width: 14px; height: 14px;`;
@@ -36161,10 +36169,11 @@ const ToggleSlider = styled__default["default"].span`
36161
36169
  return styled.css`width: 20px; height: 20px;`;
36162
36170
  }
36163
36171
  }}
36164
- left: ${({
36165
- checked,
36166
- size
36167
- }) => {
36172
+ left: ${_ref5 => {
36173
+ let {
36174
+ checked,
36175
+ size
36176
+ } = _ref5;
36168
36177
  if (!checked) return "3px";
36169
36178
  switch (size) {
36170
36179
  case "s":
@@ -36992,13 +37001,13 @@ const NoEventsWrapper = styled__default["default"].div`
36992
37001
  margin-bottom: 14px;
36993
37002
  `;
36994
37003
  const NoEventsMessage = styled__default["default"].span`
36995
- font-size: 18px;
37004
+ font-size: ${props => props.subTitleSize ? props.subTitleSize : '18px'};
36996
37005
  font-weight: 400;
36997
37006
  margin-bottom: 14px;
36998
37007
  text-align: center;
36999
37008
  display: block;
37000
37009
  > strong {
37001
- font-size: 24px;
37010
+ font-size: ${props => props.titleSize ? props.titleSize : '24px'};
37002
37011
  font-weight: 500;
37003
37012
  }
37004
37013
  `;
@@ -37218,8 +37227,8 @@ const NoEvents = ({
37218
37227
  }));
37219
37228
 
37220
37229
  const NoUpcIcon = ({
37221
- width = "251",
37222
- height = "250"
37230
+ width = "178",
37231
+ height = "171"
37223
37232
  }) => /*#__PURE__*/React__default["default"].createElement("svg", {
37224
37233
  width: width,
37225
37234
  height: height,
@@ -37754,23 +37763,19 @@ const FilterPop = props => {
37754
37763
  isAsc = true,
37755
37764
  selectedAttributes: propSelectedAttributes = {},
37756
37765
  showSearch = true,
37757
- searchPlaceholder = "Search..."
37766
+ searchPlaceholder = "Search...",
37767
+ itemHeight = 32,
37768
+ overscan = 5
37758
37769
  } = props;
37759
-
37760
- // State for search term
37761
37770
  const [searchTerm, setSearchTerm] = React$1.useState("");
37762
-
37763
- // CRITICAL FIX: Use internal state for selected attributes
37764
37771
  const [selectedAttributes, setSelectedAttributes] = React$1.useState({});
37772
+ const [scrollTop, setScrollTop] = React$1.useState(0);
37765
37773
  const isInitialMount = React$1.useRef(true);
37766
-
37767
- // Add hardcoded "Select All" as first item
37774
+ const scrollContainerRef = React$1.useRef(null);
37768
37775
  const fullList = React$1.useMemo(() => [{
37769
37776
  value: "All",
37770
37777
  label: "Select All"
37771
37778
  }, ...list], [list]);
37772
-
37773
- // Create initial state - all items selected by default
37774
37779
  const createInitialState = () => {
37775
37780
  const initialState = {};
37776
37781
  fullList.forEach(item => {
@@ -37778,11 +37783,8 @@ const FilterPop = props => {
37778
37783
  });
37779
37784
  return initialState;
37780
37785
  };
37781
-
37782
- // CRITICAL: Initialize and sync with props only when necessary
37783
37786
  React$1.useEffect(() => {
37784
37787
  if (isInitialMount.current) {
37785
- // First mount: use props or create initial state
37786
37788
  if (Object.keys(propSelectedAttributes).length > 0) {
37787
37789
  setSelectedAttributes(propSelectedAttributes);
37788
37790
  } else {
@@ -37790,8 +37792,6 @@ const FilterPop = props => {
37790
37792
  }
37791
37793
  isInitialMount.current = false;
37792
37794
  } else {
37793
- // After mount: only update if props explicitly changed and are non-empty
37794
- // This prevents reset when parent re-renders
37795
37795
  if (Object.keys(propSelectedAttributes).length > 0) {
37796
37796
  const propsString = JSON.stringify(propSelectedAttributes);
37797
37797
  const currentString = JSON.stringify(selectedAttributes);
@@ -37800,9 +37800,7 @@ const FilterPop = props => {
37800
37800
  }
37801
37801
  }
37802
37802
  }
37803
- }, [propSelectedAttributes]); // Only depend on props
37804
-
37805
- // Update selected attributes when list changes to include new items
37803
+ }, [propSelectedAttributes]);
37806
37804
  React$1.useEffect(() => {
37807
37805
  if (!isInitialMount.current && list.length > 0) {
37808
37806
  setSelectedAttributes(prev => {
@@ -37810,38 +37808,28 @@ const FilterPop = props => {
37810
37808
  ...prev
37811
37809
  };
37812
37810
  let hasChanges = false;
37813
-
37814
- // Add any new items from the list that aren't in current selection
37815
37811
  fullList.forEach(item => {
37816
37812
  if (item.value !== "All" && !(item.value in updated)) {
37817
- updated[item.value] = true; // New items default to selected
37813
+ updated[item.value] = true;
37818
37814
  hasChanges = true;
37819
37815
  }
37820
37816
  });
37821
-
37822
- // Remove items that no longer exist in the list
37823
37817
  Object.keys(updated).forEach(key => {
37824
37818
  if (key !== "All" && !fullList.find(item => item.value === key)) {
37825
37819
  delete updated[key];
37826
37820
  hasChanges = true;
37827
37821
  }
37828
37822
  });
37829
-
37830
- // Update "Select All" state
37831
37823
  if (hasChanges) {
37832
37824
  updated.All = areAllNonAllItemsSelected(updated);
37833
37825
  }
37834
37826
  return hasChanges ? updated : prev;
37835
37827
  });
37836
37828
  }
37837
- }, [list]); // Only when list changes
37838
-
37839
- // Helper function to get non-"All" items
37829
+ }, [list]);
37840
37830
  const getNonAllItems = () => {
37841
37831
  return fullList.filter(item => item.value !== "All");
37842
37832
  };
37843
-
37844
- // Filter items based on search term
37845
37833
  const filteredList = React$1.useMemo(() => {
37846
37834
  if (!searchTerm.trim()) {
37847
37835
  return fullList;
@@ -37853,22 +37841,34 @@ const FilterPop = props => {
37853
37841
  });
37854
37842
  return [fullList.find(item => item.value === "All"), ...filteredNonAllItems];
37855
37843
  }, [fullList, searchTerm]);
37856
-
37857
- // Sort the filtered list based on the `isAsc` prop
37858
37844
  const sortedList = React$1.useMemo(() => {
37859
37845
  return [...filteredList.filter(item => item.value === "All"), ...filteredList.filter(item => item.value !== "All").sort((a, b) => {
37860
37846
  return isAsc ? a.label.localeCompare(b.label) : b.label.localeCompare(a.label);
37861
37847
  })];
37862
37848
  }, [filteredList, isAsc]);
37863
-
37864
- // Helper functions for "Select All" logic
37849
+ const {
37850
+ visibleItems,
37851
+ totalHeight,
37852
+ offsetY
37853
+ } = React$1.useMemo(() => {
37854
+ const containerHeight = parseInt(maxHeight) || 400;
37855
+ const startIndex = Math.max(0, Math.floor(scrollTop / itemHeight) - overscan);
37856
+ const endIndex = Math.min(sortedList.length, Math.ceil((scrollTop + containerHeight) / itemHeight) + overscan);
37857
+ const visible = sortedList.slice(startIndex, endIndex).map((item, idx) => ({
37858
+ ...item,
37859
+ index: startIndex + idx
37860
+ }));
37861
+ return {
37862
+ visibleItems: visible,
37863
+ totalHeight: sortedList.length * itemHeight,
37864
+ offsetY: startIndex * itemHeight
37865
+ };
37866
+ }, [sortedList, scrollTop, itemHeight, overscan, maxHeight]);
37865
37867
  const areAllNonAllItemsSelected = function () {
37866
37868
  let attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : selectedAttributes;
37867
37869
  const nonAllItems = getNonAllItems();
37868
37870
  return nonAllItems.every(item => attributes[item.value]);
37869
37871
  };
37870
-
37871
- // Helper functions for visible filtered items
37872
37872
  const getVisibleNonAllItems = () => {
37873
37873
  return sortedList.filter(item => item.value !== "All");
37874
37874
  };
@@ -37883,8 +37883,6 @@ const FilterPop = props => {
37883
37883
  const visibleItems = getVisibleNonAllItems();
37884
37884
  return visibleItems.some(item => attributes[item.value]);
37885
37885
  };
37886
-
37887
- // Create the efficient data structure
37888
37886
  const createFilterData = attributes => {
37889
37887
  const nonAllItems = getNonAllItems();
37890
37888
  const selectedItems = nonAllItems.filter(item => attributes[item.value]);
@@ -37963,8 +37961,6 @@ const FilterPop = props => {
37963
37961
  allItems: resetState
37964
37962
  });
37965
37963
  };
37966
-
37967
- // Function to determine checkbox state for "Select All"
37968
37964
  const getSelectAllCheckboxProps = () => {
37969
37965
  const visibleItems = getVisibleNonAllItems();
37970
37966
  if (visibleItems.length === 0) {
@@ -37995,9 +37991,20 @@ const FilterPop = props => {
37995
37991
  };
37996
37992
  const handleSearchChange = e => {
37997
37993
  setSearchTerm(e.target.value);
37994
+ setScrollTop(0); // Reset scroll on search
37995
+ if (scrollContainerRef.current) {
37996
+ scrollContainerRef.current.scrollTop = 0;
37997
+ }
37998
37998
  };
37999
37999
  const clearSearch = () => {
38000
38000
  setSearchTerm("");
38001
+ setScrollTop(0);
38002
+ if (scrollContainerRef.current) {
38003
+ scrollContainerRef.current.scrollTop = 0;
38004
+ }
38005
+ };
38006
+ const handleScroll = e => {
38007
+ setScrollTop(e.target.scrollTop);
38001
38008
  };
38002
38009
  return /*#__PURE__*/React__default["default"].createElement(FilterPopContainer, {
38003
38010
  width: width,
@@ -38010,19 +38017,39 @@ const FilterPop = props => {
38010
38017
  value: searchTerm,
38011
38018
  onChange: handleSearchChange,
38012
38019
  accentColor: color
38013
- }), /*#__PURE__*/React__default["default"].createElement(CheckboxGroup, {
38020
+ }), /*#__PURE__*/React__default["default"].createElement("div", {
38021
+ ref: scrollContainerRef,
38022
+ onScroll: handleScroll,
38023
+ style: {
38024
+ maxHeight: maxHeight,
38025
+ overflowY: "auto",
38026
+ position: "relative"
38027
+ }
38028
+ }, sortedList.length === 1 ? /*#__PURE__*/React__default["default"].createElement(NoResultsMessage, null, "No items match your search") : /*#__PURE__*/React__default["default"].createElement("div", {
38029
+ style: {
38030
+ height: `${totalHeight}px`,
38031
+ position: "relative"
38032
+ }
38033
+ }, /*#__PURE__*/React__default["default"].createElement(CheckboxGroup, {
38014
38034
  style: {
38015
38035
  display: doubleColumn ? "grid" : "flex",
38016
38036
  gridTemplateColumns: doubleColumn ? "1fr 1fr" : "none",
38017
- gap: "8px"
38037
+ gap: "8px",
38038
+ position: "absolute",
38039
+ top: `${offsetY}px`,
38040
+ left: 0,
38041
+ right: 0
38018
38042
  }
38019
- }, sortedList.length === 1 ? /*#__PURE__*/React__default["default"].createElement(NoResultsMessage, null, "No items match your search") : sortedList.map(item => {
38043
+ }, visibleItems.map(item => {
38020
38044
  const isSelectAll = item.value === "All";
38021
38045
  const checkboxProps = isSelectAll ? getSelectAllCheckboxProps() : {};
38022
38046
  const isChecked = isSelectAll ? checkboxProps.checked : selectedAttributes[item.value] || false;
38023
38047
  return /*#__PURE__*/React__default["default"].createElement(CheckboxLabel, {
38024
38048
  width: !doubleColumn ?? width,
38025
- key: item.value
38049
+ key: item.value,
38050
+ style: {
38051
+ height: `${itemHeight}px`
38052
+ }
38026
38053
  }, /*#__PURE__*/React__default["default"].createElement("div", {
38027
38054
  style: {
38028
38055
  width: "20px",
@@ -38045,7 +38072,7 @@ const FilterPop = props => {
38045
38072
  handleCheckboxChange(item.value);
38046
38073
  }
38047
38074
  })), /*#__PURE__*/React__default["default"].createElement("span", null, item.label));
38048
- })), /*#__PURE__*/React__default["default"].createElement(ButtonWrapper$2, null, showSearch && searchTerm && /*#__PURE__*/React__default["default"].createElement(ResetButton$1, {
38075
+ })))), /*#__PURE__*/React__default["default"].createElement(ButtonWrapper$2, null, showSearch && searchTerm && /*#__PURE__*/React__default["default"].createElement(ResetButton$1, {
38049
38076
  onClick: clearSearch,
38050
38077
  style: {
38051
38078
  marginRight: "8px"
@@ -46907,6 +46934,7 @@ const Table = props => {
46907
46934
  noEventsSubtitle = "Let's get started and create your first one!",
46908
46935
  noEventsButtonText = "New Event",
46909
46936
  noEventsButtonIcon = "Plus",
46937
+ noEventsButtonHeight,
46910
46938
  disableNoEventsButton = false,
46911
46939
  showNoEventsButton = true,
46912
46940
  indexToShimmer = -1,
@@ -46931,7 +46959,9 @@ const Table = props => {
46931
46959
  onEditableClick = () => {},
46932
46960
  resetFiltersKey = 0,
46933
46961
  // NEW: Add this prop
46934
- ref = null
46962
+ ref = null,
46963
+ titleSize,
46964
+ subTitleSize
46935
46965
  } = props;
46936
46966
  const scrollWrapperRef = React$1.useRef(null);
46937
46967
  const tableBodyRef = React$1.useRef(null);
@@ -47070,8 +47100,11 @@ const Table = props => {
47070
47100
  onEditableClick: onEditableClick,
47071
47101
  isEditMode: isEditMode,
47072
47102
  editRowIndex: editRowIndex
47073
- })), data.length === 0 && /*#__PURE__*/React__default["default"].createElement(NoEventsParent, null, /*#__PURE__*/React__default["default"].createElement(NoEventsWrapper, null, showNoDataInSearch ? getNoDataSearchIcon(noDataSearchIcon) : getNoDataIcon(noDataIcon)), /*#__PURE__*/React__default["default"].createElement(NoEventsMessage, null, showNoDataInSearch ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React__default["default"].createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, noEventsTitle), /*#__PURE__*/React__default["default"].createElement("br", null), noEventsSubtitle)), !showNoDataInSearch && showNoEventsButton && /*#__PURE__*/React__default["default"].createElement(Button$1, {
47074
- height: "45px",
47103
+ })), data.length === 0 && /*#__PURE__*/React__default["default"].createElement(NoEventsParent, null, /*#__PURE__*/React__default["default"].createElement(NoEventsWrapper, null, showNoDataInSearch ? getNoDataSearchIcon(noDataSearchIcon) : getNoDataIcon(noDataIcon)), /*#__PURE__*/React__default["default"].createElement(NoEventsMessage, {
47104
+ titleSize: titleSize,
47105
+ subTitleSize: subTitleSize
47106
+ }, showNoDataInSearch ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React__default["default"].createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("strong", null, noEventsTitle), /*#__PURE__*/React__default["default"].createElement("br", null), noEventsSubtitle)), !showNoDataInSearch && showNoEventsButton && /*#__PURE__*/React__default["default"].createElement(Button$1, {
47107
+ height: noEventsButtonHeight ? noEventsButtonHeight : "45px",
47075
47108
  leftIcon: noEventsButtonIcon,
47076
47109
  text: noEventsButtonText,
47077
47110
  disabled: disableNoEventsButton,
@@ -58338,7 +58371,7 @@ const QuickFilterCards = _ref => {
58338
58371
  const StatusCell = styled__default["default"].div`
58339
58372
  display: inline-flex;
58340
58373
  height: ${props => props.height};
58341
- padding: 8px 12px;
58374
+ padding: 6px 14px;
58342
58375
  justify-content: center;
58343
58376
  align-items: center;
58344
58377
  gap: 14px;