@contentful/field-editor-single-line 1.1.11 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,241 @@
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
+ const _identity = _interop_require_default(require("lodash/identity"));
9
+ require("@testing-library/jest-dom/extend-expect");
10
+ const _SingleLineEditor = require("./SingleLineEditor");
11
+ function _interop_require_default(obj) {
12
+ return obj && obj.__esModule ? obj : {
13
+ default: obj
14
+ };
15
+ }
16
+ function _getRequireWildcardCache(nodeInterop) {
17
+ if (typeof WeakMap !== "function") return null;
18
+ var cacheBabelInterop = new WeakMap();
19
+ var cacheNodeInterop = new WeakMap();
20
+ return (_getRequireWildcardCache = function(nodeInterop) {
21
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
22
+ })(nodeInterop);
23
+ }
24
+ function _interop_require_wildcard(obj, nodeInterop) {
25
+ if (!nodeInterop && obj && obj.__esModule) {
26
+ return obj;
27
+ }
28
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
29
+ return {
30
+ default: obj
31
+ };
32
+ }
33
+ var cache = _getRequireWildcardCache(nodeInterop);
34
+ if (cache && cache.has(obj)) {
35
+ return cache.get(obj);
36
+ }
37
+ var newObj = {};
38
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
39
+ for(var key in obj){
40
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
41
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
42
+ if (desc && (desc.get || desc.set)) {
43
+ Object.defineProperty(newObj, key, desc);
44
+ } else {
45
+ newObj[key] = obj[key];
46
+ }
47
+ }
48
+ }
49
+ newObj.default = obj;
50
+ if (cache) {
51
+ cache.set(obj, newObj);
52
+ }
53
+ return newObj;
54
+ }
55
+ (0, _react1.configure)({
56
+ testIdAttribute: 'data-test-id'
57
+ });
58
+ jest.mock('lodash/throttle', ()=>({
59
+ default: _identity.default
60
+ }), {
61
+ virtual: true
62
+ });
63
+ describe('SingleLineEditor', ()=>{
64
+ afterEach(_react1.cleanup);
65
+ it('renders without crashing', ()=>{
66
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
67
+ return {
68
+ ...field,
69
+ type: 'Symbol'
70
+ };
71
+ });
72
+ (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
73
+ field: field,
74
+ isInitiallyDisabled: false,
75
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
76
+ }));
77
+ });
78
+ it('reads initial value from field.getValue', ()=>{
79
+ const initialValue = 'initial-value';
80
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
81
+ return {
82
+ ...field,
83
+ id: 'field-id',
84
+ type: 'Symbol',
85
+ getValue: ()=>{
86
+ return initialValue;
87
+ }
88
+ };
89
+ });
90
+ const { getByTestId , getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
91
+ field: field,
92
+ isInitiallyDisabled: false,
93
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
94
+ }));
95
+ expect(getByTestId('cf-ui-text-input')).toHaveValue(initialValue);
96
+ expect(getByText(`${initialValue.length} characters`)).toBeInTheDocument();
97
+ expect(getByText('Maximum 256 characters')).toBeInTheDocument();
98
+ });
99
+ it('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
100
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
101
+ jest.spyOn(field, 'setValue');
102
+ jest.spyOn(field, 'removeValue');
103
+ return {
104
+ ...field,
105
+ id: 'field-id',
106
+ type: 'Symbol'
107
+ };
108
+ });
109
+ const { getByTestId } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
110
+ field: field,
111
+ isInitiallyDisabled: false,
112
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
113
+ }));
114
+ const $input = getByTestId('cf-ui-text-input');
115
+ expect($input).toHaveValue('');
116
+ _react1.fireEvent.change($input, {
117
+ target: {
118
+ value: 'new-value'
119
+ }
120
+ });
121
+ await (0, _react1.waitFor)(()=>{
122
+ expect($input).toHaveValue('new-value');
123
+ expect(field.setValue).toHaveBeenCalledTimes(1);
124
+ expect(field.setValue).toHaveBeenLastCalledWith('new-value');
125
+ });
126
+ _react1.fireEvent.change($input, {
127
+ target: {
128
+ value: ''
129
+ }
130
+ });
131
+ await (0, _react1.waitFor)(()=>{
132
+ expect($input).toHaveValue('');
133
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
134
+ expect(field.removeValue).toHaveBeenLastCalledWith();
135
+ });
136
+ });
137
+ it('shows proper validation message (Symbol)', ()=>{
138
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
139
+ return {
140
+ ...field,
141
+ type: 'Symbol',
142
+ id: 'field-id'
143
+ };
144
+ });
145
+ const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
146
+ field: field,
147
+ isInitiallyDisabled: false,
148
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
149
+ }));
150
+ expect(getByText('0 characters')).toBeInTheDocument();
151
+ expect(getByText('Maximum 256 characters')).toBeInTheDocument();
152
+ });
153
+ it('shows proper validation message (Text)', ()=>{
154
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
155
+ return {
156
+ ...field,
157
+ type: 'Text',
158
+ id: 'field-id'
159
+ };
160
+ });
161
+ const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
162
+ field: field,
163
+ isInitiallyDisabled: false,
164
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
165
+ }));
166
+ expect(getByText('0 characters')).toBeInTheDocument();
167
+ expect(getByText('Maximum 50000 characters')).toBeInTheDocument();
168
+ });
169
+ it('shows proper min-max validation message', ()=>{
170
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
171
+ return {
172
+ ...field,
173
+ type: 'Symbol',
174
+ validations: [
175
+ {
176
+ size: {
177
+ min: 100,
178
+ max: 1000
179
+ }
180
+ }
181
+ ],
182
+ id: 'field-id'
183
+ };
184
+ });
185
+ const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
186
+ field: field,
187
+ isInitiallyDisabled: false,
188
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
189
+ }));
190
+ expect(getByText('0 characters')).toBeInTheDocument();
191
+ expect(getByText('Requires between 100 and 1000 characters')).toBeInTheDocument();
192
+ });
193
+ it('shows proper min validation message', ()=>{
194
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
195
+ return {
196
+ ...field,
197
+ type: 'Symbol',
198
+ validations: [
199
+ {
200
+ size: {
201
+ min: 1000
202
+ }
203
+ }
204
+ ],
205
+ id: 'field-id'
206
+ };
207
+ });
208
+ const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
209
+ field: field,
210
+ isInitiallyDisabled: false,
211
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
212
+ }));
213
+ expect(getByText('0 characters')).toBeInTheDocument();
214
+ expect(getByText('Requires at least 1000 characters')).toBeInTheDocument();
215
+ });
216
+ it('renders no validation message if withCharValidation is falsy', ()=>{
217
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
218
+ return {
219
+ ...field,
220
+ type: 'Symbol',
221
+ validations: [
222
+ {
223
+ size: {
224
+ min: 100,
225
+ max: 1000
226
+ }
227
+ }
228
+ ],
229
+ id: 'field-id'
230
+ };
231
+ });
232
+ const { getByText , queryByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
233
+ field: field,
234
+ withCharValidation: false,
235
+ isInitiallyDisabled: false,
236
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
237
+ }));
238
+ expect(getByText('0 characters')).toBeInTheDocument();
239
+ expect(queryByText('Requires between 100 and 1000 characters')).not.toBeInTheDocument();
240
+ });
241
+ });
@@ -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,193 @@
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 identity from 'lodash/identity';
5
+ import '@testing-library/jest-dom/extend-expect';
6
+ import { SingleLineEditor } from './SingleLineEditor';
7
+ configure({
8
+ testIdAttribute: 'data-test-id'
9
+ });
10
+ jest.mock('lodash/throttle', ()=>({
11
+ default: identity
12
+ }), {
13
+ virtual: true
14
+ });
15
+ describe('SingleLineEditor', ()=>{
16
+ afterEach(cleanup);
17
+ it('renders without crashing', ()=>{
18
+ const [field] = createFakeFieldAPI((field)=>{
19
+ return {
20
+ ...field,
21
+ type: 'Symbol'
22
+ };
23
+ });
24
+ render(React.createElement(SingleLineEditor, {
25
+ field: field,
26
+ isInitiallyDisabled: false,
27
+ locales: createFakeLocalesAPI()
28
+ }));
29
+ });
30
+ it('reads initial value from field.getValue', ()=>{
31
+ const initialValue = 'initial-value';
32
+ const [field] = createFakeFieldAPI((field)=>{
33
+ return {
34
+ ...field,
35
+ id: 'field-id',
36
+ type: 'Symbol',
37
+ getValue: ()=>{
38
+ return initialValue;
39
+ }
40
+ };
41
+ });
42
+ const { getByTestId , getByText } = render(React.createElement(SingleLineEditor, {
43
+ field: field,
44
+ isInitiallyDisabled: false,
45
+ locales: createFakeLocalesAPI()
46
+ }));
47
+ expect(getByTestId('cf-ui-text-input')).toHaveValue(initialValue);
48
+ expect(getByText(`${initialValue.length} characters`)).toBeInTheDocument();
49
+ expect(getByText('Maximum 256 characters')).toBeInTheDocument();
50
+ });
51
+ it('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
52
+ const [field] = createFakeFieldAPI((field)=>{
53
+ jest.spyOn(field, 'setValue');
54
+ jest.spyOn(field, 'removeValue');
55
+ return {
56
+ ...field,
57
+ id: 'field-id',
58
+ type: 'Symbol'
59
+ };
60
+ });
61
+ const { getByTestId } = render(React.createElement(SingleLineEditor, {
62
+ field: field,
63
+ isInitiallyDisabled: false,
64
+ locales: createFakeLocalesAPI()
65
+ }));
66
+ const $input = getByTestId('cf-ui-text-input');
67
+ expect($input).toHaveValue('');
68
+ fireEvent.change($input, {
69
+ target: {
70
+ value: 'new-value'
71
+ }
72
+ });
73
+ await waitFor(()=>{
74
+ expect($input).toHaveValue('new-value');
75
+ expect(field.setValue).toHaveBeenCalledTimes(1);
76
+ expect(field.setValue).toHaveBeenLastCalledWith('new-value');
77
+ });
78
+ fireEvent.change($input, {
79
+ target: {
80
+ value: ''
81
+ }
82
+ });
83
+ await waitFor(()=>{
84
+ expect($input).toHaveValue('');
85
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
86
+ expect(field.removeValue).toHaveBeenLastCalledWith();
87
+ });
88
+ });
89
+ it('shows proper validation message (Symbol)', ()=>{
90
+ const [field] = createFakeFieldAPI((field)=>{
91
+ return {
92
+ ...field,
93
+ type: 'Symbol',
94
+ id: 'field-id'
95
+ };
96
+ });
97
+ const { getByText } = render(React.createElement(SingleLineEditor, {
98
+ field: field,
99
+ isInitiallyDisabled: false,
100
+ locales: createFakeLocalesAPI()
101
+ }));
102
+ expect(getByText('0 characters')).toBeInTheDocument();
103
+ expect(getByText('Maximum 256 characters')).toBeInTheDocument();
104
+ });
105
+ it('shows proper validation message (Text)', ()=>{
106
+ const [field] = createFakeFieldAPI((field)=>{
107
+ return {
108
+ ...field,
109
+ type: 'Text',
110
+ id: 'field-id'
111
+ };
112
+ });
113
+ const { getByText } = render(React.createElement(SingleLineEditor, {
114
+ field: field,
115
+ isInitiallyDisabled: false,
116
+ locales: createFakeLocalesAPI()
117
+ }));
118
+ expect(getByText('0 characters')).toBeInTheDocument();
119
+ expect(getByText('Maximum 50000 characters')).toBeInTheDocument();
120
+ });
121
+ it('shows proper min-max validation message', ()=>{
122
+ const [field] = createFakeFieldAPI((field)=>{
123
+ return {
124
+ ...field,
125
+ type: 'Symbol',
126
+ validations: [
127
+ {
128
+ size: {
129
+ min: 100,
130
+ max: 1000
131
+ }
132
+ }
133
+ ],
134
+ id: 'field-id'
135
+ };
136
+ });
137
+ const { getByText } = render(React.createElement(SingleLineEditor, {
138
+ field: field,
139
+ isInitiallyDisabled: false,
140
+ locales: createFakeLocalesAPI()
141
+ }));
142
+ expect(getByText('0 characters')).toBeInTheDocument();
143
+ expect(getByText('Requires between 100 and 1000 characters')).toBeInTheDocument();
144
+ });
145
+ it('shows proper min validation message', ()=>{
146
+ const [field] = createFakeFieldAPI((field)=>{
147
+ return {
148
+ ...field,
149
+ type: 'Symbol',
150
+ validations: [
151
+ {
152
+ size: {
153
+ min: 1000
154
+ }
155
+ }
156
+ ],
157
+ id: 'field-id'
158
+ };
159
+ });
160
+ const { getByText } = render(React.createElement(SingleLineEditor, {
161
+ field: field,
162
+ isInitiallyDisabled: false,
163
+ locales: createFakeLocalesAPI()
164
+ }));
165
+ expect(getByText('0 characters')).toBeInTheDocument();
166
+ expect(getByText('Requires at least 1000 characters')).toBeInTheDocument();
167
+ });
168
+ it('renders no validation message if withCharValidation is falsy', ()=>{
169
+ const [field] = createFakeFieldAPI((field)=>{
170
+ return {
171
+ ...field,
172
+ type: 'Symbol',
173
+ validations: [
174
+ {
175
+ size: {
176
+ min: 100,
177
+ max: 1000
178
+ }
179
+ }
180
+ ],
181
+ id: 'field-id'
182
+ };
183
+ });
184
+ const { getByText , queryByText } = render(React.createElement(SingleLineEditor, {
185
+ field: field,
186
+ withCharValidation: false,
187
+ isInitiallyDisabled: false,
188
+ locales: createFakeLocalesAPI()
189
+ }));
190
+ expect(getByText('0 characters')).toBeInTheDocument();
191
+ expect(queryByText('Requires between 100 and 1000 characters')).not.toBeInTheDocument();
192
+ });
193
+ });
@@ -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.1.11",
4
- "main": "dist/index.js",
5
- "module": "dist/field-editor-single-line.esm.js",
6
- "typings": "dist/index.d.ts",
3
+ "version": "1.3.0",
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,31 @@
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.1.8",
40
+ "@contentful/field-editor-shared": "^1.3.0",
27
41
  "emotion": "^10.0.17",
