sag_components 2.0.0-beta253 → 2.0.0-beta254
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 +132 -118
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +132 -118
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10591,24 +10591,23 @@ const QuarterPopupPicker = ({
|
|
|
10591
10591
|
};
|
|
10592
10592
|
|
|
10593
10593
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
10594
|
-
const QuarterPicker =
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
} = _ref;
|
|
10594
|
+
const QuarterPicker = ({
|
|
10595
|
+
availableQuarters,
|
|
10596
|
+
// ["Q1-2024"]
|
|
10597
|
+
label,
|
|
10598
|
+
onChange,
|
|
10599
|
+
borderRadius,
|
|
10600
|
+
required,
|
|
10601
|
+
width,
|
|
10602
|
+
height,
|
|
10603
|
+
placeholder,
|
|
10604
|
+
disabled,
|
|
10605
|
+
borderColor,
|
|
10606
|
+
borderColorFocus,
|
|
10607
|
+
textColor,
|
|
10608
|
+
selectedValue,
|
|
10609
|
+
startYear
|
|
10610
|
+
}) => {
|
|
10612
10611
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
10613
10612
|
const [isOpen, setIsOpen] = React$1.useState(false);
|
|
10614
10613
|
const [value, setValue] = React$1.useState('');
|
|
@@ -11050,23 +11049,22 @@ const MonthPopupPicker = ({
|
|
|
11050
11049
|
};
|
|
11051
11050
|
|
|
11052
11051
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
11053
|
-
const MonthPicker =
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
} = _ref;
|
|
11052
|
+
const MonthPicker = ({
|
|
11053
|
+
availableMonths,
|
|
11054
|
+
label,
|
|
11055
|
+
onChange,
|
|
11056
|
+
borderRadius,
|
|
11057
|
+
required,
|
|
11058
|
+
width,
|
|
11059
|
+
height,
|
|
11060
|
+
placeholder,
|
|
11061
|
+
disabled,
|
|
11062
|
+
borderColor,
|
|
11063
|
+
borderColorFocus,
|
|
11064
|
+
textColor,
|
|
11065
|
+
selectedValue,
|
|
11066
|
+
startYear
|
|
11067
|
+
}) => {
|
|
11070
11068
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
11071
11069
|
const [isOpen, setIsOpen] = React$1.useState(false);
|
|
11072
11070
|
const [value, setValue] = React$1.useState('');
|
|
@@ -24177,22 +24175,21 @@ const DeleteIcon = styled__default["default"].div`
|
|
|
24177
24175
|
position: absolute;
|
|
24178
24176
|
`;
|
|
24179
24177
|
|
|
24180
|
-
const QuickFilterDropdownSingle =
|
|
24181
|
-
|
|
24182
|
-
|
|
24183
|
-
|
|
24184
|
-
|
|
24185
|
-
|
|
24186
|
-
|
|
24187
|
-
|
|
24188
|
-
|
|
24189
|
-
|
|
24190
|
-
|
|
24191
|
-
|
|
24192
|
-
|
|
24193
|
-
|
|
24194
|
-
|
|
24195
|
-
} = _ref;
|
|
24178
|
+
const QuickFilterDropdownSingle = ({
|
|
24179
|
+
label,
|
|
24180
|
+
hoverColor,
|
|
24181
|
+
options,
|
|
24182
|
+
selectedValue,
|
|
24183
|
+
placeHolder,
|
|
24184
|
+
onChange,
|
|
24185
|
+
disabled,
|
|
24186
|
+
width,
|
|
24187
|
+
error,
|
|
24188
|
+
errorMessage,
|
|
24189
|
+
xIconShow,
|
|
24190
|
+
labelColor,
|
|
24191
|
+
showLabelOnTop
|
|
24192
|
+
}) => {
|
|
24196
24193
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
24197
24194
|
const [showOptions, setShowOptions] = React$1.useState(false);
|
|
24198
24195
|
const [inputValue, setInputValue] = React$1.useState("");
|
|
@@ -24649,26 +24646,25 @@ const IconContainer$2 = styled__default["default"].div`
|
|
|
24649
24646
|
cursor: pointer;
|
|
24650
24647
|
`;
|
|
24651
24648
|
|
|
24652
|
-
const QuickFilterDropdownMultiSelection =
|
|
24653
|
-
|
|
24654
|
-
|
|
24655
|
-
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
|
|
24659
|
-
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
|
|
24663
|
-
|
|
24664
|
-
|
|
24665
|
-
|
|
24666
|
-
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
} = _ref;
|
|
24649
|
+
const QuickFilterDropdownMultiSelection = ({
|
|
24650
|
+
label,
|
|
24651
|
+
labelEmptyValue,
|
|
24652
|
+
options,
|
|
24653
|
+
selectedValue,
|
|
24654
|
+
placeHolder,
|
|
24655
|
+
onChange,
|
|
24656
|
+
required,
|
|
24657
|
+
disabled,
|
|
24658
|
+
width,
|
|
24659
|
+
height,
|
|
24660
|
+
error,
|
|
24661
|
+
errorMessage,
|
|
24662
|
+
labelColor,
|
|
24663
|
+
xIconShow,
|
|
24664
|
+
checkBoxColor,
|
|
24665
|
+
showLabelOnTop,
|
|
24666
|
+
dropdownHeight
|
|
24667
|
+
}) => {
|
|
24672
24668
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
24673
24669
|
const [showOptions, setShowOptions] = React$1.useState(false);
|
|
24674
24670
|
const [inputValue, setInputValue] = React$1.useState('');
|
|
@@ -36178,9 +36174,9 @@ const ToggleSlider = styled__default["default"].span`
|
|
|
36178
36174
|
}
|
|
36179
36175
|
`;
|
|
36180
36176
|
|
|
36181
|
-
/**
|
|
36182
|
-
* ToggleSwitch component for on/off states.
|
|
36183
|
-
* Supports small/large sizes and disabled state.
|
|
36177
|
+
/**
|
|
36178
|
+
* ToggleSwitch component for on/off states.
|
|
36179
|
+
* Supports small/large sizes and disabled state.
|
|
36184
36180
|
*/
|
|
36185
36181
|
function ToggleSwitch(_ref) {
|
|
36186
36182
|
let {
|
|
@@ -37754,23 +37750,19 @@ const FilterPop = props => {
|
|
|
37754
37750
|
isAsc = true,
|
|
37755
37751
|
selectedAttributes: propSelectedAttributes = {},
|
|
37756
37752
|
showSearch = true,
|
|
37757
|
-
searchPlaceholder = "Search..."
|
|
37753
|
+
searchPlaceholder = "Search...",
|
|
37754
|
+
itemHeight = 32,
|
|
37755
|
+
overscan = 5
|
|
37758
37756
|
} = props;
|
|
37759
|
-
|
|
37760
|
-
// State for search term
|
|
37761
37757
|
const [searchTerm, setSearchTerm] = React$1.useState("");
|
|
37762
|
-
|
|
37763
|
-
// CRITICAL FIX: Use internal state for selected attributes
|
|
37764
37758
|
const [selectedAttributes, setSelectedAttributes] = React$1.useState({});
|
|
37759
|
+
const [scrollTop, setScrollTop] = React$1.useState(0);
|
|
37765
37760
|
const isInitialMount = React$1.useRef(true);
|
|
37766
|
-
|
|
37767
|
-
// Add hardcoded "Select All" as first item
|
|
37761
|
+
const scrollContainerRef = React$1.useRef(null);
|
|
37768
37762
|
const fullList = React$1.useMemo(() => [{
|
|
37769
37763
|
value: "All",
|
|
37770
37764
|
label: "Select All"
|
|
37771
37765
|
}, ...list], [list]);
|
|
37772
|
-
|
|
37773
|
-
// Create initial state - all items selected by default
|
|
37774
37766
|
const createInitialState = () => {
|
|
37775
37767
|
const initialState = {};
|
|
37776
37768
|
fullList.forEach(item => {
|
|
@@ -37778,11 +37770,8 @@ const FilterPop = props => {
|
|
|
37778
37770
|
});
|
|
37779
37771
|
return initialState;
|
|
37780
37772
|
};
|
|
37781
|
-
|
|
37782
|
-
// CRITICAL: Initialize and sync with props only when necessary
|
|
37783
37773
|
React$1.useEffect(() => {
|
|
37784
37774
|
if (isInitialMount.current) {
|
|
37785
|
-
// First mount: use props or create initial state
|
|
37786
37775
|
if (Object.keys(propSelectedAttributes).length > 0) {
|
|
37787
37776
|
setSelectedAttributes(propSelectedAttributes);
|
|
37788
37777
|
} else {
|
|
@@ -37790,8 +37779,6 @@ const FilterPop = props => {
|
|
|
37790
37779
|
}
|
|
37791
37780
|
isInitialMount.current = false;
|
|
37792
37781
|
} else {
|
|
37793
|
-
// After mount: only update if props explicitly changed and are non-empty
|
|
37794
|
-
// This prevents reset when parent re-renders
|
|
37795
37782
|
if (Object.keys(propSelectedAttributes).length > 0) {
|
|
37796
37783
|
const propsString = JSON.stringify(propSelectedAttributes);
|
|
37797
37784
|
const currentString = JSON.stringify(selectedAttributes);
|
|
@@ -37800,9 +37787,7 @@ const FilterPop = props => {
|
|
|
37800
37787
|
}
|
|
37801
37788
|
}
|
|
37802
37789
|
}
|
|
37803
|
-
}, [propSelectedAttributes]);
|
|
37804
|
-
|
|
37805
|
-
// Update selected attributes when list changes to include new items
|
|
37790
|
+
}, [propSelectedAttributes]);
|
|
37806
37791
|
React$1.useEffect(() => {
|
|
37807
37792
|
if (!isInitialMount.current && list.length > 0) {
|
|
37808
37793
|
setSelectedAttributes(prev => {
|
|
@@ -37810,38 +37795,28 @@ const FilterPop = props => {
|
|
|
37810
37795
|
...prev
|
|
37811
37796
|
};
|
|
37812
37797
|
let hasChanges = false;
|
|
37813
|
-
|
|
37814
|
-
// Add any new items from the list that aren't in current selection
|
|
37815
37798
|
fullList.forEach(item => {
|
|
37816
37799
|
if (item.value !== "All" && !(item.value in updated)) {
|
|
37817
|
-
updated[item.value] = true;
|
|
37800
|
+
updated[item.value] = true;
|
|
37818
37801
|
hasChanges = true;
|
|
37819
37802
|
}
|
|
37820
37803
|
});
|
|
37821
|
-
|
|
37822
|
-
// Remove items that no longer exist in the list
|
|
37823
37804
|
Object.keys(updated).forEach(key => {
|
|
37824
37805
|
if (key !== "All" && !fullList.find(item => item.value === key)) {
|
|
37825
37806
|
delete updated[key];
|
|
37826
37807
|
hasChanges = true;
|
|
37827
37808
|
}
|
|
37828
37809
|
});
|
|
37829
|
-
|
|
37830
|
-
// Update "Select All" state
|
|
37831
37810
|
if (hasChanges) {
|
|
37832
37811
|
updated.All = areAllNonAllItemsSelected(updated);
|
|
37833
37812
|
}
|
|
37834
37813
|
return hasChanges ? updated : prev;
|
|
37835
37814
|
});
|
|
37836
37815
|
}
|
|
37837
|
-
}, [list]);
|
|
37838
|
-
|
|
37839
|
-
// Helper function to get non-"All" items
|
|
37816
|
+
}, [list]);
|
|
37840
37817
|
const getNonAllItems = () => {
|
|
37841
37818
|
return fullList.filter(item => item.value !== "All");
|
|
37842
37819
|
};
|
|
37843
|
-
|
|
37844
|
-
// Filter items based on search term
|
|
37845
37820
|
const filteredList = React$1.useMemo(() => {
|
|
37846
37821
|
if (!searchTerm.trim()) {
|
|
37847
37822
|
return fullList;
|
|
@@ -37853,22 +37828,34 @@ const FilterPop = props => {
|
|
|
37853
37828
|
});
|
|
37854
37829
|
return [fullList.find(item => item.value === "All"), ...filteredNonAllItems];
|
|
37855
37830
|
}, [fullList, searchTerm]);
|
|
37856
|
-
|
|
37857
|
-
// Sort the filtered list based on the `isAsc` prop
|
|
37858
37831
|
const sortedList = React$1.useMemo(() => {
|
|
37859
37832
|
return [...filteredList.filter(item => item.value === "All"), ...filteredList.filter(item => item.value !== "All").sort((a, b) => {
|
|
37860
37833
|
return isAsc ? a.label.localeCompare(b.label) : b.label.localeCompare(a.label);
|
|
37861
37834
|
})];
|
|
37862
37835
|
}, [filteredList, isAsc]);
|
|
37863
|
-
|
|
37864
|
-
|
|
37836
|
+
const {
|
|
37837
|
+
visibleItems,
|
|
37838
|
+
totalHeight,
|
|
37839
|
+
offsetY
|
|
37840
|
+
} = React$1.useMemo(() => {
|
|
37841
|
+
const containerHeight = parseInt(maxHeight) || 400;
|
|
37842
|
+
const startIndex = Math.max(0, Math.floor(scrollTop / itemHeight) - overscan);
|
|
37843
|
+
const endIndex = Math.min(sortedList.length, Math.ceil((scrollTop + containerHeight) / itemHeight) + overscan);
|
|
37844
|
+
const visible = sortedList.slice(startIndex, endIndex).map((item, idx) => ({
|
|
37845
|
+
...item,
|
|
37846
|
+
index: startIndex + idx
|
|
37847
|
+
}));
|
|
37848
|
+
return {
|
|
37849
|
+
visibleItems: visible,
|
|
37850
|
+
totalHeight: sortedList.length * itemHeight,
|
|
37851
|
+
offsetY: startIndex * itemHeight
|
|
37852
|
+
};
|
|
37853
|
+
}, [sortedList, scrollTop, itemHeight, overscan, maxHeight]);
|
|
37865
37854
|
const areAllNonAllItemsSelected = function () {
|
|
37866
37855
|
let attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : selectedAttributes;
|
|
37867
37856
|
const nonAllItems = getNonAllItems();
|
|
37868
37857
|
return nonAllItems.every(item => attributes[item.value]);
|
|
37869
37858
|
};
|
|
37870
|
-
|
|
37871
|
-
// Helper functions for visible filtered items
|
|
37872
37859
|
const getVisibleNonAllItems = () => {
|
|
37873
37860
|
return sortedList.filter(item => item.value !== "All");
|
|
37874
37861
|
};
|
|
@@ -37883,8 +37870,6 @@ const FilterPop = props => {
|
|
|
37883
37870
|
const visibleItems = getVisibleNonAllItems();
|
|
37884
37871
|
return visibleItems.some(item => attributes[item.value]);
|
|
37885
37872
|
};
|
|
37886
|
-
|
|
37887
|
-
// Create the efficient data structure
|
|
37888
37873
|
const createFilterData = attributes => {
|
|
37889
37874
|
const nonAllItems = getNonAllItems();
|
|
37890
37875
|
const selectedItems = nonAllItems.filter(item => attributes[item.value]);
|
|
@@ -37963,8 +37948,6 @@ const FilterPop = props => {
|
|
|
37963
37948
|
allItems: resetState
|
|
37964
37949
|
});
|
|
37965
37950
|
};
|
|
37966
|
-
|
|
37967
|
-
// Function to determine checkbox state for "Select All"
|
|
37968
37951
|
const getSelectAllCheckboxProps = () => {
|
|
37969
37952
|
const visibleItems = getVisibleNonAllItems();
|
|
37970
37953
|
if (visibleItems.length === 0) {
|
|
@@ -37995,9 +37978,20 @@ const FilterPop = props => {
|
|
|
37995
37978
|
};
|
|
37996
37979
|
const handleSearchChange = e => {
|
|
37997
37980
|
setSearchTerm(e.target.value);
|
|
37981
|
+
setScrollTop(0); // Reset scroll on search
|
|
37982
|
+
if (scrollContainerRef.current) {
|
|
37983
|
+
scrollContainerRef.current.scrollTop = 0;
|
|
37984
|
+
}
|
|
37998
37985
|
};
|
|
37999
37986
|
const clearSearch = () => {
|
|
38000
37987
|
setSearchTerm("");
|
|
37988
|
+
setScrollTop(0);
|
|
37989
|
+
if (scrollContainerRef.current) {
|
|
37990
|
+
scrollContainerRef.current.scrollTop = 0;
|
|
37991
|
+
}
|
|
37992
|
+
};
|
|
37993
|
+
const handleScroll = e => {
|
|
37994
|
+
setScrollTop(e.target.scrollTop);
|
|
38001
37995
|
};
|
|
38002
37996
|
return /*#__PURE__*/React__default["default"].createElement(FilterPopContainer, {
|
|
38003
37997
|
width: width,
|
|
@@ -38010,19 +38004,39 @@ const FilterPop = props => {
|
|
|
38010
38004
|
value: searchTerm,
|
|
38011
38005
|
onChange: handleSearchChange,
|
|
38012
38006
|
accentColor: color
|
|
38013
|
-
}), /*#__PURE__*/React__default["default"].createElement(
|
|
38007
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
38008
|
+
ref: scrollContainerRef,
|
|
38009
|
+
onScroll: handleScroll,
|
|
38010
|
+
style: {
|
|
38011
|
+
maxHeight: maxHeight,
|
|
38012
|
+
overflowY: "auto",
|
|
38013
|
+
position: "relative"
|
|
38014
|
+
}
|
|
38015
|
+
}, sortedList.length === 1 ? /*#__PURE__*/React__default["default"].createElement(NoResultsMessage, null, "No items match your search") : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
38016
|
+
style: {
|
|
38017
|
+
height: `${totalHeight}px`,
|
|
38018
|
+
position: "relative"
|
|
38019
|
+
}
|
|
38020
|
+
}, /*#__PURE__*/React__default["default"].createElement(CheckboxGroup, {
|
|
38014
38021
|
style: {
|
|
38015
38022
|
display: doubleColumn ? "grid" : "flex",
|
|
38016
38023
|
gridTemplateColumns: doubleColumn ? "1fr 1fr" : "none",
|
|
38017
|
-
gap: "8px"
|
|
38024
|
+
gap: "8px",
|
|
38025
|
+
position: "absolute",
|
|
38026
|
+
top: `${offsetY}px`,
|
|
38027
|
+
left: 0,
|
|
38028
|
+
right: 0
|
|
38018
38029
|
}
|
|
38019
|
-
},
|
|
38030
|
+
}, visibleItems.map(item => {
|
|
38020
38031
|
const isSelectAll = item.value === "All";
|
|
38021
38032
|
const checkboxProps = isSelectAll ? getSelectAllCheckboxProps() : {};
|
|
38022
38033
|
const isChecked = isSelectAll ? checkboxProps.checked : selectedAttributes[item.value] || false;
|
|
38023
38034
|
return /*#__PURE__*/React__default["default"].createElement(CheckboxLabel, {
|
|
38024
38035
|
width: !doubleColumn ?? width,
|
|
38025
|
-
key: item.value
|
|
38036
|
+
key: item.value,
|
|
38037
|
+
style: {
|
|
38038
|
+
height: `${itemHeight}px`
|
|
38039
|
+
}
|
|
38026
38040
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
38027
38041
|
style: {
|
|
38028
38042
|
width: "20px",
|
|
@@ -38045,7 +38059,7 @@ const FilterPop = props => {
|
|
|
38045
38059
|
handleCheckboxChange(item.value);
|
|
38046
38060
|
}
|
|
38047
38061
|
})), /*#__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, {
|
|
38062
|
+
})))), /*#__PURE__*/React__default["default"].createElement(ButtonWrapper$2, null, showSearch && searchTerm && /*#__PURE__*/React__default["default"].createElement(ResetButton$1, {
|
|
38049
38063
|
onClick: clearSearch,
|
|
38050
38064
|
style: {
|
|
38051
38065
|
marginRight: "8px"
|