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.d.ts
CHANGED
|
@@ -422,7 +422,7 @@ declare namespace CollapseHeader {
|
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
declare function QuickFilter({ hoverColor, multipleSelection, xIconShow, disabled, error, errorMessage, label, labelColor, placeHolder, width, height, checkBoxColor, dropdownHeight, onChange, options, selectedValue, }: {
|
|
425
|
+
declare function QuickFilter({ hoverColor, multipleSelection, xIconShow, disabled, error, errorMessage, label, labelColor, placeHolder, optionHoverColor, selectedOptionColor, width, height, checkBoxColor, dropdownHeight, onChange, options, selectedValue, }: {
|
|
426
426
|
hoverColor?: string;
|
|
427
427
|
multipleSelection?: boolean;
|
|
428
428
|
xIconShow?: boolean;
|
|
@@ -432,6 +432,8 @@ declare function QuickFilter({ hoverColor, multipleSelection, xIconShow, disable
|
|
|
432
432
|
label?: string;
|
|
433
433
|
labelColor?: string;
|
|
434
434
|
placeHolder?: string;
|
|
435
|
+
optionHoverColor?: string;
|
|
436
|
+
selectedOptionColor?: string;
|
|
435
437
|
width?: string;
|
|
436
438
|
height?: string;
|
|
437
439
|
checkBoxColor?: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -3796,11 +3796,14 @@ const SearchInput$1 = props => {
|
|
|
3796
3796
|
position = 'left',
|
|
3797
3797
|
iconColor = '#212121',
|
|
3798
3798
|
onTyping = () => {},
|
|
3799
|
+
onClear = () => {},
|
|
3800
|
+
clearTrigger,
|
|
3799
3801
|
className
|
|
3800
3802
|
} = props;
|
|
3801
3803
|
|
|
3802
3804
|
// Use internal state for uncontrolled mode
|
|
3803
3805
|
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
3806
|
+
const previousValueRef = useRef(defaultValue);
|
|
3804
3807
|
|
|
3805
3808
|
// Determine if component is controlled
|
|
3806
3809
|
const isControlled = controlledValue !== undefined;
|
|
@@ -3812,12 +3815,33 @@ const SearchInput$1 = props => {
|
|
|
3812
3815
|
setInternalValue(defaultValue);
|
|
3813
3816
|
}
|
|
3814
3817
|
}, [defaultValue, isControlled]);
|
|
3818
|
+
|
|
3819
|
+
// Clear the input when clearTrigger changes (external clear trigger)
|
|
3820
|
+
useEffect(() => {
|
|
3821
|
+
if (clearTrigger !== undefined) {
|
|
3822
|
+
setInternalValue('');
|
|
3823
|
+
}
|
|
3824
|
+
}, [clearTrigger]);
|
|
3815
3825
|
const handleInputChange = e => {
|
|
3826
|
+
const newValue = e.target.value;
|
|
3827
|
+
|
|
3828
|
+
// Detect native clear button click (value was non-empty, now empty, via input event)
|
|
3829
|
+
if (previousValueRef.current && newValue === '') {
|
|
3830
|
+
onClear();
|
|
3831
|
+
}
|
|
3832
|
+
previousValueRef.current = newValue;
|
|
3816
3833
|
if (!isControlled) {
|
|
3817
|
-
setInternalValue(
|
|
3834
|
+
setInternalValue(newValue);
|
|
3818
3835
|
}
|
|
3819
3836
|
onTyping(e);
|
|
3820
3837
|
};
|
|
3838
|
+
|
|
3839
|
+
// Handle the 'search' event which fires when native clear button is clicked
|
|
3840
|
+
const handleSearch = e => {
|
|
3841
|
+
if (e.target.value === '') {
|
|
3842
|
+
onClear();
|
|
3843
|
+
}
|
|
3844
|
+
};
|
|
3821
3845
|
return /*#__PURE__*/React$1.createElement(TextFieldContainer, {
|
|
3822
3846
|
className: className,
|
|
3823
3847
|
width: width
|
|
@@ -3832,6 +3856,7 @@ const SearchInput$1 = props => {
|
|
|
3832
3856
|
height: height,
|
|
3833
3857
|
placeholder: placeholder,
|
|
3834
3858
|
onChange: handleInputChange,
|
|
3859
|
+
onSearch: handleSearch,
|
|
3835
3860
|
position: position
|
|
3836
3861
|
}));
|
|
3837
3862
|
};
|
|
@@ -24185,9 +24210,9 @@ const OptionItem$1 = styled.li`
|
|
|
24185
24210
|
font-size: 14px;
|
|
24186
24211
|
font-weight: 400;
|
|
24187
24212
|
transition: background-color 0.3s;
|
|
24188
|
-
background-color: ${props => props.selected ?
|
|
24213
|
+
background-color: ${props => props.selected ? props.selectedOptionColor : '#fff'};
|
|
24189
24214
|
&:hover {
|
|
24190
|
-
background-color:
|
|
24215
|
+
background-color: ${props => props.optionHoverColor};
|
|
24191
24216
|
}
|
|
24192
24217
|
.highlight {
|
|
24193
24218
|
color: #229e38;
|
|
@@ -24214,6 +24239,8 @@ const QuickFilterDropdownSingle = _ref => {
|
|
|
24214
24239
|
options,
|
|
24215
24240
|
selectedValue,
|
|
24216
24241
|
placeHolder,
|
|
24242
|
+
optionHoverColor = '#edf6ff',
|
|
24243
|
+
selectedOptionColor = "#C7E4FF",
|
|
24217
24244
|
onChange,
|
|
24218
24245
|
disabled,
|
|
24219
24246
|
width,
|
|
@@ -24399,7 +24426,9 @@ const QuickFilterDropdownSingle = _ref => {
|
|
|
24399
24426
|
className: "OptionItem",
|
|
24400
24427
|
key: option.value,
|
|
24401
24428
|
onClick: () => toggleOption(option),
|
|
24402
|
-
selected: isDropdowned(option)
|
|
24429
|
+
selected: isDropdowned(option),
|
|
24430
|
+
selectedOptionColor: selectedOptionColor,
|
|
24431
|
+
optionHoverColor: optionHoverColor
|
|
24403
24432
|
}, highlightText(option.label, inputValue))))));
|
|
24404
24433
|
};
|
|
24405
24434
|
QuickFilterDropdownSingle.propTypes = {
|
|
@@ -24407,6 +24436,8 @@ QuickFilterDropdownSingle.propTypes = {
|
|
|
24407
24436
|
label: PropTypes.string,
|
|
24408
24437
|
labelColor: PropTypes.string,
|
|
24409
24438
|
hoverColor: PropTypes.string,
|
|
24439
|
+
optionHoverColor: PropTypes.string,
|
|
24440
|
+
selectedOptionColor: PropTypes.string,
|
|
24410
24441
|
width: PropTypes.string,
|
|
24411
24442
|
disabled: PropTypes.bool,
|
|
24412
24443
|
error: PropTypes.bool,
|
|
@@ -24428,6 +24459,8 @@ QuickFilterDropdownSingle.defaultProps = {
|
|
|
24428
24459
|
label: "Label",
|
|
24429
24460
|
labelColor: "#066768",
|
|
24430
24461
|
hoverColor: "#066768",
|
|
24462
|
+
optionHoverColor: '#edf6ff',
|
|
24463
|
+
selectedOptionColor: "#C7E4FF",
|
|
24431
24464
|
width: "auto",
|
|
24432
24465
|
disabled: false,
|
|
24433
24466
|
error: false,
|
|
@@ -24612,7 +24645,7 @@ const OptionItem = styled.li`
|
|
|
24612
24645
|
transition: background-color 0.3s;
|
|
24613
24646
|
|
|
24614
24647
|
&:hover {
|
|
24615
|
-
background-color:
|
|
24648
|
+
background-color: ${props => props.optionHoverColor};
|
|
24616
24649
|
}
|
|
24617
24650
|
`;
|
|
24618
24651
|
const ErrorMessage$1 = styled.div`
|
|
@@ -24689,6 +24722,7 @@ const QuickFilterDropdownMultiSelection = _ref => {
|
|
|
24689
24722
|
error,
|
|
24690
24723
|
errorMessage,
|
|
24691
24724
|
labelColor,
|
|
24725
|
+
optionHoverColor = '#edf6ff',
|
|
24692
24726
|
xIconShow,
|
|
24693
24727
|
checkBoxColor,
|
|
24694
24728
|
showLabelOnTop,
|
|
@@ -24943,7 +24977,8 @@ const QuickFilterDropdownMultiSelection = _ref => {
|
|
|
24943
24977
|
className: "OptionItem",
|
|
24944
24978
|
key: option.value,
|
|
24945
24979
|
onClick: () => toggleOption(option),
|
|
24946
|
-
selected: isDropdowned(option)
|
|
24980
|
+
selected: isDropdowned(option),
|
|
24981
|
+
optionHoverColor: optionHoverColor
|
|
24947
24982
|
}, /*#__PURE__*/React$1.createElement(IconContainer$2, {
|
|
24948
24983
|
className: "IconContainer"
|
|
24949
24984
|
}, selectedOptions.find(itemSelectedOptions => option.value === itemSelectedOptions.value) ? /*#__PURE__*/React$1.createElement(CheckBoxCheckedIcon, {
|
|
@@ -25026,6 +25061,8 @@ const QuickFilter = _ref => {
|
|
|
25026
25061
|
label = "Unit Type:",
|
|
25027
25062
|
labelColor = "#066768",
|
|
25028
25063
|
placeHolder = "Select From List",
|
|
25064
|
+
optionHoverColor = '#edf6ff',
|
|
25065
|
+
selectedOptionColor = "#C7E4FF",
|
|
25029
25066
|
width = "auto",
|
|
25030
25067
|
height = "38px",
|
|
25031
25068
|
checkBoxColor = "#229E38",
|
|
@@ -25043,6 +25080,7 @@ const QuickFilter = _ref => {
|
|
|
25043
25080
|
label: label,
|
|
25044
25081
|
labelColor: labelColor,
|
|
25045
25082
|
checkBoxColor: checkBoxColor,
|
|
25083
|
+
optionHoverColor: optionHoverColor,
|
|
25046
25084
|
options: options,
|
|
25047
25085
|
width: width,
|
|
25048
25086
|
height: height,
|
|
@@ -25057,6 +25095,8 @@ const QuickFilter = _ref => {
|
|
|
25057
25095
|
placeHolder: placeHolder,
|
|
25058
25096
|
label: label,
|
|
25059
25097
|
labelColor: labelColor,
|
|
25098
|
+
optionHoverColor: optionHoverColor,
|
|
25099
|
+
selectedOptionColor: selectedOptionColor,
|
|
25060
25100
|
checkBoxColor: checkBoxColor,
|
|
25061
25101
|
options: options,
|
|
25062
25102
|
width: width,
|
|
@@ -35742,7 +35782,7 @@ const Label$3 = styled.label`
|
|
|
35742
35782
|
if (props.isFocused || props.hasValue) {
|
|
35743
35783
|
return '0px';
|
|
35744
35784
|
}
|
|
35745
|
-
return props.size === 'medium' ? '
|
|
35785
|
+
return props.size === 'medium' ? '50%' : '17px';
|
|
35746
35786
|
}};
|
|
35747
35787
|
left: ${props => {
|
|
35748
35788
|
if (props.multiline) {
|
|
@@ -37699,8 +37739,16 @@ const SearchInput = styled.input`
|
|
|
37699
37739
|
}
|
|
37700
37740
|
`;
|
|
37701
37741
|
const ListWrapper = styled.div`
|
|
37702
|
-
max-height: ${props =>
|
|
37703
|
-
|
|
37742
|
+
max-height: ${props => {
|
|
37743
|
+
const maxH = parseInt(props.maxHeight) || 400;
|
|
37744
|
+
const actualH = (props.actualHeight || maxH) + 16;
|
|
37745
|
+
return actualH < maxH ? `${actualH}px` : props.maxHeight;
|
|
37746
|
+
}};
|
|
37747
|
+
overflow-y: ${props => {
|
|
37748
|
+
const maxH = parseInt(props.maxHeight) || 400;
|
|
37749
|
+
const actualH = (props.actualHeight || maxH) + 16;
|
|
37750
|
+
return actualH < maxH ? 'hidden' : 'auto';
|
|
37751
|
+
}};
|
|
37704
37752
|
position: relative;
|
|
37705
37753
|
`;
|
|
37706
37754
|
const CheckboxGroup = styled.div`
|
|
@@ -37745,6 +37793,7 @@ const CheckboxLabel = styled.label`
|
|
|
37745
37793
|
color: #212121;
|
|
37746
37794
|
cursor: pointer;
|
|
37747
37795
|
flex-shrink: 0;
|
|
37796
|
+
box-sizing: border-box;
|
|
37748
37797
|
|
|
37749
37798
|
&:hover {
|
|
37750
37799
|
background-color: #E6F0F0;
|
|
@@ -37817,7 +37866,7 @@ const FilterPop = props => {
|
|
|
37817
37866
|
selectedAttributes: propSelectedAttributes = {},
|
|
37818
37867
|
showSearch = true,
|
|
37819
37868
|
searchPlaceholder = "Search...",
|
|
37820
|
-
itemHeight =
|
|
37869
|
+
itemHeight = 40,
|
|
37821
37870
|
overscan = 5,
|
|
37822
37871
|
hasActiveFilter = false // NEW: Indicates if this column has an active filter
|
|
37823
37872
|
} = props;
|
|
@@ -37906,16 +37955,18 @@ const FilterPop = props => {
|
|
|
37906
37955
|
offsetY
|
|
37907
37956
|
} = useMemo(() => {
|
|
37908
37957
|
const containerHeight = parseInt(maxHeight) || 400;
|
|
37909
|
-
const
|
|
37910
|
-
const
|
|
37958
|
+
const gap = 8;
|
|
37959
|
+
const itemWithGap = itemHeight + gap;
|
|
37960
|
+
const startIndex = Math.max(0, Math.floor(scrollTop / itemWithGap) - overscan);
|
|
37961
|
+
const endIndex = Math.min(sortedList.length, Math.ceil((scrollTop + containerHeight) / itemWithGap) + overscan);
|
|
37911
37962
|
const visible = sortedList.slice(startIndex, endIndex).map((item, idx) => ({
|
|
37912
37963
|
...item,
|
|
37913
37964
|
index: startIndex + idx
|
|
37914
37965
|
}));
|
|
37915
37966
|
return {
|
|
37916
37967
|
visibleItems: visible,
|
|
37917
|
-
totalHeight:
|
|
37918
|
-
offsetY: startIndex *
|
|
37968
|
+
totalHeight: sortedList.length * itemHeight + Math.max(0, sortedList.length - 1) * gap,
|
|
37969
|
+
offsetY: startIndex * itemWithGap
|
|
37919
37970
|
};
|
|
37920
37971
|
}, [sortedList, scrollTop, itemHeight, overscan, maxHeight]);
|
|
37921
37972
|
const areAllNonAllItemsSelected = function () {
|
|
@@ -38115,7 +38166,8 @@ const FilterPop = props => {
|
|
|
38115
38166
|
}), /*#__PURE__*/React$1.createElement(ListWrapper, {
|
|
38116
38167
|
ref: scrollContainerRef,
|
|
38117
38168
|
onScroll: handleScroll,
|
|
38118
|
-
maxHeight: maxHeight
|
|
38169
|
+
maxHeight: maxHeight,
|
|
38170
|
+
actualHeight: totalHeight
|
|
38119
38171
|
}, sortedList.length === 1 ? /*#__PURE__*/React$1.createElement(NoResultsMessage, null, "No items match your search") : /*#__PURE__*/React$1.createElement("div", {
|
|
38120
38172
|
style: {
|
|
38121
38173
|
height: `${totalHeight}px`,
|
|
@@ -40967,10 +41019,12 @@ const TableHeader = ({
|
|
|
40967
41019
|
const debouncedFilterState = useDebounce(filterState, debounceDelay);
|
|
40968
41020
|
const iconRefs = useRef({});
|
|
40969
41021
|
const popupRef = useRef(null);
|
|
41022
|
+
const prevResetKeyRef = useRef(resetFiltersKey);
|
|
40970
41023
|
|
|
40971
|
-
// Reset internal state when resetFiltersKey changes
|
|
41024
|
+
// Reset internal state when resetFiltersKey changes (not when columns change)
|
|
40972
41025
|
useEffect(() => {
|
|
40973
|
-
|
|
41026
|
+
// Only run reset when resetFiltersKey actually changed
|
|
41027
|
+
if (resetFiltersKey !== prevResetKeyRef.current && resetFiltersKey > 0) {
|
|
40974
41028
|
const resetSelections = {};
|
|
40975
41029
|
columns.forEach(column => {
|
|
40976
41030
|
if (column.filter && column.filterOptions) {
|
|
@@ -40992,6 +41046,7 @@ const TableHeader = ({
|
|
|
40992
41046
|
setVisibleFilterPopWrapper(null);
|
|
40993
41047
|
setVisibleSortPopWrapper(null);
|
|
40994
41048
|
}
|
|
41049
|
+
prevResetKeyRef.current = resetFiltersKey;
|
|
40995
41050
|
}, [resetFiltersKey, columns]);
|
|
40996
41051
|
|
|
40997
41052
|
// Track if we've already initialized from saved state
|