@commercetools-uikit/localized-text-field 18.0.0 → 18.1.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/README.md +1 -0
- package/dist/commercetools-uikit-localized-text-field.cjs.dev.js +7 -4
- package/dist/commercetools-uikit-localized-text-field.cjs.prod.js +3 -2
- package/dist/commercetools-uikit-localized-text-field.esm.js +7 -4
- package/dist/declarations/src/localized-text-field.d.ts +4 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -57,6 +57,7 @@ export default Example;
|
|
|
57
57
|
| `renderError` | `Function`<br/>[See signature.](#signature-renderError) | | | 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. |
|
|
58
58
|
| `warnings` | `Record` | | | A map of warnings. Warning messages for known warnings are rendered automatically.
<br/>
Unknown warnings will be forwarded to renderWarning. |
|
|
59
59
|
| `renderWarning` | `Function`<br/>[See signature.](#signature-renderWarning) | | | Called with custom warnings, as renderWarning(key, warning). This function can return a message which will be wrapped in a WarningMessage.
<br />
It can also return null to show no warning. |
|
|
60
|
+
| `additionalInfo` | `Record` | | | An object mapping locales to additional messages to be rendered below each input element.
Example:
{
en: 'Some value',
es: 'Algún valor',
} |
|
|
60
61
|
| `isRequired` | `boolean` | | | Indicates if the value is required. Shows an the "required asterisk" if so. |
|
|
61
62
|
| `touched` | `boolean` | | | Indicates whether the field was touched. Errors will only be shown when the field was touched. |
|
|
62
63
|
| `autoComplete` | `string` | | | Used as HTML `autocomplete` of the input component. property |
|
|
@@ -127,7 +127,8 @@ let LocalizedTextField = /*#__PURE__*/function (_Component) {
|
|
|
127
127
|
horizontalConstraint: "scale"
|
|
128
128
|
}, utils.filterDataAttributes(this.props)), {}, {
|
|
129
129
|
"aria-invalid": hasError,
|
|
130
|
-
"aria-errormessage": sequentialErrorsId
|
|
130
|
+
"aria-errormessage": sequentialErrorsId,
|
|
131
|
+
additionalInfo: this.props.additionalInfo && this.props.additionalInfo
|
|
131
132
|
})), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
132
133
|
id: sequentialErrorsId,
|
|
133
134
|
errors: this.props.errors,
|
|
@@ -170,6 +171,9 @@ LocalizedTextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
170
171
|
renderError: _pt__default["default"].func,
|
|
171
172
|
warnings: _pt__default["default"].objectOf(_pt__default["default"].bool),
|
|
172
173
|
renderWarning: _pt__default["default"].func,
|
|
174
|
+
additionalInfo: _pt__default["default"].objectOf(_pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node, _pt__default["default"].oneOfType([_pt__default["default"].any, _pt__default["default"].shape({
|
|
175
|
+
values: _pt__default["default"].objectOf(_pt__default["default"].node).isRequired
|
|
176
|
+
})])])),
|
|
173
177
|
isRequired: _pt__default["default"].bool,
|
|
174
178
|
touched: _pt__default["default"].bool,
|
|
175
179
|
autoComplete: _pt__default["default"].string,
|
|
@@ -187,13 +191,12 @@ LocalizedTextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
187
191
|
placeholder: _pt__default["default"].objectOf(_pt__default["default"].string),
|
|
188
192
|
errorsByLanguage: _pt__default["default"].objectOf(_pt__default["default"].string),
|
|
189
193
|
title: _pt__default["default"].node.isRequired,
|
|
190
|
-
hint: _pt__default["default"].node
|
|
191
|
-
description: _pt__default["default"].node
|
|
194
|
+
hint: _pt__default["default"].node
|
|
192
195
|
} : {};
|
|
193
196
|
var LocalizedTextField$1 = LocalizedTextField;
|
|
194
197
|
|
|
195
198
|
// NOTE: This string will be replaced on build time with the package version.
|
|
196
|
-
var version = "18.
|
|
199
|
+
var version = "18.1.0";
|
|
197
200
|
|
|
198
201
|
exports["default"] = LocalizedTextField$1;
|
|
199
202
|
exports.version = version;
|
|
@@ -122,7 +122,8 @@ let LocalizedTextField = /*#__PURE__*/function (_Component) {
|
|
|
122
122
|
horizontalConstraint: "scale"
|
|
123
123
|
}, utils.filterDataAttributes(this.props)), {}, {
|
|
124
124
|
"aria-invalid": hasError,
|
|
125
|
-
"aria-errormessage": sequentialErrorsId
|
|
125
|
+
"aria-errormessage": sequentialErrorsId,
|
|
126
|
+
additionalInfo: this.props.additionalInfo && this.props.additionalInfo
|
|
126
127
|
})), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
127
128
|
id: sequentialErrorsId,
|
|
128
129
|
errors: this.props.errors,
|
|
@@ -162,7 +163,7 @@ LocalizedTextField.propTypes = {};
|
|
|
162
163
|
var LocalizedTextField$1 = LocalizedTextField;
|
|
163
164
|
|
|
164
165
|
// NOTE: This string will be replaced on build time with the package version.
|
|
165
|
-
var version = "18.
|
|
166
|
+
var version = "18.1.0";
|
|
166
167
|
|
|
167
168
|
exports["default"] = LocalizedTextField$1;
|
|
168
169
|
exports.version = version;
|
|
@@ -102,7 +102,8 @@ let LocalizedTextField = /*#__PURE__*/function (_Component) {
|
|
|
102
102
|
horizontalConstraint: "scale"
|
|
103
103
|
}, filterDataAttributes(this.props)), {}, {
|
|
104
104
|
"aria-invalid": hasError,
|
|
105
|
-
"aria-errormessage": sequentialErrorsId
|
|
105
|
+
"aria-errormessage": sequentialErrorsId,
|
|
106
|
+
additionalInfo: this.props.additionalInfo && this.props.additionalInfo
|
|
106
107
|
})), jsx(FieldErrors, {
|
|
107
108
|
id: sequentialErrorsId,
|
|
108
109
|
errors: this.props.errors,
|
|
@@ -145,6 +146,9 @@ LocalizedTextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
145
146
|
renderError: _pt.func,
|
|
146
147
|
warnings: _pt.objectOf(_pt.bool),
|
|
147
148
|
renderWarning: _pt.func,
|
|
149
|
+
additionalInfo: _pt.objectOf(_pt.oneOfType([_pt.string, _pt.node, _pt.oneOfType([_pt.any, _pt.shape({
|
|
150
|
+
values: _pt.objectOf(_pt.node).isRequired
|
|
151
|
+
})])])),
|
|
148
152
|
isRequired: _pt.bool,
|
|
149
153
|
touched: _pt.bool,
|
|
150
154
|
autoComplete: _pt.string,
|
|
@@ -162,12 +166,11 @@ LocalizedTextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
162
166
|
placeholder: _pt.objectOf(_pt.string),
|
|
163
167
|
errorsByLanguage: _pt.objectOf(_pt.string),
|
|
164
168
|
title: _pt.node.isRequired,
|
|
165
|
-
hint: _pt.node
|
|
166
|
-
description: _pt.node
|
|
169
|
+
hint: _pt.node
|
|
167
170
|
} : {};
|
|
168
171
|
var LocalizedTextField$1 = LocalizedTextField;
|
|
169
172
|
|
|
170
173
|
// NOTE: This string will be replaced on build time with the package version.
|
|
171
|
-
var version = "18.
|
|
174
|
+
var version = "18.1.0";
|
|
172
175
|
|
|
173
176
|
export { LocalizedTextField$1 as default, version };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component, type ChangeEventHandler, type FocusEventHandler, type KeyboardEvent, type MouseEvent, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { type MessageDescriptor } from 'react-intl';
|
|
2
3
|
type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
|
|
3
4
|
type TFieldWarnings = Record<string, boolean>;
|
|
4
5
|
type TFieldErrors = Record<string, boolean>;
|
|
@@ -15,6 +16,9 @@ export type TLocalizedTextFieldProps = {
|
|
|
15
16
|
renderError?: TErrorRenderer;
|
|
16
17
|
warnings?: TFieldWarnings;
|
|
17
18
|
renderWarning?: (key: string, warning?: boolean) => ReactNode;
|
|
19
|
+
additionalInfo?: Record<string, string | ReactNode | (MessageDescriptor & {
|
|
20
|
+
values: Record<string, ReactNode>;
|
|
21
|
+
})>;
|
|
18
22
|
isRequired?: boolean;
|
|
19
23
|
touched?: boolean;
|
|
20
24
|
autoComplete?: string;
|
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": "18.
|
|
4
|
+
"version": "18.1.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": "18.
|
|
25
|
-
"@commercetools-uikit/design-system": "18.
|
|
26
|
-
"@commercetools-uikit/field-errors": "18.
|
|
27
|
-
"@commercetools-uikit/field-label": "18.
|
|
28
|
-
"@commercetools-uikit/field-warnings": "18.
|
|
29
|
-
"@commercetools-uikit/localized-text-input": "18.
|
|
30
|
-
"@commercetools-uikit/spacings": "18.
|
|
31
|
-
"@commercetools-uikit/utils": "18.
|
|
24
|
+
"@commercetools-uikit/constraints": "18.1.0",
|
|
25
|
+
"@commercetools-uikit/design-system": "18.1.0",
|
|
26
|
+
"@commercetools-uikit/field-errors": "18.1.0",
|
|
27
|
+
"@commercetools-uikit/field-label": "18.1.0",
|
|
28
|
+
"@commercetools-uikit/field-warnings": "18.1.0",
|
|
29
|
+
"@commercetools-uikit/localized-text-input": "18.1.0",
|
|
30
|
+
"@commercetools-uikit/spacings": "18.1.0",
|
|
31
|
+
"@commercetools-uikit/utils": "18.1.0",
|
|
32
32
|
"@emotion/react": "^11.10.5",
|
|
33
33
|
"@emotion/styled": "^11.10.5",
|
|
34
34
|
"prop-types": "15.8.1",
|