fis-component 0.2.4 → 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/cjs/index.js +10 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +10 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -73135,6 +73135,7 @@ const FISInputDate$1 = React.forwardRef((props, ref) => {
|
|
|
73135
73135
|
return parseDateText(text, formats);
|
|
73136
73136
|
};
|
|
73137
73137
|
const [open, setOpen] = React.useState(false);
|
|
73138
|
+
const [hovered, setHovered] = React.useState(false);
|
|
73138
73139
|
const [inputValue, setInputValue] = React.useState(value ? dayjs(value).format(finalFormat) : "");
|
|
73139
73140
|
const [dateValue, setDateValue] = React.useState(value ? dayjs(value) : null);
|
|
73140
73141
|
const inputRef = React.useRef(null);
|
|
@@ -73222,6 +73223,14 @@ const FISInputDate$1 = React.forwardRef((props, ref) => {
|
|
|
73222
73223
|
setInputValue("");
|
|
73223
73224
|
}
|
|
73224
73225
|
};
|
|
73226
|
+
const showClear = allowClear && !disabled && inputValue !== "" && hovered;
|
|
73227
|
+
const handleClear = () => {
|
|
73228
|
+
setInputValue("");
|
|
73229
|
+
setDateValue(null);
|
|
73230
|
+
setOpen(false);
|
|
73231
|
+
if (dateValue)
|
|
73232
|
+
onChange?.(null);
|
|
73233
|
+
};
|
|
73225
73234
|
const handleInputKeyDown = (e) => {
|
|
73226
73235
|
if (e.key === "Enter") {
|
|
73227
73236
|
normalizeInput();
|
|
@@ -73229,7 +73238,7 @@ const FISInputDate$1 = React.forwardRef((props, ref) => {
|
|
|
73229
73238
|
}
|
|
73230
73239
|
originalOnKeyDown?.(e);
|
|
73231
73240
|
};
|
|
73232
|
-
return (jsxRuntime.jsxs(DivWrapperSC$2, { className: className, children: [(textLabel || iconLabel) && (jsxRuntime.jsx(FISInputLabel$1, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxRuntime.jsxs(DivInputWrapperSC$1, { children: [jsxRuntime.jsx(FISInputField$1, { ...restProps, ref: mergeRef, typeSuffix: "icon", iconSuffix: jsxRuntime.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" }), jsxRuntime.jsx(HiddenDatePickerSC, { open: open, value: dateValue, onChange: (value) => handleChange(value), onOpenChange: handleOpenChange, format: finalFormat, getPopupContainer: getPopupContainer, minDate: minDate, maxDate: maxDate, picker: picker,
|
|
73241
|
+
return (jsxRuntime.jsxs(DivWrapperSC$2, { className: className, children: [(textLabel || iconLabel) && (jsxRuntime.jsx(FISInputLabel$1, { textLabel: textLabel, required: required, iconLabel: iconLabel, onClickIconLabel: onClickIconLabel })), jsxRuntime.jsxs(DivInputWrapperSC$1, { onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), children: [jsxRuntime.jsx(FISInputField$1, { ...restProps, ref: mergeRef, typeSuffix: "icon", iconSuffix: showClear ? jsxRuntime.jsx(CloseIcon, {}) : jsxRuntime.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" }), jsxRuntime.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 && (jsxRuntime.jsx(DivHintWrapperSC$1, { children: jsxRuntime.jsx(SpanHintSC$3, { className: classNames({
|
|
73233
73242
|
disabled,
|
|
73234
73243
|
negative,
|
|
73235
73244
|
positive,
|