@verifiedinc-public/shared-ui-elements 0.14.2 → 0.14.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "0.14.2",
3
+ "version": "0.14.4",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "keywords": [],
@@ -94,7 +94,23 @@ export const CustomAlertComponent = forwardRef<
94
94
  CustomAlertComponentProps
95
95
  >(
96
96
  (
97
- { id, message, severity, alertAction, sx, showCloseIcon = true, ...props },
97
+ {
98
+ id,
99
+ message,
100
+ severity,
101
+ alertAction,
102
+ sx,
103
+ showCloseIcon = true,
104
+
105
+ // remove these props because they were triggering warnings. They are not used in this component anyway
106
+ persist,
107
+ hideIconVariant,
108
+ autoHideDuration,
109
+ anchorOrigin,
110
+ iconVariant,
111
+
112
+ ...props
113
+ },
98
114
  ref,
99
115
  ) => {
100
116
  return (
@@ -20,6 +20,7 @@ import {
20
20
  type InputBaseProps,
21
21
  Typography,
22
22
  useTheme,
23
+ FormControl,
23
24
  } from '@mui/material';
24
25
  import { v4 as uuid } from 'uuid';
25
26
 
@@ -192,22 +193,24 @@ function OTPInputComponent(
192
193
  (startIndex: number) => {
193
194
  return new Array(3).fill(undefined).map((_, index) => {
194
195
  return (
195
- <InputBase
196
- key={ids.current[index + startIndex]}
197
- inputRef={(input) =>
198
- ((inputsRef.current[index + startIndex] as any) = input)
199
- }
200
- autoComplete='one-time-code'
201
- autoFocus={index + startIndex === 0}
202
- value={values[index + startIndex] || ''}
203
- disabled={props.disabled}
204
- onChange={handleChange}
205
- onKeyUp={handleKeyUp}
206
- onFocus={handleFocus}
207
- onBlur={() => setIsFocused(false)}
208
- {...inputProps}
209
- data-testid={`otp-input-${index + startIndex}`}
210
- />
196
+ // FormControl is required for InputBase to avoid bad setState in handleBlur event, and it is one per input.
197
+ <FormControl key={ids.current[index + startIndex]}>
198
+ <InputBase
199
+ inputRef={(input) =>
200
+ ((inputsRef.current[index + startIndex] as any) = input)
201
+ }
202
+ autoComplete='one-time-code'
203
+ autoFocus={index + startIndex === 0}
204
+ value={values[index + startIndex] || ''}
205
+ disabled={props.disabled}
206
+ onChange={handleChange}
207
+ onKeyUp={handleKeyUp}
208
+ onFocus={handleFocus}
209
+ onBlur={() => setIsFocused(false)}
210
+ {...inputProps}
211
+ data-testid={`otp-input-${index + startIndex}`}
212
+ />
213
+ </FormControl>
211
214
  );
212
215
  });
213
216
  },