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.esm.js +102 -69
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +102 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -36110,15 +36110,19 @@ const ToggleInput = styled.input`
|
|
|
36110
36110
|
const ToggleSlider = styled.span`
|
|
36111
36111
|
display: block;
|
|
36112
36112
|
position: relative;
|
|
36113
|
-
background: ${
|
|
36114
|
-
|
|
36115
|
-
|
|
36116
|
-
|
|
36113
|
+
background: ${_ref => {
|
|
36114
|
+
let {
|
|
36115
|
+
checked,
|
|
36116
|
+
disabled
|
|
36117
|
+
} = _ref;
|
|
36118
|
+
return checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0";
|
|
36119
|
+
}};
|
|
36117
36120
|
border-radius: 999px;
|
|
36118
36121
|
transition: background 0.2s;
|
|
36119
|
-
${
|
|
36120
|
-
|
|
36121
|
-
|
|
36122
|
+
${_ref2 => {
|
|
36123
|
+
let {
|
|
36124
|
+
size
|
|
36125
|
+
} = _ref2;
|
|
36122
36126
|
switch (size) {
|
|
36123
36127
|
case "s":
|
|
36124
36128
|
return css`width: 40px; height: 20px;`;
|
|
@@ -36134,14 +36138,18 @@ const ToggleSlider = styled.span`
|
|
|
36134
36138
|
left: 3px;
|
|
36135
36139
|
top: 50%;
|
|
36136
36140
|
transform: translateY(-50%);
|
|
36137
|
-
background: ${
|
|
36138
|
-
|
|
36139
|
-
|
|
36141
|
+
background: ${_ref3 => {
|
|
36142
|
+
let {
|
|
36143
|
+
disabled
|
|
36144
|
+
} = _ref3;
|
|
36145
|
+
return disabled ? "#D0D0D0" : "#fff";
|
|
36146
|
+
}};
|
|
36140
36147
|
border-radius: 50%;
|
|
36141
36148
|
transition: left 0.2s, width 0.2s, height 0.2s;
|
|
36142
|
-
${
|
|
36143
|
-
|
|
36144
|
-
|
|
36149
|
+
${_ref4 => {
|
|
36150
|
+
let {
|
|
36151
|
+
size
|
|
36152
|
+
} = _ref4;
|
|
36145
36153
|
switch (size) {
|
|
36146
36154
|
case "s":
|
|
36147
36155
|
return css`width: 14px; height: 14px;`;
|
|
@@ -36151,10 +36159,11 @@ const ToggleSlider = styled.span`
|
|
|
36151
36159
|
return css`width: 20px; height: 20px;`;
|
|
36152
36160
|
}
|
|
36153
36161
|
}}
|
|
36154
|
-
left: ${
|
|
36155
|
-
|
|
36156
|
-
|
|
36157
|
-
|
|
36162
|
+
left: ${_ref5 => {
|
|
36163
|
+
let {
|
|
36164
|
+
checked,
|
|
36165
|
+
size
|
|
36166
|
+
} = _ref5;
|
|
36158
36167
|
if (!checked) return "3px";
|
|
36159
36168
|
switch (size) {
|
|
36160
36169
|
case "s":
|
|
@@ -36982,13 +36991,13 @@ const NoEventsWrapper = styled.div`
|
|
|
36982
36991
|
margin-bottom: 14px;
|
|
36983
36992
|
`;
|
|
36984
36993
|
const NoEventsMessage = styled.span`
|
|
36985
|
-
font-size: 18px;
|
|
36994
|
+
font-size: ${props => props.subTitleSize ? props.subTitleSize : '18px'};
|
|
36986
36995
|
font-weight: 400;
|
|
36987
36996
|
margin-bottom: 14px;
|
|
36988
36997
|
text-align: center;
|
|
36989
36998
|
display: block;
|
|
36990
36999
|
> strong {
|
|
36991
|
-
font-size: 24px;
|
|
37000
|
+
font-size: ${props => props.titleSize ? props.titleSize : '24px'};
|
|
36992
37001
|
font-weight: 500;
|
|
36993
37002
|
}
|
|
36994
37003
|
`;
|
|
@@ -37208,8 +37217,8 @@ const NoEvents = ({
|
|
|
37208
37217
|
}));
|
|
37209
37218
|
|
|
37210
37219
|
const NoUpcIcon = ({
|
|
37211
|
-
width = "
|
|
37212
|
-
height = "
|
|
37220
|
+
width = "178",
|
|
37221
|
+
height = "171"
|
|
37213
37222
|
}) => /*#__PURE__*/React$1.createElement("svg", {
|
|
37214
37223
|
width: width,
|
|
37215
37224
|
height: height,
|
|
@@ -37744,23 +37753,19 @@ const FilterPop = props => {
|
|
|
37744
37753
|
isAsc = true,
|
|
37745
37754
|
selectedAttributes: propSelectedAttributes = {},
|
|
37746
37755
|
showSearch = true,
|
|
37747
|
-
searchPlaceholder = "Search..."
|
|
37756
|
+
searchPlaceholder = "Search...",
|
|
37757
|
+
itemHeight = 32,
|
|
37758
|
+
overscan = 5
|
|
37748
37759
|
} = props;
|
|
37749
|
-
|
|
37750
|
-
// State for search term
|
|
37751
37760
|
const [searchTerm, setSearchTerm] = useState("");
|
|
37752
|
-
|
|
37753
|
-
// CRITICAL FIX: Use internal state for selected attributes
|
|
37754
37761
|
const [selectedAttributes, setSelectedAttributes] = useState({});
|
|
37762
|
+
const [scrollTop, setScrollTop] = useState(0);
|
|
37755
37763
|
const isInitialMount = useRef(true);
|
|
37756
|
-
|
|
37757
|
-
// Add hardcoded "Select All" as first item
|
|
37764
|
+
const scrollContainerRef = useRef(null);
|
|
37758
37765
|
const fullList = useMemo(() => [{
|
|
37759
37766
|
value: "All",
|
|
37760
37767
|
label: "Select All"
|
|
37761
37768
|
}, ...list], [list]);
|
|
37762
|
-
|
|
37763
|
-
// Create initial state - all items selected by default
|
|
37764
37769
|
const createInitialState = () => {
|
|
37765
37770
|
const initialState = {};
|
|
37766
37771
|
fullList.forEach(item => {
|
|
@@ -37768,11 +37773,8 @@ const FilterPop = props => {
|
|
|
37768
37773
|
});
|
|
37769
37774
|
return initialState;
|
|
37770
37775
|
};
|
|
37771
|
-
|
|
37772
|
-
// CRITICAL: Initialize and sync with props only when necessary
|
|
37773
37776
|
useEffect(() => {
|
|
37774
37777
|
if (isInitialMount.current) {
|
|
37775
|
-
// First mount: use props or create initial state
|
|
37776
37778
|
if (Object.keys(propSelectedAttributes).length > 0) {
|
|
37777
37779
|
setSelectedAttributes(propSelectedAttributes);
|
|
37778
37780
|
} else {
|
|
@@ -37780,8 +37782,6 @@ const FilterPop = props => {
|
|
|
37780
37782
|
}
|
|
37781
37783
|
isInitialMount.current = false;
|
|
37782
37784
|
} else {
|
|
37783
|
-
// After mount: only update if props explicitly changed and are non-empty
|
|
37784
|
-
// This prevents reset when parent re-renders
|
|
37785
37785
|
if (Object.keys(propSelectedAttributes).length > 0) {
|
|
37786
37786
|
const propsString = JSON.stringify(propSelectedAttributes);
|
|
37787
37787
|
const currentString = JSON.stringify(selectedAttributes);
|
|
@@ -37790,9 +37790,7 @@ const FilterPop = props => {
|
|
|
37790
37790
|
}
|
|
37791
37791
|
}
|
|
37792
37792
|
}
|
|
37793
|
-
}, [propSelectedAttributes]);
|
|
37794
|
-
|
|
37795
|
-
// Update selected attributes when list changes to include new items
|
|
37793
|
+
}, [propSelectedAttributes]);
|
|
37796
37794
|
useEffect(() => {
|
|
37797
37795
|
if (!isInitialMount.current && list.length > 0) {
|
|
37798
37796
|
setSelectedAttributes(prev => {
|
|
@@ -37800,38 +37798,28 @@ const FilterPop = props => {
|
|
|
37800
37798
|
...prev
|
|
37801
37799
|
};
|
|
37802
37800
|
let hasChanges = false;
|
|
37803
|
-
|
|
37804
|
-
// Add any new items from the list that aren't in current selection
|
|
37805
37801
|
fullList.forEach(item => {
|
|
37806
37802
|
if (item.value !== "All" && !(item.value in updated)) {
|
|
37807
|
-
updated[item.value] = true;
|
|
37803
|
+
updated[item.value] = true;
|
|
37808
37804
|
hasChanges = true;
|
|
37809
37805
|
}
|
|
37810
37806
|
});
|
|
37811
|
-
|
|
37812
|
-
// Remove items that no longer exist in the list
|
|
37813
37807
|
Object.keys(updated).forEach(key => {
|
|
37814
37808
|
if (key !== "All" && !fullList.find(item => item.value === key)) {
|
|
37815
37809
|
delete updated[key];
|
|
37816
37810
|
hasChanges = true;
|
|
37817
37811
|
}
|
|
37818
37812
|
});
|
|
37819
|
-
|
|
37820
|
-
// Update "Select All" state
|
|
37821
37813
|
if (hasChanges) {
|
|
37822
37814
|
updated.All = areAllNonAllItemsSelected(updated);
|
|
37823
37815
|
}
|
|
37824
37816
|
return hasChanges ? updated : prev;
|
|
37825
37817
|
});
|
|
37826
37818
|
}
|
|
37827
|
-
}, [list]);
|
|
37828
|
-
|
|
37829
|
-
// Helper function to get non-"All" items
|
|
37819
|
+
}, [list]);
|
|
37830
37820
|
const getNonAllItems = () => {
|
|
37831
37821
|
return fullList.filter(item => item.value !== "All");
|
|
37832
37822
|
};
|
|
37833
|
-
|
|
37834
|
-
// Filter items based on search term
|
|
37835
37823
|
const filteredList = useMemo(() => {
|
|
37836
37824
|
if (!searchTerm.trim()) {
|
|
37837
37825
|
return fullList;
|
|
@@ -37843,22 +37831,34 @@ const FilterPop = props => {
|
|
|
37843
37831
|
});
|
|
37844
37832
|
return [fullList.find(item => item.value === "All"), ...filteredNonAllItems];
|
|
37845
37833
|
}, [fullList, searchTerm]);
|
|
37846
|
-
|
|
37847
|
-
// Sort the filtered list based on the `isAsc` prop
|
|
37848
37834
|
const sortedList = useMemo(() => {
|
|
37849
37835
|
return [...filteredList.filter(item => item.value === "All"), ...filteredList.filter(item => item.value !== "All").sort((a, b) => {
|
|
37850
37836
|
return isAsc ? a.label.localeCompare(b.label) : b.label.localeCompare(a.label);
|
|
37851
37837
|
})];
|
|
37852
37838
|
}, [filteredList, isAsc]);
|
|
37853
|
-
|
|
37854
|
-
|
|
37839
|
+
const {
|
|
37840
|
+
visibleItems,
|
|
37841
|
+
totalHeight,
|
|
37842
|
+
offsetY
|
|
37843
|
+
} = useMemo(() => {
|
|
37844
|
+
const containerHeight = parseInt(maxHeight) || 400;
|
|
37845
|
+
const startIndex = Math.max(0, Math.floor(scrollTop / itemHeight) - overscan);
|
|
37846
|
+
const endIndex = Math.min(sortedList.length, Math.ceil((scrollTop + containerHeight) / itemHeight) + overscan);
|
|
37847
|
+
const visible = sortedList.slice(startIndex, endIndex).map((item, idx) => ({
|
|
37848
|
+
...item,
|
|
37849
|
+
index: startIndex + idx
|
|
37850
|
+
}));
|
|
37851
|
+
return {
|
|
37852
|
+
visibleItems: visible,
|
|
37853
|
+
totalHeight: sortedList.length * itemHeight,
|
|
37854
|
+
offsetY: startIndex * itemHeight
|
|
37855
|
+
};
|
|
37856
|
+
}, [sortedList, scrollTop, itemHeight, overscan, maxHeight]);
|
|
37855
37857
|
const areAllNonAllItemsSelected = function () {
|
|
37856
37858
|
let attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : selectedAttributes;
|
|
37857
37859
|
const nonAllItems = getNonAllItems();
|
|
37858
37860
|
return nonAllItems.every(item => attributes[item.value]);
|
|
37859
37861
|
};
|
|
37860
|
-
|
|
37861
|
-
// Helper functions for visible filtered items
|
|
37862
37862
|
const getVisibleNonAllItems = () => {
|
|
37863
37863
|
return sortedList.filter(item => item.value !== "All");
|
|
37864
37864
|
};
|
|
@@ -37873,8 +37873,6 @@ const FilterPop = props => {
|
|
|
37873
37873
|
const visibleItems = getVisibleNonAllItems();
|
|
37874
37874
|
return visibleItems.some(item => attributes[item.value]);
|
|
37875
37875
|
};
|
|
37876
|
-
|
|
37877
|
-
// Create the efficient data structure
|
|
37878
37876
|
const createFilterData = attributes => {
|
|
37879
37877
|
const nonAllItems = getNonAllItems();
|
|
37880
37878
|
const selectedItems = nonAllItems.filter(item => attributes[item.value]);
|
|
@@ -37953,8 +37951,6 @@ const FilterPop = props => {
|
|
|
37953
37951
|
allItems: resetState
|
|
37954
37952
|
});
|
|
37955
37953
|
};
|
|
37956
|
-
|
|
37957
|
-
// Function to determine checkbox state for "Select All"
|
|
37958
37954
|
const getSelectAllCheckboxProps = () => {
|
|
37959
37955
|
const visibleItems = getVisibleNonAllItems();
|
|
37960
37956
|
if (visibleItems.length === 0) {
|
|
@@ -37985,9 +37981,20 @@ const FilterPop = props => {
|
|
|
37985
37981
|
};
|
|
37986
37982
|
const handleSearchChange = e => {
|
|
37987
37983
|
setSearchTerm(e.target.value);
|
|
37984
|
+
setScrollTop(0); // Reset scroll on search
|
|
37985
|
+
if (scrollContainerRef.current) {
|
|
37986
|
+
scrollContainerRef.current.scrollTop = 0;
|
|
37987
|
+
}
|
|
37988
37988
|
};
|
|
37989
37989
|
const clearSearch = () => {
|
|
37990
37990
|
setSearchTerm("");
|
|
37991
|
+
setScrollTop(0);
|
|
37992
|
+
if (scrollContainerRef.current) {
|
|
37993
|
+
scrollContainerRef.current.scrollTop = 0;
|
|
37994
|
+
}
|
|
37995
|
+
};
|
|
37996
|
+
const handleScroll = e => {
|
|
37997
|
+
setScrollTop(e.target.scrollTop);
|
|
37991
37998
|
};
|
|
37992
37999
|
return /*#__PURE__*/React$1.createElement(FilterPopContainer, {
|
|
37993
38000
|
width: width,
|
|
@@ -38000,19 +38007,39 @@ const FilterPop = props => {
|
|
|
38000
38007
|
value: searchTerm,
|
|
38001
38008
|
onChange: handleSearchChange,
|
|
38002
38009
|
accentColor: color
|
|
38003
|
-
}), /*#__PURE__*/React$1.createElement(
|
|
38010
|
+
}), /*#__PURE__*/React$1.createElement("div", {
|
|
38011
|
+
ref: scrollContainerRef,
|
|
38012
|
+
onScroll: handleScroll,
|
|
38013
|
+
style: {
|
|
38014
|
+
maxHeight: maxHeight,
|
|
38015
|
+
overflowY: "auto",
|
|
38016
|
+
position: "relative"
|
|
38017
|
+
}
|
|
38018
|
+
}, sortedList.length === 1 ? /*#__PURE__*/React$1.createElement(NoResultsMessage, null, "No items match your search") : /*#__PURE__*/React$1.createElement("div", {
|
|
38019
|
+
style: {
|
|
38020
|
+
height: `${totalHeight}px`,
|
|
38021
|
+
position: "relative"
|
|
38022
|
+
}
|
|
38023
|
+
}, /*#__PURE__*/React$1.createElement(CheckboxGroup, {
|
|
38004
38024
|
style: {
|
|
38005
38025
|
display: doubleColumn ? "grid" : "flex",
|
|
38006
38026
|
gridTemplateColumns: doubleColumn ? "1fr 1fr" : "none",
|
|
38007
|
-
gap: "8px"
|
|
38027
|
+
gap: "8px",
|
|
38028
|
+
position: "absolute",
|
|
38029
|
+
top: `${offsetY}px`,
|
|
38030
|
+
left: 0,
|
|
38031
|
+
right: 0
|
|
38008
38032
|
}
|
|
38009
|
-
},
|
|
38033
|
+
}, visibleItems.map(item => {
|
|
38010
38034
|
const isSelectAll = item.value === "All";
|
|
38011
38035
|
const checkboxProps = isSelectAll ? getSelectAllCheckboxProps() : {};
|
|
38012
38036
|
const isChecked = isSelectAll ? checkboxProps.checked : selectedAttributes[item.value] || false;
|
|
38013
38037
|
return /*#__PURE__*/React$1.createElement(CheckboxLabel, {
|
|
38014
38038
|
width: !doubleColumn ?? width,
|
|
38015
|
-
key: item.value
|
|
38039
|
+
key: item.value,
|
|
38040
|
+
style: {
|
|
38041
|
+
height: `${itemHeight}px`
|
|
38042
|
+
}
|
|
38016
38043
|
}, /*#__PURE__*/React$1.createElement("div", {
|
|
38017
38044
|
style: {
|
|
38018
38045
|
width: "20px",
|
|
@@ -38035,7 +38062,7 @@ const FilterPop = props => {
|
|
|
38035
38062
|
handleCheckboxChange(item.value);
|
|
38036
38063
|
}
|
|
38037
38064
|
})), /*#__PURE__*/React$1.createElement("span", null, item.label));
|
|
38038
|
-
})), /*#__PURE__*/React$1.createElement(ButtonWrapper$2, null, showSearch && searchTerm && /*#__PURE__*/React$1.createElement(ResetButton$1, {
|
|
38065
|
+
})))), /*#__PURE__*/React$1.createElement(ButtonWrapper$2, null, showSearch && searchTerm && /*#__PURE__*/React$1.createElement(ResetButton$1, {
|
|
38039
38066
|
onClick: clearSearch,
|
|
38040
38067
|
style: {
|
|
38041
38068
|
marginRight: "8px"
|
|
@@ -46897,6 +46924,7 @@ const Table = props => {
|
|
|
46897
46924
|
noEventsSubtitle = "Let's get started and create your first one!",
|
|
46898
46925
|
noEventsButtonText = "New Event",
|
|
46899
46926
|
noEventsButtonIcon = "Plus",
|
|
46927
|
+
noEventsButtonHeight,
|
|
46900
46928
|
disableNoEventsButton = false,
|
|
46901
46929
|
showNoEventsButton = true,
|
|
46902
46930
|
indexToShimmer = -1,
|
|
@@ -46921,7 +46949,9 @@ const Table = props => {
|
|
|
46921
46949
|
onEditableClick = () => {},
|
|
46922
46950
|
resetFiltersKey = 0,
|
|
46923
46951
|
// NEW: Add this prop
|
|
46924
|
-
ref = null
|
|
46952
|
+
ref = null,
|
|
46953
|
+
titleSize,
|
|
46954
|
+
subTitleSize
|
|
46925
46955
|
} = props;
|
|
46926
46956
|
const scrollWrapperRef = useRef(null);
|
|
46927
46957
|
const tableBodyRef = useRef(null);
|
|
@@ -47060,8 +47090,11 @@ const Table = props => {
|
|
|
47060
47090
|
onEditableClick: onEditableClick,
|
|
47061
47091
|
isEditMode: isEditMode,
|
|
47062
47092
|
editRowIndex: editRowIndex
|
|
47063
|
-
})), data.length === 0 && /*#__PURE__*/React$1.createElement(NoEventsParent, null, /*#__PURE__*/React$1.createElement(NoEventsWrapper, null, showNoDataInSearch ? getNoDataSearchIcon(noDataSearchIcon) : getNoDataIcon(noDataIcon)), /*#__PURE__*/React$1.createElement(NoEventsMessage,
|
|
47064
|
-
|
|
47093
|
+
})), data.length === 0 && /*#__PURE__*/React$1.createElement(NoEventsParent, null, /*#__PURE__*/React$1.createElement(NoEventsWrapper, null, showNoDataInSearch ? getNoDataSearchIcon(noDataSearchIcon) : getNoDataIcon(noDataIcon)), /*#__PURE__*/React$1.createElement(NoEventsMessage, {
|
|
47094
|
+
titleSize: titleSize,
|
|
47095
|
+
subTitleSize: subTitleSize
|
|
47096
|
+
}, showNoDataInSearch ? /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React$1.createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("strong", null, noEventsTitle), /*#__PURE__*/React$1.createElement("br", null), noEventsSubtitle)), !showNoDataInSearch && showNoEventsButton && /*#__PURE__*/React$1.createElement(Button$1, {
|
|
47097
|
+
height: noEventsButtonHeight ? noEventsButtonHeight : "45px",
|
|
47065
47098
|
leftIcon: noEventsButtonIcon,
|
|
47066
47099
|
text: noEventsButtonText,
|
|
47067
47100
|
disabled: disableNoEventsButton,
|
|
@@ -58328,7 +58361,7 @@ const QuickFilterCards = _ref => {
|
|
|
58328
58361
|
const StatusCell = styled.div`
|
|
58329
58362
|
display: inline-flex;
|
|
58330
58363
|
height: ${props => props.height};
|
|
58331
|
-
padding:
|
|
58364
|
+
padding: 6px 14px;
|
|
58332
58365
|
justify-content: center;
|
|
58333
58366
|
align-items: center;
|
|
58334
58367
|
gap: 14px;
|