@contentful/field-editor-multiple-line 0.15.1 → 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 CHANGED
@@ -3,208 +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
- ## [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)
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)
7
7
 
8
- **Note:** Version bump only for package @contentful/field-editor-multiple-line
8
+ ### Features
9
9
 
10
+ - Forma v4 components adoption ([#805](https://github.com/contentful/field-editors/issues/805)) ([526bde6](https://github.com/contentful/field-editors/commit/526bde6e10e0ee3789705ec10fb31489af7ca59e))
10
11
 
12
+ ### BREAKING CHANGES
11
13
 
14
+ - adopts a new Forma v4 beta
12
15
 
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)
13
17
 
14
- # [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
+ **Note:** Version bump only for package @contentful/field-editor-multiple-line
15
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)
16
21
 
17
22
  ### Features
18
23
 
19
- * [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
-
21
-
22
-
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))
24
25
 
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)
26
27
 
27
28
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
28
29
 
29
-
30
-
31
-
32
-
33
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)
34
31
 
35
32
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
36
33
 
37
-
38
-
39
-
40
-
41
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)
42
35
 
43
36
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
44
37
 
45
-
46
-
47
-
48
-
49
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)
50
39
 
51
-
52
40
  ### Features
53
41
 
54
- * 🎸 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)
55
-
56
-
57
-
58
-
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)
59
43
 
60
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)
61
45
 
62
46
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
63
47
 
64
-
65
-
66
-
67
-
68
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)
69
49
 
70
-
71
50
  ### Features
72
51
 
73
- * 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
74
-
75
-
76
-
77
-
52
+ - 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
78
53
 
79
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)
80
55
 
81
56
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
82
57
 
83
-
84
-
85
-
86
-
87
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)
88
59
 
89
60
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
90
61
 
91
-
92
-
93
-
94
-
95
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)
96
63
 
97
64
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
98
65
 
99
-
100
-
101
-
102
-
103
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)
104
67
 
105
68
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
106
69
 
107
-
108
-
109
-
110
-
111
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)
112
71
 
113
72
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
114
73
 
115
-
116
-
117
-
118
-
119
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)
120
75
 
121
76
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
122
77
 
123
-
124
-
125
-
126
-
127
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)
128
79
 
129
-
130
80
  ### Features
131
81
 
132
- * bump min version of forma-36 ([#606](https://github.com/contentful/field-editors/issues/606)) ([fd57c7a](https://github.com/contentful/field-editors/commit/fd57c7a4312766af38c01507f17706ab22992617))
133
-
134
-
135
-
136
-
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))
137
83
 
138
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)
139
85
 
140
86
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
141
87
 
142
-
143
-
144
-
145
-
146
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)
147
89
 
148
90
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
149
91
 
150
-
151
-
152
-
153
-
154
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)
155
93
 
156
-
157
94
  ### Features
158
95
 
159
- * 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))
160
-
161
-
162
-
163
-
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))
164
97
 
165
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)
166
99
 
167
-
168
100
  ### Features
169
101
 
170
- * 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))
171
-
172
-
173
-
174
-
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))
175
103
 
176
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)
177
105
 
178
106
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
179
107
 
180
-
181
-
182
-
183
-
184
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)
185
109
 
186
110
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
187
111
 
188
-
189
-
190
-
191
-
192
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)
193
113
 
194
114
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
195
115
 
196
-
197
-
198
-
199
-
200
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)
201
117
 
202
118
  **Note:** Version bump only for package @contentful/field-editor-multiple-line
203
119
 
204
-
205
-
206
-
207
-
208
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)
209
121
 
