@contentful/field-editor-list 0.15.3 → 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 +19 -77
- package/README.md +0 -1
- package/dist/field-editor-list.cjs.development.js +5 -5
- package/dist/field-editor-list.cjs.development.js.map +1 -1
- package/dist/field-editor-list.cjs.production.min.js +1 -1
- package/dist/field-editor-list.cjs.production.min.js.map +1 -1
- package/dist/field-editor-list.esm.js +4 -4
- package/dist/field-editor-list.esm.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,170 +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
|
-
|
|
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.
|
|
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
|
|
|
22
|
+
**Note:** Version bump only for package @contentful/field-editor-list
|
|
19
23
|
|
|
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)
|
|
20
25
|
|
|
26
|
+
**Note:** Version bump only for package @contentful/field-editor-list
|
|
21
27
|
|
|
22
|
-
## [0.15.
|
|
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)
|
|
23
29
|
|
|
24
30
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
25
31
|
|
|
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)
|
|
26
33
|
|
|
34
|
+
**Note:** Version bump only for package @contentful/field-editor-list
|
|
27
35
|
|
|
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)
|
|
28
37
|
|
|
38
|
+
**Note:** Version bump only for package @contentful/field-editor-list
|
|
29
39
|
|
|
30
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)
|
|
31
41
|
|
|
32
|
-
|
|
33
42
|
### Features
|
|
34
43
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
- 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
|
|
40
45
|
|
|
41
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)
|
|
42
47
|
|
|
43
48
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
44
49
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
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)
|
|
50
51
|
|
|
51
52
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
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)
|
|
58
55
|
|
|
59
56
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
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)
|
|
66
59
|
|
|
67
60
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
68
61
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
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)
|
|
74
63
|
|
|
75
64
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
76
65
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
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)
|
|
82
67
|
|
|
83
68
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
84
69
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
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)
|
|
90
71
|
|
|
91
|
-
|
|
92
72
|
### Features
|
|
93
73
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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))
|
|
99
75
|
|
|
100
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)
|
|
101
77
|
|
|
102
78
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
103
79
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
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)
|
|
109
81
|
|
|
110
82
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
111
83
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
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)
|
|
117
85
|
|
|
118
|
-
|
|
119
86
|
### Features
|
|
120
87
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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))
|
|
126
89
|
|
|
127
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)
|
|
128
91
|
|
|
129
|
-
|
|
130
92
|
### Features
|
|
131
93
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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))
|
|
137
95
|
|
|
138
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)
|
|
139
97
|
|
|
140
98
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
141
99
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
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)
|
|
147
101
|
|
|
148
102
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
149
103
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
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)
|
|
155
105
|
|
|
156
106
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
157
107
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
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)
|
|
163
109
|
|
|
164
110
|
**Note:** Version bump only for package @contentful/field-editor-list
|
|
165
111
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
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)
|
|
171
113
|
|
|
172
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(
|
|
43
|
+
return React.createElement(f36Components.TextInput, {
|
|
44
44
|
testId: "list-editor-input",
|
|
45
45
|
className: direction === 'rtl' ? rightToLeft : '',
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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'
|
|
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;A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__esModule",{value:!0});var e=require("react"),t=require("@contentful/field-editor-shared"),r=require("@contentful/
|
|
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'
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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'
|
|
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,O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
3
|
-
"version": "0.
|
|
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/
|
|
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
|
}
|