@contentful/field-editor-list 0.15.5 → 1.0.1

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,186 +3,122 @@
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.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)
6
+ ## [1.0.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@1.0.0...@contentful/field-editor-list@1.0.1) (2021-11-17)
7
7
 
8
- **Note:** Version bump only for package @contentful/field-editor-list
8
+ ### Bug Fixes
9
9
 
10
+ - **card-actions:** update forma 36 to fix card actions click issue ([#927](https://github.com/contentful/field-editors/issues/927)) ([3dfdef2](https://github.com/contentful/field-editors/commit/3dfdef2c2b0045f12ea94ddafca89a8e9f25e7d0))
10
11
 
12
+ # [1.0.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-list@0.16.0...@contentful/field-editor-list@1.0.0) (2021-11-04)
11
13
 
14
+ **Note:** Version bump only for package @contentful/field-editor-list
12
15
 
16
+ # [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)
13
17
 
14
- ## [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)
18
+ ### Features
15
19
 
16
- **Note:** Version bump only for package @contentful/field-editor-list
20
+ - Forma v4 components adoption ([#805](https://github.com/contentful/field-editors/issues/805)) ([526bde6](https://github.com/contentful/field-editors/commit/526bde6e10e0ee3789705ec10fb31489af7ca59e))
17
21
 
22
+ ### BREAKING CHANGES
18
23
 
24
+ - adopts a new Forma v4 beta
19
25
 
26
+ ## [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)
20
27
 
28
+ **Note:** Version bump only for package @contentful/field-editor-list
21
29
 
22
- ## [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)
30
+ ## [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)
23
31
 
24
32
  **Note:** Version bump only for package @contentful/field-editor-list
25
33
 
34
+ ## [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)
26
35
 
36
+ **Note:** Version bump only for package @contentful/field-editor-list
27
37
 
38
+ ## [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)
28
39
 
40
+ **Note:** Version bump only for package @contentful/field-editor-list
29
41
 
30
42
  ## [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)
31
43
 
32
44
  **Note:** Version bump only for package @contentful/field-editor-list
33
45
 
34
-
35
-
36
-
37
-
38
46
  ## [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)
39
47
 
40
48
  **Note:** Version bump only for package @contentful/field-editor-list
41
49
 
42
-
43
-
44
-
45
-
46
50
  # [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)
47
51
 
48
-
49
52
  ### Features
50
53
 
51
- * 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
52
-
53
-
54
-
55
-
54
+ - 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
56
55
 
57
56
  ## [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)
58
57
 
59
58
  **Note:** Version bump only for package @contentful/field-editor-list
60
59
 
61
-
62
-
63
-
64
-
65
60
  ## [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)
66
61
 
67
62
  **Note:** Version bump only for package @contentful/field-editor-list
68
63
 
69
-
70
-
71
-
72
-
73
64
  ## [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)
74
65
 
75
66
  **Note:** Version bump only for package @contentful/field-editor-list
76
67
 
77
-
78
-
79
-
80
-
81
68
  ## [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)
82
69
 
83
70
  **Note:** Version bump only for package @contentful/field-editor-list
84
71
 
85
-
86
-
87
-
88
-
89
72
  ## [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)
90
73
 
91
74
  **Note:** Version bump only for package @contentful/field-editor-list
92
75
 
93
-
94
-
95
-
96
-
97
76
  ## [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)
98
77
 
99
78
  **Note:** Version bump only for package @contentful/field-editor-list
100
79
 
101
-
102
-
103
-
104
-
105
80
  # [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)
106
81
 
107
-
108
82
  ### Features
109
83
 
110
- * bump min version of forma-36 ([#606](https://github.com/contentful/field-editors/issues/606)) ([fd57c7a](https://github.com/contentful/field-editors/commit/fd57c7a4312766af38c01507f17706ab22992617))
111
-
112
-
113
-
114
-
84
+ - bump min version of forma-36 ([#606](https://github.com/contentful/field-editors/issues/606)) ([fd57c7a](https://github.com/contentful/field-editors/commit/fd57c7a4312766af38c01507f17706ab22992617))
115
85
 
116
86
  ## [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)
117
87
 
118
88
  **Note:** Version bump only for package @contentful/field-editor-list
119
89
 
120
-
121
-
122
-
123
-
124
90
  ## [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)
125
91
 
126
92
  **Note:** Version bump only for package @contentful/field-editor-list
127
93
 
128
-
129
-
130
-
131
-
132
94
  # [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)
133
95
 
134
-
135
96
  ### Features
136
97
 
137
- * 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))
138
-
139
-
140
-
141
-
98
+ - 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))
142
99
 
143
100
  # [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)
144
101
 
145
-
146
102
  ### Features
147
103
 
148
- * 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))
149
-
150
-
151
-
152
-
104
+ - 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))
153
105
 
154
106
  ## [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)
155
107
 
156
108
  **Note:** Version bump only for package @contentful/field-editor-list
157
109
 
158
-
159
-
160
-
161
-
162
110
  ## [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)
163
111
 
164
112
  **Note:** Version bump only for package @contentful/field-editor-list
165
113
 
166
-
167
-
168
-
169
-
170
114
  ## [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)
171
115
 
172
116
  **Note:** Version bump only for package @contentful/field-editor-list
173
117
 
174
-
175
-
176
-
177
-
178
118
  ## [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)
179
119
 
180
120
  **Note:** Version bump only for package @contentful/field-editor-list
181
121
 
182
-
183
-
184
-
185
-
186
122
  ## [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)
187
123
 
188
124
  **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,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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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tDC,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.5",
3
+ "version": "1.0.1",
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.0",
25
- "@contentful/forma-36-react-components": "^3.93.4",
26
- "@contentful/forma-36-tokens": "^0.11.0",
24
+ "@contentful/f36-components": "^4.0.1-beta.2527",
25
+ "@contentful/f36-tokens": "^4.0.1-beta.2527",
26
+ "@contentful/field-editor-shared": "^1.0.1",
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.0"
32
+ "@contentful/field-editor-test-utils": "^1.0.1"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": ">=16.8.0"
@@ -44,5 +44,5 @@
44
44
  }
45
45
  }
46
46
  },
47
- "gitHead": "917572e21ded4ddb74828b2e1b2ce7bdc1c14fc8"
47
+ "gitHead": "3dc7130a751de690903c572edfcdfdf3587b57bf"
48
48
  }