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