fis-component 0.0.67 → 0.0.68

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,10 +1,12 @@
1
1
  import React from "react";
2
2
  import { InputFieldProps } from "../InputField";
3
3
  import { InputLabelProps } from "../InputLabel";
4
- export interface InputTimeProps extends InputFieldProps, Partial<InputLabelProps> {
4
+ export interface InputTimeProps extends Omit<InputFieldProps, "onChange">, Partial<InputLabelProps> {
5
5
  message?: string;
6
6
  positive?: boolean;
7
7
  format?: string;
8
+ onChange?: (date: Date | null) => void;
9
+ getPopupContainer?: () => HTMLElement;
8
10
  }
9
11
  declare const FISInputTime: React.ForwardRefExoticComponent<InputTimeProps & React.RefAttributes<HTMLInputElement>>;
10
12
  export default FISInputTime;
package/dist/esm/index.js CHANGED
@@ -70918,7 +70918,7 @@ const DivInputTimeSC = styled.div `
70918
70918
  `;
70919
70919
 
70920
70920
  const FISInputTime = forwardRef((props, ref) => {
70921
- const { className, textLabel = "", iconLabel, required, message, negative, positive, format = "HH:mm:ss", disabled, onClickIconLabel, ...rest } = props;
70921
+ const { className, textLabel = "", iconLabel, required, message, negative, positive, format = "HH:mm:ss", disabled, onChange, onClickIconLabel, getPopupContainer, ...rest } = props;
70922
70922
  const [inputValue, setInputValue] = useState("");
70923
70923
  const [timeValue, setTimeValue] = useState(null);
70924
70924
  const [isOpen, setIsOpen] = useState(false);
@@ -70936,6 +70936,7 @@ const FISInputTime = forwardRef((props, ref) => {
70936
70936
  };
70937
70937
  }, []);
70938
70938
  const handleTimeChange = (time) => {
70939
+ onChange?.(time ? time.toDate() : null);
70939
70940
  setTimeValue(time);
70940
70941
  setInputValue(time ? time.format(format) : "");
70941
70942
  setIsOpen(false);
@@ -70945,9 +70946,11 @@ const FISInputTime = forwardRef((props, ref) => {
70945
70946
  setInputValue(newValue);
70946
70947
  const parsedTime = dayjs(newValue, format, true);
70947
70948
  if (parsedTime.isValid()) {
70949
+ onChange?.(parsedTime.toDate());
70948
70950
  setTimeValue(parsedTime);
70949
70951
  }
70950
70952
  else {
70953
+ onChange?.(null);
70951
70954
  setTimeValue(null);
70952
70955
  }
70953
70956
  };
@@ -70959,7 +70962,7 @@ const FISInputTime = forwardRef((props, ref) => {
70959
70962
  setIsOpen(open);
70960
70963
  }
70961
70964
  };
70962
- return (jsxs(DivContainerSC$2, { className: className, ref: containerRef, children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxs(DivInputTimeSC, { children: [jsx(FISInputField, { ...rest, ref: ref, typeSuffix: "icon", iconSuffix: jsx(TimeIcon, {}), negative: negative, value: inputValue, onChange: handleInputChange, onFocus: handleClickInput, onClickSuffix: handleClickInput }), jsx(HiddenTimePickerSC, { format: format, value: timeValue, onChange: handleTimeChange, open: isOpen, onOpenChange: handleOpenChange, getPopupContainer: (triggerNode) => triggerNode.parentElement || document.body })] }), message && (jsx(DivHintWrapperSC, { children: jsx(SpanHintSC, { className: classNames({
70965
+ return (jsxs(DivContainerSC$2, { className: className, ref: containerRef, children: [(textLabel || iconLabel) && (jsx(FISInputLabel, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxs(DivInputTimeSC, { children: [jsx(FISInputField, { ...rest, ref: ref, typeSuffix: "icon", iconSuffix: jsx(TimeIcon, {}), negative: negative, value: inputValue, onChange: handleInputChange, onFocus: handleClickInput, onClickSuffix: handleClickInput }), jsx(HiddenTimePickerSC, { format: format, value: timeValue, onChange: handleTimeChange, open: isOpen, onOpenChange: handleOpenChange, getPopupContainer: getPopupContainer })] }), message && (jsx(DivHintWrapperSC, { children: jsx(SpanHintSC, { className: classNames({
70963
70966
  disabled: disabled,
70964
70967
  negative: negative,
70965
70968
  positive: positive,