@contentful/field-editor-multiple-line 1.3.9 → 1.3.11

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.
@@ -74,15 +74,18 @@ function MultipleLineEditor(props) {
74
74
  onChange: (e)=>{
75
75
  setValue(e.target.value);
76
76
  }
77
- }), _react.createElement("div", {
78
- className: _styles.validationRow(withCharValidation)
79
- }, _react.createElement(_fieldeditorshared.CharValidation, {
80
- constraints: constraints,
81
- enabled: withCharValidation
82
- }), _react.createElement(_fieldeditorshared.CharCounter, {
77
+ }), withCharValidation && _react.createElement("div", {
78
+ className: _styles.validationRow
79
+ }, _react.createElement(_fieldeditorshared.CharCounter, {
83
80
  value: value || '',
84
- checkConstraint: checkConstraint,
81
+ checkConstraint: checkConstraint
82
+ }), _react.createElement(_fieldeditorshared.CharValidation, {
85
83
  constraints: constraints
84
+ })), !withCharValidation && _react.createElement("div", {
85
+ className: _styles.validationRow
86
+ }, _react.createElement(_fieldeditorshared.CharCounter, {
87
+ value: value || '',
88
+ checkConstraint: ()=>true
86
89
  })));
87
90
  });
88
91
  }
@@ -66,7 +66,6 @@ describe('MultipleLineEditor', ()=>{
66
66
  const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
67
67
  return {
68
68
  ...field,
69
- type: 'Text',
70
69
  id: 'field-id',
71
70
  getValue: ()=>{
72
71
  return initialValue;
@@ -79,7 +78,6 @@ describe('MultipleLineEditor', ()=>{
79
78
  isInitiallyDisabled: false
80
79
  }));
81
80
  expect(getByTestId('cf-ui-textarea')).toHaveValue(initialValue);
82
- expect(getByTestId('cf-ui-char-counter')).toHaveTextContent(`${initialValue.length} / 50000`);
83
81
  });
84
82
  it('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
85
83
  const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
@@ -23,13 +23,13 @@ function _interop_require_default(obj) {
23
23
  default: obj
24
24
  };
25
25
  }
26
- const validationRow = (withValidation)=>(0, _emotion.css)({
27
- display: 'flex',
28
- justifyContent: withValidation ? 'space-between' : 'flex-end',
29
- fontSize: _f36tokens.default.fontSizeM,
30
- marginTop: _f36tokens.default.spacingXs,
31
- color: _f36tokens.default.gray500
32
- });
26
+ const validationRow = (0, _emotion.css)({
27
+ display: 'flex',
28
+ justifyContent: 'space-between',
29
+ fontSize: _f36tokens.default.fontSizeM,
30
+ marginTop: _f36tokens.default.spacingXs,
31
+ color: _f36tokens.default.gray700
32
+ });
33
33
  const rightToLeft = (0, _emotion.css)({
34
34
  direction: 'rtl'
35
35
  });
@@ -23,15 +23,18 @@ export function MultipleLineEditor(props) {
23
23
  onChange: (e)=>{
24
24
  setValue(e.target.value);
25
25
  }
26
- }), React.createElement("div", {
27
- className: styles.validationRow(withCharValidation)
28
- }, React.createElement(CharValidation, {
29
- constraints: constraints,
30
- enabled: withCharValidation
31
- }), React.createElement(CharCounter, {
26
+ }), withCharValidation && React.createElement("div", {
27
+ className: styles.validationRow
28
+ }, React.createElement(CharCounter, {
32
29
  value: value || '',
33
- checkConstraint: checkConstraint,
30
+ checkConstraint: checkConstraint
31
+ }), React.createElement(CharValidation, {
34
32
  constraints: constraints
33
+ })), !withCharValidation && React.createElement("div", {
34
+ className: styles.validationRow
35
+ }, React.createElement(CharCounter, {
36
+ value: value || '',
37
+ checkConstraint: ()=>true
35
38
  })));
36
39
  });
37
40
  }
@@ -21,7 +21,6 @@ describe('MultipleLineEditor', ()=>{
21
21
  const [field] = createFakeFieldAPI((field)=>{
22
22
  return {
23
23
  ...field,
24
- type: 'Text',
25
24
  id: 'field-id',
26
25
  getValue: ()=>{
27
26
  return initialValue;
@@ -34,7 +33,6 @@ describe('MultipleLineEditor', ()=>{
34
33
  isInitiallyDisabled: false
35
34
  }));
36
35
  expect(getByTestId('cf-ui-textarea')).toHaveValue(initialValue);
37
- expect(getByTestId('cf-ui-char-counter')).toHaveTextContent(`${initialValue.length} / 50000`);
38
36
  });
39
37
  it('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
40
38
  const [field] = createFakeFieldAPI((field)=>{
@@ -1,12 +1,12 @@
1
1
  import tokens from '@contentful/f36-tokens';
2
2
  import { css } from 'emotion';
3
- export const validationRow = (withValidation)=>css({
4
- display: 'flex',
5
- justifyContent: withValidation ? 'space-between' : 'flex-end',
6
- fontSize: tokens.fontSizeM,
7
- marginTop: tokens.spacingXs,
8
- color: tokens.gray500
9
- });
3
+ export const validationRow = css({
4
+ display: 'flex',
5
+ justifyContent: 'space-between',
6
+ fontSize: tokens.fontSizeM,
7
+ marginTop: tokens.spacingXs,
8
+ color: tokens.gray700
9
+ });
10
10
  export const rightToLeft = css({
11
11
  direction: 'rtl'
12
12
  });
@@ -1,2 +1,2 @@
1
- export declare const validationRow: (withValidation: boolean) => string;
1
+ export declare const validationRow: string;
2
2
  export declare const rightToLeft: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-multiple-line",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@contentful/f36-components": "^4.0.27",
39
39
  "@contentful/f36-tokens": "^4.0.0",
40
- "@contentful/field-editor-shared": "^1.4.7",
40
+ "@contentful/field-editor-shared": "^1.4.9",
41
41
  "emotion": "^10.0.17",
42
42
  "lodash": "^4.17.15"
43
43
  },
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "registry": "https://npm.pkg.github.com/"
52
52
  },
53
- "gitHead": "129510a558258ae7eb0c53e7845868048a465ca7"
53
+ "gitHead": "29cf5fb16a8d61f6c23678dad618c61aceec320d"
54
54
  }