@contentful/field-editor-single-line 1.2.0 → 1.3.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.
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "SingleLineEditor", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return SingleLineEditor;
9
+ }
10
+ });
11
+ const _react = _interop_require_wildcard(require("react"));
12
+ const _f36components = require("@contentful/f36-components");
13
+ const _fieldeditorshared = require("@contentful/field-editor-shared");
14
+ const _styles = _interop_require_wildcard(require("./styles"));
15
+ function _getRequireWildcardCache(nodeInterop) {
16
+ if (typeof WeakMap !== "function") return null;
17
+ var cacheBabelInterop = new WeakMap();
18
+ var cacheNodeInterop = new WeakMap();
19
+ return (_getRequireWildcardCache = function(nodeInterop) {
20
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
21
+ })(nodeInterop);
22
+ }
23
+ function _interop_require_wildcard(obj, nodeInterop) {
24
+ if (!nodeInterop && obj && obj.__esModule) {
25
+ return obj;
26
+ }
27
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
28
+ return {
29
+ default: obj
30
+ };
31
+ }
32
+ var cache = _getRequireWildcardCache(nodeInterop);
33
+ if (cache && cache.has(obj)) {
34
+ return cache.get(obj);
35
+ }
36
+ var newObj = {};
37
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
38
+ for(var key in obj){
39
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
40
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
41
+ if (desc && (desc.get || desc.set)) {
42
+ Object.defineProperty(newObj, key, desc);
43
+ } else {
44
+ newObj[key] = obj[key];
45
+ }
46
+ }
47
+ }
48
+ newObj.default = obj;
49
+ if (cache) {
50
+ cache.set(obj, newObj);
51
+ }
52
+ return newObj;
53
+ }
54
+ function isSupportedFieldTypes(val) {
55
+ return val === 'Symbol' || val === 'Text';
56
+ }
57
+ function SingleLineEditor(props) {
58
+ const { field , locales } = props;
59
+ if (!isSupportedFieldTypes(field.type)) {
60
+ throw new Error(`"${field.type}" field type is not supported by SingleLineEditor`);
61
+ }
62
+ const constraints = _fieldeditorshared.ConstraintsUtils.fromFieldValidations(field.validations, field.type);
63
+ const checkConstraint = _fieldeditorshared.ConstraintsUtils.makeChecker(constraints);
64
+ const direction = locales.direction[field.locale] || 'ltr';
65
+ return _react.createElement(_fieldeditorshared.FieldConnector, {
66
+ field: field,
67
+ isInitiallyDisabled: props.isInitiallyDisabled,
68
+ isDisabled: props.isDisabled
69
+ }, ({ value , errors , disabled , setValue })=>{
70
+ return _react.createElement("div", {
71
+ "data-test-id": "single-line-editor"
72
+ }, _react.createElement(_f36components.TextInput, {
73
+ className: direction === 'rtl' ? _styles.rightToLeft : '',
74
+ isRequired: field.required,
75
+ isInvalid: errors.length > 0,
76
+ isDisabled: disabled,
77
+ value: value || '',
78
+ onChange: (e)=>{
79
+ setValue(e.target.value);
80
+ }
81
+ }), props.withCharValidation && _react.createElement("div", {
82
+ className: _styles.validationRow
83
+ }, _react.createElement(_fieldeditorshared.CharCounter, {
84
+ value: value || '',
85
+ checkConstraint: checkConstraint
86
+ }), _react.createElement(_fieldeditorshared.CharValidation, {
87
+ constraints: constraints
88
+ })), props.withCharValidation === false && _react.createElement("div", {
89
+ className: _styles.validationRow
90
+ }, _react.createElement(_fieldeditorshared.CharCounter, {
91
+ value: value || '',
92
+ checkConstraint: ()=>true
93
+ })));
94
+ });
95
+ }
96
+ SingleLineEditor.defaultProps = {
97
+ isInitiallyDisabled: true,
98
+ withCharValidation: true
99
+ };
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _react = _interop_require_wildcard(require("react"));
6
+ const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
7
+ const _react1 = require("@testing-library/react");
8
+ require("@testing-library/jest-dom/extend-expect");
9
+ const _SingleLineEditor = require("./SingleLineEditor");
10
+ function _getRequireWildcardCache(nodeInterop) {
11
+ if (typeof WeakMap !== "function") return null;
12
+ var cacheBabelInterop = new WeakMap();
13
+ var cacheNodeInterop = new WeakMap();
14
+ return (_getRequireWildcardCache = function(nodeInterop) {
15
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
16
+ })(nodeInterop);
17
+ }
18
+ function _interop_require_wildcard(obj, nodeInterop) {
19
+ if (!nodeInterop && obj && obj.__esModule) {
20
+ return obj;
21
+ }
22
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
23
+ return {
24
+ default: obj
25
+ };
26
+ }
27
+ var cache = _getRequireWildcardCache(nodeInterop);
28
+ if (cache && cache.has(obj)) {
29
+ return cache.get(obj);
30
+ }
31
+ var newObj = {};
32
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
33
+ for(var key in obj){
34
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
35
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
36
+ if (desc && (desc.get || desc.set)) {
37
+ Object.defineProperty(newObj, key, desc);
38
+ } else {
39
+ newObj[key] = obj[key];
40
+ }
41
+ }
42
+ }
43
+ newObj.default = obj;
44
+ if (cache) {
45
+ cache.set(obj, newObj);
46
+ }
47
+ return newObj;
48
+ }
49
+ (0, _react1.configure)({
50
+ testIdAttribute: 'data-test-id'
51
+ });
52
+ describe('SingleLineEditor', ()=>{
53
+ afterEach(_react1.cleanup);
54
+ it('renders without crashing', ()=>{
55
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
56
+ return {
57
+ ...field,
58
+ type: 'Symbol'
59
+ };
60
+ });
61
+ (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
62
+ field: field,
63
+ isInitiallyDisabled: false,
64
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
65
+ }));
66
+ });
67
+ it('reads initial value from field.getValue', ()=>{
68
+ const initialValue = 'initial-value';
69
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
70
+ return {
71
+ ...field,
72
+ id: 'field-id',
73
+ type: 'Symbol',
74
+ getValue: ()=>{
75
+ return initialValue;
76
+ }
77
+ };
78
+ });
79
+ const { getByTestId , getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
80
+ field: field,
81
+ isInitiallyDisabled: false,
82
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
83
+ }));
84
+ expect(getByTestId('cf-ui-text-input')).toHaveValue(initialValue);
85
+ expect(getByText(`${initialValue.length} characters`)).toBeInTheDocument();
86
+ expect(getByText('Maximum 256 characters')).toBeInTheDocument();
87
+ });
88
+ it('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
89
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
90
+ jest.spyOn(field, 'setValue');
91
+ jest.spyOn(field, 'removeValue');
92
+ return {
93
+ ...field,
94
+ id: 'field-id',
95
+ type: 'Symbol'
96
+ };
97
+ });
98
+ const { getByTestId } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
99
+ field: field,
100
+ isInitiallyDisabled: false,
101
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
102
+ }));
103
+ const $input = getByTestId('cf-ui-text-input');
104
+ expect($input).toHaveValue('');
105
+ _react1.fireEvent.change($input, {
106
+ target: {
107
+ value: 'new-value'
108
+ }
109
+ });
110
+ await (0, _react1.waitFor)(()=>{
111
+ expect($input).toHaveValue('new-value');
112
+ expect(field.setValue).toHaveBeenCalledTimes(1);
113
+ expect(field.setValue).toHaveBeenLastCalledWith('new-value');
114
+ });
115
+ _react1.fireEvent.change($input, {
116
+ target: {
117
+ value: ''
118
+ }
119
+ });
120
+ await (0, _react1.waitFor)(()=>{
121
+ expect($input).toHaveValue('');
122
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
123
+ expect(field.removeValue).toHaveBeenLastCalledWith();
124
+ });
125
+ });
126
+ it('shows proper validation message (Symbol)', ()=>{
127
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
128
+ return {
129
+ ...field,
130
+ type: 'Symbol',
131
+ id: 'field-id'
132
+ };
133
+ });
134
+ const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
135
+ field: field,
136
+ isInitiallyDisabled: false,
137
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
138
+ }));
139
+ expect(getByText('0 characters')).toBeInTheDocument();
140
+ expect(getByText('Maximum 256 characters')).toBeInTheDocument();
141
+ });
142
+ it('shows proper validation message (Text)', ()=>{
143
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
144
+ return {
145
+ ...field,
146
+ type: 'Text',
147
+ id: 'field-id'
148
+ };
149
+ });
150
+ const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
151
+ field: field,
152
+ isInitiallyDisabled: false,
153
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
154
+ }));
155
+ expect(getByText('0 characters')).toBeInTheDocument();
156
+ expect(getByText('Maximum 50000 characters')).toBeInTheDocument();
157
+ });
158
+ it('shows proper min-max validation message', ()=>{
159
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
160
+ return {
161
+ ...field,
162
+ type: 'Symbol',
163
+ validations: [
164
+ {
165
+ size: {
166
+ min: 100,
167
+ max: 1000
168
+ }
169
+ }
170
+ ],
171
+ id: 'field-id'
172
+ };
173
+ });
174
+ const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
175
+ field: field,
176
+ isInitiallyDisabled: false,
177
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
178
+ }));
179
+ expect(getByText('0 characters')).toBeInTheDocument();
180
+ expect(getByText('Requires between 100 and 1000 characters')).toBeInTheDocument();
181
+ });
182
+ it('shows proper min validation message', ()=>{
183
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
184
+ return {
185
+ ...field,
186
+ type: 'Symbol',
187
+ validations: [
188
+ {
189
+ size: {
190
+ min: 1000
191
+ }
192
+ }
193
+ ],
194
+ id: 'field-id'
195
+ };
196
+ });
197
+ const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
198
+ field: field,
199
+ isInitiallyDisabled: false,
200
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
201
+ }));
202
+ expect(getByText('0 characters')).toBeInTheDocument();
203
+ expect(getByText('Requires at least 1000 characters')).toBeInTheDocument();
204
+ });
205
+ it('renders no validation message if withCharValidation is falsy', ()=>{
206
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
207
+ return {
208
+ ...field,
209
+ type: 'Symbol',
210
+ validations: [
211
+ {
212
+ size: {
213
+ min: 100,
214
+ max: 1000
215
+ }
216
+ }
217
+ ],
218
+ id: 'field-id'
219
+ };
220
+ });
221
+ const { getByText , queryByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
222
+ field: field,
223
+ withCharValidation: false,
224
+ isInitiallyDisabled: false,
225
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
226
+ }));
227
+ expect(getByText('0 characters')).toBeInTheDocument();
228
+ expect(queryByText('Requires between 100 and 1000 characters')).not.toBeInTheDocument();
229
+ });
230
+ });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "SingleLineEditor", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _SingleLineEditor.SingleLineEditor;
9
+ }
10
+ });
11
+ const _SingleLineEditor = require("./SingleLineEditor");
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ validationRow: function() {
13
+ return validationRow;
14
+ },
15
+ rightToLeft: function() {
16
+ return rightToLeft;
17
+ }
18
+ });
19
+ const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
20
+ const _emotion = require("emotion");
21
+ function _interop_require_default(obj) {
22
+ return obj && obj.__esModule ? obj : {
23
+ default: obj
24
+ };
25
+ }
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
+ const rightToLeft = (0, _emotion.css)({
34
+ direction: 'rtl'
35
+ });
@@ -0,0 +1,50 @@
1
+ import * as React from 'react';
2
+ import { TextInput } from '@contentful/f36-components';
3
+ import { FieldConnector, ConstraintsUtils, CharCounter, CharValidation } from '@contentful/field-editor-shared';
4
+ import * as styles from './styles';
5
+ function isSupportedFieldTypes(val) {
6
+ return val === 'Symbol' || val === 'Text';
7
+ }
8
+ export function SingleLineEditor(props) {
9
+ const { field , locales } = props;
10
+ if (!isSupportedFieldTypes(field.type)) {
11
+ throw new Error(`"${field.type}" field type is not supported by SingleLineEditor`);
12
+ }
13
+ const constraints = ConstraintsUtils.fromFieldValidations(field.validations, field.type);
14
+ const checkConstraint = ConstraintsUtils.makeChecker(constraints);
15
+ const direction = locales.direction[field.locale] || 'ltr';
16
+ return React.createElement(FieldConnector, {
17
+ field: field,
18
+ isInitiallyDisabled: props.isInitiallyDisabled,
19
+ isDisabled: props.isDisabled
20
+ }, ({ value , errors , disabled , setValue })=>{
21
+ return React.createElement("div", {
22
+ "data-test-id": "single-line-editor"
23
+ }, React.createElement(TextInput, {
24
+ className: direction === 'rtl' ? styles.rightToLeft : '',
25
+ isRequired: field.required,
26
+ isInvalid: errors.length > 0,
27
+ isDisabled: disabled,
28
+ value: value || '',
29
+ onChange: (e)=>{
30
+ setValue(e.target.value);
31
+ }
32
+ }), props.withCharValidation && React.createElement("div", {
33
+ className: styles.validationRow
34
+ }, React.createElement(CharCounter, {
35
+ value: value || '',
36
+ checkConstraint: checkConstraint
37
+ }), React.createElement(CharValidation, {
38
+ constraints: constraints
39
+ })), props.withCharValidation === false && React.createElement("div", {
40
+ className: styles.validationRow
41
+ }, React.createElement(CharCounter, {
42
+ value: value || '',
43
+ checkConstraint: ()=>true
44
+ })));
45
+ });
46
+ }
47
+ SingleLineEditor.defaultProps = {
48
+ isInitiallyDisabled: true,
49
+ withCharValidation: true
50
+ };
@@ -0,0 +1,187 @@
1
+ import * as React from 'react';
2
+ import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils';
3
+ import { cleanup, configure, fireEvent, render, waitFor } from '@testing-library/react';
4
+ import '@testing-library/jest-dom/extend-expect';
5
+ import { SingleLineEditor } from './SingleLineEditor';
6
+ configure({
7
+ testIdAttribute: 'data-test-id'
8
+ });
9
+ describe('SingleLineEditor', ()=>{
10
+ afterEach(cleanup);
11
+ it('renders without crashing', ()=>{
12
+ const [field] = createFakeFieldAPI((field)=>{
13
+ return {
14
+ ...field,
15
+ type: 'Symbol'
16
+ };
17
+ });
18
+ render(React.createElement(SingleLineEditor, {
19
+ field: field,
20
+ isInitiallyDisabled: false,
21
+ locales: createFakeLocalesAPI()
22
+ }));
23
+ });
24
+ it('reads initial value from field.getValue', ()=>{
25
+ const initialValue = 'initial-value';
26
+ const [field] = createFakeFieldAPI((field)=>{
27
+ return {
28
+ ...field,
29
+ id: 'field-id',
30
+ type: 'Symbol',
31
+ getValue: ()=>{
32
+ return initialValue;
33
+ }
34
+ };
35
+ });
36
+ const { getByTestId , getByText } = render(React.createElement(SingleLineEditor, {
37
+ field: field,
38
+ isInitiallyDisabled: false,
39
+ locales: createFakeLocalesAPI()
40
+ }));
41
+ expect(getByTestId('cf-ui-text-input')).toHaveValue(initialValue);
42
+ expect(getByText(`${initialValue.length} characters`)).toBeInTheDocument();
43
+ expect(getByText('Maximum 256 characters')).toBeInTheDocument();
44
+ });
45
+ it('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
46
+ const [field] = createFakeFieldAPI((field)=>{
47
+ jest.spyOn(field, 'setValue');
48
+ jest.spyOn(field, 'removeValue');
49
+ return {
50
+ ...field,
51
+ id: 'field-id',
52
+ type: 'Symbol'
53
+ };
54
+ });
55
+ const { getByTestId } = render(React.createElement(SingleLineEditor, {
56
+ field: field,
57
+ isInitiallyDisabled: false,
58
+ locales: createFakeLocalesAPI()
59
+ }));
60
+ const $input = getByTestId('cf-ui-text-input');
61
+ expect($input).toHaveValue('');
62
+ fireEvent.change($input, {
63
+ target: {
64
+ value: 'new-value'
65
+ }
66
+ });
67
+ await waitFor(()=>{
68
+ expect($input).toHaveValue('new-value');
69
+ expect(field.setValue).toHaveBeenCalledTimes(1);
70
+ expect(field.setValue).toHaveBeenLastCalledWith('new-value');
71
+ });
72
+ fireEvent.change($input, {
73
+ target: {
74
+ value: ''
75
+ }
76
+ });
77
+ await waitFor(()=>{
78
+ expect($input).toHaveValue('');
79
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
80
+ expect(field.removeValue).toHaveBeenLastCalledWith();
81
+ });
82
+ });
83
+ it('shows proper validation message (Symbol)', ()=>{
84
+ const [field] = createFakeFieldAPI((field)=>{
85
+ return {
86
+ ...field,
87
+ type: 'Symbol',
88
+ id: 'field-id'
89
+ };
90
+ });
91
+ const { getByText } = render(React.createElement(SingleLineEditor, {
92
+ field: field,
93
+ isInitiallyDisabled: false,
94
+ locales: createFakeLocalesAPI()
95
+ }));
96
+ expect(getByText('0 characters')).toBeInTheDocument();
97
+ expect(getByText('Maximum 256 characters')).toBeInTheDocument();
98
+ });
99
+ it('shows proper validation message (Text)', ()=>{
100
+ const [field] = createFakeFieldAPI((field)=>{
101
+ return {
102
+ ...field,
103
+ type: 'Text',
104
+ id: 'field-id'
105
+ };
106
+ });
107
+ const { getByText } = render(React.createElement(SingleLineEditor, {
108
+ field: field,
109
+ isInitiallyDisabled: false,
110
+ locales: createFakeLocalesAPI()
111
+ }));
112
+ expect(getByText('0 characters')).toBeInTheDocument();
113
+ expect(getByText('Maximum 50000 characters')).toBeInTheDocument();
114
+ });
115
+ it('shows proper min-max validation message', ()=>{
116
+ const [field] = createFakeFieldAPI((field)=>{
117
+ return {
118
+ ...field,
119
+ type: 'Symbol',
120
+ validations: [
121
+ {
122
+ size: {
123
+ min: 100,
124
+ max: 1000
125
+ }
126
+ }
127
+ ],
128
+ id: 'field-id'
129
+ };
130
+ });
131
+ const { getByText } = render(React.createElement(SingleLineEditor, {
132
+ field: field,
133
+ isInitiallyDisabled: false,
134
+ locales: createFakeLocalesAPI()
135
+ }));
136
+ expect(getByText('0 characters')).toBeInTheDocument();
137
+ expect(getByText('Requires between 100 and 1000 characters')).toBeInTheDocument();
138
+ });
139
+ it('shows proper min validation message', ()=>{
140
+ const [field] = createFakeFieldAPI((field)=>{
141
+ return {
142
+ ...field,
143
+ type: 'Symbol',
144
+ validations: [
145
+ {
146
+ size: {
147
+ min: 1000
148
+ }
149
+ }
150
+ ],
151
+ id: 'field-id'
152
+ };
153
+ });
154
+ const { getByText } = render(React.createElement(SingleLineEditor, {
155
+ field: field,
156
+ isInitiallyDisabled: false,
157
+ locales: createFakeLocalesAPI()
158
+ }));
159
+ expect(getByText('0 characters')).toBeInTheDocument();
160
+ expect(getByText('Requires at least 1000 characters')).toBeInTheDocument();
161
+ });
162
+ it('renders no validation message if withCharValidation is falsy', ()=>{
163
+ const [field] = createFakeFieldAPI((field)=>{
164
+ return {
165
+ ...field,
166
+ type: 'Symbol',
167
+ validations: [
168
+ {
169
+ size: {
170
+ min: 100,
171
+ max: 1000
172
+ }
173
+ }
174
+ ],
175
+ id: 'field-id'
176
+ };
177
+ });
178
+ const { getByText , queryByText } = render(React.createElement(SingleLineEditor, {
179
+ field: field,
180
+ withCharValidation: false,
181
+ isInitiallyDisabled: false,
182
+ locales: createFakeLocalesAPI()
183
+ }));
184
+ expect(getByText('0 characters')).toBeInTheDocument();
185
+ expect(queryByText('Requires between 100 and 1000 characters')).not.toBeInTheDocument();
186
+ });
187
+ });
@@ -0,0 +1 @@
1
+ export { SingleLineEditor } from './SingleLineEditor';
@@ -0,0 +1,12 @@
1
+ import tokens from '@contentful/f36-tokens';
2
+ import { css } from 'emotion';
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
+ export const rightToLeft = css({
11
+ direction: 'rtl'
12
+ });
@@ -1,31 +1,31 @@
1
- /// <reference types="react" />
2
- import { FieldAPI, LocalesAPI } from '@contentful/field-editor-shared';
3
- export interface SingleLineEditorProps {
4
- /**
5
- * is the field disabled initially
6
- */
7
- isInitiallyDisabled: boolean;
8
- /**
9
- * is the field manually disabled
10
- */
11
- isDisabled?: boolean;
12
- /**
13
- * whether char validation should be shown or not
14
- */
15
- withCharValidation: boolean;
16
- /**
17
- * sdk.field
18
- */
19
- field: FieldAPI;
20
- /**
21
- * sdk.locales
22
- */
23
- locales: LocalesAPI;
24
- }
25
- export declare function SingleLineEditor(props: SingleLineEditorProps): JSX.Element;
26
- export declare namespace SingleLineEditor {
27
- var defaultProps: {
28
- isInitiallyDisabled: boolean;
29
- withCharValidation: boolean;
30
- };
31
- }
1
+ import * as React from 'react';
2
+ import { FieldAPI, LocalesAPI } from '@contentful/field-editor-shared';
3
+ export interface SingleLineEditorProps {
4
+ /**
5
+ * is the field disabled initially
6
+ */
7
+ isInitiallyDisabled: boolean;
8
+ /**
9
+ * is the field manually disabled
10
+ */
11
+ isDisabled?: boolean;
12
+ /**
13
+ * whether char validation should be shown or not
14
+ */
15
+ withCharValidation: boolean;
16
+ /**
17
+ * sdk.field
18
+ */
19
+ field: FieldAPI;
20
+ /**
21
+ * sdk.locales
22
+ */
23
+ locales: LocalesAPI;
24
+ }
25
+ export declare function SingleLineEditor(props: SingleLineEditorProps): React.JSX.Element;
26
+ export declare namespace SingleLineEditor {
27
+ var defaultProps: {
28
+ isInitiallyDisabled: boolean;
29
+ withCharValidation: boolean;
30
+ };
31
+ }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -1 +1 @@
1
- export { SingleLineEditor } from './SingleLineEditor';
1
+ export { SingleLineEditor } from './SingleLineEditor';
@@ -1,2 +1,2 @@
1
- export declare const validationRow: string;
2
- export declare const rightToLeft: string;
1
+ export declare const validationRow: string;
2
+ export declare const rightToLeft: string;
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-single-line",
3
- "version": "1.2.0",
4
- "main": "dist/index.js",
5
- "module": "dist/field-editor-single-line.esm.js",
6
- "typings": "dist/index.d.ts",
3
+ "version": "1.3.1",
4
+ "main": "dist/cjs/index.js",
5
+ "module": "dist/esm/index.js",
6
+ "types": "dist/types/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/types/index.d.ts",
10
+ "require": "./dist/cjs/index.js",
11
+ "default": "./dist/cjs/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
7
15
  "files": [
8
16
  "dist"
9
17
  ],
