@commercetools-uikit/password-field 19.0.0 → 19.1.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/README.md CHANGED
@@ -71,6 +71,7 @@ export default Example;
71
71
  | `onInfoButtonClick` | `Function`<br/>[See signature.](#signature-onInfoButtonClick) | | | Function called when info button is pressed.&#xA;<br />&#xA;Info button will only be visible when this prop is passed. |
72
72
  | `hintIcon` | `ReactElement` | | | Icon to be displayed beside the hint text.&#xA;<br />&#xA;Will only get rendered when `hint` is passed as well. |
73
73
  | `badge` | `ReactNode` | | | Badge to be displayed beside the label.&#xA;<br />&#xA;Might be used to display additional information about the content of the field (E.g verified email) |
74
+ | `renderShowHideButton` | `boolean` | | `true` | Determines whether to render the "Show/Hide" button for the password field. |
74
75
 
75
76
  ## Signatures
76
77
 
@@ -82,7 +82,8 @@ const hasWarnings = warnings => {
82
82
  return warnings && _someInstanceProperty__default["default"](_context2 = _Object$values__default["default"](warnings)).call(_context2, Boolean);
83
83
  };
84
84
  const defaultProps = {
85
- horizontalConstraint: 'scale'
85
+ horizontalConstraint: 'scale',
86
+ renderShowHideButton: true
86
87
  };
87
88
  const PasswordField = props => {
88
89
  const intl = reactIntl.useIntl();
@@ -93,7 +94,7 @@ const PasswordField = props => {
93
94
  const id = hooks.useFieldId(props.id, sequentialId);
94
95
  const hasError = props.touched && hasErrors(props.errors);
95
96
  const hasWarning = props.touched && hasWarnings(props.warnings);
96
- const canInteract = !props.isDisabled && !props.isReadOnly;
97
+ const canInteract = !props.isDisabled && !props.isReadOnly && props.renderShowHideButton;
97
98
  if (!props.isReadOnly) {
98
99
  process.env.NODE_ENV !== "production" ? utils.warning(Boolean(props.onChange), 'PasswordField: `onChange` is required when field is not read only.') : void 0;
99
100
  }
@@ -180,7 +181,8 @@ PasswordField.propTypes = process.env.NODE_ENV !== "production" ? {
180
181
  description: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]),
181
182
  onInfoButtonClick: _pt__default["default"].func,
182
183
  hintIcon: _pt__default["default"].element,
183
- badge: _pt__default["default"].node
184
+ badge: _pt__default["default"].node,
185
+ renderShowHideButton: _pt__default["default"].bool
184
186
  } : {};
185
187
  PasswordField.displayName = 'PasswordField';
186
188
  PasswordField.defaultProps = defaultProps;
@@ -195,7 +197,7 @@ PasswordField.toFieldErrors = function toFieldErrors(errors) {
195
197
  var PasswordField$1 = PasswordField;
196
198
 
197
199
  // NOTE: This string will be replaced on build time with the package version.
198
- var version = "19.0.0";
200
+ var version = "19.1.0";
199
201
 
200
202
  exports["default"] = PasswordField$1;
201
203
  exports.version = version;
@@ -81,7 +81,8 @@ const hasWarnings = warnings => {
81
81
  return warnings && _someInstanceProperty__default["default"](_context2 = _Object$values__default["default"](warnings)).call(_context2, Boolean);
82
82
  };
83
83
  const defaultProps = {
84
- horizontalConstraint: 'scale'
84
+ horizontalConstraint: 'scale',
85
+ renderShowHideButton: true
85
86
  };
86
87
  const PasswordField = props => {
87
88
  const intl = reactIntl.useIntl();
@@ -92,7 +93,7 @@ const PasswordField = props => {
92
93
  const id = hooks.useFieldId(props.id, sequentialId);
93
94
  const hasError = props.touched && hasErrors(props.errors);
94
95
  const hasWarning = props.touched && hasWarnings(props.warnings);
95
- const canInteract = !props.isDisabled && !props.isReadOnly;
96
+ const canInteract = !props.isDisabled && !props.isReadOnly && props.renderShowHideButton;
96
97
  if (!props.isReadOnly) ;
97
98
  if (props.hintIcon) ;
98
99
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
@@ -165,7 +166,7 @@ PasswordField.toFieldErrors = function toFieldErrors(errors) {
165
166
  var PasswordField$1 = PasswordField;
166
167
 
167
168
  // NOTE: This string will be replaced on build time with the package version.
168
- var version = "19.0.0";
169
+ var version = "19.1.0";
169
170
 
170
171
  exports["default"] = PasswordField$1;
171
172
  exports.version = version;
@@ -56,7 +56,8 @@ const hasWarnings = warnings => {
56
56
  return warnings && _someInstanceProperty(_context2 = _Object$values(warnings)).call(_context2, Boolean);
57
57
  };
58
58
  const defaultProps = {
59
- horizontalConstraint: 'scale'
59
+ horizontalConstraint: 'scale',
60
+ renderShowHideButton: true
60
61
  };
61
62
  const PasswordField = props => {
62
63
  const intl = useIntl();
@@ -67,7 +68,7 @@ const PasswordField = props => {
67
68
  const id = useFieldId(props.id, sequentialId);
68
69
  const hasError = props.touched && hasErrors(props.errors);
69
70
  const hasWarning = props.touched && hasWarnings(props.warnings);
70
- const canInteract = !props.isDisabled && !props.isReadOnly;
71
+ const canInteract = !props.isDisabled && !props.isReadOnly && props.renderShowHideButton;
71
72
  if (!props.isReadOnly) {
72
73
  process.env.NODE_ENV !== "production" ? warning(Boolean(props.onChange), 'PasswordField: `onChange` is required when field is not read only.') : void 0;
73
74
  }
@@ -154,7 +155,8 @@ PasswordField.propTypes = process.env.NODE_ENV !== "production" ? {
154
155
  description: _pt.oneOfType([_pt.string, _pt.node]),
155
156
  onInfoButtonClick: _pt.func,
156
157
  hintIcon: _pt.element,
157
- badge: _pt.node
158
+ badge: _pt.node,
159
+ renderShowHideButton: _pt.bool
158
160
  } : {};
159
161
  PasswordField.displayName = 'PasswordField';
160
162
  PasswordField.defaultProps = defaultProps;
@@ -169,6 +171,6 @@ PasswordField.toFieldErrors = function toFieldErrors(errors) {
169
171
  var PasswordField$1 = PasswordField;
170
172
 
171
173
  // NOTE: This string will be replaced on build time with the package version.
172
- var version = "19.0.0";
174
+ var version = "19.1.0";
173
175
 
174
176
  export { PasswordField$1 as default, version };
@@ -30,11 +30,12 @@ export type TPasswordField = {
30
30
  onInfoButtonClick?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
31
31
  hintIcon?: ReactElement;
32
32
  badge?: ReactNode;
33
+ renderShowHideButton?: boolean;
33
34
  };
34
35
  declare const PasswordField: {
35
36
  (props: TPasswordField): import("@emotion/react/jsx-runtime").JSX.Element;
36
37
  displayName: string;
37
- defaultProps: Pick<TPasswordField, "horizontalConstraint">;
38
+ defaultProps: Pick<TPasswordField, "horizontalConstraint" | "renderShowHideButton">;
38
39
  toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
39
40
  };
40
41
  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.0.0",
4
+ "version": "19.1.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.0.0",
25
- "@commercetools-uikit/design-system": "19.0.0",
26
- "@commercetools-uikit/field-errors": "19.0.0",
27
- "@commercetools-uikit/field-label": "19.0.0",
28
- "@commercetools-uikit/field-warnings": "19.0.0",
29
- "@commercetools-uikit/flat-button": "19.0.0",
30
- "@commercetools-uikit/hooks": "19.0.0",
31
- "@commercetools-uikit/icons": "19.0.0",
32
- "@commercetools-uikit/password-input": "19.0.0",
33
- "@commercetools-uikit/spacings-inline": "19.0.0",
34
- "@commercetools-uikit/spacings-stack": "19.0.0",
35
- "@commercetools-uikit/utils": "19.0.0",
24
+ "@commercetools-uikit/constraints": "19.1.0",
25
+ "@commercetools-uikit/design-system": "19.1.0",
26
+ "@commercetools-uikit/field-errors": "19.1.0",
27
+ "@commercetools-uikit/field-label": "19.1.0",
28
+ "@commercetools-uikit/field-warnings": "19.1.0",
29
+ "@commercetools-uikit/flat-button": "19.1.0",
30
+ "@commercetools-uikit/hooks": "19.1.0",
31
+ "@commercetools-uikit/icons": "19.1.0",
32
+ "@commercetools-uikit/password-input": "19.1.0",
33
+ "@commercetools-uikit/spacings-inline": "19.1.0",
34
+ "@commercetools-uikit/spacings-stack": "19.1.0",
35
+ "@commercetools-uikit/utils": "19.1.0",
36
36
  "@emotion/react": "^11.10.5",
37
37
  "@emotion/styled": "^11.10.5",
38
38
  "prop-types": "15.8.1"