fis-component 0.0.67 → 0.0.69

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
@@ -61532,12 +61532,12 @@ function LevelingIcon(props) {
61532
61532
 
61533
61533
  function CaretIcon(props) {
61534
61534
  const { width = 16, height = 16, ...rest } = props;
61535
- return (jsxs("svg", { width: width, height: height, viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsx("g", { "clip-path": "url(#clip0_11094_8532)", children: jsx("path", { d: "M4.66699 6L8.66699 10L12.667 6", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_11094_8532", children: jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0.666992)" }) }) })] }));
61535
+ return (jsxs("svg", { width: width, height: height, viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsx("g", { clipPath: "url(#clip0_11094_8532)", children: jsx("path", { d: "M4.66699 6L8.66699 10L12.667 6", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_11094_8532", children: jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0.666992)" }) }) })] }));
61536
61536
  }
61537
61537
 
61538
61538
  function ExitIcon(props) {
61539
61539
  const { width = 16, height = 16, ...rest } = props;
61540
- return (jsxs("svg", { width: width, height: height, viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("g", { "clip-path": "url(#clip0_11161_972)", children: jsx("path", { d: "M12.6001 4L4.6001 12M4.6001 4L12.6001 12", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_11161_972", children: jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0.600098)" }) }) })] }));
61540
+ return (jsxs("svg", { width: width, height: height, viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("g", { clipPath: "url(#clip0_11161_972)", children: jsx("path", { d: "M12.6001 4L4.6001 12M4.6001 4L12.6001 12", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_11161_972", children: jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0.600098)" }) }) })] }));
61541
61541
  }
61542
61542
 
