@contentful/field-editor-multiple-line 0.14.2 → 0.16.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.
- package/CHANGELOG.md +22 -83
- 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,181 +3,120 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
6
|
+
# [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)
|
|
9
7
|
|
|
8
|
+
### Features
|
|
10
9
|
|
|
10
|
+
- Forma v4 components adoption ([#805](https://github.com/contentful/field-editors/issues/805)) ([526bde6](https://github.com/contentful/field-editors/commit/526bde6e10e0ee3789705ec10fb31489af7ca59e))
|
|
11
11
|
|
|
12
|
+
### BREAKING CHANGES
|
|
12
13
|
|
|
14
|
+
- adopts a new Forma v4 beta
|
|
13
15
|
|
|
14
|
-
## [0.
|
|
16
|
+
## [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)
|
|
15
17
|
|
|
16
18
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
17
19
|
|
|
20
|
+
# [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)
|
|
18
21
|
|
|
22
|
+
### Features
|
|
19
23
|
|
|
24
|
+
- [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))
|
|
20
25
|
|
|
26
|
+
## [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)
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
23
29
|
|
|
30
|
+
## [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)
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
## [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)
|
|
28
35
|
|
|
36
|
+
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
29
37
|
|
|
38
|
+
# [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)
|
|
30
39
|
|
|
40
|
+
### Features
|
|
31
41
|
|
|
42
|
+
- 🎸 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)
|
|
32
43
|
|
|
33
44
|
## [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)
|
|
34
45
|
|
|
35
46
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
36
47
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
48
|
# [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)
|
|
42
49
|
|
|
43
|
-
|
|
44
50
|
### Features
|
|
45
51
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
- 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
|
|
51
53
|
|
|
52
54
|
## [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)
|
|
53
55
|
|
|
54
56
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
58
|
## [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)
|
|
61
59
|
|
|
62
60
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
62
|
## [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)
|
|
69
63
|
|
|
70
64
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
66
|
## [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)
|
|
77
67
|
|
|
78
68
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
79
69
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
70
|
## [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)
|
|
85
71
|
|
|
86
72
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
87
73
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
74
|
## [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)
|
|
93
75
|
|
|
94
76
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
95
77
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
78
|
# [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)
|
|
101
79
|
|
|
102
|
-
|
|
103
80
|
### Features
|
|
104
81
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
82
|
+
- bump min version of forma-36 ([#606](https://github.com/contentful/field-editors/issues/606)) ([fd57c7a](https://github.com/contentful/field-editors/commit/fd57c7a4312766af38c01507f17706ab22992617))
|
|
110
83
|
|
|
111
84
|
## [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)
|
|
112
85
|
|
|
113
86
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
114
87
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
88
|
## [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)
|
|
120
89
|
|
|
121
90
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
122
91
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
92
|
# [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)
|
|
128
93
|
|
|
129
|
-
|
|
130
94
|
### Features
|
|
131
95
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
96
|
+
- 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))
|
|
137
97
|
|
|
138
98
|
# [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)
|
|
139
99
|
|
|
140
|
-
|
|
141
100
|
### Features
|
|
142
101
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
102
|
+
- 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))
|
|
148
103
|
|
|
149
104
|
## [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)
|
|
150
105
|
|
|
151
106
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
152
107
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
108
|
## [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)
|
|
158
109
|
|
|
159
110
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
160
111
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
112
|
## [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)
|
|
166
113
|
|
|
167
114
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
168
115
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
116
|
## [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)
|
|
174
117
|
|
|
175
118
|
**Note:** Version bump only for package @contentful/field-editor-multiple-line
|
|
176
119
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
120
|
## [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)
|
|
182
121
|
|
|
183
122
|
**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;A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UAAU,EAAEX;AACZC,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAChBW,MAAAA,QAAQ,EAAE,kBAACC,CAAD;AACRX,QAAAA,QAAQ,CAACW,CAAC,CAACC,MAAF,CAASb,KAAV,CAAR;AACD;KATH,CADF,EAYGb,kBAAkB,IACjBS,mBAAA,MAAA;AAAKO,MAAAA,SAAS,EAAEC;KAAhB,EACER,mBAAA,CAACkB,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;A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AA,WAAW,EAAEA;KAA7B,CAFF,CAbJ,EAkBG,CAACD,kBAAD,IACCS,aAAA,MAAA;AAAKO,MAAAA,SAAS,EAAEC;KAAhB,EACER,aAAA,CAACkB,WAAD;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;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-multiple-line",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
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": "beta",
|
|
25
|
+
"@contentful/f36-tokens": "beta",
|
|
26
|
+
"@contentful/field-editor-shared": "^0.26.0",
|
|
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": "^0.19.0"
|
|
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": "f86ba28db3f34cffc0dc2580bf21297542f331c9"
|
|
48
48
|
}
|