@commercetools-uikit/multiline-text-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.
@@ -190,7 +190,7 @@ MultilineTextField.propTypes = process.env.NODE_ENV !== "production" ? {
190
190
  var MultilineTextField$1 = MultilineTextField;
191
191
 
192
192
  // NOTE: This string will be replaced on build time with the package version.
193
- var version = "19.8.0";
193
+ var version = "19.10.0";
194
194
 
195
195
  exports["default"] = MultilineTextField$1;
196
196
  exports.version = version;
@@ -159,7 +159,7 @@ MultilineTextField.propTypes = {};
159
159
  var MultilineTextField$1 = MultilineTextField;
160
160
 
161
161
  // NOTE: This string will be replaced on build time with the package version.
162
- var version = "19.8.0";
162
+ var version = "19.10.0";
163
163
 
164
164
  exports["default"] = MultilineTextField$1;
165
165
  exports.version = version;
@@ -165,6 +165,6 @@ MultilineTextField.propTypes = process.env.NODE_ENV !== "production" ? {
165
165
  var MultilineTextField$1 = MultilineTextField;
166
166
 
167
167
  // NOTE: This string will be replaced on build time with the package version.
168
- var version = "19.8.0";
168
+ var version = "19.10.0";
169
169
 
170
170
  export { MultilineTextField$1 as default, version };
@@ -5,30 +5,117 @@ type TCustomFormErrors<Values> = {
5
5
  [K in keyof Values]?: TFieldErrors;
6
6
  };
7
7
  export type TMultiTextFieldProps = {
8
+ /**
9
+ * Used as HTML id property. An id is auto-generated when it is not specified.
10
+ */
8
11
  id?: string;
12
+ /**
13
+ * Horizontal size limit of the input fields.
14
+ */
9
15
  horizontalConstraint?: 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
16
+ /**
17
+ * 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.
18
+ */
10
19
  renderError?: TErrorRenderer;
20
+ /**
21
+ * Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
22
+ * <br />
23
+ * It can also return null to show no warning.
24
+ */
11
25
  renderWarning?: (key: string, warning?: boolean) => ReactNode;
26
+ /**
27
+ * Indicates if the value is required. Shows an the "required asterisk" if so.
28
+ */
12
29
  isRequired?: boolean;
30
+ /**
31
+ * Indicates whether the field was touched. Errors will only be shown when the field was touched.
32
+ */
13
33
  touched?: boolean;
34
+ /**
35
+ * Used as HTML `autocomplete` property
36
+ */
14
37
  autoComplete?: string;
38
+ /**
39
+ * Used as HTML name of the input component. property
40
+ */
15
41
  name?: string;
42
+ /**
43
+ * Value of the input component.
44
+ */
16
45
  value: string;
46
+ /**
47
+ * Called with an event containing the new value. Required when input is not read only. Parent should pass it back as value.
48
+ */
17
49
  onChange?: ChangeEventHandler<HTMLTextAreaElement>;
50
+ /**
51
+ * Called when input is blurred
52
+ */
18
53
  onBlur?: FocusEventHandler<HTMLTextAreaElement>;
54
+ /**
55
+ * Called when input is focused
56
+ */
19
57
  onFocus?: FocusEventHandler<HTMLTextAreaElement>;
58
+ /**
59
+ * Focus the input on initial render
60
+ */
20
61
  isAutofocussed?: boolean;
62
+ /**
63
+ * Expands multiline text input initially
64
+ */
21
65
  defaultExpandMultilineText?: boolean;
66
+ /**
67
+ * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
68
+ */
22
69
  isDisabled?: boolean;
70
+ /**
71
+ * Indicates that the field is displaying read-only content
72
+ */
23
73
  isReadOnly?: boolean;
74
+ /**
75
+ * Placeholder text for the input
76
+ */
24
77
  placeholder?: string;
78
+ /**
79
+ * A map of errors. Error messages for known errors are rendered automatically.
80
+ * <br />
81
+ * Unknown errors will be forwarded to `renderError`
82
+ */
25
83
  errors?: TFieldErrors;
84
+ /**
85
+ * A map of warnings. Warning messages for known warnings are rendered automatically.
86
+ * <br/>
87
+ * Unknown warnings will be forwarded to renderWarning.
88
+ */
26
89
  warnings?: TFieldWarnings;
90
+ /**
91
+ * Title of the label
92
+ */
27
93
  title?: string | ReactNode;
94
+ /**
95
+ * 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`.
96
+ */
28
97
  hint?: string | ReactNode;
98
+ /**
99
+ * Provides a description for the title.
100
+ */
29
101
  description?: string | ReactNode;
102
+ /**
103
+ * Function called when info button is pressed.
104
+ * <br />
105
+ * Info button will only be visible when this prop is passed.
106
+ */
30
107
  onInfoButtonClick?: () => void;
108
+ /**
109
+ * Icon to be displayed beside the hint text.
110
+ * <br />
111
+ * Will only get rendered when `hint` is passed as well.
112
+ */
31
113
  hintIcon?: ReactElement;
114
+ /**
115
+ * Badge to be displayed beside the label.
116
+ * <br />
117
+ * Might be used to display additional information about the content of the field (E.g verified email)
118
+ */
32
119
  badge?: string;
33
120
  };
34
121
  type TState = {
@@ -44,6 +131,11 @@ declare class MultilineTextField extends Component<TMultiTextFieldProps, TState>
44
131
  static getDerivedStateFromProps: (props: TMultiTextFieldProps, state: TState) => {
45
132
  id: string;
46
133
  };
134
+ /**
135
+ * Use this function to convert the Formik `errors` object type to
136
+ * our custom field errors type.
137
+ * This is primarly useful when using TypeScript.
138
+ */
47
139
  static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
48
140
  render(): import("@emotion/react/jsx-runtime").JSX.Element;
49
141
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/multiline-text-field",
3
3
  "description": "A controlled text input component for multi-line strings with validation states and a label.",
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,14 +21,14 @@
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/multiline-text-input": "19.8.0",
30
- "@commercetools-uikit/spacings": "19.8.0",
31
- "@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/multiline-text-input": "19.10.0",
30
+ "@commercetools-uikit/spacings": "19.10.0",
31
+ "@commercetools-uikit/utils": "19.10.0",
32
32
  "@emotion/react": "^11.10.5",
33
33
  "@emotion/styled": "^11.10.5",
34
34
  "prop-types": "15.8.1",