@commercetools-uikit/date-range-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-date-range-field.cjs.dev.js +12 -1
- package/dist/commercetools-uikit-date-range-field.cjs.prod.js +12 -1
- package/dist/commercetools-uikit-date-range-field.esm.js +12 -1
- package/dist/declarations/src/date-range-field.d.ts +4 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -119,3 +119,21 @@ Known error keys are:
|
|
|
119
119
|
## Main Functions and use cases are:
|
|
120
120
|
|
|
121
121
|
- Input field for a single date
|
|
122
|
+
|
|
123
|
+
## Static methods
|
|
124
|
+
|
|
125
|
+
### `DateRangeField.toFieldErrors`
|
|
126
|
+
|
|
127
|
+
Use this function to convert the Formik `errors` object type to our custom field errors type. This is primarily useful when using TypeScript.
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
type FormValues = {
|
|
131
|
+
myField: string;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
<DateRangeField
|
|
135
|
+
// ...
|
|
136
|
+
name="my-field"
|
|
137
|
+
errors={DateRangeField.toFieldErrors<FormValues>(formik.errors).myField}
|
|
138
|
+
/>;
|
|
139
|
+
```
|
|
@@ -142,6 +142,17 @@ var DateRangeField = /*#__PURE__*/function (_Component) {
|
|
|
142
142
|
})
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
+
}], [{
|
|
146
|
+
key: "toFieldErrors",
|
|
147
|
+
value:
|
|
148
|
+
/**
|
|
149
|
+
* Use this function to convert the Formik `errors` object type to
|
|
150
|
+
* our custom field errors type.
|
|
151
|
+
* This is primarly useful when using TypeScript.
|
|
152
|
+
*/
|
|
153
|
+
function toFieldErrors(errors) {
|
|
154
|
+
return errors;
|
|
155
|
+
}
|
|
145
156
|
}]);
|
|
146
157
|
|
|
147
158
|
return DateRangeField;
|
|
@@ -183,7 +194,7 @@ DateRangeField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
183
194
|
var DateRangeField$1 = DateRangeField;
|
|
184
195
|
|
|
185
196
|
// NOTE: This string will be replaced on build time with the package version.
|
|
186
|
-
var version = "14.0.
|
|
197
|
+
var version = "14.0.1";
|
|
187
198
|
|
|
188
199
|
exports["default"] = DateRangeField$1;
|
|
189
200
|
exports.version = version;
|
|
@@ -137,6 +137,17 @@ var DateRangeField = /*#__PURE__*/function (_Component) {
|
|
|
137
137
|
})
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
+
}], [{
|
|
141
|
+
key: "toFieldErrors",
|
|
142
|
+
value:
|
|
143
|
+
/**
|
|
144
|
+
* Use this function to convert the Formik `errors` object type to
|
|
145
|
+
* our custom field errors type.
|
|
146
|
+
* This is primarly useful when using TypeScript.
|
|
147
|
+
*/
|
|
148
|
+
function toFieldErrors(errors) {
|
|
149
|
+
return errors;
|
|
150
|
+
}
|
|
140
151
|
}]);
|
|
141
152
|
|
|
142
153
|
return DateRangeField;
|
|
@@ -157,7 +168,7 @@ DateRangeField.propTypes = {};
|
|
|
157
168
|
var DateRangeField$1 = DateRangeField;
|
|
158
169
|
|
|
159
170
|
// NOTE: This string will be replaced on build time with the package version.
|
|
160
|
-
var version = "14.0.
|
|
171
|
+
var version = "14.0.1";
|
|
161
172
|
|
|
162
173
|
exports["default"] = DateRangeField$1;
|
|
163
174
|
exports.version = version;
|
|
@@ -117,6 +117,17 @@ var DateRangeField = /*#__PURE__*/function (_Component) {
|
|
|
117
117
|
})
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
+
}], [{
|
|
121
|
+
key: "toFieldErrors",
|
|
122
|
+
value:
|
|
123
|
+
/**
|
|
124
|
+
* Use this function to convert the Formik `errors` object type to
|
|
125
|
+
* our custom field errors type.
|
|
126
|
+
* This is primarly useful when using TypeScript.
|
|
127
|
+
*/
|
|
128
|
+
function toFieldErrors(errors) {
|
|
129
|
+
return errors;
|
|
130
|
+
}
|
|
120
131
|
}]);
|
|
121
132
|
|
|
122
133
|
return DateRangeField;
|
|
@@ -158,6 +169,6 @@ DateRangeField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
158
169
|
var DateRangeField$1 = DateRangeField;
|
|
159
170
|
|
|
160
171
|
// NOTE: This string will be replaced on build time with the package version.
|
|
161
|
-
var version = "14.0.
|
|
172
|
+
var version = "14.0.1";
|
|
162
173
|
|
|
163
174
|
export { DateRangeField$1 as default, version };
|
|
@@ -2,6 +2,9 @@ import { Component, type ReactElement, type ReactNode } from 'react';
|
|
|
2
2
|
import type { MomentInput } from 'moment';
|
|
3
3
|
declare type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
|
|
4
4
|
declare type TFieldErrors = Record<string, boolean>;
|
|
5
|
+
declare type TCustomFormErrors<Values> = {
|
|
6
|
+
[K in keyof Values]?: TFieldErrors;
|
|
7
|
+
};
|
|
5
8
|
declare type TEvent = {
|
|
6
9
|
target: {
|
|
7
10
|
id?: string;
|
|
@@ -41,6 +44,7 @@ declare class DateRangeField extends Component<TDateRangeFieldProps, TDateRangeF
|
|
|
41
44
|
static getDerivedStateFromProps: (props: TDateRangeFieldProps, state: TDateRangeFieldState) => {
|
|
42
45
|
id: string;
|
|
43
46
|
};
|
|
47
|
+
static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
|
|
44
48
|
render(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
45
49
|
}
|
|
46
50
|
export default DateRangeField;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/date-range-field",
|
|
3
3
|
"description": "A controlled date input component for a date range, with validation states and a label.",
|
|
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.
|
|
25
|
-
"@commercetools-uikit/date-range-input": "14.0.
|
|
24
|
+
"@commercetools-uikit/constraints": "14.0.1",
|
|
25
|
+
"@commercetools-uikit/date-range-input": "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",
|