61543
61543
  function InfoIcon(props) {
@@ -61546,7 +61546,7 @@ function InfoIcon(props) {
61546
61546
 
61547
61547
  function CheckIcon(props) {
61548
61548
  const { width = 20, height = 20, ...rest } = props;
61549
- return (jsx("svg", { width: width, height: height, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: jsx("path", { d: "M16.6666 5L7.49992 14.1667L3.33325 10", stroke: "currentColor", "stroke-width": "1.3", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
61549
+ return (jsx("svg", { width: width, height: height, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: jsx("path", { d: "M16.6666 5L7.49992 14.1667L3.33325 10", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" }) }));
61550
61550
  }
61551
61551
 
61552
61552
  function WarningIcon(props) {
@@ -61566,7 +61566,7 @@ function PositiveIcon(props) {
61566
61566
 
61567
61567
  function ArrowDownIcon(props) {
61568
61568
  const { width = 16, height = 16, ...rest } = props;
61569
- return (jsxs("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsx("g", { "clip-path": "url(#clip0_11182_21084)", children: jsx("path", { d: "M4.66666 6L8.66666 10L12.6667 6", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_11182_21084", children: jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0.666656)" }) }) })] }));
61569
+ return (jsxs("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsx("g", { clipPath: "url(#clip0_11182_21084)", children: jsx("path", { d: "M4.66666 6L8.66666 10L12.6667 6", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_11182_21084", children: jsx("rect", { width: "16", height: "16", fill: "white", transform: "translate(0.666656)" }) }) })] }));
61570
61570
  }
61571
61571
 
61572
61572
  function ArrowUpIcon(props) {
@@ -61576,12 +61576,12 @@ function ArrowUpIcon(props) {
61576
61576
 
61577
61577
  function CloseChipIcon(props) {
61578
61578
  const { width = 20, height = 20, ...rest } = props;
61579
- return (jsxs("svg", { width: width, height: height, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsx("g", { "clip-path": "url(#clip0_10200_41079)", children: jsx("path", { d: "M15 5L5 15M5 5L15 15", stroke: "currentColor", "stroke-width": "1.3", "stroke-linecap": "round", "stroke-linejoin": "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_10200_41079", children: jsx("rect", { width: "20", height: "20", fill: "white" }) }) })] }));
61579
+ return (jsxs("svg", { width: width, height: height, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsx("g", { clipPath: "url(#clip0_10200_41079)", children: jsx("path", { d: "M15 5L5 15M5 5L15 15", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_10200_41079", children: jsx("rect", { width: "20", height: "20", fill: "white" }) }) })] }));
61580
61580
  }
61581
61581
 
61582
61582
  function TimeIcon(props) {
61583
61583
  const { width = 16, height = 16, ...rest } = props;
61584
- return (jsxs("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsx("g", { "clip-path": "url(#clip0_10132_275)", children: jsx("path", { d: "M8.00004 4.00004V8.00004L10.6667 9.33337M14.6667 8.00004C14.6667 11.6819 11.6819 14.6667 8.00004 14.6667C4.31814 14.6667 1.33337 11.6819 1.33337 8.00004C1.33337 4.31814 4.31814 1.33337 8.00004 1.33337C11.6819 1.33337 14.6667 4.31814 14.6667 8.00004Z", stroke: "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_10132_275", children: jsx("rect", { width: width, height: height, fill: "white" }) }) })] }));
61584
+ return (jsxs("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...rest, children: [jsx("g", { clipPath: "url(#clip0_10132_275)", children: jsx("path", { d: "M8.00004 4.00004V8.00004L10.6667 9.33337M14.6667 8.00004C14.6667 11.6819 11.6819 14.6667 8.00004 14.6667C4.31814 14.6667 1.33337 11.6819 1.33337 8.00004C1.33337 4.31814 4.31814 1.33337 8.00004 1.33337C11.6819 1.33337 14.6667 4.31814 14.6667 8.00004Z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_10132_275", children: jsx("rect", { width: width, height: height, fill: "white" }) }) })] }));
61585
61585
  }
61586
61586
 
61587
61587
  function DateIcon(props) {
@@ -70918,24 +70918,30 @@ 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);
70925
70925
  const containerRef = useRef(null);
70926
+ const timePickerRef = useRef(null);
70926
70927
  useEffect(() => {
70927
70928
  const handleClickOutside = (event) => {
70929
+ const target = event.target;
70928
70930
  if (containerRef.current &&
70929
- !containerRef.current.contains(event.target)) {
70931
+ !containerRef.current.contains(target) &&
70932
+ !document.querySelector(".ant-picker-dropdown")?.contains(target)) {
70930
70933
  setIsOpen(false);
70931
70934
  }
70932
70935
  };
70933
- document.addEventListener("mousedown", handleClickOutside);
70936
+ if (isOpen) {
70937
+ document.addEventListener("mousedown", handleClickOutside);
70938
+ }
70934
70939
  return () => {
70935
70940
  document.removeEventListener("mousedown", handleClickOutside);
70936
70941
  };
70937
- }, []);
70942
+ }, [isOpen]);
70938
70943
  const handleTimeChange = (time) => {
70944
+ onChange?.(time ? time.toDate() : null);
70939
70945
  setTimeValue(time);
70940
70946
  setInputValue(time ? time.format(format) : "");
70941
70947
  setIsOpen(false);
@@ -70945,21 +70951,28 @@ const FISInputTime = forwardRef((props, ref) => {
70945
70951
  setInputValue(newValue);
70946
70952
  const parsedTime = dayjs(newValue, format, true);
70947
70953
  if (parsedTime.isValid()) {
70954
+ onChange?.(parsedTime.toDate());
70948
70955
  setTimeValue(parsedTime);
70949
70956
  }
70950
70957
  else {
70958
+ onChange?.(null);
70951
70959
  setTimeValue(null);
70952
70960
  }
70953
70961
  };
70954
70962
  const handleClickInput = () => {
70955
- setIsOpen(true);
70963
+ if (!disabled) {
70964
+ setIsOpen(true);
70965
+ }
70956
70966
  };
70957
70967
  const handleOpenChange = (open) => {
70958
- if (open) {
70959
- setIsOpen(open);
70968
+ setIsOpen(open);
70969
+ };
70970
+ const handleKeyDown = (e) => {
70971
+ if (e.key === "Escape") {
70972
+ setIsOpen(false);
70960
70973
  }
70961
70974
  };
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({
70975
+ 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, disabled: disabled, value: inputValue, onChange: handleInputChange, onFocus: handleClickInput, onClickSuffix: handleClickInput, onKeyDown: handleKeyDown }), jsx(HiddenTimePickerSC, { ref: timePickerRef, format: format, value: timeValue, onChange: handleTimeChange, open: isOpen, onOpenChange: handleOpenChange, getPopupContainer: getPopupContainer, showNow: true, inputReadOnly: true })] }), message && (jsx(DivHintWrapperSC, { children: jsx(SpanHintSC, { className: classNames({
70963
70976
  disabled: disabled,
70964
70977
  negative: negative,
70965
70978
  positive: positive,