@contentful/field-editor-list 0.15.6 → 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,194 +3,112 @@
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.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.15.5...@contentful/field-editor-list@0.15.6) (2021-10-14)
7
-
8
- **Note:** Version bump only for package @contentful/field-editor-list
6
+ # [0.16.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.15.6...@contentful/field-editor-list@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.15.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.15.4...@contentful/field-editor-list@0.15.5) (2021-10-06)
16
+ ## [0.15.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.15.5...@contentful/field-editor-list@0.15.6) (2021-10-14)
15
17
 
16
18
  **Note:** Version bump only for package @contentful/field-editor-list
17
19
 
20
+ ## [0.15.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.15.4...@contentful/field-editor-list@0.15.5) (2021-10-06)
18
21
 
19
-
20
-
22
+ **Note:** Version bump only for package @contentful/field-editor-list
21
23
 
22
24
  ## [0.15.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.15.3...@contentful/field-editor-list@0.15.4) (2021-09-17)
23
25
 
24
26
  **Note:** Version bump only for package @contentful/field-editor-list
25
27
 
26
-
27
-
28
-
29
-
30
28
  ## [0.15.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.15.2...@contentful/field-editor-list@0.15.3) (2021-09-16)
31
29
 
32
30
  **Note:** Version bump only for package @contentful/field-editor-list
33
31
 
34
-
35
-
36
-
37
-
38
32
  ## [0.15.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.15.1...@contentful/field-editor-list@0.15.2) (2021-08-19)
39
33
 
40
34
  **Note:** Version bump only for package @contentful/field-editor-list
41
35
 
42
-
43
-
44
-
45
-
46
36
  ## [0.15.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.15.0...@contentful/field-editor-list@0.15.1) (2021-07-29)
47
37
 
48
38
  **Note:** Version bump only for package @contentful/field-editor-list
49
39
 
50
-
51
-
52
-
53
-
54
40
  # [0.15.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.14.6...@contentful/field-editor-list@0.15.0) (2021-07-23)
55
41
 
56
-
57
42
  ### Features
58
43
 
59
- * 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
60
-
61
-
62
-
63
-
44
+ - 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
64
45
 
65
46
  ## [0.14.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.14.3...@contentful/field-editor-list@0.14.6) (2021-07-06)
66
47
 
67
48
  **Note:** Version bump only for package @contentful/field-editor-list
68
49
 
69
-
70
-
71
-
72
-
73
50
  ## [0.14.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.14.3...@contentful/field-editor-list@0.14.5) (2021-07-06)
74
51
 
75
52
  **Note:** Version bump only for package @contentful/field-editor-list
76
53
 
77
-
78
-
79
-
80
-
81
54
  ## [0.14.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.14.3...@contentful/field-editor-list@0.14.4) (2021-06-23)
82
55
 
83
56
  **Note:** Version bump only for package @contentful/field-editor-list
84
57
 
85
-
86
-
87
-
88
-
89
58
  ## [0.14.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.14.2...@contentful/field-editor-list@0.14.3) (2021-06-23)
90
59
 
91
60
  **Note:** Version bump only for package @contentful/field-editor-list
92
61
 
93
-
94
-
95
-
96
-
97
62
  ## [0.14.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.14.1...@contentful/field-editor-list@0.14.2) (2021-06-22)
98
63
 
99
64
  **Note:** Version bump only for package @contentful/field-editor-list
100
65
 
101
-
102
-
103
-
104
-
105
66
  ## [0.14.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.14.0...@contentful/field-editor-list@0.14.1) (2021-03-05)
106
67
 
107
68
  **Note:** Version bump only for package @contentful/field-editor-list
108
69
 
109
-
110
-
111
-
112
-
113
70
  # [0.14.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.13.2...@contentful/field-editor-list@0.14.0) (2021-02-19)
114
71
 
115
-
116
72
  ### Features
117
73
 
