@commercetools-uikit/localized-rich-text-input 13.0.3 → 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
@@ -1,3 +1,6 @@
1
+ <!-- THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -->
2
+ <!-- This file is created by the `yarn generate-readme` script. -->
3
+
1
4
  # LocalizedRichTextInput
2
5
 
3
6
  ## Description
@@ -5,12 +8,32 @@
5
8
  A controlled text input component for localized rich text input with validation
6
9
  states.
7
10
 
11
+ ## Installation
12
+
13
+ ```
14
+ yarn add @commercetools-uikit/localized-rich-text-input
15
+ ```
16
+
17
+ ```
18
+ npm --save install @commercetools-uikit/localized-rich-text-input
19
+ ```
20
+
21
+ Additionally install the peer dependencies (if not present)
22
+
23
+ ```
24
+ yarn add react react-intl
25
+ ```
26
+
27
+ ```
28
+ npm --save install react react-intl
29
+ ```
30
+
8
31
  ## Usage
9
32
 
10
- ```js
33
+ ```jsx
11
34
  import LocalizedRichTextInput from '@commercetools-uikit/localized-rich-text-input';
12
35
 
13
- const Input = (props) => (
36
+ const Example = () => (
14
37
  <LocalizedRichTextInput
15
38
  value={{
16
39
  en: '',
@@ -19,40 +42,60 @@ const Input = (props) => (
19
42
  onChange={(event) => console.log('event.target.value', event.target.value)}
20
43
  />
21
44
  );
45
+
46
+ export default Example;
22
47
  ```
23
48
 
24
49
  ## Properties
25
50
 
26
- | Props | Type | Required | Values | Default | Description |
27
- | ------------------------------- | ---------------- | :------: | ----------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
28
- | `id` | `string` | - | - | - | Used as prefix of HTML `id` property. Each input field id will have the language as a suffix (`${idPrefix}.${lang}`), e.g. `foo.en` |
29
- | `name` | `string` | - | - | - | 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` |
30
- | `value` | `object` | ✅ | - | - | Values to use. Keyed by language, the values are the actual values, e.g. `{ en: '<p>Horse</p>', de: '<p>Pferd</p>' }` |
31
- | `autoComplete` | `string` | - | - | - | Used as HTML `autocomplete` property |
32
- | `onChange` | `function` | ✅ | - | - | Gets called when any input is changed. Is called with the change event of the changed input. |
33
- | `selectedLanguage` | `string` | ✅ | - | - | Specifies which language will be shown in case the `LocalizedRichTextInput` is collapsed. |
34
- | `onBlur` | `function` | - | - | - | Called when any field is blurred. Is called with the `event` of that field. |
35
- | `onFocus` | `function` | - | - | - | Called when any field is focussed. Is called with the `event` of that field. |
36
- | `defaultExpandMultilineText` | `bool` | - | - | `false` | Expands input components holding multiline values instead of collpasing them by default. |
37
- | `hideLanguageExpansionControls` | `bool` | - | - | `false` | Will hide the language expansion controls when set to `true`. All languages will be shown when set to `true`. |
38
- | `defaultExpandLanguages` | `bool` | - | - | `false` | Controls whether one or all languages are visible by default. Pass `true` to show all languages by default. |
39
- | `isAutofocussed` | `bool` | - | - | `false` | Sets the focus on the first input when `true` is passed. |
40
- | `isDisabled` | `bool` | - | - | `false` | Disables all input fields. |
41
- | `isReadOnly` | `bool` | - | - | `false` | Disables all input fields and shows them in read-only mode. |
42
- | `placeholder` | `object` | - | - | - | Placeholders for each language. Object of the same shape as `value`. |
43
- | `horizontalConstraint` | `object` | - | `m`, `l`, `xl`, `scale` | `scale` | Horizontal size limit of the input fields. |
44
- | `hasError` | `bool` | - | - | - | Will apply the error state to each input without showing any error message. |
45
- | `hasWarning` | `bool` | - | - | - | Will apply the warning state to each input without showing any warning message. |
46
- | `errors` | `objectOf(node)` | - | - | - | Used to show errors underneath the inputs of specific languages. Pass an object whose key is a language and whose value is the error to show for that key. |
47
- | `warnings` | `objectOf(node)` | - | - | - | Used to show warnings underneath the inputs of specific languages. Pass an object whose key is a language and whose value is the warning to show for that key. |
48
- | `showExpandIcon` | `bool` | - | - | `false` | Shows an `expand` icon in the toolbar |
49
- | `onClickExpand` | `func` | - | - | - | Called when the `expand` button is clicked |
50
-
51
- The component forwards all `data` attribute props. It further adds a `-${language}` suffix to the values of the `data-test` and `data-track-component` attributes, e.g `data-test="foo"` will get added to the input for `en` as `data-test="foo-en"`.
52
-
53
- Main Functions and use cases are:
54
-
55
- - Receiving localized HTML input from user
51
+ | Props | Type | Required | Default | Description |
52
+ | ------------------------------- | ----------------------------------------------------------------------------------------- | :------: | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
53
+ | `id` | `string` | | | Used as prefix of HTML `id` property. Each input field id will have the language as a suffix (`${idPrefix}.${lang}`), e.g. \`foo.en |
54
+ | `name` | `string` | | | 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` |
55
+ | `value` | `Record` | ✅ | | Values to use. Keyed by language, the values are the actual values, e.g. \`{ en: '<p>Horse</p>', de: '<p>Pferd</p>' } |
56
+ | `onChange` | `Function`<br/>[See signature.](#signature-onChange) | | | Gets called when any input is changed. Is called with the change event of the changed input. |
57
+ | `selectedLanguage` | `string` | ✅ | | Specifies which language will be shown in case the `LocalizedRichTextInput` is collapsed. |
58
+ | `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Called when any field is blurred. Is called with the `event` of that field. |
59
+ | `onFocus` | `Function`<br/>[See signature.](#signature-onFocus) | | | Called when any field is focussed. Is called with the `event` of that field. |
60
+ | `defaultExpandMultilineText` | `boolean` | | | Expands input components holding multiline values instead of collapsing them by default. |
61
+ | `hideLanguageExpansionControls` | `boolean` | | | Will hide the language expansion controls when set to `true`. All languages will be shown when set to `true` |
62
+ | `defaultExpandLanguages` | `boolean` | | | Controls whether one or all languages are visible by default. Pass `true` to show all languages by default. |
63
+ | `isDisabled` | `boolean` | | | Disables all input |
64
+ | `isReadOnly` | `boolean` | | | Disables all input fields and shows them in read-only mode. |
65
+ | `placeholder` | `Record` | | | Placeholders for each language. Object of the same shape as |
66
+ | `horizontalConstraint` | `union`<br/>Possible values:<br/>`, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | `'scale'` | Horizontal size limit of the input fields. |
67
+ | `hasError` | `boolean` | | | Will apply the error state to each input without showing any error message. |
68
+ | `hasWarning` | `boolean` | | | Will apply the warning state to each input without showing any warning message. |
69
+ | `errors` | `Record` | | | Used to show errors underneath the inputs of specific languages. Pass an object whose key is a language and whose value is the error to show for that key. |
70
+ | `warnings` | `Record` | | | Used to show warnings underneath the inputs of specific languages. Pass an object whose key is a language and whose value is the warning to show for that key. |
71
+ | `showExpandIcon` | `boolean` | | `false` | Shows an `expand` icon in the toolbar |
72
+ | `onClickExpand` | `Function`<br/>[See signature.](#signature-onClickExpand) | | | Called when the `expand` button is clicked |
73
+
74
+ ## Signatures
75
+
76
+ ### Signature `onChange`
77
+
78
+ ```ts
79
+ (event: TEvent) => void
80
+ ```
81
+
82
+ ### Signature `onBlur`
83
+
84
+ ```ts
85
+ (event: TEvent) => void
86
+ ```
87
+
88
+ ### Signature `onFocus`
89
+
90
+ ```ts
91
+ (event: TEvent) => void
92
+ ```
93
+
94
+ ### Signature `onClickExpand`
95
+
96
+ ```ts
97
+ () => boolean;
98
+ ```
56
99
 
57
100
  ### Static Properties
58
101
 
@@ -118,16 +161,3 @@ Returns `true` when at least one value is truthy.
118
161
 
119
162
  This field exports a default error message which can be used when the field is
120
163
  required, but the user provided no value. You can use it as
121
-
122
- ```js
123
- render (
124
- return (
125
- <div>
126
- <LocalizedRichTextInput hasError={isMissing} />
127
- {
128
- isMissing && <LocalizedRichTextInput.RequiredValueErrorMessage />
129
- }
130
- </div>
131
- )
132
- )
133
- ```
@@ -0,0 +1,2 @@
1
+ export * from "./declarations/src/index";
2
+ export { default } from "./declarations/src/index";