28
42
  "lodash": "^4.17.15",
29
43
  "lodash-es": "^4.17.15"
30
44
  },
31
45
  "devDependencies": {
32
- "@contentful/field-editor-test-utils": "^1.2.7"
46
+ "@contentful/field-editor-test-utils": "^1.4.0"
33
47
  },
34
48
  "peerDependencies": {
35
49
  "react": ">=16.8.0"
36
50
  },
37
- "gitHead": "4fff7b9534374dcc44cb477240d369fc34f46415"
51
+ "gitHead": "543e02672a8dd4edc810f9f3568d6b69c454e1f9"
38
52
  }
package/CHANGELOG.md DELETED
@@ -1,194 +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.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)
7
-
8
- **Note:** Version bump only for package @contentful/field-editor-single-line
9
-
10
- ## [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)
11
-
12
- ### Bug Fixes
13
-
14
- - support disabling single line editor ([#1367](https://github.com/contentful/field-editors/issues/1367)) ([f8314ff](https://github.com/contentful/field-editors/commit/f8314fff446a3dcb482835424c7fca66c4f87f20))
15
-
16
- ## [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)
17
-
18
- **Note:** Version bump only for package @contentful/field-editor-single-line
19
-
20
- ## [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)
21
-
22
- **Note:** Version bump only for package @contentful/field-editor-single-line
23
-
24
- ## [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)
25
-
26
- **Note:** Version bump only for package @contentful/field-editor-single-line
27
-
28
- ## [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)
29
-
30
- **Note:** Version bump only for package @contentful/field-editor-single-line
31
-
32
- ## [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)
33
-
34
- **Note:** Version bump only for package @contentful/field-editor-single-line
35
-
36
- ## [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)
37
-
38
- **Note:** Version bump only for package @contentful/field-editor-single-line
39
-
40
- ## [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)
41
-
42
- **Note:** Version bump only for package @contentful/field-editor-single-line
43
-
44
- ## [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)
45
-
46
- ### Bug Fixes
47
-
48
- - bump f36 packages ([#1025](https://github.com/contentful/field-editors/issues/1025)) ([ec37a40](https://github.com/contentful/field-editors/commit/ec37a4000db7cd75c66dd9621136b2272c9feeea))
49
-
50
- ## [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)
51
-
52
- **Note:** Version bump only for package @contentful/field-editor-single-line
53
-
54
- # [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)
55
-
56
- ### Features
57
-
58
- - 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))
59
-
60
- ## [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)
61
-
62
- ### Bug Fixes
63
-
64
- - markdown buttons ([#968](https://github.com/contentful/field-editors/issues/968)) ([9803b98](https://github.com/contentful/field-editors/commit/9803b98c25d92df6148686ffe2749a77f7efdbb9))
65
-
66
- ## [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)
67
-
68
- **Note:** Version bump only for package @contentful/field-editor-single-line
69
-
70
- ## [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)
71
-
72
- ### Bug Fixes
73
-
74
- - **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))
75
-
76
- # [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)
77
-
78
- **Note:** Version bump only for package @contentful/field-editor-single-line
79
-
80
- # [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)
81
-
82
- ### Features
83
-
84
- - Forma v4 components adoption ([#805](https://github.com/contentful/field-editors/issues/805)) ([526bde6](https://github.com/contentful/field-editors/commit/526bde6e10e0ee3789705ec10fb31489af7ca59e))
85
-
86
- ### BREAKING CHANGES
87
-
88
- - adopts a new Forma v4 beta
89
-
90
- ## [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)
91
-
92
- **Note:** Version bump only for package @contentful/field-editor-single-line
93
-
94
- ## [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)
95
-
96
- **Note:** Version bump only for package @contentful/field-editor-single-line
97
-
98
- ## [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)
99
-
100
- **Note:** Version bump only for package @contentful/field-editor-single-line
101
-
102
- ## [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)
103
-
104
- **Note:** Version bump only for package @contentful/field-editor-single-line
105
-
106
- ## [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)
107
-
108
- **Note:** Version bump only for package @contentful/field-editor-single-line
109
-
110
- ## [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)
111
-
112
- **Note:** Version bump only for package @contentful/field-editor-single-line
113
-
114
- # [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)
115
-
116
- ### Features
117
-
118
- - 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
119
-
120
- ## [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)
121
-
122
- **Note:** Version bump only for package @contentful/field-editor-single-line
123
-
124
- ## [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)
125
-
126
- **Note:** Version bump only for package @contentful/field-editor-single-line
127
-
128
- ## [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)
129
-
130
- **Note:** Version bump only for package @contentful/field-editor-single-line
131
-
132
- ## [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)
133
-
134
- **Note:** Version bump only for package @contentful/field-editor-single-line
135
-
136
- ## [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)
137
-
138
- **Note:** Version bump only for package @contentful/field-editor-single-line
139
-
140
- ## [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)
141
-
142
- **Note:** Version bump only for package @contentful/field-editor-single-line
143
-
144
- # [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)
145
-
146
- ### Features
147
-
148
- - bump min version of forma-36 ([#606](https://github.com/contentful/field-editors/issues/606)) ([fd57c7a](https://github.com/contentful/field-editors/commit/fd57c7a4312766af38c01507f17706ab22992617))
149
-
150
- ## [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)
151
-
152
- **Note:** Version bump only for package @contentful/field-editor-single-line
153
-
154
- ## [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)
155
-
156
- **Note:** Version bump only for package @contentful/field-editor-single-line
157
-
158
- # [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)
159
-
160
- ### Features
161
-
162
- - 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))
163
-
164
- # [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)
165
-
166
- ### Features
167
-
168
- - 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))
169
-
170
- ## [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)
171
-
172
- **Note:** Version bump only for package @contentful/field-editor-single-line
173
-
174
- ## [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)
175
-
176
- **Note:** Version bump only for package @contentful/field-editor-single-line
177
-
178
- ## [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)
179
-
180
- **Note:** Version bump only for package @contentful/field-editor-single-line
181
-
182
- ## [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)
183
-
184
- **Note:** Version bump only for package @contentful/field-editor-single-line
185
-
186
- # [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)
187
-
188
- ### Features
189
-
190
- - 🎸 add withCharValidation property to hide validation ([#390](https://github.com/contentful/field-editors/issues/390)) ([9da6700](https://github.com/contentful/field-editors/commit/9da67005f83c1cebdabb67edfed73f7d1dcbfc04))
191
-
192
- ## [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)
193
-
194
- **Note:** Version bump only for package @contentful/field-editor-single-line
@@ -1,82 +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 fieldEditorShared = require('@contentful/field-editor-shared');
9
- var emotion = require('emotion');
10
- var tokens = _interopDefault(require('@contentful/f36-tokens'));
11
- var f36Components = require('@contentful/f36-components');
12
-
13
- var 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
- var 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
- var field = props.field,
30
- locales = props.locales;
31
-
32
- if (!isSupportedFieldTypes(field.type)) {
33
- throw new Error("\"" + field.type + "\" field type is not supported by SingleLineEditor");
34
- }
35
-
36
- var constraints = fieldEditorShared.ConstraintsUtils.fromFieldValidations(field.validations, field.type);
37
- var checkConstraint = fieldEditorShared.ConstraintsUtils.makeChecker(constraints);
38
- var direction = locales.direction[field.locale] || 'ltr';
39
- return React.createElement(fieldEditorShared.FieldConnector, {
40
- field: field,
41
- isInitiallyDisabled: props.isInitiallyDisabled,
42
- isDisabled: props.isDisabled
43
- }, function (_ref) {
44
- var value = _ref.value,
45
- errors = _ref.errors,
46
- disabled = _ref.disabled,
47
- setValue = _ref.setValue;
48
- return React.createElement("div", {
49
- "data-test-id": "single-line-editor"
50
- }, React.createElement(f36Components.TextInput, {
51
- className: direction === 'rtl' ? rightToLeft : '',
52
- isRequired: field.required,
53
- isInvalid: errors.length > 0,
54
- isDisabled: disabled,
55
- value: value || '',
56
- onChange: function onChange(e) {
57
- setValue(e.target.value);
58
- }
59
- }), props.withCharValidation && React.createElement("div", {
60
- className: validationRow
61
- }, React.createElement(fieldEditorShared.CharCounter, {
62
- value: value || '',
63
- checkConstraint: checkConstraint
64
- }), React.createElement(fieldEditorShared.CharValidation, {
65
- constraints: constraints
66
- })), props.withCharValidation === false && React.createElement("div", {
67
- className: validationRow
68
- }, React.createElement(fieldEditorShared.CharCounter, {
69
- value: value || '',
70
- checkConstraint: function checkConstraint() {
71
- return true;
72
- }
73
- })));
74
- });
75
- }
76
- SingleLineEditor.defaultProps = {
77
- isInitiallyDisabled: true,
78
- withCharValidation: true
79
- };
80
-
81
- exports.SingleLineEditor = SingleLineEditor;
82
- //# 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 { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\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';\nimport {\n FieldAPI,\n FieldConnector,\n ConstraintsUtils,\n CharCounter,\n CharValidation,\n LocalesAPI,\n} from '@contentful/field-editor-shared';\nimport * as styles from './styles';\n\nimport { TextInput } from '@contentful/f36-components';\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,IAAMA,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,IAAMC,WAAW,gBAAGV,WAAG,CAAC;AAC7BW,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;;AC4BP,SAASC,qBAAT,CAA+BC,GAA/B;AACE,SAAOA,GAAG,KAAK,QAAR,IAAoBA,GAAG,KAAK,MAAnC;AACD;;AAED,SAAgBC,iBAAiBC;AAC/B,MAAQC,KAAR,GAA2BD,KAA3B,CAAQC,KAAR;AAAA,MAAeC,OAAf,GAA2BF,KAA3B,CAAeE,OAAf;;AAEA,MAAI,CAACL,qBAAqB,CAACI,KAAK,CAACE,IAAP,CAA1B,EAAwC;AACtC,UAAM,IAAIC,KAAJ,QAAcH,KAAK,CAACE,IAApB,wDAAN;AACD;;AAED,MAAME,WAAW,GAAGC,kCAAgB,CAACC,oBAAjB,CAAsCN,KAAK,CAACO,WAA5C,EAAyDP,KAAK,CAACE,IAA/D,CAApB;AACA,MAAMM,eAAe,GAAGH,kCAAgB,CAACI,WAAjB,CAA6BL,WAA7B,CAAxB;AACA,MAAMT,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;QAAGC,aAAAA;QAAOC,cAAAA;QAAQC,gBAAAA;QAAUC,gBAAAA;AAC3B,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,EAAE,kBAACC,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;AAAA,eAAM,IAAN;AAAA;KAAlD,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/field-editor-shared"),a=require("emotion"),n=(e=require("@contentful/f36-tokens"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("@contentful/f36-components"),l=a.css({display:"flex",justifyContent:"space-between",fontSize:n.fontSizeM,marginTop:n.spacingXs,color:n.gray700}),s=a.css({direction:"rtl"});function o(e){var a,n=e.field,o=e.locales;if("Symbol"!==(a=n.type)&&"Text"!==a)throw new Error('"'+n.type+'" field type is not supported by SingleLineEditor');var d=i.ConstraintsUtils.fromFieldValidations(n.validations,n.type),c=i.ConstraintsUtils.makeChecker(d),u=o.direction[n.locale]||"ltr";return t.createElement(i.FieldConnector,{field:n,isInitiallyDisabled:e.isInitiallyDisabled,isDisabled:e.isDisabled},(function(a){var o=a.value,f=a.setValue;return t.createElement("div",{"data-test-id":"single-line-editor"},t.createElement(r.TextInput,{className:"rtl"===u?s:"",isRequired:n.required,isInvalid:a.errors.length>0,isDisabled:a.disabled,value:o||"",onChange:function(e){f(e.target.value)}}),e.withCharValidation&&t.createElement("div",{className:l},t.createElement(i.CharCounter,{value:o||"",checkConstraint:c}),t.createElement(i.CharValidation,{constraints:d})),!1===e.withCharValidation&&t.createElement("div",{className:l},t.createElement(i.CharCounter,{value:o||"",checkConstraint:function(){return!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 { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\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';\nimport {\n FieldAPI,\n FieldConnector,\n ConstraintsUtils,\n CharCounter,\n CharValidation,\n LocalesAPI,\n} from '@contentful/field-editor-shared';\nimport * as styles from './styles';\n\nimport { TextInput } from '@contentful/f36-components';\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","val","field","locales","type","Error","constraints","ConstraintsUtils","fromFieldValidations","validations","checkConstraint","makeChecker","locale","React","FieldConnector","isInitiallyDisabled","isDisabled","value","setValue","TextInput","className","styles","isRequired","required","isInvalid","errors","length","disabled","onChange","e","target","withCharValidation","CharCounter","CharValidation","defaultProps"],"mappings":"8RAGaA,EAAgBC,MAAI,CAC/BC,QAAS,OACTC,eAAgB,gBAChBC,SAAUC,EAAOC,UACjBC,UAAWF,EAAOG,UAClBC,MAAOJ,EAAOK,UAGHC,EAAcV,MAAI,CAC7BW,UAAW,iBC+BGC,EAAiBC,OAJFC,EAKrBC,EAAmBF,EAAnBE,MAAOC,EAAYH,EAAZG,WAJA,YADcF,EAOFC,EAAME,OANE,SAARH,QAOnB,IAAII,UAAUH,EAAME,8DAGtBE,EAAcC,mBAAiBC,qBAAqBN,EAAMO,YAAaP,EAAME,MAC7EM,EAAkBH,mBAAiBI,YAAYL,GAC/CR,EAAYK,EAAQL,UAAUI,EAAMU,SAAW,aAGnDC,gBAACC,kBACCZ,MAAOA,EACPa,oBAAqBf,EAAMe,oBAC3BC,WAAYhB,EAAMgB,aACjB,gBAAGC,IAAAA,MAAyBC,IAAAA,gBAEzBL,sCAAkB,sBAChBA,gBAACM,aACCC,UAAyB,QAAdtB,EAAsBuB,EAAqB,GACtDC,WAAYpB,EAAMqB,SAClBC,YANGC,OAMeC,OAAS,EAC3BV,aAPWW,SAQXV,MAAOA,GAAS,GAChBW,SAAU,SAACC,GACTX,EAASW,EAAEC,OAAOb,UAGrBjB,EAAM+B,oBACLlB,uBAAKO,UAAWC,GACdR,gBAACmB,eAAYf,MAAOA,GAAS,GAAIP,gBAAiBA,IAClDG,gBAACoB,kBAAe3B,YAAaA,MAGH,IAA7BN,EAAM+B,oBACLlB,uBAAKO,UAAWC,GACdR,gBAACmB,eAAYf,MAAOA,GAAS,GAAIP,gBAAiB,kBAAM,UAUxEX,EAAiBmC,aAAe,CAC9BnB,qBAAqB,EACrBgB,oBAAoB"}
@@ -1,76 +0,0 @@
1
- import { createElement } from 'react';
2
- import { ConstraintsUtils, FieldConnector, CharCounter, CharValidation } from '@contentful/field-editor-shared';
3
- import { css } from 'emotion';
4
- import tokens from '@contentful/f36-tokens';
5
- import { TextInput } from '@contentful/f36-components';
6
-
7
- var validationRow = /*#__PURE__*/css({
8
- display: 'flex',
9
- justifyContent: 'space-between',
10
- fontSize: tokens.fontSizeM,
11
- marginTop: tokens.spacingXs,
12
- color: tokens.gray700
13
- });
14
- var 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
- var field = props.field,
24
- locales = props.locales;
25
-
26
- if (!isSupportedFieldTypes(field.type)) {
27
- throw new Error("\"" + field.type + "\" field type is not supported by SingleLineEditor");
28
- }
29
-
30
- var constraints = ConstraintsUtils.fromFieldValidations(field.validations, field.type);
31
- var checkConstraint = ConstraintsUtils.makeChecker(constraints);
32
- var direction = locales.direction[field.locale] || 'ltr';
33
- return createElement(FieldConnector, {
34
- field: field,
35
- isInitiallyDisabled: props.isInitiallyDisabled,
36
- isDisabled: props.isDisabled
37
- }, function (_ref) {
38
- var value = _ref.value,
39
- errors = _ref.errors,
40
- disabled = _ref.disabled,
41
- setValue = _ref.setValue;
42
- return createElement("div", {
43
- "data-test-id": "single-line-editor"
44
- }, createElement(TextInput, {
45
- className: direction === 'rtl' ? rightToLeft : '',
46
- isRequired: field.required,
47
- isInvalid: errors.length > 0,
48
- isDisabled: disabled,
49
- value: value || '',
50
- onChange: function onChange(e) {
51
- setValue(e.target.value);
52
- }
53
- }), props.withCharValidation && createElement("div", {
54
- className: validationRow
55
- }, createElement(CharCounter, {
56
- value: value || '',
57
- checkConstraint: checkConstraint
58
- }), createElement(CharValidation, {
59
- constraints: constraints
60
- })), props.withCharValidation === false && createElement("div", {
61
- className: validationRow
62
- }, createElement(CharCounter, {
63
- value: value || '',
64
- checkConstraint: function checkConstraint() {
65
- return true;
66
- }
67
- })));
68
- });
69
- }
70
- SingleLineEditor.defaultProps = {
71
- isInitiallyDisabled: true,
72
- withCharValidation: true
73
- };
74
-
75
- export { SingleLineEditor };
76
- //# 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 { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\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';\nimport {\n FieldAPI,\n FieldConnector,\n ConstraintsUtils,\n CharCounter,\n CharValidation,\n LocalesAPI,\n} from '@contentful/field-editor-shared';\nimport * as styles from './styles';\n\nimport { TextInput } from '@contentful/f36-components';\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,IAAMA,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,IAAMC,WAAW,gBAAGV,GAAG,CAAC;AAC7BW,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;;AC4BP,SAASC,qBAAT,CAA+BC,GAA/B;AACE,SAAOA,GAAG,KAAK,QAAR,IAAoBA,GAAG,KAAK,MAAnC;AACD;;AAED,SAAgBC,iBAAiBC;AAC/B,MAAQC,KAAR,GAA2BD,KAA3B,CAAQC,KAAR;AAAA,MAAeC,OAAf,GAA2BF,KAA3B,CAAeE,OAAf;;AAEA,MAAI,CAACL,qBAAqB,CAACI,KAAK,CAACE,IAAP,CAA1B,EAAwC;AACtC,UAAM,IAAIC,KAAJ,QAAcH,KAAK,CAACE,IAApB,wDAAN;AACD;;AAED,MAAME,WAAW,GAAGC,gBAAgB,CAACC,oBAAjB,CAAsCN,KAAK,CAACO,WAA5C,EAAyDP,KAAK,CAACE,IAA/D,CAApB;AACA,MAAMM,eAAe,GAAGH,gBAAgB,CAACI,WAAjB,CAA6BL,WAA7B,CAAxB;AACA,MAAMT,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;QAAGC,aAAAA;QAAOC,cAAAA;QAAQC,gBAAAA;QAAUC,gBAAAA;AAC3B,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,EAAE,kBAACC,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;AAAA,eAAM,IAAN;AAAA;KAAlD,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
- }