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/esm/index.js
CHANGED
|
@@ -73673,8 +73673,10 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73673
73673
|
}
|
|
73674
73674
|
}, [multi, value, multiDisplayText, selectedItems, displayValue]);
|
|
73675
73675
|
const handleToggle = useCallback(() => {
|
|
73676
|
-
if (!disabled)
|
|
73676
|
+
if (!disabled) {
|
|
73677
|
+
console.log("Toggle dropdown"); // Debug log
|
|
73677
73678
|
setIsOpen((prev) => !prev);
|
|
73679
|
+
}
|
|
73678
73680
|
}, [disabled]);
|
|
73679
73681
|
const handleOptionRemove = useCallback((option) => {
|
|
73680
73682
|
if (multi && Array.isArray(value)) {
|
|
@@ -73683,40 +73685,41 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73683
73685
|
}
|
|
73684
73686
|
}, [multi, onChange, value]);
|
|
73685
73687
|
const handleMenuChange = useCallback((values) => {
|
|
73686
|
-
console.log("Starting selection,
|
|
73687
|
-
isSelectingRef.current = true;
|
|
73688
|
+
console.log("Starting selection, keeping onBlur blocked"); // Debug log
|
|
73688
73689
|
if (multi) {
|
|
73689
73690
|
onChange(values);
|
|
73690
|
-
|
|
73691
|
+
// For multi-select, allow onBlur immediately since dropdown stays open
|
|
73692
|
+
setTimeout(() => {
|
|
73693
|
+
console.log("Multi-selection complete, allowing onBlur"); // Debug log
|
|
73694
|
+
isSelectingRef.current = false;
|
|
73695
|
+
}, 50);
|
|
73691
73696
|
}
|
|
73692
73697
|
else {
|
|
73693
73698
|
if (values.length > 0) {
|
|
73694
73699
|
onChange(values[0]);
|
|
73695
73700
|
setIsOpen(false);
|
|
73696
|
-
//
|
|
73701
|
+
// Keep blocking until value is processed
|
|
73697
73702
|
setTimeout(() => {
|
|
73698
|
-
console.log("
|
|
73703
|
+
console.log("Single selection complete, allowing onBlur"); // Debug log
|
|
73699
73704
|
isSelectingRef.current = false;
|
|
73700
|
-
},
|
|
73705
|
+
}, 150);
|
|
73701
73706
|
}
|
|
73702
73707
|
}
|
|
73703
73708
|
}, [multi, onChange]);
|
|
73704
73709
|
const handleMenuClick = useCallback(() => {
|
|
73705
73710
|
if (!multi) {
|
|
73706
|
-
console.log("Menu click
|
|
73707
|
-
isSelectingRef.current = true;
|
|
73711
|
+
console.log("Menu click - closing dropdown"); // Debug log
|
|
73708
73712
|
setIsOpen(false);
|
|
73709
|
-
setTimeout(() => {
|
|
73710
|
-
console.log("Menu click complete, allowing onBlur"); // Debug log
|
|
73711
|
-
isSelectingRef.current = false;
|
|
73712
|
-
}, 100);
|
|
73713
73713
|
}
|
|
73714
73714
|
}, [multi]);
|
|
73715
73715
|
// Handle onBlur to prevent validation flash during selection
|
|
73716
73716
|
const handleBlur = useCallback((event) => {
|
|
73717
|
-
//
|
|
73718
|
-
if (isSelectingRef.current) {
|
|
73719
|
-
console.log("Blocking onBlur
|
|
73717
|
+
// Block onBlur if dropdown is open OR we're in the middle of selection
|
|
73718
|
+
if (isOpen || isSelectingRef.current) {
|
|
73719
|
+
console.log("Blocking onBlur - dropdown open or selecting:", {
|
|
73720
|
+
isOpen,
|
|
73721
|
+
isSelecting: isSelectingRef.current,
|
|
73722
|
+
}); // Debug log
|
|
73720
73723
|
return;
|
|
73721
73724
|
}
|
|
73722
73725
|
console.log("Allowing onBlur to proceed"); // Debug log
|
|
@@ -73724,7 +73727,7 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73724
73727
|
if (restProps.onBlur) {
|
|
73725
73728
|
restProps.onBlur(event);
|
|
73726
73729
|
}
|
|
73727
|
-
}, [restProps]);
|
|
73730
|
+
}, [isOpen, restProps]);
|
|
73728
73731
|
const menuProps = useMemo$1(() => ({
|
|
73729
73732
|
groups: options,
|
|
73730
73733
|
placeholder: placeholderSearch,
|
|
@@ -73767,12 +73770,25 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73767
73770
|
!referenceElement.contains(target) &&
|
|
73768
73771
|
popperElement &&
|
|
73769
73772
|
!popperElement.contains(target)) {
|
|
73773
|
+
console.log("Click outside - closing dropdown"); // Debug log
|
|
73770
73774
|
setIsOpen(false);
|
|
73771
73775
|
}
|
|
73772
73776
|
};
|
|
73773
73777
|
document.addEventListener("mousedown", handleClickOutside);
|
|
73774
73778
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
73775
73779
|
}, [isOpen, referenceElement, popperElement]);
|
|
73780
|
+
// Add delay after dropdown closes to ensure validation processes
|
|
73781
|
+
useEffect(() => {
|
|
73782
|
+
if (!isOpen && !multi) {
|
|
73783
|
+
// When dropdown closes, give time for value to be processed before allowing onBlur
|
|
73784
|
+
isSelectingRef.current = true;
|
|
73785
|
+
const timer = setTimeout(() => {
|
|
73786
|
+
console.log("Dropdown closed delay complete, allowing onBlur"); // Debug log
|
|
73787
|
+
isSelectingRef.current = false;
|
|
73788
|
+
}, 200);
|
|
73789
|
+
return () => clearTimeout(timer);
|
|
73790
|
+
}
|
|
73791
|
+
}, [isOpen, multi]);
|
|
73776
73792
|
return (jsxs(DivWrapperSC$1, { className: className, style: style, children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsx(DivInputWrapperSC, { ref: setReferenceElement, onClick: handleToggle, "$hasValue": !!value, children: jsx(FISSelectItem, { ...restProps, onBlur: handleBlur, ref: ref, size: size, placeholder: placeholder, iconSuffix: isOpen ? jsx(ArrowUpIcon, {}) : jsx(ArrowDownIcon, {}), value: computedDisplayValue, disabled: disabled, activeDropdown: isOpen, negative: negative }) }), message && (jsx(SpanHintSC$3, { className: classNames({ disabled, negative, positive }), children: message })), multi && Array.isArray(value) && value.length > 0 && (jsx(SelectedTagsWrapper, { children: jsx(MultipleValue, { options: selectedItems, onRemove: handleOptionRemove }) })), isOpen && (jsx(Portal, { portal: portal, children: jsx(DivDropdownMenuSC, { ref: setPopperElement, style: {
|
|
73777
73793
|
...styles.popper,
|
|
73778
73794
|
width: referenceElement?.offsetWidth,
|