fis-component 0.0.93 → 0.0.94
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/cjs/index.js +33 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +33 -17
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -73693,8 +73693,10 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73693
73693
|
}
|
|
73694
73694
|
}, [multi, value, multiDisplayText, selectedItems, displayValue]);
|
|
73695
73695
|
const handleToggle = React.useCallback(() => {
|
|
73696
|
-
if (!disabled)
|
|
73696
|
+
if (!disabled) {
|
|
73697
|
+
console.log("Toggle dropdown"); // Debug log
|
|
73697
73698
|
setIsOpen((prev) => !prev);
|
|
73699
|
+
}
|
|
73698
73700
|
}, [disabled]);
|
|
73699
73701
|
const handleOptionRemove = React.useCallback((option) => {
|
|
73700
73702
|
if (multi && Array.isArray(value)) {
|
|
@@ -73703,40 +73705,41 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73703
73705
|
}
|
|
73704
73706
|
}, [multi, onChange, value]);
|
|
73705
73707
|
const handleMenuChange = React.useCallback((values) => {
|
|
73706
|
-
console.log("Starting selection,
|
|
73707
|
-
isSelectingRef.current = true;
|
|
73708
|
+
console.log("Starting selection, keeping onBlur blocked"); // Debug log
|
|
73708
73709
|
if (multi) {
|
|
73709
73710
|
onChange(values);
|
|
73710
|
-
|
|
73711
|
+
// For multi-select, allow onBlur immediately since dropdown stays open
|
|
73712
|
+
setTimeout(() => {
|
|
73713
|
+
console.log("Multi-selection complete, allowing onBlur"); // Debug log
|
|
73714
|
+
isSelectingRef.current = false;
|
|
73715
|
+
}, 50);
|
|
73711
73716
|
}
|
|
73712
73717
|
else {
|
|
73713
73718
|
if (values.length > 0) {
|
|
73714
73719
|
onChange(values[0]);
|
|
73715
73720
|
setIsOpen(false);
|
|
73716
|
-
//
|
|
73721
|
+
// Keep blocking until value is processed
|
|
73717
73722
|
setTimeout(() => {
|
|
73718
|
-
console.log("
|
|
73723
|
+
console.log("Single selection complete, allowing onBlur"); // Debug log
|
|
73719
73724
|
isSelectingRef.current = false;
|
|
73720
|
-
},
|
|
73725
|
+
}, 150);
|
|
73721
73726
|
}
|
|
73722
73727
|
}
|
|
73723
73728
|
}, [multi, onChange]);
|
|
73724
73729
|
const handleMenuClick = React.useCallback(() => {
|
|
73725
73730
|
if (!multi) {
|
|
73726
|
-
console.log("Menu click
|
|
73727
|
-
isSelectingRef.current = true;
|
|
73731
|
+
console.log("Menu click - closing dropdown"); // Debug log
|
|
73728
73732
|
setIsOpen(false);
|
|
73729
|
-
setTimeout(() => {
|
|
73730
|
-
console.log("Menu click complete, allowing onBlur"); // Debug log
|
|
73731
|
-
isSelectingRef.current = false;
|
|
73732
|
-
}, 100);
|
|
73733
73733
|
}
|
|
73734
73734
|
}, [multi]);
|
|
73735
73735
|
// Handle onBlur to prevent validation flash during selection
|
|
73736
73736
|
const handleBlur = React.useCallback((event) => {
|
|
73737
|
-
//
|
|
73738
|
-
if (isSelectingRef.current) {
|
|
73739
|
-
console.log("Blocking onBlur
|
|
73737
|
+
// Block onBlur if dropdown is open OR we're in the middle of selection
|
|
73738
|
+
if (isOpen || isSelectingRef.current) {
|
|
73739
|
+
console.log("Blocking onBlur - dropdown open or selecting:", {
|
|
73740
|
+
isOpen,
|
|
73741
|
+
isSelecting: isSelectingRef.current,
|
|
73742
|
+
}); // Debug log
|
|
73740
73743
|
return;
|
|
73741
73744
|
}
|
|
73742
73745
|
console.log("Allowing onBlur to proceed"); // Debug log
|
|
@@ -73744,7 +73747,7 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73744
73747
|
if (restProps.onBlur) {
|
|
73745
73748
|
restProps.onBlur(event);
|
|
73746
73749
|
}
|
|
73747
|
-
}, [restProps]);
|
|
73750
|
+
}, [isOpen, restProps]);
|
|
73748
73751
|
const menuProps = React.useMemo(() => ({
|
|
73749
73752
|
groups: options,
|
|
73750
73753
|
placeholder: placeholderSearch,
|
|
@@ -73787,12 +73790,25 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73787
73790
|
!referenceElement.contains(target) &&
|
|
73788
73791
|
popperElement &&
|
|
73789
73792
|
!popperElement.contains(target)) {
|
|
73793
|
+
console.log("Click outside - closing dropdown"); // Debug log
|
|
73790
73794
|
setIsOpen(false);
|
|
73791
73795
|
}
|
|
73792
73796
|
};
|
|
73793
73797
|
document.addEventListener("mousedown", handleClickOutside);
|
|
73794
73798
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
73795
73799
|
}, [isOpen, referenceElement, popperElement]);
|
|
73800
|
+
// Add delay after dropdown closes to ensure validation processes
|
|
73801
|
+
React.useEffect(() => {
|
|
73802
|
+
if (!isOpen && !multi) {
|
|
73803
|
+
// When dropdown closes, give time for value to be processed before allowing onBlur
|
|
73804
|
+
isSelectingRef.current = true;
|
|
73805
|
+
const timer = setTimeout(() => {
|
|
73806
|
+
console.log("Dropdown closed delay complete, allowing onBlur"); // Debug log
|
|
73807
|
+
isSelectingRef.current = false;
|
|
73808
|
+
}, 200);
|
|
73809
|
+
return () => clearTimeout(timer);
|
|
73810
|
+
}
|
|
73811
|
+
}, [isOpen, multi]);
|
|
73796
73812
|
return (jsxRuntime.jsxs(DivWrapperSC$1, { className: className, style: style, children: [(textLabel || iconLabel) && (jsxRuntime.jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxRuntime.jsx(DivInputWrapperSC, { ref: setReferenceElement, onClick: handleToggle, "$hasValue": !!value, children: jsxRuntime.jsx(FISSelectItem, { ...restProps, onBlur: handleBlur, ref: ref, size: size, placeholder: placeholder, iconSuffix: isOpen ? jsxRuntime.jsx(ArrowUpIcon, {}) : jsxRuntime.jsx(ArrowDownIcon, {}), value: computedDisplayValue, disabled: disabled, activeDropdown: isOpen, negative: negative }) }), message && (jsxRuntime.jsx(SpanHintSC$3, { className: classNames({ disabled, negative, positive }), children: message })), multi && Array.isArray(value) && value.length > 0 && (jsxRuntime.jsx(SelectedTagsWrapper, { children: jsxRuntime.jsx(MultipleValue, { options: selectedItems, onRemove: handleOptionRemove }) })), isOpen && (jsxRuntime.jsx(Portal, { portal: portal, children: jsxRuntime.jsx(DivDropdownMenuSC, { ref: setPopperElement, style: {
|
|
73797
73813
|
...styles.popper,
|
|
73798
73814
|
width: referenceElement?.offsetWidth,
|