@commercetools-uikit/localized-text-input 19.9.0 → 19.11.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.
@@ -266,7 +266,7 @@ LocalizedTextInput.isTouched = localizedUtils.isTouched;
266
266
  var LocalizedTextInput$1 = LocalizedTextInput;
267
267
 
268
268
  // NOTE: This string will be replaced on build time with the package version.
269
- var version = "19.9.0";
269
+ var version = "19.11.0";
270
270
 
271
271
  exports["default"] = LocalizedTextInput$1;
272
272
  exports.version = version;
@@ -204,7 +204,7 @@ LocalizedTextInput.isTouched = localizedUtils.isTouched;
204
204
  var LocalizedTextInput$1 = LocalizedTextInput;
205
205
 
206
206
  // NOTE: This string will be replaced on build time with the package version.
207
- var version = "19.9.0";
207
+ var version = "19.11.0";
208
208
 
209
209
  exports["default"] = LocalizedTextInput$1;
210
210
  exports.version = version;
@@ -246,6 +246,6 @@ LocalizedTextInput.isTouched = isTouched;
246
246
  var LocalizedTextInput$1 = LocalizedTextInput;
247
247
 
248
248
  // NOTE: This string will be replaced on build time with the package version.
249
- var version = "19.9.0";
249
+ var version = "19.11.0";
250
250
 
251
251
  export { LocalizedTextInput$1 as default, version };
@@ -7,34 +7,113 @@ export type TLocalizedTextInputProps = {
7
7
  id?: string;
8
8
  name?: string;
9
9
  autoComplete?: string;
10
+ /**
11
+ * Indicate if the value entered in the input is invalid.
12
+ */
10
13
  'aria-invalid'?: boolean;
14
+ /**
15
+ * HTML ID of an element containing an error message related to the input.
16
+ */
11
17
  'aria-errormessage'?: string;
18
+ /**
19
+ * then input doesn't accept a "languages" prop, instead all possible
20
+ languages have to exist (with empty or filled strings) on the value:
21
+ { en: 'foo', de: '', es: '' }
22
+ */
12
23
  value: Record<string, string>;
24
+ /**
25
+ * Gets called when any input is changed. Is called with the change event of the changed input.
26
+ */
13
27
  onChange?: ChangeEventHandler<HTMLLocalizedInputElement>;
28
+ /**
29
+ * Specifies which language will be shown in case the `LocalizedTextInput` is collapsed.
30
+ */
14
31
  selectedLanguage: string;
32
+ /**
33
+ * Called when any field is blurred. Is called with the `event` of that field.
34
+ */
15
35
  onBlur?: FocusEventHandler<HTMLInputElement>;
36
+ /**
37
+ * Called when any field is focussed. Is called with the `event` of that field.
38
+ */
16
39
  onFocus?: FocusEventHandler<HTMLInputElement>;
40
+ /**
41
+ * Will hide the language expansion controls when set to `true`. All languages will be shown when set to `true`.
42
+ */
17
43
  hideLanguageExpansionControls?: boolean;
44
+ /**
45
+ * Controls whether one or all languages are visible by default
46
+ */
18
47
  defaultExpandLanguages?: boolean;
48
+ /**
49
+ * Focus the input field on initial render
50
+ */
19
51
  isAutofocussed?: boolean;
52
+ /**
53
+ * Use this property to reduce the paddings of the component for a ui compact variant
54
+ */
20
55
  isCondensed?: boolean;
56
+ /**
57
+ * Disables all input fields.
58
+ */
21
59
  isDisabled?: boolean;
60
+ /**
61
+ * Disables all input fields and shows them in read-only mode.
62
+ */
22
63
  isReadOnly?: boolean;
64
+ /**
65
+ * Placeholders for each language. Object of the same shape as `value`.
66
+ */
23
67
  placeholder?: Record<string, string>;
68
+ /**
69
+ * Horizontal size limit of the input fields.
70
+ */
24
71
  horizontalConstraint?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
72
+ /**
73
+ * Will apply the error state to each input without showing any error message.
74
+ */
25
75
  hasError?: boolean;
76
+ /**
77
+ * Indicates the input field has a warning
78
+ */
26
79
  hasWarning?: boolean;
80
+ /**
81
+ * Used to show errors underneath the inputs of specific locales. Pass an object whose key is a locale and whose value is the error to show for that key.
82
+ */
27
83
  errors?: Record<string, ReactNode>;
84
+ /**
85
+ * A map of warnings.
86
+ */
28
87
  warnings?: Record<string, ReactNode>;
88
+ /**
89
+ * An object mapping locales to additional messages to be rendered below each input element.
90
+ Example:
91
+ {
92
+ en: 'Some value',
93
+ es: 'Algún valor',
94
+ }
95
+ */
29
96
  additionalInfo?: Record<string, string | ReactNode | (MessageDescriptor & {
30
97
  values: Record<string, ReactNode>;
31
98
  })>;
32
99
  };
