@commercetools-uikit/text-field 19.11.0 → 19.12.1
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
CHANGED
|
@@ -62,13 +62,14 @@ export default Example;
|
|
|
62
62
|
| `isDisabled` | `boolean` | | | Indicates that the input cannot be modified (e.g not authorized, or changes currently saving). |
|
|
63
63
|
| `isReadOnly` | `boolean` | | | Indicates that the field is displaying read-only content |
|
|
64
64
|
| `placeholder` | `string` | | | Placeholder text for the input |
|
|
65
|
-
| `maxLength` | `number` | | | Maximum number of characters allowed in the input field |
|
|
66
65
|
| `title` | `union`<br/>Possible values:<br/>`string , ReactNode` | ✅ | | Title of the label |
|
|
67
66
|
| `hint` | `union`<br/>Possible values:<br/>`string , ReactNode` | | | 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. |
|
|
68
67
|
| `description` | `union`<br/>Possible values:<br/>`string , ReactNode` | | | Provides a description for the title. |
|
|
69
68
|
| `onInfoButtonClick` | `Function`<br/>[See signature.](#signature-onInfoButtonClick) | | | Function called when info button is pressed. Info button will only be visible when this prop is passed. |
|
|
70
69
|
| `hintIcon` | `ReactElement` | | | Icon to be displayed beside the hint text. Will only get rendered when hint is passed as well. |
|
|
71
70
|
| `badge` | `ReactNode` | | | Badge to be displayed beside the label. Might be used to display additional information about the content of the field (E.g verified email) |
|
|
71
|
+
| `maxLength` | `number` | | | 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 |
|
|
72
|
+
| `additionalInfo` | `ReactNode` | | | Additional information to be displayed below the input. |
|
|
72
73
|
|
|
73
74
|
## Signatures
|
|
74
75
|
|
|
@@ -28,6 +28,7 @@ var TextInput = require('@commercetools-uikit/text-input');
|
|
|
28
28
|
var utils = require('@commercetools-uikit/utils');
|
|
29
29
|
var FieldErrors = require('@commercetools-uikit/field-errors');
|
|
30
30
|
var FieldWarnings = require('@commercetools-uikit/field-warnings');
|
|
31
|
+
var messages = require('@commercetools-uikit/messages');
|
|
31
32
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
32
33
|
|
|
33
34
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -69,7 +70,6 @@ const hasWarnings = warnings => {
|
|
|
69
70
|
|
|
70
71
|
// Similar shape of `FormikErrors` but values are `TFieldErrors` objects.
|
|
71
72
|
let TextField = /*#__PURE__*/function (_Component) {
|
|
72
|
-
_inherits(TextField, _Component);
|
|
73
73
|
function TextField() {
|
|
74
74
|
var _this;
|
|
75
75
|
_classCallCheck(this, TextField);
|
|
@@ -84,7 +84,8 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
84
84
|
};
|
|
85
85
|
return _this;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
_inherits(TextField, _Component);
|
|
88
|
+
return _createClass(TextField, [{
|
|
88
89
|
key: "render",
|
|
89
90
|
value: function render() {
|
|
90
91
|
if (!this.props.isReadOnly) {
|
|
@@ -129,7 +130,9 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
129
130
|
/* ARIA */
|
|
130
131
|
"aria-invalid": hasError,
|
|
131
132
|
"aria-errormessage": sequentialErrorsId
|
|
132
|
-
})), jsxRuntime.jsx(
|
|
133
|
+
})), this.props.additionalInfo && jsxRuntime.jsx(messages.AdditionalInfoMessage, {
|
|
134
|
+
message: this.props.additionalInfo
|
|
135
|
+
}), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
133
136
|
id: sequentialErrorsId,
|
|
134
137
|
errors: this.props.errors,
|
|
135
138
|
isVisible: hasError,
|
|
@@ -155,7 +158,6 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
155
158
|
return errors;
|
|
156
159
|
}
|
|
157
160
|
}]);
|
|
158
|
-
return TextField;
|
|
159
161
|
}(react.Component);
|
|
160
162
|
TextField.displayName = 'TextField';
|
|
161
163
|
TextField.defaultProps = {
|
|
@@ -194,7 +196,7 @@ TextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
194
196
|
var TextField$1 = TextField;
|
|
195
197
|
|
|
196
198
|
// NOTE: This string will be replaced on build time with the package version.
|
|
197
|
-
var version = "19.
|
|
199
|
+
var version = "19.12.1";
|
|
198
200
|
|
|
199
201
|
exports["default"] = TextField$1;
|
|
200
202
|
exports.version = version;
|
|
@@ -28,6 +28,7 @@ var TextInput = require('@commercetools-uikit/text-input');
|
|
|
28
28
|
var utils = require('@commercetools-uikit/utils');
|
|
29
29
|
var FieldErrors = require('@commercetools-uikit/field-errors');
|
|
30
30
|
var FieldWarnings = require('@commercetools-uikit/field-warnings');
|
|
31
|
+
var messages = require('@commercetools-uikit/messages');
|
|
31
32
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
32
33
|
|
|
33
34
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
@@ -68,7 +69,6 @@ const hasWarnings = warnings => {
|
|
|
68
69
|
|
|
69
70
|
// Similar shape of `FormikErrors` but values are `TFieldErrors` objects.
|
|
70
71
|
let TextField = /*#__PURE__*/function (_Component) {
|
|
71
|
-
_inherits(TextField, _Component);
|
|
72
72
|
function TextField() {
|
|
73
73
|
var _this;
|
|
74
74
|
_classCallCheck(this, TextField);
|
|
@@ -83,7 +83,8 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
83
83
|
};
|
|
84
84
|
return _this;
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
_inherits(TextField, _Component);
|
|
87
|
+
return _createClass(TextField, [{
|
|
87
88
|
key: "render",
|
|
88
89
|
value: function render() {
|
|
89
90
|
if (!this.props.isReadOnly) ;
|
|
@@ -124,7 +125,9 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
124
125
|
/* ARIA */
|
|
125
126
|
"aria-invalid": hasError,
|
|
126
127
|
"aria-errormessage": sequentialErrorsId
|
|
127
|
-
})), jsxRuntime.jsx(
|
|
128
|
+
})), this.props.additionalInfo && jsxRuntime.jsx(messages.AdditionalInfoMessage, {
|
|
129
|
+
message: this.props.additionalInfo
|
|
130
|
+
}), jsxRuntime.jsx(FieldErrors__default["default"], {
|
|
128
131
|
id: sequentialErrorsId,
|
|
129
132
|
errors: this.props.errors,
|
|
130
133
|
isVisible: hasError,
|
|
@@ -150,7 +153,6 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
150
153
|
return errors;
|
|
151
154
|
}
|
|
152
155
|
}]);
|
|
153
|
-
return TextField;
|
|
154
156
|
}(react.Component);
|
|
155
157
|
TextField.displayName = 'TextField';
|
|
156
158
|
TextField.defaultProps = {
|
|
@@ -163,7 +165,7 @@ TextField.propTypes = {};
|
|
|
163
165
|
var TextField$1 = TextField;
|
|
164
166
|
|
|
165
167
|
// NOTE: This string will be replaced on build time with the package version.
|
|
166
|
-
var version = "19.
|
|
168
|
+
var version = "19.12.1";
|
|
167
169
|
|
|
168
170
|
exports["default"] = TextField$1;
|
|
169
171
|
exports.version = version;
|
|
@@ -24,6 +24,7 @@ import TextInput from '@commercetools-uikit/text-input';
|
|
|
24
24
|
import { createSequentialId, warning, filterDataAttributes, getFieldId } from '@commercetools-uikit/utils';
|
|
25
25
|
import FieldErrors from '@commercetools-uikit/field-errors';
|
|
26
26
|
import FieldWarnings from '@commercetools-uikit/field-warnings';
|
|
27
|
+
import { AdditionalInfoMessage } from '@commercetools-uikit/messages';
|
|
27
28
|
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
28
29
|
|
|
29
30
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -44,7 +45,6 @@ const hasWarnings = warnings => {
|
|
|
44
45
|
|
|
45
46
|
// Similar shape of `FormikErrors` but values are `TFieldErrors` objects.
|
|
46
47
|
let TextField = /*#__PURE__*/function (_Component) {
|
|
47
|
-
_inherits(TextField, _Component);
|
|
48
48
|
function TextField() {
|
|
49
49
|
var _this;
|
|
50
50
|
_classCallCheck(this, TextField);
|
|
@@ -59,7 +59,8 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
59
59
|
};
|
|
60
60
|
return _this;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
_inherits(TextField, _Component);
|
|
63
|
+
return _createClass(TextField, [{
|
|
63
64
|
key: "render",
|
|
64
65
|
value: function render() {
|
|
65
66
|
if (!this.props.isReadOnly) {
|
|
@@ -104,7 +105,9 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
104
105
|
/* ARIA */
|
|
105
106
|
"aria-invalid": hasError,
|
|
106
107
|
"aria-errormessage": sequentialErrorsId
|
|
107
|
-
})), jsx(
|
|
108
|
+
})), this.props.additionalInfo && jsx(AdditionalInfoMessage, {
|
|
109
|
+
message: this.props.additionalInfo
|
|
110
|
+
}), jsx(FieldErrors, {
|
|
108
111
|
id: sequentialErrorsId,
|
|
109
112
|
errors: this.props.errors,
|
|
110
113
|
isVisible: hasError,
|
|
@@ -130,7 +133,6 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
130
133
|
return errors;
|
|
131
134
|
}
|
|
132
135
|
}]);
|
|
133
|
-
return TextField;
|
|
134
136
|
}(Component);
|
|
135
137
|
TextField.displayName = 'TextField';
|
|
136
138
|
TextField.defaultProps = {
|
|
@@ -169,6 +171,6 @@ TextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
169
171
|
var TextField$1 = TextField;
|
|
170
172
|
|
|
171
173
|
// NOTE: This string will be replaced on build time with the package version.
|
|
172
|
-
var version = "19.
|
|
174
|
+
var version = "19.12.1";
|
|
173
175
|
|
|
174
176
|
export { TextField$1 as default, version };
|
|
@@ -116,6 +116,10 @@ export type TTextFieldProps = {
|
|
|
116
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
117
|
*/
|
|
118
118
|
maxLength?: number;
|
|
119
|
+
/**
|
|
120
|
+
* Additional information to be displayed below the input.
|
|
121
|
+
*/
|
|
122
|
+
additionalInfo?: ReactNode;
|
|
119
123
|
};
|
|
120
124
|
type TTextFieldState = Pick<TTextFieldProps, 'id'>;
|
|
121
125
|
declare class TextField extends Component<TTextFieldProps, TTextFieldState> {
|
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.12.1",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,14 +21,15 @@
|
|
|
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/
|
|
30
|
-
"@commercetools-uikit/
|
|
31
|
-
"@commercetools-uikit/
|
|
24
|
+
"@commercetools-uikit/constraints": "19.12.1",
|
|
25
|
+
"@commercetools-uikit/design-system": "19.12.1",
|
|
26
|
+
"@commercetools-uikit/field-errors": "19.12.1",
|
|
27
|
+
"@commercetools-uikit/field-label": "19.12.1",
|
|
28
|
+
"@commercetools-uikit/field-warnings": "19.12.1",
|
|
29
|
+
"@commercetools-uikit/messages": "19.12.1",
|
|
30
|
+
"@commercetools-uikit/spacings-stack": "19.12.1",
|
|
31
|
+
"@commercetools-uikit/text-input": "19.12.1",
|
|
32
|
+
"@commercetools-uikit/utils": "19.12.1",
|
|
32
33
|
"@emotion/react": "^11.10.5",
|
|
33
34
|
"@emotion/styled": "^11.10.5",
|
|
34
35
|
"prop-types": "15.8.1",
|