@@ -14,25 +22,30 @@
14
22
  "url": "https://github.com/contentful/field-editors"
15
23
  },
16
24
  "scripts": {
17
- "watch": "tsdx watch",
18
- "build": "tsdx build",
19
- "test": "tsdx test --env=jsdom --watch",
20
- "test:ci": "tsdx test --env=jsdom --ci",
25
+ "watch": "yarn concurrently \"yarn:watch:*\"",
26
+ "watch:cjs": "yarn build:cjs -w",
27
+ "watch:esm": "yarn build:esm -w",
28
+ "watch:types": "yarn build:types --watch",
29
+ "build": "yarn build:types && yarn build:cjs && yarn build:esm",
30
+ "build:types": "tsc --outDir dist/types --emitDeclarationOnly",
31
+ "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs",
32
+ "build:esm": "swc src --config-file ../../.swcrc -d dist/esm",
33
+ "test": "jest --watch",
34
+ "test:ci": "jest --ci",
21
35
  "tsc": "tsc -p ./ --noEmit"
22
36
  },
23
37
  "dependencies": {
24
38
  "@contentful/f36-components": "^4.0.27",
25
39
  "@contentful/f36-tokens": "^4.0.0",
26
- "@contentful/field-editor-shared": "^1.2.0",
40
+ "@contentful/field-editor-shared": "^1.3.1",
27
41
  "emotion": "^10.0.17",
28
- "lodash": "^4.17.15",
29
- "lodash-es": "^4.17.15"
42
+ "lodash": "^4.17.15"
30
43
  },
