@decisiv/ui-components 2.0.1-alpha.148 → 2.0.1-alpha.149
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PasswordField/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAEZ,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PasswordField/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAEZ,sBAAsB,EAMvB,MAAM,OAAO,CAAC;AAGf,OAAmB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AASzE,oBAAY,YAAY,GAAG,gBAAgB,CAAC;AAE5C,MAAM,WAAW,kBACf,SAAQ,IAAI,CACR,KAAK,CAAC,mBAAmB,CAAC,YAAY,CAAC,EACvC,MAAM,GAAG,UAAU,GAAG,OAAO,CAC9B,EACD,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,SAAS,CAAC;IACnD,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAClD,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClC,SAAS,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC;IACvC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAmED,QAAA,MAAM,oBAAoB,EAAE,sBAAsB,CAChD,YAAY,EACZ,kBAAkB,CACS,CAAC;AAQ9B,eAAe,oBAAoB,CAAC"}
|
|
@@ -9,6 +9,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
+
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
|
13
|
+
|
|
12
14
|
var _InputField = _interopRequireDefault(require("../../atoms/InputField"));
|
|
13
15
|
|
|
14
16
|
var _Flex = _interopRequireDefault(require("../Flex"));
|
|
@@ -57,10 +59,25 @@ function PasswordField(_ref, ref) {
|
|
|
57
59
|
setShowPassword = _useState2[1];
|
|
58
60
|
|
|
59
61
|
var translate = (0, _useTranslations.default)();
|
|
62
|
+
var inputRef = (0, _react.useRef)(null);
|
|
60
63
|
var handleClick = (0, _react.useCallback)(function () {
|
|
61
64
|
setShowPassword(!showPassword);
|
|
62
65
|
}, [showPassword, setShowPassword]);
|
|
63
|
-
var inputType = showPassword ? 'text' : 'password';
|
|
66
|
+
var inputType = showPassword ? 'text' : 'password'; // Moving cursor to the end after re-rendering input because of `type`
|
|
67
|
+
|
|
68
|
+
(0, _react.useEffect)(function () {
|
|
69
|
+
if (!(0, _isNil.default)(inputRef) && !(0, _isNil.default)(inputRef.current)) {
|
|
70
|
+
inputRef.current.selectionStart = inputRef.current.value.length;
|
|
71
|
+
inputRef.current.selectionEnd = inputRef.current.value.length;
|
|
72
|
+
}
|
|
73
|
+
}, [inputType]);
|
|
74
|
+
var setInputRef = (0, _react.useCallback)(function (propRef) {
|
|
75
|
+
return function (element) {
|
|
76
|
+
inputRef.current = element; // eslint-disable-next-line no-param-reassign
|
|
77
|
+
|
|
78
|
+
propRef.current = element;
|
|
79
|
+
};
|
|
80
|
+
}, []);
|
|
64
81
|
return _react.default.createElement(_InputField.default, _extends({}, props, {
|
|
65
82
|
disabled: disabled,
|
|
66
83
|
label: translate(undefined, 'passwordField.password'),
|
|
@@ -77,6 +94,7 @@ function PasswordField(_ref, ref) {
|
|
|
77
94
|
flexDirection: "row",
|
|
78
95
|
flex: 1
|
|
79
96
|
}, _react.default.createElement(_Input.default, _extends({}, p, {
|
|
97
|
+
ref: setInputRef(p.ref),
|
|
80
98
|
role: "password",
|
|
81
99
|
passwordVisible: showPassword,
|
|
82
100
|
hideLabel: hideLabel,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decisiv/ui-components",
|
|
3
|
-
"version": "2.0.1-alpha.
|
|
3
|
+
"version": "2.0.1-alpha.149+fe24813",
|
|
4
4
|
"description": "Decisiv's design system React components",
|
|
5
5
|
"author": "Decisiv UI Development Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"private": false,
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "fe24813f50d912454a38553db03a7b180c70d0a3"
|
|
75
75
|
}
|