@commercetools-uikit/date-field 19.9.0 → 19.11.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.
@@ -194,7 +194,7 @@ DateField.propTypes = process.env.NODE_ENV !== "production" ? {
194
194
  var DateField$1 = DateField;
195
195
 
196
196
  // NOTE: This string will be replaced on build time with the package version.
197
- var version = "19.9.0";
197
+ var version = "19.11.0";
198
198
 
199
199
  exports["default"] = DateField$1;
200
200
  exports.version = version;
@@ -163,7 +163,7 @@ DateField.propTypes = {};
163
163
  var DateField$1 = DateField;
164
164
 
165
165
  // NOTE: This string will be replaced on build time with the package version.
166
- var version = "19.9.0";
166
+ var version = "19.11.0";
167
167
 
168
168
  exports["default"] = DateField$1;
169
169
  exports.version = version;
@@ -169,6 +169,6 @@ DateField.propTypes = process.env.NODE_ENV !== "production" ? {
169
169
  var DateField$1 = DateField;
170
170
 
171
171
  // NOTE: This string will be replaced on build time with the package version.
172
- var version = "19.9.0";
172
+ var version = "19.11.0";
173
173
 
174
174
  export { DateField$1 as default, version };
@@ -14,30 +14,118 @@ type TCustomEvent = {
14
14
  };
15
15
  };
16
16
  export type TDateFieldProps = {
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. This function can return a message which will be wrapped in an WarningMessage. It can also return null to show no warning.
43
+ */
22
44
  renderWarning?: TWarningRenderer;
45
+ /**
46
+ * Indicates if the value is required. Shows an the "required asterisk" if so.
47
+ */
23
48
  isRequired?: boolean;
49
+ /**
50
+ * Indicates whether the field was touched. Errors will only be shown when the field was touched.
51
+ */
24
52
  touched?: boolean;
53
+ /**
54
+ * Used as HTML name of the input component.
55
+ */
25
56
  name?: string;
57
+ /**
58
+ * Value of the input
59
+ */
26
60
  value: string;
61
+ /**
62
+ * Called with an event containing the new value.
63
+ * This is always called with either an empty string or a valid date in the format of `YYYY-MM-DD`.
64
+ * <br/>
65
+ * Parent should pass it back as `value`.
66
+ */
27
67
  onChange?: (event: TCustomEvent) => void;
68
+ /**
69
+ * Called when input is blurred
70
+ */
28
71
  onBlur?: (event: TCustomEvent) => void;
72
+ /**
73
+ * Called when input is focused
74
+ */
29
75
  onFocus?: FocusEventHandler;
76
+ /**
77
+ * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
78
+ */
30
79
  isDisabled?: boolean;
80
+ /**
81
+ * Indicates that the field is displaying read-only content
82
+ */
31
83
  isReadOnly?: boolean;
84
+ /**
85
+ * Placeholder text for the input
86
+ */
32
87
  placeholder?: string;
88
+ /**
89
+ * Use this property to reduce the paddings of the component for a ui compact variant
90
+ */
33
91
  isCondensed?: boolean;
92
+ /**
93
+ * A minimum selectable date. Must either be an empty string or a date formatted as "YYYY-MM-DD".
94
+ */
34
95
  minValue?: string;
96
+ /**
97
+ * A maximum selectable date. Must either be an empty string or a date formatted as "YYYY-MM-DD".
98
+ */
35
99
  maxValue?: string;
100
+ /**
101
+ * Title of the label
102
+ */
36
103
  title: string | ReactNode;
104
+ /**
105
+ * 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`.
106
+ */
37
107
  hint?: string | ReactNode;
108
+ /**
109
+ * Provides a description for the title.
110
+ */
38
111
  description?: string | ReactNode;
112
+ /**
113
+ * Function called when info button is pressed.
114
+ * <br />
115
+ * Info button will only be visible when this prop is passed.
116
+ */
39
117
  onInfoButtonClick?: () => void;
118
+ /**
119
+ * Icon to be displayed beside the hint text.
120
+ * <br />
121
+ * Will only get rendered when `hint` is passed as well.
122
+ */
40
123
  hintIcon?: ReactElement;
124
+ /**
125
+ * Badge to be displayed beside the label.
126
+ * <br />
127
+ * Might be used to display additional information about the content of the field (E.g verified email)
128
+ */
41
129
  badge?: ReactNode;
42
130
  };
43
131
  type TDateFieldState = Pick<TDateFieldProps, 'id'>;
@@ -52,6 +140,11 @@ declare class DateField extends Component<TDateFieldProps, TDateFieldState> {
52
140
  static getDerivedStateFromProps: (props: TDateFieldProps, state: TDateFieldState) => {
53
141
  id: string;
54
142
  };
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
+ */
55
148
  static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
56
149
  render(): import("@emotion/react/jsx-runtime").JSX.Element;
57
150
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/date-field",
3
3
  "description": "A controlled date input component for single date, with validation states and a label.",
4
- "version": "19.9.0",
4
+ "version": "19.11.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.9.0",
25
- "@commercetools-uikit/date-input": "19.9.0",
26
- "@commercetools-uikit/design-system": "19.9.0",
27
- "@commercetools-uikit/field-errors": "19.9.0",
28
- "@commercetools-uikit/field-label": "19.9.0",
29
- "@commercetools-uikit/field-warnings": "19.9.0",
30
- "@commercetools-uikit/spacings": "19.9.0",
31
- "@commercetools-uikit/utils": "19.9.0",
24
+ "@commercetools-uikit/constraints": "19.11.0",
25
+ "@commercetools-uikit/date-input": "19.11.0",
26
+ "@commercetools-uikit/design-system": "19.11.0",
27
+ "@commercetools-uikit/field-errors": "19.11.0",
28
+ "@commercetools-uikit/field-label": "19.11.0",
29
+ "@commercetools-uikit/field-warnings": "19.11.0",
30
+ "@commercetools-uikit/spacings": "19.11.0",
31
+ "@commercetools-uikit/utils": "19.11.0",
32
32
  "@emotion/react": "^11.10.5",
33
33
  "@emotion/styled": "^11.10.5",
34
34
  "prop-types": "15.8.1",