31
44
  "devDependencies": {
32
- "@contentful/field-editor-test-utils": "^1.3.0"
45
+ "@contentful/field-editor-test-utils": "^1.4.1"
33
46
  },
34
47
  "peerDependencies": {
35
48
  "react": ">=16.8.0"
36
49
  },
37
- "gitHead": "de7e74e3485dd69c240cfe9c545e6e50e41fb295"
50
+ "gitHead": "ca904b19ca794a2c40d82e1f7ede9e0be3560f22"
38
51
  }
package/CHANGELOG.md DELETED
@@ -1,200 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [1.2.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.11...@contentful/field-editor-single-line@1.2.0) (2023-04-19)
7
-
8
- ### Features
9
-
10
- - upgrade cypress [TOL-1036] ([#1391](https://github.com/contentful/field-editors/issues/1391)) ([9c1aec9](https://github.com/contentful/field-editors/commit/9c1aec98aabbe464cdc3f1236c3bb1cc29b8208d))
11
-
12
- ## [1.1.11](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.10...@contentful/field-editor-single-line@1.1.11) (2023-03-14)
13
-
14
- **Note:** Version bump only for package @contentful/field-editor-single-line
15
-
16
- ## [1.1.10](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.9...@contentful/field-editor-single-line@1.1.10) (2023-03-10)
17
-
18
- ### Bug Fixes
19
-
20
- - support disabling single line editor ([#1367](https://github.com/contentful/field-editors/issues/1367)) ([f8314ff](https://github.com/contentful/field-editors/commit/f8314fff446a3dcb482835424c7fca66c4f87f20))
21
-
22
- ## [1.1.9](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.8...@contentful/field-editor-single-line@1.1.9) (2023-02-21)
23
-
24
- **Note:** Version bump only for package @contentful/field-editor-single-line
25
-
26
- ## [1.1.8](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.7...@contentful/field-editor-single-line@1.1.8) (2023-02-07)
27
-
28
- **Note:** Version bump only for package @contentful/field-editor-single-line
29
-
30
- ## [1.1.7](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.6...@contentful/field-editor-single-line@1.1.7) (2022-12-08)
31
-
32
- **Note:** Version bump only for package @contentful/field-editor-single-line
33
-
34
- ## [1.1.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.5...@contentful/field-editor-single-line@1.1.6) (2022-07-29)
35
-
36
- **Note:** Version bump only for package @contentful/field-editor-single-line
37
-
38
- ## [1.1.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.4...@contentful/field-editor-single-line@1.1.5) (2022-07-29)
39
-
40
- **Note:** Version bump only for package @contentful/field-editor-single-line
41
-
42
- ## [1.1.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.3...@contentful/field-editor-single-line@1.1.4) (2022-07-11)
43
-
44
- **Note:** Version bump only for package @contentful/field-editor-single-line
45
-
46
- ## [1.1.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.2...@contentful/field-editor-single-line@1.1.3) (2022-06-22)
47
-
48
- **Note:** Version bump only for package @contentful/field-editor-single-line
49
-
50
- ## [1.1.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.1...@contentful/field-editor-single-line@1.1.2) (2022-02-15)
51
-
52
- ### Bug Fixes
53
-
54
- - bump f36 packages ([#1025](https://github.com/contentful/field-editors/issues/1025)) ([ec37a40](https://github.com/contentful/field-editors/commit/ec37a4000db7cd75c66dd9621136b2272c9feeea))
55
-
56
- ## [1.1.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.1.0...@contentful/field-editor-single-line@1.1.1) (2022-02-14)
57
-
58
- **Note:** Version bump only for package @contentful/field-editor-single-line
59
-
60
- # [1.1.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.0.3...@contentful/field-editor-single-line@1.1.0) (2022-01-11)
61
-
62
- ### Features
63
-
64
- - bump f36 packages to stable v4 [BAU-521] ([#988](https://github.com/contentful/field-editors/issues/988)) ([419cf56](https://github.com/contentful/field-editors/commit/419cf56692179b074fcfa2743469d5265ed98429))
65
-
66
- ## [1.0.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.0.2...@contentful/field-editor-single-line@1.0.3) (2021-12-23)
67
-
68
- ### Bug Fixes
69
-
70
- - markdown buttons ([#968](https://github.com/contentful/field-editors/issues/968)) ([9803b98](https://github.com/contentful/field-editors/commit/9803b98c25d92df6148686ffe2749a77f7efdbb9))
71
-
72
- ## [1.0.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.0.1...@contentful/field-editor-single-line@1.0.2) (2021-12-20)
73
-
74
- **Note:** Version bump only for package @contentful/field-editor-single-line
75
-
76
- ## [1.0.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@1.0.0...@contentful/field-editor-single-line@1.0.1) (2021-11-17)
77
-
78
- ### Bug Fixes
79
-
80
- - **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))
81
-
82
- # [1.0.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.16.0...@contentful/field-editor-single-line@1.0.0) (2021-11-04)
83
-
84
- **Note:** Version bump only for package @contentful/field-editor-single-line
85
-
86
- # [0.16.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.15.6...@contentful/field-editor-single-line@0.16.0) (2021-11-04)
87
-
88
- ### Features
89
-
90
- - Forma v4 components adoption ([#805](https://github.com/contentful/field-editors/issues/805)) ([526bde6](https://github.com/contentful/field-editors/commit/526bde6e10e0ee3789705ec10fb31489af7ca59e))
91
-
92
- ### BREAKING CHANGES
93
-
94
- - adopts a new Forma v4 beta
95
-
96
- ## [0.15.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.15.5...@contentful/field-editor-single-line@0.15.6) (2021-10-14)
97
-
98
- **Note:** Version bump only for package @contentful/field-editor-single-line
99
-
100
- ## [0.15.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.15.4...@contentful/field-editor-single-line@0.15.5) (2021-10-06)
101
-
102
- **Note:** Version bump only for package @contentful/field-editor-single-line
103
-
104
- ## [0.15.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.15.3...@contentful/field-editor-single-line@0.15.4) (2021-09-17)
105
-
106
- **Note:** Version bump only for package @contentful/field-editor-single-line
107
-
108
- ## [0.15.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.15.2...@contentful/field-editor-single-line@0.15.3) (2021-09-16)
109
-
110
- **Note:** Version bump only for package @contentful/field-editor-single-line
111
-
112
- ## [0.15.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.15.1...@contentful/field-editor-single-line@0.15.2) (2021-08-19)
113
-
114
- **Note:** Version bump only for package @contentful/field-editor-single-line
115
-
116
- ## [0.15.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.15.0...@contentful/field-editor-single-line@0.15.1) (2021-07-29)
117
-
118
- **Note:** Version bump only for package @contentful/field-editor-single-line
119
-
120
- # [0.15.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.14.6...@contentful/field-editor-single-line@0.15.0) (2021-07-23)
121
-
122
- ### Features
123
-
124
- - 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
125
-
126
- ## [0.14.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.14.3...@contentful/field-editor-single-line@0.14.6) (2021-07-06)
127
-
128
- **Note:** Version bump only for package @contentful/field-editor-single-line
129
-
130
- ## [0.14.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.14.3...@contentful/field-editor-single-line@0.14.5) (2021-07-06)
131
-
132
- **Note:** Version bump only for package @contentful/field-editor-single-line
133
-
134
- ## [0.14.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.14.3...@contentful/field-editor-single-line@0.14.4) (2021-06-23)
135
-
136
- **Note:** Version bump only for package @contentful/field-editor-single-line
137
-
138
- ## [0.14.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.14.2...@contentful/field-editor-single-line@0.14.3) (2021-06-23)
139
-
140
- **Note:** Version bump only for package @contentful/field-editor-single-line
141
-
142
- ## [0.14.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.14.1...@contentful/field-editor-single-line@0.14.2) (2021-06-22)
143
-
144
- **Note:** Version bump only for package @contentful/field-editor-single-line
145
-
146
- ## [0.14.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.14.0...@contentful/field-editor-single-line@0.14.1) (2021-03-05)
147
-
148
- **Note:** Version bump only for package @contentful/field-editor-single-line
149
-
150
- # [0.14.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.13.2...@contentful/field-editor-single-line@0.14.0) (2021-02-19)
151
-
152
- ### Features
153
-
154
- - bump min version of forma-36 ([#606](https://github.com/contentful/field-editors/issues/606)) ([fd57c7a](https://github.com/contentful/field-editors/commit/fd57c7a4312766af38c01507f17706ab22992617))
155
-
156
- ## [0.13.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.13.1...@contentful/field-editor-single-line@0.13.2) (2021-02-09)
157
-
158
- **Note:** Version bump only for package @contentful/field-editor-single-line
159
-
160
- ## [0.13.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.13.0...@contentful/field-editor-single-line@0.13.1) (2021-02-01)
161
-
162
- **Note:** Version bump only for package @contentful/field-editor-single-line
163
-
164
- # [0.13.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.12.0...@contentful/field-editor-single-line@0.13.0) (2021-01-20)
165
-
166
- ### Features
167
-
168
- - 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))
169
-
170
- # [0.12.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.11.4...@contentful/field-editor-single-line@0.12.0) (2021-01-12)
171
-
172
- ### Features
173
-
174
- - update minimal required Forma version to the 3.73.12 ([#552](https://github.com/contentful/field-editors/issues/552)) ([2816fd9](https://github.com/contentful/field-editors/commit/2816fd960c28815faebf49a9ef8f4c4c0d91fc36))
175
-
176
- ## [0.11.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.11.3...@contentful/field-editor-single-line@0.11.4) (2020-12-16)
177
-
178
- **Note:** Version bump only for package @contentful/field-editor-single-line
179
-
180
- ## [0.11.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.11.2...@contentful/field-editor-single-line@0.11.3) (2020-11-06)
181
-
182
- **Note:** Version bump only for package @contentful/field-editor-single-line
183
-
184
- ## [0.11.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.11.1...@contentful/field-editor-single-line@0.11.2) (2020-11-06)
185
-
186
- **Note:** Version bump only for package @contentful/field-editor-single-line
187
-
188
- ## [0.11.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.11.0...@contentful/field-editor-single-line@0.11.1) (2020-10-28)
189
-
190
- **Note:** Version bump only for package @contentful/field-editor-single-line
191
-
192
- # [0.11.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.10.1...@contentful/field-editor-single-line@0.11.0) (2020-09-03)
193
-
194
- ### Features
195
-
196
- - 🎸 add withCharValidation property to hide validation ([#390](https://github.com/contentful/field-editors/issues/390)) ([9da6700](https://github.com/contentful/field-editors/commit/9da67005f83c1cebdabb67edfed73f7d1dcbfc04))
197
-
198
- ## [0.10.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-single-line@0.10.0...@contentful/field-editor-single-line@0.10.1) (2020-08-24)
199
-
200
- **Note:** Version bump only for package @contentful/field-editor-single-line
@@ -1,83 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var React = require('react');
8
- var f36Components = require('@contentful/f36-components');
9
- var fieldEditorShared = require('@contentful/field-editor-shared');
10
- var tokens = _interopDefault(require('@contentful/f36-tokens'));
11
- var emotion = require('emotion');
12
-
13
- const validationRow = /*#__PURE__*/emotion.css({
14
- display: 'flex',
15
- justifyContent: 'space-between',
16
- fontSize: tokens.fontSizeM,
17
- marginTop: tokens.spacingXs,
18
- color: tokens.gray700
19
- });
20
- const rightToLeft = /*#__PURE__*/emotion.css({
21
- direction: 'rtl'
22
- });
23
-
24
- function isSupportedFieldTypes(val) {
25
- return val === 'Symbol' || val === 'Text';
26
- }
27
-
28
- function SingleLineEditor(props) {
29
- const {
30
- field,
31
- locales
32
- } = props;
33
-
34
- if (!isSupportedFieldTypes(field.type)) {
35
- throw new Error(`"${field.type}" field type is not supported by SingleLineEditor`);
36
- }
37
-
38
- const constraints = fieldEditorShared.ConstraintsUtils.fromFieldValidations(field.validations, field.type);
39
- const checkConstraint = fieldEditorShared.ConstraintsUtils.makeChecker(constraints);
40
- const direction = locales.direction[field.locale] || 'ltr';
41
- return React.createElement(fieldEditorShared.FieldConnector, {
42
- field: field,
43
- isInitiallyDisabled: props.isInitiallyDisabled,
44
- isDisabled: props.isDisabled
45
- }, ({
46
- value,
47
- errors,
48
- disabled,
49
- setValue
50
- }) => {
51
- return React.createElement("div", {
52
- "data-test-id": "single-line-editor"
53
- }, React.createElement(f36Components.TextInput, {
54
- className: direction === 'rtl' ? rightToLeft : '',
55
- isRequired: field.required,
56
- isInvalid: errors.length > 0,
57
- isDisabled: disabled,
58
- value: value || '',
59
- onChange: e => {
60
- setValue(e.target.value);
61
- }
62
- }), props.withCharValidation && React.createElement("div", {
63
- className: validationRow
64
- }, React.createElement(fieldEditorShared.CharCounter, {
65
- value: value || '',
66
- checkConstraint: checkConstraint
67
- }), React.createElement(fieldEditorShared.CharValidation, {
68
- constraints: constraints
69
- })), props.withCharValidation === false && React.createElement("div", {
70
- className: validationRow
71
- }, React.createElement(fieldEditorShared.CharCounter, {
72
- value: value || '',
73
- checkConstraint: () => true
74
- })));
75
- });
76
- }
77
- SingleLineEditor.defaultProps = {
78
- isInitiallyDisabled: true,
79
- withCharValidation: true
80
- };
81
-
82
- exports.SingleLineEditor = SingleLineEditor;
83
- //# sourceMappingURL=field-editor-single-line.cjs.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-editor-single-line.cjs.development.js","sources":["../src/styles.ts","../src/SingleLineEditor.tsx"],"sourcesContent":["import tokens from '@contentful/f36-tokens';\nimport { css } from 'emotion';\n\nexport const validationRow = css({\n display: 'flex',\n justifyContent: 'space-between',\n fontSize: tokens.fontSizeM,\n marginTop: tokens.spacingXs,\n color: tokens.gray700,\n});\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n","import * as React from 'react';\n\nimport { TextInput } from '@contentful/f36-components';\nimport {\n FieldAPI,\n FieldConnector,\n ConstraintsUtils,\n CharCounter,\n CharValidation,\n LocalesAPI,\n} from '@contentful/field-editor-shared';\n\nimport * as styles from './styles';\n\n\nexport interface SingleLineEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * is the field manually disabled\n */\n isDisabled?: boolean;\n\n /**\n * whether char validation should be shown or not\n */\n withCharValidation: boolean;\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\nfunction isSupportedFieldTypes(val: string): val is 'Symbol' | 'Text' {\n return val === 'Symbol' || val === 'Text';\n}\n\nexport function SingleLineEditor(props: SingleLineEditorProps) {\n const { field, locales } = props;\n\n if (!isSupportedFieldTypes(field.type)) {\n throw new Error(`\"${field.type}\" field type is not supported by SingleLineEditor`);\n }\n\n const constraints = ConstraintsUtils.fromFieldValidations(field.validations, field.type);\n const checkConstraint = ConstraintsUtils.makeChecker(constraints);\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<string>\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}\n isDisabled={props.isDisabled}>\n {({ value, errors, disabled, setValue }) => {\n return (\n <div data-test-id=\"single-line-editor\">\n <TextInput\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n isRequired={field.required}\n isInvalid={errors.length > 0}\n isDisabled={disabled}\n value={value || ''}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n }}\n />\n {props.withCharValidation && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={checkConstraint} />\n <CharValidation constraints={constraints} />\n </div>\n )}\n {props.withCharValidation === false && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={() => true} />\n </div>\n )}\n </div>\n );\n }}\n </FieldConnector>\n );\n}\n\nSingleLineEditor.defaultProps = {\n isInitiallyDisabled: true,\n withCharValidation: true,\n};\n"],"names":["validationRow","css","display","justifyContent","fontSize","tokens","fontSizeM","marginTop","spacingXs","color","gray700","rightToLeft","direction","isSupportedFieldTypes","val","SingleLineEditor","props","field","locales","type","Error","constraints","ConstraintsUtils","fromFieldValidations","validations","checkConstraint","makeChecker","locale","React","FieldConnector","isInitiallyDisabled","isDisabled","value","errors","disabled","setValue","TextInput","className","styles","isRequired","required","isInvalid","length","onChange","e","target","withCharValidation","CharCounter","CharValidation","defaultProps"],"mappings":";;;;;;;;;;;;AAGO,MAAMA,aAAa,gBAAGC,WAAG,CAAC;AAC/BC,EAAAA,OAAO,EAAE,MADsB;AAE/BC,EAAAA,cAAc,EAAE,eAFe;AAG/BC,EAAAA,QAAQ,EAAEC,MAAM,CAACC,SAHc;AAI/BC,EAAAA,SAAS,EAAEF,MAAM,CAACG,SAJa;AAK/BC,EAAAA,KAAK,EAAEJ,MAAM,CAACK;AALiB,CAAD,CAAzB;AAQA,MAAMC,WAAW,gBAAGV,WAAG,CAAC;AAC7BW,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;;AC8BP,SAASC,qBAAT,CAA+BC,GAA/B;AACE,SAAOA,GAAG,KAAK,QAAR,IAAoBA,GAAG,KAAK,MAAnC;AACD;;AAED,SAAgBC,iBAAiBC;AAC/B,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAqBF,KAA3B;;AAEA,MAAI,CAACH,qBAAqB,CAACI,KAAK,CAACE,IAAP,CAA1B,EAAwC;AACtC,UAAM,IAAIC,KAAJ,KAAcH,KAAK,CAACE,uDAApB,CAAN;AACD;;AAED,QAAME,WAAW,GAAGC,kCAAgB,CAACC,oBAAjB,CAAsCN,KAAK,CAACO,WAA5C,EAAyDP,KAAK,CAACE,IAA/D,CAApB;AACA,QAAMM,eAAe,GAAGH,kCAAgB,CAACI,WAAjB,CAA6BL,WAA7B,CAAxB;AACA,QAAMT,SAAS,GAAGM,OAAO,CAACN,SAAR,CAAkBK,KAAK,CAACU,MAAxB,KAAmC,KAArD;AAEA,SACEC,mBAAA,CAACC,gCAAD;AACEZ,IAAAA,KAAK,EAAEA;AACPa,IAAAA,mBAAmB,EAAEd,KAAK,CAACc;AAC3BC,IAAAA,UAAU,EAAEf,KAAK,CAACe;GAHpB,EAIG,CAAC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,MAAT;AAAiBC,IAAAA,QAAjB;AAA2BC,IAAAA;AAA3B,GAAD;AACC,WACEP,mBAAA,MAAA;sBAAkB;KAAlB,EACEA,mBAAA,CAACQ,uBAAD;AACEC,MAAAA,SAAS,EAAEzB,SAAS,KAAK,KAAd,GAAsB0B,WAAtB,GAA2C;AACtDC,MAAAA,UAAU,EAAEtB,KAAK,CAACuB;AAClBC,MAAAA,SAAS,EAAER,MAAM,CAACS,MAAP,GAAgB;AAC3BX,MAAAA,UAAU,EAAEG;AACZF,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAChBW,MAAAA,QAAQ,EAAGC,CAAD;AACRT,QAAAA,QAAQ,CAACS,CAAC,CAACC,MAAF,CAASb,KAAV,CAAR;AACD;KARH,CADF,EAWGhB,KAAK,CAAC8B,kBAAN,IACClB,mBAAA,MAAA;AAAKS,MAAAA,SAAS,EAAEC;KAAhB,EACEV,mBAAA,CAACmB,6BAAD;AAAaf,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAAIP,MAAAA,eAAe,EAAEA;KAAlD,CADF,EAEEG,mBAAA,CAACoB,gCAAD;AAAgB3B,MAAAA,WAAW,EAAEA;KAA7B,CAFF,CAZJ,EAiBGL,KAAK,CAAC8B,kBAAN,KAA6B,KAA7B,IACClB,mBAAA,MAAA;AAAKS,MAAAA,SAAS,EAAEC;KAAhB,EACEV,mBAAA,CAACmB,6BAAD;AAAaf,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAAIP,MAAAA,eAAe,EAAE,MAAM;KAAxD,CADF,CAlBJ,CADF;AAyBD,GA9BH,CADF;AAkCD;AAEDV,gBAAgB,CAACkC,YAAjB,GAAgC;AAC9BnB,EAAAA,mBAAmB,EAAE,IADS;AAE9BgB,EAAAA,kBAAkB,EAAE;AAFU,CAAhC;;;;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),i=require("@contentful/f36-components"),a=require("@contentful/field-editor-shared"),n=(e=require("@contentful/f36-tokens"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("emotion");const l=r.css({display:"flex",justifyContent:"space-between",fontSize:n.fontSizeM,marginTop:n.spacingXs,color:n.gray700}),s=r.css({direction:"rtl"});function o(e){const{field:n,locales:r}=e;if("Symbol"!==(o=n.type)&&"Text"!==o)throw new Error(`"${n.type}" field type is not supported by SingleLineEditor`);var o;const d=a.ConstraintsUtils.fromFieldValidations(n.validations,n.type),c=a.ConstraintsUtils.makeChecker(d),u=r.direction[n.locale]||"ltr";return t.createElement(a.FieldConnector,{field:n,isInitiallyDisabled:e.isInitiallyDisabled,isDisabled:e.isDisabled},({value:r,errors:o,disabled:f,setValue:m})=>t.createElement("div",{"data-test-id":"single-line-editor"},t.createElement(i.TextInput,{className:"rtl"===u?s:"",isRequired:n.required,isInvalid:o.length>0,isDisabled:f,value:r||"",onChange:e=>{m(e.target.value)}}),e.withCharValidation&&t.createElement("div",{className:l},t.createElement(a.CharCounter,{value:r||"",checkConstraint:c}),t.createElement(a.CharValidation,{constraints:d})),!1===e.withCharValidation&&t.createElement("div",{className:l},t.createElement(a.CharCounter,{value:r||"",checkConstraint:()=>!0}))))}o.defaultProps={isInitiallyDisabled:!0,withCharValidation:!0},exports.SingleLineEditor=o;
2
- //# sourceMappingURL=field-editor-single-line.cjs.production.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-editor-single-line.cjs.production.min.js","sources":["../src/styles.ts","../src/SingleLineEditor.tsx"],"sourcesContent":["import tokens from '@contentful/f36-tokens';\nimport { css } from 'emotion';\n\nexport const validationRow = css({\n display: 'flex',\n justifyContent: 'space-between',\n fontSize: tokens.fontSizeM,\n marginTop: tokens.spacingXs,\n color: tokens.gray700,\n});\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n","import * as React from 'react';\n\nimport { TextInput } from '@contentful/f36-components';\nimport {\n FieldAPI,\n FieldConnector,\n ConstraintsUtils,\n CharCounter,\n CharValidation,\n LocalesAPI,\n} from '@contentful/field-editor-shared';\n\nimport * as styles from './styles';\n\n\nexport interface SingleLineEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * is the field manually disabled\n */\n isDisabled?: boolean;\n\n /**\n * whether char validation should be shown or not\n */\n withCharValidation: boolean;\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\nfunction isSupportedFieldTypes(val: string): val is 'Symbol' | 'Text' {\n return val === 'Symbol' || val === 'Text';\n}\n\nexport function SingleLineEditor(props: SingleLineEditorProps) {\n const { field, locales } = props;\n\n if (!isSupportedFieldTypes(field.type)) {\n throw new Error(`\"${field.type}\" field type is not supported by SingleLineEditor`);\n }\n\n const constraints = ConstraintsUtils.fromFieldValidations(field.validations, field.type);\n const checkConstraint = ConstraintsUtils.makeChecker(constraints);\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<string>\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}\n isDisabled={props.isDisabled}>\n {({ value, errors, disabled, setValue }) => {\n return (\n <div data-test-id=\"single-line-editor\">\n <TextInput\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n isRequired={field.required}\n isInvalid={errors.length > 0}\n isDisabled={disabled}\n value={value || ''}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n }}\n />\n {props.withCharValidation && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={checkConstraint} />\n <CharValidation constraints={constraints} />\n </div>\n )}\n {props.withCharValidation === false && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={() => true} />\n </div>\n )}\n </div>\n );\n }}\n </FieldConnector>\n );\n}\n\nSingleLineEditor.defaultProps = {\n isInitiallyDisabled: true,\n withCharValidation: true,\n};\n"],"names":["validationRow","css","display","justifyContent","fontSize","tokens","fontSizeM","marginTop","spacingXs","color","gray700","rightToLeft","direction","SingleLineEditor","props","field","locales","val","type","Error","constraints","ConstraintsUtils","fromFieldValidations","validations","checkConstraint","makeChecker","locale","React","FieldConnector","isInitiallyDisabled","isDisabled","value","errors","disabled","setValue","TextInput","className","styles","isRequired","required","isInvalid","length","onChange","e","target","withCharValidation","CharCounter","CharValidation","defaultProps"],"mappings":"8RAGO,MAAMA,EAAgBC,MAAI,CAC/BC,QAAS,OACTC,eAAgB,gBAChBC,SAAUC,EAAOC,UACjBC,UAAWF,EAAOG,UAClBC,MAAOJ,EAAOK,UAGHC,EAAcV,MAAI,CAC7BW,UAAW,iBCiCGC,EAAiBC,SACzBC,MAAEA,EAAFC,QAASA,GAAYF,KAJZ,YADcG,EAOFF,EAAMG,OANE,SAARD,QAOnB,IAAIE,UAAUJ,EAAMG,yDAR9B,IAA+BD,QAWvBG,EAAcC,mBAAiBC,qBAAqBP,EAAMQ,YAAaR,EAAMG,MAC7EM,EAAkBH,mBAAiBI,YAAYL,GAC/CR,EAAYI,EAAQJ,UAAUG,EAAMW,SAAW,aAGnDC,gBAACC,kBACCb,MAAOA,EACPc,oBAAqBf,EAAMe,oBAC3BC,WAAYhB,EAAMgB,YACjB,EAAGC,MAAAA,EAAOC,OAAAA,EAAQC,SAAAA,EAAUC,SAAAA,KAEzBP,sCAAkB,sBAChBA,gBAACQ,aACCC,UAAyB,QAAdxB,EAAsByB,EAAqB,GACtDC,WAAYvB,EAAMwB,SAClBC,UAAWR,EAAOS,OAAS,EAC3BX,WAAYG,EACZF,MAAOA,GAAS,GAChBW,SAAWC,IACTT,EAASS,EAAEC,OAAOb,UAGrBjB,EAAM+B,oBACLlB,uBAAKS,UAAWC,GACdV,gBAACmB,eAAYf,MAAOA,GAAS,GAAIP,gBAAiBA,IAClDG,gBAACoB,kBAAe3B,YAAaA,MAGH,IAA7BN,EAAM+B,oBACLlB,uBAAKS,UAAWC,GACdV,gBAACmB,eAAYf,MAAOA,GAAS,GAAIP,gBAAiB,KAAM,OAUxEX,EAAiBmC,aAAe,CAC9BnB,qBAAqB,EACrBgB,oBAAoB"}
@@ -1,77 +0,0 @@
1
- import { createElement } from 'react';
2
- import { TextInput } from '@contentful/f36-components';
3
- import { ConstraintsUtils, FieldConnector, CharCounter, CharValidation } from '@contentful/field-editor-shared';
4
- import tokens from '@contentful/f36-tokens';
5
- import { css } from 'emotion';
6
-
7
- const validationRow = /*#__PURE__*/css({
8
- display: 'flex',
9
- justifyContent: 'space-between',
10
- fontSize: tokens.fontSizeM,
11
- marginTop: tokens.spacingXs,
12
- color: tokens.gray700
13
- });
14
- const rightToLeft = /*#__PURE__*/css({
15
- direction: 'rtl'
16
- });
17
-
18
- function isSupportedFieldTypes(val) {
19
- return val === 'Symbol' || val === 'Text';
20
- }
21
-
22
- function SingleLineEditor(props) {
23
- const {
24
- field,
25
- locales
26
- } = props;
27
-
28
- if (!isSupportedFieldTypes(field.type)) {
29
- throw new Error(`"${field.type}" field type is not supported by SingleLineEditor`);
30
- }
31
-
32
- const constraints = ConstraintsUtils.fromFieldValidations(field.validations, field.type);
33
- const checkConstraint = ConstraintsUtils.makeChecker(constraints);
34
- const direction = locales.direction[field.locale] || 'ltr';
35
- return createElement(FieldConnector, {
36
- field: field,
37
- isInitiallyDisabled: props.isInitiallyDisabled,
38
- isDisabled: props.isDisabled
39
- }, ({
40
- value,
41
- errors,
42
- disabled,
43
- setValue
44
- }) => {
45
- return createElement("div", {
46
- "data-test-id": "single-line-editor"
47
- }, createElement(TextInput, {
48
- className: direction === 'rtl' ? rightToLeft : '',
49
- isRequired: field.required,
50
- isInvalid: errors.length > 0,
51
- isDisabled: disabled,
52
- value: value || '',
53
- onChange: e => {
54
- setValue(e.target.value);
55
- }
56
- }), props.withCharValidation && createElement("div", {
57
- className: validationRow
58
- }, createElement(CharCounter, {
59
- value: value || '',
60
- checkConstraint: checkConstraint
61
- }), createElement(CharValidation, {
62
- constraints: constraints
63
- })), props.withCharValidation === false && createElement("div", {
64
- className: validationRow
65
- }, createElement(CharCounter, {
66
- value: value || '',
67
- checkConstraint: () => true
68
- })));
69
- });
70
- }
71
- SingleLineEditor.defaultProps = {
72
- isInitiallyDisabled: true,
73
- withCharValidation: true
74
- };
75
-
76
- export { SingleLineEditor };
77
- //# sourceMappingURL=field-editor-single-line.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-editor-single-line.esm.js","sources":["../src/styles.ts","../src/SingleLineEditor.tsx"],"sourcesContent":["import tokens from '@contentful/f36-tokens';\nimport { css } from 'emotion';\n\nexport const validationRow = css({\n display: 'flex',\n justifyContent: 'space-between',\n fontSize: tokens.fontSizeM,\n marginTop: tokens.spacingXs,\n color: tokens.gray700,\n});\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n","import * as React from 'react';\n\nimport { TextInput } from '@contentful/f36-components';\nimport {\n FieldAPI,\n FieldConnector,\n ConstraintsUtils,\n CharCounter,\n CharValidation,\n LocalesAPI,\n} from '@contentful/field-editor-shared';\n\nimport * as styles from './styles';\n\n\nexport interface SingleLineEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * is the field manually disabled\n */\n isDisabled?: boolean;\n\n /**\n * whether char validation should be shown or not\n */\n withCharValidation: boolean;\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\nfunction isSupportedFieldTypes(val: string): val is 'Symbol' | 'Text' {\n return val === 'Symbol' || val === 'Text';\n}\n\nexport function SingleLineEditor(props: SingleLineEditorProps) {\n const { field, locales } = props;\n\n if (!isSupportedFieldTypes(field.type)) {\n throw new Error(`\"${field.type}\" field type is not supported by SingleLineEditor`);\n }\n\n const constraints = ConstraintsUtils.fromFieldValidations(field.validations, field.type);\n const checkConstraint = ConstraintsUtils.makeChecker(constraints);\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<string>\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}\n isDisabled={props.isDisabled}>\n {({ value, errors, disabled, setValue }) => {\n return (\n <div data-test-id=\"single-line-editor\">\n <TextInput\n className={direction === 'rtl' ? styles.rightToLeft : ''}\n isRequired={field.required}\n isInvalid={errors.length > 0}\n isDisabled={disabled}\n value={value || ''}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setValue(e.target.value);\n }}\n />\n {props.withCharValidation && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={checkConstraint} />\n <CharValidation constraints={constraints} />\n </div>\n )}\n {props.withCharValidation === false && (\n <div className={styles.validationRow}>\n <CharCounter value={value || ''} checkConstraint={() => true} />\n </div>\n )}\n </div>\n );\n }}\n </FieldConnector>\n );\n}\n\nSingleLineEditor.defaultProps = {\n isInitiallyDisabled: true,\n withCharValidation: true,\n};\n"],"names":["validationRow","css","display","justifyContent","fontSize","tokens","fontSizeM","marginTop","spacingXs","color","gray700","rightToLeft","direction","isSupportedFieldTypes","val","SingleLineEditor","props","field","locales","type","Error","constraints","ConstraintsUtils","fromFieldValidations","validations","checkConstraint","makeChecker","locale","React","FieldConnector","isInitiallyDisabled","isDisabled","value","errors","disabled","setValue","TextInput","className","styles","isRequired","required","isInvalid","length","onChange","e","target","withCharValidation","CharCounter","CharValidation","defaultProps"],"mappings":";;;;;;AAGO,MAAMA,aAAa,gBAAGC,GAAG,CAAC;AAC/BC,EAAAA,OAAO,EAAE,MADsB;AAE/BC,EAAAA,cAAc,EAAE,eAFe;AAG/BC,EAAAA,QAAQ,EAAEC,MAAM,CAACC,SAHc;AAI/BC,EAAAA,SAAS,EAAEF,MAAM,CAACG,SAJa;AAK/BC,EAAAA,KAAK,EAAEJ,MAAM,CAACK;AALiB,CAAD,CAAzB;AAQA,MAAMC,WAAW,gBAAGV,GAAG,CAAC;AAC7BW,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;;AC8BP,SAASC,qBAAT,CAA+BC,GAA/B;AACE,SAAOA,GAAG,KAAK,QAAR,IAAoBA,GAAG,KAAK,MAAnC;AACD;;AAED,SAAgBC,iBAAiBC;AAC/B,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAqBF,KAA3B;;AAEA,MAAI,CAACH,qBAAqB,CAACI,KAAK,CAACE,IAAP,CAA1B,EAAwC;AACtC,UAAM,IAAIC,KAAJ,KAAcH,KAAK,CAACE,uDAApB,CAAN;AACD;;AAED,QAAME,WAAW,GAAGC,gBAAgB,CAACC,oBAAjB,CAAsCN,KAAK,CAACO,WAA5C,EAAyDP,KAAK,CAACE,IAA/D,CAApB;AACA,QAAMM,eAAe,GAAGH,gBAAgB,CAACI,WAAjB,CAA6BL,WAA7B,CAAxB;AACA,QAAMT,SAAS,GAAGM,OAAO,CAACN,SAAR,CAAkBK,KAAK,CAACU,MAAxB,KAAmC,KAArD;AAEA,SACEC,aAAA,CAACC,cAAD;AACEZ,IAAAA,KAAK,EAAEA;AACPa,IAAAA,mBAAmB,EAAEd,KAAK,CAACc;AAC3BC,IAAAA,UAAU,EAAEf,KAAK,CAACe;GAHpB,EAIG,CAAC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,MAAT;AAAiBC,IAAAA,QAAjB;AAA2BC,IAAAA;AAA3B,GAAD;AACC,WACEP,aAAA,MAAA;sBAAkB;KAAlB,EACEA,aAAA,CAACQ,SAAD;AACEC,MAAAA,SAAS,EAAEzB,SAAS,KAAK,KAAd,GAAsB0B,WAAtB,GAA2C;AACtDC,MAAAA,UAAU,EAAEtB,KAAK,CAACuB;AAClBC,MAAAA,SAAS,EAAER,MAAM,CAACS,MAAP,GAAgB;AAC3BX,MAAAA,UAAU,EAAEG;AACZF,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAChBW,MAAAA,QAAQ,EAAGC,CAAD;AACRT,QAAAA,QAAQ,CAACS,CAAC,CAACC,MAAF,CAASb,KAAV,CAAR;AACD;KARH,CADF,EAWGhB,KAAK,CAAC8B,kBAAN,IACClB,aAAA,MAAA;AAAKS,MAAAA,SAAS,EAAEC;KAAhB,EACEV,aAAA,CAACmB,WAAD;AAAaf,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAAIP,MAAAA,eAAe,EAAEA;KAAlD,CADF,EAEEG,aAAA,CAACoB,cAAD;AAAgB3B,MAAAA,WAAW,EAAEA;KAA7B,CAFF,CAZJ,EAiBGL,KAAK,CAAC8B,kBAAN,KAA6B,KAA7B,IACClB,aAAA,MAAA;AAAKS,MAAAA,SAAS,EAAEC;KAAhB,EACEV,aAAA,CAACmB,WAAD;AAAaf,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAAIP,MAAAA,eAAe,EAAE,MAAM;KAAxD,CADF,CAlBJ,CADF;AAyBD,GA9BH,CADF;AAkCD;AAEDV,gBAAgB,CAACkC,YAAjB,GAAgC;AAC9BnB,EAAAA,mBAAmB,EAAE,IADS;AAE9BgB,EAAAA,kBAAkB,EAAE;AAFU,CAAhC;;;;"}
package/dist/index.js DELETED
@@ -1,8 +0,0 @@
1
-
2
- 'use strict'
3
-
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./field-editor-single-line.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./field-editor-single-line.cjs.development.js')
8
- }