@commercetools-uikit/password-input 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.
@@ -11,6 +11,7 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
11
11
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
14
15
  var _pt = require('prop-types');
15
16
  var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
16
17
  var utils = require('@commercetools-uikit/utils');
@@ -32,38 +33,45 @@ var _pt__default = /*#__PURE__*/_interopDefault(_pt);
32
33
  var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
33
34
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
34
35
 
36
+ const _excluded = ["horizontalConstraint", "isDisabled", "isReadOnly", "isPasswordVisible"];
35
37
  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; }
36
38
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
37
- const defaultProps = {
38
- horizontalConstraint: 'scale',
39
- isDisabled: false,
40
- isReadOnly: false,
41
- isPasswordVisible: false
42
- };
43
- const PasswordInput = props => {
44
- if (!props.isReadOnly) {
39
+ const PasswordInput = _ref => {
40
+ let _ref$horizontalConstr = _ref.horizontalConstraint,
41
+ horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
42
+ _ref$isDisabled = _ref.isDisabled,
43
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
44
+ _ref$isReadOnly = _ref.isReadOnly,
45
+ isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
46
+ _ref$isPasswordVisibl = _ref.isPasswordVisible,
47
+ isPasswordVisible = _ref$isPasswordVisibl === void 0 ? false : _ref$isPasswordVisibl,
48
+ props = _objectWithoutProperties(_ref, _excluded);
49
+ if (!isReadOnly) {
45
50
  process.env.NODE_ENV !== "production" ? utils.warning(Boolean(props.onChange), 'PasswordInput: `onChange` is required when is not read only.') : void 0;
46
51
  }
47
52
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
48
- max: props.horizontalConstraint,
53
+ max: horizontalConstraint,
49
54
  children: jsxRuntime.jsx("input", _objectSpread(_objectSpread({
50
55
  id: props.id,
51
56
  name: props.name,
52
- type: props.isPasswordVisible ? 'text' : 'password',
57
+ type: isPasswordVisible ? 'text' : 'password',
53
58
  value: props.value,
54
59
  onChange: props.onChange,
55
60
  onBlur: props.onBlur,
56
61
  onFocus: props.onFocus,
57
- disabled: props.isDisabled,
62
+ disabled: isDisabled,
58
63
  placeholder: props.placeholder,
59
64
  autoComplete: props.autoComplete,
60
- css: inputUtils.getInputStyles(props),
61
- readOnly: props.isReadOnly,
65
+ css: inputUtils.getInputStyles(_objectSpread({
66
+ isDisabled,
67
+ isReadOnly
68
+ }, props)),
69
+ readOnly: isReadOnly,
62
70
  autoFocus: props.isAutofocussed
63
71
  }, utils.filterDataAttributes(props)), {}, {
64
72
  /* ARIA */
65
- "aria-readonly": props.isReadOnly,
66
- contentEditable: !props.isReadOnly,
73
+ "aria-readonly": isReadOnly,
74
+ contentEditable: !isReadOnly,
67
75
  "aria-invalid": props['aria-invalid'],
68
76
  "aria-errormessage": props['aria-errormessage']
69
77
  }))
@@ -89,12 +97,11 @@ PasswordInput.propTypes = process.env.NODE_ENV !== "production" ? {
89
97
  autoComplete: _pt__default["default"].oneOf(['on', 'off', 'current-password', 'new-password'])
90
98
  } : {};
91
99
  PasswordInput.displayName = 'PasswordInput';
92
- PasswordInput.defaultProps = defaultProps;
93
100
  PasswordInput.isEmpty = value => !value || _trimInstanceProperty__default["default"](value).call(value).length === 0;
94
101
  var PasswordInput$1 = PasswordInput;
95
102
 
96
103
  // NOTE: This string will be replaced on build time with the package version.
97
- var version = "19.20.1";
104
+ var version = "19.22.0";
98
105
 
99
106
  exports["default"] = PasswordInput$1;
100
107
  exports.version = version;
@@ -11,6 +11,7 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
11
11
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
14
15
  require('prop-types');
15
16
  var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
16
17
  var utils = require('@commercetools-uikit/utils');
@@ -31,36 +32,42 @@ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defin
31
32
  var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
32
33
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
33
34
 
35
+ const _excluded = ["horizontalConstraint", "isDisabled", "isReadOnly", "isPasswordVisible"];
34
36
  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; }
35
37
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
36
- const defaultProps = {
37
- horizontalConstraint: 'scale',
38
- isDisabled: false,
39
- isReadOnly: false,
40
- isPasswordVisible: false
41
- };
42
- const PasswordInput = props => {
43
- if (!props.isReadOnly) ;
38
+ const PasswordInput = _ref => {
39
+ let _ref$horizontalConstr = _ref.horizontalConstraint,
40
+ horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
41
+ _ref$isDisabled = _ref.isDisabled,
42
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
43
+ _ref$isReadOnly = _ref.isReadOnly,
44
+ isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
45
+ _ref$isPasswordVisibl = _ref.isPasswordVisible,
46
+ isPasswordVisible = _ref$isPasswordVisibl === void 0 ? false : _ref$isPasswordVisibl,
47
+ props = _objectWithoutProperties(_ref, _excluded);
44
48
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
45
- max: props.horizontalConstraint,
49
+ max: horizontalConstraint,
46
50
  children: jsxRuntime.jsx("input", _objectSpread(_objectSpread({
47
51
  id: props.id,
48
52
  name: props.name,
49
- type: props.isPasswordVisible ? 'text' : 'password',
53
+ type: isPasswordVisible ? 'text' : 'password',
50
54
  value: props.value,
51
55
  onChange: props.onChange,
52
56
  onBlur: props.onBlur,
53
57
  onFocus: props.onFocus,
54
- disabled: props.isDisabled,
58
+ disabled: isDisabled,
55
59
  placeholder: props.placeholder,
56
60
  autoComplete: props.autoComplete,
57
- css: inputUtils.getInputStyles(props),
58
- readOnly: props.isReadOnly,
61
+ css: inputUtils.getInputStyles(_objectSpread({
62
+ isDisabled,
63
+ isReadOnly
64
+ }, props)),
65
+ readOnly: isReadOnly,
59
66
  autoFocus: props.isAutofocussed
60
67
  }, utils.filterDataAttributes(props)), {}, {
61
68
  /* ARIA */
62
- "aria-readonly": props.isReadOnly,
63
- contentEditable: !props.isReadOnly,
69
+ "aria-readonly": isReadOnly,
70
+ contentEditable: !isReadOnly,
64
71
  "aria-invalid": props['aria-invalid'],
65
72
  "aria-errormessage": props['aria-errormessage']
66
73
  }))
@@ -68,12 +75,11 @@ const PasswordInput = props => {
68
75
  };
69
76
  PasswordInput.propTypes = {};
70
77
  PasswordInput.displayName = 'PasswordInput';
71
- PasswordInput.defaultProps = defaultProps;
72
78
  PasswordInput.isEmpty = value => !value || _trimInstanceProperty__default["default"](value).call(value).length === 0;
73
79
  var PasswordInput$1 = PasswordInput;
74
80
 
75
81
  // NOTE: This string will be replaced on build time with the package version.
76
- var version = "19.20.1";
82
+ var version = "19.22.0";
77
83
 
78
84
  exports["default"] = PasswordInput$1;
79
85
  exports.version = version;
@@ -7,6 +7,7 @@ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-st
7
7
  import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
8
8
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
9
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
10
11
  import _pt from 'prop-types';
11
12
  import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
12
13
  import { warning, filterDataAttributes } from '@commercetools-uikit/utils';
@@ -14,38 +15,45 @@ import Constraints from '@commercetools-uikit/constraints';
14
15
  import { getInputStyles } from '@commercetools-uikit/input-utils';
15
16
  import { jsx } from '@emotion/react/jsx-runtime';
16
17
 
18
+ const _excluded = ["horizontalConstraint", "isDisabled", "isReadOnly", "isPasswordVisible"];
17
19
  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; }
18
20
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
19
- const defaultProps = {
20
- horizontalConstraint: 'scale',
21
- isDisabled: false,
22
- isReadOnly: false,
23
- isPasswordVisible: false
24
- };
25
- const PasswordInput = props => {
26
- if (!props.isReadOnly) {
21
+ const PasswordInput = _ref => {
22
+ let _ref$horizontalConstr = _ref.horizontalConstraint,
23
+ horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
24
+ _ref$isDisabled = _ref.isDisabled,
25
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
26
+ _ref$isReadOnly = _ref.isReadOnly,
27
+ isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
28
+ _ref$isPasswordVisibl = _ref.isPasswordVisible,
29
+ isPasswordVisible = _ref$isPasswordVisibl === void 0 ? false : _ref$isPasswordVisibl,
30
+ props = _objectWithoutProperties(_ref, _excluded);
31
+ if (!isReadOnly) {
27
32
  process.env.NODE_ENV !== "production" ? warning(Boolean(props.onChange), 'PasswordInput: `onChange` is required when is not read only.') : void 0;
28
33
  }
29
34
  return jsx(Constraints.Horizontal, {
30
- max: props.horizontalConstraint,
35
+ max: horizontalConstraint,
31
36
  children: jsx("input", _objectSpread(_objectSpread({
32
37
  id: props.id,
33
38
  name: props.name,
34
- type: props.isPasswordVisible ? 'text' : 'password',
39
+ type: isPasswordVisible ? 'text' : 'password',
35
40
  value: props.value,
36
41
  onChange: props.onChange,
37
42
  onBlur: props.onBlur,
38
43
  onFocus: props.onFocus,
39
- disabled: props.isDisabled,
44
+ disabled: isDisabled,
40
45
  placeholder: props.placeholder,
41
46
  autoComplete: props.autoComplete,
42
- css: getInputStyles(props),
43
- readOnly: props.isReadOnly,
47
+ css: getInputStyles(_objectSpread({
48
+ isDisabled,
49
+ isReadOnly
50
+ }, props)),
51
+ readOnly: isReadOnly,
44
52
  autoFocus: props.isAutofocussed
45
53
  }, filterDataAttributes(props)), {}, {
46
54
  /* ARIA */
47
- "aria-readonly": props.isReadOnly,
48
- contentEditable: !props.isReadOnly,
55
+ "aria-readonly": isReadOnly,
56
+ contentEditable: !isReadOnly,
49
57
  "aria-invalid": props['aria-invalid'],
50
58
  "aria-errormessage": props['aria-errormessage']
51
59
  }))
@@ -71,11 +79,10 @@ PasswordInput.propTypes = process.env.NODE_ENV !== "production" ? {
71
79
  autoComplete: _pt.oneOf(['on', 'off', 'current-password', 'new-password'])
72
80
  } : {};
73
81
  PasswordInput.displayName = 'PasswordInput';
74
- PasswordInput.defaultProps = defaultProps;
75
82
  PasswordInput.isEmpty = value => !value || _trimInstanceProperty(value).call(value).length === 0;
76
83
  var PasswordInput$1 = PasswordInput;
77
84
 
78
85
  // NOTE: This string will be replaced on build time with the package version.
79
- var version = "19.20.1";
86
+ var version = "19.22.0";
80
87
 
81
88
  export { PasswordInput$1 as default, version };
@@ -71,9 +71,8 @@ export type TPasswordInputProps = {
71
71
  autoComplete?: 'on' | 'off' | 'current-password' | 'new-password';
72
72
  };
73
73
  declare const PasswordInput: {
74
- (props: TPasswordInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
74
+ ({ horizontalConstraint, isDisabled, isReadOnly, isPasswordVisible, ...props }: TPasswordInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
75
75
  displayName: string;
76
- defaultProps: Pick<TPasswordInputProps, "isDisabled" | "horizontalConstraint" | "isReadOnly" | "isPasswordVisible">;
77
76
  isEmpty(value: TPasswordInputProps["value"]): boolean;
78
77
  };
79
78
  export default PasswordInput;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/password-input",
3
3
  "description": "A controlled password input component.",
4
- "version": "19.20.1",
4
+ "version": "19.22.0",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,10 +21,10 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.20.13",
23
23
  "@babel/runtime-corejs3": "^7.20.13",
24
- "@commercetools-uikit/constraints": "19.20.1",
25
- "@commercetools-uikit/design-system": "19.20.1",
26
- "@commercetools-uikit/input-utils": "19.20.1",
27
- "@commercetools-uikit/utils": "19.20.1",
24
+ "@commercetools-uikit/constraints": "19.22.0",
25
+ "@commercetools-uikit/design-system": "19.22.0",
26
+ "@commercetools-uikit/input-utils": "19.22.0",
27
+ "@commercetools-uikit/utils": "19.22.0",
28
28
  "@emotion/react": "^11.10.5",
29
29
  "@emotion/styled": "^11.10.5",
30
30
  "prop-types": "15.8.1"