@contentful/field-editor-multiple-line 0.15.1 → 1.0.2
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/CHANGELOG.md +22 -96
- package/README.md +0 -1
- package/dist/field-editor-multiple-line.cjs.development.js +6 -6
- package/dist/field-editor-multiple-line.cjs.development.js.map +1 -1
- package/dist/field-editor-multiple-line.cjs.production.min.js +1 -1
- package/dist/field-editor-multiple-line.cjs.production.min.js.map +1 -1
- package/dist/field-editor-multiple-line.esm.js +5 -5
- package/dist/field-editor-multiple-line.esm.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,208 +3,134 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [0.
|
|
6
|
+
## [1.0.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@1.0.1...@contentful/field-editor-multiple-line@1.0.2) (2021-12-20)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
9
9
|
|
|
10
|
+
## [1.0.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@1.0.0...@contentful/field-editor-multiple-line@1.0.1) (2021-11-17)
|
|
10
11
|
|
|
12
|
+
### Bug Fixes
|
|
11
13
|
|
|
14
|
+
- **card-actions:** update forma 36 to fix card actions click issue ([#927](https://github.com/contentful/field-editors/issues/927)) ([3dfdef2](https://github.com/contentful/field-editors/commit/3dfdef2c2b0045f12ea94ddafca89a8e9f25e7d0))
|
|
12
15
|
|
|
16
|
+
# [1.0.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.16.0...@contentful/field-editor-multiple-line@1.0.0) (2021-11-04)
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
15
19
|
|
|
20
|
+
# [0.16.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.15.1...@contentful/field-editor-multiple-line@0.16.0) (2021-11-04)
|
|
16
21
|
|
|
17
22
|
### Features
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
- Forma v4 components adoption ([#805](https://github.com/contentful/field-editors/issues/805)) ([526bde6](https://github.com/contentful/field-editors/commit/526bde6e10e0ee3789705ec10fb31489af7ca59e))
|
|
21
25
|
|
|
26
|
+
### BREAKING CHANGES
|
|
22
27
|
|
|
28
|
+
- adopts a new Forma v4 beta
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
## [0.14.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.14.2...@contentful/field-editor-multiple-line@0.14.3) (2021-09-17)
|
|
30
|
+
## [0.15.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.15.0...@contentful/field-editor-multiple-line@0.15.1) (2021-10-14)
|
|
26
31
|
|
|
27
32
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
28
33
|
|
|
34
|
+
# [0.15.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.14.3...@contentful/field-editor-multiple-line@0.15.0) (2021-10-06)
|
|
29
35
|
|
|
36
|
+
### Features
|
|
30
37
|
|
|
38
|
+
- [EXT-3161] bump app sdk to v4 ([#881](https://github.com/contentful/field-editors/issues/881)) ([9c4a2af](https://github.com/contentful/field-editors/commit/9c4a2af07da203d59fb5f15c3a5188ecc64b1d44))
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
## [0.14.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.14.1...@contentful/field-editor-multiple-line@0.14.2) (2021-09-16)
|
|
40
|
+
## [0.14.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.14.2...@contentful/field-editor-multiple-line@0.14.3) (2021-09-17)
|
|
34
41
|
|
|
35
42
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
36
43
|
|
|
44
|
+
## [0.14.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.14.1...@contentful/field-editor-multiple-line@0.14.2) (2021-09-16)
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
40
47
|
|
|
41
48
|
## [0.14.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.14.0...@contentful/field-editor-multiple-line@0.14.1) (2021-08-19)
|
|
42
49
|
|
|
43
50
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
52
|
# [0.14.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.13.1...@contentful/field-editor-multiple-line@0.14.0) (2021-08-05)
|
|
50
53
|
|
|
51
|
-
|
|
52
54
|
### Features
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
- 🎸 add char counter ([#795](https://github.com/contentful/field-editors/issues/795)) ([3237f6c](https://github.com/contentful/field-editors/commit/3237f6ce51cf5d29880e641858a61ffcd9c61fa4)), closes [#491](https://github.com/contentful/field-editors/issues/491)
|
|
59
57
|
|
|
60
58
|
## [0.13.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.13.0...@contentful/field-editor-multiple-line@0.13.1) (2021-07-29)
|
|
61
59
|
|
|
62
60
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
62
|
# [0.13.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.12.6...@contentful/field-editor-multiple-line@0.13.0) (2021-07-23)
|
|
69
63
|
|
|
70
|
-
|
|
71
64
|
### Features
|
|
72
65
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
- 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
|
|
78
67
|
|
|
79
68
|
## [0.12.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.12.3...@contentful/field-editor-multiple-line@0.12.6) (2021-07-06)
|
|
80
69
|
|
|
81
70
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
82
71
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
72
|
## [0.12.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.12.3...@contentful/field-editor-multiple-line@0.12.5) (2021-07-06)
|
|
88
73
|
|
|
89
74
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
90
75
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
76
|
## [0.12.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.12.3...@contentful/field-editor-multiple-line@0.12.4) (2021-06-23)
|
|
96
77
|
|
|
97
78
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
98
79
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
80
|
## [0.12.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.12.2...@contentful/field-editor-multiple-line@0.12.3) (2021-06-23)
|
|
104
81
|
|
|
105
82
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
106
83
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
84
|
## [0.12.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.12.1...@contentful/field-editor-multiple-line@0.12.2) (2021-06-22)
|
|
112
85
|
|
|
113
86
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
114
87
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
88
|
## [0.12.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.12.0...@contentful/field-editor-multiple-line@0.12.1) (2021-03-05)
|
|
120
89
|
|
|
121
90
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
122
91
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
92
|
# [0.12.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.11.2...@contentful/field-editor-multiple-line@0.12.0) (2021-02-19)
|
|
128
93
|
|
|
129
|
-
|
|
130
94
|
### Features
|
|
131
95
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
96
|
+
- bump min version of forma-36 ([#606](https://github.com/contentful/field-editors/issues/606)) ([fd57c7a](https://github.com/contentful/field-editors/commit/fd57c7a4312766af38c01507f17706ab22992617))
|
|
137
97
|
|
|
138
98
|
## [0.11.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.11.1...@contentful/field-editor-multiple-line@0.11.2) (2021-02-09)
|
|
139
99
|
|
|
140
100
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
141
101
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
102
|
## [0.11.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.11.0...@contentful/field-editor-multiple-line@0.11.1) (2021-02-01)
|
|
147
103
|
|
|
148
104
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
149
105
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
106
|
# [0.11.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.10.0...@contentful/field-editor-multiple-line@0.11.0) (2021-01-20)
|
|
155
107
|
|
|
156
|
-
|
|
157
108
|
### Features
|
|
158
109
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
110
|
+
- update minimal forma-36 versions to use updated design ([#565](https://github.com/contentful/field-editors/issues/565)) ([332c734](https://github.com/contentful/field-editors/commit/332c734bfaf54f0e9773fcbb460d743b1f5459ec))
|
|
164
111
|
|
|
165
112
|
# [0.10.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.9.5...@contentful/field-editor-multiple-line@0.10.0) (2021-01-12)
|
|
166
113
|
|
|
167
|
-
|
|
168
114
|
### Features
|
|
169
115
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
116
|
+
- update minimal required Forma version to the 3.73.12 ([#552](https://github.com/contentful/field-editors/issues/552)) ([2816fd9](https://github.com/contentful/field-editors/commit/2816fd960c28815faebf49a9ef8f4c4c0d91fc36))
|
|
175
117
|
|
|
176
118
|
## [0.9.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.9.4...@contentful/field-editor-multiple-line@0.9.5) (2020-12-16)
|
|
177
119
|
|
|
178
120
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
179
121
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
122
|
## [0.9.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.9.3...@contentful/field-editor-multiple-line@0.9.4) (2020-11-06)
|
|
185
123
|
|
|
186
124
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
187
125
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
126
|
## [0.9.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.9.2...@contentful/field-editor-multiple-line@0.9.3) (2020-11-06)
|
|
193
127
|
|
|
194
128
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
195
129
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
130
|
## [0.9.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.9.1...@contentful/field-editor-multiple-line@0.9.2) (2020-10-28)
|
|
201
131
|
|
|
202
132
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
203
133
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
134
|
## [0.9.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-multiple-line@0.9.0...@contentful/field-editor-multiple-line@0.9.1) (2020-08-24)
|
|
209
135
|
|
|
210
136
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
package/README.md
CHANGED
|
@@ -7,6 +7,5 @@ npm install @contentful/field-editor-multiple-line
|
|
|
7
7
|
This package contains a React `MultipleLineEditor` component that is used as a default for the `Text` field type in the Contentful web application.
|
|
8
8
|
|
|
9
9
|
```js
|
|
10
|
-
import '@contentful/forma-36-react-components/dist/styles.css';
|
|
11
10
|
import { MultipleLineEditor } from '@contentful/field-editor-multiple-line';
|
|
12
11
|
```
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var forma36ReactComponents = require('@contentful/forma-36-react-components');
|
|
9
8
|
var fieldEditorShared = require('@contentful/field-editor-shared');
|
|
10
9
|
var emotion = require('emotion');
|
|
11
|
-
var tokens = _interopDefault(require('@contentful/
|
|
10
|
+
var tokens = _interopDefault(require('@contentful/f36-tokens'));
|
|
11
|
+
var f36Components = require('@contentful/f36-components');
|
|
12
12
|
|
|
13
13
|
var validationRow = /*#__PURE__*/emotion.css({
|
|
14
14
|
display: 'flex',
|
|
@@ -39,12 +39,12 @@ function MultipleLineEditor(props) {
|
|
|
39
39
|
setValue = _ref.setValue;
|
|
40
40
|
return React.createElement("div", {
|
|
41
41
|
"data-test-id": "multiple-line-editor"
|
|
42
|
-
}, React.createElement(
|
|
42
|
+
}, React.createElement(f36Components.Textarea, {
|
|
43
43
|
className: direction === 'rtl' ? rightToLeft : '',
|
|
44
44
|
rows: 3,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
isRequired: field.required,
|
|
46
|
+
isInvalid: errors.length > 0,
|
|
47
|
+
isDisabled: disabled,
|
|
48
48
|
value: value || '',
|
|
49
49
|
onChange: function onChange(e) {
|
|
50
50
|
setValue(e.target.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-editor-multiple-line.cjs.development.js","sources":["../src/styles.ts","../src/MultipleLineEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\nimport tokens from '@contentful/
|
|
1
|
+
{"version":3,"file":"field-editor-multiple-line.cjs.development.js","sources":["../src/styles.ts","../src/MultipleLineEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const validationRow = css({\n display: 'flex',\n justifyContent: 'space-between',\n fontSize: tokens.fontSizeM,\n marginTop: tokens.spacingXs,\n color: tokens.gray700,\n});\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n","import * as React from 'react';\nimport {\n FieldAPI,\n LocalesAPI,\n FieldConnector,\n CharCounter,\n CharValidation,\n ConstraintsUtils,\n} from '@contentful/field-editor-shared';\nimport * as styles from './styles';\n\nimport { Textarea } from '@contentful/f36-components';\n\nexport interface MultipleLineEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * whether char validation should be shown or not\n */\n withCharValidation: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\nexport function MultipleLineEditor(props: MultipleLineEditorProps) {\n const { field, locales, isInitiallyDisabled, withCharValidation } = props;\n\n const constraints = ConstraintsUtils.fromFieldValidations(\n field.validations,\n field.type as 'Text'\n );\n const checkConstraint = ConstraintsUtils.makeChecker(constraints);\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<string> field={field} isInitiallyDisabled={isInitiallyDisabled}>\n {({ errors, disabled, value, setValue }) => {\n return (\n <div data-test-id=\"multiple-line-editor\">\n <Textarea\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n rows={3}\n isRequired={field.required}\n isInvalid={errors.length > 0}\n isDisabled={disabled}\n value={value || ''}\n onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setValue(e.target.value);\n }}\n />\n {withCharValidation && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={checkConstraint} />\n <CharValidation constraints={constraints} />\n </div>\n )}\n {!withCharValidation && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={() => true} />\n </div>\n )}\n </div>\n );\n }}\n </FieldConnector>\n );\n}\n\nMultipleLineEditor.defaultProps = {\n isInitiallyDisabled: true,\n withCharValidation: true,\n};\n"],"names":["validationRow","css","display","justifyContent","fontSize","tokens","fontSizeM","marginTop","spacingXs","color","gray700","rightToLeft","direction","MultipleLineEditor","props","field","locales","isInitiallyDisabled","withCharValidation","constraints","ConstraintsUtils","fromFieldValidations","validations","type","checkConstraint","makeChecker","locale","React","FieldConnector","errors","disabled","value","setValue","Textarea","className","styles","rows","isRequired","required","isInvalid","length","isDisabled","onChange","e","target","CharCounter","CharValidation","defaultProps"],"mappings":";;;;;;;;;;;;AAGO,IAAMA,aAAa,gBAAGC,WAAG,CAAC;AAC/BC,EAAAA,OAAO,EAAE,MADsB;AAE/BC,EAAAA,cAAc,EAAE,eAFe;AAG/BC,EAAAA,QAAQ,EAAEC,MAAM,CAACC,SAHc;AAI/BC,EAAAA,SAAS,EAAEF,MAAM,CAACG,SAJa;AAK/BC,EAAAA,KAAK,EAAEJ,MAAM,CAACK;AALiB,CAAD,CAAzB;AAQA,IAAMC,WAAW,gBAAGV,WAAG,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kB,6BAAD;AAAad,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAAIP,MAAAA,eAAe,EAAEA;KAAlD,CADF,EAEEG,mBAAA,CAACmB,gCAAD;AAAgB3B,MAAAA,WAAW,EAAEA;KAA7B,CAFF,CAbJ,EAkBG,CAACD,kBAAD,IACCS,mBAAA,MAAA;AAAKO,MAAAA,SAAS,EAAEC;KAAhB,EACER,mBAAA,CAACkB,6BAAD;AAAad,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAAIP,MAAAA,eAAe,EAAE;AAAA,eAAM,IAAN;AAAA;KAAlD,CADF,CAnBJ,CADF;AA0BD,GA5BH,CADF;AAgCD;AAEDX,kBAAkB,CAACkC,YAAnB,GAAkC;AAChC9B,EAAAA,mBAAmB,EAAE,IADW;AAEhCC,EAAAA,kBAAkB,EAAE;AAFY,CAAlC;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),i=require("@contentful/field-editor-shared"),a=require("emotion"),r=(e=require("@contentful/f36-tokens"))&&"object"==typeof e&&"default"in e?e.default:e,n=require("@contentful/f36-components"),l=a.css({display:"flex",justifyContent:"space-between",fontSize:r.fontSizeM,marginTop:r.spacingXs,color:r.gray700}),s=a.css({direction:"rtl"});function o(e){var a=e.field,r=e.locales,o=e.isInitiallyDisabled,c=e.withCharValidation,d=i.ConstraintsUtils.fromFieldValidations(a.validations,a.type),u=i.ConstraintsUtils.makeChecker(d),f=r.direction[a.locale]||"ltr";return t.createElement(i.FieldConnector,{field:a,isInitiallyDisabled:o},(function(e){var r=e.value,o=e.setValue;return t.createElement("div",{"data-test-id":"multiple-line-editor"},t.createElement(n.Textarea,{className:"rtl"===f?s:"",rows:3,isRequired:a.required,isInvalid:e.errors.length>0,isDisabled:e.disabled,value:r||"",onChange:function(e){o(e.target.value)}}),c&&t.createElement("div",{className:l},t.createElement(i.CharCounter,{value:r||"",checkConstraint:u}),t.createElement(i.CharValidation,{constraints:d})),!c&&t.createElement("div",{className:l},t.createElement(i.CharCounter,{value:r||"",checkConstraint:function(){return!0}})))}))}o.defaultProps={isInitiallyDisabled:!0,withCharValidation:!0},exports.MultipleLineEditor=o;
|
|
2
2
|
//# sourceMappingURL=field-editor-multiple-line.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-editor-multiple-line.cjs.production.min.js","sources":["../src/styles.ts","../src/MultipleLineEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\nimport tokens from '@contentful/
|
|
1
|
+
{"version":3,"file":"field-editor-multiple-line.cjs.production.min.js","sources":["../src/styles.ts","../src/MultipleLineEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const validationRow = css({\n display: 'flex',\n justifyContent: 'space-between',\n fontSize: tokens.fontSizeM,\n marginTop: tokens.spacingXs,\n color: tokens.gray700,\n});\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n","import * as React from 'react';\nimport {\n FieldAPI,\n LocalesAPI,\n FieldConnector,\n CharCounter,\n CharValidation,\n ConstraintsUtils,\n} from '@contentful/field-editor-shared';\nimport * as styles from './styles';\n\nimport { Textarea } from '@contentful/f36-components';\n\nexport interface MultipleLineEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * whether char validation should be shown or not\n */\n withCharValidation: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\nexport function MultipleLineEditor(props: MultipleLineEditorProps) {\n const { field, locales, isInitiallyDisabled, withCharValidation } = props;\n\n const constraints = ConstraintsUtils.fromFieldValidations(\n field.validations,\n field.type as 'Text'\n );\n const checkConstraint = ConstraintsUtils.makeChecker(constraints);\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<string> field={field} isInitiallyDisabled={isInitiallyDisabled}>\n {({ errors, disabled, value, setValue }) => {\n return (\n <div data-test-id=\"multiple-line-editor\">\n <Textarea\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n rows={3}\n isRequired={field.required}\n isInvalid={errors.length > 0}\n isDisabled={disabled}\n value={value || ''}\n onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setValue(e.target.value);\n }}\n />\n {withCharValidation && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={checkConstraint} />\n <CharValidation constraints={constraints} />\n </div>\n )}\n {!withCharValidation && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={() => true} />\n </div>\n )}\n </div>\n );\n }}\n </FieldConnector>\n );\n}\n\nMultipleLineEditor.defaultProps = {\n isInitiallyDisabled: true,\n withCharValidation: true,\n};\n"],"names":["validationRow","css","display","justifyContent","fontSize","tokens","fontSizeM","marginTop","spacingXs","color","gray700","rightToLeft","direction","MultipleLineEditor","props","field","locales","isInitiallyDisabled","withCharValidation","constraints","ConstraintsUtils","fromFieldValidations","validations","type","checkConstraint","makeChecker","locale","React","FieldConnector","value","setValue","Textarea","className","styles","rows","isRequired","required","isInvalid","errors","length","isDisabled","disabled","onChange","e","target","CharCounter","CharValidation","defaultProps"],"mappings":"8RAGaA,EAAgBC,MAAI,CAC/BC,QAAS,OACTC,eAAgB,gBAChBC,SAAUC,EAAOC,UACjBC,UAAWF,EAAOG,UAClBC,MAAOJ,EAAOK,UAGHC,EAAcV,MAAI,CAC7BW,UAAW,iBCuBGC,EAAmBC,OACzBC,EAA4DD,EAA5DC,MAAOC,EAAqDF,EAArDE,QAASC,EAA4CH,EAA5CG,oBAAqBC,EAAuBJ,EAAvBI,mBAEvCC,EAAcC,mBAAiBC,qBACnCN,EAAMO,YACNP,EAAMQ,MAEFC,EAAkBJ,mBAAiBK,YAAYN,GAC/CP,EAAYI,EAAQJ,UAAUG,EAAMW,SAAW,aAGnDC,gBAACC,kBAAuBb,MAAOA,EAAOE,oBAAqBA,IACxD,gBAAqBY,IAAAA,MAAOC,IAAAA,gBAEzBH,sCAAkB,wBAChBA,gBAACI,YACCC,UAAyB,QAAdpB,EAAsBqB,EAAqB,GACtDC,KAAM,EACNC,WAAYpB,EAAMqB,SAClBC,YAPJC,OAOsBC,OAAS,EAC3BC,aARIC,SASJZ,MAAOA,GAAS,GAChBa,SAAU,SAACC,GACTb,EAASa,EAAEC,OAAOf,UAGrBX,GACCS,uBAAKK,UAAWC,GACdN,gBAACkB,eAAYhB,MAAOA,GAAS,GAAIL,gBAAiBA,IAClDG,gBAACmB,kBAAe3B,YAAaA,MAG/BD,GACAS,uBAAKK,UAAWC,GACdN,gBAACkB,eAAYhB,MAAOA,GAAS,GAAIL,gBAAiB,kBAAM,UAUxEX,EAAmBkC,aAAe,CAChC9B,qBAAqB,EACrBC,oBAAoB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
|
-
import { Textarea } from '@contentful/forma-36-react-components';
|
|
3
2
|
import { ConstraintsUtils, FieldConnector, CharCounter, CharValidation } from '@contentful/field-editor-shared';
|
|
4
3
|
import { css } from 'emotion';
|
|
5
|
-
import tokens from '@contentful/
|
|
4
|
+
import tokens from '@contentful/f36-tokens';
|
|
5
|
+
import { Textarea } from '@contentful/f36-components';
|
|
6
6
|
|
|
7
7
|
var validationRow = /*#__PURE__*/css({
|
|
8
8
|
display: 'flex',
|
|
@@ -36,9 +36,9 @@ function MultipleLineEditor(props) {
|
|
|
36
36
|
}, createElement(Textarea, {
|
|
37
37
|
className: direction === 'rtl' ? rightToLeft : '',
|
|
38
38
|
rows: 3,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
isRequired: field.required,
|
|
40
|
+
isInvalid: errors.length > 0,
|
|
41
|
+
isDisabled: disabled,
|
|
42
42
|
value: value || '',
|
|
43
43
|
onChange: function onChange(e) {
|
|
44
44
|
setValue(e.target.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-editor-multiple-line.esm.js","sources":["../src/styles.ts","../src/MultipleLineEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\nimport tokens from '@contentful/
|
|
1
|
+
{"version":3,"file":"field-editor-multiple-line.esm.js","sources":["../src/styles.ts","../src/MultipleLineEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const validationRow = css({\n display: 'flex',\n justifyContent: 'space-between',\n fontSize: tokens.fontSizeM,\n marginTop: tokens.spacingXs,\n color: tokens.gray700,\n});\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n","import * as React from 'react';\nimport {\n FieldAPI,\n LocalesAPI,\n FieldConnector,\n CharCounter,\n CharValidation,\n ConstraintsUtils,\n} from '@contentful/field-editor-shared';\nimport * as styles from './styles';\n\nimport { Textarea } from '@contentful/f36-components';\n\nexport interface MultipleLineEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * whether char validation should be shown or not\n */\n withCharValidation: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\nexport function MultipleLineEditor(props: MultipleLineEditorProps) {\n const { field, locales, isInitiallyDisabled, withCharValidation } = props;\n\n const constraints = ConstraintsUtils.fromFieldValidations(\n field.validations,\n field.type as 'Text'\n );\n const checkConstraint = ConstraintsUtils.makeChecker(constraints);\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<string> field={field} isInitiallyDisabled={isInitiallyDisabled}>\n {({ errors, disabled, value, setValue }) => {\n return (\n <div data-test-id=\"multiple-line-editor\">\n <Textarea\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n rows={3}\n isRequired={field.required}\n isInvalid={errors.length > 0}\n isDisabled={disabled}\n value={value || ''}\n onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setValue(e.target.value);\n }}\n />\n {withCharValidation && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={checkConstraint} />\n <CharValidation constraints={constraints} />\n </div>\n )}\n {!withCharValidation && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={() => true} />\n </div>\n )}\n </div>\n );\n }}\n </FieldConnector>\n );\n}\n\nMultipleLineEditor.defaultProps = {\n isInitiallyDisabled: true,\n withCharValidation: true,\n};\n"],"names":["validationRow","css","display","justifyContent","fontSize","tokens","fontSizeM","marginTop","spacingXs","color","gray700","rightToLeft","direction","MultipleLineEditor","props","field","locales","isInitiallyDisabled","withCharValidation","constraints","ConstraintsUtils","fromFieldValidations","validations","type","checkConstraint","makeChecker","locale","React","FieldConnector","errors","disabled","value","setValue","Textarea","className","styles","rows","isRequired","required","isInvalid","length","isDisabled","onChange","e","target","CharCounter","CharValidation","defaultProps"],"mappings":";;;;;;AAGO,IAAMA,aAAa,gBAAGC,GAAG,CAAC;AAC/BC,EAAAA,OAAO,EAAE,MADsB;AAE/BC,EAAAA,cAAc,EAAE,eAFe;AAG/BC,EAAAA,QAAQ,EAAEC,MAAM,CAACC,SAHc;AAI/BC,EAAAA,SAAS,EAAEF,MAAM,CAACG,SAJa;AAK/BC,EAAAA,KAAK,EAAEJ,MAAM,CAACK;AALiB,CAAD,CAAzB;AAQA,IAAMC,WAAW,gBAAGV,GAAG,CAAC;AAC7BW,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;;SCwBSC,mBAAmBC;AACjC,MAAQC,KAAR,GAAoED,KAApE,CAAQC,KAAR;AAAA,MAAeC,OAAf,GAAoEF,KAApE,CAAeE,OAAf;AAAA,MAAwBC,mBAAxB,GAAoEH,KAApE,CAAwBG,mBAAxB;AAAA,MAA6CC,kBAA7C,GAAoEJ,KAApE,CAA6CI,kBAA7C;AAEA,MAAMC,WAAW,GAAGC,gBAAgB,CAACC,oBAAjB,CAClBN,KAAK,CAACO,WADY,EAElBP,KAAK,CAACQ,IAFY,C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GA5BH,CADF;AAgCD;AAEDX,kBAAkB,CAACkC,YAAnB,GAAkC;AAChC9B,EAAAA,mBAAmB,EAAE,IADW;AAEhCC,EAAAA,kBAAkB,EAAE;AAFY,CAAlC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-multiple-line",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/field-editor-multiple-line.esm.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"tsc": "tsc -p ./ --noEmit"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@contentful/
|
|
25
|
-
"@contentful/
|
|
26
|
-
"@contentful/
|
|
24
|
+
"@contentful/f36-components": "^4.0.1-beta.2696",
|
|
25
|
+
"@contentful/f36-tokens": "^4.0.1-beta.2696",
|
|
26
|
+
"@contentful/field-editor-shared": "^1.0.2",
|
|
27
27
|
"emotion": "^10.0.17",
|
|
28
28
|
"lodash": "^4.17.15",
|
|
29
29
|
"lodash-es": "^4.17.15"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@contentful/field-editor-test-utils": "^0.
|
|
32
|
+
"@contentful/field-editor-test-utils": "^1.0.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=16.8.0"
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "7813114ba59222371e5b3f2c4d90464b75cb8d0d"
|
|
48
48
|
}
|