fis-component 0.0.96 → 0.0.98

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.
@@ -30,6 +30,7 @@ export interface MenuProps {
30
30
  removeSelectedText?: string;
31
31
  selectedGroupLabel?: string;
32
32
  maxHeight?: string | number;
33
+ onPopupScroll?: (e: React.UIEvent<HTMLElement>) => void;
33
34
  }
34
35
  export interface MenuState {
35
36
  search: string;
@@ -21,6 +21,7 @@ type BaseSelectProps<T extends string | number> = Partial<InputLabelProps> & Omi
21
21
  renderOption?: (option: SelectOption<T>) => React.ReactNode;
22
22
  portal?: boolean;
23
23
  maxHeight?: string | number;
24
+ onPopupScroll?: (e: React.UIEvent<HTMLElement>) => void;
24
25
  };
25
26
  export type SingleSelectProps<T extends string | number> = BaseSelectProps<T> & {
26
27
  multi?: false;
package/dist/esm/index.js CHANGED
@@ -67607,7 +67607,7 @@ const FISMenuSection = ({ label, withAction = false, actionText, actionLabel = f
67607
67607
  };
67608
67608
  FISMenuSection.displayName = "FISMenuSection";
67609
67609
 
67610
- const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, selectedValues = [], onChangeSelected, searchValue = "", onSearchChange, loading = false, noData = false, noResult = false, combobox, className, onClickMenu, loadingText = "Data loading...", noDataText = "No data", noResultText = "No result", removeSelectedText = "Remove selected", selectedGroupLabel = "Selected", maxHeight, }) => {
67610
+ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, selectedValues = [], onChangeSelected, searchValue = "", onSearchChange, loading = false, noData = false, noResult = false, combobox, className, onClickMenu, loadingText = "Data loading...", noDataText = "No data", noResultText = "No result", removeSelectedText = "Remove selected", selectedGroupLabel = "Selected", maxHeight, onPopupScroll, }) => {
67611
67611
  const [localSearch, setLocalSearch] = useState(searchValue);
67612
67612
  useEffect(() => {
67613
67613
  setLocalSearch(searchValue);
@@ -67688,7 +67688,7 @@ const FISMenuSelect = ({ placeholder, groups, size = "md", multi = false, select
67688
67688
  onClickMenu?.();
67689
67689
  }
67690
67690
  };
67691
- return (jsxs(DivContainerSC$4, { "$maxHeight": maxHeight, className: className, children: [showInput && !combobox && (jsx(DivSearchSC, { children: jsx(FISInputText, { iconPrefix: jsx(SearchIcon, {}), placeholder: placeholder, value: search, onChange: handleSearchChange }) })), (shouldShowNoResult || noResult) && (jsxs(DivLoaderSC, { children: [jsx(DivIconDataSC, { children: jsx(NoResultIcon, {}) }), jsx(PTitleSC$2, { children: noResultText })] })), noData && (jsxs(DivLoaderSC, { children: [jsx(DivIconDataSC, { children: jsx(NoDataIcon, {}) }), jsx(PTitleSC$2, { children: noDataText })] })), loading && (jsxs(DivLoaderSC, { children: [jsx(FISProgressCircular, { size: size, variant: "indeterminate" }), jsx(PTitleSC$2, { children: loadingText })] })), !shouldShowNoResult && !noData && !loading && (jsxs(Fragment, { children: [jsx(MenuContent, { "$removeSelectedGroup": !!removeSelectedGroup, children: groupsToRender.map((group, index) => (jsxs(DivWrapperSC$4, { children: [index !== 0 && jsx(FISMenuSection, { withDivider: true }), group?.groupLabel && (jsx(FISMenuSection, { label: group?.groupLabel })), group.items.map((item, idx) => (jsx(FISTooltip, { title: item.label, variant: "primary", children: jsx(FISMenuItem, { title: item.label, description: item.description, size: size, onClickMenu: () => handleItemClick(item), selected: selectedValues.includes(item.value), type: "select" }) }, idx)))] }, index))) }), removeSelectedGroup && (jsx(FixedBottomSection, { children: jsx(DivWrapperSC$4, { children: removeSelectedGroup.items.map((item, idx) => (jsx(FISTooltip, { title: item.label, variant: "primary", children: jsx(FISMenuItem, { title: item.label, description: item.description, size: size, onClickMenu: () => onChangeSelected?.([]), type: "select", iconPrefix: jsx(RemoveIcon, {}), negative: true }) }, idx))) }) }))] }))] }));
67691
+ return (jsxs(DivContainerSC$4, { "$maxHeight": maxHeight, className: className, onScroll: onPopupScroll, children: [showInput && !combobox && (jsx(DivSearchSC, { children: jsx(FISInputText, { iconPrefix: jsx(SearchIcon, {}), placeholder: placeholder, value: search, onChange: handleSearchChange }) })), (shouldShowNoResult || noResult) && (jsxs(DivLoaderSC, { children: [jsx(DivIconDataSC, { children: jsx(NoResultIcon, {}) }), jsx(PTitleSC$2, { children: noResultText })] })), noData && (jsxs(DivLoaderSC, { children: [jsx(DivIconDataSC, { children: jsx(NoDataIcon, {}) }), jsx(PTitleSC$2, { children: noDataText })] })), loading && (jsxs(DivLoaderSC, { children: [jsx(FISProgressCircular, { size: size, variant: "indeterminate" }), jsx(PTitleSC$2, { children: loadingText })] })), !shouldShowNoResult && !noData && !loading && (jsxs(Fragment, { children: [jsx(MenuContent, { "$removeSelectedGroup": !!removeSelectedGroup, children: groupsToRender.map((group, index) => (jsxs(DivWrapperSC$4, { children: [index !== 0 && jsx(FISMenuSection, { withDivider: true }), group?.groupLabel && (jsx(FISMenuSection, { label: group?.groupLabel })), group.items.map((item, idx) => (jsx(FISTooltip, { title: item.label, variant: "primary", children: jsx(FISMenuItem, { title: item.label, description: item.description, size: size, onClickMenu: () => handleItemClick(item), selected: selectedValues.includes(item.value), type: "select" }) }, idx)))] }, index))) }), removeSelectedGroup && (jsx(FixedBottomSection, { children: jsx(DivWrapperSC$4, { children: removeSelectedGroup.items.map((item, idx) => (jsx(FISTooltip, { title: item.label, variant: "primary", children: jsx(FISMenuItem, { title: item.label, description: item.description, size: size, onClickMenu: () => onChangeSelected?.([]), type: "select", iconPrefix: jsx(RemoveIcon, {}), negative: true }) }, idx))) }) }))] }))] }));
67692
67692
  };
67693
67693
  FISMenuSelect.displayName = "FISMenuSelect";
67694
67694
 
@@ -71306,6 +71306,12 @@ const FISInputDate = forwardRef((props, ref) => {
71306
71306
  return;
71307
71307
  const newInputValue = e.target.value;
71308
71308
  setInputValue(newInputValue);
71309
+ // Handle empty input - user wants to clear the date
71310
+ if (newInputValue === "") {
71311
+ setDateValue(null);
71312
+ onChange?.(null);
71313
+ return;
71314
+ }
71309
71315
  // Try to parse the input as a date
71310
71316
  const parsedDate = dayjs(newInputValue, finalFormat);
71311
71317
  if (parsedDate.isValid()) {
@@ -71320,6 +71326,10 @@ const FISInputDate = forwardRef((props, ref) => {
71320
71326
  if (originalOnBlur) {
71321
71327
  originalOnBlur(e);
71322
71328
  }
71329
+ // Don't revert if input is empty (user intentionally cleared)
71330
+ if (inputValue === "") {
71331
+ return;
71332
+ }
71323
71333
  // On blur, if input format is invalid, revert to the current date value's formatted string
71324
71334
  const parsedDate = dayjs(inputValue, finalFormat);
71325
71335
  if (!parsedDate.isValid() && dateValue) {
@@ -73637,7 +73647,7 @@ function isMenuSize(value) {
73637
73647
  return value === "sm" || value === "md";
73638
73648
  }
73639
73649
 
73640
- const FISSelect = forwardRef(({ className, style, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholder, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, searchValue, onSearchChange, portal, maxHeight, ...restProps }, ref) => {
73650
+ const FISSelect = forwardRef(({ className, style, size = "md", options, value, disabled = false, textLabel = "", iconLabel, required, negative, message, positive, multi, placeholder, placeholderSearch, loading, onChange, renderOption, onClickIconLabel, displayValue, multiDisplayText, searchValue, onSearchChange, portal, maxHeight, onPopupScroll, ...restProps }, ref) => {
73641
73651
  const [isOpen, setIsOpen] = useState(false);
73642
73652
  const [referenceElement, setReferenceElement] = useState(null);
73643
73653
  const [popperElement, setPopperElement] = useState(null);
@@ -73741,6 +73751,7 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
73741
73751
  searchValue,
73742
73752
  onSearchChange,
73743
73753
  maxHeight,
73754
+ onPopupScroll,
73744
73755
  ...restProps,
73745
73756
  }), [
73746
73757
  options,
@@ -73754,6 +73765,7 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
73754
73765
  searchValue,
73755
73766
  onSearchChange,
73756
73767
  maxHeight,
73768
+ onPopupScroll,
73757
73769
  restProps,
73758
73770
  ]);
73759
73771
  useEffect(() => {