@commercetools-uikit/localized-multiline-text-field 14.0.0 → 14.0.1
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 +20 -0
- package/dist/commercetools-uikit-localized-multiline-text-field.cjs.dev.js +12 -1
- package/dist/commercetools-uikit-localized-multiline-text-field.cjs.prod.js +12 -1
- package/dist/commercetools-uikit-localized-multiline-text-field.esm.js +12 -1
- package/dist/declarations/src/localized-multiline-text-field.d.ts +6 -2
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -144,3 +144,23 @@ When the `key` is known, and when the value is truthy, and when `renderError` re
|
|
|
144
144
|
Known error keys are:
|
|
145
145
|
|
|
146
146
|
- `missing`: tells the user that this field is required
|
|
147
|
+
|
|
148
|
+
## Static methods
|
|
149
|
+
|
|
150
|
+
### `LocalizedMultilineTextField.toFieldErrors`
|
|
151
|
+
|
|
152
|
+
Use this function to convert the Formik `errors` object type to our custom field errors type. This is primarily useful when using TypeScript.
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
type FormValues = {
|
|
156
|
+
myField: string;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
<LocalizedMultilineTextField
|
|
160
|
+
// ...
|
|
161
|
+
name="my-field"
|
|
162
|
+
errors={
|
|
163
|
+
LocalizedMultilineTextField.toFieldErrors<FormValues>(formik.errors).myField
|
|
164
|
+
}
|
|
165
|
+
/>;
|
|
166
|
+
```
|
|
@@ -149,6 +149,17 @@ var LocalizedMultilineTextField = /*#__PURE__*/function (_Component) {
|
|
|
149
149
|
})
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
+
}], [{
|
|
153
|
+
key: "toFieldErrors",
|
|
154
|
+
value:
|
|
155
|
+
/**
|
|
156
|
+
* Use this function to convert the Formik `errors` object type to
|
|
157
|
+
* our custom field errors type.
|
|
158
|
+
* This is primarly useful when using TypeScript.
|
|
159
|
+
*/
|
|
160
|
+
function toFieldErrors(errors) {
|
|
161
|
+
return errors;
|
|
162
|
+
}
|
|
152
163
|
}]);
|
|
153
164
|
|
|
154
165
|
return LocalizedMultilineTextField;
|
|
@@ -195,7 +206,7 @@ LocalizedMultilineTextField.propTypes = process.env.NODE_ENV !== "production" ?
|
|
|
195
206
|
var LocalizedMultilineTextField$1 = LocalizedMultilineTextField;
|
|
196
207
|
|
|
197
208
|
// NOTE: This string will be replaced on build time with the package version.
|
|
198
|
-
var version = "14.0.
|
|
209
|
+
var version = "14.0.1";
|
|
199
210
|
|
|
200
211
|
exports["default"] = LocalizedMultilineTextField$1;
|
|
201
212
|
exports.version = version;
|
|
@@ -144,6 +144,17 @@ var LocalizedMultilineTextField = /*#__PURE__*/function (_Component) {
|
|
|
144
144
|
})
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
+
}], [{
|
|
148
|
+
key: "toFieldErrors",
|
|
149
|
+
value:
|
|
150
|
+
/**
|
|
151
|
+
* Use this function to convert the Formik `errors` object type to
|
|
152
|
+
* our custom field errors type.
|
|
153
|
+
* This is primarly useful when using TypeScript.
|
|
154
|
+
*/
|
|
155
|
+
function toFieldErrors(errors) {
|
|
156
|
+
return errors;
|
|
157
|
+
}
|
|
147
158
|
}]);
|
|
148
159
|
|
|
149
160
|
return LocalizedMultilineTextField;
|
|
@@ -164,7 +175,7 @@ LocalizedMultilineTextField.propTypes = {};
|
|
|
164
175
|
var LocalizedMultilineTextField$1 = LocalizedMultilineTextField;
|
|
165
176
|
|
|
166
177
|
// NOTE: This string will be replaced on build time with the package version.
|
|
167
|
-
var version = "14.0.
|
|
178
|
+
var version = "14.0.1";
|
|
168
179
|
|
|
169
180
|
exports["default"] = LocalizedMultilineTextField$1;
|
|
170
181
|
exports.version = version;
|
|
@@ -124,6 +124,17 @@ var LocalizedMultilineTextField = /*#__PURE__*/function (_Component) {
|
|
|
124
124
|
})
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
+
}], [{
|
|
128
|
+
key: "toFieldErrors",
|
|
129
|
+
value:
|
|
130
|
+
/**
|
|
131
|
+
* Use this function to convert the Formik `errors` object type to
|
|
132
|
+
* our custom field errors type.
|
|
133
|
+
* This is primarly useful when using TypeScript.
|
|
134
|
+
*/
|
|
135
|
+
function toFieldErrors(errors) {
|
|
136
|
+
return errors;
|
|
137
|
+
}
|
|
127
138
|
}]);
|
|
128
139
|
|
|
129
140
|
return LocalizedMultilineTextField;
|
|
@@ -170,6 +181,6 @@ LocalizedMultilineTextField.propTypes = process.env.NODE_ENV !== "production" ?
|
|
|
170
181
|
var LocalizedMultilineTextField$1 = LocalizedMultilineTextField;
|
|
171
182
|
|
|
172
183
|
// NOTE: This string will be replaced on build time with the package version.
|
|
173
|
-
var version = "14.0.
|
|
184
|
+
var version = "14.0.1";
|
|
174
185
|
|
|
175
186
|
export { LocalizedMultilineTextField$1 as default, version };
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Component, type ReactNode, type ChangeEventHandler, type ReactElement } from 'react';
|
|
2
|
+
declare type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
|
|
3
|
+
declare type TFieldErrors = Record<string, boolean>;
|
|
4
|
+
declare type TCustomFormErrors<Values> = {
|
|
5
|
+
[K in keyof Values]?: TFieldErrors;
|
|
6
|
+
};
|
|
2
7
|
declare type TEvent = {
|
|
3
8
|
target: {
|
|
4
9
|
language: string;
|
|
@@ -40,8 +45,6 @@ declare type TLocalizedMultilineTextFieldProps = {
|
|
|
40
45
|
badge?: ReactNode;
|
|
41
46
|
};
|
|
42
47
|
declare type TLocalizedMultilineTextFieldState = Pick<TLocalizedMultilineTextFieldProps, 'id'>;
|
|
43
|
-
declare type TFieldErrors = Record<string, boolean>;
|
|
44
|
-
declare type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
|
|
45
48
|
declare class LocalizedMultilineTextField extends Component<TLocalizedMultilineTextFieldProps, TLocalizedMultilineTextFieldState> {
|
|
46
49
|
static displayName: string;
|
|
47
50
|
static defaultProps: Pick<TLocalizedMultilineTextFieldProps, 'horizontalConstraint'>;
|
|
@@ -51,6 +54,7 @@ declare class LocalizedMultilineTextField extends Component<TLocalizedMultilineT
|
|
|
51
54
|
static getDerivedStateFromProps: (props: TLocalizedMultilineTextFieldProps, state: TLocalizedMultilineTextFieldState) => {
|
|
52
55
|
id: string;
|
|
53
56
|
};
|
|
57
|
+
static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
|
|
54
58
|
render(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
55
59
|
}
|
|
56
60
|
export default LocalizedMultilineTextField;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/localized-multiline-text-field",
|
|
3
3
|
"description": "A controlled text input component for localized multi-line strings with validation states.",
|
|
4
|
-
"version": "14.0.
|
|
4
|
+
"version": "14.0.1",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.17.2",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.17.2",
|
|
24
|
-
"@commercetools-uikit/constraints": "14.0.
|
|
24
|
+
"@commercetools-uikit/constraints": "14.0.1",
|
|
25
25
|
"@commercetools-uikit/design-system": "14.0.0",
|
|
26
|
-
"@commercetools-uikit/field-errors": "14.0.
|
|
27
|
-
"@commercetools-uikit/field-label": "14.0.
|
|
28
|
-
"@commercetools-uikit/localized-multiline-text-input": "14.0.
|
|
29
|
-
"@commercetools-uikit/spacings": "14.0.
|
|
30
|
-
"@commercetools-uikit/utils": "14.0.
|
|
26
|
+
"@commercetools-uikit/field-errors": "14.0.1",
|
|
27
|
+
"@commercetools-uikit/field-label": "14.0.1",
|
|
28
|
+
"@commercetools-uikit/localized-multiline-text-input": "14.0.1",
|
|
29
|
+
"@commercetools-uikit/spacings": "14.0.1",
|
|
30
|
+
"@commercetools-uikit/utils": "14.0.1",
|
|
31
31
|
"@emotion/react": "^11.4.0",
|
|
32
32
|
"@emotion/styled": "^11.3.0",
|
|
33
33
|
"prop-types": "15.8.1",
|