118
- * bump min version of forma-36 ([#606](https://github.com/contentful/field-editors/issues/606)) ([fd57c7a](https://github.com/contentful/field-editors/commit/fd57c7a4312766af38c01507f17706ab22992617))
119
-
120
-
121
-
122
-
74
+ - bump min version of forma-36 ([#606](https://github.com/contentful/field-editors/issues/606)) ([fd57c7a](https://github.com/contentful/field-editors/commit/fd57c7a4312766af38c01507f17706ab22992617))
123
75
 
124
76
  ## [0.13.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.13.1...@contentful/field-editor-list@0.13.2) (2021-02-09)
125
77
 
126
78
  **Note:** Version bump only for package @contentful/field-editor-list
127
79
 
128
-
129
-
130
-
131
-
132
80
  ## [0.13.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.13.0...@contentful/field-editor-list@0.13.1) (2021-02-01)
133
81
 
134
82
  **Note:** Version bump only for package @contentful/field-editor-list
135
83
 
136
-
137
-
138
-
139
-
140
84
  # [0.13.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.12.0...@contentful/field-editor-list@0.13.0) (2021-01-20)
141
85
 
142
-
143
86
  ### Features
144
87
 
145
- * 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))
146
-
147
-
148
-
149
-
88
+ - 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))
150
89
 
151
90
  # [0.12.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.11.5...@contentful/field-editor-list@0.12.0) (2021-01-12)
152
91
 
153
-
154
92
  ### Features
155
93
 
156
- * 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))
157
-
158
-
159
-
160
-
94
+ - 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))
161
95
 
162
96
  ## [0.11.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.11.4...@contentful/field-editor-list@0.11.5) (2020-12-16)
163
97
 
164
98
  **Note:** Version bump only for package @contentful/field-editor-list
165
99
 
166
-
167
-
168
-
169
-
170
100
  ## [0.11.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.11.3...@contentful/field-editor-list@0.11.4) (2020-11-06)
171
101
 
172
102
  **Note:** Version bump only for package @contentful/field-editor-list
173
103
 
174
-
175
-
176
-
177
-
178
104
  ## [0.11.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.11.2...@contentful/field-editor-list@0.11.3) (2020-11-06)
179
105
 
180
106
  **Note:** Version bump only for package @contentful/field-editor-list
181
107
 
182
-
183
-
184
-
185
-
186
108
  ## [0.11.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.11.1...@contentful/field-editor-list@0.11.2) (2020-10-28)
187
109
 
188
110
  **Note:** Version bump only for package @contentful/field-editor-list
189
111
 
190
-
191
-
192
-
193
-
194
112
  ## [0.11.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.11.0...@contentful/field-editor-list@0.11.1) (2020-08-24)
195
113
 
196
114
  **Note:** Version bump only for package @contentful/field-editor-list
package/README.md CHANGED
@@ -7,6 +7,5 @@ npm install @contentful/field-editor-list
7
7
  This package contains a React `ListEditor` component that is used as a default for the `Symbol / List` 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 { ListEditor } from '@contentful/field-editor-list';
