pcm-shared-components 0.0.178 → 0.0.179
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.
|
@@ -28,7 +28,6 @@ export const CurrencyTextInput = props => {
|
|
|
28
28
|
variant,
|
|
29
29
|
fullWidth,
|
|
30
30
|
onChange,
|
|
31
|
-
onChangeDebounce,
|
|
32
31
|
currencySymbol,
|
|
33
32
|
className,
|
|
34
33
|
decimalPlaces,
|
|
@@ -41,15 +40,7 @@ export const CurrencyTextInput = props => {
|
|
|
41
40
|
theme
|
|
42
41
|
} = props;
|
|
43
42
|
const compTheme = theme ? theme : useTheme();
|
|
44
|
-
const defaultTheme = createTheme(compTheme);
|
|
45
|
-
|
|
46
|
-
const [localValue, setLocalValue] = useState(value);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
clearTimeout(debounce);
|
|
49
|
-
debounce = setTimeout(() => {
|
|
50
|
-
onChangeDebounce(localValue);
|
|
51
|
-
}, 700);
|
|
52
|
-
}, [localValue]); //---------------------------------------------------
|
|
43
|
+
const defaultTheme = createTheme(compTheme); //---------------------------------------------------
|
|
53
44
|
// Functions used to sanitize the number
|
|
54
45
|
//---------------------------------------------------
|
|
55
46
|
|
|
@@ -159,7 +150,8 @@ export const CurrencyTextInput = props => {
|
|
|
159
150
|
};
|
|
160
151
|
|
|
161
152
|
const handleOnChange = event => {
|
|
162
|
-
|
|
153
|
+
//Sanitize the output same as the input
|
|
154
|
+
event.target.value = handleCurrencyFormatting(event.target.value);
|
|
163
155
|
onChange(event);
|
|
164
156
|
};
|
|
165
157
|
|
|
@@ -200,7 +192,6 @@ CurrencyTextInput.defaultProps = {
|
|
|
200
192
|
variant: 'outlined',
|
|
201
193
|
fullWidth: true,
|
|
202
194
|
onChange: () => {},
|
|
203
|
-
onChangeDebounce: () => {},
|
|
204
195
|
currencySymbol: '$',
|
|
205
196
|
useThousandSeparator: true,
|
|
206
197
|
className: '',
|
|
@@ -237,9 +228,6 @@ CurrencyTextInput.propTypes = {
|
|
|
237
228
|
/** Callback fired when the value is changed*/
|
|
238
229
|
onChange: PropTypes.func,
|
|
239
230
|
|
|
240
|
-
/** Same as onChange except only fires 700ms after the users has completed typing to prevent performance issues. Returns the new value */
|
|
241
|
-
onChangeDebounce: PropTypes.func,
|
|
242
|
-
|
|
243
231
|
/** Defines the currency symbol string.*/
|
|
244
232
|
currencySymbol: PropTypes.string,
|
|
245
233
|
|