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/cjs/index.js
CHANGED
|
@@ -73648,6 +73648,7 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73648
73648
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
73649
73649
|
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
73650
73650
|
const [popperElement, setPopperElement] = React.useState(null);
|
|
73651
|
+
const isSelectingRef = React.useRef(false);
|
|
73651
73652
|
const popperOptions = React.useMemo(() => ({
|
|
73652
73653
|
modifiers: [
|
|
73653
73654
|
{ name: "preventOverflow", options: { padding: 0, altAxis: true } },
|
|
@@ -73702,23 +73703,48 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73702
73703
|
}
|
|
73703
73704
|
}, [multi, onChange, value]);
|
|
73704
73705
|
const handleMenuChange = React.useCallback((values) => {
|
|
73706
|
+
console.log("Starting selection, blocking onBlur"); // Debug log
|
|
73707
|
+
isSelectingRef.current = true;
|
|
73705
73708
|
if (multi) {
|
|
73706
73709
|
onChange(values);
|
|
73710
|
+
isSelectingRef.current = false;
|
|
73707
73711
|
}
|
|
73708
73712
|
else {
|
|
73709
73713
|
if (values.length > 0) {
|
|
73710
73714
|
onChange(values[0]);
|
|
73711
|
-
|
|
73712
|
-
|
|
73715
|
+
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);
|
|
73713
73721
|
}
|
|
73714
73722
|
}
|
|
73715
73723
|
}, [multi, onChange]);
|
|
73716
73724
|
const handleMenuClick = React.useCallback(() => {
|
|
73717
73725
|
if (!multi) {
|
|
73718
|
-
|
|
73719
|
-
|
|
73726
|
+
console.log("Menu click, setting isSelecting to true"); // Debug log
|
|
73727
|
+
isSelectingRef.current = true;
|
|
73728
|
+
setIsOpen(false);
|
|
73729
|
+
setTimeout(() => {
|
|
73730
|
+
console.log("Menu click complete, allowing onBlur"); // Debug log
|
|
73731
|
+
isSelectingRef.current = false;
|
|
73732
|
+
}, 100);
|
|
73720
73733
|
}
|
|
73721
73734
|
}, [multi]);
|
|
73735
|
+
// Handle onBlur to prevent validation flash during selection
|
|
73736
|
+
const handleBlur = React.useCallback((event) => {
|
|
73737
|
+
// Don't trigger onBlur validation if user is currently selecting an option
|
|
73738
|
+
if (isSelectingRef.current) {
|
|
73739
|
+
console.log("Blocking onBlur during selection"); // Debug log
|
|
73740
|
+
return;
|
|
73741
|
+
}
|
|
73742
|
+
console.log("Allowing onBlur to proceed"); // Debug log
|
|
73743
|
+
// Call original onBlur if provided
|
|
73744
|
+
if (restProps.onBlur) {
|
|
73745
|
+
restProps.onBlur(event);
|
|
73746
|
+
}
|
|
73747
|
+
}, [restProps]);
|
|
73722
73748
|
const menuProps = React.useMemo(() => ({
|
|
73723
73749
|
groups: options,
|
|
73724
73750
|
placeholder: placeholderSearch,
|
|
@@ -73767,7 +73793,7 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
|
|
|
73767
73793
|
document.addEventListener("mousedown", handleClickOutside);
|
|
73768
73794
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
73769
73795
|
}, [isOpen, referenceElement, popperElement]);
|
|
73770
|
-
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, 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: {
|
|
73796
|
+
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: {
|
|
73771
73797
|
...styles.popper,
|
|
73772
73798
|
width: referenceElement?.offsetWidth,
|
|
73773
73799
|
zIndex: 9999,
|