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 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 [isSelecting, setIsSelecting] = React.useState(false);
73651
73652
  const popperOptions = React.useMemo(() => ({
73652
73653
  modifiers: [
73653
73654
  { name: "preventOverflow", options: { padding: 0, altAxis: true } },
@@ -73702,23 +73703,36 @@ 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
+ setIsSelecting(true);
73705
73707
  if (multi) {
73706
73708
  onChange(values);
73709
+ setIsSelecting(false);
73707
73710
  }
73708
73711
  else {
73709
73712
  if (values.length > 0) {
73710
73713
  onChange(values[0]);
73711
- // Delay closing to ensure react-hook-form processes the change first
73712
- setTimeout(() => setIsOpen(false), 0);
73714
+ setIsOpen(false);
73715
+ // Reset selecting flag after onChange completes
73716
+ setTimeout(() => setIsSelecting(false), 0);
73713
73717
  }
73714
73718
  }
73715
73719
  }, [multi, onChange]);
73716
73720
  const handleMenuClick = React.useCallback(() => {
73717
73721
  if (!multi) {
73718
- // Delay closing to ensure react-hook-form processes the change first
73719
- setTimeout(() => setIsOpen(false), 0);
73722
+ setIsOpen(false);
73720
73723
  }
73721
73724
  }, [multi]);
73725
+ // Handle onBlur to prevent validation flash during selection
73726
+ const handleBlur = React.useCallback((event) => {
73727
+ // Don't trigger onBlur validation if user is currently selecting an option
73728
+ if (isSelecting) {
73729
+ return;
73730
+ }
73731
+ // Call original onBlur if provided
73732
+ if (restProps.onBlur) {
73733
+ restProps.onBlur(event);
73734
+ }
73735
+ }, [isSelecting, restProps]);
73722
73736
  const menuProps = React.useMemo(() => ({
73723
73737
  groups: options,
73724
73738
  placeholder: placeholderSearch,
@@ -73767,7 +73781,7 @@ const FISSelect = React.forwardRef(({ className, style, size = "md", options, va
73767
73781
  document.addEventListener("mousedown", handleClickOutside);
73768
73782
  return () => document.removeEventListener("mousedown", handleClickOutside);
73769
73783
  }, [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: {
73784
+ 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
73785
  ...styles.popper,
73772
73786
  width: referenceElement?.offsetWidth,
73773
73787
  zIndex: 9999,