fis-component 0.2.3 → 0.2.5

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/esm/index.js CHANGED
@@ -64413,7 +64413,7 @@ const DivContainer$2 = styled.div `
64413
64413
  ${getTheme("com/badge/default/color-stroke/neutral")};
64414
64414
 
64415
64415
  &.solid {
64416
- border: ${getTheme("sem/dimension/stroke-width/border/md")} solid ${getTheme("com/badge/solid/background-color/neutral")};
64416
+ border: ${getTheme("com/badge/stroke-width")} solid transparent;
64417
64417
  }
64418
64418
 
64419
64419
  &.ghost {
@@ -64773,8 +64773,7 @@ const DivContainer$2 = styled.div `
64773
64773
 
64774
64774
  &.solid {
64775
64775
  background-color: ${getTheme("com/badge/solid/background-color/disable")};
64776
- border: ${getTheme("com/badge/stroke-width")} solid
64777
- ${getTheme("com/badge/disable/color-stroke")};
64776
+ border: ${getTheme("com/badge/stroke-width")} solid transparent;
64778
64777
  }
64779
64778
  `}
64780
64779
  `;
@@ -73116,6 +73115,7 @@ const FISInputDate$1 = forwardRef((props, ref) => {
73116
73115
  return parseDateText(text, formats);
73117
73116
  };
73118
73117
  const [open, setOpen] = useState(false);
73118
+ const [hovered, setHovered] = useState(false);
73119
73119
  const [inputValue, setInputValue] = useState(value ? dayjs(value).format(finalFormat) : "");
73120
73120
  const [dateValue, setDateValue] = useState(value ? dayjs(value) : null);
73121
73121
  const inputRef = useRef(null);
@@ -73203,6 +73203,14 @@ const FISInputDate$1 = forwardRef((props, ref) => {
73203
73203
  setInputValue("");
73204
73204
  }
73205
73205
  };
73206
+ const showClear = allowClear && !disabled && inputValue !== "" && hovered;
73207
+ const handleClear = () => {
73208
+ setInputValue("");
73209
+ setDateValue(null);
73210
+ setOpen(false);
73211
+ if (dateValue)
73212
+ onChange?.(null);
73213
+ };
73206
73214
  const handleInputKeyDown = (e) => {
73207
73215
  if (e.key === "Enter") {
73208
73216
  normalizeInput();
@@ -73210,7 +73218,7 @@ const FISInputDate$1 = forwardRef((props, ref) => {
73210
73218
  }
73211
73219
  originalOnKeyDown?.(e);
73212
73220
  };
73213
- return (jsxs(DivWrapperSC$2, { className: className, children: [(textLabel || iconLabel) && (jsx(FISInputLabel$1, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxs(DivInputWrapperSC$1, { children: [jsx(FISInputField$1, { ...restProps, ref: mergeRef, typeSuffix: "icon", iconSuffix: jsx(DateIcon, {}), value: inputValue, negative: negative, disabled: disabled, placeholder: restProps.placeholder, readOnly: inputReadOnly, autoFocus: autoFocus, onFocus: () => setOpen(true), onChange: handleInputChange, onBlur: handleInputBlur, onKeyDown: handleInputKeyDown, onClickSuffix: () => setOpen(true), autoComplete: "off" }), jsx(HiddenDatePickerSC, { open: open, value: dateValue, onChange: (value) => handleChange(value), onOpenChange: handleOpenChange, format: finalFormat, getPopupContainer: getPopupContainer, minDate: minDate, maxDate: maxDate, picker: picker, allowClear: allowClear, showToday: showToday, showTime: showTime, disabledDate: disabledDate, disabledTime: disabledTime })] }), message && (jsx(DivHintWrapperSC$1, { children: jsx(SpanHintSC$3, { className: classNames({
73221
+ return (jsxs(DivWrapperSC$2, { className: className, children: [(textLabel || iconLabel) && (jsx(FISInputLabel$1, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxs(DivInputWrapperSC$1, { onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: [jsx(FISInputField$1, { ...restProps, ref: mergeRef, typeSuffix: "icon", iconSuffix: showClear ? jsx(CloseIcon, {}) : jsx(DateIcon, {}), value: inputValue, negative: negative, disabled: disabled, placeholder: restProps.placeholder, readOnly: inputReadOnly, autoFocus: autoFocus, onFocus: () => setOpen(true), onChange: handleInputChange, onBlur: handleInputBlur, onKeyDown: handleInputKeyDown, onClickSuffix: showClear ? handleClear : () => setOpen(true), autoComplete: "off" }), jsx(HiddenDatePickerSC, { open: open, value: dateValue, onChange: (value) => handleChange(value), onOpenChange: handleOpenChange, format: finalFormat, getPopupContainer: getPopupContainer, minDate: minDate, maxDate: maxDate, picker: picker, showToday: showToday, showTime: showTime, disabledDate: disabledDate, disabledTime: disabledTime })] }), message && (jsx(DivHintWrapperSC$1, { children: jsx(SpanHintSC$3, { className: classNames({
73214
73222
  disabled,
73215
73223
  negative,
73216
73224
  positive,