fis-component 0.0.94 → 0.0.96
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 +19 -26
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +19 -26
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -71259,7 +71259,7 @@ const HiddenDatePickerSC = styled(DatePicker) `
|
|
|
71259
71259
|
`;
|
|
71260
71260
|
|
|
71261
71261
|
const FISInputDate = forwardRef((props, ref) => {
|
|
71262
|
-
const { className, value, textLabel = "", iconLabel, required, message = "", disabled, negative, positive, format, onClickIconLabel, onChange, getPopupContainer, minDate, maxDate, picker = "date", allowClear = true, showToday = true, showTime = false, autoFocus = false, disabledDate, inputReadOnly = false, ...restProps } = props;
|
|
71262
|
+
const { className, value, textLabel = "", iconLabel, required, message = "", disabled, negative, positive, format, onClickIconLabel, onChange, getPopupContainer, minDate, maxDate, picker = "date", allowClear = true, showToday = true, showTime = false, autoFocus = false, disabledDate, inputReadOnly = false, onBlur: originalOnBlur, ...restProps } = props;
|
|
71263
71263
|
const getDefaultFormat = (pickerMode) => {
|
|
71264
71264
|
switch (pickerMode) {
|
|
71265
71265
|
case "year":
|
|
@@ -71312,13 +71312,26 @@ const FISInputDate = forwardRef((props, ref) => {
|
|
|
71312
71312
|
setDateValue(parsedDate);
|
|
71313
71313
|
onChange?.(parsedDate.toDate());
|
|
71314
71314
|
}
|
|
71315
|
-
|
|
71316
|
-
|
|
71317
|
-
|
|
71318
|
-
|
|
71315
|
+
// If invalid format, keep inputValue but don't update dateValue or call onChange
|
|
71316
|
+
// This preserves the old date value like Antd DatePicker
|
|
71317
|
+
};
|
|
71318
|
+
const handleInputBlur = (e) => {
|
|
71319
|
+
// Call original onBlur if provided
|
|
71320
|
+
if (originalOnBlur) {
|
|
71321
|
+
originalOnBlur(e);
|
|
71322
|
+
}
|
|
71323
|
+
// On blur, if input format is invalid, revert to the current date value's formatted string
|
|
71324
|
+
const parsedDate = dayjs(inputValue, finalFormat);
|
|
71325
|
+
if (!parsedDate.isValid() && dateValue) {
|
|
71326
|
+
// Revert to formatted current date value
|
|
71327
|
+
setInputValue(dateValue.format(finalFormat));
|
|
71328
|
+
}
|
|
71329
|
+
else if (!parsedDate.isValid() && !dateValue) {
|
|
71330
|
+
// If no current date and invalid input, clear input
|
|
71331
|
+
setInputValue("");
|
|
71319
71332
|
}
|
|
71320
71333
|
};
|
|
71321
|
-
return (jsxs(DivWrapperSC$2, { className: className, 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, placeholder: restProps.placeholder, readOnly: inputReadOnly, autoFocus: autoFocus, onFocus: () => setOpen(true), onChange: handleInputChange, onClickSuffix: () => setOpen(true) }), 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 })] }), message && (jsx(DivHintWrapperSC$1, { children: jsx(SpanHintSC$3, { className: classNames({
|
|
71334
|
+
return (jsxs(DivWrapperSC$2, { className: className, 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, placeholder: restProps.placeholder, readOnly: inputReadOnly, autoFocus: autoFocus, onFocus: () => setOpen(true), onChange: handleInputChange, onBlur: handleInputBlur, onClickSuffix: () => setOpen(true) }), 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 })] }), message && (jsx(DivHintWrapperSC$1, { children: jsx(SpanHintSC$3, { className: classNames({
|
|
71322
71335
|
disabled,
|
|
71323
71336
|
negative,
|
|
71324
71337
|
positive,
|
|
@@ -73674,7 +73687,6 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73674
73687
|
}, [multi, value, multiDisplayText, selectedItems, displayValue]);
|
|
73675
73688
|
const handleToggle = useCallback(() => {
|
|
73676
73689
|
if (!disabled) {
|
|
73677
|
-
console.log("Toggle dropdown"); // Debug log
|
|
73678
73690
|
setIsOpen((prev) => !prev);
|
|
73679
73691
|
}
|
|
73680
73692
|
}, [disabled]);
|
|
@@ -73685,30 +73697,18 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73685
73697
|
}
|
|
73686
73698
|
}, [multi, onChange, value]);
|
|
73687
73699
|
const handleMenuChange = useCallback((values) => {
|
|
73688
|
-
console.log("Starting selection, keeping onBlur blocked"); // Debug log
|
|
73689
73700
|
if (multi) {
|
|
73690
73701
|
onChange(values);
|
|
73691
|
-
// For multi-select, allow onBlur immediately since dropdown stays open
|
|
73692
|
-
setTimeout(() => {
|
|
73693
|
-
console.log("Multi-selection complete, allowing onBlur"); // Debug log
|
|
73694
|
-
isSelectingRef.current = false;
|
|
73695
|
-
}, 50);
|
|
73696
73702
|
}
|
|
73697
73703
|
else {
|
|
73698
73704
|
if (values.length > 0) {
|
|
73699
73705
|
onChange(values[0]);
|
|
73700
73706
|
setIsOpen(false);
|
|
73701
|
-
// Keep blocking until value is processed
|
|
73702
|
-
setTimeout(() => {
|
|
73703
|
-
console.log("Single selection complete, allowing onBlur"); // Debug log
|
|
73704
|
-
isSelectingRef.current = false;
|
|
73705
|
-
}, 150);
|
|
73706
73707
|
}
|
|
73707
73708
|
}
|
|
73708
73709
|
}, [multi, onChange]);
|
|
73709
73710
|
const handleMenuClick = useCallback(() => {
|
|
73710
73711
|
if (!multi) {
|
|
73711
|
-
console.log("Menu click - closing dropdown"); // Debug log
|
|
73712
73712
|
setIsOpen(false);
|
|
73713
73713
|
}
|
|
73714
73714
|
}, [multi]);
|
|
@@ -73716,13 +73716,8 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73716
73716
|
const handleBlur = useCallback((event) => {
|
|
73717
73717
|
// Block onBlur if dropdown is open OR we're in the middle of selection
|
|
73718
73718
|
if (isOpen || isSelectingRef.current) {
|
|
73719
|
-
console.log("Blocking onBlur - dropdown open or selecting:", {
|
|
73720
|
-
isOpen,
|
|
73721
|
-
isSelecting: isSelectingRef.current,
|
|
73722
|
-
}); // Debug log
|
|
73723
73719
|
return;
|
|
73724
73720
|
}
|
|
73725
|
-
console.log("Allowing onBlur to proceed"); // Debug log
|
|
73726
73721
|
// Call original onBlur if provided
|
|
73727
73722
|
if (restProps.onBlur) {
|
|
73728
73723
|
restProps.onBlur(event);
|
|
@@ -73770,7 +73765,6 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73770
73765
|
!referenceElement.contains(target) &&
|
|
73771
73766
|
popperElement &&
|
|
73772
73767
|
!popperElement.contains(target)) {
|
|
73773
|
-
console.log("Click outside - closing dropdown"); // Debug log
|
|
73774
73768
|
setIsOpen(false);
|
|
73775
73769
|
}
|
|
73776
73770
|
};
|
|
@@ -73783,7 +73777,6 @@ const FISSelect = forwardRef(({ className, style, size = "md", options, value, d
|
|
|
73783
73777
|
// When dropdown closes, give time for value to be processed before allowing onBlur
|
|
73784
73778
|
isSelectingRef.current = true;
|
|
73785
73779
|
const timer = setTimeout(() => {
|
|
73786
|
-
console.log("Dropdown closed delay complete, allowing onBlur"); // Debug log
|
|
73787
73780
|
isSelectingRef.current = false;
|
|
73788
73781
|
}, 200);
|
|
73789
73782
|
return () => clearTimeout(timer);
|