@bytebrand/fe-ui-core 4.1.17 → 4.1.19

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/common.ts CHANGED
@@ -118,6 +118,7 @@ import { makeStyles, createStyles, withStyles, ThemeProvider } from '@mui/styles
118
118
  import {
119
119
  Skeleton,
120
120
  Divider,
121
+ Switch,
121
122
  TextField as MITextField,
122
123
  IconButton,
123
124
  MenuItem,
@@ -136,6 +137,7 @@ export {
136
137
  makeStyles, createStyles, withStyles, ThemeProvider, createTheme,
137
138
  Skeleton,
138
139
  Divider,
140
+ Switch,
139
141
  MITextField,
140
142
  IconButton,
141
143
  MenuItem,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.1.17",
3
+ "version": "4.1.19",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -9,9 +9,9 @@ const SvgRemoveEye = (props: any) => (
9
9
  fill="none"
10
10
  {...props}
11
11
  >
12
- <path d="M11 2C14.79 2 18.17 4.13 19.82 7.5C18.17 10.87 14.79 13 11 13C7.21 13 3.83 10.87 2.18 7.5C3.83 4.13 7.21 2 11 2ZM11 0C6 0 1.73 3.11 0 7.5C1.73 11.89 6 15 11 15C16 15 20.27 11.89 22 7.5C20.27 3.11 16 0 11 0ZM11 5C12.38 5 13.5 6.12 13.5 7.5C13.5 8.88 12.38 10 11 10C9.62 10 8.5 8.88 8.5 7.5C8.5 6.12 9.62 5 11 5ZM11 3C8.52 3 6.5 5.02 6.5 7.5C6.5 9.98 8.52 12 11 12C13.48 12 15.5 9.98 15.5 7.5C15.5 5.02 13.48 3 11 3Z" />
12
+ <path d="M11 2C14.79 2 18.17 4.13 19.82 7.5C18.17 10.87 14.79 13 11 13C7.21 13 3.83 10.87 2.18 7.5C3.83 4.13 7.21 2 11 2ZM11 0C6 0 1.73 3.11 0 7.5C1.73 11.89 6 15 11 15C16 15 20.27 11.89 22 7.5C20.27 3.11 16 0 11 0ZM11 5C12.38 5 13.5 6.12 13.5 7.5C13.5 8.88 12.38 10 11 10C9.62 10 8.5 8.88 8.5 7.5C8.5 6.12 9.62 5 11 5ZM11 3C8.52 3 6.5 5.02 6.5 7.5C6.5 9.98 8.52 12 11 12C13.48 12 15.5 9.98 15.5 7.5C15.5 5.02 13.48 3 11 3Z" fill="#4C4E64" fill-opacity="0.54" />
13
13
  </svg>
14
14
  );
15
15
 
16
16
  export default SvgRemoveEye;
17
- /* tslint:enable */
17
+ /* tslint:enable */
@@ -1,7 +1,9 @@
1
1
  import * as React from 'react';
2
- import { TextField } from '@mui/material';
2
+ import { TextField, IconButton } from '@mui/material';
3
3
  import { ThemeProvider } from '@mui/material/styles';
4
4
  import { Theme } from './MaterialField.styled';
5
+ import InputAdornment from '@mui/material/InputAdornment';
6
+ import IconSVG from '../IconSVG/IconSVG';
5
7
 
6
8
  export interface IVehicleModalProps {
7
9
  className?: string;
@@ -40,12 +42,25 @@ const MaterialField: React.FC<IVehicleModalProps> = ({
40
42
  rows,
41
43
  placeholder
42
44
  }: IVehicleModalProps) => {
45
+ const [showPassword, setShowPassword] = React.useState(false);
46
+
43
47
  const onHandleChange = (event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
44
48
  const value = event.currentTarget.value;
45
49
  const name = event.currentTarget.name;
46
50
 
47
51
  onChange(value, name, event);
48
52
  };
53
+
54
+ const handleClickShowPassword = () => {
55
+ setShowPassword(!showPassword);
56
+ };
57
+
58
+ const handleMouseDownPassword = (event) => {
59
+ event.preventDefault();
60
+ };
61
+
62
+ const passType = showPassword ? 'text' : 'password';
63
+
49
64
  return (
50
65
  <ThemeProvider theme={Theme}>
51
66
  <TextField
@@ -56,7 +71,7 @@ const MaterialField: React.FC<IVehicleModalProps> = ({
56
71
  name={name}
57
72
  sx={sx}
58
73
  error={error}
59
- type={type}
74
+ type={type === 'password' ? passType : type}
60
75
  disabled={disabled}
61
76
  required={required}
62
77
  size={size}
@@ -66,6 +81,20 @@ const MaterialField: React.FC<IVehicleModalProps> = ({
66
81
  variant={variant}
67
82
  rows={rows}
68
83
  placeholder={placeholder}
84
+ InputProps={{
85
+ endAdornment: type === 'password' ? (
86
+ <InputAdornment position="end">
87
+ <IconButton
88
+ aria-label="toggle password visibility"
89
+ onClick={handleClickShowPassword}
90
+ onMouseDown={handleMouseDownPassword}
91
+ edge="end"
92
+ >
93
+ {showPassword ? <IconSVG name='removeEyeIcon' customDimensions /> : <IconSVG name='removeEyeIcon' customDimensions />}
94
+ </IconButton>
95
+ </InputAdornment>
96
+ ) : null
97
+ }}
69
98
  />
70
99
  </ThemeProvider>
71
100
  );