@commercetools-uikit/password-input 0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 commercetools GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,87 @@
1
+ <!-- THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -->
2
+ <!-- This file is created by the `yarn generate-readme` script. -->
3
+
4
+ # PasswordInput
5
+
6
+ ## Description
7
+
8
+ A controlled password input component.
9
+
10
+ ## Installation
11
+
12
+ ```
13
+ yarn add @commercetools-uikit/password-input
14
+ ```
15
+
16
+ ```
17
+ npm --save install @commercetools-uikit/password-input
18
+ ```
19
+
20
+ Additionally install the peer dependencies (if not present)
21
+
22
+ ```
23
+ yarn add react
24
+ ```
25
+
26
+ ```
27
+ npm --save install react
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ```jsx
33
+ import PasswordInput from '@commercetools-uikit/password-input';
34
+
35
+ const Example = () => (
36
+ <PasswordInput
37
+ value="foo"
38
+ onChange={(event) => {
39
+ alert(event.target.value);
40
+ }}
41
+ />
42
+ );
43
+
44
+ export default Example;
45
+ ```
46
+
47
+ ## Properties
48
+
49
+ | Props | Type | Required | Default | Description |
50
+ | ---------------------- | ----------------------------------------------------------------------------------------------------- | :------: | --------- | ------------------------------------------------------------------------------------------------------------------------- |
51
+ | `id` | `string` | | | Used as HTML id property. An id is auto-generated when it is not specified. |
52
+ | `name` | `string` | | | Used as HTML name of the input component. property |
53
+ | `aria-invalid` | `boolean` | | | Indicate if the value entered in the input is invalid. |
54
+ | `aria-errormessage` | `string` | | | HTML ID of an element containing an error message related to the input. |
55
+ | `value` | `string` | ✅ | | Value of the input component. |
56
+ | `placeholder` | `string` | | | Placeholder text for the input |
57
+ | `onChange` | `ChangeEventHandler` | | | Called with an event containing the new value. Required when input is not read only. Parent should pass it back as value. |
58
+ | `onBlur` | `FocusEventHandler` | | | Called when input is blurred. |
59
+ | `onFocus` | `FocusEventHandler` | | | Called when input is focused. |
60
+ | `isAutofocussed` | `boolean` | | | Focus the input on initial render. |
61
+ | `isDisabled` | `boolean` | | `false` | Indicates that the input cannot be modified (e.g not authorized, or changes currently saving). |
62
+ | `isReadOnly` | `boolean` | | `false` | Indicates that the field is displaying read-only content |
63
+ | `hasError` | `boolean` | | | Indicates that the input has an error |
64
+ | `hasWarning` | `boolean` | | | Indicates that the input has a warning due to e.g invalid values |
65
+ | `isPasswordVisible` | `boolean` | | `false` | Indicates whether we show the password or not |
66
+ | `horizontalConstraint` | `union`<br/>Possible values:<br/>`, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | `'scale'` | Horizontal size limit of the input fields. |
67
+ | `autoComplete` | `union`<br/>Possible values:<br/>`'on' , 'off' , 'current-password' , 'new-password'` | | | Password autocomplete mode |
68
+
69
+ ## `data-*` props
70
+
71
+ The component further forwards all `data-` attributes to the underlying `input` component.
72
+
73
+ ## Static methods
74
+
75
+ ### `PasswordInput.isEmpty`
76
+
77
+ Returns `true` when the value is considered empty, which is when the value is empty or consists of spaces only.
78
+
79
+ ```js
80
+ PasswordInput.isEmpty(''); // -> true
81
+ PasswordInput.isEmpty(' '); // -> true
82
+ PasswordInput.isEmpty('tree'); // -> false
83
+ ```
84
+
85
+ ## Main Functions and use cases are:
86
+
87
+ - Password field
@@ -0,0 +1,3 @@
1
+ export * from "./declarations/src/index.js";
2
+ export { default } from "./declarations/src/index.js";
3
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy11aWtpdC1wYXNzd29yZC1pbnB1dC5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4vZGVjbGFyYXRpb25zL3NyYy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
@@ -0,0 +1,107 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
6
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
9
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
10
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
11
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
15
+ var _pt = require('prop-types');
16
+ var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
17
+ var utils = require('@commercetools-uikit/utils');
18
+ var Constraints = require('@commercetools-uikit/constraints');
19
+ var inputUtils = require('@commercetools-uikit/input-utils');
20
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
21
+
22
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
23
+
24
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
25
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
26
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
27
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
28
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
29
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
30
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
31
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
32
+ var _pt__default = /*#__PURE__*/_interopDefault(_pt);
33
+ var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
34
+ var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
35
+
36
+ const _excluded = ["horizontalConstraint", "isDisabled", "isReadOnly", "isPasswordVisible"];
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; }
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; }
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) {
50
+ process.env.NODE_ENV !== "production" ? utils.warning(Boolean(props.onChange), 'PasswordInput: `onChange` is required when is not read only.') : void 0;
51
+ }
52
+ return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
53
+ max: horizontalConstraint,
54
+ children: jsxRuntime.jsx("input", _objectSpread(_objectSpread({
55
+ id: props.id,
56
+ name: props.name,
57
+ type: isPasswordVisible ? 'text' : 'password',
58
+ value: props.value,
59
+ onChange: props.onChange,
60
+ onBlur: props.onBlur,
61
+ onFocus: props.onFocus,
62
+ disabled: isDisabled,
63
+ placeholder: props.placeholder,
64
+ autoComplete: props.autoComplete,
65
+ css: inputUtils.getInputStyles(_objectSpread({
66
+ isDisabled,
67
+ isReadOnly
68
+ }, props)),
69
+ readOnly: isReadOnly,
70
+ autoFocus: props.isAutofocussed
71
+ }, utils.filterDataAttributes(props)), {}, {
72
+ /* ARIA */
73
+ "aria-readonly": isReadOnly,
74
+ contentEditable: !isReadOnly,
75
+ "aria-invalid": props['aria-invalid'],
76
+ "aria-errormessage": props['aria-errormessage']
77
+ }))
78
+ });
79
+ };
80
+ PasswordInput.propTypes = process.env.NODE_ENV !== "production" ? {
81
+ id: _pt__default["default"].string,
82
+ name: _pt__default["default"].string,
83
+ 'aria-invalid': _pt__default["default"].bool,
84
+ 'aria-errormessage': _pt__default["default"].string,
85
+ value: _pt__default["default"].string.isRequired,
86
+ placeholder: _pt__default["default"].string,
87
+ onChange: _pt__default["default"].func,
88
+ onBlur: _pt__default["default"].func,
89
+ onFocus: _pt__default["default"].func,
90
+ isAutofocussed: _pt__default["default"].bool,
91
+ isDisabled: _pt__default["default"].bool,
92
+ isReadOnly: _pt__default["default"].bool,
93
+ hasError: _pt__default["default"].bool,
94
+ hasWarning: _pt__default["default"].bool,
95
+ isPasswordVisible: _pt__default["default"].bool,
96
+ horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
97
+ autoComplete: _pt__default["default"].oneOf(['on', 'off', 'current-password', 'new-password'])
98
+ } : {};
99
+ PasswordInput.displayName = 'PasswordInput';
100
+ PasswordInput.isEmpty = value => !value || _trimInstanceProperty__default["default"](value).call(value).length === 0;
101
+ var PasswordInput$1 = PasswordInput;
102
+
103
+ // NOTE: This string will be replaced on build time with the package version.
104
+ var version = "19.25.1";
105
+
106
+ exports["default"] = PasswordInput$1;
107
+ exports.version = version;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./commercetools-uikit-password-input.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./commercetools-uikit-password-input.cjs.dev.js");
7
+ }
@@ -0,0 +1,85 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
6
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
9
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
10
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
11
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
15
+ require('prop-types');
16
+ var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
17
+ var utils = require('@commercetools-uikit/utils');
18
+ var Constraints = require('@commercetools-uikit/constraints');
19
+ var inputUtils = require('@commercetools-uikit/input-utils');
20
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
21
+
22
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
23
+
24
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
25
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
26
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
27
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
28
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
29
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
30
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
31
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
32
+ var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
33
+ var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
34
+
35
+ const _excluded = ["horizontalConstraint", "isDisabled", "isReadOnly", "isPasswordVisible"];
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; }
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; }
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);
48
+ return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
49
+ max: horizontalConstraint,
50
+ children: jsxRuntime.jsx("input", _objectSpread(_objectSpread({
51
+ id: props.id,
52
+ name: props.name,
53
+ type: isPasswordVisible ? 'text' : 'password',
54
+ value: props.value,
55
+ onChange: props.onChange,
56
+ onBlur: props.onBlur,
57
+ onFocus: props.onFocus,
58
+ disabled: isDisabled,
59
+ placeholder: props.placeholder,
60
+ autoComplete: props.autoComplete,
61
+ css: inputUtils.getInputStyles(_objectSpread({
62
+ isDisabled,
63
+ isReadOnly
64
+ }, props)),
65
+ readOnly: isReadOnly,
66
+ autoFocus: props.isAutofocussed
67
+ }, utils.filterDataAttributes(props)), {}, {
68
+ /* ARIA */
69
+ "aria-readonly": isReadOnly,
70
+ contentEditable: !isReadOnly,
71
+ "aria-invalid": props['aria-invalid'],
72
+ "aria-errormessage": props['aria-errormessage']
73
+ }))
74
+ });
75
+ };
76
+ PasswordInput.propTypes = {};
77
+ PasswordInput.displayName = 'PasswordInput';
78
+ PasswordInput.isEmpty = value => !value || _trimInstanceProperty__default["default"](value).call(value).length === 0;
79
+ var PasswordInput$1 = PasswordInput;
80
+
81
+ // NOTE: This string will be replaced on build time with the package version.
82
+ var version = "19.25.1";
83
+
84
+ exports["default"] = PasswordInput$1;
85
+ exports.version = version;
@@ -0,0 +1,88 @@
1
+ import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
2
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
3
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
4
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
5
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
6
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
7
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
8
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
+ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
11
+ import _pt from 'prop-types';
12
+ import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
13
+ import { warning, filterDataAttributes } from '@commercetools-uikit/utils';
14
+ import Constraints from '@commercetools-uikit/constraints';
15
+ import { getInputStyles } from '@commercetools-uikit/input-utils';
16
+ import { jsx } from '@emotion/react/jsx-runtime';
17
+
18
+ const _excluded = ["horizontalConstraint", "isDisabled", "isReadOnly", "isPasswordVisible"];
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; }
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; }
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) {
32
+ process.env.NODE_ENV !== "production" ? warning(Boolean(props.onChange), 'PasswordInput: `onChange` is required when is not read only.') : void 0;
33
+ }
34
+ return jsx(Constraints.Horizontal, {
35
+ max: horizontalConstraint,
36
+ children: jsx("input", _objectSpread(_objectSpread({
37
+ id: props.id,
38
+ name: props.name,
39
+ type: isPasswordVisible ? 'text' : 'password',
40
+ value: props.value,
41
+ onChange: props.onChange,
42
+ onBlur: props.onBlur,
43
+ onFocus: props.onFocus,
44
+ disabled: isDisabled,
45
+ placeholder: props.placeholder,
46
+ autoComplete: props.autoComplete,
47
+ css: getInputStyles(_objectSpread({
48
+ isDisabled,
49
+ isReadOnly
50
+ }, props)),
51
+ readOnly: isReadOnly,
52
+ autoFocus: props.isAutofocussed
53
+ }, filterDataAttributes(props)), {}, {
54
+ /* ARIA */
55
+ "aria-readonly": isReadOnly,
56
+ contentEditable: !isReadOnly,
57
+ "aria-invalid": props['aria-invalid'],
58
+ "aria-errormessage": props['aria-errormessage']
59
+ }))
60
+ });
61
+ };
62
+ PasswordInput.propTypes = process.env.NODE_ENV !== "production" ? {
63
+ id: _pt.string,
64
+ name: _pt.string,
65
+ 'aria-invalid': _pt.bool,
66
+ 'aria-errormessage': _pt.string,
67
+ value: _pt.string.isRequired,
68
+ placeholder: _pt.string,
69
+ onChange: _pt.func,
70
+ onBlur: _pt.func,
71
+ onFocus: _pt.func,
72
+ isAutofocussed: _pt.bool,
73
+ isDisabled: _pt.bool,
74
+ isReadOnly: _pt.bool,
75
+ hasError: _pt.bool,
76
+ hasWarning: _pt.bool,
77
+ isPasswordVisible: _pt.bool,
78
+ horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
79
+ autoComplete: _pt.oneOf(['on', 'off', 'current-password', 'new-password'])
80
+ } : {};
81
+ PasswordInput.displayName = 'PasswordInput';
82
+ PasswordInput.isEmpty = value => !value || _trimInstanceProperty(value).call(value).length === 0;
83
+ var PasswordInput$1 = PasswordInput;
84
+
85
+ // NOTE: This string will be replaced on build time with the package version.
86
+ var version = "19.25.1";
87
+
88
+ export { PasswordInput$1 as default, version };
@@ -0,0 +1 @@
1
+ export type { TPasswordInputProps } from "./password-input.js";
@@ -0,0 +1,3 @@
1
+ export { default } from "./password-input.js";
2
+ export { default as version } from "./version.js";
3
+ export * from "./export-types.js";
@@ -0,0 +1,78 @@
1
+ import type { ChangeEventHandler, FocusEventHandler } from 'react';
2
+ export type TPasswordInputProps = {
3
+ /**
4
+ * Used as HTML id property. An id is auto-generated when it is not specified.
5
+ */
6
+ id?: string;
7
+ /**
8
+ * Used as HTML name of the input component. property
9
+ */
10
+ name?: string;
11
+ /**
12
+ * Indicate if the value entered in the input is invalid.
13
+ */
14
+ 'aria-invalid'?: boolean;
15
+ /**
16
+ * HTML ID of an element containing an error message related to the input.
17
+ */
18
+ 'aria-errormessage'?: string;
19
+ /**
20
+ * Value of the input component.
21
+ */
22
+ value: string;
23
+ /**
24
+ * Placeholder text for the input
25
+ */
26
+ placeholder?: string;
27
+ /**
28
+ * Called with an event containing the new value. Required when input is not read only. Parent should pass it back as value.
29
+ */
30
+ onChange?: ChangeEventHandler<HTMLInputElement>;
31
+ /**
32
+ * Called when input is blurred.
33
+ */
34
+ onBlur?: FocusEventHandler<HTMLInputElement>;
35
+ /**
36
+ *
37
+ * Called when input is focused.
38
+ */
39
+ onFocus?: FocusEventHandler<HTMLInputElement>;
40
+ /**
41
+ * Focus the input on initial render.
42
+ */
43
+ isAutofocussed?: boolean;
44
+ /**
45
+ * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
46
+ */
47
+ isDisabled?: boolean;
48
+ /**
49
+ * Indicates that the field is displaying read-only content
50
+ */
51
+ isReadOnly?: boolean;
52
+ /**
53
+ * Indicates that the input has an error
54
+ */
55
+ hasError?: boolean;
56
+ /**
57
+ * Indicates that the input has a warning due to e.g invalid values
58
+ */
59
+ hasWarning?: boolean;
60
+ /**
61
+ * Indicates whether we show the password or not
62
+ */
63
+ isPasswordVisible?: boolean;
64
+ /**
65
+ * Horizontal size limit of the input fields.
66
+ */
67
+ horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
68
+ /**
69
+ * Password autocomplete mode
70
+ */
71
+ autoComplete?: 'on' | 'off' | 'current-password' | 'new-password';
72
+ };
73
+ declare const PasswordInput: {
74
+ ({ horizontalConstraint, isDisabled, isReadOnly, isPasswordVisible, ...props }: TPasswordInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
75
+ displayName: string;
76
+ isEmpty(value: TPasswordInputProps["value"]): boolean;
77
+ };
78
+ export default PasswordInput;
@@ -0,0 +1,2 @@
1
+ declare const _default: "__@UI_KIT_PACKAGE/VERSION_OF_RELEASE__";
2
+ export default _default;
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@commercetools-uikit/password-input",
3
+ "description": "A controlled password input component.",
4
+ "version": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
5
+ "bugs": "https://github.com/commercetools/ui-kit/issues",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/commercetools/ui-kit.git",
9
+ "directory": "packages/components/inputs/password-input"
10
+ },
11
+ "homepage": "https://uikit.commercetools.com",
12
+ "keywords": [
13
+ "javascript",
14
+ "typescript",
15
+ "design-system",
16
+ "react",
17
+ "uikit"
18
+ ],
19
+ "license": "MIT",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "sideEffects": false,
24
+ "main": "dist/commercetools-uikit-password-input.cjs.js",
25
+ "module": "dist/commercetools-uikit-password-input.esm.js",
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "dependencies": {
30
+ "@babel/runtime": "^7.20.13",
31
+ "@babel/runtime-corejs3": "^7.20.13",
32
+ "@commercetools-uikit/constraints": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
33
+ "@commercetools-uikit/design-system": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
34
+ "@commercetools-uikit/input-utils": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
35
+ "@commercetools-uikit/utils": "0.0.0-FCT-1500-adjust-legacy-css-reset-20250527090339",
36
+ "@emotion/react": "^11.10.5",
37
+ "@emotion/styled": "^11.10.5",
38
+ "prop-types": "15.8.1"
39
+ },
40
+ "devDependencies": {
41
+ "react": "17.0.2"
42
+ },
43
+ "peerDependencies": {
44
+ "react": "17.x"
45
+ }
46
+ }