fis-component 0.0.58 → 0.0.60

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.
@@ -1,4 +1,5 @@
1
1
  import { InputFieldProps } from "../InputField";
2
+ import dayjs from "dayjs";
2
3
  import { InputLabelProps } from "../InputLabel";
3
4
  export interface InputDateProps extends Omit<InputFieldProps, "value" | "onChange">, Partial<InputLabelProps> {
4
5
  /**Date value*/
@@ -11,6 +12,15 @@ export interface InputDateProps extends Omit<InputFieldProps, "value" | "onChang
11
12
  positive?: boolean;
12
13
  /** Handle on change action */
13
14
  onChange?: (date: Date | null) => void;
15
+ /**
16
+ * Function that returns the HTML element to render the popup container into.
17
+ * Useful for controlling where the date picker dropdown is attached in the DOM.
18
+ */
19
+ getPopupContainer?: () => HTMLElement;
20
+ /**The minimum selectable date. Dates before this value will be disabled.*/
21
+ minDate?: dayjs.Dayjs | undefined;
22
+ /**The maximum selectable date. Dates after this value will be disabled.*/
23
+ maxDate?: dayjs.Dayjs | undefined;
14
24
  }
15
25
  declare const FISInputDate: import("react").ForwardRefExoticComponent<InputDateProps & import("react").RefAttributes<HTMLInputElement>>;
16
26
  export default FISInputDate;
package/dist/esm/index.js CHANGED
@@ -62950,6 +62950,7 @@ const FISTab = ({ children, active: propActive, defaultActive, size = "md", clas
62950
62950
  return (jsxs(DivTabItemSC, { ref: (el) => (tabRefs.current[value] = el), "$isActive": activeKey === value, "$disabled": disabled, "$size": size, className: itemClassName, "$fullWidth": fullWidth, onClick: () => handleTabClick(value, disabled), children: [startIcon, title && jsx(SpanContentSC$1, { children: title }), endIcon] }, value));
62951
62951
  }), jsx(DivActiveIndicatorSC, { style: indicatorStyle })] }), activeContent && jsx("div", { className: contentClassName, children: activeContent })] }));
62952
62952
  };
62953
+ FISTab.displayName = "FISTab";
62953
62954
 
62954
62955
  const DivSegmentedContainerSC = styled.div `
62955
62956
  width: 100%;
@@ -71000,7 +71001,7 @@ function mergeRefs(...refs) {
71000
71001
  }
71001
71002
 
71002
71003
  const FISInputDate = forwardRef((props, ref) => {
71003
- const { value, textLabel = "", iconLabel, required, message = "", disabled, negative, positive, format = "DD/MM/YYYY", onClickIconLabel, onChange, ...restProps } = props;
71004
+ const { value, textLabel = "", iconLabel, required, message = "", disabled, negative, positive, format = "DD/MM/YYYY", onClickIconLabel, onChange, getPopupContainer, minDate, maxDate, ...restProps } = props;
71004
71005
  const [open, setOpen] = useState(false);
71005
71006
  const [inputValue, setInputValue] = useState(value ? dayjs(value).format(format) : "");
71006
71007
  const [dateValue, setDateValue] = useState(value ? dayjs(value) : null);
@@ -71043,7 +71044,7 @@ const FISInputDate = forwardRef((props, ref) => {
71043
71044
  onChange?.(null);
71044
71045
  }
71045
71046
  };
71046
- return (jsxs(DivWrapperSC$2, { children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxs(DivInputWrapperSC$1, { children: [jsx(FISInputField, { ...restProps, ref: mergeRef, typeSuffix: "icon", iconSuffix: jsx(DateIcon, {}), value: inputValue, negative: negative, disabled: disabled, onFocus: () => setOpen(true), onChange: handleInputChange, onClickSuffix: () => setOpen(true) }), jsx(HiddenDatePickerSC, { open: open, value: dateValue, onChange: (value) => handleChange(value), onOpenChange: handleOpenChange, format: format })] }), message && (jsx(DivHintWrapperSC$1, { children: jsx(SpanHintSC$3, { className: classNames({
71047
+ return (jsxs(DivWrapperSC$2, { children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxs(DivInputWrapperSC$1, { children: [jsx(FISInputField, { ...restProps, ref: mergeRef, typeSuffix: "icon", iconSuffix: jsx(DateIcon, {}), value: inputValue, negative: negative, disabled: disabled, onFocus: () => setOpen(true), onChange: handleInputChange, onClickSuffix: () => setOpen(true) }), jsx(HiddenDatePickerSC, { open: open, value: dateValue, onChange: (value) => handleChange(value), onOpenChange: handleOpenChange, format: format, getPopupContainer: getPopupContainer, minDate: minDate, maxDate: maxDate })] }), message && (jsx(DivHintWrapperSC$1, { children: jsx(SpanHintSC$3, { className: classNames({
71047
71048
  disabled,
71048
71049
  negative,
71049
71050
  positive,
@@ -73358,9 +73359,12 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
73358
73359
  return found ? [found] : [];
73359
73360
  }
73360
73361
  }, [value, multi]);
73361
- const computedDisplayValue = useMemo$1(() => {
73362
+ const computedDisplayValue = () => {
73362
73363
  if (multi) {
73363
73364
  const count = value.length;
73365
+ if (count === 0) {
73366
+ return "";
73367
+ }
73364
73368
  return multiDisplayText
73365
73369
  ? multiDisplayText(count)
73366
73370
  : `Selected ${count.toString().padStart(2, "0")} option${count !== 1 ? "s" : ""}`;
@@ -73370,7 +73374,7 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
73370
73374
  return "";
73371
73375
  return (displayValue?.(selectedItems[0]) || selectedItems[0].label);
73372
73376
  }
73373
- }, [value, multi, displayValue, multiDisplayText, selectedItems, options]);
73377
+ };
73374
73378
  const handleToggle = useCallback(() => {
73375
73379
  if (!disabled)
73376
73380
  setIsOpen((prev) => !prev);