fis-component 0.0.91 → 0.0.93
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 +31 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +31 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -73628,6 +73628,7 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73628
73628
|
const [isOpen, setIsOpen] = useState(false);
|
|
73629
73629
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
73630
73630
|
const [popperElement, setPopperElement] = useState(null);
|
|
73631
|
+
const isSelectingRef = useRef(false);
|
|
73631
73632
|
const popperOptions = useMemo$1(() => ({
|
|
73632
73633
|
modifiers: [
|
|
73633
73634
|
{ name: "preventOverflow", options: { padding: 0, altAxis: true } },
|
|
@@ -73682,23 +73683,48 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73682
73683
|
}
|
|
73683
73684
|
}, [multi, onChange, value]);
|
|
73684
73685
|
const handleMenuChange = useCallback((values) => {
|
|
73686
|
+
console.log("Starting selection, blocking onBlur"); // Debug log
|
|
73687
|
+
isSelectingRef.current = true;
|
|
73685
73688
|
if (multi) {
|
|
73686
73689
|
onChange(values);
|
|
73690
|
+
isSelectingRef.current = false;
|
|
73687
73691
|
}
|
|
73688
73692
|
else {
|
|
73689
73693
|
if (values.length > 0) {
|
|
73690
73694
|
onChange(values[0]);
|
|
73691
|
-
|
|
73692
|
-
|
|
73695
|
+
setIsOpen(false);
|
|
73696
|
+
// Reset selecting flag after a longer delay to ensure validation completes
|
|
73697
|
+
setTimeout(() => {
|
|
73698
|
+
console.log("Selection complete, allowing onBlur"); // Debug log
|
|
73699
|
+
isSelectingRef.current = false;
|
|
73700
|
+
}, 100);
|
|
73693
73701
|
}
|
|
73694
73702
|
}
|
|
73695
73703
|
}, [multi, onChange]);
|
|
73696
73704
|
const handleMenuClick = useCallback(() => {
|
|
73697
73705
|
if (!multi) {
|
|
73698
|
-
|
|
73699
|
-
|
|
73706
|
+
console.log("Menu click, setting isSelecting to true"); // Debug log
|
|
73707
|
+
isSelectingRef.current = true;
|
|
73708
|
+
setIsOpen(false);
|
|
73709
|
+
setTimeout(() => {
|
|
73710
|
+
console.log("Menu click complete, allowing onBlur"); // Debug log
|
|
73711
|
+
isSelectingRef.current = false;
|
|
73712
|
+
}, 100);
|
|
73700
73713
|
}
|
|
73701
73714
|
}, [multi]);
|
|
73715
|
+
// Handle onBlur to prevent validation flash during selection
|
|
73716
|
+
const handleBlur = useCallback((event) => {
|
|
73717
|
+
// Don't trigger onBlur validation if user is currently selecting an option
|
|
73718
|
+
if (isSelectingRef.current) {
|
|
73719
|
+
console.log("Blocking onBlur during selection"); // Debug log
|
|
73720
|
+
return;
|
|
73721
|
+
}
|
|
73722
|
+
console.log("Allowing onBlur to proceed"); // Debug log
|
|
73723
|
+
// Call original onBlur if provided
|
|
73724
|
+
if (restProps.onBlur) {
|
|
73725
|
+
restProps.onBlur(event);
|
|
73726
|
+
}
|
|
73727
|
+
}, [restProps]);
|
|
73702
73728
|
const menuProps = useMemo$1(() => ({
|
|
73703
73729
|
groups: options,
|
|
73704
73730
|
placeholder: placeholderSearch,
|
|
@@ -73747,7 +73773,7 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73747
73773
|
document.addEventListener("mousedown", handleClickOutside);
|
|
73748
73774
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
73749
73775
|
}, [isOpen, referenceElement, popperElement]);
|
|
73750
|
-
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, 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: {
|
|
73776
|
+
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: {
|
|
73751
73777
|
...styles.popper,
|
|
73752
73778
|
width: referenceElement?.offsetWidth,
|
|
73753
73779
|
zIndex: 9999,
|