fis-component 0.0.93 → 0.0.95
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 +16 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +16 -20
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -73693,8 +73693,9 @@ 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
73697
|
setIsOpen((prev) => !prev);
|
|
73698
|
+
}
|
|
73698
73699
|
}, [disabled]);
|
|
73699
73700
|
const handleOptionRemove = React.useCallback((option) => {
|
|
73700
73701
|
if (multi && Array.isArray(value)) {
|
|
@@ -73703,48 +73704,32 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73703
73704
|
}
|
|
73704
73705
|
}, [multi, onChange, value]);
|
|
73705
73706
|
const handleMenuChange = React.useCallback((values) => {
|
|
73706
|
-
console.log("Starting selection, blocking onBlur"); // Debug log
|
|
73707
|
-
isSelectingRef.current = true;
|
|
73708
73707
|
if (multi) {
|
|
73709
73708
|
onChange(values);
|
|
73710
|
-
isSelectingRef.current = false;
|
|
73711
73709
|
}
|
|
73712
73710
|
else {
|
|
73713
73711
|
if (values.length > 0) {
|
|
73714
73712
|
onChange(values[0]);
|
|
73715
73713
|
setIsOpen(false);
|
|
73716
|
-
// Reset selecting flag after a longer delay to ensure validation completes
|
|
73717
|
-
setTimeout(() => {
|
|
73718
|
-
console.log("Selection complete, allowing onBlur"); // Debug log
|
|
73719
|
-
isSelectingRef.current = false;
|
|
73720
|
-
}, 100);
|
|
73721
73714
|
}
|
|
73722
73715
|
}
|
|
73723
73716
|
}, [multi, onChange]);
|
|
73724
73717
|
const handleMenuClick = React.useCallback(() => {
|
|
73725
73718
|
if (!multi) {
|
|
73726
|
-
console.log("Menu click, setting isSelecting to true"); // Debug log
|
|
73727
|
-
isSelectingRef.current = true;
|
|
73728
73719
|
setIsOpen(false);
|
|
73729
|
-
setTimeout(() => {
|
|
73730
|
-
console.log("Menu click complete, allowing onBlur"); // Debug log
|
|
73731
|
-
isSelectingRef.current = false;
|
|
73732
|
-
}, 100);
|
|
73733
73720
|
}
|
|
73734
73721
|
}, [multi]);
|
|
73735
73722
|
// Handle onBlur to prevent validation flash during selection
|
|
73736
73723
|
const handleBlur = React.useCallback((event) => {
|
|
73737
|
-
//
|
|
73738
|
-
if (isSelectingRef.current) {
|
|
73739
|
-
console.log("Blocking onBlur during selection"); // Debug log
|
|
73724
|
+
// Block onBlur if dropdown is open OR we're in the middle of selection
|
|
73725
|
+
if (isOpen || isSelectingRef.current) {
|
|
73740
73726
|
return;
|
|
73741
73727
|
}
|
|
73742
|
-
console.log("Allowing onBlur to proceed"); // Debug log
|
|
73743
73728
|
// Call original onBlur if provided
|
|
73744
73729
|
if (restProps.onBlur) {
|
|
73745
73730
|
restProps.onBlur(event);
|
|
73746
73731
|
}
|
|
73747
|
-
}, [restProps]);
|
|
73732
|
+
}, [isOpen, restProps]);
|
|
73748
73733
|
const menuProps = React.useMemo(() => ({
|
|
73749
73734
|
groups: options,
|
|
73750
73735
|
placeholder: placeholderSearch,
|
|
@@ -73793,6 +73778,17 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73793
73778
|
document.addEventListener("mousedown", handleClickOutside);
|
|
73794
73779
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
73795
73780
|
}, [isOpen, referenceElement, popperElement]);
|
|
73781
|
+
// Add delay after dropdown closes to ensure validation processes
|
|
73782
|
+
React.useEffect(() => {
|
|
73783
|
+
if (!isOpen && !multi) {
|
|
73784
|
+
// When dropdown closes, give time for value to be processed before allowing onBlur
|
|
73785
|
+
isSelectingRef.current = true;
|
|
73786
|
+
const timer = setTimeout(() => {
|
|
73787
|
+
isSelectingRef.current = false;
|
|
73788
|
+
}, 200);
|
|
73789
|
+
return () => clearTimeout(timer);
|
|
73790
|
+
}
|
|
73791
|
+
}, [isOpen, multi]);
|
|
73796
73792
|
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
73793
|
...styles.popper,
|
|
73798
73794
|
width: referenceElement?.offsetWidth,
|