@commercetools-uikit/date-range-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.
@@ -186,7 +186,7 @@ DateRangeField.propTypes = process.env.NODE_ENV !== "production" ? {
186
186
  var DateRangeField$1 = DateRangeField;
187
187
 
188
188
  // NOTE: This string will be replaced on build time with the package version.
189
- var version = "19.8.0";
189
+ var version = "19.10.0";
190
190
 
191
191
  exports["default"] = DateRangeField$1;
192
192
  exports.version = version;
@@ -157,7 +157,7 @@ DateRangeField.propTypes = {};
157
157
  var DateRangeField$1 = DateRangeField;
158
158
 
159
159
  // NOTE: This string will be replaced on build time with the package version.
160
- var version = "19.8.0";
160
+ var version = "19.10.0";
161
161
 
162
162
  exports["default"] = DateRangeField$1;
163
163
  exports.version = version;
@@ -161,6 +161,6 @@ DateRangeField.propTypes = process.env.NODE_ENV !== "production" ? {
161
161
  var DateRangeField$1 = DateRangeField;
162
162
 
163
163
  // NOTE: This string will be replaced on build time with the package version.
164
- var version = "19.8.0";
164
+ var version = "19.10.0";
165
165
 
166
166
  export { DateRangeField$1 as default, version };
@@ -14,28 +14,111 @@ type TCustomEvent = {
14
14
  };
15
15
  };
16
16
  export type TDateRangeFieldProps = {
17
+ /**
18
+ * Used as HTML id property. An id is auto-generated when it is not specified.
19
+ */
17
20
  id?: string;
21
+ /**
22
+ * Horizontal size limit of the input fields.
23
+ */
18
24
  horizontalConstraint?: 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
25
+ /**
26
+ * A map of errors. Error messages for known errors are rendered automatically.
27
+ * <br />
28
+ * Unknown errors will be forwarded to `renderError`
29
+ */
19
30
  errors?: TFieldErrors;
31
+ /**
32
+ * 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.
33
+ */
20
34
  renderError?: TErrorRenderer;
35
+ /**
36
+ * A map of warnings. Warning messages for known warnings are rendered automatically.
37
+ * <br/>
38
+ * Unknown warnings will be forwarded to renderWarning.
39
+ */
21
40
  warnings?: TFieldWarnings;
41
+ /**
42
+ * Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
43
+ * <br />
44
+ * It can also return null to show no warning.
45
+ */
22
46
  renderWarning?: (key: string, warning?: boolean) => ReactNode;
47
+ /**
48
+ * Indicates if the value is required. Shows an the "required asterisk" if so.
49
+ */
23
50
  isRequired?: boolean;
51
+ /**
52
+ * Indicates whether the field was touched. Errors will only be shown when the field was touched.
53
+ */
24
54
  touched?: boolean;
55
+ /**
56
+ * Used as HTML name of the input component.
57
+ */
25
58
  name?: string;
59
+ /**
60
+ * The selected date range. Must either be an empty array or an array of two strings holding dates formatted as "YYYY-MM-DD".
61
+ */
26
62
  value: string[];
63
+ /**
64
+ * Called when the date range changes, with an event containing either an empty array (no value) or an array holding two string in this format: "YYYY-MM-DD".
65
+ * <br/>
66
+ * Required when input is not read only.
67
+ */
27
68
  onChange?: (event: TCustomEvent) => void;
69
+ /**
70
+ * Called when input is blurred
71
+ */
28
72
  onBlur?: (event: TCustomEvent) => void;
73
+ /**
74
+ * Called when input is focused
75
+ */
29
76
  onFocus?: (event: TCustomEvent) => void;
77
+ /**
78
+ * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
79
+ */
30
80
  isDisabled?: boolean;
81
+ /**
82
+ * Indicates that the field is displaying read-only content
83
+ */
31
84
  isReadOnly?: boolean;
85
+ /**
86
+ * Placeholder text for the input
87
+ */
32
88
  placeholder?: string;
89
+ /**
90
+ * Use this property to reduce the paddings of the component for a ui compact variant
91
+ */
33
92
  isCondensed?: boolean;
93
+ /**
94
+ * Title of the label
95
+ */
34
96
  title: string | ReactNode;
97
+ /**
98
+ * 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`.
99
+ */
35
100
  hint?: string | ReactNode;
101
+ /**
102
+ * Provides a description for the title.
103
+ */
36
104
  description?: string | ReactNode;
105
+ /**
106
+ * Function called when info button is pressed.
107
+ * <br />
108
+ * Info button will only be visible when this prop is passed.
109
+ */
37
110
  onInfoButtonClick?: () => void;
111
+ /**
112
+ * Icon to be displayed beside the hint text.
113
+ * <br />
114
+ * Will only get rendered when `hint` is passed as well.
115
+ */
38
116
  hintIcon?: ReactElement;
117
+ /**
118
+ * Badge to be displayed beside the label.
119
+ * <br />
120
+ * Might be used to display additional information about the content of the field (E.g verified email)
121
+ */
39
122
  badge?: ReactNode;
40
123
  };
41
124
  type TDateRangeFieldState = Pick<TDateRangeFieldProps, 'id'>;
@@ -48,6 +131,11 @@ declare class DateRangeField extends Component<TDateRangeFieldProps, TDateRangeF
48
131
  static getDerivedStateFromProps: (props: TDateRangeFieldProps, state: TDateRangeFieldState) => {
49
132
  id: string;
50
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
+ */
51
139
  static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
52
140
  render(): import("@emotion/react/jsx-runtime").JSX.Element;
53
141
  }
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": "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/date-range-input": "19.8.0",
26
- "@commercetools-uikit/design-system": "19.8.0",
27
- "@commercetools-uikit/field-errors": "19.8.0",
28
- "@commercetools-uikit/field-label": "19.8.0",
29
- "@commercetools-uikit/field-warnings": "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/date-range-input": "19.10.0",
26
+ "@commercetools-uikit/design-system": "19.10.0",
27
+ "@commercetools-uikit/field-errors": "19.10.0",
28
+ "@commercetools-uikit/field-label": "19.10.0",
29
+ "@commercetools-uikit/field-warnings": "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",