fis-component 0.0.91 → 0.0.92
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 +19 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +19 -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 [isSelecting, setIsSelecting] = useState(false);
|
|
73631
73632
|
const popperOptions = useMemo$1(() => ({
|
|
73632
73633
|
modifiers: [
|
|
73633
73634
|
{ name: "preventOverflow", options: { padding: 0, altAxis: true } },
|
|
@@ -73682,23 +73683,36 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73682
73683
|
}
|
|
73683
73684
|
}, [multi, onChange, value]);
|
|
73684
73685
|
const handleMenuChange = useCallback((values) => {
|
|
73686
|
+
setIsSelecting(true);
|
|
73685
73687
|
if (multi) {
|
|
73686
73688
|
onChange(values);
|
|
73689
|
+
setIsSelecting(false);
|
|
73687
73690
|
}
|
|
73688
73691
|
else {
|
|
73689
73692
|
if (values.length > 0) {
|
|
73690
73693
|
onChange(values[0]);
|
|
73691
|
-
|
|
73692
|
-
|
|
73694
|
+
setIsOpen(false);
|
|
73695
|
+
// Reset selecting flag after onChange completes
|
|
73696
|
+
setTimeout(() => setIsSelecting(false), 0);
|
|
73693
73697
|
}
|
|
73694
73698
|
}
|
|
73695
73699
|
}, [multi, onChange]);
|
|
73696
73700
|
const handleMenuClick = useCallback(() => {
|
|
73697
73701
|
if (!multi) {
|
|
73698
|
-
|
|
73699
|
-
setTimeout(() => setIsOpen(false), 0);
|
|
73702
|
+
setIsOpen(false);
|
|
73700
73703
|
}
|
|
73701
73704
|
}, [multi]);
|
|
73705
|
+
// Handle onBlur to prevent validation flash during selection
|
|
73706
|
+
const handleBlur = useCallback((event) => {
|
|
73707
|
+
// Don't trigger onBlur validation if user is currently selecting an option
|
|
73708
|
+
if (isSelecting) {
|
|
73709
|
+
return;
|
|
73710
|
+
}
|
|
73711
|
+
// Call original onBlur if provided
|
|
73712
|
+
if (restProps.onBlur) {
|
|
73713
|
+
restProps.onBlur(event);
|
|
73714
|
+
}
|
|
73715
|
+
}, [isSelecting, restProps]);
|
|
73702
73716
|
const menuProps = useMemo$1(() => ({
|
|
73703
73717
|
groups: options,
|
|
73704
73718
|
placeholder: placeholderSearch,
|
|
@@ -73747,7 +73761,7 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73747
73761
|
document.addEventListener("mousedown", handleClickOutside);
|
|
73748
73762
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
73749
73763
|
}, [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: {
|
|
73764
|
+
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
73765
|
...styles.popper,
|
|
73752
73766
|
width: referenceElement?.offsetWidth,
|
|
73753
73767
|
zIndex: 9999,
|