@commercetools-uikit/localized-text-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.
- package/dist/commercetools-uikit-localized-text-field.cjs.dev.js +1 -1
- package/dist/commercetools-uikit-localized-text-field.cjs.prod.js +1 -1
- package/dist/commercetools-uikit-localized-text-field.esm.js +1 -1
- package/dist/declarations/src/localized-text-field.d.ts +114 -0
- package/package.json +9 -9
|
@@ -197,7 +197,7 @@ LocalizedTextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
197
197
|
var LocalizedTextField$1 = LocalizedTextField;
|
|
198
198
|
|
|
199
199
|
// NOTE: This string will be replaced on build time with the package version.
|
|
200
|
-
var version = "19.
|
|
200
|
+
var version = "19.10.0";
|
|
201
201
|
|
|
202
202
|
exports["default"] = LocalizedTextField$1;
|
|
203
203
|
exports.version = version;
|
|
@@ -164,7 +164,7 @@ LocalizedTextField.propTypes = {};
|
|
|
164
164
|
var LocalizedTextField$1 = LocalizedTextField;
|
|
165
165
|
|
|
166
166
|
// NOTE: This string will be replaced on build time with the package version.
|
|
167
|
-
var version = "19.
|
|
167
|
+
var version = "19.10.0";
|
|
168
168
|
|
|
169
169
|
exports["default"] = LocalizedTextField$1;
|
|
170
170
|
exports.version = version;
|
|
@@ -172,6 +172,6 @@ LocalizedTextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
172
172
|
var LocalizedTextField$1 = LocalizedTextField;
|
|
173
173
|
|
|
174
174
|
// NOTE: This string will be replaced on build time with the package version.
|
|
175
|
-
var version = "19.
|
|
175
|
+
var version = "19.10.0";
|
|
176
176
|
|
|
177
177
|
export { LocalizedTextField$1 as default, version };
|
|
@@ -10,37 +10,146 @@ interface HTMLLocalizedInputElement extends HTMLInputElement {
|
|
|
10
10
|
language: string;
|
|
11
11
|
}
|
|
12
12
|
export type TLocalizedTextFieldProps = {
|
|
13
|
+
/**
|
|
14
|
+
* Used as HTML id property. An id is auto-generated when it is not specified.
|
|
15
|
+
*/
|
|
13
16
|
id?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Horizontal size limit of the input fields.
|
|
19
|
+
*/
|
|
14
20
|
horizontalConstraint?: 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
|
|
21
|
+
/**
|
|
22
|
+
* A map of errors. Error messages for known errors are rendered automatically.
|
|
23
|
+
* <br />
|
|
24
|
+
* Unknown errors will be forwarded to `renderError`
|
|
25
|
+
*/
|
|
15
26
|
errors?: TFieldErrors;
|
|
27
|
+
/**
|
|
28
|
+
* 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.
|
|
29
|
+
*/
|
|
16
30
|
renderError?: TErrorRenderer;
|
|
31
|
+
/**
|
|
32
|
+
* A map of warnings. Warning messages for known warnings are rendered automatically.
|
|
33
|
+
* <br/>
|
|
34
|
+
* Unknown warnings will be forwarded to renderWarning.
|
|
35
|
+
*/
|
|
17
36
|
warnings?: TFieldWarnings;
|
|
37
|
+
/**
|
|
38
|
+
* Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
|
|
39
|
+
* <br />
|
|
40
|
+
* It can also return null to show no warning.
|
|
41
|
+
*/
|
|
18
42
|
renderWarning?: (key: string, warning?: boolean) => ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* An object mapping locales to additional messages to be rendered below each input element.
|
|
45
|
+
Example:
|
|
46
|
+
{
|
|
47
|
+
en: 'Some value',
|
|
48
|
+
es: 'Algún valor',
|
|
49
|
+
}
|
|
50
|
+
*/
|
|
19
51
|
additionalInfo?: Record<string, string | ReactNode | (MessageDescriptor & {
|
|
20
52
|
values: Record<string, ReactNode>;
|
|
21
53
|
})>;
|
|
54
|
+
/**
|
|
55
|
+
* Indicates if the value is required. Shows an the "required asterisk" if so.
|
|
56
|
+
*/
|
|
22
57
|
isRequired?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Indicates whether the field was touched. Errors will only be shown when the field was touched.
|
|
60
|
+
*/
|
|
23
61
|
touched?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Used as HTML `autocomplete` of the input component. property
|
|
64
|
+
*/
|
|
24
65
|
autoComplete?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Used as HTML name of the input component. property
|
|
68
|
+
*/
|
|
25
69
|
name?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Values to use.
|
|
72
|
+
* <br />
|
|
73
|
+
Keyed by language, the values are the actual values, e.g. `{ en: 'Horse', de: 'Pferd' }`
|
|
74
|
+
*/
|
|
26
75
|
value: Record<string, string>;
|
|
76
|
+
/**
|
|
77
|
+
* Called with an event containing the new value. Required when input is not read only. Parent should pass it back as value.
|
|
78
|
+
*/
|
|
27
79
|
onChange?: ChangeEventHandler<HTMLLocalizedInputElement>;
|
|
80
|
+
/**
|
|
81
|
+
* Specifies which language will be shown in case the `LocalizedTextInput` is collapsed.
|
|
82
|
+
*/
|
|
28
83
|
selectedLanguage: string;
|
|
84
|
+
/**
|
|
85
|
+
* Called when input is blurred
|
|
86
|
+
*/
|
|
29
87
|
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
88
|
+
/**
|
|
89
|
+
* Called when input is focused
|
|
90
|
+
*/
|
|
30
91
|
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
92
|
+
/**
|
|
93
|
+
* Will hide the language expansion controls when set to `true`. All languages will be shown when set to `true`.
|
|
94
|
+
*/
|
|
31
95
|
hideLanguageExpansionControls?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Controls whether one or all languages are visible by default
|
|
98
|
+
*/
|
|
32
99
|
defaultExpandLanguages?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Focus the input on initial render
|
|
102
|
+
*/
|
|
33
103
|
isAutofocussed?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the text inputs for each localization should render with condensed paddings.
|
|
106
|
+
*/
|
|
34
107
|
isCondensed?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
|
|
110
|
+
*/
|
|
35
111
|
isDisabled?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Indicates that the field is displaying read-only content
|
|
114
|
+
*/
|
|
36
115
|
isReadOnly?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Placeholders for each language. Object of the same shape as `value`.
|
|
118
|
+
*/
|
|
37
119
|
placeholder?: Record<string, string>;
|
|
120
|
+
/**
|
|
121
|
+
* Errors for each translation. These are forwarded to the `errors` prop of `LocalizedTextInput`.
|
|
122
|
+
*/
|
|
38
123
|
errorsByLanguage?: Record<string, ReactNode>;
|
|
124
|
+
/**
|
|
125
|
+
* Title of the label
|
|
126
|
+
*/
|
|
39
127
|
title: ReactNode;
|
|
128
|
+
/**
|
|
129
|
+
* 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`.
|
|
130
|
+
*/
|
|
40
131
|
hint?: ReactNode;
|
|
132
|
+
/**
|
|
133
|
+
* Provides a description for the title.
|
|
134
|
+
*/
|
|
41
135
|
description?: ReactNode;
|
|
136
|
+
/**
|
|
137
|
+
* Function called when info button is pressed.
|
|
138
|
+
* <br />
|
|
139
|
+
* Info button will only be visible when this prop is passed.
|
|
140
|
+
*/
|
|
42
141
|
onInfoButtonClick?: (event: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>) => void;
|
|
142
|
+
/**
|
|
143
|
+
* Icon to be displayed beside the hint text.
|
|
144
|
+
* <br />
|
|
145
|
+
* Will only get rendered when `hint` is passed as well.
|
|
146
|
+
*/
|
|
43
147
|
hintIcon?: ReactElement;
|
|
148
|
+
/**
|
|
149
|
+
* Badge to be displayed beside the label.
|
|
150
|
+
* <br />
|
|
151
|
+
* Might be used to display additional information about the content of the field (E.g verified email)
|
|
152
|
+
*/
|
|
44
153
|
badge?: ReactNode;
|
|
45
154
|
};
|
|
46
155
|
type TLocalizedTextFieldSTate = Pick<TLocalizedTextFieldProps, 'id'>;
|
|
@@ -53,6 +162,11 @@ declare class LocalizedTextField extends Component<TLocalizedTextFieldProps, TLo
|
|
|
53
162
|
static getDerivedStateFromProps: (props: TLocalizedTextFieldProps, state: TLocalizedTextFieldSTate) => {
|
|
54
163
|
id: string;
|
|
55
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Use this function to convert the Formik `errors` object type to
|
|
167
|
+
* our custom field errors type.
|
|
168
|
+
* This is primarly useful when using TypeScript.
|
|
169
|
+
*/
|
|
56
170
|
static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
|
|
57
171
|
render(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
58
172
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/localized-text-field",
|
|
3
3
|
"description": "A controlled text input component for localized 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/localized-text-input": "19.
|
|
30
|
-
"@commercetools-uikit/spacings": "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/localized-text-input": "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",
|