@commercetools-uikit/password-field 19.8.0 → 19.10.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.
@@ -197,7 +197,7 @@ PasswordField.toFieldErrors = function toFieldErrors(errors) {
197
197
  var PasswordField$1 = PasswordField;
198
198
 
199
199
  // NOTE: This string will be replaced on build time with the package version.
200
- var version = "19.8.0";
200
+ var version = "19.10.0";
201
201
 
202
202
  exports["default"] = PasswordField$1;
203
203
  exports.version = version;
@@ -166,7 +166,7 @@ PasswordField.toFieldErrors = function toFieldErrors(errors) {
166
166
  var PasswordField$1 = PasswordField;
167
167
 
168
168
  // NOTE: This string will be replaced on build time with the package version.
169
- var version = "19.8.0";
169
+ var version = "19.10.0";
170
170
 
171
171
  exports["default"] = PasswordField$1;
172
172
  exports.version = version;
@@ -171,6 +171,6 @@ PasswordField.toFieldErrors = function toFieldErrors(errors) {
171
171
  var PasswordField$1 = PasswordField;
172
172
 
173
173
  // NOTE: This string will be replaced on build time with the package version.
174
- var version = "19.8.0";
174
+ var version = "19.10.0";
175
175
 
176
176
  export { PasswordField$1 as default, version };
@@ -6,36 +6,128 @@ type TCustomFormErrors<Values> = {
6
6
  };
7
7
  type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
8
8
  export type TPasswordField = {
9
+ /**
10
+ * Used as HTML id property. An id is auto-generated when it is not specified.
11
+ */
9
12
  id?: string;
13
+ /**
14
+ * Horizontal size limit of the input fields.
15
+ */
10
16
  horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
17
+ /**
18
+ * A map of errors. Error messages for known errors are rendered automatically.
19
+ * <br />
20
+ * Unknown errors will be forwarded to `renderError`
21
+ */
11
22
  errors?: TFieldErrors;
23
+ /**
24
+ * A map of warnings. Warning messages for known warnings are rendered automatically.
25
+ * <br/>
26
+ * Unknown warnings will be forwarded to renderWarning.
27
+ */
12
28
  warnings?: TFieldWarnings;
29
+ /**
30
+ * Called with custom errors. This function can return a message which will be wrapped in an ErrorMessage. It can also return null to show no error.
31
+ */
13
32
  renderError?: TErrorRenderer;
33
+ /**
34
+ * Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
35
+ * <br />
36
+ * It can also return null to show no warning.
37
+ */
14
38
  renderWarning?: (key: string, warning?: boolean) => ReactNode;
39
+ /**
40
+ * Indicates if the value is required. Shows an the "required asterisk" if so.
41
+ */
15
42
  isRequired?: boolean;
43
+ /**
44
+ * Indicates whether the field was touched. Errors will only be shown when the field was touched.
45
+ */
16
46
  touched?: boolean;
47
+ /**
48
+ * Used as HTML name of the input component. property
49
+ */
17
50
  name?: string;
51
+ /**
52
+ * Value of the input component.
53
+ */
18
54
  value: string;
55
+ /**
56
+ * Called with an event containing the new value. Required when input is not read only. Parent should pass it back as value.
57
+ */
19
58
  onChange?: ChangeEventHandler<HTMLInputElement>;
59
+ /**
60
+ * Called when input is blurred
61
+ */
20
62
  onBlur?: FocusEventHandler<HTMLInputElement>;
63
+ /**
64
+ * Called when input is focused
65
+ */
21
66
  onFocus?: FocusEventHandler<HTMLInputElement>;
67
+ /**
68
+ * Focus the input on initial render
69
+ */
22
70
  isAutofocussed?: boolean;
71
+ /**
72
+ * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
73
+ */
23
74
  isDisabled?: boolean;
75
+ /**
76
+ * Indicates that the field is displaying read-only content
77
+ */
24
78
  isReadOnly?: boolean;
79
+ /**
80
+ * Placeholder text for the input
81
+ */
25
82
  placeholder?: string;
83
+ /**
84
+ * Password autocomplete mode
85
+ */
26
86
  autoComplete?: 'on' | 'off' | 'current-password' | 'new-password';
87
+ /**
88
+ * Title of the label
89
+ */
27
90
  title: string | ReactNode;
91
+ /**
92
+ * Hint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas `description` can describe it in more depth. Can also receive a `hintIcon`.
93
+ */
28
94
  hint?: string | ReactNode;
95
+ /**
96
+ * Provides a description for the title.
97
+ */
29
98
  description?: string | ReactNode;
99
+ /**
100
+ * Function called when info button is pressed.
101
+ * <br />
102
+ * Info button will only be visible when this prop is passed.
103
+ */
30
104
  onInfoButtonClick?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
105
+ /**
106
+ * Icon to be displayed beside the hint text.
107
+ * <br />
108
+ * Will only get rendered when `hint` is passed as well.
109
+ */
31
110
  hintIcon?: ReactElement;
111
+ /**
112
+ * Badge to be displayed beside the label.
113
+ * <br />
114
+ * Might be used to display additional information about the content of the field (E.g verified email)
115
+ */
32
116
  badge?: ReactNode;
117
+ /**
118
+ * Determines whether to render the "Show/Hide" button for the password field.
119
+ */
33
120
  renderShowHideButton?: boolean;
34
121
  };
35
122
  declare const PasswordField: {
36
123
  (props: TPasswordField): import("@emotion/react/jsx-runtime").JSX.Element;
37
124
  displayName: string;
38
125
  defaultProps: Pick<TPasswordField, "horizontalConstraint" | "renderShowHideButton">;
126
+ /**
127
+ * Use this function to convert the Formik `errors` object type to
128
+ * our custom field errors type.
129
+ * This is primarly useful when using TypeScript.
130
+ */
39
131
  toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
40
132
  };
41
133
  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.8.0",
4
+ "version": "19.10.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.8.0",
25
- "@commercetools-uikit/design-system": "19.8.0",
26
- "@commercetools-uikit/field-errors": "19.8.0",
27
- "@commercetools-uikit/field-label": "19.8.0",
28
- "@commercetools-uikit/field-warnings": "19.8.0",
29
- "@commercetools-uikit/flat-button": "19.8.0",
30
- "@commercetools-uikit/hooks": "19.8.0",
31
- "@commercetools-uikit/icons": "19.8.0",
32
- "@commercetools-uikit/password-input": "19.8.0",
33
- "@commercetools-uikit/spacings-inline": "19.8.0",
34
- "@commercetools-uikit/spacings-stack": "19.8.0",
35
- "@commercetools-uikit/utils": "19.8.0",
24
+ "@commercetools-uikit/constraints": "19.10.0",
25
+ "@commercetools-uikit/design-system": "19.10.0",
26
+ "@commercetools-uikit/field-errors": "19.10.0",
27
+ "@commercetools-uikit/field-label": "19.10.0",
28
+ "@commercetools-uikit/field-warnings": "19.10.0",
29
+ "@commercetools-uikit/flat-button": "19.10.0",
30
+ "@commercetools-uikit/hooks": "19.10.0",
31
+ "@commercetools-uikit/icons": "19.10.0",
32
+ "@commercetools-uikit/password-input": "19.10.0",
33
+ "@commercetools-uikit/spacings-inline": "19.10.0",
34
+ "@commercetools-uikit/spacings-stack": "19.10.0",
35
+ "@commercetools-uikit/utils": "19.10.0",
36
36
  "@emotion/react": "^11.10.5",
37
37
  "@emotion/styled": "^11.10.5",
38
38
  "prop-types": "15.8.1"