@commercetools-uikit/async-select-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 +18 -0
- package/dist/commercetools-uikit-async-select-field.cjs.dev.js +12 -1
- package/dist/commercetools-uikit-async-select-field.cjs.prod.js +12 -1
- package/dist/commercetools-uikit-async-select-field.esm.js +12 -1
- package/dist/declarations/src/async-select-field.d.ts +4 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -145,3 +145,21 @@ When the `key` is known, and when the value is truthy, and when `renderError` re
|
|
|
145
145
|
Known error keys are:
|
|
146
146
|
|
|
147
147
|
- `missing`: tells the user that this field is required
|
|
148
|
+
|
|
149
|
+
## Static methods
|
|
150
|
+
|
|
151
|
+
### `AsyncSelectField.toFieldErrors`
|
|
152
|
+
|
|
153
|
+
Use this function to convert the Formik `errors` object type to our custom field errors type. This is primarily useful when using TypeScript.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
type FormValues = {
|
|
157
|
+
myField: string;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
<AsyncSelectField
|
|
161
|
+
// ...
|
|
162
|
+
name="my-field"
|
|
163
|
+
errors={AsyncSelectField.toFieldErrors<FormValues>(formik.errors).myField}
|
|
164
|
+
/>;
|
|
165
|
+
```
|
|
@@ -171,6 +171,17 @@ var AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
|
171
171
|
})
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
+
}], [{
|
|
175
|
+
key: "toFieldErrors",
|
|
176
|
+
value:
|
|
177
|
+
/**
|
|
178
|
+
* Use this function to convert the Formik `errors` object type to
|
|
179
|
+
* our custom field errors type.
|
|
180
|
+
* This is primarly useful when using TypeScript.
|
|
181
|
+
*/
|
|
182
|
+
function toFieldErrors(errors) {
|
|
183
|
+
return errors;
|
|
184
|
+
}
|
|
174
185
|
}]);
|
|
175
186
|
|
|
176
187
|
return AsyncSelectField;
|
|
@@ -212,7 +223,7 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
212
223
|
} : {};
|
|
213
224
|
|
|
214
225
|
// NOTE: This string will be replaced on build time with the package version.
|
|
215
|
-
var version = "14.0.
|
|
226
|
+
var version = "14.0.1";
|
|
216
227
|
|
|
217
228
|
exports["default"] = AsyncSelectField;
|
|
218
229
|
exports.version = version;
|
|
@@ -164,6 +164,17 @@ var AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
|
164
164
|
})
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
|
+
}], [{
|
|
168
|
+
key: "toFieldErrors",
|
|
169
|
+
value:
|
|
170
|
+
/**
|
|
171
|
+
* Use this function to convert the Formik `errors` object type to
|
|
172
|
+
* our custom field errors type.
|
|
173
|
+
* This is primarly useful when using TypeScript.
|
|
174
|
+
*/
|
|
175
|
+
function toFieldErrors(errors) {
|
|
176
|
+
return errors;
|
|
177
|
+
}
|
|
167
178
|
}]);
|
|
168
179
|
|
|
169
180
|
return AsyncSelectField;
|
|
@@ -182,7 +193,7 @@ AsyncSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
182
193
|
AsyncSelectField.propTypes = {};
|
|
183
194
|
|
|
184
195
|
// NOTE: This string will be replaced on build time with the package version.
|
|
185
|
-
var version = "14.0.
|
|
196
|
+
var version = "14.0.1";
|
|
186
197
|
|
|
187
198
|
exports["default"] = AsyncSelectField;
|
|
188
199
|
exports.version = version;
|
|
@@ -145,6 +145,17 @@ var AsyncSelectField = /*#__PURE__*/function (_Component) {
|
|
|
145
145
|
})
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
+
}], [{
|
|
149
|
+
key: "toFieldErrors",
|
|
150
|
+
value:
|
|
151
|
+
/**
|
|
152
|
+
* Use this function to convert the Formik `errors` object type to
|
|
153
|
+
* our custom field errors type.
|
|
154
|
+
* This is primarly useful when using TypeScript.
|
|
155
|
+
*/
|
|
156
|
+
function toFieldErrors(errors) {
|
|
157
|
+
return errors;
|
|
158
|
+
}
|
|
148
159
|
}]);
|
|
149
160
|
|
|
150
161
|
return AsyncSelectField;
|
|
@@ -186,6 +197,6 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
186
197
|
} : {};
|
|
187
198
|
|
|
188
199
|
// NOTE: This string will be replaced on build time with the package version.
|
|
189
|
-
var version = "14.0.
|
|
200
|
+
var version = "14.0.1";
|
|
190
201
|
|
|
191
202
|
export { AsyncSelectField as default, version };
|
|
@@ -4,6 +4,9 @@ import type { GroupBase, OptionsOrGroups, ActionMeta } from 'react-select';
|
|
|
4
4
|
declare type ReactSelectAsyncProps = AsyncProps<unknown, boolean, GroupBase<unknown>>;
|
|
5
5
|
declare type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
|
|
6
6
|
declare type TFieldErrors = Record<string, boolean>;
|
|
7
|
+
declare type TCustomFormErrors<Values> = {
|
|
8
|
+
[K in keyof Values]?: TFieldErrors;
|
|
9
|
+
};
|
|
7
10
|
declare type TEvent = {
|
|
8
11
|
target: {
|
|
9
12
|
name?: string;
|
|
@@ -69,6 +72,7 @@ export default class AsyncSelectField extends Component<TAsyncSelectFieldProps,
|
|
|
69
72
|
static getDerivedStateFromProps: (props: TAsyncSelectFieldProps, state: TAsyncSelectFieldState) => {
|
|
70
73
|
id: string;
|
|
71
74
|
};
|
|
75
|
+
static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
|
|
72
76
|
render(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
73
77
|
}
|
|
74
78
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/async-select-field",
|
|
3
3
|
"description": "A controlled input component with validation states and a label getting a selection from an asynchronously loaded list from the user.",
|
|
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/async-select-input": "14.0.
|
|
25
|
-
"@commercetools-uikit/constraints": "14.0.
|
|
24
|
+
"@commercetools-uikit/async-select-input": "14.0.1",
|
|
25
|
+
"@commercetools-uikit/constraints": "14.0.1",
|
|
26
26
|
"@commercetools-uikit/design-system": "14.0.0",
|
|
27
|
-
"@commercetools-uikit/field-errors": "14.0.
|
|
28
|
-
"@commercetools-uikit/field-label": "14.0.
|
|
29
|
-
"@commercetools-uikit/spacings": "14.0.
|
|
30
|
-
"@commercetools-uikit/utils": "14.0.
|
|
27
|
+
"@commercetools-uikit/field-errors": "14.0.1",
|
|
28
|
+
"@commercetools-uikit/field-label": "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",
|