12
11
  ```
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var fieldEditorShared = require('@contentful/field-editor-shared');
7
- var forma36ReactComponents = require('@contentful/forma-36-react-components');
8
7
  var emotion = require('emotion');
8
+ var f36Components = require('@contentful/f36-components');
9
9
 
10
10
  var rightToLeft = /*#__PURE__*/emotion.css({
11
11
  direction: 'rtl'
@@ -40,12 +40,12 @@ function ListEditor(props) {
40
40
  setValue(valueAsArray);
41
41
  };
42
42
 
43
- return React.createElement(forma36ReactComponents.TextInput, {
43
+ return React.createElement(f36Components.TextInput, {
44
44
  testId: "list-editor-input",
45
45
  className: direction === 'rtl' ? rightToLeft : '',
46
- required: field.required,
47
- error: errors.length > 0,
48
- disabled: disabled,
46
+ isRequired: field.required,
47
+ isInvalid: errors.length > 0,
48
+ isDisabled: disabled,
49
49
  value: valueAsString,
50
50
  onChange: onChange
51
51
  });
@@ -1 +1 @@
1
- {"version":3,"file":"field-editor-list.cjs.development.js","sources":["../src/styles.ts","../src/ListEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\n\nexport const rightToLeft = css({\n direction: 'rtl'\n});\n","import * as React from 'react';\nimport { FieldAPI, LocalesAPI, FieldConnector } from '@contentful/field-editor-shared';\nimport { TextInput } from '@contentful/forma-36-react-components';\nimport * as styles from './styles';\n\nexport interface ListEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\ntype ListValue = string[];\n\nfunction isEmptyListValue(value: ListValue | null) {\n return value === null || value.length === 0;\n}\n\nexport function ListEditor(props: ListEditorProps) {\n const { field, locales } = props;\n\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<ListValue>\n throttle={0}\n isEmptyValue={isEmptyListValue}\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ setValue, value, errors, disabled }) => {\n const valueAsString = (value || []).join(', ');\n\n const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const valueAsArray = e.target.value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item);\n setValue(valueAsArray);\n };\n\n return (\n <TextInput\n testId=\"list-editor-input\"\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n required={field.required}\n error={errors.length > 0}\n disabled={disabled}\n value={valueAsString}\n onChange={onChange}\n />\n );\n }}\n </FieldConnector>\n );\n}\n\nListEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["rightToLeft","css","direction","isEmptyListValue","value","length","ListEditor","props","field","locales","locale","React","FieldConnector","throttle","isEmptyValue","isInitiallyDisabled","setValue","errors","disabled","valueAsString","join","onChange","e","valueAsArray","target","split","map","item","trim","filter","TextInput","testId","className","styles","required","error","defaultProps"],"mappings":";;;;;;;;;AAEO,IAAMA,WAAW,gBAAGC,WAAG,CAAC;AAC7BC,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;;ACsBP,SAASC,gBAAT,CAA0BC,KAA1B;AACE,SAAOA,KAAK,KAAK,IAAV,IAAkBA,KAAK,CAACC,MAAN,KAAiB,CAA1C;AACD;;AAED,SAAgBC,WAAWC;AACzB,MAAQC,KAAR,GAA2BD,KAA3B,CAAQC,KAAR;AAAA,MAAeC,OAAf,GAA2BF,KAA3B,CAAeE,OAAf;AAEA,MAAMP,SAAS,GAAGO,OAAO,CAACP,SAAR,CAAkBM,KAAK,CAACE,MAAxB,KAAmC,KAArD;AAEA,SACEC,mBAAA,CAACC,gCAAD;AACEC,IAAAA,QAAQ,EAAE;AACVC,IAAAA,YAAY,EAAEX;AACdK,IAAAA,KAAK,EAAEA;AACPO,IAAAA,mBAAmB,EAAER,KAAK,CAACQ;GAJ7B,EAKG;QAAGC,gBAAAA;QAAUZ,aAAAA;QAAOa,cAAAA;QAAQC,gBAAAA;AAC3B,QAAMC,aAAa,GAAG,CAACf,KAAK,IAAI,EAAV,EAAcgB,IAAd,CAAmB,IAAnB,CAAtB;;AAEA,QAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,CAAD;AACf,UAAMC,YAAY,GAAGD,CAAC,CAACE,MAAF,CAASpB,KAAT,CAClBqB,KADkB,CACZ,GADY,EAElBC,GAFkB,CAEd,UAACC,IAAD;AAAA,eAAUA,IAAI,CAACC,IAAL,EAAV;AAAA,OAFc,EAGlBC,MAHkB,CAGX,UAACF,IAAD;AAAA,eAAUA,IAAV;AAAA,OAHW,CAArB;AAIAX,MAAAA,QAAQ,CAACO,YAAD,CAAR;AACD,KAND;;AAQA,WACEZ,mBAAA,CAACmB,gCAAD;AACEC,MAAAA,MAAM,EAAC;AACPC,MAAAA,SAAS,EAAE9B,SAAS,KAAK,KAAd,GAAsB+B,WAAtB,GAA2C;AACtDC,MAAAA,QAAQ,EAAE1B,KAAK,CAAC0B;AAChBC,MAAAA,KAAK,EAAElB,MAAM,CAACZ,MAAP,GAAgB;AACvBa,MAAAA,QAAQ,EAAEA;AACVd,MAAAA,KAAK,EAAEe;AACPE,MAAAA,QAAQ,EAAEA;KAPZ,CADF;AAWD,GA3BH,CADF;AA+BD;AAEDf,UAAU,CAAC8B,YAAX,GAA0B;AACxBrB,EAAAA,mBAAmB,EAAE;AADG,CAA1B;;;;"}
1
+ {"version":3,"file":"field-editor-list.cjs.development.js","sources":["../src/styles.ts","../src/ListEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n","import * as React from 'react';\nimport { FieldAPI, LocalesAPI, FieldConnector } from '@contentful/field-editor-shared';\nimport * as styles from './styles';\n\nimport { TextInput } from '@contentful/f36-components';\n\nexport interface ListEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\ntype ListValue = string[];\n\nfunction isEmptyListValue(value: ListValue | null) {\n return value === null || value.length === 0;\n}\n\nexport function ListEditor(props: ListEditorProps) {\n const { field, locales } = props;\n\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<ListValue>\n throttle={0}\n isEmptyValue={isEmptyListValue}\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ setValue, value, errors, disabled }) => {\n const valueAsString = (value || []).join(', ');\n\n const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const valueAsArray = e.target.value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item);\n setValue(valueAsArray);\n };\n\n return (\n <TextInput\n testId=\"list-editor-input\"\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n isRequired={field.required}\n isInvalid={errors.length > 0}\n isDisabled={disabled}\n value={valueAsString}\n onChange={onChange}\n />\n );\n }}\n </FieldConnector>\n );\n}\n\nListEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["rightToLeft","css","direction","isEmptyListValue","value","length","ListEditor","props","field","locales","locale","React","FieldConnector","throttle","isEmptyValue","isInitiallyDisabled","setValue","errors","disabled","valueAsString","join","onChange","e","valueAsArray","target","split","map","item","trim","filter","TextInput","testId","className","styles","isRequired","required","isInvalid","isDisabled","defaultProps"],"mappings":";;;;;;;;;AAEO,IAAMA,WAAW,gBAAGC,WAAG,CAAC;AAC7BC,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;;ACuBP,SAASC,gBAAT,CAA0BC,KAA1B;AACE,SAAOA,KAAK,KAAK,IAAV,IAAkBA,KAAK,CAACC,MAAN,KAAiB,CAA1C;AACD;;AAED,SAAgBC,WAAWC;AACzB,MAAQC,KAAR,GAA2BD,KAA3B,CAAQC,KAAR;AAAA,MAAeC,OAAf,GAA2BF,KAA3B,CAAeE,OAAf;AAEA,MAAMP,SAAS,GAAGO,OAAO,CAACP,SAAR,CAAkBM,KAAK,CAACE,MAAxB,KAAmC,KAArD;AAEA,SACEC,mBAAA,CAACC,gCAAD;AACEC,IAAAA,QAAQ,EAAE;AACVC,IAAAA,YAAY,EAAEX;AACdK,IAAAA,KAAK,EAAEA;AACPO,IAAAA,mBAAmB,EAAER,KAAK,CAACQ;GAJ7B,EAKG;QAAGC,gBAAAA;QAAUZ,aAAAA;QAAOa,cAAAA;QAAQC,gBAAAA;AAC3B,QAAMC,aAAa,GAAG,CAACf,KAAK,IAAI,EAAV,EAAcgB,IAAd,CAAmB,IAAnB,CAAtB;;AAEA,QAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,CAAD;AACf,UAAMC,YAAY,GAAGD,CAAC,CAACE,MAAF,CAASpB,KAAT,CAClBqB,KADkB,CACZ,GADY,EAElBC,GAFkB,CAEd,UAACC,IAAD;AAAA,eAAUA,IAAI,CAACC,IAAL,EAAV;AAAA,OAFc,EAGlBC,MAHkB,CAGX,UAACF,IAAD;AAAA,eAAUA,IAAV;AAAA,OAHW,CAArB;AAIAX,MAAAA,QAAQ,CAACO,YAAD,CAAR;AACD,KAND;;AAQA,WACEZ,mBAAA,CAACmB,uBAAD;AACEC,MAAAA,MAAM,EAAC;AACPC,MAAAA,SAAS,EAAE9B,SAAS,KAAK,KAAd,GAAsB+B,WAAtB,GAA2C;AACtDC,MAAAA,UAAU,EAAE1B,KAAK,CAAC2B;AAClBC,MAAAA,SAAS,EAAEnB,MAAM,CAACZ,MAAP,GAAgB;AAC3BgC,MAAAA,UAAU,EAAEnB;AACZd,MAAAA,KAAK,EAAEe;AACPE,MAAAA,QAAQ,EAAEA;KAPZ,CADF;AAWD,GA3BH,CADF;AA+BD;AAEDf,UAAU,CAACgC,YAAX,GAA0B;AACxBvB,EAAAA,mBAAmB,EAAE;AADG,CAA1B;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@contentful/field-editor-shared"),r=require("@contentful/forma-36-react-components"),i=require("emotion").css({direction:"rtl"});function l(e){return null===e||0===e.length}function n(n){var a=n.field,o=n.locales.direction[a.locale]||"ltr";return e.createElement(t.FieldConnector,{throttle:0,isEmptyValue:l,field:a,isInitiallyDisabled:n.isInitiallyDisabled},(function(t){var l=t.setValue,n=t.errors,u=t.disabled,s=(t.value||[]).join(", ");return e.createElement(r.TextInput,{testId:"list-editor-input",className:"rtl"===o?i:"",required:a.required,error:n.length>0,disabled:u,value:s,onChange:function(e){var t=e.target.value.split(",").map((function(e){return e.trim()})).filter((function(e){return e}));l(t)}})}))}n.defaultProps={isInitiallyDisabled:!0},exports.ListEditor=n;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@contentful/field-editor-shared"),i=require("emotion"),r=require("@contentful/f36-components"),l=i.css({direction:"rtl"});function n(e){return null===e||0===e.length}function a(i){var a=i.field,s=i.locales.direction[a.locale]||"ltr";return e.createElement(t.FieldConnector,{throttle:0,isEmptyValue:n,field:a,isInitiallyDisabled:i.isInitiallyDisabled},(function(t){var i=t.setValue,n=t.errors,u=t.disabled,o=(t.value||[]).join(", ");return e.createElement(r.TextInput,{testId:"list-editor-input",className:"rtl"===s?l:"",isRequired:a.required,isInvalid:n.length>0,isDisabled:u,value:o,onChange:function(e){var t=e.target.value.split(",").map((function(e){return e.trim()})).filter((function(e){return e}));i(t)}})}))}a.defaultProps={isInitiallyDisabled:!0},exports.ListEditor=a;
2
2
  //# sourceMappingURL=field-editor-list.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-editor-list.cjs.production.min.js","sources":["../src/styles.ts","../src/ListEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\n\nexport const rightToLeft = css({\n direction: 'rtl'\n});\n","import * as React from 'react';\nimport { FieldAPI, LocalesAPI, FieldConnector } from '@contentful/field-editor-shared';\nimport { TextInput } from '@contentful/forma-36-react-components';\nimport * as styles from './styles';\n\nexport interface ListEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\ntype ListValue = string[];\n\nfunction isEmptyListValue(value: ListValue | null) {\n return value === null || value.length === 0;\n}\n\nexport function ListEditor(props: ListEditorProps) {\n const { field, locales } = props;\n\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<ListValue>\n throttle={0}\n isEmptyValue={isEmptyListValue}\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ setValue, value, errors, disabled }) => {\n const valueAsString = (value || []).join(', ');\n\n const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const valueAsArray = e.target.value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item);\n setValue(valueAsArray);\n };\n\n return (\n <TextInput\n testId=\"list-editor-input\"\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n required={field.required}\n error={errors.length > 0}\n disabled={disabled}\n value={valueAsString}\n onChange={onChange}\n />\n );\n }}\n </FieldConnector>\n );\n}\n\nListEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["rightToLeft","direction","isEmptyListValue","value","length","ListEditor","props","field","locales","locale","React","FieldConnector","throttle","isEmptyValue","isInitiallyDisabled","setValue","errors","disabled","valueAsString","join","TextInput","testId","className","styles","required","error","onChange","e","valueAsArray","target","split","map","item","trim","filter","defaultProps"],"mappings":"2LAEaA,yBAAkB,CAC7BC,UAAW,QCqBb,SAASC,EAAiBC,UACP,OAAVA,GAAmC,IAAjBA,EAAMC,gBAGjBC,EAAWC,OACjBC,EAAmBD,EAAnBC,MAEFN,EAFqBK,EAAZE,QAEWP,UAAUM,EAAME,SAAW,aAGnDC,gBAACC,kBACCC,SAAU,EACVC,aAAcX,EACdK,MAAOA,EACPO,oBAAqBR,EAAMQ,sBAC1B,gBAAGC,IAAAA,SAAiBC,IAAAA,OAAQC,IAAAA,SACrBC,KADMf,OACoB,IAAIgB,KAAK,aAWvCT,gBAACU,aACCC,OAAO,oBACPC,UAAyB,QAAdrB,EAAsBsB,EAAqB,GACtDC,SAAUjB,EAAMiB,SAChBC,MAAOT,EAAOZ,OAAS,EACvBa,SAAUA,EACVd,MAAOe,EACPQ,SAhBa,SAACC,OACVC,EAAeD,EAAEE,OAAO1B,MAC3B2B,MAAM,KACNC,KAAI,SAACC,UAASA,EAAKC,UACnBC,QAAO,SAACF,UAASA,KACpBjB,EAASa,SAmBnBvB,EAAW8B,aAAe,CACxBrB,qBAAqB"}
1
+ {"version":3,"file":"field-editor-list.cjs.production.min.js","sources":["../src/styles.ts","../src/ListEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n","import * as React from 'react';\nimport { FieldAPI, LocalesAPI, FieldConnector } from '@contentful/field-editor-shared';\nimport * as styles from './styles';\n\nimport { TextInput } from '@contentful/f36-components';\n\nexport interface ListEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\ntype ListValue = string[];\n\nfunction isEmptyListValue(value: ListValue | null) {\n return value === null || value.length === 0;\n}\n\nexport function ListEditor(props: ListEditorProps) {\n const { field, locales } = props;\n\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<ListValue>\n throttle={0}\n isEmptyValue={isEmptyListValue}\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ setValue, value, errors, disabled }) => {\n const valueAsString = (value || []).join(', ');\n\n const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const valueAsArray = e.target.value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item);\n setValue(valueAsArray);\n };\n\n return (\n <TextInput\n testId=\"list-editor-input\"\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n isRequired={field.required}\n isInvalid={errors.length > 0}\n isDisabled={disabled}\n value={valueAsString}\n onChange={onChange}\n />\n );\n }}\n </FieldConnector>\n );\n}\n\nListEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["rightToLeft","css","direction","isEmptyListValue","value","length","ListEditor","props","field","locales","locale","React","FieldConnector","throttle","isEmptyValue","isInitiallyDisabled","setValue","errors","disabled","valueAsString","join","TextInput","testId","className","styles","isRequired","required","isInvalid","isDisabled","onChange","e","valueAsArray","target","split","map","item","trim","filter","defaultProps"],"mappings":"qMAEaA,EAAcC,MAAI,CAC7BC,UAAW,QCsBb,SAASC,EAAiBC,UACP,OAAVA,GAAmC,IAAjBA,EAAMC,gBAGjBC,EAAWC,OACjBC,EAAmBD,EAAnBC,MAEFN,EAFqBK,EAAZE,QAEWP,UAAUM,EAAME,SAAW,aAGnDC,gBAACC,kBACCC,SAAU,EACVC,aAAcX,EACdK,MAAOA,EACPO,oBAAqBR,EAAMQ,sBAC1B,gBAAGC,IAAAA,SAAiBC,IAAAA,OAAQC,IAAAA,SACrBC,KADMf,OACoB,IAAIgB,KAAK,aAWvCT,gBAACU,aACCC,OAAO,oBACPC,UAAyB,QAAdrB,EAAsBsB,EAAqB,GACtDC,WAAYjB,EAAMkB,SAClBC,UAAWV,EAAOZ,OAAS,EAC3BuB,WAAYV,EACZd,MAAOe,EACPU,SAhBa,SAACC,OACVC,EAAeD,EAAEE,OAAO5B,MAC3B6B,MAAM,KACNC,KAAI,SAACC,UAASA,EAAKC,UACnBC,QAAO,SAACF,UAASA,KACpBnB,EAASe,SAmBnBzB,EAAWgC,aAAe,CACxBvB,qBAAqB"}
@@ -1,7 +1,7 @@
1
1
  import { createElement } from 'react';
2
2
  import { FieldConnector } from '@contentful/field-editor-shared';
3
- import { TextInput } from '@contentful/forma-36-react-components';
4
3
  import { css } from 'emotion';
4
+ import { TextInput } from '@contentful/f36-components';
5
5
 
6
6
  var rightToLeft = /*#__PURE__*/css({
7
7
  direction: 'rtl'
@@ -39,9 +39,9 @@ function ListEditor(props) {
39
39
  return createElement(TextInput, {
40
40
  testId: "list-editor-input",
41
41
  className: direction === 'rtl' ? rightToLeft : '',
42
- required: field.required,
43
- error: errors.length > 0,
44
- disabled: disabled,
42
+ isRequired: field.required,
43
+ isInvalid: errors.length > 0,
44
+ isDisabled: disabled,
45
45
  value: valueAsString,
46
46
  onChange: onChange
47
47
  });
@@ -1 +1 @@
1
- {"version":3,"file":"field-editor-list.esm.js","sources":["../src/styles.ts","../src/ListEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\n\nexport const rightToLeft = css({\n direction: 'rtl'\n});\n","import * as React from 'react';\nimport { FieldAPI, LocalesAPI, FieldConnector } from '@contentful/field-editor-shared';\nimport { TextInput } from '@contentful/forma-36-react-components';\nimport * as styles from './styles';\n\nexport interface ListEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\ntype ListValue = string[];\n\nfunction isEmptyListValue(value: ListValue | null) {\n return value === null || value.length === 0;\n}\n\nexport function ListEditor(props: ListEditorProps) {\n const { field, locales } = props;\n\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<ListValue>\n throttle={0}\n isEmptyValue={isEmptyListValue}\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ setValue, value, errors, disabled }) => {\n const valueAsString = (value || []).join(', ');\n\n const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const valueAsArray = e.target.value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item);\n setValue(valueAsArray);\n };\n\n return (\n <TextInput\n testId=\"list-editor-input\"\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n required={field.required}\n error={errors.length > 0}\n disabled={disabled}\n value={valueAsString}\n onChange={onChange}\n />\n );\n }}\n </FieldConnector>\n );\n}\n\nListEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["rightToLeft","css","direction","isEmptyListValue","value","length","ListEditor","props","field","locales","locale","React","FieldConnector","throttle","isEmptyValue","isInitiallyDisabled","setValue","errors","disabled","valueAsString","join","onChange","e","valueAsArray","target","split","map","item","trim","filter","TextInput","testId","className","styles","required","error","defaultProps"],"mappings":";;;;;AAEO,IAAMA,WAAW,gBAAGC,GAAG,CAAC;AAC7BC,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;;ACsBP,SAASC,gBAAT,CAA0BC,KAA1B;AACE,SAAOA,KAAK,KAAK,IAAV,IAAkBA,KAAK,CAACC,MAAN,KAAiB,CAA1C;AACD;;AAED,SAAgBC,WAAWC;AACzB,MAAQC,KAAR,GAA2BD,KAA3B,CAAQC,KAAR;AAAA,MAAeC,OAAf,GAA2BF,KAA3B,CAAeE,OAAf;AAEA,MAAMP,SAAS,GAAGO,OAAO,CAACP,SAAR,CAAkBM,KAAK,CAACE,MAAxB,KAAmC,KAArD;AAEA,SACEC,aAAA,CAACC,cAAD;AACEC,IAAAA,QAAQ,EAAE;AACVC,IAAAA,YAAY,EAAEX;AACdK,IAAAA,KAAK,EAAEA;AACPO,IAAAA,mBAAmB,EAAER,KAAK,CAACQ;GAJ7B,EAKG;QAAGC,gBAAAA;QAAUZ,aAAAA;QAAOa,cAAAA;QAAQC,gBAAAA;AAC3B,QAAMC,aAAa,GAAG,CAACf,KAAK,IAAI,EAAV,EAAcgB,IAAd,CAAmB,IAAnB,CAAtB;;AAEA,QAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,CAAD;AACf,UAAMC,YAAY,GAAGD,CAAC,CAACE,MAAF,CAASpB,KAAT,CAClBqB,KADkB,CACZ,GADY,EAElBC,GAFkB,CAEd,UAACC,IAAD;AAAA,eAAUA,IAAI,CAACC,IAAL,EAAV;AAAA,OAFc,EAGlBC,MAHkB,CAGX,UAACF,IAAD;AAAA,eAAUA,IAAV;AAAA,OAHW,CAArB;AAIAX,MAAAA,QAAQ,CAACO,YAAD,CAAR;AACD,KAND;;AAQA,WACEZ,aAAA,CAACmB,SAAD;AACEC,MAAAA,MAAM,EAAC;AACPC,MAAAA,SAAS,EAAE9B,SAAS,KAAK,KAAd,GAAsB+B,WAAtB,GAA2C;AACtDC,MAAAA,QAAQ,EAAE1B,KAAK,CAAC0B;AAChBC,MAAAA,KAAK,EAAElB,MAAM,CAACZ,MAAP,GAAgB;AACvBa,MAAAA,QAAQ,EAAEA;AACVd,MAAAA,KAAK,EAAEe;AACPE,MAAAA,QAAQ,EAAEA;KAPZ,CADF;AAWD,GA3BH,CADF;AA+BD;AAEDf,UAAU,CAAC8B,YAAX,GAA0B;AACxBrB,EAAAA,mBAAmB,EAAE;AADG,CAA1B;;;;"}
1
+ {"version":3,"file":"field-editor-list.esm.js","sources":["../src/styles.ts","../src/ListEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n","import * as React from 'react';\nimport { FieldAPI, LocalesAPI, FieldConnector } from '@contentful/field-editor-shared';\nimport * as styles from './styles';\n\nimport { TextInput } from '@contentful/f36-components';\n\nexport interface ListEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\ntype ListValue = string[];\n\nfunction isEmptyListValue(value: ListValue | null) {\n return value === null || value.length === 0;\n}\n\nexport function ListEditor(props: ListEditorProps) {\n const { field, locales } = props;\n\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<ListValue>\n throttle={0}\n isEmptyValue={isEmptyListValue}\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ setValue, value, errors, disabled }) => {\n const valueAsString = (value || []).join(', ');\n\n const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const valueAsArray = e.target.value\n .split(',')\n .map((item) => item.trim())\n .filter((item) => item);\n setValue(valueAsArray);\n };\n\n return (\n <TextInput\n testId=\"list-editor-input\"\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n isRequired={field.required}\n isInvalid={errors.length > 0}\n isDisabled={disabled}\n value={valueAsString}\n onChange={onChange}\n />\n );\n }}\n </FieldConnector>\n );\n}\n\nListEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["rightToLeft","css","direction","isEmptyListValue","value","length","ListEditor","props","field","locales","locale","React","FieldConnector","throttle","isEmptyValue","isInitiallyDisabled","setValue","errors","disabled","valueAsString","join","onChange","e","valueAsArray","target","split","map","item","trim","filter","TextInput","testId","className","styles","isRequired","required","isInvalid","isDisabled","defaultProps"],"mappings":";;;;;AAEO,IAAMA,WAAW,gBAAGC,GAAG,CAAC;AAC7BC,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;;ACuBP,SAASC,gBAAT,CAA0BC,KAA1B;AACE,SAAOA,KAAK,KAAK,IAAV,IAAkBA,KAAK,CAACC,MAAN,KAAiB,CAA1C;AACD;;AAED,SAAgBC,WAAWC;AACzB,MAAQC,KAAR,GAA2BD,KAA3B,CAAQC,KAAR;AAAA,MAAeC,OAAf,GAA2BF,KAA3B,CAAeE,OAAf;AAEA,MAAMP,SAAS,GAAGO,OAAO,CAACP,SAAR,CAAkBM,KAAK,CAACE,MAAxB,KAAmC,KAArD;AAEA,SACEC,aAAA,CAACC,cAAD;AACEC,IAAAA,QAAQ,EAAE;AACVC,IAAAA,YAAY,EAAEX;AACdK,IAAAA,KAAK,EAAEA;AACPO,IAAAA,mBAAmB,EAAER,KAAK,CAACQ;GAJ7B,EAKG;QAAGC,gBAAAA;QAAUZ,aAAAA;QAAOa,cAAAA;QAAQC,gBAAAA;AAC3B,QAAMC,aAAa,GAAG,CAACf,KAAK,IAAI,EAAV,EAAcgB,IAAd,CAAmB,IAAnB,CAAtB;;AAEA,QAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,CAAD;AACf,UAAMC,YAAY,GAAGD,CAAC,CAACE,MAAF,CAASpB,KAAT,CAClBqB,KADkB,CACZ,GADY,EAElBC,GAFkB,CAEd,UAACC,IAAD;AAAA,eAAUA,IAAI,CAACC,IAAL,EAAV;AAAA,OAFc,EAGlBC,MAHkB,CAGX,UAACF,IAAD;AAAA,eAAUA,IAAV;AAAA,OAHW,CAArB;AAIAX,MAAAA,QAAQ,CAACO,YAAD,CAAR;AACD,KAND;;AAQA,WACEZ,aAAA,CAACmB,SAAD;AACEC,MAAAA,MAAM,EAAC;AACPC,MAAAA,SAAS,EAAE9B,SAAS,KAAK,KAAd,GAAsB+B,WAAtB,GAA2C;AACtDC,MAAAA,UAAU,EAAE1B,KAAK,CAAC2B;AAClBC,MAAAA,SAAS,EAAEnB,MAAM,CAACZ,MAAP,GAAgB;AAC3BgC,MAAAA,UAAU,EAAEnB;AACZd,MAAAA,KAAK,EAAEe;AACPE,MAAAA,QAAQ,EAAEA;KAPZ,CADF;AAWD,GA3BH,CADF;AA+BD;AAEDf,UAAU,CAACgC,YAAX,GAA0B;AACxBvB,EAAAA,mBAAmB,EAAE;AADG,CAA1B;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-list",
3
- "version": "0.15.6",
3
+ "version": "0.16.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/field-editor-list.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
  }