sag_components 2.0.0-beta304 → 2.0.0-beta306
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.d.ts +3 -1
- package/dist/index.esm.js +72 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +72 -17
- package/dist/index.js.map +1 -1
- package/dist/types/components/QuickFilter/QuickFilter.d.ts +3 -1
- package/dist/types/components/QuickFilter/QuickFilter.stories.d.ts +120 -101
- package/dist/types/components/QuickFilterDropdownMultiSelection/QuickFilterDropdownMultiSelection.d.ts +2 -1
- package/dist/types/components/QuickFilterDropdownSingle/QuickFilterDropdownSingle.d.ts +9 -1
- package/dist/types/components/SearchInput/SearchInput.stories.d.ts +27 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3806,11 +3806,14 @@ const SearchInput$1 = props => {
|
|
|
3806
3806
|
position = 'left',
|
|
3807
3807
|
iconColor = '#212121',
|
|
3808
3808
|
onTyping = () => {},
|
|
3809
|
+
onClear = () => {},
|
|
3810
|
+
clearTrigger,
|
|
3809
3811
|
className
|
|
3810
3812
|
} = props;
|
|
3811
3813
|
|
|
3812
3814
|
// Use internal state for uncontrolled mode
|
|
3813
3815
|
const [internalValue, setInternalValue] = React$1.useState(defaultValue);
|
|
3816
|
+
const previousValueRef = React$1.useRef(defaultValue);
|
|
3814
3817
|
|
|
3815
3818
|
// Determine if component is controlled
|
|
3816
3819
|
const isControlled = controlledValue !== undefined;
|
|
@@ -3822,12 +3825,33 @@ const SearchInput$1 = props => {
|
|
|
3822
3825
|
setInternalValue(defaultValue);
|
|
3823
3826
|
}
|
|
3824
3827
|
}, [defaultValue, isControlled]);
|
|
3828
|
+
|
|
3829
|
+
// Clear the input when clearTrigger changes (external clear trigger)
|
|
3830
|
+
React$1.useEffect(() => {
|
|
3831
|
+
if (clearTrigger !== undefined) {
|
|
3832
|
+
setInternalValue('');
|
|
3833
|
+
}
|
|
3834
|
+
}, [clearTrigger]);
|
|
3825
3835
|
const handleInputChange = e => {
|
|
3836
|
+
const newValue = e.target.value;
|
|
3837
|
+
|
|
3838
|
+
// Detect native clear button click (value was non-empty, now empty, via input event)
|
|
3839
|
+
if (previousValueRef.current && newValue === '') {
|
|
3840
|
+
onClear();
|
|
3841
|
+
}
|
|
3842
|
+
previousValueRef.current = newValue;
|
|
3826
3843
|
if (!isControlled) {
|
|
3827
|
-
setInternalValue(
|
|
3844
|
+
setInternalValue(newValue);
|
|
3828
3845
|
}
|
|
3829
3846
|
onTyping(e);
|
|
3830
3847
|
};
|
|
3848
|
+
|
|
3849
|
+
// Handle the 'search' event which fires when native clear button is clicked
|
|
3850
|
+
const handleSearch = e => {
|
|
3851
|
+
if (e.target.value === '') {
|
|
3852
|
+
onClear();
|
|
3853
|
+
}
|
|
3854
|
+
};
|
|
3831
3855
|
return /*#__PURE__*/React__default["default"].createElement(TextFieldContainer, {
|
|
3832
3856
|
className: className,
|
|
3833
3857
|
width: width
|
|
@@ -3842,6 +3866,7 @@ const SearchInput$1 = props => {
|
|
|
3842
3866
|
height: height,
|
|
3843
3867
|
placeholder: placeholder,
|
|
3844
3868
|
onChange: handleInputChange,
|
|
3869
|
+
onSearch: handleSearch,
|
|
3845
3870
|
position: position
|
|
3846
3871
|
}));
|
|
3847
3872
|
};
|
|
@@ -24195,9 +24220,9 @@ const OptionItem$1 = styled__default["default"].li`
|
|
|
24195
24220
|
font-size: 14px;
|
|
24196
24221
|
font-weight: 400;
|
|
24197
24222
|
transition: background-color 0.3s;
|
|
24198
|
-
background-color: ${props => props.selected ?
|
|
24223
|
+
background-color: ${props => props.selected ? props.selectedOptionColor : '#fff'};
|
|
24199
24224
|
&:hover {
|
|
24200
|
-
background-color:
|
|
24225
|
+
background-color: ${props => props.optionHoverColor};
|
|
24201
24226
|
}
|
|
24202
24227
|
.highlight {
|
|
24203
24228
|
color: #229e38;
|
|
@@ -24224,6 +24249,8 @@ const QuickFilterDropdownSingle = _ref => {
|
|
|
24224
24249
|
options,
|
|
24225
24250
|
selectedValue,
|
|
24226
24251
|
placeHolder,
|
|
24252
|
+
optionHoverColor = '#edf6ff',
|
|
24253
|
+
selectedOptionColor = "#C7E4FF",
|
|
24227
24254
|
onChange,
|
|
24228
24255
|
disabled,
|
|
24229
24256
|
width,
|
|
@@ -24409,7 +24436,9 @@ const QuickFilterDropdownSingle = _ref => {
|
|
|
24409
24436
|
className: "OptionItem",
|
|
24410
24437
|
key: option.value,
|
|
24411
24438
|
onClick: () => toggleOption(option),
|
|
24412
|
-
selected: isDropdowned(option)
|
|
24439
|
+
selected: isDropdowned(option),
|
|
24440
|
+
selectedOptionColor: selectedOptionColor,
|
|
24441
|
+
optionHoverColor: optionHoverColor
|
|
24413
24442
|
}, highlightText(option.label, inputValue))))));
|
|
24414
24443
|
};
|
|
24415
24444
|
QuickFilterDropdownSingle.propTypes = {
|
|
@@ -24417,6 +24446,8 @@ QuickFilterDropdownSingle.propTypes = {
|
|
|
24417
24446
|
label: PropTypes.string,
|
|
24418
24447
|
labelColor: PropTypes.string,
|
|
24419
24448
|
hoverColor: PropTypes.string,
|
|
24449
|
+
optionHoverColor: PropTypes.string,
|
|
24450
|
+
selectedOptionColor: PropTypes.string,
|
|
24420
24451
|
width: PropTypes.string,
|
|
24421
24452
|
disabled: PropTypes.bool,
|
|
24422
24453
|
error: PropTypes.bool,
|
|
@@ -24438,6 +24469,8 @@ QuickFilterDropdownSingle.defaultProps = {
|
|
|
24438
24469
|
label: "Label",
|
|
24439
24470
|
labelColor: "#066768",
|
|
24440
24471
|
hoverColor: "#066768",
|
|
24472
|
+
optionHoverColor: '#edf6ff',
|
|
24473
|
+
selectedOptionColor: "#C7E4FF",
|
|
24441
24474
|
width: "auto",
|
|
24442
24475
|
disabled: false,
|
|
24443
24476
|
error: false,
|
|
@@ -24622,7 +24655,7 @@ const OptionItem = styled__default["default"].li`
|
|
|
24622
24655
|
transition: background-color 0.3s;
|
|
24623
24656
|
|
|
24624
24657
|
&:hover {
|
|
24625
|
-
background-color:
|
|
24658
|
+
background-color: ${props => props.optionHoverColor};
|
|
24626
24659
|
}
|
|
24627
24660
|
`;
|
|
24628
24661
|
const ErrorMessage$1 = styled__default["default"].div`
|
|
@@ -24699,6 +24732,7 @@ const QuickFilterDropdownMultiSelection = _ref => {
|
|
|
24699
24732
|
error,
|
|
24700
24733
|
errorMessage,
|
|
24701
24734
|
labelColor,
|
|
24735
|
+
optionHoverColor = '#edf6ff',
|
|
24702
24736
|
xIconShow,
|
|
24703
24737
|
checkBoxColor,
|
|
24704
24738
|
showLabelOnTop,
|
|
@@ -24953,7 +24987,8 @@ const QuickFilterDropdownMultiSelection = _ref => {
|
|
|
24953
24987
|
className: "OptionItem",
|
|
24954
24988
|
key: option.value,
|
|
24955
24989
|
onClick: () => toggleOption(option),
|
|
24956
|
-
selected: isDropdowned(option)
|
|
24990
|
+
selected: isDropdowned(option),
|
|
24991
|
+
optionHoverColor: optionHoverColor
|
|
24957
24992
|
}, /*#__PURE__*/React__default["default"].createElement(IconContainer$2, {
|
|
24958
24993
|
className: "IconContainer"
|
|
24959
24994
|
}, selectedOptions.find(itemSelectedOptions => option.value === itemSelectedOptions.value) ? /*#__PURE__*/React__default["default"].createElement(CheckBoxCheckedIcon, {
|
|
@@ -25036,6 +25071,8 @@ const QuickFilter = _ref => {
|
|
|
25036
25071
|
label = "Unit Type:",
|
|
25037
25072
|
labelColor = "#066768",
|
|
25038
25073
|
placeHolder = "Select From List",
|
|
25074
|
+
optionHoverColor = '#edf6ff',
|
|
25075
|
+
selectedOptionColor = "#C7E4FF",
|
|
25039
25076
|
width = "auto",
|
|
25040
25077
|
height = "38px",
|
|
25041
25078
|
checkBoxColor = "#229E38",
|
|
@@ -25053,6 +25090,7 @@ const QuickFilter = _ref => {
|
|
|
25053
25090
|
label: label,
|
|
25054
25091
|
labelColor: labelColor,
|
|
25055
25092
|
checkBoxColor: checkBoxColor,
|
|
25093
|
+
optionHoverColor: optionHoverColor,
|
|
25056
25094
|
options: options,
|
|
25057
25095
|
width: width,
|
|
25058
25096
|
height: height,
|
|
@@ -25067,6 +25105,8 @@ const QuickFilter = _ref => {
|
|
|
25067
25105
|
placeHolder: placeHolder,
|
|
25068
25106
|
label: label,
|
|
25069
25107
|
labelColor: labelColor,
|
|
25108
|
+
optionHoverColor: optionHoverColor,
|
|
25109
|
+
selectedOptionColor: selectedOptionColor,
|
|
25070
25110
|
checkBoxColor: checkBoxColor,
|
|
25071
25111
|
options: options,
|
|
25072
25112
|
width: width,
|
|
@@ -35752,7 +35792,7 @@ const Label$3 = styled__default["default"].label`
|
|
|
35752
35792
|
if (props.isFocused || props.hasValue) {
|
|
35753
35793
|
return '0px';
|
|
35754
35794
|
}
|
|
35755
|
-
return props.size === 'medium' ? '
|
|
35795
|
+
return props.size === 'medium' ? '50%' : '17px';
|
|
35756
35796
|
}};
|
|
35757
35797
|
left: ${props => {
|
|
35758
35798
|
if (props.multiline) {
|
|
@@ -37709,8 +37749,16 @@ const SearchInput = styled__default["default"].input`
|
|
|
37709
37749
|
}
|
|
37710
37750
|
`;
|
|
37711
37751
|
const ListWrapper = styled__default["default"].div`
|
|
37712
|
-
max-height: ${props =>
|
|
37713
|
-
|
|
37752
|
+
max-height: ${props => {
|
|
37753
|
+
const maxH = parseInt(props.maxHeight) || 400;
|
|
37754
|
+
const actualH = (props.actualHeight || maxH) + 16;
|
|
37755
|
+
return actualH < maxH ? `${actualH}px` : props.maxHeight;
|
|
37756
|
+
}};
|
|
37757
|
+
overflow-y: ${props => {
|
|
37758
|
+
const maxH = parseInt(props.maxHeight) || 400;
|
|
37759
|
+
const actualH = (props.actualHeight || maxH) + 16;
|
|
37760
|
+
return actualH < maxH ? 'hidden' : 'auto';
|
|
37761
|
+
}};
|
|
37714
37762
|
position: relative;
|
|
37715
37763
|
`;
|
|
37716
37764
|
const CheckboxGroup = styled__default["default"].div`
|
|
@@ -37755,6 +37803,7 @@ const CheckboxLabel = styled__default["default"].label`
|
|
|
37755
37803
|
color: #212121;
|
|
37756
37804
|
cursor: pointer;
|
|
37757
37805
|
flex-shrink: 0;
|
|
37806
|
+
box-sizing: border-box;
|
|
37758
37807
|
|
|
37759
37808
|
&:hover {
|
|
37760
37809
|
background-color: #E6F0F0;
|
|
@@ -37827,7 +37876,7 @@ const FilterPop = props => {
|
|
|
37827
37876
|
selectedAttributes: propSelectedAttributes = {},
|
|
37828
37877
|
showSearch = true,
|
|
37829
37878
|
searchPlaceholder = "Search...",
|
|
37830
|
-
itemHeight =
|
|
37879
|
+
itemHeight = 40,
|
|
37831
37880
|
overscan = 5,
|
|
37832
37881
|
hasActiveFilter = false // NEW: Indicates if this column has an active filter
|
|
37833
37882
|
} = props;
|
|
@@ -37916,16 +37965,18 @@ const FilterPop = props => {
|
|
|
37916
37965
|
offsetY
|
|
37917
37966
|
} = React$1.useMemo(() => {
|
|
37918
37967
|
const containerHeight = parseInt(maxHeight) || 400;
|
|
37919
|
-
const
|
|
37920
|
-
const
|
|
37968
|
+
const gap = 8;
|
|
37969
|
+
const itemWithGap = itemHeight + gap;
|
|
37970
|
+
const startIndex = Math.max(0, Math.floor(scrollTop / itemWithGap) - overscan);
|
|
37971
|
+
const endIndex = Math.min(sortedList.length, Math.ceil((scrollTop + containerHeight) / itemWithGap) + overscan);
|
|
37921
37972
|
const visible = sortedList.slice(startIndex, endIndex).map((item, idx) => ({
|
|
37922
37973
|
...item,
|
|
37923
37974
|
index: startIndex + idx
|
|
37924
37975
|
}));
|
|
37925
37976
|
return {
|
|
37926
37977
|
visibleItems: visible,
|
|
37927
|
-
totalHeight:
|
|
37928
|
-
offsetY: startIndex *
|
|
37978
|
+
totalHeight: sortedList.length * itemHeight + Math.max(0, sortedList.length - 1) * gap,
|
|
37979
|
+
offsetY: startIndex * itemWithGap
|
|
37929
37980
|
};
|
|
37930
37981
|
}, [sortedList, scrollTop, itemHeight, overscan, maxHeight]);
|
|
37931
37982
|
const areAllNonAllItemsSelected = function () {
|
|
@@ -38125,7 +38176,8 @@ const FilterPop = props => {
|
|
|
38125
38176
|
}), /*#__PURE__*/React__default["default"].createElement(ListWrapper, {
|
|
38126
38177
|
ref: scrollContainerRef,
|
|
38127
38178
|
onScroll: handleScroll,
|
|
38128
|
-
maxHeight: maxHeight
|
|
38179
|
+
maxHeight: maxHeight,
|
|
38180
|
+
actualHeight: totalHeight
|
|
38129
38181
|
}, sortedList.length === 1 ? /*#__PURE__*/React__default["default"].createElement(NoResultsMessage, null, "No items match your search") : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
38130
38182
|
style: {
|
|
38131
38183
|
height: `${totalHeight}px`,
|
|
@@ -40977,10 +41029,12 @@ const TableHeader = ({
|
|
|
40977
41029
|
const debouncedFilterState = useDebounce(filterState, debounceDelay);
|
|
40978
41030
|
const iconRefs = React$1.useRef({});
|
|
40979
41031
|
const popupRef = React$1.useRef(null);
|
|
41032
|
+
const prevResetKeyRef = React$1.useRef(resetFiltersKey);
|
|
40980
41033
|
|
|
40981
|
-
// Reset internal state when resetFiltersKey changes
|
|
41034
|
+
// Reset internal state when resetFiltersKey changes (not when columns change)
|
|
40982
41035
|
React$1.useEffect(() => {
|
|
40983
|
-
|
|
41036
|
+
// Only run reset when resetFiltersKey actually changed
|
|
41037
|
+
if (resetFiltersKey !== prevResetKeyRef.current && resetFiltersKey > 0) {
|
|
40984
41038
|
const resetSelections = {};
|
|
40985
41039
|
columns.forEach(column => {
|
|
40986
41040
|
if (column.filter && column.filterOptions) {
|
|
@@ -41002,6 +41056,7 @@ const TableHeader = ({
|
|
|
41002
41056
|
setVisibleFilterPopWrapper(null);
|
|
41003
41057
|
setVisibleSortPopWrapper(null);
|
|
41004
41058
|
}
|
|
41059
|
+
prevResetKeyRef.current = resetFiltersKey;
|
|
41005
41060
|
}, [resetFiltersKey, columns]);
|
|
41006
41061
|
|
|
41007
41062
|
// Track if we've already initialized from saved state
|