@sonardigital/carbon-ui 1.2.14 → 1.2.15

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": "@sonardigital/carbon-ui",
3
- "version": "1.2.14",
3
+ "version": "1.2.15",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "files": [
@@ -1,15 +1,7 @@
1
- import {
2
- ClickAwayListener,
3
- IconButton,
4
- Stack,
5
- TextField,
6
- TextFieldProps,
7
- } from '@mui/material';
1
+ import { Stack, TextField, TextFieldProps } from '@mui/material';
8
2
  import { Controller } from 'react-hook-form';
9
3
  import { FormLabel } from '../layout';
10
4
  import { FormError } from '../layout/FormError';
11
- import { useState } from 'react';
12
- import { RiCloseFill } from 'react-icons/ri';
13
5
 
14
6
  interface FormInputProps extends TextFieldProps<'standard'> {
15
7
  name: string;
@@ -21,34 +13,13 @@ export function FormInput({
21
13
  label,
22
14
  ...props
23
15
  }: FormInputProps): React.ReactElement {
24
- const [isFocused, setIsFocused] = useState(false);
25
16
  return (
26
17
  <Controller
27
18
  name={name}
28
19
  render={({ field, fieldState }) => (
29
20
  <FormLabel label={label}>
30
21
  <Stack gap={0.8}>
31
- <ClickAwayListener onClickAway={() => setIsFocused(false)}>
32
- <TextField
33
- {...field}
34
- {...props}
35
- onFocus={() => setIsFocused(true)}
36
- InputProps={{
37
- endAdornment: isFocused && field.value && (
38
- <IconButton
39
- size="medium"
40
- onClick={() => {
41
- field.onChange(undefined);
42
- setIsFocused(false);
43
- }}
44
- >
45
- <RiCloseFill size={18} />
46
- </IconButton>
47
- ),
48
- ...props.InputProps,
49
- }}
50
- />
51
- </ClickAwayListener>
22
+ <TextField {...field} {...props} />
52
23
  {fieldState.error && (
53
24
  <FormError label={fieldState.error?.message ?? ''} />
54
25
  )}