@commercetools-uikit/localized-text-field 13.0.0 → 13.0.4

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
@@ -49,35 +49,48 @@ export default Example;
49
49
 
50
50
  ## Properties
51
51
 
52
- | Props | Type | Required | Default | Description |
53
- | ------------------------------- | ----------------------------------------------------------------------------------------- | :------: | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
- | `id` | `string` | | | Used as HTML id property. An id is auto-generated when it is not specified. |
55
- | `horizontalConstraint` | `enum`<br/>Possible values:<br/>`6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | `'scale'` | Horizontal size limit of the input fields. |
56
- | `errors` | `object` | | | A map of errors. Error messages for known errors are rendered automatically.&#xA;<br />&#xA;Unknown errors will be forwarded to `renderError` |
57
- | `errors.missing` | `bool` | | | |
58
- | `renderError` | `func` | | | 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.&#xA;<br />&#xA;Signature: `(key, error) => React.node` |
59
- | `isRequired` | `bool` | | | Indicates if the value is required. Shows an the "required asterisk" if so. |
60
- | `touched` | `bool` | | | Indicates whether the field was touched. Errors will only be shown when the field was touched. |
61
- | `autoComplete` | `string` | | | Used as HTML `autocomplete` of the input component. property |
62
- | `name` | `string` | | | Used as HTML name of the input component. property |
63
- | `value` | `objectOf(string)` | ✅ | | Values to use.&#xA;<br />&#xA;Keyed by language, the values are the actual values, e.g. `{ en: 'Horse', de: 'Pferd' }` |
64
- | `onChange` | `custom` | | | Called with an event containing the new value. Required when input is not read only. Parent should pass it back as value.&#xA;<br />&#xA;Signature: `(event) => void` |
65
- | `selectedLanguage` | `string` | ✅ | | Specifies which language will be shown in case the `LocalizedTextInput` is collapsed. |
66
- | `onBlur` | `func` | | | Called when input is blurred |
67
- | `onFocus` | `func` | | | Called when input is focused |
68
- | `hideLanguageExpansionControls` | `bool` | | | Will hide the language expansion controls when set to `true`. All languages will be shown when set to `true`. |
69
- | `defaultExpandLanguages` | `custom` | | | Controls whether one or all languages are visible by default |
70
- | `isAutofocussed` | `bool` | | | Focus the input on initial render |
71
- | `isDisabled` | `bool` | | | Indicates that the input cannot be modified (e.g not authorized, or changes currently saving). |
72
- | `isReadOnly` | `bool` | | | Indicates that the field is displaying read-only content |
73
- | `placeholder` | `objectOf(string)` | | | Placeholders for each language. Object of the same shape as `value`. |
74
- | `errorsByLanguage` | `objectOf(node)` | | | Errors for each translation. These are forwarded to the `errors` prop of `LocalizedTextInput`. |
75
- | `title` | `<string, node>` | ✅ | | Title of the label |
76
- | `hint` | `custom` | | | 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`. |
77
- | `description` | `<string, node>` | | | Provides a description for the title. |
78
- | `onInfoButtonClick` | `func` | | | Function called when info button is pressed.&#xA;<br />&#xA;Info button will only be visible when this prop is passed.&#xA;<br />&#xA;Signature: `(event) => void` |
79
- | `hintIcon` | `node` | | | Icon to be displayed beside the hint text.&#xA;<br />&#xA;Will only get rendered when `hint` is passed as well. |
80
- | `badge` | `node` | | | Badge to be displayed beside the label.&#xA;<br />&#xA;Might be used to display additional information about the content of the field (E.g verified email) |
52
+ | Props | Type | Required | Default | Description |
53
+ | ------------------------------- | -------------------------------------------------------------------------------------------- | :------: | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
+ | `id` | `string` | | | Used as HTML id property. An id is auto-generated when it is not specified. |
55
+ | `horizontalConstraint` | `union`<br/>Possible values:<br/>`, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | `'scale'` | Horizontal size limit of the input fields. |
56
+ | `errors` | `TFieldErrors` | | | A map of errors. Error messages for known errors are rendered automatically.&#xA;<br />&#xA;Unknown errors will be forwarded to `renderError` |
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
+ | `isRequired` | `boolean` | | | Indicates if the value is required. Shows an the "required asterisk" if so. |
59
+ | `touched` | `boolean` | | | Indicates whether the field was touched. Errors will only be shown when the field was touched. |
60
+ | `autoComplete` | `string` | | | Used as HTML `autocomplete` of the input component. property |
61
+ | `name` | `string` | | | Used as HTML name of the input component. property |
62
+ | `value` | `Record` | ✅ | | Values to use.&#xA;<br />&#xA;Keyed by language, the values are the actual values, e.g. `{ en: 'Horse', de: 'Pferd' }` |
63
+ | `onChange` | `ChangeEventHandler` | | | Called with an event containing the new value. Required when input is not read only. Parent should pass it back as value. |
64
+ | `selectedLanguage` | `string` | ✅ | | Specifies which language will be shown in case the `LocalizedTextInput` is collapsed. |
65
+ | `onBlur` | `FocusEventHandler` | | | Called when input is blurred |
66
+ | `onFocus` | `FocusEventHandler` | | | Called when input is focused |
67
+ | `hideLanguageExpansionControls` | `boolean` | | | Will hide the language expansion controls when set to `true`. All languages will be shown when set to `true`. |
68
+ | `defaultExpandLanguages` | `boolean` | | | Controls whether one or all languages are visible by default |
69
+ | `isAutofocussed` | `boolean` | | | Focus the input on initial render |
70
+ | `isDisabled` | `boolean` | | | Indicates that the input cannot be modified (e.g not authorized, or changes currently saving). |
71
+ | `isReadOnly` | `boolean` | | | Indicates that the field is displaying read-only content |
72
+ | `placeholder` | `Record` | | | Placeholders for each language. Object of the same shape as `value`. |
73
+ | `errorsByLanguage` | `Record` | | | Errors for each translation. These are forwarded to the `errors` prop of `LocalizedTextInput`. |
74
+ | `title` | `ReactNode` | ✅ | | Title of the label |
75
+ | `hint` | `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`. |
76
+ | `description` | `ReactNode` | | | Provides a description for the title. |
77
+ | `onInfoButtonClick` | `Function`<br/>[See signature.](#signature-onInfoButtonClick) | | | Function called when info button is pressed.&#xA;<br />&#xA;Info button will only be visible when this prop is passed. |
78
+ | `hintIcon` | `ReactElement` | | | Icon to be displayed beside the hint text.&#xA;<br />&#xA;Will only get rendered when `hint` is passed as well. |
79
+ | `badge` | `ReactNode` | | | Badge to be displayed beside the label.&#xA;<br />&#xA;Might be used to display additional information about the content of the field (E.g verified email) |
80
+
81
+ ## Signatures
82
+
83
+ ### Signature `renderError`
84
+
85
+ ```ts
86
+ (key: string, error?: boolean) => ReactNode;
87
+ ```
88
+
89
+ ### Signature `onInfoButtonClick`
90
+
91
+ ```ts
92
+ (event: TEvent) => void
93
+ ```
81
94
 
82
95
  ## `data-*` props
83
96
 
@@ -0,0 +1,2 @@
1
+ export * from "./declarations/src/index";
2
+ export { default } from "./declarations/src/index";
@@ -11,20 +11,17 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
11
11
  var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
12
12
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
13
13
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
14
- var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
15
14
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
16
15
  var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
17
16
  var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
18
17
  var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
19
18
  var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
20
19
  var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
20
+ var _pt = require('prop-types');
21
21
  var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
22
22
  var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
23
23
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
24
24
  var react = require('react');
25
- var PropTypes = require('prop-types');
26
- var requiredIf = require('react-required-if');
27
- var commonTags = require('common-tags');
28
25
  var utils = require('@commercetools-uikit/utils');
29
26
  var Constraints = require('@commercetools-uikit/constraints');
30
27
  var Spacings = require('@commercetools-uikit/spacings');
@@ -44,27 +41,25 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
44
41
  var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
45
42
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
46
43
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
44
+ var _pt__default = /*#__PURE__*/_interopDefault(_pt);
47
45
  var _someInstanceProperty__default = /*#__PURE__*/_interopDefault(_someInstanceProperty);
48
46
  var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
49
47
  var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
50
- var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
51
- var requiredIf__default = /*#__PURE__*/_interopDefault(requiredIf);
52
48
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
53
49
  var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
54
50
  var FieldLabel__default = /*#__PURE__*/_interopDefault(FieldLabel);
55
51
  var LocalizedTextInput__default = /*#__PURE__*/_interopDefault(LocalizedTextInput);
56
52
  var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
57
53
 
58
- var _templateObject;
59
-
60
54
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
61
55
 
62
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
56
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
63
57
 
64
58
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
65
59
 
66
60
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
67
61
  var sequentialId = utils.createSequentialId('localized-text-field-');
62
+ var sequentialErrorsId = utils.createSequentialId('localized-text-field-error-')();
68
63
 
69
64
  var hasErrors = function hasErrors(errors) {
70
65
  var _context;
@@ -101,6 +96,15 @@ var LocalizedTextField = /*#__PURE__*/function (_Component) {
101
96
  key: "render",
102
97
  value: function render() {
103
98
  var hasError = this.props.touched && hasErrors(this.props.errors);
99
+
100
+ if (this.props.hintIcon) {
101
+ process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.hint === 'string' || /*#__PURE__*/react.isValidElement(this.props.hint), 'LocalizedTextField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
102
+ }
103
+
104
+ if (this.props.hideLanguageExpansionControls) {
105
+ process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.defaultExpandLanguages !== 'boolean', 'LocalizedTextField: "defaultExpandLanguages" does not have any effect when "hideLanguageExpansionControls" is set.') : void 0;
106
+ }
107
+
104
108
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
105
109
  max: this.props.horizontalConstraint,
106
110
  children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
@@ -114,7 +118,7 @@ var LocalizedTextField = /*#__PURE__*/function (_Component) {
114
118
  badge: this.props.badge,
115
119
  hasRequiredIndicator: this.props.isRequired,
116
120
  htmlFor: this.state.id
117
- }), jsxRuntime.jsx(LocalizedTextInput__default["default"], _objectSpread({
121
+ }), jsxRuntime.jsx(LocalizedTextInput__default["default"], _objectSpread(_objectSpread({
118
122
  autoComplete: this.props.autoComplete,
119
123
  id: this.state.id,
120
124
  name: this.props.name,
@@ -132,7 +136,11 @@ var LocalizedTextField = /*#__PURE__*/function (_Component) {
132
136
  hasError: hasError,
133
137
  placeholder: this.props.placeholder,
134
138
  horizontalConstraint: "scale"
135
- }, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default["default"], {
139
+ }, utils.filterDataAttributes(this.props)), {}, {
140
+ "aria-invalid": hasError,
141
+ "aria-errormessage": sequentialErrorsId
142
+ })), jsxRuntime.jsx(FieldErrors__default["default"], {
143
+ id: sequentialErrorsId,
136
144
  errors: this.props.errors,
137
145
  isVisible: hasError,
138
146
  renderError: this.props.renderError
@@ -157,178 +165,36 @@ LocalizedTextField.getDerivedStateFromProps = function (props, state) {
157
165
  };
158
166
 
159
167
  LocalizedTextField.propTypes = process.env.NODE_ENV !== "production" ? {
160
- // LocalizedTextField
161
-
162
- /**
163
- * Used as HTML id property. An id is auto-generated when it is not specified.
164
- */
165
- id: PropTypes__default["default"].string,
166
-
167
- /**
168
- * Horizontal size limit of the input fields.
169
- */
170
- horizontalConstraint: PropTypes__default["default"].oneOf([6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
171
-
172
- /**
173
- * A map of errors. Error messages for known errors are rendered automatically.
174
- * <br />
175
- * Unknown errors will be forwarded to `renderError`
176
- */
177
- errors: PropTypes__default["default"].shape({
178
- missing: PropTypes__default["default"].bool
179
- }),
180
-
181
- /**
182
- * 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.
183
- * <br />
184
- * Signature: `(key, error) => React.node`
185
- */
186
- renderError: PropTypes__default["default"].func,
187
-
188
- /**
189
- * Indicates if the value is required. Shows an the "required asterisk" if so.
190
- */
191
- isRequired: PropTypes__default["default"].bool,
192
-
193
- /**
194
- * Indicates whether the field was touched. Errors will only be shown when the field was touched.
195
- */
196
- touched: PropTypes__default["default"].bool,
197
- // LocalizedTextInput
198
-
199
- /**
200
- * Used as HTML `autocomplete` of the input component. property
201
- */
202
- autoComplete: PropTypes__default["default"].string,
203
-
204
- /**
205
- * Used as HTML name of the input component. property
206
- */
207
- name: PropTypes__default["default"].string,
208
-
209
- /**
210
- * Values to use.
211
- * <br />
212
- Keyed by language, the values are the actual values, e.g. `{ en: 'Horse', de: 'Pferd' }`
213
- */
214
- value: PropTypes__default["default"].objectOf(PropTypes__default["default"].string).isRequired,
215
-
216
- /**
217
- * Called with an event containing the new value. Required when input is not read only. Parent should pass it back as value.
218
- * <br />
219
- * Signature: `(event) => void`
220
- */
221
- onChange: requiredIf__default["default"](PropTypes__default["default"].func, function (props) {
222
- return !props.isReadOnly;
223
- }),
224
-
225
- /**
226
- * Specifies which language will be shown in case the `LocalizedTextInput` is collapsed.
227
- */
228
- selectedLanguage: PropTypes__default["default"].string.isRequired,
229
-
230
- /**
231
- * Called when input is blurred
232
- */
233
- onBlur: PropTypes__default["default"].func,
234
-
235
- /**
236
- * Called when input is focused
237
- */
238
- onFocus: PropTypes__default["default"].func,
239
-
240
- /**
241
- * Will hide the language expansion controls when set to `true`. All languages will be shown when set to `true`.
242
- */
243
- hideLanguageExpansionControls: PropTypes__default["default"].bool,
244
-
245
- /**
246
- * Controls whether one or all languages are visible by default
247
- */
248
- defaultExpandLanguages: function defaultExpandLanguages(props, propName, componentName) {
249
- var _context3;
250
-
251
- if (props.hideLanguageExpansionControls && typeof props[propName] === 'boolean') {
252
- throw new Error(commonTags.oneLine(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", ": \"", "\" does not have any effect when\n \"hideLanguageExpansionControls\" is set.\n "])), componentName, propName));
253
- }
254
-
255
- for (var _len2 = arguments.length, rest = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
256
- rest[_key2 - 3] = arguments[_key2];
257
- }
258
-
259
- return PropTypes__default["default"].bool.apply(PropTypes__default["default"], _concatInstanceProperty__default["default"](_context3 = [props, propName, componentName]).call(_context3, rest));
260
- },
261
-
262
- /**
263
- * Focus the input on initial render
264
- */
265
- isAutofocussed: PropTypes__default["default"].bool,
266
-
267
- /**
268
- * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
269
- */
270
- isDisabled: PropTypes__default["default"].bool,
271
-
272
- /**
273
- * Indicates that the field is displaying read-only content
274
- */
275
- isReadOnly: PropTypes__default["default"].bool,
276
-
277
- /**
278
- * Placeholders for each language. Object of the same shape as `value`.
279
- */
280
- placeholder: PropTypes__default["default"].objectOf(PropTypes__default["default"].string),
281
-
282
- /**
283
- * Errors for each translation. These are forwarded to the `errors` prop of `LocalizedTextInput`.
284
- */
285
- errorsByLanguage: PropTypes__default["default"].objectOf(PropTypes__default["default"].node),
286
- // LabelField
287
-
288
- /**
289
- * Title of the label
290
- */
291
- title: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]).isRequired,
292
-
293
- /**
294
- * 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`.
295
- */
296
- hint: requiredIf__default["default"](PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]), function (props) {
297
- return props.hintIcon;
298
- }),
299
-
300
- /**
301
- * Provides a description for the title.
302
- */
303
- description: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node]),
304
-
305
- /**
306
- * Function called when info button is pressed.
307
- * <br />
308
- * Info button will only be visible when this prop is passed.
309
- * <br />
310
- * Signature: `(event) => void`
311
- */
312
- onInfoButtonClick: PropTypes__default["default"].func,
313
-
314
- /**
315
- * Icon to be displayed beside the hint text.
316
- * <br />
317
- * Will only get rendered when `hint` is passed as well.
318
- */
319
- hintIcon: PropTypes__default["default"].node,
320
-
321
- /**
322
- * Badge to be displayed beside the label.
323
- * <br />
324
- * Might be used to display additional information about the content of the field (E.g verified email)
325
- */
326
- badge: PropTypes__default["default"].node
168
+ id: _pt__default["default"].string,
169
+ horizontalConstraint: _pt__default["default"].oneOf([6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
170
+ errors: _pt__default["default"].any,
171
+ renderError: _pt__default["default"].func,
172
+ isRequired: _pt__default["default"].bool,
173
+ touched: _pt__default["default"].bool,
174
+ autoComplete: _pt__default["default"].string,
175
+ name: _pt__default["default"].string,
176
+ value: _pt__default["default"].objectOf(_pt__default["default"].string).isRequired,
177
+ onChange: _pt__default["default"].func,
178
+ selectedLanguage: _pt__default["default"].string.isRequired,
179
+ onBlur: _pt__default["default"].func,
180
+ onFocus: _pt__default["default"].func,
181
+ hideLanguageExpansionControls: _pt__default["default"].bool,
182
+ defaultExpandLanguages: _pt__default["default"].bool,
183
+ isAutofocussed: _pt__default["default"].bool,
184
+ isDisabled: _pt__default["default"].bool,
185
+ isReadOnly: _pt__default["default"].bool,
186
+ placeholder: _pt__default["default"].objectOf(_pt__default["default"].string),
187
+ errorsByLanguage: _pt__default["default"].objectOf(_pt__default["default"].string),
188
+ title: _pt__default["default"].node.isRequired,
189
+ hint: _pt__default["default"].node,
190
+ description: _pt__default["default"].node,
191
+ onInfoButtonClick: _pt__default["default"].func,
192
+ hintIcon: _pt__default["default"].element
327
193
  } : {};
328
194
  var LocalizedTextField$1 = LocalizedTextField;
329
195
 
330
196
  // NOTE: This string will be replaced on build time with the package version.
331
- var version = "13.0.0";
197
+ var version = "13.0.4";
332
198
 
333
199
  exports["default"] = LocalizedTextField$1;
334
200
  exports.version = version;
@@ -11,20 +11,17 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
11
11
  var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
12
12
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
13
13
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
14
- require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
15
14
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
16
15
  var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
17
16
  var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
18
17
  var _inherits = require('@babel/runtime-corejs3/helpers/inherits');
19
18
  var _possibleConstructorReturn = require('@babel/runtime-corejs3/helpers/possibleConstructorReturn');
20
19
  var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
20
+ require('prop-types');
21
21
  var _someInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/some');
22
22
  var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
23
23
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
24
24
  var react = require('react');
25
- require('prop-types');
26
- require('react-required-if');
27
- require('common-tags');
28
25
  var utils = require('@commercetools-uikit/utils');
29
26
  var Constraints = require('@commercetools-uikit/constraints');
30
27
  var Spacings = require('@commercetools-uikit/spacings');
@@ -55,12 +52,13 @@ var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
55
52
 
56
53
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
57
54
 
58
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
55
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
59
56
 
60
57
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
61
58
 
62
59
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
63
60
  var sequentialId = utils.createSequentialId('localized-text-field-');
61
+ var sequentialErrorsId = utils.createSequentialId('localized-text-field-error-')();
64
62
 
65
63
  var hasErrors = function hasErrors(errors) {
66
64
  var _context;
@@ -97,6 +95,11 @@ var LocalizedTextField = /*#__PURE__*/function (_Component) {
97
95
  key: "render",
98
96
  value: function render() {
99
97
  var hasError = this.props.touched && hasErrors(this.props.errors);
98
+
99
+ if (this.props.hintIcon) ;
100
+
101
+ if (this.props.hideLanguageExpansionControls) ;
102
+
100
103
  return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
101
104
  max: this.props.horizontalConstraint,
102
105
  children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
@@ -110,7 +113,7 @@ var LocalizedTextField = /*#__PURE__*/function (_Component) {
110
113
  badge: this.props.badge,
111
114
  hasRequiredIndicator: this.props.isRequired,
112
115
  htmlFor: this.state.id
113
- }), jsxRuntime.jsx(LocalizedTextInput__default["default"], _objectSpread({
116
+ }), jsxRuntime.jsx(LocalizedTextInput__default["default"], _objectSpread(_objectSpread({
114
117
  autoComplete: this.props.autoComplete,
115
118
  id: this.state.id,
116
119
  name: this.props.name,
@@ -128,7 +131,11 @@ var LocalizedTextField = /*#__PURE__*/function (_Component) {
128
131
  hasError: hasError,
129
132
  placeholder: this.props.placeholder,
130
133
  horizontalConstraint: "scale"
131
- }, utils.filterDataAttributes(this.props))), jsxRuntime.jsx(FieldErrors__default["default"], {
134
+ }, utils.filterDataAttributes(this.props)), {}, {
135
+ "aria-invalid": hasError,
136
+ "aria-errormessage": sequentialErrorsId
137
+ })), jsxRuntime.jsx(FieldErrors__default["default"], {
138
+ id: sequentialErrorsId,
132
139
  errors: this.props.errors,
133
140
  isVisible: hasError,
134
141
  renderError: this.props.renderError
@@ -156,7 +163,7 @@ LocalizedTextField.propTypes = {};
156
163
  var LocalizedTextField$1 = LocalizedTextField;
157
164
 
158
165
  // NOTE: This string will be replaced on build time with the package version.
159
- var version = "13.0.0";
166
+ var version = "13.0.4";
160
167
 
161
168
  exports["default"] = LocalizedTextField$1;
162
169
  exports.version = version;
@@ -7,21 +7,18 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
7
7
  import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
8
8
  import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
9
9
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
10
- import _taggedTemplateLiteral from '@babel/runtime-corejs3/helpers/esm/taggedTemplateLiteral';
11
10
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
12
11
  import _classCallCheck from '@babel/runtime-corejs3/helpers/esm/classCallCheck';
13
12
  import _createClass from '@babel/runtime-corejs3/helpers/esm/createClass';
14
13
  import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
15
14
  import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn';
16
15
  import _getPrototypeOf from '@babel/runtime-corejs3/helpers/esm/getPrototypeOf';
16
+ import _pt from 'prop-types';
17
17
  import _someInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/some';
18
18
  import _Object$values from '@babel/runtime-corejs3/core-js-stable/object/values';
19
19
  import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
20
- import { Component } from 'react';
21
- import PropTypes from 'prop-types';
22
- import requiredIf from 'react-required-if';
23
- import { oneLine } from 'common-tags';
24
- import { createSequentialId, filterDataAttributes, getFieldId } from '@commercetools-uikit/utils';
20
+ import { isValidElement, Component } from 'react';
21
+ import { createSequentialId, warning, filterDataAttributes, getFieldId } from '@commercetools-uikit/utils';
25
22
  import Constraints from '@commercetools-uikit/constraints';
26
23
  import Spacings from '@commercetools-uikit/spacings';
27
24
  import FieldLabel from '@commercetools-uikit/field-label';
@@ -29,16 +26,15 @@ import LocalizedTextInput from '@commercetools-uikit/localized-text-input';
29
26
  import FieldErrors from '@commercetools-uikit/field-errors';
30
27
  import { jsx, jsxs } from '@emotion/react/jsx-runtime';
31
28
 
32
- var _templateObject;
33
-
34
29
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35
30
 
36
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
31
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
37
32
 
38
33
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
39
34
 
40
35
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
36
  var sequentialId = createSequentialId('localized-text-field-');
37
+ var sequentialErrorsId = createSequentialId('localized-text-field-error-')();
42
38
 
43
39
  var hasErrors = function hasErrors(errors) {
44
40
  var _context;
@@ -75,6 +71,15 @@ var LocalizedTextField = /*#__PURE__*/function (_Component) {
75
71
  key: "render",
76
72
  value: function render() {
77
73
  var hasError = this.props.touched && hasErrors(this.props.errors);
74
+
75
+ if (this.props.hintIcon) {
76
+ process.env.NODE_ENV !== "production" ? warning(typeof this.props.hint === 'string' || /*#__PURE__*/isValidElement(this.props.hint), 'LocalizedTextField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
77
+ }
78
+
79
+ if (this.props.hideLanguageExpansionControls) {
80
+ process.env.NODE_ENV !== "production" ? warning(typeof this.props.defaultExpandLanguages !== 'boolean', 'LocalizedTextField: "defaultExpandLanguages" does not have any effect when "hideLanguageExpansionControls" is set.') : void 0;
81
+ }
82
+
78
83
  return jsx(Constraints.Horizontal, {
79
84
  max: this.props.horizontalConstraint,
80
85
  children: jsxs(Spacings.Stack, {
@@ -88,7 +93,7 @@ var LocalizedTextField = /*#__PURE__*/function (_Component) {
88
93
  badge: this.props.badge,
89
94
  hasRequiredIndicator: this.props.isRequired,
90
95
  htmlFor: this.state.id
91
- }), jsx(LocalizedTextInput, _objectSpread({
96
+ }), jsx(LocalizedTextInput, _objectSpread(_objectSpread({
92
97
  autoComplete: this.props.autoComplete,
93
98
  id: this.state.id,
94
99
  name: this.props.name,
@@ -106,7 +111,11 @@ var LocalizedTextField = /*#__PURE__*/function (_Component) {
106
111
  hasError: hasError,
107
112
  placeholder: this.props.placeholder,
108
113
  horizontalConstraint: "scale"
109
- }, filterDataAttributes(this.props))), jsx(FieldErrors, {
114
+ }, filterDataAttributes(this.props)), {}, {
115
+ "aria-invalid": hasError,
116
+ "aria-errormessage": sequentialErrorsId
117
+ })), jsx(FieldErrors, {
118
+ id: sequentialErrorsId,
110
119
  errors: this.props.errors,
111
120
  isVisible: hasError,
112
121
  renderError: this.props.renderError
@@ -131,177 +140,35 @@ LocalizedTextField.getDerivedStateFromProps = function (props, state) {
131
140
  };
132
141
 
133
142
  LocalizedTextField.propTypes = process.env.NODE_ENV !== "production" ? {
134
- // LocalizedTextField
135
-
136
- /**
137
- * Used as HTML id property. An id is auto-generated when it is not specified.
138
- */
139
- id: PropTypes.string,
140
-
141
- /**
142
- * Horizontal size limit of the input fields.
143
- */
144
- horizontalConstraint: PropTypes.oneOf([6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
145
-
146
- /**
147
- * A map of errors. Error messages for known errors are rendered automatically.
148
- * <br />
149
- * Unknown errors will be forwarded to `renderError`
150
- */
151
- errors: PropTypes.shape({
152
- missing: PropTypes.bool
153
- }),
154
-
155
- /**
156
- * 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.
157
- * <br />
158
- * Signature: `(key, error) => React.node`
159
- */
160
- renderError: PropTypes.func,
161
-
162
- /**
163
- * Indicates if the value is required. Shows an the "required asterisk" if so.
164
- */
165
- isRequired: PropTypes.bool,
166
-
167
- /**
168
- * Indicates whether the field was touched. Errors will only be shown when the field was touched.
169
- */
170
- touched: PropTypes.bool,
171
- // LocalizedTextInput
172
-
173
- /**
174
- * Used as HTML `autocomplete` of the input component. property
175
- */
176
- autoComplete: PropTypes.string,
177
-
178
- /**
179
- * Used as HTML name of the input component. property
180
- */
181
- name: PropTypes.string,
182
-
183
- /**
184
- * Values to use.
185
- * <br />
186
- Keyed by language, the values are the actual values, e.g. `{ en: 'Horse', de: 'Pferd' }`
187
- */
188
- value: PropTypes.objectOf(PropTypes.string).isRequired,
189
-
190
- /**
191
- * Called with an event containing the new value. Required when input is not read only. Parent should pass it back as value.
192
- * <br />
193
- * Signature: `(event) => void`
194
- */
195
- onChange: requiredIf(PropTypes.func, function (props) {
196
- return !props.isReadOnly;
197
- }),
198
-
199
- /**
200
- * Specifies which language will be shown in case the `LocalizedTextInput` is collapsed.
201
- */
202
- selectedLanguage: PropTypes.string.isRequired,
203
-
204
- /**
205
- * Called when input is blurred
206
- */
207
- onBlur: PropTypes.func,
208
-
209
- /**
210
- * Called when input is focused
211
- */
212
- onFocus: PropTypes.func,
213
-
214
- /**
215
- * Will hide the language expansion controls when set to `true`. All languages will be shown when set to `true`.
216
- */
217
- hideLanguageExpansionControls: PropTypes.bool,
218
-
219
- /**
220
- * Controls whether one or all languages are visible by default
221
- */
222
- defaultExpandLanguages: function defaultExpandLanguages(props, propName, componentName) {
223
- var _context3;
224
-
225
- if (props.hideLanguageExpansionControls && typeof props[propName] === 'boolean') {
226
- throw new Error(oneLine(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", ": \"", "\" does not have any effect when\n \"hideLanguageExpansionControls\" is set.\n "])), componentName, propName));
227
- }
228
-
229
- for (var _len2 = arguments.length, rest = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
230
- rest[_key2 - 3] = arguments[_key2];
231
- }
232
-
233
- return PropTypes.bool.apply(PropTypes, _concatInstanceProperty(_context3 = [props, propName, componentName]).call(_context3, rest));
234
- },
235
-
236
- /**
237
- * Focus the input on initial render
238
- */
239
- isAutofocussed: PropTypes.bool,
240
-
241
- /**
242
- * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
243
- */
244
- isDisabled: PropTypes.bool,
245
-
246
- /**
247
- * Indicates that the field is displaying read-only content
248
- */
249
- isReadOnly: PropTypes.bool,
250
-
251
- /**
252
- * Placeholders for each language. Object of the same shape as `value`.
253
- */
254
- placeholder: PropTypes.objectOf(PropTypes.string),
255
-
256
- /**
257
- * Errors for each translation. These are forwarded to the `errors` prop of `LocalizedTextInput`.
258
- */
259
- errorsByLanguage: PropTypes.objectOf(PropTypes.node),
260
- // LabelField
261
-
262
- /**
263
- * Title of the label
264
- */
265
- title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
266
-
267
- /**
268
- * 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`.
269
- */
270
- hint: requiredIf(PropTypes.oneOfType([PropTypes.string, PropTypes.node]), function (props) {
271
- return props.hintIcon;
272
- }),
273
-
274
- /**
275
- * Provides a description for the title.
276
- */
277
- description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
278
-
279
- /**
280
- * Function called when info button is pressed.
281
- * <br />
282
- * Info button will only be visible when this prop is passed.
283
- * <br />
284
- * Signature: `(event) => void`
285
- */
286
- onInfoButtonClick: PropTypes.func,
287
-
288
- /**
289
- * Icon to be displayed beside the hint text.
290
- * <br />
291
- * Will only get rendered when `hint` is passed as well.
292
- */
293
- hintIcon: PropTypes.node,
294
-
295
- /**
296
- * Badge to be displayed beside the label.
297
- * <br />
298
- * Might be used to display additional information about the content of the field (E.g verified email)
299
- */
300
- badge: PropTypes.node
143
+ id: _pt.string,
144
+ horizontalConstraint: _pt.oneOf([6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
145
+ errors: _pt.any,
146
+ renderError: _pt.func,
147
+ isRequired: _pt.bool,
148
+ touched: _pt.bool,
149
+ autoComplete: _pt.string,
150
+ name: _pt.string,
151
+ value: _pt.objectOf(_pt.string).isRequired,
152
+ onChange: _pt.func,
153
+ selectedLanguage: _pt.string.isRequired,
154
+ onBlur: _pt.func,
155
+ onFocus: _pt.func,
156
+ hideLanguageExpansionControls: _pt.bool,
157
+ defaultExpandLanguages: _pt.bool,
158
+ isAutofocussed: _pt.bool,
159
+ isDisabled: _pt.bool,
160
+ isReadOnly: _pt.bool,
161
+ placeholder: _pt.objectOf(_pt.string),
162
+ errorsByLanguage: _pt.objectOf(_pt.string),
163
+ title: _pt.node.isRequired,
164
+ hint: _pt.node,
165
+ description: _pt.node,
166
+ onInfoButtonClick: _pt.func,
167
+ hintIcon: _pt.element
301
168
  } : {};
302
169
  var LocalizedTextField$1 = LocalizedTextField;
303
170
 
304
171
  // NOTE: This string will be replaced on build time with the package version.
305
- var version = "13.0.0";
172
+ var version = "13.0.4";
306
173
 
307
174
  export { LocalizedTextField$1 as default, version };
@@ -0,0 +1,2 @@
1
+ export { default } from './localized-text-field';
2
+ export { default as version } from './version';
@@ -0,0 +1,45 @@
1
+ import { Component, type ChangeEventHandler, type FocusEventHandler, type KeyboardEvent, type MouseEvent, type ReactElement, type ReactNode } from 'react';
2
+ import { type TFieldErrors } from '@commercetools-uikit/field-errors';
3
+ declare type TEvent = MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>;
4
+ declare type TErrorRenderer = (key: string, error?: boolean) => ReactNode;
5
+ declare type TLocalizedTextFieldProps = {
6
+ id?: string;
7
+ horizontalConstraint?: 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
8
+ errors?: TFieldErrors;
9
+ renderError?: TErrorRenderer;
10
+ isRequired?: boolean;
11
+ touched?: boolean;
12
+ autoComplete?: string;
13
+ name?: string;
14
+ value: Record<string, string>;
15
+ onChange?: ChangeEventHandler;
16
+ selectedLanguage: string;
17
+ onBlur?: FocusEventHandler;
18
+ onFocus?: FocusEventHandler;
19
+ hideLanguageExpansionControls?: boolean;
20
+ defaultExpandLanguages?: boolean;
21
+ isAutofocussed?: boolean;
22
+ isDisabled?: boolean;
23
+ isReadOnly?: boolean;
24
+ placeholder?: Record<string, string>;
25
+ errorsByLanguage?: Record<string, string>;
26
+ title: ReactNode;
27
+ hint?: ReactNode;
28
+ description?: ReactNode;
29
+ onInfoButtonClick?: (event: TEvent) => void;
30
+ hintIcon?: ReactElement;
31
+ badge?: ReactNode;
32
+ };
33
+ declare type TLocalizedTextFieldSTate = Pick<TLocalizedTextFieldProps, 'id'>;
34
+ declare class LocalizedTextField extends Component<TLocalizedTextFieldProps, TLocalizedTextFieldSTate> {
35
+ static displayName: string;
36
+ static defaultProps: Pick<TLocalizedTextFieldProps, 'horizontalConstraint'>;
37
+ state: {
38
+ id: string | undefined;
39
+ };
40
+ static getDerivedStateFromProps: (props: TLocalizedTextFieldProps, state: TLocalizedTextFieldSTate) => {
41
+ id: string;
42
+ };
43
+ render(): import("@emotion/react/jsx-runtime").JSX.Element;
44
+ }
45
+ export default LocalizedTextField;
@@ -0,0 +1,2 @@
1
+ declare const _default: "__@UI_KIT_PACKAGE/VERSION_OF_RELEASE__";
2
+ export default _default;
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": "13.0.0",
4
+ "version": "13.0.4",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,18 +21,17 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "7.17.2",
23
23
  "@babel/runtime-corejs3": "7.17.2",
24
- "@commercetools-uikit/constraints": "13.0.0",
24
+ "@commercetools-uikit/constraints": "13.0.2",
25
25
  "@commercetools-uikit/design-system": "13.0.0",
26
- "@commercetools-uikit/field-errors": "13.0.0",
27
- "@commercetools-uikit/field-label": "13.0.0",
28
- "@commercetools-uikit/localized-text-input": "13.0.0",
29
- "@commercetools-uikit/spacings": "13.0.0",
30
- "@commercetools-uikit/utils": "12.2.9",
26
+ "@commercetools-uikit/field-errors": "13.0.4",
27
+ "@commercetools-uikit/field-label": "13.0.4",
28
+ "@commercetools-uikit/localized-text-input": "13.0.4",
29
+ "@commercetools-uikit/spacings": "13.0.2",
30
+ "@commercetools-uikit/utils": "13.0.2",
31
31
  "@emotion/react": "^11.4.0",
32
32
  "@emotion/styled": "^11.3.0",
33
- "common-tags": "1.8.2",
34
33
  "prop-types": "15.8.1",
35
- "react-required-if": "1.0.3"
34
+ "react-intl": "^5.24.6"
36
35
  },
37
36
  "devDependencies": {
38
37
  "react": "17.0.2"