Skip to content

Commit af14e20

Browse files
author
Hector Arce De Las Heras
committed
Improve types
Improve types for useInput and tooltipUncontrolled
1 parent 1b78b49 commit af14e20

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/tooltip/tooltipUnControlled.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const TooltipUnControlledComponent = React.forwardRef(
108108
showTooltip();
109109
return;
110110
}
111-
if (!tooltipAsModalValue && !tooltipRef.current?.contains(event.target as Node)) {
111+
if (!tooltipRef.current?.contains(event.target as Node)) {
112112
hideTooltip();
113113
}
114114
};

src/hooks/useInput/useInput.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export const useInput = (props: ParamsTypeInputHook): ReturnTypeInputHook => {
131131

132132
const truncateFloatValue = value => {
133133
if (value === '') {
134-
return;
134+
return value;
135135
}
136136
const hasMark = value.match(/[^a-zA-Z0-9]/g);
137137

@@ -158,7 +158,7 @@ export const useInput = (props: ParamsTypeInputHook): ReturnTypeInputHook => {
158158
props.maxDecimals,
159159
props.locale || props.formatNumber?.locale
160160
)
161-
: limitedValue;
161+
: String(limitedValue);
162162

163163
const valueTruncated = truncateFloatValue(truncateValue);
164164

@@ -172,7 +172,7 @@ export const useInput = (props: ParamsTypeInputHook): ReturnTypeInputHook => {
172172
// remove existing thousand separator
173173
const newValue = removeThousandSeparator(value, props.locale || format.locale);
174174
// format value
175-
const formattedValue = formatNumber(Number(newValue), format);
175+
const formattedValue = formatNumber(Number(newValue), format, props.locale || format.locale);
176176
return formattedValue;
177177
}
178178
return value;

0 commit comments

Comments
 (0)