@commercetools-uikit/time-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.
@@ -190,7 +190,7 @@ TimeField.propTypes = process.env.NODE_ENV !== "production" ? {
190
190
  var TimeField$1 = TimeField;
191
191
 
192
192
  // NOTE: This string will be replaced on build time with the package version.
193
- var version = "19.8.0";
193
+ var version = "19.10.0";
194
194
 
195
195
  exports["default"] = TimeField$1;
196
196
  exports.version = version;
@@ -159,7 +159,7 @@ TimeField.propTypes = {};
159
159
  var TimeField$1 = TimeField;
160
160
 
161
161
  // NOTE: This string will be replaced on build time with the package version.
162
- var version = "19.8.0";
162
+ var version = "19.10.0";
163
163
 
164
164
  exports["default"] = TimeField$1;
165
165
  exports.version = version;
@@ -165,6 +165,6 @@ TimeField.propTypes = process.env.NODE_ENV !== "production" ? {
165
165
  var TimeField$1 = TimeField;
166
166
 
167
167
  // NOTE: This string will be replaced on build time with the package version.
168
- var version = "19.8.0";
168
+ var version = "19.10.0";
169
169
 
170
170
  export { TimeField$1 as default, version };
@@ -5,30 +5,118 @@ type TCustomFormErrors<Values> = {
5
5
  [K in keyof Values]?: TFieldErrors;
6
6
  };
7
7
  export type TTimeFieldProps = {
8
+ /**
9
+ * Used as HTML id property. An id is auto-generated when it is not specified.
10
+ */
8
11
  id?: string;
12
+ /**
13
+ * Horizontal size limit of the input fields.
14
+ */
9
15
  horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
16
+ /**
17
+ * A map of errors. Error messages for known errors are rendered automatically.
18
+ * <br/>
19
+ * Unknown errors will be forwarded to renderError.
20
+ */
10
21
  errors?: TFieldErrors;
22
+ /**
23
+ * A map of warnings. Warning messages for known warnings are rendered automatically.
24
+ * <br/>
25
+ * Unknown warnings will be forwarded to renderWarning.
26
+ */
11
27
  warnings?: TFieldWarnings;
28
+ /**
29
+ * Called with custom errors, as renderError(key, error). This function can return a message which will be wrapped in an ErrorMessage.
30
+ * <br />
31
+ * It can also return null to show no error.
32
+ */
12
33
  renderError?: (key: string, error?: boolean) => ReactNode;
34
+ /**
35
+ * Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
36
+ * <br />
37
+ * It can also return null to show no warning.
38
+ */
13
39
  renderWarning?: (key: string, warning?: boolean) => ReactNode;
40
+ /**
41
+ * Indicates if the value is required. Shows an the "required asterisk" if so.
42
+ */
14
43
  isRequired?: boolean;
44
+ /**
45
+ * Indicates whether the field was touched. Errors will only be shown when the field was touched.
46
+ */
15
47
  touched?: boolean;
48
+ /**
49
+ * Used as HTML name of the input component.
50
+ */
16
51
  name?: string;
52
+ /**
53
+ * Used as HTML autocomplete of the input component.
54
+ */
17
55
  autoComplete?: string;
56
+ /**
57
+ * Value of the input
58
+ */
18
59
  value: string;
60
+ /**
61
+ * Called with an event holding the new value.
62
+ */
19
63
  onChange?: ChangeEventHandler<HTMLInputElement>;
64
+ /**
65
+ * Called when input is blurred
66
+ */
20
67
  onBlur?: FocusEventHandler<HTMLInputElement>;
68
+ /**
69
+ * Called when input is focused
70
+ */
21
71
  onFocus?: FocusEventHandler<HTMLInputElement>;
72
+ /**
73
+ * Focus the input on initial render
74
+ */
22
75
  isAutofocussed?: boolean;
76
+ /**
77
+ * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
78
+ */
23
79
  isDisabled?: boolean;
80
+ /**
81
+ * Indicates that the input is read only (no changes allowed).
82
+ */
24
83
  isReadOnly?: boolean;
84
+ /**
85
+ * Placeholder text for the input
86
+ */
25
87
  placeholder?: string;
88
+ /**
89
+ * Use this property to reduce the paddings of the component for a ui compact variant
90
+ */
26
91
  isCondensed?: boolean;
92
+ /**
93
+ * Title of the label
94
+ */
27
95
  title: ReactNode;
96
+ /**
97
+ * 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),
98
+ * whereas description can describe it in more depth. Can also receive a hintIcon.
99
+ */
28
100
  hint?: ReactNode;
101
+ /**
102
+ * Provides a description for the title.
103
+ */
29
104
  description?: 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
+ */
30
110
  onInfoButtonClick?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
111
+ /**
112
+ * Icon to be displayed beside the hint text. Will only get rendered when hint is passed as well.
113
+ */
31
114
  hintIcon?: ReactElement;
115
+ /**
116
+ * Badge to be displayed beside the label.
117
+ * <br/>
118
+ * Might be used to display additional information about the content of the field (E.g verified email)
119
+ */
32
120
  badge?: ReactNode;
33
121
  };
34
122
  type TTimeFieldState = Pick<TTimeFieldProps, 'id'>;
@@ -41,6 +129,11 @@ declare class TimeField extends Component<TTimeFieldProps, TTimeFieldState> {
41
129
  static getDerivedStateFromProps: (props: TTimeFieldProps, state: TTimeFieldState) => {
42
130
  id: string;
43
131
  };
132
+ /**
133
+ * Use this function to convert the Formik `errors` object type to
134
+ * our custom field errors type.
135
+ * This is primarily useful when using TypeScript.
136
+ */
44
137
  static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
45
138
  render(): import("@emotion/react/jsx-runtime").JSX.Element;
46
139
  }
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": "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/design-system": "19.8.0",
26
- "@commercetools-uikit/field-errors": "19.8.0",
27
- "@commercetools-uikit/field-label": "19.8.0",
28
- "@commercetools-uikit/field-warnings": "19.8.0",
29
- "@commercetools-uikit/spacings-stack": "19.8.0",
30
- "@commercetools-uikit/time-input": "19.8.0",
31
- "@commercetools-uikit/utils": "19.8.0",
24
+ "@commercetools-uikit/constraints": "19.10.0",
25
+ "@commercetools-uikit/design-system": "19.10.0",
26
+ "@commercetools-uikit/field-errors": "19.10.0",
27
+ "@commercetools-uikit/field-label": "19.10.0",
28
+ "@commercetools-uikit/field-warnings": "19.10.0",
29
+ "@commercetools-uikit/spacings-stack": "19.10.0",
30
+ "@commercetools-uikit/time-input": "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",