33
100
  export type TLocalizedInputProps = {
101
+ /**
102
+ * Used as prefix of HTML `id` property. Each input field id will have the language as a suffix (`${idPrefix}.${lang}`), e.g. `foo.en`. You can use the static `LocalizedTextInput.getId(idPrefix, language)` to create this id string, e.g. for labels.
103
+ */
34
104
  id?: string;
105
+ /**
106
+ * 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`
107
+ */
35
108
  name?: string;
109
+ /**
110
+ * Used as HTML `autocomplete` property
111
+ */
36
112
  autoComplete?: string;
37
113
  value: string;
114
+ /**
115
+ * Gets called when any input is changed. Is called with the change event of the changed input.
116
+ */
38
117
  onChange?: ChangeEventHandler<HTMLLocalizedInputElement>;
39
118
  language: string;
40
119
  onBlur?: FocusEventHandler<HTMLInputElement>;
@@ -44,6 +123,9 @@ export type TLocalizedInputProps = {
44
123
  isDisabled?: boolean;
45
124
  isReadOnly?: boolean;
46
125
  hasError?: boolean;
126
+ /**
127
+ * Indicates the input field has a warning
128
+ */
47
129
  hasWarning?: boolean;
48
130
  warning?: ReactNode;
49
131
  placeholder?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/localized-text-input",
3
3
  "description": "A controlled text input component for localized single-line strings with validation states.",
4
- "version": "19.9.0",
4
+ "version": "19.11.0",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,18 +21,18 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.20.13",
23
23
  "@babel/runtime-corejs3": "^7.20.13",
24
- "@commercetools-uikit/constraints": "19.9.0",
25
- "@commercetools-uikit/design-system": "19.9.0",
26
- "@commercetools-uikit/flat-button": "19.9.0",
27
- "@commercetools-uikit/hooks": "19.9.0",
28
- "@commercetools-uikit/icons": "19.9.0",
29
- "@commercetools-uikit/input-utils": "19.9.0",
30
- "@commercetools-uikit/localized-utils": "19.9.0",
31
- "@commercetools-uikit/messages": "19.9.0",
32
- "@commercetools-uikit/spacings-stack": "19.9.0",
33
- "@commercetools-uikit/text": "19.9.0",
34
- "@commercetools-uikit/text-input": "19.9.0",
35
- "@commercetools-uikit/utils": "19.9.0",
24
+ "@commercetools-uikit/constraints": "19.11.0",
25
+ "@commercetools-uikit/design-system": "19.11.0",
26
+ "@commercetools-uikit/flat-button": "19.11.0",
27
+ "@commercetools-uikit/hooks": "19.11.0",
28
+ "@commercetools-uikit/icons": "19.11.0",
29
+ "@commercetools-uikit/input-utils": "19.11.0",
30
+ "@commercetools-uikit/localized-utils": "19.11.0",
31
+ "@commercetools-uikit/messages": "19.11.0",
32
+ "@commercetools-uikit/spacings-stack": "19.11.0",
33
+ "@commercetools-uikit/text": "19.11.0",
34
+ "@commercetools-uikit/text-input": "19.11.0",
35
+ "@commercetools-uikit/utils": "19.11.0",
36
36
  "@emotion/react": "^11.10.5",
37
37
  "@emotion/styled": "^11.10.5",
38
38
  "prop-types": "15.8.1"