@commercetools-uikit/localized-multiline-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.
- package/dist/commercetools-uikit-localized-multiline-text-field.cjs.dev.js +1 -1
- package/dist/commercetools-uikit-localized-multiline-text-field.cjs.prod.js +1 -1
- package/dist/commercetools-uikit-localized-multiline-text-field.esm.js +1 -1
- package/dist/declarations/src/localized-multiline-text-field.d.ts +117 -0
- package/package.json +9 -9
|
@@ -201,7 +201,7 @@ LocalizedMultilineTextField.propTypes = process.env.NODE_ENV !== "production" ?
|
|
|
201
201
|
var LocalizedMultilineTextField$1 = LocalizedMultilineTextField;
|
|
202
202
|
|
|
203
203
|
// NOTE: This string will be replaced on build time with the package version.
|
|
204
|
-
var version = "19.
|
|
204
|
+
var version = "19.10.0";
|
|
205
205
|
|
|
206
206
|
exports["default"] = LocalizedMultilineTextField$1;
|
|
207
207
|
exports.version = version;
|
|
@@ -168,7 +168,7 @@ LocalizedMultilineTextField.propTypes = {};
|
|
|
168
168
|
var LocalizedMultilineTextField$1 = LocalizedMultilineTextField;
|
|
169
169
|
|
|
170
170
|
// NOTE: This string will be replaced on build time with the package version.
|
|
171
|
-
var version = "19.
|
|
171
|
+
var version = "19.10.0";
|
|
172
172
|
|
|
173
173
|
exports["default"] = LocalizedMultilineTextField$1;
|
|
174
174
|
exports.version = version;
|
|
@@ -176,6 +176,6 @@ LocalizedMultilineTextField.propTypes = process.env.NODE_ENV !== "production" ?
|
|
|
176
176
|
var LocalizedMultilineTextField$1 = LocalizedMultilineTextField;
|
|
177
177
|
|
|
178
178
|
// NOTE: This string will be replaced on build time with the package version.
|
|
179
|
-
var version = "19.
|
|
179
|
+
var version = "19.10.0";
|
|
180
180
|
|
|
181
181
|
export { LocalizedMultilineTextField$1 as default, version };
|
|
@@ -10,45 +10,157 @@ interface HTMLLocalizedTextAreaElement extends HTMLTextAreaElement {
|
|
|
10
10
|
language: string;
|
|
11
11
|
}
|
|
12
12
|
export type TLocalizedMultilineTextFieldProps = {
|
|
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` property
|
|
64
|
+
*/
|
|
24
65
|
autoComplete?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Used as HTML `name` property for each input field. Each input field name will have the language as a suffix (`${namePrefix}.${lang}`), e.g. `foo.en`
|
|
68
|
+
*/
|
|
25
69
|
name?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Values to use. Keyed by language, the values are the actual values, e.g. `{ en: 'Horse', de: 'Pferd' }`
|
|
72
|
+
* <br />
|
|
73
|
+
* The input doesn't accept a "languages" prop, instead all possible
|
|
74
|
+
* languages have to exist (with empty or filled strings) on the value:
|
|
75
|
+
* <br />
|
|
76
|
+
* { en: 'foo', de: '', es: '' }
|
|
77
|
+
*/
|
|
26
78
|
value: {
|
|
27
79
|
[key: string]: string;
|
|
28
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* Gets called when any input is changed. Is called with the change event of the changed input.
|
|
83
|
+
*/
|
|
29
84
|
onChange?: ChangeEventHandler<HTMLLocalizedTextAreaElement>;
|
|
85
|
+
/**
|
|
86
|
+
* Specifies which language will be shown in case the `LocalizedTextInput` is collapsed.
|
|
87
|
+
*/
|
|
30
88
|
selectedLanguage: string;
|
|
89
|
+
/**
|
|
90
|
+
* Called when input is blurred
|
|
91
|
+
*/
|
|
31
92
|
onBlur?: FocusEventHandler<HTMLLocalizedTextAreaElement>;
|
|
93
|
+
/**
|
|
94
|
+
* Called when input is focused
|
|
95
|
+
*/
|
|
32
96
|
onFocus?: () => void;
|
|
97
|
+
/**
|
|
98
|
+
* Expands input components holding multiline values instead of collapsing them by default.
|
|
99
|
+
*/
|
|
33
100
|
defaultExpandMultilineText?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Use this property to turn off caching input measurements.
|
|
103
|
+
*/
|
|
34
104
|
cacheMeasurements?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Will hide the language expansion controls when set to `true`. All languages will be shown when set to `true`.
|
|
107
|
+
*/
|
|
35
108
|
hideLanguageExpansionControls?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Controls whether one or all languages are visible by default. Pass `true` to show all languages by default.
|
|
111
|
+
*/
|
|
36
112
|
defaultExpandLanguages?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Sets the focus on the first input when `true` is passed.
|
|
115
|
+
*/
|
|
37
116
|
isAutofocussed?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Whether the text inputs for each localization should render with condensed paddings.
|
|
119
|
+
*/
|
|
38
120
|
isCondensed?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Disables all input fields.
|
|
123
|
+
*/
|
|
39
124
|
isDisabled?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Disables all input fields and shows them in read-only mode.
|
|
127
|
+
*/
|
|
40
128
|
isReadOnly?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Placeholders for each language. Object of the same shape as `value`.
|
|
131
|
+
*/
|
|
41
132
|
placeholder?: {
|
|
42
133
|
[key: string]: string;
|
|
43
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* Errors for each translation. These are forwarded to the `errors` prop of `LocalizedTextInput`.
|
|
137
|
+
*/
|
|
44
138
|
errorsByLanguage?: {
|
|
45
139
|
[key: string]: ReactNode;
|
|
46
140
|
};
|
|
141
|
+
/**
|
|
142
|
+
* Title of the label
|
|
143
|
+
*/
|
|
47
144
|
title: string | ReactNode;
|
|
145
|
+
/**
|
|
146
|
+
* 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.
|
|
147
|
+
*/
|
|
48
148
|
hint?: string | ReactNode;
|
|
149
|
+
/**
|
|
150
|
+
* Provides a description for the title.
|
|
151
|
+
*/
|
|
49
152
|
description?: string | ReactNode;
|
|
153
|
+
/**
|
|
154
|
+
* Function called when info button is pressed. Info button will only be visible when this prop is passed.
|
|
155
|
+
*/
|
|
50
156
|
onInfoButtonClick?: () => void;
|
|
157
|
+
/**
|
|
158
|
+
* Icon to be displayed beside the hint text. Will only get rendered when hint is passed as well.
|
|
159
|
+
*/
|
|
51
160
|
hintIcon?: ReactElement;
|
|
161
|
+
/**
|
|
162
|
+
* Badge to be displayed beside the label. Might be used to display additional information about the content of the field (E.g verified email)
|
|
163
|
+
*/
|
|
52
164
|
badge?: ReactNode;
|
|
53
165
|
};
|
|
54
166
|
type TLocalizedMultilineTextFieldState = Pick<TLocalizedMultilineTextFieldProps, 'id'>;
|
|
@@ -61,6 +173,11 @@ declare class LocalizedMultilineTextField extends Component<TLocalizedMultilineT
|
|
|
61
173
|
static getDerivedStateFromProps: (props: TLocalizedMultilineTextFieldProps, state: TLocalizedMultilineTextFieldState) => {
|
|
62
174
|
id: string;
|
|
63
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* Use this function to convert the Formik `errors` object type to
|
|
178
|
+
* our custom field errors type.
|
|
179
|
+
* This is primarly useful when using TypeScript.
|
|
180
|
+
*/
|
|
64
181
|
static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
|
|
65
182
|
render(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
66
183
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/localized-multiline-text-field",
|
|
3
3
|
"description": "A controlled text input component for localized multi-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-multiline-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-multiline-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",
|