@commercetools-uikit/date-time-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.
@@ -190,7 +190,7 @@ DateTimeField.propTypes = process.env.NODE_ENV !== "production" ? {
190
190
  var DateTimeField$1 = DateTimeField;
191
191
 
192
192
  // NOTE: This string will be replaced on build time with the package version.
193
- var version = "19.9.0";
193
+ var version = "19.11.0";
194
194
 
195
195
  exports["default"] = DateTimeField$1;
196
196
  exports.version = version;
@@ -159,7 +159,7 @@ DateTimeField.propTypes = {};
159
159
  var DateTimeField$1 = DateTimeField;
160
160
 
161
161
  // NOTE: This string will be replaced on build time with the package version.
162
- var version = "19.9.0";
162
+ var version = "19.11.0";
163
163
 
164
164
  exports["default"] = DateTimeField$1;
165
165
  exports.version = version;
@@ -165,6 +165,6 @@ DateTimeField.propTypes = process.env.NODE_ENV !== "production" ? {
165
165
  var DateTimeField$1 = DateTimeField;
166
166
 
167
167
  // NOTE: This string will be replaced on build time with the package version.
168
- var version = "19.9.0";
168
+ var version = "19.11.0";
169
169
 
170
170
  export { DateTimeField$1 as default, version };
@@ -13,30 +13,122 @@ type TCustomEvent = {
13
13
  };
14
14
  };
15
15
  export type TDateTimeFieldProps = {
16
+ /**
17
+ * Used as HTML id property. An id is auto-generated when it is not specified.
18
+ */
16
19
  id?: string;
20
+ /**
21
+ * Horizontal size limit of the input fields.
22
+ */
17
23
  horizontalConstraint?: 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
24
+ /**
25
+ * A map of errors. Error messages for known errors are rendered automatically.
26
+ * <br />
27
+ * Unknown errors will be forwarded to `renderError`
28
+ */
18
29
  errors?: TFieldErrors;
30
+ /**
31
+ * 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.
32
+ */
19
33
  renderError?: TErrorRenderer;
34
+ /**
35
+ * A map of warnings. Warning messages for known warnings are rendered automatically.
36
+ * <br/>
37
+ * Unknown warnings will be forwarded to renderWarning.
38
+ */
20
39
  warnings?: TFieldWarnings;
40
+ /**
41
+ * Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
42
+ * <br />
43
+ * It can also return null to show no warning.
44
+ */
21
45
  renderWarning?: (key: string, warning?: boolean) => ReactNode;
46
+ /**
47
+ * Indicates if the value is required. Shows an the "required asterisk" if so.
48
+ */
22
49
  isRequired?: boolean;
50
+ /**
51
+ * Indicates whether the field was touched. Errors will only be shown when the field was touched.
52
+ */
23
53
  touched?: boolean;
54
+ /**
55
+ * Used as HTML name of the input component.
56
+ */
24
57
  name?: string;
58
+ /**
59
+ * Value of the input
60
+ */
25
61
  value: string;
62
+ /**
63
+ * Called with an event holding the new value.
64
+ * <br/>
65
+ * Required when input is not read only. Parent should pass it back as `value`-
66
+ */
26
67
  onChange?: (event: TCustomEvent) => void;
68
+ /**
69
+ * Called when input is blurred
70
+ */
27
71
  onBlur?: (event: TCustomEvent) => void;
72
+ /**
73
+ * Called when input is focused
74
+ */
28
75
  onFocus?: FocusEventHandler;
76
+ /**
77
+ * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
78
+ */
29
79
  isDisabled?: boolean;
80
+ /**
81
+ * Indicates that the field is displaying read-only content
82
+ */
30
83
  isReadOnly?: boolean;
84
+ /**
85
+ * Placeholder text for the input
86
+ */
31
87
  placeholder?: string;
88
+ /**
89
+ * Use this property to reduce the paddings of the component for a ui compact variant
90
+ */
32
91
  isCondensed?: boolean;
92
+ /**
93
+ * Specifies the time zone in which the calendar and selected values are shown. It also influences how entered dates and times are parsed.
94
+ * <br />
95
+ * See the `DateTimeInput` docs for more information.
96
+ */
33
97
  timeZone: string;
98
+ /**
99
+ * Title of the label
100
+ */
34
101
  title: ReactNode;
102
+ /**
103
+ * 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`.
104
+ */
35
105
  hint?: ReactNode;
106
+ /**
107
+ * Provides a description for the title.
108
+ */
36
109
  description?: ReactNode;
110
+ /**
111
+ * Function called when info button is pressed.
112
+ * <br />
113
+ * Info button will only be visible when this prop is passed.
114
+ */
37
115
  onInfoButtonClick?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
116
+ /**
117
+ * Icon to be displayed beside the hint text.
118
+ * <br />
119
+ * Will only get rendered when `hint` is passed as well.
120
+ */
38
121
  hintIcon?: ReactElement;
122
+ /**
123
+ * Badge to be displayed beside the label.
124
+ * <br />
125
+ * Might be used to display additional information about the content of the field (E.g verified email)
126
+ */
39
127
  badge?: ReactNode;
128
+ /**
129
+ * The time that will be used by default when a user selects a calendar day.
130
+ * It must follow the “HH:mm” pattern (eg: 04:30, 13:25, 23:59)
131
+ */
40
132
  defaultDaySelectionTime?: string;
41
133
  };
42
134
  type TDateTimeFieldState = Pick<TDateTimeFieldProps, 'id'>;
@@ -49,6 +141,11 @@ declare class DateTimeField extends Component<TDateTimeFieldProps, TDateTimeFiel
49
141
  static getDerivedStateFromProps: (props: TDateTimeFieldProps, state: TDateTimeFieldState) => {
50
142
  id: string;
51
143
  };
144
+ /**
145
+ * Use this function to convert the Formik `errors` object type to
146
+ * our custom field errors type.
147
+ * This is primarly useful when using TypeScript.
148
+ */
52
149
  static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
53
150
  render(): import("@emotion/react/jsx-runtime").JSX.Element;
54
151
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/date-time-field",
3
3
  "description": "A controlled date time 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-time-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-time-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",