@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 +75 -45
- package/dist/commercetools-uikit-localized-rich-text-input.cjs.d.ts +2 -0
- package/dist/commercetools-uikit-localized-rich-text-input.cjs.dev.js +179 -175
- package/dist/commercetools-uikit-localized-rich-text-input.cjs.prod.js +78 -53
- package/dist/commercetools-uikit-localized-rich-text-input.esm.js +178 -173
- package/dist/declarations/src/editor.d.ts +48 -0
- package/dist/declarations/src/editor.styles.d.ts +15 -0
- package/dist/declarations/src/editor.types.d.ts +103 -0
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/localized-rich-text-input.d.ts +55 -0
- package/dist/declarations/src/required-value-error-message.d.ts +5 -0
- package/dist/declarations/src/rich-text-input.d.ts +65 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/package.json +7 -9
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
|
-
```
|
|
33
|
+
```jsx
|
|
11
34
|
import LocalizedRichTextInput from '@commercetools-uikit/localized-rich-text-input';
|
|
12
35
|
|
|
13
|
-
const
|
|
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
|
|
27
|
-
| ------------------------------- |
|
|
28
|
-
| `id` | `string`
|
|
29
|
-
| `name` | `string`
|
|
30
|
-
| `value` | `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
```
|