@commercetools-uikit/password-field 19.20.1 → 19.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.
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
6
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
7
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
8
|
var _pt = require('prop-types');
|
|
8
9
|
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
9
10
|
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
@@ -65,6 +66,7 @@ var messages = reactIntl.defineMessages({
|
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
|
|
69
|
+
const _excluded = ["horizontalConstraint", "renderShowHideButton"];
|
|
68
70
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
69
71
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
70
72
|
const sequentialId = utils.createSequentialId('password-field-');
|
|
@@ -79,11 +81,12 @@ const hasWarnings = warnings => {
|
|
|
79
81
|
var _context2;
|
|
80
82
|
return warnings && _someInstanceProperty__default["default"](_context2 = _Object$values__default["default"](warnings)).call(_context2, Boolean);
|
|
81
83
|
};
|
|
82
|
-
const
|
|
83
|
-
horizontalConstraint
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
const PasswordField = _ref => {
|
|
85
|
+
let _ref$horizontalConstr = _ref.horizontalConstraint,
|
|
86
|
+
horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
|
|
87
|
+
_ref$renderShowHideBu = _ref.renderShowHideButton,
|
|
88
|
+
renderShowHideButton = _ref$renderShowHideBu === void 0 ? true : _ref$renderShowHideBu,
|
|
89
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
87
90
|
const intl = reactIntl.useIntl();
|
|
88
91
|
const _useToggleState = hooks.useToggleState(false),
|
|
89
92
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
@@ -94,7 +97,7 @@ const PasswordField = props => {
|
|
|
94
97
|
const warningsContainerId = `${id}-warnings`;
|
|
95
98
|
const hasError = props.touched && hasErrors(props.errors);
|
|
96
99
|
const hasWarning = props.touched && hasWarnings(props.warnings);
|
|
97
|
-
const canInteract = !props.isDisabled && !props.isReadOnly &&
|
|
100
|
+
const canInteract = !props.isDisabled && !props.isReadOnly && renderShowHideButton;
|
|
98
101
|
if (!props.isReadOnly) {
|
|
99
102
|
process.env.NODE_ENV !== "production" ? utils.warning(Boolean(props.onChange), 'PasswordField: `onChange` is required when field is not read only.') : void 0;
|
|
100
103
|
}
|
|
@@ -102,7 +105,7 @@ const PasswordField = props => {
|
|
|
102
105
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof props.hint === 'string' || /*#__PURE__*/react.isValidElement(props.hint), 'PasswordField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
103
106
|
}
|
|
104
107
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
105
|
-
max:
|
|
108
|
+
max: horizontalConstraint,
|
|
106
109
|
children: jsxRuntime.jsxs(Stack__default["default"], {
|
|
107
110
|
scale: "xs",
|
|
108
111
|
children: [jsxRuntime.jsxs(Inline__default["default"], {
|
|
@@ -139,7 +142,10 @@ const PasswordField = props => {
|
|
|
139
142
|
placeholder: props.placeholder,
|
|
140
143
|
autoComplete: props.autoComplete,
|
|
141
144
|
horizontalConstraint: "scale"
|
|
142
|
-
}, utils.filterDataAttributes(
|
|
145
|
+
}, utils.filterDataAttributes(_objectSpread({
|
|
146
|
+
horizontalConstraint,
|
|
147
|
+
renderShowHideButton
|
|
148
|
+
}, props))), {}, {
|
|
143
149
|
/* ARIA */
|
|
144
150
|
"aria-invalid": hasError,
|
|
145
151
|
"aria-errormessage": errorsContainerId
|
|
@@ -185,7 +191,6 @@ PasswordField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
185
191
|
renderShowHideButton: _pt__default["default"].bool
|
|
186
192
|
} : {};
|
|
187
193
|
PasswordField.displayName = 'PasswordField';
|
|
188
|
-
PasswordField.defaultProps = defaultProps;
|
|
189
194
|
/**
|
|
190
195
|
* Use this function to convert the Formik `errors` object type to
|
|
191
196
|
* our custom field errors type.
|
|
@@ -197,7 +202,7 @@ PasswordField.toFieldErrors = function toFieldErrors(errors) {
|
|
|
197
202
|
var PasswordField$1 = PasswordField;
|
|
198
203
|
|
|
199
204
|
// NOTE: This string will be replaced on build time with the package version.
|
|
200
|
-
var version = "19.
|
|
205
|
+
var version = "19.22.0";
|
|
201
206
|
|
|
202
207
|
exports["default"] = PasswordField$1;
|
|
203
208
|
exports.version = version;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
6
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
7
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
8
|
require('prop-types');
|
|
8
9
|
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
|
|
9
10
|
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
@@ -64,6 +65,7 @@ var messages = reactIntl.defineMessages({
|
|
|
64
65
|
}
|
|
65
66
|
});
|
|
66
67
|
|
|
68
|
+
const _excluded = ["horizontalConstraint", "renderShowHideButton"];
|
|
67
69
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
68
70
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
69
71
|
const sequentialId = utils.createSequentialId('password-field-');
|
|
@@ -78,11 +80,12 @@ const hasWarnings = warnings => {
|
|
|
78
80
|
var _context2;
|
|
79
81
|
return warnings && _someInstanceProperty__default["default"](_context2 = _Object$values__default["default"](warnings)).call(_context2, Boolean);
|
|
80
82
|
};
|
|
81
|
-
const
|
|
82
|
-
horizontalConstraint
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
const PasswordField = _ref => {
|
|
84
|
+
let _ref$horizontalConstr = _ref.horizontalConstraint,
|
|
85
|
+
horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
|
|
86
|
+
_ref$renderShowHideBu = _ref.renderShowHideButton,
|
|
87
|
+
renderShowHideButton = _ref$renderShowHideBu === void 0 ? true : _ref$renderShowHideBu,
|
|
88
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
86
89
|
const intl = reactIntl.useIntl();
|
|
87
90
|
const _useToggleState = hooks.useToggleState(false),
|
|
88
91
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
@@ -93,11 +96,11 @@ const PasswordField = props => {
|
|
|
93
96
|
const warningsContainerId = `${id}-warnings`;
|
|
94
97
|
const hasError = props.touched && hasErrors(props.errors);
|
|
95
98
|
const hasWarning = props.touched && hasWarnings(props.warnings);
|
|
96
|
-
const canInteract = !props.isDisabled && !props.isReadOnly &&
|
|
99
|
+
const canInteract = !props.isDisabled && !props.isReadOnly && renderShowHideButton;
|
|
97
100
|
if (!props.isReadOnly) ;
|
|
98
101
|
if (props.hintIcon) ;
|
|
99
102
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
100
|
-
max:
|
|
103
|
+
max: horizontalConstraint,
|
|
101
104
|
children: jsxRuntime.jsxs(Stack__default["default"], {
|
|
102
105
|
scale: "xs",
|
|
103
106
|
children: [jsxRuntime.jsxs(Inline__default["default"], {
|
|
@@ -134,7 +137,10 @@ const PasswordField = props => {
|
|
|
134
137
|
placeholder: props.placeholder,
|
|
135
138
|
autoComplete: props.autoComplete,
|
|
136
139
|
horizontalConstraint: "scale"
|
|
137
|
-
}, utils.filterDataAttributes(
|
|
140
|
+
}, utils.filterDataAttributes(_objectSpread({
|
|
141
|
+
horizontalConstraint,
|
|
142
|
+
renderShowHideButton
|
|
143
|
+
}, props))), {}, {
|
|
138
144
|
/* ARIA */
|
|
139
145
|
"aria-invalid": hasError,
|
|
140
146
|
"aria-errormessage": errorsContainerId
|
|
@@ -154,7 +160,6 @@ const PasswordField = props => {
|
|
|
154
160
|
};
|
|
155
161
|
PasswordField.propTypes = {};
|
|
156
162
|
PasswordField.displayName = 'PasswordField';
|
|
157
|
-
PasswordField.defaultProps = defaultProps;
|
|
158
163
|
/**
|
|
159
164
|
* Use this function to convert the Formik `errors` object type to
|
|
160
165
|
* our custom field errors type.
|
|
@@ -166,7 +171,7 @@ PasswordField.toFieldErrors = function toFieldErrors(errors) {
|
|
|
166
171
|
var PasswordField$1 = PasswordField;
|
|
167
172
|
|
|
168
173
|
// NOTE: This string will be replaced on build time with the package version.
|
|
169
|
-
var version = "19.
|
|
174
|
+
var version = "19.22.0";
|
|
170
175
|
|
|
171
176
|
exports["default"] = PasswordField$1;
|
|
172
177
|
exports.version = version;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
2
2
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
3
4
|
import _pt from 'prop-types';
|
|
4
5
|
import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
|
|
5
6
|
import _Object$values from '@babel/runtime-corejs3/core-js-stable/object/values';
|
|
@@ -39,6 +40,7 @@ var messages = defineMessages({
|
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
42
|
|
|
43
|
+
const _excluded = ["horizontalConstraint", "renderShowHideButton"];
|
|
42
44
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
43
45
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
44
46
|
const sequentialId = createSequentialId('password-field-');
|
|
@@ -53,11 +55,12 @@ const hasWarnings = warnings => {
|
|
|
53
55
|
var _context2;
|
|
54
56
|
return warnings && _someInstanceProperty(_context2 = _Object$values(warnings)).call(_context2, Boolean);
|
|
55
57
|
};
|
|
56
|
-
const
|
|
57
|
-
horizontalConstraint
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
const PasswordField = _ref => {
|
|
59
|
+
let _ref$horizontalConstr = _ref.horizontalConstraint,
|
|
60
|
+
horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
|
|
61
|
+
_ref$renderShowHideBu = _ref.renderShowHideButton,
|
|
62
|
+
renderShowHideButton = _ref$renderShowHideBu === void 0 ? true : _ref$renderShowHideBu,
|
|
63
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
61
64
|
const intl = useIntl();
|
|
62
65
|
const _useToggleState = useToggleState(false),
|
|
63
66
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
@@ -68,7 +71,7 @@ const PasswordField = props => {
|
|
|
68
71
|
const warningsContainerId = `${id}-warnings`;
|
|
69
72
|
const hasError = props.touched && hasErrors(props.errors);
|
|
70
73
|
const hasWarning = props.touched && hasWarnings(props.warnings);
|
|
71
|
-
const canInteract = !props.isDisabled && !props.isReadOnly &&
|
|
74
|
+
const canInteract = !props.isDisabled && !props.isReadOnly && renderShowHideButton;
|
|
72
75
|
if (!props.isReadOnly) {
|
|
73
76
|
process.env.NODE_ENV !== "production" ? warning(Boolean(props.onChange), 'PasswordField: `onChange` is required when field is not read only.') : void 0;
|
|
74
77
|
}
|
|
@@ -76,7 +79,7 @@ const PasswordField = props => {
|
|
|
76
79
|
process.env.NODE_ENV !== "production" ? warning(typeof props.hint === 'string' || /*#__PURE__*/isValidElement(props.hint), 'PasswordField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
77
80
|
}
|
|
78
81
|
return jsx(Constraints.Horizontal, {
|
|
79
|
-
max:
|
|
82
|
+
max: horizontalConstraint,
|
|
80
83
|
children: jsxs(Stack, {
|
|
81
84
|
scale: "xs",
|
|
82
85
|
children: [jsxs(Inline, {
|
|
@@ -113,7 +116,10 @@ const PasswordField = props => {
|
|
|
113
116
|
placeholder: props.placeholder,
|
|
114
117
|
autoComplete: props.autoComplete,
|
|
115
118
|
horizontalConstraint: "scale"
|
|
116
|
-
}, filterDataAttributes(
|
|
119
|
+
}, filterDataAttributes(_objectSpread({
|
|
120
|
+
horizontalConstraint,
|
|
121
|
+
renderShowHideButton
|
|
122
|
+
}, props))), {}, {
|
|
117
123
|
/* ARIA */
|
|
118
124
|
"aria-invalid": hasError,
|
|
119
125
|
"aria-errormessage": errorsContainerId
|
|
@@ -159,7 +165,6 @@ PasswordField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
159
165
|
renderShowHideButton: _pt.bool
|
|
160
166
|
} : {};
|
|
161
167
|
PasswordField.displayName = 'PasswordField';
|
|
162
|
-
PasswordField.defaultProps = defaultProps;
|
|
163
168
|
/**
|
|
164
169
|
* Use this function to convert the Formik `errors` object type to
|
|
165
170
|
* our custom field errors type.
|
|
@@ -171,6 +176,6 @@ PasswordField.toFieldErrors = function toFieldErrors(errors) {
|
|
|
171
176
|
var PasswordField$1 = PasswordField;
|
|
172
177
|
|
|
173
178
|
// NOTE: This string will be replaced on build time with the package version.
|
|
174
|
-
var version = "19.
|
|
179
|
+
var version = "19.22.0";
|
|
175
180
|
|
|
176
181
|
export { PasswordField$1 as default, version };
|
|
@@ -120,9 +120,8 @@ export type TPasswordField = {
|
|
|
120
120
|
renderShowHideButton?: boolean;
|
|
121
121
|
};
|
|
122
122
|
declare const PasswordField: {
|
|
123
|
-
(props: TPasswordField): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
123
|
+
({ horizontalConstraint, renderShowHideButton, ...props }: TPasswordField): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
124
124
|
displayName: string;
|
|
125
|
-
defaultProps: Pick<TPasswordField, "horizontalConstraint" | "renderShowHideButton">;
|
|
126
125
|
toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
|
|
127
126
|
};
|
|
128
127
|
export default PasswordField;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/password-field",
|
|
3
3
|
"description": "A controlled text input component for passwords with validation states.",
|
|
4
|
-
"version": "19.
|
|
4
|
+
"version": "19.22.0",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/constraints": "19.
|
|
25
|
-
"@commercetools-uikit/design-system": "19.
|
|
26
|
-
"@commercetools-uikit/field-errors": "19.
|
|
27
|
-
"@commercetools-uikit/field-label": "19.
|
|
28
|
-
"@commercetools-uikit/field-warnings": "19.
|
|
29
|
-
"@commercetools-uikit/flat-button": "19.
|
|
30
|
-
"@commercetools-uikit/hooks": "19.
|
|
31
|
-
"@commercetools-uikit/icons": "19.
|
|
32
|
-
"@commercetools-uikit/password-input": "19.
|
|
33
|
-
"@commercetools-uikit/spacings-inline": "19.
|
|
34
|
-
"@commercetools-uikit/spacings-stack": "19.
|
|
35
|
-
"@commercetools-uikit/utils": "19.
|
|
24
|
+
"@commercetools-uikit/constraints": "19.22.0",
|
|
25
|
+
"@commercetools-uikit/design-system": "19.22.0",
|
|
26
|
+
"@commercetools-uikit/field-errors": "19.22.0",
|
|
27
|
+
"@commercetools-uikit/field-label": "19.22.0",
|
|
28
|
+
"@commercetools-uikit/field-warnings": "19.22.0",
|
|
29
|
+
"@commercetools-uikit/flat-button": "19.22.0",
|
|
30
|
+
"@commercetools-uikit/hooks": "19.22.0",
|
|
31
|
+
"@commercetools-uikit/icons": "19.22.0",
|
|
32
|
+
"@commercetools-uikit/password-input": "19.22.0",
|
|
33
|
+
"@commercetools-uikit/spacings-inline": "19.22.0",
|
|
34
|
+
"@commercetools-uikit/spacings-stack": "19.22.0",
|
|
35
|
+
"@commercetools-uikit/utils": "19.22.0",
|
|
36
36
|
"@emotion/react": "^11.10.5",
|
|
37
37
|
"@emotion/styled": "^11.10.5",
|
|
38
38
|
"prop-types": "15.8.1"
|