@ainias42/react-bootstrap-mobile 0.1.29 → 0.1.30
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/bootstrapReactMobile.js +29 -17
- package/dist/bootstrapReactMobile.js.map +1 -1
- package/dist/src/Components/FormElements/Input/Input.d.ts +2 -10
- package/dist/src/Components/Layout/Block.d.ts +1 -1
- package/dist/src/Components/Layout/Flex.d.ts +1 -1
- package/dist/src/Components/Layout/Inline.d.ts +1 -1
- package/dist/src/Components/Layout/InlineBlock.d.ts +1 -1
- package/package.json +1 -1
- package/src/Components/FormElements/Input/Input.tsx +37 -49
|
@@ -2,18 +2,10 @@ import { InputHTMLAttributes } from 'react';
|
|
|
2
2
|
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
3
3
|
import { Override } from '../../../TypeHelpers';
|
|
4
4
|
import { OptionalListener } from '../../Hooks/useListener';
|
|
5
|
-
type
|
|
6
|
-
export type InputProps<OnChangeData, OnBlurData, OnChangeDoneData> = RbmComponentProps<Override<Omit<InputHTMLAttributes<HTMLInputElement>, 'onInput' | "type">, {
|
|
5
|
+
export type InputProps<OnChangeData, OnBlurData, OnChangeDoneData> = RbmComponentProps<Override<Omit<InputHTMLAttributes<HTMLInputElement>, 'onInput'>, {
|
|
7
6
|
label?: string;
|
|
8
7
|
inline?: boolean;
|
|
9
|
-
} & OptionalListener<'onChange', OnChangeData> & OptionalListener<'onBlur', OnBlurData> & OptionalListener<'onChangeDone', OnChangeDoneData> & ({
|
|
10
|
-
type?: InputTypes;
|
|
11
8
|
onChangeText?: (newText: string) => void;
|
|
12
9
|
onEnter?: (newText: string) => void;
|
|
13
|
-
}
|
|
14
|
-
type: "number";
|
|
15
|
-
onChangeText?: (newNumber: number) => void;
|
|
16
|
-
onEnter?: (newNumber: number) => void;
|
|
17
|
-
})>>;
|
|
10
|
+
} & OptionalListener<'onChange', OnChangeData> & OptionalListener<'onBlur', OnBlurData> & OptionalListener<'onChangeDone', OnChangeDoneData>>>;
|
|
18
11
|
export declare const Input: import("../../../helper/withForwardRef").RefComponent<InputProps<unknown, unknown, unknown>, HTMLInputElement>;
|
|
19
|
-
export {};
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
4
4
|
import { ViewWithoutListenersProps } from './ViewWithoutListeners';
|
|
5
5
|
export type BlockProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<ViewWithoutListenersProps<AsType>>;
|
|
6
|
-
declare const BlockMemo: import("../../helper/withForwardRef").RefComponent<BlockProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement |
|
|
6
|
+
declare const BlockMemo: import("../../helper/withForwardRef").RefComponent<BlockProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement | HTMLStyleElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDivElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLParamElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableDataCellElement | HTMLTextAreaElement | HTMLTableHeaderCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLWebViewElement | SVGSVGElement | SVGCircleElement | SVGClipPathElement | SVGDefsElement | SVGDescElement | SVGEllipseElement | SVGFEBlendElement | SVGFEColorMatrixElement | SVGFEComponentTransferElement | SVGFECompositeElement | SVGFEConvolveMatrixElement | SVGFEDiffuseLightingElement | SVGFEDisplacementMapElement | SVGFEDistantLightElement | SVGFEDropShadowElement | SVGFEFloodElement | SVGFEFuncAElement | SVGFEFuncBElement | SVGFEFuncGElement | SVGFEFuncRElement | SVGFEGaussianBlurElement | SVGFEImageElement | SVGFEMergeElement | SVGFEMergeNodeElement | SVGFEMorphologyElement | SVGFEOffsetElement | SVGFEPointLightElement | SVGFESpecularLightingElement | SVGFESpotLightElement | SVGFETileElement | SVGFETurbulenceElement | SVGFilterElement | SVGForeignObjectElement | SVGGElement | SVGImageElement | SVGLineElement | SVGLinearGradientElement | SVGMarkerElement | SVGMaskElement | SVGMetadataElement | SVGPathElement | SVGPatternElement | SVGPolygonElement | SVGPolylineElement | SVGRadialGradientElement | SVGRectElement | SVGStopElement | SVGSwitchElement | SVGTextPathElement | SVGTSpanElement | SVGUseElement | SVGViewElement>;
|
|
7
7
|
export { BlockMemo as Block };
|
|
@@ -6,5 +6,5 @@ export type FlexProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponent
|
|
|
6
6
|
horizontal?: boolean;
|
|
7
7
|
grow?: boolean;
|
|
8
8
|
}>;
|
|
9
|
-
declare const tmp: import("../../helper/withForwardRef").RefComponent<FlexProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement |
|
|
9
|
+
declare const tmp: import("../../helper/withForwardRef").RefComponent<FlexProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement | HTMLStyleElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDivElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLParamElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableDataCellElement | HTMLTextAreaElement | HTMLTableHeaderCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLWebViewElement | SVGSVGElement | SVGCircleElement | SVGClipPathElement | SVGDefsElement | SVGDescElement | SVGEllipseElement | SVGFEBlendElement | SVGFEColorMatrixElement | SVGFEComponentTransferElement | SVGFECompositeElement | SVGFEConvolveMatrixElement | SVGFEDiffuseLightingElement | SVGFEDisplacementMapElement | SVGFEDistantLightElement | SVGFEDropShadowElement | SVGFEFloodElement | SVGFEFuncAElement | SVGFEFuncBElement | SVGFEFuncGElement | SVGFEFuncRElement | SVGFEGaussianBlurElement | SVGFEImageElement | SVGFEMergeElement | SVGFEMergeNodeElement | SVGFEMorphologyElement | SVGFEOffsetElement | SVGFEPointLightElement | SVGFESpecularLightingElement | SVGFESpotLightElement | SVGFETileElement | SVGFETurbulenceElement | SVGFilterElement | SVGForeignObjectElement | SVGGElement | SVGImageElement | SVGLineElement | SVGLinearGradientElement | SVGMarkerElement | SVGMaskElement | SVGMetadataElement | SVGPathElement | SVGPatternElement | SVGPolygonElement | SVGPolylineElement | SVGRadialGradientElement | SVGRectElement | SVGStopElement | SVGSwitchElement | SVGTextPathElement | SVGTSpanElement | SVGUseElement | SVGViewElement>;
|
|
10
10
|
export { tmp as Flex };
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
import { RbmComponentProps } from '../RbmComponentProps';
|
|
4
4
|
import { ViewWithoutListenersProps } from './ViewWithoutListeners';
|
|
5
5
|
export type InlineProps<AsType extends keyof JSX.IntrinsicElements> = RbmComponentProps<ViewWithoutListenersProps<AsType>>;
|
|
6
|
-
declare const InlineMemo: import("../../helper/withForwardRef").RefComponent<InlineProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement |
|
|
6
|
+
declare const InlineMemo: import("../../helper/withForwardRef").RefComponent<InlineProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement | HTMLStyleElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDivElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLParamElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableDataCellElement | HTMLTextAreaElement | HTMLTableHeaderCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLWebViewElement | SVGSVGElement | SVGCircleElement | SVGClipPathElement | SVGDefsElement | SVGDescElement | SVGEllipseElement | SVGFEBlendElement | SVGFEColorMatrixElement | SVGFEComponentTransferElement | SVGFECompositeElement | SVGFEConvolveMatrixElement | SVGFEDiffuseLightingElement | SVGFEDisplacementMapElement | SVGFEDistantLightElement | SVGFEDropShadowElement | SVGFEFloodElement | SVGFEFuncAElement | SVGFEFuncBElement | SVGFEFuncGElement | SVGFEFuncRElement | SVGFEGaussianBlurElement | SVGFEImageElement | SVGFEMergeElement | SVGFEMergeNodeElement | SVGFEMorphologyElement | SVGFEOffsetElement | SVGFEPointLightElement | SVGFESpecularLightingElement | SVGFESpotLightElement | SVGFETileElement | SVGFETurbulenceElement | SVGFilterElement | SVGForeignObjectElement | SVGGElement | SVGImageElement | SVGLineElement | SVGLinearGradientElement | SVGMarkerElement | SVGMaskElement | SVGMetadataElement | SVGPathElement | SVGPatternElement | SVGPolygonElement | SVGPolylineElement | SVGRadialGradientElement | SVGRectElement | SVGStopElement | SVGSwitchElement | SVGTextPathElement | SVGTSpanElement | SVGUseElement | SVGViewElement>;
|
|
7
7
|
export { InlineMemo as Inline };
|
|
@@ -6,5 +6,5 @@ export type InlineBlockProps<AsType extends keyof JSX.IntrinsicElements> = RbmCo
|
|
|
6
6
|
id?: string;
|
|
7
7
|
title?: string;
|
|
8
8
|
}>;
|
|
9
|
-
declare const InlineBlockMemo: import("../../helper/withForwardRef").RefComponent<InlineBlockProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement |
|
|
9
|
+
declare const InlineBlockMemo: import("../../helper/withForwardRef").RefComponent<InlineBlockProps<keyof JSX.IntrinsicElements>, SVGSymbolElement | SVGElement | HTMLObjectElement | HTMLElement | HTMLHtmlElement | SVGTextElement | HTMLTitleElement | HTMLStyleElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDivElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLParamElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLSpanElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableDataCellElement | HTMLTextAreaElement | HTMLTableHeaderCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLWebViewElement | SVGSVGElement | SVGCircleElement | SVGClipPathElement | SVGDefsElement | SVGDescElement | SVGEllipseElement | SVGFEBlendElement | SVGFEColorMatrixElement | SVGFEComponentTransferElement | SVGFECompositeElement | SVGFEConvolveMatrixElement | SVGFEDiffuseLightingElement | SVGFEDisplacementMapElement | SVGFEDistantLightElement | SVGFEDropShadowElement | SVGFEFloodElement | SVGFEFuncAElement | SVGFEFuncBElement | SVGFEFuncGElement | SVGFEFuncRElement | SVGFEGaussianBlurElement | SVGFEImageElement | SVGFEMergeElement | SVGFEMergeNodeElement | SVGFEMorphologyElement | SVGFEOffsetElement | SVGFEPointLightElement | SVGFESpecularLightingElement | SVGFESpotLightElement | SVGFETileElement | SVGFETurbulenceElement | SVGFilterElement | SVGForeignObjectElement | SVGGElement | SVGImageElement | SVGLineElement | SVGLinearGradientElement | SVGMarkerElement | SVGMaskElement | SVGMetadataElement | SVGPathElement | SVGPatternElement | SVGPolygonElement | SVGPolylineElement | SVGRadialGradientElement | SVGRectElement | SVGStopElement | SVGSwitchElement | SVGTextPathElement | SVGTSpanElement | SVGUseElement | SVGViewElement>;
|
|
10
10
|
export { InlineBlockMemo as InlineBlock };
|
package/package.json
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ChangeEventHandler,
|
|
4
|
+
InputHTMLAttributes,
|
|
5
|
+
KeyboardEvent,
|
|
6
|
+
MutableRefObject,
|
|
7
|
+
useCallback, useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
useState
|
|
10
|
+
} from 'react';
|
|
3
11
|
import { RbmComponentProps } from '../../RbmComponentProps';
|
|
4
12
|
import { Override } from '../../../TypeHelpers';
|
|
5
13
|
import { OptionalListener, useListenerWithExtractedProps } from '../../Hooks/useListener';
|
|
@@ -10,47 +18,17 @@ import classNames from 'classnames';
|
|
|
10
18
|
import { useComposedRef } from '../../Hooks/useComposedRef';
|
|
11
19
|
import { useOnChangeDone } from '../hooks/useOnChangeDone';
|
|
12
20
|
|
|
13
|
-
type InputTypes =
|
|
14
|
-
| 'button'
|
|
15
|
-
| 'checkbox'
|
|
16
|
-
| 'color'
|
|
17
|
-
| 'date'
|
|
18
|
-
| 'datetime-local'
|
|
19
|
-
| 'email'
|
|
20
|
-
| 'file'
|
|
21
|
-
| 'hidden'
|
|
22
|
-
| 'image'
|
|
23
|
-
| 'month'
|
|
24
|
-
| 'password'
|
|
25
|
-
| 'radio'
|
|
26
|
-
| 'range'
|
|
27
|
-
| 'reset'
|
|
28
|
-
| 'search'
|
|
29
|
-
| 'submit'
|
|
30
|
-
| 'tel'
|
|
31
|
-
| 'text'
|
|
32
|
-
| 'time'
|
|
33
|
-
| 'url'
|
|
34
|
-
| 'week';
|
|
35
|
-
|
|
36
21
|
export type InputProps<OnChangeData, OnBlurData, OnChangeDoneData> = RbmComponentProps<
|
|
37
22
|
Override<
|
|
38
|
-
Omit<InputHTMLAttributes<HTMLInputElement>, 'onInput'
|
|
23
|
+
Omit<InputHTMLAttributes<HTMLInputElement>, 'onInput'>,
|
|
39
24
|
{
|
|
40
25
|
label?: string;
|
|
41
|
-
inline?: boolean
|
|
26
|
+
inline?: boolean;
|
|
27
|
+
onChangeText?: (newText: string) => void;
|
|
28
|
+
onEnter?: (newText: string) => void;
|
|
42
29
|
} & OptionalListener<'onChange', OnChangeData> &
|
|
43
30
|
OptionalListener<'onBlur', OnBlurData> &
|
|
44
31
|
OptionalListener<'onChangeDone', OnChangeDoneData>
|
|
45
|
-
& ({
|
|
46
|
-
type?: InputTypes
|
|
47
|
-
onChangeText?: (newText: string) => void;
|
|
48
|
-
onEnter?: (newText: string) => void;
|
|
49
|
-
} | {
|
|
50
|
-
type: "number"
|
|
51
|
-
onChangeText?: (newNumber: number) => void;
|
|
52
|
-
onEnter?: (newNumber: number) => void;
|
|
53
|
-
})
|
|
54
32
|
>
|
|
55
33
|
>;
|
|
56
34
|
|
|
@@ -61,6 +39,7 @@ export const Input = withForwardRef(function Input<OnChangeData, OnBlurData, OnC
|
|
|
61
39
|
style,
|
|
62
40
|
onKeyDown,
|
|
63
41
|
inline = false,
|
|
42
|
+
value,
|
|
64
43
|
...otherProps
|
|
65
44
|
}: InputProps<OnChangeData, OnBlurData, OnChangeDoneData>,
|
|
66
45
|
ref: MutableRefObject<HTMLInputElement> | null
|
|
@@ -68,10 +47,23 @@ export const Input = withForwardRef(function Input<OnChangeData, OnBlurData, OnC
|
|
|
68
47
|
// Variables
|
|
69
48
|
|
|
70
49
|
// States
|
|
71
|
-
|
|
50
|
+
const usedValue = useMemo(() => {
|
|
51
|
+
if (otherProps.type !== "number" || typeof value === "number"){
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
if (typeof value === "string"){
|
|
55
|
+
if (!Number.isNaN(Number(value))){
|
|
56
|
+
// Do not parse to allow ., and so on
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
if (!Number.isNaN(parseFloat(value))){
|
|
60
|
+
return parseFloat(value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return "";
|
|
64
|
+
}, [value])
|
|
72
65
|
// Refs
|
|
73
66
|
const innerRef = useComposedRef(ref);
|
|
74
|
-
const lastValueRef = useRef(NaN);
|
|
75
67
|
|
|
76
68
|
// Callbacks
|
|
77
69
|
const [onChangeWithData, otherPropsWithoutOnchange] = useListenerWithExtractedProps<'onChange', OnChangeData>(
|
|
@@ -82,12 +74,8 @@ export const Input = withForwardRef(function Input<OnChangeData, OnBlurData, OnC
|
|
|
82
74
|
(e) => {
|
|
83
75
|
if (otherProps.onChangeText) {
|
|
84
76
|
if (otherProps.type === "number") {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
} else {
|
|
88
|
-
otherProps.onChangeText(e.target.valueAsNumber);
|
|
89
|
-
lastValueRef.current = e.target.valueAsNumber;
|
|
90
|
-
}
|
|
77
|
+
const val = !Number.isNaN(Number(e.target.value)) ? e.target.value : !Number.isNaN(parseFloat(e.target.value)) ? String(parseFloat(e.target.value)) : "";
|
|
78
|
+
otherProps.onChangeText(val);
|
|
91
79
|
} else {
|
|
92
80
|
otherProps.onChangeText(e.target.value);
|
|
93
81
|
}
|
|
@@ -112,12 +100,9 @@ export const Input = withForwardRef(function Input<OnChangeData, OnBlurData, OnC
|
|
|
112
100
|
onKeyDown?.(e);
|
|
113
101
|
if (otherProps.onEnter && e.key === 'Enter' && !e.defaultPrevented) {
|
|
114
102
|
if (otherProps.type === "number") {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
otherProps.onEnter((e.target as HTMLInputElement).valueAsNumber);
|
|
119
|
-
lastValueRef.current = (e.target as HTMLInputElement).valueAsNumber;
|
|
120
|
-
}
|
|
103
|
+
const stringValue = (e.target as HTMLInputElement).value;
|
|
104
|
+
const val = !Number.isNaN(Number(stringValue)) ? stringValue : !Number.isNaN(parseFloat(stringValue)) ? String(parseFloat(stringValue)) : "";
|
|
105
|
+
otherProps.onEnter(val)
|
|
121
106
|
} else {
|
|
122
107
|
otherProps.onEnter((e.target as HTMLInputElement).value);
|
|
123
108
|
}
|
|
@@ -139,7 +124,10 @@ export const Input = withForwardRef(function Input<OnChangeData, OnBlurData, OnC
|
|
|
139
124
|
<label className={classNames(styles.input, {[styles.inline]: inline}, className)} style={style}>
|
|
140
125
|
{label ? <span className={styles.label}>{label}</span> : null}
|
|
141
126
|
<input
|
|
127
|
+
inputMode={otherProps.type === "number" ? "numeric" : undefined}
|
|
142
128
|
{...otherPropsWithoutData}
|
|
129
|
+
value={usedValue}
|
|
130
|
+
type={otherProps.type === "number" ? "text" : otherProps.type}
|
|
143
131
|
ref={innerRef}
|
|
144
132
|
className={styles.text}
|
|
145
133
|
onBlur={onBlur}
|