@commercetools-uikit/time-field 13.0.2 → 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 CHANGED
@@ -123,3 +123,21 @@ Known error keys are:
123
123
  ## Main Functions and use cases are:
124
124
 
125
125
  - Input field for a single date
126
+
127
+ ## Static methods
128
+
129
+ ### `TimeField.toFieldErrors`
130
+
131
+ Use this function to convert the Formik `errors` object type to our custom field errors type. This is primarily useful when using TypeScript.
132
+
133
+ ```ts
134
+ type FormValues = {
135
+ myField: string;
136
+ };
137
+
138
+ <TimeField
139
+ // ...
140
+ name="my-field"
141
+ errors={TimeField.toFieldErrors<FormValues>(formik.errors).myField}
142
+ />;
143
+ ```
@@ -139,6 +139,17 @@ var TimeField = /*#__PURE__*/function (_Component) {
139
139
  })
140
140
  });
141
141
  }
142
+ }], [{
143
+ key: "toFieldErrors",
144
+ value:
145
+ /**
146
+ * Use this function to convert the Formik `errors` object type to
147
+ * our custom field errors type.
148
+ * This is primarily useful when using TypeScript.
149
+ */
150
+ function toFieldErrors(errors) {
151
+ return errors;
152
+ }
142
153
  }]);
143
154
 
144
155
  return TimeField;
@@ -182,7 +193,7 @@ TimeField.propTypes = process.env.NODE_ENV !== "production" ? {
182
193
  var TimeField$1 = TimeField;
183
194
 
184
195
  // NOTE: This string will be replaced on build time with the package version.
185
- var version = "13.0.2";
196
+ var version = "14.0.1";
186
197
 
187
198
  exports["default"] = TimeField$1;
188
199
  exports.version = version;
@@ -134,6 +134,17 @@ var TimeField = /*#__PURE__*/function (_Component) {
134
134
  })
135
135
  });
136
136
  }
137
+ }], [{
138
+ key: "toFieldErrors",
139
+ value:
140
+ /**
141
+ * Use this function to convert the Formik `errors` object type to
142
+ * our custom field errors type.
143
+ * This is primarily useful when using TypeScript.
144
+ */
145
+ function toFieldErrors(errors) {
146
+ return errors;
147
+ }
137
148
  }]);
138
149
 
139
150
  return TimeField;
@@ -154,7 +165,7 @@ TimeField.propTypes = {};
154
165
  var TimeField$1 = TimeField;
155
166
 
156
167
  // NOTE: This string will be replaced on build time with the package version.
157
- var version = "13.0.2";
168
+ var version = "14.0.1";
158
169
 
159
170
  exports["default"] = TimeField$1;
160
171
  exports.version = version;
@@ -114,6 +114,17 @@ var TimeField = /*#__PURE__*/function (_Component) {
114
114
  })
115
115
  });
116
116
  }
117
+ }], [{
118
+ key: "toFieldErrors",
119
+ value:
120
+ /**
121
+ * Use this function to convert the Formik `errors` object type to
122
+ * our custom field errors type.
123
+ * This is primarily useful when using TypeScript.
124
+ */
125
+ function toFieldErrors(errors) {
126
+ return errors;
127
+ }
117
128
  }]);
118
129
 
119
130
  return TimeField;
@@ -157,6 +168,6 @@ TimeField.propTypes = process.env.NODE_ENV !== "production" ? {
157
168
  var TimeField$1 = TimeField;
158
169
 
159
170
  // NOTE: This string will be replaced on build time with the package version.
160
- var version = "13.0.2";
171
+ var version = "14.0.1";
161
172
 
162
173
  export { TimeField$1 as default, version };
@@ -8,6 +8,9 @@ declare type TEvent = {
8
8
  persist?: () => void;
9
9
  };
10
10
  declare type TFieldErrors = Record<string, boolean>;
11
+ declare type TCustomFormErrors<Values> = {
12
+ [K in keyof Values]?: TFieldErrors;
13
+ };
11
14
  declare type TTimeFieldProps = {
12
15
  id?: string;
13
16
  horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
@@ -42,6 +45,7 @@ declare class TimeField extends Component<TTimeFieldProps, TTimeFieldState> {
42
45
  static getDerivedStateFromProps: (props: TTimeFieldProps, state: TTimeFieldState) => {
43
46
  id: string;
44
47
  };
48
+ static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
45
49
  render(): import("@emotion/react/jsx-runtime").JSX.Element;
46
50
  }
47
51
  export default TimeField;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/time-field",
3
3
  "description": "A controlled date input component for single date.",
4
- "version": "13.0.2",
4
+ "version": "14.0.1",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  "directory": "packages/components/fields/time-field"
10
10
  },
11
11
  "homepage": "https://uikit.commercetools.com",
12
- "keywords": ["javascript", "design system", "react", "uikit"],
12
+ "keywords": ["javascript", "typescript", "design-system", "react", "uikit"],
13
13
  "license": "MIT",
14
14
  "publishConfig": {
15
15
  "access": "public"
@@ -19,19 +19,19 @@
19
19
  "module": "dist/commercetools-uikit-time-field.esm.js",
20
20
  "files": ["dist"],
21
21
  "dependencies": {
22
- "@babel/runtime": "7.17.2",
23
- "@babel/runtime-corejs3": "7.17.2",
24
- "@commercetools-uikit/constraints": "13.0.2",
25
- "@commercetools-uikit/design-system": "13.0.0",
26
- "@commercetools-uikit/field-errors": "13.0.2",
27
- "@commercetools-uikit/field-label": "13.0.2",
28
- "@commercetools-uikit/spacings-stack": "13.0.2",
29
- "@commercetools-uikit/time-input": "13.0.2",
30
- "@commercetools-uikit/utils": "13.0.2",
22
+ "@babel/runtime": "^7.17.2",
23
+ "@babel/runtime-corejs3": "^7.17.2",
24
+ "@commercetools-uikit/constraints": "14.0.1",
25
+ "@commercetools-uikit/design-system": "14.0.0",
26
+ "@commercetools-uikit/field-errors": "14.0.1",
27
+ "@commercetools-uikit/field-label": "14.0.1",
28
+ "@commercetools-uikit/spacings-stack": "14.0.1",
29
+ "@commercetools-uikit/time-input": "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",
34
- "react-required-if": "1.0.3"
34
+ "react-intl": "^5.24.6"
35
35
  },
36
36
  "devDependencies": {
37
37
  "react": "17.0.2"