210
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/forma-36-tokens'));
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(forma36ReactComponents.Textarea, {
42
+ }, React.createElement(f36Components.Textarea, {
43
43
  className: direction === 'rtl' ? rightToLeft : '',
44
44
  rows: 3,
45
- required: field.required,
46
- error: errors.length > 0,
47
- disabled: disabled,
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/forma-36-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 { Textarea } from '@contentful/forma-36-react-components';\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\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 required={field.required}\n error={errors.length > 0}\n disabled={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","required","error","length","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,CAAC;AAC7BW,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;;SCuBSC,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,kCAAgB,CAACC,oBAAjB,CAClBN,KAAK,CAACO,WADY,EAElBP,KAAK,CAACQ,IAFY,CAApB;AAIA,MAAMC,eAAe,GAAGJ,kCAAgB,CAACK,WAAjB,CAA6BN,WAA7B,CAAxB;AACA,MAAMP,SAAS,GAAGI,OAAO,CAACJ,SAAR,CAAkBG,KAAK,CAACW,MAAxB,KAAmC,KAArD;AAEA,SACEC,mBAAA,CAACC,gCAAD;AAAwBb,IAAAA,KAAK,EAAEA;AAAOE,IAAAA,mBAAmB,EAAEA;GAA3D,EACG;QAAGY,cAAAA;QAAQC,gBAAAA;QAAUC,aAAAA;QAAOC,gBAAAA;AAC3B,WACEL,mBAAA,MAAA;sBAAkB;KAAlB,EACEA,mBAAA,CAACM,+BAAD;AACEC,MAAAA,SAAS,EAAEtB,SAAS,KAAK,KAAd,GAAsBuB,WAAtB,GAA2C;AACtDC,MAAAA,IAAI,EAAE;AACNC,MAAAA,QAAQ,EAAEtB,KAAK,CAACsB;AAChBC,MAAAA,KAAK,EAAET,MAAM,CAACU,MAAP,GAAgB;AACvBT,MAAAA,QAAQ,EAAEA;AACVC,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAChBS,MAAAA,QAAQ,EAAE,kBAACC,CAAD;AACRT,QAAAA,QAAQ,CAACS,CAAC,CAACC,MAAF,CAASX,KAAV,CAAR;AACD;KATH,CADF,EAYGb,kBAAkB,IACjBS,mBAAA,MAAA;AAAKO,MAAAA,SAAS,EAAEC;KAAhB,EACER,mBAAA,CAACgB,6BAAD;AAAaZ,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAAIP,MAAAA,eAAe,EAAEA;KAAlD,CADF,EAEEG,mBAAA,CAACiB,gCAAD;AAAgBzB,MAAAA,WAAW,EAAEA;KAA7B,CAFF,CAbJ,EAkBG,CAACD,kBAAD,IACCS,mBAAA,MAAA;AAAKO,MAAAA,SAAS,EAAEC;KAAhB,EACER,mBAAA,CAACgB,6BAAD;AAAaZ,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAAIP,MAAAA,eAAe,EAAE;AAAA,eAAM,IAAN;AAAA;KAAlD,CADF,CAnBJ,CADF;AA0BD,GA5BH,CADF;AAgCD;AAEDX,kBAAkB,CAACgC,YAAnB,GAAkC;AAChC5B,EAAAA,mBAAmB,EAAE,IADW;AAEhCC,EAAAA,kBAAkB,EAAE;AAFY,CAAlC;;;;"}
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,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,kCAAgB,CAACC,oBAAjB,CAClBN,KAAK,CAACO,WADY,EAElBP,KAAK,CAACQ,IAFY,CAApB;AAIA,MAAMC,eAAe,GAAGJ,kCAAgB,CAACK,WAAjB,CAA6BN,WAA7B,CAAxB;AACA,MAAMP,SAAS,GAAGI,OAAO,CAACJ,SAAR,CAAkBG,KAAK,CAACW,MAAxB,KAAmC,KAArD;AAEA,SACEC,mBAAA,CAACC,gCAAD;AAAwBb,IAAAA,KAAK,EAAEA;AAAOE,IAA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entful/forma-36-react-components"),a=require("@contentful/field-editor-shared"),i=require("emotion"),n=(e=require("@contentful/forma-36-tokens"))&&"object"==typeof e&&"default"in e?e.default:e,l=i.css({display:"flex",justifyContent:"space-between",fontSize:n.fontSizeM,marginTop:n.spacingXs,color:n.gray700}),o=i.css({direction:"rtl"});function s(e){var i=e.field,n=e.locales,s=e.isInitiallyDisabled,c=e.withCharValidation,d=a.ConstraintsUtils.fromFieldValidations(i.validations,i.type),u=a.ConstraintsUtils.makeChecker(d),f=n.direction[i.locale]||"ltr";return t.createElement(a.FieldConnector,{field:i,isInitiallyDisabled:s},(function(e){var n=e.value,s=e.setValue;return t.createElement("div",{"data-test-id":"multiple-line-editor"},t.createElement(r.Textarea,{className:"rtl"===f?o:"",rows:3,required:i.required,error:e.errors.length>0,disabled:e.disabled,value:n||"",onChange:function(e){s(e.target.value)}}),c&&t.createElement("div",{className:l},t.createElement(a.CharCounter,{value:n||"",checkConstraint:u}),t.createElement(a.CharValidation,{constraints:d})),!c&&t.createElement("div",{className:l},t.createElement(a.CharCounter,{value:n||"",checkConstraint:function(){return!0}})))}))}s.defaultProps={isInitiallyDisabled:!0,withCharValidation:!0},exports.MultipleLineEditor=s;
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/forma-36-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 { Textarea } from '@contentful/forma-36-react-components';\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\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 required={field.required}\n error={errors.length > 0}\n disabled={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","required","error","errors","length","disabled","onChange","e","target","CharCounter","CharValidation","defaultProps"],"mappings":"8SAGaA,EAAgBC,MAAI,CAC/BC,QAAS,OACTC,eAAgB,gBAChBC,SAAUC,EAAOC,UACjBC,UAAWF,EAAOG,UAClBC,MAAOJ,EAAOK,UAGHC,EAAcV,MAAI,CAC7BW,UAAW,iBCsBGC,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,SAAUpB,EAAMoB,SAChBC,QAPJC,OAOkBC,OAAS,EACvBC,WARIA,SASJV,MAAOA,GAAS,GAChBW,SAAU,SAACC,GACTX,EAASW,EAAEC,OAAOb,UAGrBX,GACCS,uBAAKK,UAAWC,GACdN,gBAACgB,eAAYd,MAAOA,GAAS,GAAIL,gBAAiBA,IAClDG,gBAACiB,kBAAezB,YAAaA,MAG/BD,GACAS,uBAAKK,UAAWC,GACdN,gBAACgB,eAAYd,MAAOA,GAAS,GAAIL,gBAAiB,kBAAM,UAUxEX,EAAmBgC,aAAe,CAChC5B,qBAAqB,EACrBC,oBAAoB"}
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/forma-36-tokens';
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
- required: field.required,
40
- error: errors.length > 0,
41
- disabled: disabled,
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/forma-36-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 { Textarea } from '@contentful/forma-36-react-components';\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\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 required={field.required}\n error={errors.length > 0}\n disabled={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","required","error","length","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;;SCuBSC,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,CAApB;AAIA,MAAMC,eAAe,GAAGJ,gBAAgB,CAACK,WAAjB,CAA6BN,WAA7B,CAAxB;AACA,MAAMP,SAAS,GAAGI,OAAO,CAACJ,SAAR,CAAkBG,KAAK,CAACW,MAAxB,KAAmC,KAArD;AAEA,SACEC,aAAA,CAACC,cAAD;AAAwBb,IA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ultipleLineEditor.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,CAApB;AAIA,MAAMC,eAAe,GAAGJ,gBAAgB,CAACK,WAAjB,CAA6BN,WAA7B,CAAxB;AACA,MAAMP,SAAS,GAAGI,OAAO,CAACJ,SAAR,CAAkBG,KAAK,CAACW,MAAxB,KAAmC,KAArD;AAEA,SACEC,aAAA,CAACC,cAAD;AAAwBb,IAAAA,K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-line",
3
- "version": "0.15.1",
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/field-editor-shared": "^0.25.1",
25
- "@contentful/forma-36-react-components": "^3.93.4",
26
- "@contentful/forma-36-tokens": "^0.11.0",
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.18.1"
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": "422234c47b3637970eea4501d095d2914c88b855"
47
+ "gitHead": "f86ba28db3f34cffc0dc2580bf21297542f331c9"
48
48
  }