@okta/odyssey-react-mui 0.21.3 → 0.22.0
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/CHANGELOG.md +24 -0
- package/dist/Autocomplete.js +58 -0
- package/dist/Autocomplete.js.map +1 -0
- package/dist/Banner.js +2 -3
- package/dist/Banner.js.map +1 -1
- package/dist/Button.js +46 -0
- package/dist/Button.js.map +1 -0
- package/dist/CheckboxGroup.js +2 -3
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/CircularProgress.js +12 -0
- package/dist/CircularProgress.js.map +1 -0
- package/dist/Field.js +59 -0
- package/dist/Field.js.map +1 -0
- package/dist/FieldError.js +34 -0
- package/dist/FieldError.js.map +1 -0
- package/dist/FieldHint.js +29 -0
- package/dist/FieldHint.js.map +1 -0
- package/dist/FieldLabel.js +32 -0
- package/dist/FieldLabel.js.map +1 -0
- package/dist/Infobox.js +2 -3
- package/dist/Infobox.js.map +1 -1
- package/dist/MenuButton.js +2 -2
- package/dist/MenuButton.js.map +1 -1
- package/dist/MenuItem.js +0 -1
- package/dist/MenuItem.js.map +1 -1
- package/dist/PasswordField.js +68 -0
- package/dist/PasswordField.js.map +1 -0
- package/dist/RadioGroup.js +2 -3
- package/dist/RadioGroup.js.map +1 -1
- package/dist/ScreenReaderText.js +30 -0
- package/dist/ScreenReaderText.js.map +1 -0
- package/dist/SearchField.js +54 -0
- package/dist/SearchField.js.map +1 -0
- package/dist/Tag.js +28 -0
- package/dist/Tag.js.map +1 -0
- package/dist/TagList.js +26 -0
- package/dist/TagList.js.map +1 -0
- package/dist/TagListContext.js +16 -0
- package/dist/TagListContext.js.map +1 -0
- package/dist/TextField.js +26 -62
- package/dist/TextField.js.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/src/Autocomplete.d.ts +27 -0
- package/dist/src/Autocomplete.d.ts.map +1 -0
- package/dist/src/Button.d.ts +31 -0
- package/dist/src/Button.d.ts.map +1 -0
- package/dist/src/CircularProgress.d.ts +16 -0
- package/dist/src/CircularProgress.d.ts.map +1 -0
- package/dist/src/Field.d.ts +54 -0
- package/dist/src/Field.d.ts.map +1 -0
- package/dist/src/FieldError.d.ts +19 -0
- package/dist/src/FieldError.d.ts.map +1 -0
- package/dist/src/FieldHint.d.ts +19 -0
- package/dist/src/FieldHint.d.ts.map +1 -0
- package/dist/src/FieldLabel.d.ts +23 -0
- package/dist/src/FieldLabel.d.ts.map +1 -0
- package/dist/src/Icon.d.ts +1 -1
- package/dist/src/Link.d.ts +1 -1
- package/dist/src/MenuButton.d.ts.map +1 -1
- package/dist/src/MenuItem.d.ts +1 -1
- package/dist/src/MenuItem.d.ts.map +1 -1
- package/dist/src/PasswordField.d.ts +75 -0
- package/dist/src/PasswordField.d.ts.map +1 -0
- package/dist/src/RadioGroup.d.ts.map +1 -1
- package/dist/src/ScreenReaderText.d.ts +21 -0
- package/dist/src/ScreenReaderText.d.ts.map +1 -0
- package/dist/src/SearchField.d.ts +59 -0
- package/dist/src/SearchField.d.ts.map +1 -0
- package/dist/src/Tag.d.ts +22 -0
- package/dist/src/Tag.d.ts.map +1 -0
- package/dist/src/TagList.d.ts +19 -0
- package/dist/src/TagList.d.ts.map +1 -0
- package/dist/src/TagListContext.d.ts +18 -0
- package/dist/src/TagListContext.d.ts.map +1 -0
- package/dist/src/TextField.d.ts +3 -8
- package/dist/src/TextField.d.ts.map +1 -1
- package/dist/src/iconDictionary/Add.d.ts +1 -1
- package/dist/src/iconDictionary/AddCircle.d.ts +1 -1
- package/dist/src/iconDictionary/AlertCircle.d.ts +1 -1
- package/dist/src/iconDictionary/AlertCircleFilled.d.ts +1 -1
- package/dist/src/iconDictionary/AlertTriangleFilled.d.ts +1 -1
- package/dist/src/iconDictionary/Anchor.d.ts +1 -1
- package/dist/src/iconDictionary/ArrowDown.d.ts +1 -1
- package/dist/src/iconDictionary/ArrowLeft.d.ts +1 -1
- package/dist/src/iconDictionary/ArrowRight.d.ts +1 -1
- package/dist/src/iconDictionary/ArrowUp.d.ts +1 -1
- package/dist/src/iconDictionary/ArrowUpDown.d.ts +1 -1
- package/dist/src/iconDictionary/Calendar.d.ts +1 -1
- package/dist/src/iconDictionary/Check.d.ts +1 -1
- package/dist/src/iconDictionary/CheckCircleFilled.d.ts +1 -1
- package/dist/src/iconDictionary/ChevronDown.d.ts +1 -1
- package/dist/src/iconDictionary/ChevronUp.d.ts +1 -1
- package/dist/src/iconDictionary/Close.d.ts +1 -1
- package/dist/src/iconDictionary/CloseCircleFilled.d.ts +1 -1
- package/dist/src/iconDictionary/Copy.d.ts +1 -1
- package/dist/src/iconDictionary/Delete.d.ts +1 -1
- package/dist/src/iconDictionary/Download.d.ts +1 -1
- package/dist/src/iconDictionary/DragHandle.d.ts +1 -1
- package/dist/src/iconDictionary/Edit.d.ts +1 -1
- package/dist/src/iconDictionary/ExternalLink.d.ts +1 -1
- package/dist/src/iconDictionary/Eye.d.ts +1 -1
- package/dist/src/iconDictionary/EyeOff.d.ts +1 -1
- package/dist/src/iconDictionary/Filter.d.ts +1 -1
- package/dist/src/iconDictionary/Globe.d.ts +1 -1
- package/dist/src/iconDictionary/Home.d.ts +1 -1
- package/dist/src/iconDictionary/InformationCircle.d.ts +1 -1
- package/dist/src/iconDictionary/InformationCircleFilled.d.ts +1 -1
- package/dist/src/iconDictionary/Notification.d.ts +1 -1
- package/dist/src/iconDictionary/OverflowVertical.d.ts +1 -1
- package/dist/src/iconDictionary/QuestionCircle.d.ts +1 -1
- package/dist/src/iconDictionary/QuestionCircleFilled.d.ts +1 -1
- package/dist/src/iconDictionary/Search.d.ts +1 -1
- package/dist/src/iconDictionary/Settings.d.ts +1 -1
- package/dist/src/iconDictionary/Subtract.d.ts +1 -1
- package/dist/src/iconDictionary/User.d.ts +1 -1
- package/dist/src/iconDictionary/UserGroup.d.ts +1 -1
- package/dist/src/iconDictionary/index.d.ts +40 -40
- package/dist/src/index.d.ts +13 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/src/theme/components.types.d.ts +0 -8
- package/dist/src/theme/components.types.d.ts.map +1 -1
- package/dist/theme/components.js +217 -124
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/components.types.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Autocomplete.tsx +132 -0
- package/src/Banner.tsx +2 -2
- package/src/Button.tsx +75 -0
- package/src/CheckboxGroup.tsx +2 -2
- package/src/CircularProgress.tsx +24 -0
- package/src/Field.tsx +112 -0
- package/src/FieldError.tsx +34 -0
- package/src/FieldHint.tsx +28 -0
- package/src/FieldLabel.tsx +57 -0
- package/src/Infobox.tsx +2 -2
- package/src/MenuButton.tsx +2 -3
- package/src/MenuItem.tsx +0 -1
- package/src/OdysseyCacheProvider.test.tsx +1 -1
- package/src/PasswordField.tsx +174 -0
- package/src/RadioGroup.tsx +2 -2
- package/src/ScreenReaderText.tsx +36 -0
- package/src/SearchField.tsx +136 -0
- package/src/Tag.tsx +41 -0
- package/src/TagList.tsx +43 -0
- package/src/TagListContext.tsx +23 -0
- package/src/TextField.tsx +43 -101
- package/src/index.ts +11 -5
- package/src/theme/components.tsx +87 -18
- package/src/theme/components.types.ts +0 -8
- package/dist/PasswordInput.js +0 -87
- package/dist/PasswordInput.js.map +0 -1
- package/dist/src/PasswordInput.d.ts +0 -21
- package/dist/src/PasswordInput.d.ts.map +0 -1
- package/src/PasswordInput.test.tsx +0 -51
- package/src/PasswordInput.tsx +0 -111
package/src/index.ts
CHANGED
|
@@ -14,9 +14,7 @@ export {
|
|
|
14
14
|
Alert,
|
|
15
15
|
AlertTitle,
|
|
16
16
|
Box,
|
|
17
|
-
Button,
|
|
18
17
|
Chip,
|
|
19
|
-
CircularProgress,
|
|
20
18
|
createTheme,
|
|
21
19
|
CssBaseline,
|
|
22
20
|
Dialog,
|
|
@@ -67,9 +65,7 @@ export type {
|
|
|
67
65
|
AlertProps,
|
|
68
66
|
AlertTitleProps,
|
|
69
67
|
BoxProps,
|
|
70
|
-
ButtonProps,
|
|
71
68
|
ChipProps,
|
|
72
|
-
CircularProgressProps,
|
|
73
69
|
CssBaselineProps,
|
|
74
70
|
DialogProps,
|
|
75
71
|
DialogActionsProps,
|
|
@@ -124,10 +120,16 @@ export { default as FavoriteIcon } from "@mui/icons-material/Favorite";
|
|
|
124
120
|
|
|
125
121
|
export { deepmerge, visuallyHidden } from "@mui/utils";
|
|
126
122
|
|
|
123
|
+
export * from "./Autocomplete";
|
|
127
124
|
export * from "./Banner";
|
|
125
|
+
export * from "./Button";
|
|
128
126
|
export * from "./Checkbox";
|
|
129
127
|
export * from "./CheckboxGroup";
|
|
128
|
+
export * from "./CircularProgress";
|
|
130
129
|
export * from "./createUniqueId";
|
|
130
|
+
export * from "./FieldError";
|
|
131
|
+
export * from "./FieldHint";
|
|
132
|
+
export * from "./FieldLabel";
|
|
131
133
|
export * from "./Icon";
|
|
132
134
|
export * from "./iconDictionary";
|
|
133
135
|
export * from "./Infobox";
|
|
@@ -136,10 +138,14 @@ export * from "./MenuButton";
|
|
|
136
138
|
export * from "./MenuItem";
|
|
137
139
|
export * from "./OdysseyCacheProvider";
|
|
138
140
|
export * from "./OdysseyThemeProvider";
|
|
139
|
-
export * from "./
|
|
141
|
+
export * from "./PasswordField";
|
|
140
142
|
export * from "./Radio";
|
|
141
143
|
export * from "./RadioGroup";
|
|
144
|
+
export * from "./ScreenReaderText";
|
|
145
|
+
export * from "./SearchField";
|
|
142
146
|
export * from "./Status";
|
|
147
|
+
export * from "./Tag";
|
|
148
|
+
export * from "./TagList";
|
|
143
149
|
export * from "./TextField";
|
|
144
150
|
export * from "./theme";
|
|
145
151
|
export * from "./ThemeProvider";
|
package/src/theme/components.tsx
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
CheckCircleFilledIcon,
|
|
37
37
|
ChevronDownIcon,
|
|
38
38
|
CloseCircleFilledIcon,
|
|
39
|
+
CloseIcon,
|
|
39
40
|
InformationCircleFilledIcon,
|
|
40
41
|
SubtractIcon,
|
|
41
42
|
} from "../iconDictionary";
|
|
@@ -144,6 +145,68 @@ export const components: ThemeOptions["components"] = {
|
|
|
144
145
|
}),
|
|
145
146
|
},
|
|
146
147
|
},
|
|
148
|
+
MuiAutocomplete: {
|
|
149
|
+
defaultProps: {
|
|
150
|
+
autoHighlight: true,
|
|
151
|
+
autoSelect: false,
|
|
152
|
+
blurOnSelect: false,
|
|
153
|
+
clearIcon: <CloseIcon />,
|
|
154
|
+
clearOnEscape: true,
|
|
155
|
+
disableClearable: false,
|
|
156
|
+
disabledItemsFocusable: false,
|
|
157
|
+
disableListWrap: false,
|
|
158
|
+
disablePortal: false,
|
|
159
|
+
filterSelectedOptions: false,
|
|
160
|
+
fullWidth: false,
|
|
161
|
+
handleHomeEndKeys: true,
|
|
162
|
+
includeInputInList: true,
|
|
163
|
+
limitTags: -1,
|
|
164
|
+
openOnFocus: false,
|
|
165
|
+
popupIcon: <ChevronDownIcon />,
|
|
166
|
+
selectOnFocus: true,
|
|
167
|
+
},
|
|
168
|
+
styleOverrides: {
|
|
169
|
+
clearIndicator: ({ theme }) => ({
|
|
170
|
+
marginRight: "unset",
|
|
171
|
+
padding: theme.spacing(1),
|
|
172
|
+
}),
|
|
173
|
+
endAdornment: ({ theme, ownerState }) => ({
|
|
174
|
+
display: "flex",
|
|
175
|
+
gap: theme.spacing(1),
|
|
176
|
+
top: `calc(${theme.spacing(2)} - ${theme.mixins.borderWidth})`,
|
|
177
|
+
right: theme.spacing(2),
|
|
178
|
+
maxHeight: "unset",
|
|
179
|
+
alignItems: "center",
|
|
180
|
+
whiteSpace: "nowrap",
|
|
181
|
+
color: theme.palette.action.active,
|
|
182
|
+
|
|
183
|
+
...(ownerState.disabled === true && {
|
|
184
|
+
display: "none",
|
|
185
|
+
}),
|
|
186
|
+
|
|
187
|
+
...(ownerState.readOnly === true && {
|
|
188
|
+
display: "none",
|
|
189
|
+
}),
|
|
190
|
+
}),
|
|
191
|
+
loading: ({ theme }) => ({
|
|
192
|
+
paddingBlock: theme.spacing(3),
|
|
193
|
+
paddingInline: theme.spacing(4),
|
|
194
|
+
}),
|
|
195
|
+
popupIndicator: ({ theme }) => ({
|
|
196
|
+
padding: theme.spacing(1),
|
|
197
|
+
marginRight: "unset",
|
|
198
|
+
}),
|
|
199
|
+
inputRoot: ({ theme, ownerState }) => ({
|
|
200
|
+
...(ownerState.readOnly === true && {
|
|
201
|
+
backgroundColor: theme.palette.grey[50],
|
|
202
|
+
|
|
203
|
+
[`&:not(:hover)`]: {
|
|
204
|
+
borderColor: "transparent",
|
|
205
|
+
},
|
|
206
|
+
}),
|
|
207
|
+
}),
|
|
208
|
+
},
|
|
209
|
+
},
|
|
147
210
|
MuiBackdrop: {
|
|
148
211
|
styleOverrides: {
|
|
149
212
|
root: ({ ownerState }) => ({
|
|
@@ -255,7 +318,7 @@ export const components: ThemeOptions["components"] = {
|
|
|
255
318
|
}),
|
|
256
319
|
},
|
|
257
320
|
{
|
|
258
|
-
props: { size: "
|
|
321
|
+
props: { size: "small" },
|
|
259
322
|
style: ({ theme }) => ({
|
|
260
323
|
paddingBlock: `calc(${theme.spacing(2)} - 1px)`,
|
|
261
324
|
paddingInline: `calc(${theme.spacing(2)} - 1px)`,
|
|
@@ -263,7 +326,7 @@ export const components: ThemeOptions["components"] = {
|
|
|
263
326
|
}),
|
|
264
327
|
},
|
|
265
328
|
{
|
|
266
|
-
props: { size: "
|
|
329
|
+
props: { size: "large" },
|
|
267
330
|
style: ({ theme }) => ({
|
|
268
331
|
paddingBlock: `calc(${theme.spacing(4)} - 1px)`,
|
|
269
332
|
paddingInline: `calc(${theme.spacing(4)} - 1px)`,
|
|
@@ -468,19 +531,6 @@ export const components: ThemeOptions["components"] = {
|
|
|
468
531
|
paddingInlineEnd: theme.spacing(2),
|
|
469
532
|
}),
|
|
470
533
|
|
|
471
|
-
[`& .${chipClasses.deleteIcon}`]: {
|
|
472
|
-
WebkitTapHighlightColor: "transparent",
|
|
473
|
-
color: theme.palette.text.secondary,
|
|
474
|
-
fontSize: "1em",
|
|
475
|
-
cursor: "pointer",
|
|
476
|
-
margin: "0",
|
|
477
|
-
marginInlineStart: theme.spacing(2),
|
|
478
|
-
|
|
479
|
-
"&:hover": {
|
|
480
|
-
color: theme.palette.text.primary,
|
|
481
|
-
},
|
|
482
|
-
},
|
|
483
|
-
|
|
484
534
|
[`&.${chipClasses.disabled}`]: {
|
|
485
535
|
opacity: 1,
|
|
486
536
|
pointerEvents: "none",
|
|
@@ -539,10 +589,32 @@ export const components: ThemeOptions["components"] = {
|
|
|
539
589
|
},
|
|
540
590
|
},
|
|
541
591
|
}),
|
|
592
|
+
|
|
593
|
+
[`.${inputBaseClasses.root}.${inputBaseClasses.disabled} &`]: {
|
|
594
|
+
backgroundColor: theme.palette.grey[200],
|
|
595
|
+
},
|
|
542
596
|
}),
|
|
597
|
+
|
|
543
598
|
label: {
|
|
544
599
|
padding: 0,
|
|
545
600
|
},
|
|
601
|
+
|
|
602
|
+
deleteIcon: ({ theme }) => ({
|
|
603
|
+
WebkitTapHighlightColor: "transparent",
|
|
604
|
+
color: theme.palette.text.secondary,
|
|
605
|
+
fontSize: "1em",
|
|
606
|
+
cursor: "pointer",
|
|
607
|
+
margin: "0",
|
|
608
|
+
marginInlineStart: theme.spacing(2),
|
|
609
|
+
|
|
610
|
+
"&:hover": {
|
|
611
|
+
color: theme.palette.text.primary,
|
|
612
|
+
},
|
|
613
|
+
|
|
614
|
+
[`.${inputBaseClasses.root}.${inputBaseClasses.disabled} &`]: {
|
|
615
|
+
display: "none",
|
|
616
|
+
},
|
|
617
|
+
}),
|
|
546
618
|
},
|
|
547
619
|
},
|
|
548
620
|
MuiCircularProgress: {
|
|
@@ -1112,9 +1184,6 @@ export const components: ThemeOptions["components"] = {
|
|
|
1112
1184
|
},
|
|
1113
1185
|
},
|
|
1114
1186
|
MuiInputAdornment: {
|
|
1115
|
-
defaultProps: {
|
|
1116
|
-
variant: "outlined",
|
|
1117
|
-
},
|
|
1118
1187
|
styleOverrides: {
|
|
1119
1188
|
root: ({ theme, ownerState }) => ({
|
|
1120
1189
|
display: "flex",
|
|
@@ -33,14 +33,6 @@ declare module "@mui/material/Button" {
|
|
|
33
33
|
contained: false;
|
|
34
34
|
outlined: false;
|
|
35
35
|
}
|
|
36
|
-
interface ButtonPropsSizeOverrides {
|
|
37
|
-
s: true;
|
|
38
|
-
m: true;
|
|
39
|
-
l: true;
|
|
40
|
-
small: false;
|
|
41
|
-
medium: false;
|
|
42
|
-
large: false;
|
|
43
|
-
}
|
|
44
36
|
interface ButtonPropsColorOverrides {
|
|
45
37
|
inherit: false;
|
|
46
38
|
primary: false;
|
package/dist/PasswordInput.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import _Box from "@mui/material/Box";
|
|
2
|
-
import _OutlinedInput from "@mui/material/OutlinedInput";
|
|
3
|
-
import _InputAdornment from "@mui/material/InputAdornment";
|
|
4
|
-
import _Tooltip from "@mui/material/Tooltip";
|
|
5
|
-
import _IconButton from "@mui/material/IconButton";
|
|
6
|
-
import _Visibility from "@mui/icons-material/Visibility";
|
|
7
|
-
import _VisibilityOff from "@mui/icons-material/VisibilityOff";
|
|
8
|
-
import _InputLabel from "@mui/material/InputLabel";
|
|
9
|
-
|
|
10
|
-
/*!
|
|
11
|
-
* Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
12
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
13
|
-
*
|
|
14
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
17
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
*
|
|
19
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
import { forwardRef, useState, useMemo } from "react";
|
|
22
|
-
import { useUniqueId } from "./useUniqueId.js";
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
-
export const PasswordInput = forwardRef((props, ref) => {
|
|
26
|
-
const {
|
|
27
|
-
tooltipLabel,
|
|
28
|
-
id,
|
|
29
|
-
label,
|
|
30
|
-
defaultValue: password = "",
|
|
31
|
-
inputProps,
|
|
32
|
-
...rest
|
|
33
|
-
} = props;
|
|
34
|
-
const [values, setValues] = useState({
|
|
35
|
-
password,
|
|
36
|
-
showPassword: false
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const handlePasswordChange = event => {
|
|
40
|
-
setValues({ ...values,
|
|
41
|
-
password: event.target.value
|
|
42
|
-
});
|
|
43
|
-
props.onChange?.(event);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const handleClickShowPassword = () => {
|
|
47
|
-
setValues({ ...values,
|
|
48
|
-
showPassword: !values.showPassword
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const handleMouseDownPassword = event => {
|
|
53
|
-
event.preventDefault();
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const tooltipTitle = useMemo(() => {
|
|
57
|
-
return typeof tooltipLabel === "function" ? tooltipLabel(values.showPassword === false) : tooltipLabel;
|
|
58
|
-
}, [values, tooltipLabel]);
|
|
59
|
-
const uniqueId = useUniqueId(id);
|
|
60
|
-
return _jsxs(_Box, {
|
|
61
|
-
children: [_jsx(_InputLabel, {
|
|
62
|
-
htmlFor: uniqueId,
|
|
63
|
-
children: label
|
|
64
|
-
}), _jsx(_OutlinedInput, { ...rest,
|
|
65
|
-
id: uniqueId,
|
|
66
|
-
inputProps: inputProps,
|
|
67
|
-
inputRef: ref,
|
|
68
|
-
onChange: handlePasswordChange,
|
|
69
|
-
type: values.showPassword ? "text" : "password",
|
|
70
|
-
value: values.password,
|
|
71
|
-
endAdornment: _jsx(_InputAdornment, {
|
|
72
|
-
position: "end",
|
|
73
|
-
children: _jsx(_Tooltip, {
|
|
74
|
-
title: tooltipTitle,
|
|
75
|
-
children: _jsx(_IconButton, {
|
|
76
|
-
"aria-label": "toggle password visibility",
|
|
77
|
-
onClick: handleClickShowPassword,
|
|
78
|
-
onMouseDown: handleMouseDownPassword,
|
|
79
|
-
edge: "end",
|
|
80
|
-
children: values.showPassword ? _jsx(_VisibilityOff, {}) : _jsx(_Visibility, {})
|
|
81
|
-
})
|
|
82
|
-
})
|
|
83
|
-
})
|
|
84
|
-
})]
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
//# sourceMappingURL=PasswordInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordInput.js","names":["forwardRef","useState","useMemo","useUniqueId","PasswordInput","props","ref","tooltipLabel","id","label","defaultValue","password","inputProps","rest","values","setValues","showPassword","handlePasswordChange","event","target","value","onChange","handleClickShowPassword","handleMouseDownPassword","preventDefault","tooltipTitle","uniqueId"],"sources":["../src/PasswordInput.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { forwardRef, useState, useMemo } from \"react\";\nimport type { Ref, ChangeEvent, MouseEvent } from \"react\";\nimport type { OutlinedInputProps, TooltipProps } from \"@mui/material\";\nimport {\n Tooltip,\n IconButton,\n Box,\n InputLabel,\n OutlinedInput,\n InputAdornment,\n} from \"@mui/material\";\nimport { Visibility, VisibilityOff } from \"@mui/icons-material\";\nimport { useUniqueId } from \"./useUniqueId\";\n\ninterface State {\n password: string;\n showPassword: boolean;\n}\n\nexport interface PasswordInputProps\n extends Omit<OutlinedInputProps, \"type\" | \"label\" | \"defaultValue\" | \"ref\"> {\n ref?: Ref<HTMLInputElement>;\n defaultValue?: string;\n label: string;\n tooltipLabel?:\n | TooltipProps[\"title\"]\n | ((isHidden: boolean) => TooltipProps[\"title\"]);\n}\n\nexport const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(\n (props, ref) => {\n const {\n tooltipLabel,\n id,\n label,\n defaultValue: password = \"\",\n inputProps,\n ...rest\n } = props;\n\n const [values, setValues] = useState<State>({\n password,\n showPassword: false,\n });\n\n const handlePasswordChange = (event: ChangeEvent<HTMLInputElement>) => {\n setValues({ ...values, password: event.target.value });\n props.onChange?.(event);\n };\n\n const handleClickShowPassword = () => {\n setValues({\n ...values,\n showPassword: !values.showPassword,\n });\n };\n\n const handleMouseDownPassword = (event: MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n };\n\n const tooltipTitle = useMemo(() => {\n return typeof tooltipLabel === \"function\"\n ? tooltipLabel(values.showPassword === false)\n : tooltipLabel;\n }, [values, tooltipLabel]);\n\n const uniqueId = useUniqueId(id);\n\n return (\n <Box>\n <InputLabel htmlFor={uniqueId}>{label}</InputLabel>\n <OutlinedInput\n {...rest}\n id={uniqueId}\n inputProps={inputProps}\n inputRef={ref}\n onChange={handlePasswordChange}\n type={values.showPassword ? \"text\" : \"password\"}\n value={values.password}\n endAdornment={\n <InputAdornment position=\"end\">\n <Tooltip title={tooltipTitle}>\n <IconButton\n aria-label=\"toggle password visibility\"\n onClick={handleClickShowPassword}\n onMouseDown={handleMouseDownPassword}\n edge=\"end\"\n >\n {values.showPassword ? <VisibilityOff /> : <Visibility />}\n </IconButton>\n </Tooltip>\n </InputAdornment>\n }\n />\n </Box>\n );\n }\n);\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,UAAT,EAAqBC,QAArB,EAA+BC,OAA/B,QAA8C,OAA9C;SAYSC,W;;;AAiBT,OAAO,MAAMC,aAAa,GAAGJ,UAAU,CACrC,CAACK,KAAD,EAAQC,GAAR,KAAgB;EACd,MAAM;IACJC,YADI;IAEJC,EAFI;IAGJC,KAHI;IAIJC,YAAY,EAAEC,QAAQ,GAAG,EAJrB;IAKJC,UALI;IAMJ,GAAGC;EANC,IAOFR,KAPJ;EASA,MAAM,CAACS,MAAD,EAASC,SAAT,IAAsBd,QAAQ,CAAQ;IAC1CU,QAD0C;IAE1CK,YAAY,EAAE;EAF4B,CAAR,CAApC;;EAKA,MAAMC,oBAAoB,GAAIC,KAAD,IAA0C;IACrEH,SAAS,CAAC,EAAE,GAAGD,MAAL;MAAaH,QAAQ,EAAEO,KAAK,CAACC,MAAN,CAAaC;IAApC,CAAD,CAAT;IACAf,KAAK,CAACgB,QAAN,GAAiBH,KAAjB;EACD,CAHD;;EAKA,MAAMI,uBAAuB,GAAG,MAAM;IACpCP,SAAS,CAAC,EACR,GAAGD,MADK;MAERE,YAAY,EAAE,CAACF,MAAM,CAACE;IAFd,CAAD,CAAT;EAID,CALD;;EAOA,MAAMO,uBAAuB,GAAIL,KAAD,IAA0C;IACxEA,KAAK,CAACM,cAAN;EACD,CAFD;;EAIA,MAAMC,YAAY,GAAGvB,OAAO,CAAC,MAAM;IACjC,OAAO,OAAOK,YAAP,KAAwB,UAAxB,GACHA,YAAY,CAACO,MAAM,CAACE,YAAP,KAAwB,KAAzB,CADT,GAEHT,YAFJ;EAGD,CAJ2B,EAIzB,CAACO,MAAD,EAASP,YAAT,CAJyB,CAA5B;EAMA,MAAMmB,QAAQ,GAAGvB,WAAW,CAACK,EAAD,CAA5B;EAEA,OACE;IAAA,WACE;MAAY,OAAO,EAAEkB,QAArB;MAAA,UAAgCjB;IAAhC,EADF,EAEE,0BACMI,IADN;MAEE,EAAE,EAAEa,QAFN;MAGE,UAAU,EAAEd,UAHd;MAIE,QAAQ,EAAEN,GAJZ;MAKE,QAAQ,EAAEW,oBALZ;MAME,IAAI,EAAEH,MAAM,CAACE,YAAP,GAAsB,MAAtB,GAA+B,UANvC;MAOE,KAAK,EAAEF,MAAM,CAACH,QAPhB;MAQE,YAAY,EACV;QAAgB,QAAQ,EAAC,KAAzB;QAAA,UACE;UAAS,KAAK,EAAEc,YAAhB;UAAA,UACE;YACE,cAAW,4BADb;YAEE,OAAO,EAAEH,uBAFX;YAGE,WAAW,EAAEC,uBAHf;YAIE,IAAI,EAAC,KAJP;YAAA,UAMGT,MAAM,CAACE,YAAP,GAAsB,wBAAtB,GAA0C;UAN7C;QADF;MADF;IATJ,EAFF;EAAA,EADF;AA4BD,CApEoC,CAAhC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
-
*
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
-
*
|
|
10
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import type { Ref } from "react";
|
|
13
|
-
import type { OutlinedInputProps, TooltipProps } from "@mui/material";
|
|
14
|
-
export interface PasswordInputProps extends Omit<OutlinedInputProps, "type" | "label" | "defaultValue" | "ref"> {
|
|
15
|
-
ref?: Ref<HTMLInputElement>;
|
|
16
|
-
defaultValue?: string;
|
|
17
|
-
label: string;
|
|
18
|
-
tooltipLabel?: TooltipProps["title"] | ((isHidden: boolean) => TooltipProps["title"]);
|
|
19
|
-
}
|
|
20
|
-
export declare const PasswordInput: import("react").ForwardRefExoticComponent<Pick<PasswordInputProps, "label" | "name" | "onChange" | "value" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "sx" | "autoFocus" | "inputProps" | "inputRef" | "readOnly" | "required" | "error" | "fullWidth" | "margin" | "size" | "autoComplete" | "rows" | "slotProps" | "slots" | "components" | "componentsProps" | "disableInjectingGlobalStyles" | "endAdornment" | "inputComponent" | "multiline" | "renderSuffix" | "maxRows" | "minRows" | "startAdornment" | "notched" | "tooltipLabel"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
21
|
-
//# sourceMappingURL=PasswordInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordInput.d.ts","sourceRoot":"","sources":["../../src/PasswordInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,GAAG,EAA2B,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAiBtE,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,KAAK,CAAC;IAC3E,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EACT,YAAY,CAAC,OAAO,CAAC,GACrB,CAAC,CAAC,QAAQ,EAAE,OAAO,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,aAAa,sgKAqEzB,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
-
*
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
-
*
|
|
10
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { render, screen } from "@testing-library/react";
|
|
14
|
-
|
|
15
|
-
import { a11yCheck } from "./a11yCheck";
|
|
16
|
-
import { PasswordInput } from "./PasswordInput";
|
|
17
|
-
|
|
18
|
-
const label = "Password";
|
|
19
|
-
const tooltipOnLabel = "Show password";
|
|
20
|
-
const tooltipOffLabel = "Hide password";
|
|
21
|
-
|
|
22
|
-
describe("PasswordInput", () => {
|
|
23
|
-
it("renders into the document", () => {
|
|
24
|
-
render(<PasswordInput label={label} tooltipLabel={tooltipOnLabel} />);
|
|
25
|
-
expect(screen.getByLabelText(label)).toBeVisible();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("has a button that changes the type when clicked", () => {
|
|
29
|
-
const tooltipLabel = (isHidden: boolean) => {
|
|
30
|
-
return isHidden ? tooltipOnLabel : tooltipOffLabel;
|
|
31
|
-
};
|
|
32
|
-
render(
|
|
33
|
-
<PasswordInput
|
|
34
|
-
label={label}
|
|
35
|
-
tooltipLabel={tooltipLabel}
|
|
36
|
-
defaultValue="Imma password"
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
const inputElement = screen.getByLabelText(label);
|
|
40
|
-
expect(inputElement).toHaveValue("Imma password");
|
|
41
|
-
expect(inputElement).toHaveAttribute("type", "password");
|
|
42
|
-
const eyeButton = screen.getByRole("button");
|
|
43
|
-
expect(eyeButton).toBeInTheDocument();
|
|
44
|
-
eyeButton.click();
|
|
45
|
-
expect(inputElement).toHaveAttribute("type", "text");
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
a11yCheck(() =>
|
|
49
|
-
render(<PasswordInput label="input label" tooltipLabel="tooltip label" />)
|
|
50
|
-
);
|
|
51
|
-
});
|
package/src/PasswordInput.tsx
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
-
*
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
-
*
|
|
10
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { forwardRef, useState, useMemo } from "react";
|
|
14
|
-
import type { Ref, ChangeEvent, MouseEvent } from "react";
|
|
15
|
-
import type { OutlinedInputProps, TooltipProps } from "@mui/material";
|
|
16
|
-
import {
|
|
17
|
-
Tooltip,
|
|
18
|
-
IconButton,
|
|
19
|
-
Box,
|
|
20
|
-
InputLabel,
|
|
21
|
-
OutlinedInput,
|
|
22
|
-
InputAdornment,
|
|
23
|
-
} from "@mui/material";
|
|
24
|
-
import { Visibility, VisibilityOff } from "@mui/icons-material";
|
|
25
|
-
import { useUniqueId } from "./useUniqueId";
|
|
26
|
-
|
|
27
|
-
interface State {
|
|
28
|
-
password: string;
|
|
29
|
-
showPassword: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface PasswordInputProps
|
|
33
|
-
extends Omit<OutlinedInputProps, "type" | "label" | "defaultValue" | "ref"> {
|
|
34
|
-
ref?: Ref<HTMLInputElement>;
|
|
35
|
-
defaultValue?: string;
|
|
36
|
-
label: string;
|
|
37
|
-
tooltipLabel?:
|
|
38
|
-
| TooltipProps["title"]
|
|
39
|
-
| ((isHidden: boolean) => TooltipProps["title"]);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
|
|
43
|
-
(props, ref) => {
|
|
44
|
-
const {
|
|
45
|
-
tooltipLabel,
|
|
46
|
-
id,
|
|
47
|
-
label,
|
|
48
|
-
defaultValue: password = "",
|
|
49
|
-
inputProps,
|
|
50
|
-
...rest
|
|
51
|
-
} = props;
|
|
52
|
-
|
|
53
|
-
const [values, setValues] = useState<State>({
|
|
54
|
-
password,
|
|
55
|
-
showPassword: false,
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const handlePasswordChange = (event: ChangeEvent<HTMLInputElement>) => {
|
|
59
|
-
setValues({ ...values, password: event.target.value });
|
|
60
|
-
props.onChange?.(event);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const handleClickShowPassword = () => {
|
|
64
|
-
setValues({
|
|
65
|
-
...values,
|
|
66
|
-
showPassword: !values.showPassword,
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const handleMouseDownPassword = (event: MouseEvent<HTMLButtonElement>) => {
|
|
71
|
-
event.preventDefault();
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const tooltipTitle = useMemo(() => {
|
|
75
|
-
return typeof tooltipLabel === "function"
|
|
76
|
-
? tooltipLabel(values.showPassword === false)
|
|
77
|
-
: tooltipLabel;
|
|
78
|
-
}, [values, tooltipLabel]);
|
|
79
|
-
|
|
80
|
-
const uniqueId = useUniqueId(id);
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<Box>
|
|
84
|
-
<InputLabel htmlFor={uniqueId}>{label}</InputLabel>
|
|
85
|
-
<OutlinedInput
|
|
86
|
-
{...rest}
|
|
87
|
-
id={uniqueId}
|
|
88
|
-
inputProps={inputProps}
|
|
89
|
-
inputRef={ref}
|
|
90
|
-
onChange={handlePasswordChange}
|
|
91
|
-
type={values.showPassword ? "text" : "password"}
|
|
92
|
-
value={values.password}
|
|
93
|
-
endAdornment={
|
|
94
|
-
<InputAdornment position="end">
|
|
95
|
-
<Tooltip title={tooltipTitle}>
|
|
96
|
-
<IconButton
|
|
97
|
-
aria-label="toggle password visibility"
|
|
98
|
-
onClick={handleClickShowPassword}
|
|
99
|
-
onMouseDown={handleMouseDownPassword}
|
|
100
|
-
edge="end"
|
|
101
|
-
>
|
|
102
|
-
{values.showPassword ? <VisibilityOff /> : <Visibility />}
|
|
103
|
-
</IconButton>
|
|
104
|
-
</Tooltip>
|
|
105
|
-
</InputAdornment>
|
|
106
|
-
}
|
|
107
|
-
/>
|
|
108
|
-
</Box>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
);
|