@contentful/field-editor-radio 1.1.12 → 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,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "RadioEditor", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return RadioEditor;
9
+ }
10
+ });
11
+ const _react = _interop_require_wildcard(require("react"));
12
+ const _f36components = require("@contentful/f36-components");
13
+ const _fieldeditordropdown = require("@contentful/field-editor-dropdown");
14
+ const _fieldeditorshared = require("@contentful/field-editor-shared");
15
+ const _emotion = require("emotion");
16
+ const _styles = _interop_require_wildcard(require("./styles"));
17
+ function _getRequireWildcardCache(nodeInterop) {
18
+ if (typeof WeakMap !== "function") return null;
19
+ var cacheBabelInterop = new WeakMap();
20
+ var cacheNodeInterop = new WeakMap();
21
+ return (_getRequireWildcardCache = function(nodeInterop) {
22
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
23
+ })(nodeInterop);
24
+ }
25
+ function _interop_require_wildcard(obj, nodeInterop) {
26
+ if (!nodeInterop && obj && obj.__esModule) {
27
+ return obj;
28
+ }
29
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
30
+ return {
31
+ default: obj
32
+ };
33
+ }
34
+ var cache = _getRequireWildcardCache(nodeInterop);
35
+ if (cache && cache.has(obj)) {
36
+ return cache.get(obj);
37
+ }
38
+ var newObj = {};
39
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
40
+ for(var key in obj){
41
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
42
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
43
+ if (desc && (desc.get || desc.set)) {
44
+ Object.defineProperty(newObj, key, desc);
45
+ } else {
46
+ newObj[key] = obj[key];
47
+ }
48
+ }
49
+ }
50
+ newObj.default = obj;
51
+ if (cache) {
52
+ cache.set(obj, newObj);
53
+ }
54
+ return newObj;
55
+ }
56
+ function RadioEditor(props) {
57
+ const { field , locales } = props;
58
+ const options = (0, _fieldeditordropdown.getOptions)(field);
59
+ const misconfigured = options.length === 0;
60
+ if (misconfigured) {
61
+ return _react.createElement(_fieldeditorshared.PredefinedValuesError, null);
62
+ }
63
+ const direction = locales.direction[field.locale] || 'ltr';
64
+ return _react.createElement(_fieldeditorshared.FieldConnector, {
65
+ throttle: 0,
66
+ field: field,
67
+ isInitiallyDisabled: props.isInitiallyDisabled
68
+ }, ({ disabled , value , setValue })=>{
69
+ const setOption = (value)=>{
70
+ setValue((0, _fieldeditordropdown.parseValue)(value, field.type));
71
+ };
72
+ const clearOption = ()=>{
73
+ setValue(undefined);
74
+ };
75
+ return _react.createElement(_f36components.Form, {
76
+ testId: "radio-editor",
77
+ className: (0, _emotion.cx)(_styles.form, direction === 'rtl' ? _styles.rightToLeft : '')
78
+ }, options.map((item, index)=>{
79
+ const id = [
80
+ 'entity',
81
+ field.id,
82
+ field.locale,
83
+ index,
84
+ item.id
85
+ ].join('.');
86
+ const checked = value === item.value;
87
+ return _react.createElement(_f36components.Flex, {
88
+ key: id,
89
+ alignItems: "center",
90
+ marginBottom: "spacingS"
91
+ }, _react.createElement(_f36components.Radio, {
92
+ id: id,
93
+ isDisabled: disabled,
94
+ value: item.value === undefined ? '' : String(item.value),
95
+ isChecked: checked,
96
+ onChange: (e)=>{
97
+ if (e.target.checked) {
98
+ setOption(e.target.value);
99
+ }
100
+ }
101
+ }, item.label), checked && !disabled && _react.createElement(_f36components.TextLink, {
102
+ as: "button",
103
+ className: _styles.clearBtn,
104
+ onClick: clearOption
105
+ }, "Clear"));
106
+ }));
107
+ });
108
+ }
109
+ RadioEditor.defaultProps = {
110
+ isInitiallyDisabled: true
111
+ };
@@ -0,0 +1,209 @@
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
+ require("@testing-library/jest-dom/extend-expect");
8
+ const _react1 = require("@testing-library/react");
9
+ const _RadioEditor = require("./RadioEditor");
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('RadioEditor', ()=>{
53
+ afterEach(_react1.cleanup);
54
+ it('renders a warning if no options are present', ()=>{
55
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((mock)=>{
56
+ return {
57
+ ...mock,
58
+ validations: []
59
+ };
60
+ });
61
+ const { getByTestId , queryByTestId } = (0, _react1.render)(_react.createElement(_RadioEditor.RadioEditor, {
62
+ field: field,
63
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)(),
64
+ isInitiallyDisabled: false
65
+ }));
66
+ expect(getByTestId('predefined-values-warning')).toBeInTheDocument();
67
+ expect(queryByTestId('radio-editor')).not.toBeInTheDocument();
68
+ });
69
+ it('renders inputs for predefined values', ()=>{
70
+ const predefined = [
71
+ 'banana',
72
+ 'orange',
73
+ 'strawberry'
74
+ ];
75
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((mock)=>{
76
+ return {
77
+ ...mock,
78
+ validations: [
79
+ {
80
+ in: predefined
81
+ }
82
+ ]
83
+ };
84
+ });
85
+ const { container } = (0, _react1.render)(_react.createElement(_RadioEditor.RadioEditor, {
86
+ field: field,
87
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)(),
88
+ isInitiallyDisabled: false
89
+ }));
90
+ const $inputs = container.querySelectorAll('input[type="radio"]');
91
+ expect($inputs).toHaveLength(3);
92
+ predefined.forEach((item, index)=>{
93
+ expect($inputs[index].value).toEqual(item);
94
+ });
95
+ });
96
+ it('calls setValue and removeValue properly', ()=>{
97
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
98
+ jest.spyOn(field, 'setValue');
99
+ jest.spyOn(field, 'removeValue');
100
+ return {
101
+ ...field,
102
+ validations: [
103
+ {
104
+ in: [
105
+ 'banana',
106
+ 'orange',
107
+ 'strawberry'
108
+ ]
109
+ }
110
+ ]
111
+ };
112
+ });
113
+ const { container , queryByText , getByText } = (0, _react1.render)(_react.createElement(_RadioEditor.RadioEditor, {
114
+ field: field,
115
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)(),
116
+ isInitiallyDisabled: false
117
+ }));
118
+ expect(queryByText('Clear')).not.toBeInTheDocument();
119
+ const $inputs = container.querySelectorAll('input[type="radio"]');
120
+ _react1.fireEvent.click($inputs[0]);
121
+ expect(field.setValue).toHaveBeenCalledWith('banana');
122
+ _react1.fireEvent.click($inputs[1]);
123
+ expect(field.setValue).toHaveBeenCalledWith('orange');
124
+ expect(field.removeValue).toHaveBeenCalledTimes(0);
125
+ _react1.fireEvent.click(getByText('Clear'));
126
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
127
+ });
128
+ describe('Number field', ()=>{
129
+ it('calls setValue and removeValue properly', function() {
130
+ const predefined = [
131
+ 1,
132
+ '2.71',
133
+ '0'
134
+ ];
135
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
136
+ jest.spyOn(field, 'setValue');
137
+ jest.spyOn(field, 'removeValue');
138
+ return {
139
+ ...field,
140
+ type: 'Number',
141
+ validations: [
142
+ {
143
+ in: predefined
144
+ }
145
+ ]
146
+ };
147
+ });
148
+ const { container , getByText } = (0, _react1.render)(_react.createElement(_RadioEditor.RadioEditor, {
149
+ field: field,
150
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)(),
151
+ isInitiallyDisabled: false
152
+ }));
153
+ const $inputs = container.querySelectorAll('input[type="radio"]');
154
+ _react1.fireEvent.click($inputs[0]);
155
+ expect(field.setValue).toHaveBeenCalledWith(1);
156
+ expect(field.setValue).toHaveBeenCalledTimes(1);
157
+ _react1.fireEvent.click($inputs[1]);
158
+ expect(field.setValue).toHaveBeenCalledWith(2.71);
159
+ expect(field.setValue).toHaveBeenCalledTimes(2);
160
+ _react1.fireEvent.click($inputs[2]);
161
+ expect(field.setValue).toHaveBeenCalledWith(0);
162
+ expect(field.setValue).toHaveBeenCalledTimes(3);
163
+ expect(field.removeValue).toHaveBeenCalledTimes(0);
164
+ _react1.fireEvent.click(getByText('Clear'));
165
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
166
+ });
167
+ });
168
+ describe('Integer field', ()=>{
169
+ it('calls setValue and removeValue properly', function() {
170
+ const predefined = [
171
+ 0,
172
+ '65',
173
+ '99',
174
+ 100
175
+ ];
176
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
177
+ jest.spyOn(field, 'setValue');
178
+ jest.spyOn(field, 'removeValue');
179
+ return {
180
+ ...field,
181
+ type: 'Number',
182
+ validations: [
183
+ {
184
+ in: predefined
185
+ }
186
+ ]
187
+ };
188
+ });
189
+ const { container , getByText } = (0, _react1.render)(_react.createElement(_RadioEditor.RadioEditor, {
190
+ field: field,
191
+ locales: (0, _fieldeditortestutils.createFakeLocalesAPI)(),
192
+ isInitiallyDisabled: false
193
+ }));
194
+ const $inputs = container.querySelectorAll('input[type="radio"]');
195
+ _react1.fireEvent.click($inputs[0]);
196
+ expect(field.setValue).toHaveBeenCalledWith(0);
197
+ expect(field.setValue).toHaveBeenCalledTimes(1);
198
+ _react1.fireEvent.click($inputs[1]);
199
+ expect(field.setValue).toHaveBeenCalledWith(65);
200
+ expect(field.setValue).toHaveBeenCalledTimes(2);
201
+ _react1.fireEvent.click($inputs[2]);
202
+ expect(field.setValue).toHaveBeenCalledWith(99);
203
+ expect(field.setValue).toHaveBeenCalledTimes(3);
204
+ expect(field.removeValue).toHaveBeenCalledTimes(0);
205
+ _react1.fireEvent.click(getByText('Clear'));
206
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
207
+ });
208
+ });
209
+ });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "RadioEditor", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _RadioEditor.RadioEditor;
9
+ }
10
+ });
11
+ const _RadioEditor = require("./RadioEditor");
@@ -0,0 +1,37 @@
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
+ form: function() {
13
+ return form;
14
+ },
15
+ rightToLeft: function() {
16
+ return rightToLeft;
17
+ },
18
+ clearBtn: function() {
19
+ return clearBtn;
20
+ }
21
+ });
22
+ const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
23
+ const _emotion = require("emotion");
24
+ function _interop_require_default(obj) {
25
+ return obj && obj.__esModule ? obj : {
26
+ default: obj
27
+ };
28
+ }
29
+ const form = (0, _emotion.css)({
30
+ marginTop: _f36tokens.default.spacingS
31
+ });
32
+ const rightToLeft = (0, _emotion.css)({
33
+ direction: 'rtl'
34
+ });
35
+ const clearBtn = (0, _emotion.css)({
36
+ marginLeft: _f36tokens.default.spacingL
37
+ });
@@ -0,0 +1,62 @@
1
+ import * as React from 'react';
2
+ import { TextLink, Flex, Radio, Form } from '@contentful/f36-components';
3
+ import { getOptions, parseValue } from '@contentful/field-editor-dropdown';
4
+ import { FieldConnector, PredefinedValuesError } from '@contentful/field-editor-shared';
5
+ import { cx } from 'emotion';
6
+ import * as styles from './styles';
7
+ export function RadioEditor(props) {
8
+ const { field , locales } = props;
9
+ const options = getOptions(field);
10
+ const misconfigured = options.length === 0;
11
+ if (misconfigured) {
12
+ return React.createElement(PredefinedValuesError, null);
13
+ }
14
+ const direction = locales.direction[field.locale] || 'ltr';
15
+ return React.createElement(FieldConnector, {
16
+ throttle: 0,
17
+ field: field,
18
+ isInitiallyDisabled: props.isInitiallyDisabled
19
+ }, ({ disabled , value , setValue })=>{
20
+ const setOption = (value)=>{
21
+ setValue(parseValue(value, field.type));
22
+ };
23
+ const clearOption = ()=>{
24
+ setValue(undefined);
25
+ };
26
+ return React.createElement(Form, {
27
+ testId: "radio-editor",
28
+ className: cx(styles.form, direction === 'rtl' ? styles.rightToLeft : '')
29
+ }, options.map((item, index)=>{
30
+ const id = [
31
+ 'entity',
32
+ field.id,
33
+ field.locale,
34
+ index,
35
+ item.id
36
+ ].join('.');
37
+ const checked = value === item.value;
38
+ return React.createElement(Flex, {
39
+ key: id,
40
+ alignItems: "center",
41
+ marginBottom: "spacingS"
42
+ }, React.createElement(Radio, {
43
+ id: id,
44
+ isDisabled: disabled,
45
+ value: item.value === undefined ? '' : String(item.value),
46
+ isChecked: checked,
47
+ onChange: (e)=>{
48
+ if (e.target.checked) {
49
+ setOption(e.target.value);
50
+ }
51
+ }
52
+ }, item.label), checked && !disabled && React.createElement(TextLink, {
53
+ as: "button",
54
+ className: styles.clearBtn,
55
+ onClick: clearOption
56
+ }, "Clear"));
57
+ }));
58
+ });
59
+ }
60
+ RadioEditor.defaultProps = {
61
+ isInitiallyDisabled: true
62
+ };
@@ -0,0 +1,166 @@
1
+ import * as React from 'react';
2
+ import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+ import { cleanup, configure, fireEvent, render } from '@testing-library/react';
5
+ import { RadioEditor } from './RadioEditor';
6
+ configure({
7
+ testIdAttribute: 'data-test-id'
8
+ });
9
+ describe('RadioEditor', ()=>{
10
+ afterEach(cleanup);
11
+ it('renders a warning if no options are present', ()=>{
12
+ const [field] = createFakeFieldAPI((mock)=>{
13
+ return {
14
+ ...mock,
15
+ validations: []
16
+ };
17
+ });
18
+ const { getByTestId , queryByTestId } = render(React.createElement(RadioEditor, {
19
+ field: field,
20
+ locales: createFakeLocalesAPI(),
21
+ isInitiallyDisabled: false
22
+ }));
23
+ expect(getByTestId('predefined-values-warning')).toBeInTheDocument();
24
+ expect(queryByTestId('radio-editor')).not.toBeInTheDocument();
25
+ });
26
+ it('renders inputs for predefined values', ()=>{
27
+ const predefined = [
28
+ 'banana',
29
+ 'orange',
30
+ 'strawberry'
31
+ ];
32
+ const [field] = createFakeFieldAPI((mock)=>{
33
+ return {
34
+ ...mock,
35
+ validations: [
36
+ {
37
+ in: predefined
38
+ }
39
+ ]
40
+ };
41
+ });
42
+ const { container } = render(React.createElement(RadioEditor, {
43
+ field: field,
44
+ locales: createFakeLocalesAPI(),
45
+ isInitiallyDisabled: false
46
+ }));
47
+ const $inputs = container.querySelectorAll('input[type="radio"]');
48
+ expect($inputs).toHaveLength(3);
49
+ predefined.forEach((item, index)=>{
50
+ expect($inputs[index].value).toEqual(item);
51
+ });
52
+ });
53
+ it('calls setValue and removeValue properly', ()=>{
54
+ const [field] = createFakeFieldAPI((field)=>{
55
+ jest.spyOn(field, 'setValue');
56
+ jest.spyOn(field, 'removeValue');
57
+ return {
58
+ ...field,
59
+ validations: [
60
+ {
61
+ in: [
62
+ 'banana',
63
+ 'orange',
64
+ 'strawberry'
65
+ ]
66
+ }
67
+ ]
68
+ };
69
+ });
70
+ const { container , queryByText , getByText } = render(React.createElement(RadioEditor, {
71
+ field: field,
72
+ locales: createFakeLocalesAPI(),
73
+ isInitiallyDisabled: false
74
+ }));
75
+ expect(queryByText('Clear')).not.toBeInTheDocument();
76
+ const $inputs = container.querySelectorAll('input[type="radio"]');
77
+ fireEvent.click($inputs[0]);
78
+ expect(field.setValue).toHaveBeenCalledWith('banana');
79
+ fireEvent.click($inputs[1]);
80
+ expect(field.setValue).toHaveBeenCalledWith('orange');
81
+ expect(field.removeValue).toHaveBeenCalledTimes(0);
82
+ fireEvent.click(getByText('Clear'));
83
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
84
+ });
85
+ describe('Number field', ()=>{
86
+ it('calls setValue and removeValue properly', function() {
87
+ const predefined = [
88
+ 1,
89
+ '2.71',
90
+ '0'
91
+ ];
92
+ const [field] = createFakeFieldAPI((field)=>{
93
+ jest.spyOn(field, 'setValue');
94
+ jest.spyOn(field, 'removeValue');
95
+ return {
96
+ ...field,
97
+ type: 'Number',
98
+ validations: [
99
+ {
100
+ in: predefined
101
+ }
102
+ ]
103
+ };
104
+ });
105
+ const { container , getByText } = render(React.createElement(RadioEditor, {
106
+ field: field,
107
+ locales: createFakeLocalesAPI(),
108
+ isInitiallyDisabled: false
109
+ }));
110
+ const $inputs = container.querySelectorAll('input[type="radio"]');
111
+ fireEvent.click($inputs[0]);
112
+ expect(field.setValue).toHaveBeenCalledWith(1);
113
+ expect(field.setValue).toHaveBeenCalledTimes(1);
114
+ fireEvent.click($inputs[1]);
115
+ expect(field.setValue).toHaveBeenCalledWith(2.71);
116
+ expect(field.setValue).toHaveBeenCalledTimes(2);
117
+ fireEvent.click($inputs[2]);
118
+ expect(field.setValue).toHaveBeenCalledWith(0);
119
+ expect(field.setValue).toHaveBeenCalledTimes(3);
120
+ expect(field.removeValue).toHaveBeenCalledTimes(0);
121
+ fireEvent.click(getByText('Clear'));
122
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
123
+ });
124
+ });
125
+ describe('Integer field', ()=>{
126
+ it('calls setValue and removeValue properly', function() {
127
+ const predefined = [
128
+ 0,
129
+ '65',
130
+ '99',
131
+ 100
132
+ ];
133
+ const [field] = createFakeFieldAPI((field)=>{
134
+ jest.spyOn(field, 'setValue');
135
+ jest.spyOn(field, 'removeValue');
136
+ return {
137
+ ...field,
138
+ type: 'Number',
139
+ validations: [
140
+ {
141
+ in: predefined
142
+ }
143
+ ]
144
+ };
145
+ });
146
+ const { container , getByText } = render(React.createElement(RadioEditor, {
147
+ field: field,
148
+ locales: createFakeLocalesAPI(),
149
+ isInitiallyDisabled: false
150
+ }));
151
+ const $inputs = container.querySelectorAll('input[type="radio"]');
152
+ fireEvent.click($inputs[0]);
153
+ expect(field.setValue).toHaveBeenCalledWith(0);
154
+ expect(field.setValue).toHaveBeenCalledTimes(1);
155
+ fireEvent.click($inputs[1]);
156
+ expect(field.setValue).toHaveBeenCalledWith(65);
157
+ expect(field.setValue).toHaveBeenCalledTimes(2);
158
+ fireEvent.click($inputs[2]);
159
+ expect(field.setValue).toHaveBeenCalledWith(99);
160
+ expect(field.setValue).toHaveBeenCalledTimes(3);
161
+ expect(field.removeValue).toHaveBeenCalledTimes(0);
162
+ fireEvent.click(getByText('Clear'));
163
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
164
+ });
165
+ });
166
+ });
@@ -0,0 +1 @@
1
+ export { RadioEditor } from './RadioEditor';
@@ -0,0 +1,11 @@
1
+ import tokens from '@contentful/f36-tokens';
2
+ import { css } from 'emotion';
3
+ export const form = css({
4
+ marginTop: tokens.spacingS
5
+ });
6
+ export const rightToLeft = css({
7
+ direction: 'rtl'
8
+ });
9
+ export const clearBtn = css({
10
+ marginLeft: tokens.spacingL
11
+ });
@@ -1,22 +1,22 @@
1
- /// <reference types="react" />
2
- import { FieldAPI, LocalesAPI } from '@contentful/field-editor-shared';
3
- export interface RadioEditorProps {
4
- /**
5
- * is the field disabled initially
6
- */
7
- isInitiallyDisabled: boolean;
8
- /**
9
- * sdk.field
10
- */
11
- field: FieldAPI;
12
- /**
13
- * sdk.locales
14
- */
15
- locales: LocalesAPI;
16
- }
17
- export declare function RadioEditor(props: RadioEditorProps): JSX.Element;
18
- export declare namespace RadioEditor {
19
- var defaultProps: {
20
- isInitiallyDisabled: boolean;
21
- };
22
- }
1
+ import * as React from 'react';
2
+ import { FieldAPI, LocalesAPI } from '@contentful/field-editor-shared';
3
+ export interface RadioEditorProps {
4
+ /**
5
+ * is the field disabled initially
6
+ */
7
+ isInitiallyDisabled: boolean;
8
+ /**
9
+ * sdk.field
10
+ */
11
+ field: FieldAPI;
12
+ /**
13
+ * sdk.locales
14
+ */
15
+ locales: LocalesAPI;
16
+ }
17
+ export declare function RadioEditor(props: RadioEditorProps): React.JSX.Element;
18
+ export declare namespace RadioEditor {
19
+ var defaultProps: {
20
+ isInitiallyDisabled: boolean;
21
+ };
22
+ }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -1 +1 @@
1
- export { RadioEditor } from './RadioEditor';
1
+ export { RadioEditor } from './RadioEditor';
@@ -1,3 +1,3 @@
1
- export declare const form: string;
2
- export declare const rightToLeft: string;
3
- export declare const clearBtn: string;
1
+ export declare const form: string;
2
+ export declare const rightToLeft: string;
3
+ export declare const clearBtn: string;
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-radio",
3
- "version": "1.1.12",
4
- "main": "dist/index.js",
5
- "module": "dist/field-editor-radio.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,28 +22,34 @@
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-dropdown": "^1.1.11",
27
- "@contentful/field-editor-shared": "^1.1.8",
40
+ "@contentful/field-editor-dropdown": "^1.3.0",
41
+ "@contentful/field-editor-shared": "^1.3.0",
28
42
  "emotion": "^10.0.17",
29
43
  "lodash": "^4.17.15",
30
44
  "lodash-es": "^4.17.15",
31
45
  "nanoid": "^3.1.3"
32
46
  },
33
47
  "devDependencies": {
34
- "@contentful/field-editor-test-utils": "^1.2.7",
48
+ "@contentful/field-editor-test-utils": "^1.4.0",
35
49
  "contentful-management": "^10.0.0"
36
50
  },
37
51
  "peerDependencies": {
38
52
  "react": ">=16.8.0"
39
53
  },
40
- "gitHead": "4fff7b9534374dcc44cb477240d369fc34f46415"
54
+ "gitHead": "543e02672a8dd4edc810f9f3568d6b69c454e1f9"
41
55
  }
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.1.12](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.11...@contentful/field-editor-radio@1.1.12) (2023-03-14)
7
-
8
- **Note:** Version bump only for package @contentful/field-editor-radio
9
-
10
- ## [1.1.11](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.10...@contentful/field-editor-radio@1.1.11) (2023-03-10)
11
-
12
- **Note:** Version bump only for package @contentful/field-editor-radio
13
-
14
- ## [1.1.10](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.9...@contentful/field-editor-radio@1.1.10) (2023-02-21)
15
-
16
- **Note:** Version bump only for package @contentful/field-editor-radio
17
-
18
- ## [1.1.9](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.8...@contentful/field-editor-radio@1.1.9) (2023-02-07)
19
-
20
- **Note:** Version bump only for package @contentful/field-editor-radio
21
-
22
- ## [1.1.8](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.7...@contentful/field-editor-radio@1.1.8) (2022-12-08)
23
-
24
- **Note:** Version bump only for package @contentful/field-editor-radio
25
-
26
- ## [1.1.7](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.6...@contentful/field-editor-radio@1.1.7) (2022-07-29)
27
-
28
- **Note:** Version bump only for package @contentful/field-editor-radio
29
-
30
- ## [1.1.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.5...@contentful/field-editor-radio@1.1.6) (2022-07-29)
31
-
32
- **Note:** Version bump only for package @contentful/field-editor-radio
33
-
34
- ## [1.1.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.4...@contentful/field-editor-radio@1.1.5) (2022-07-11)
35
-
36
- **Note:** Version bump only for package @contentful/field-editor-radio
37
-
38
- ## [1.1.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.3...@contentful/field-editor-radio@1.1.4) (2022-06-22)
39
-
40
- **Note:** Version bump only for package @contentful/field-editor-radio
41
-
42
- ## [1.1.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.2...@contentful/field-editor-radio@1.1.3) (2022-05-04)
43
-
44
- ### Bug Fixes
45
-
46
- - reflect disabled state on fields ([#1125](https://github.com/contentful/field-editors/issues/1125)) ([01502b9](https://github.com/contentful/field-editors/commit/01502b9d785c5f782b0e5de782d092c439cb690f))
47
-
48
- ## [1.1.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.1...@contentful/field-editor-radio@1.1.2) (2022-02-15)
49
-
50
- ### Bug Fixes
51
-
52
- - bump f36 packages ([#1025](https://github.com/contentful/field-editors/issues/1025)) ([ec37a40](https://github.com/contentful/field-editors/commit/ec37a4000db7cd75c66dd9621136b2272c9feeea))
53
-
54
- ## [1.1.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.1.0...@contentful/field-editor-radio@1.1.1) (2022-02-14)
55
-
56
- **Note:** Version bump only for package @contentful/field-editor-radio
57
-
58
- # [1.1.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.0.3...@contentful/field-editor-radio@1.1.0) (2022-01-11)
59
-
60
- ### Features
61
-
62
- - 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))
63
-
64
- ## [1.0.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.0.2...@contentful/field-editor-radio@1.0.3) (2021-12-23)
65
-
66
- ### Bug Fixes
67
-
68
- - markdown buttons ([#968](https://github.com/contentful/field-editors/issues/968)) ([9803b98](https://github.com/contentful/field-editors/commit/9803b98c25d92df6148686ffe2749a77f7efdbb9))
69
-
70
- ## [1.0.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.0.1...@contentful/field-editor-radio@1.0.2) (2021-12-20)
71
-
72
- **Note:** Version bump only for package @contentful/field-editor-radio
73
-
74
- ## [1.0.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@1.0.0...@contentful/field-editor-radio@1.0.1) (2021-11-17)
75
-
76
- ### Bug Fixes
77
-
78
- - **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))
79
-
80
- # [1.0.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.15.0...@contentful/field-editor-radio@1.0.0) (2021-11-04)
81
-
82
- **Note:** Version bump only for package @contentful/field-editor-radio
83
-
84
- # [0.15.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.14.1...@contentful/field-editor-radio@0.15.0) (2021-11-04)
85
-
86
- ### Features
87
-
88
- - Forma v4 components adoption ([#805](https://github.com/contentful/field-editors/issues/805)) ([526bde6](https://github.com/contentful/field-editors/commit/526bde6e10e0ee3789705ec10fb31489af7ca59e))
89
-
90
- ### BREAKING CHANGES
91
-
92
- - adopts a new Forma v4 beta
93
-
94
- ## [0.14.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.14.0...@contentful/field-editor-radio@0.14.1) (2021-10-14)
95
-
96
- **Note:** Version bump only for package @contentful/field-editor-radio
97
-
98
- # [0.14.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.13.4...@contentful/field-editor-radio@0.14.0) (2021-10-06)
99
-
100
- ### Features
101
-
102
- - [EXT-3161] bump app sdk to v4 ([#881](https://github.com/contentful/field-editors/issues/881)) ([9c4a2af](https://github.com/contentful/field-editors/commit/9c4a2af07da203d59fb5f15c3a5188ecc64b1d44))
103
-
104
- ## [0.13.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.13.3...@contentful/field-editor-radio@0.13.4) (2021-09-17)
105
-
106
- **Note:** Version bump only for package @contentful/field-editor-radio
107
-
108
- ## [0.13.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.13.2...@contentful/field-editor-radio@0.13.3) (2021-09-16)
109
-
110
- **Note:** Version bump only for package @contentful/field-editor-radio
111
-
112
- ## [0.13.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.13.1...@contentful/field-editor-radio@0.13.2) (2021-08-19)
113
-
114
- **Note:** Version bump only for package @contentful/field-editor-radio
115
-
116
- ## [0.13.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.13.0...@contentful/field-editor-radio@0.13.1) (2021-07-29)
117
-
118
- **Note:** Version bump only for package @contentful/field-editor-radio
119
-
120
- # [0.13.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.12.6...@contentful/field-editor-radio@0.13.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.12.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.12.3...@contentful/field-editor-radio@0.12.6) (2021-07-06)
127
-
128
- **Note:** Version bump only for package @contentful/field-editor-radio
129
-
130
- ## [0.12.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.12.3...@contentful/field-editor-radio@0.12.5) (2021-07-06)
131
-
132
- **Note:** Version bump only for package @contentful/field-editor-radio
133
-
134
- ## [0.12.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.12.3...@contentful/field-editor-radio@0.12.4) (2021-06-23)
135
-
136
- **Note:** Version bump only for package @contentful/field-editor-radio
137
-
138
- ## [0.12.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.12.2...@contentful/field-editor-radio@0.12.3) (2021-06-23)
139
-
140
- **Note:** Version bump only for package @contentful/field-editor-radio
141
-
142
- ## [0.12.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.12.1...@contentful/field-editor-radio@0.12.2) (2021-06-22)
143
-
144
- **Note:** Version bump only for package @contentful/field-editor-radio
145
-
146
- ## [0.12.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.12.0...@contentful/field-editor-radio@0.12.1) (2021-03-05)
147
-
148
- **Note:** Version bump only for package @contentful/field-editor-radio
149
-
150
- # [0.12.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.11.1...@contentful/field-editor-radio@0.12.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.11.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.11.1...@contentful/field-editor-radio@0.11.2) (2021-02-09)
157
-
158
- **Note:** Version bump only for package @contentful/field-editor-radio
159
-
160
- ## [0.11.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.11.0...@contentful/field-editor-radio@0.11.1) (2021-02-01)
161
-
162
- **Note:** Version bump only for package @contentful/field-editor-radio
163
-
164
- # [0.11.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.10.1...@contentful/field-editor-radio@0.11.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.10.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.10.0...@contentful/field-editor-radio@0.10.1) (2021-01-15)
171
-
172
- ### Bug Fixes
173
-
174
- - 🐛 small layout adjustments ([#555](https://github.com/contentful/field-editors/issues/555)) ([235c594](https://github.com/contentful/field-editors/commit/235c5941db152d2921a9ef134c1a71b0069a4dc2))
175
-
176
- # [0.10.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.9.5...@contentful/field-editor-radio@0.10.0) (2021-01-12)
177
-
178
- ### Features
179
-
180
- - 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))
181
-
182
- ## [0.9.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.9.4...@contentful/field-editor-radio@0.9.5) (2020-12-16)
183
-
184
- **Note:** Version bump only for package @contentful/field-editor-radio
185
-
186
- ## [0.9.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.9.3...@contentful/field-editor-radio@0.9.4) (2020-11-06)
187
-
188
- **Note:** Version bump only for package @contentful/field-editor-radio
189
-
190
- ## [0.9.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.9.2...@contentful/field-editor-radio@0.9.3) (2020-11-06)
191
-
192
- **Note:** Version bump only for package @contentful/field-editor-radio
193
-
194
- ## [0.9.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.9.1...@contentful/field-editor-radio@0.9.2) (2020-10-28)
195
-
196
- **Note:** Version bump only for package @contentful/field-editor-radio
197
-
198
- ## [0.9.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-radio@0.9.0...@contentful/field-editor-radio@0.9.1) (2020-08-24)
199
-
200
- **Note:** Version bump only for package @contentful/field-editor-radio
@@ -1,85 +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 emotion = require('emotion');
9
- var fieldEditorShared = require('@contentful/field-editor-shared');
10
- var fieldEditorDropdown = require('@contentful/field-editor-dropdown');
11
- var tokens = _interopDefault(require('@contentful/f36-tokens'));
12
- var f36Components = require('@contentful/f36-components');
13
-
14
- var form = /*#__PURE__*/emotion.css({
15
- marginTop: tokens.spacingS
16
- });
17
- var rightToLeft = /*#__PURE__*/emotion.css({
18
- direction: 'rtl'
19
- });
20
- var clearBtn = /*#__PURE__*/emotion.css({
21
- marginLeft: tokens.spacingL
22
- });
23
-
24
- function RadioEditor(props) {
25
- var field = props.field,
26
- locales = props.locales;
27
- var options = fieldEditorDropdown.getOptions(field);
28
- var misconfigured = options.length === 0;
29
-
30
- if (misconfigured) {
31
- return React.createElement(fieldEditorShared.PredefinedValuesError, null);
32
- }
33
-
34
- var direction = locales.direction[field.locale] || 'ltr';
35
- return React.createElement(fieldEditorShared.FieldConnector, {
36
- throttle: 0,
37
- field: field,
38
- isInitiallyDisabled: props.isInitiallyDisabled
39
- }, function (_ref) {
40
- var disabled = _ref.disabled,
41
- value = _ref.value,
42
- setValue = _ref.setValue;
43
-
44
- var setOption = function setOption(value) {
45
- setValue(fieldEditorDropdown.parseValue(value, field.type));
46
- };
47
-
48
- var clearOption = function clearOption() {
49
- setValue(undefined);
50
- };
51
-
52
- return React.createElement(f36Components.Form, {
53
- testId: "radio-editor",
54
- className: emotion.cx(form, direction === 'rtl' ? rightToLeft : '')
55
- }, options.map(function (item, index) {
56
- var id = ['entity', field.id, field.locale, index, item.id].join('.');
57
- var checked = value === item.value;
58
- return React.createElement(f36Components.Flex, {
59
- key: id,
60
- alignItems: "center",
61
- marginBottom: "spacingS"
62
- }, React.createElement(f36Components.Radio, {
63
- id: id,
64
- isDisabled: disabled,
65
- value: item.value === undefined ? '' : String(item.value),
66
- isChecked: checked,
67
- onChange: function onChange(e) {
68
- if (e.target.checked) {
69
- setOption(e.target.value);
70
- }
71
- }
72
- }, item.label), checked && !disabled && React.createElement(f36Components.TextLink, {
73
- as: "button",
74
- className: clearBtn,
75
- onClick: clearOption
76
- }, "Clear"));
77
- }));
78
- });
79
- }
80
- RadioEditor.defaultProps = {
81
- isInitiallyDisabled: true
82
- };
83
-
84
- exports.RadioEditor = RadioEditor;
85
- //# sourceMappingURL=field-editor-radio.cjs.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-editor-radio.cjs.development.js","sources":["../src/styles.ts","../src/RadioEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const form = css({\n marginTop: tokens.spacingS,\n});\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n\nexport const clearBtn = css({ marginLeft: tokens.spacingL });\n","import * as React from 'react';\nimport { cx } from 'emotion';\nimport {\n FieldAPI,\n FieldConnector,\n PredefinedValuesError,\n LocalesAPI,\n} from '@contentful/field-editor-shared';\nimport { getOptions, parseValue } from '@contentful/field-editor-dropdown';\nimport * as styles from './styles';\n\nimport { TextLink, Flex, Radio, Form } from '@contentful/f36-components';\n\nexport interface RadioEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\nexport function RadioEditor(props: RadioEditorProps) {\n const { field, locales } = props;\n\n const options = getOptions(field);\n const misconfigured = options.length === 0;\n\n if (misconfigured) {\n return <PredefinedValuesError />;\n }\n\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<string | number>\n throttle={0}\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ disabled, value, setValue }) => {\n const setOption = (value: string) => {\n setValue(parseValue(value, field.type));\n };\n const clearOption = () => {\n setValue(undefined);\n };\n\n return (\n <Form\n testId=\"radio-editor\"\n className={cx(styles.form, direction === 'rtl' ? styles.rightToLeft : '')}>\n {options.map((item, index) => {\n const id = ['entity', field.id, field.locale, index, item.id].join('.');\n const checked = value === item.value;\n return (\n <Flex key={id} alignItems=\"center\" marginBottom=\"spacingS\">\n <Radio\n id={id}\n isDisabled={disabled}\n value={item.value === undefined ? '' : String(item.value)}\n isChecked={checked}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n if (e.target.checked) {\n setOption(e.target.value);\n }\n }}>\n {item.label}\n </Radio>\n {checked && !disabled && (\n <TextLink as=\"button\" className={styles.clearBtn} onClick={clearOption}>\n Clear\n </TextLink>\n )}\n </Flex>\n );\n })}\n </Form>\n );\n }}\n </FieldConnector>\n );\n}\n\nRadioEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["form","css","marginTop","tokens","spacingS","rightToLeft","direction","clearBtn","marginLeft","spacingL","RadioEditor","props","field","locales","options","getOptions","misconfigured","length","React","PredefinedValuesError","locale","FieldConnector","throttle","isInitiallyDisabled","disabled","value","setValue","setOption","parseValue","type","clearOption","undefined","Form","testId","className","cx","styles","map","item","index","id","join","checked","Flex","key","alignItems","marginBottom","Radio","isDisabled","String","isChecked","onChange","e","target","label","TextLink","as","onClick","defaultProps"],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),i=require("emotion"),r=require("@contentful/field-editor-shared"),n=require("@contentful/field-editor-dropdown"),l=(e=require("@contentful/f36-tokens"))&&"object"==typeof e&&"default"in e?e.default:e,a=require("@contentful/f36-components"),o=i.css({marginTop:l.spacingS}),c=i.css({direction:"rtl"}),s=i.css({marginLeft:l.spacingL});function d(e){var l=e.field,d=e.locales,u=n.getOptions(l);if(0===u.length)return t.createElement(r.PredefinedValuesError,null);var f=d.direction[l.locale]||"ltr";return t.createElement(r.FieldConnector,{throttle:0,field:l,isInitiallyDisabled:e.isInitiallyDisabled},(function(e){var r=e.disabled,d=e.value,m=e.setValue,p=function(){m(void 0)};return t.createElement(a.Form,{testId:"radio-editor",className:i.cx(o,"rtl"===f?c:"")},u.map((function(e,i){var o=["entity",l.id,l.locale,i,e.id].join("."),c=d===e.value;return t.createElement(a.Flex,{key:o,alignItems:"center",marginBottom:"spacingS"},t.createElement(a.Radio,{id:o,isDisabled:r,value:void 0===e.value?"":String(e.value),isChecked:c,onChange:function(e){e.target.checked&&function(e){m(n.parseValue(e,l.type))}(e.target.value)}},e.label),c&&!r&&t.createElement(a.TextLink,{as:"button",className:s,onClick:p},"Clear"))})))}))}d.defaultProps={isInitiallyDisabled:!0},exports.RadioEditor=d;
2
- //# sourceMappingURL=field-editor-radio.cjs.production.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-editor-radio.cjs.production.min.js","sources":["../src/styles.ts","../src/RadioEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const form = css({\n marginTop: tokens.spacingS,\n});\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n\nexport const clearBtn = css({ marginLeft: tokens.spacingL });\n","import * as React from 'react';\nimport { cx } from 'emotion';\nimport {\n FieldAPI,\n FieldConnector,\n PredefinedValuesError,\n LocalesAPI,\n} from '@contentful/field-editor-shared';\nimport { getOptions, parseValue } from '@contentful/field-editor-dropdown';\nimport * as styles from './styles';\n\nimport { TextLink, Flex, Radio, Form } from '@contentful/f36-components';\n\nexport interface RadioEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\nexport function RadioEditor(props: RadioEditorProps) {\n const { field, locales } = props;\n\n const options = getOptions(field);\n const misconfigured = options.length === 0;\n\n if (misconfigured) {\n return <PredefinedValuesError />;\n }\n\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<string | number>\n throttle={0}\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ disabled, value, setValue }) => {\n const setOption = (value: string) => {\n setValue(parseValue(value, field.type));\n };\n const clearOption = () => {\n setValue(undefined);\n };\n\n return (\n <Form\n testId=\"radio-editor\"\n className={cx(styles.form, direction === 'rtl' ? styles.rightToLeft : '')}>\n {options.map((item, index) => {\n const id = ['entity', field.id, field.locale, index, item.id].join('.');\n const checked = value === item.value;\n return (\n <Flex key={id} alignItems=\"center\" marginBottom=\"spacingS\">\n <Radio\n id={id}\n isDisabled={disabled}\n value={item.value === undefined ? '' : String(item.value)}\n isChecked={checked}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n if (e.target.checked) {\n setOption(e.target.value);\n }\n }}>\n {item.label}\n </Radio>\n {checked && !disabled && (\n <TextLink as=\"button\" className={styles.clearBtn} onClick={clearOption}>\n Clear\n </TextLink>\n )}\n </Flex>\n );\n })}\n </Form>\n );\n }}\n </FieldConnector>\n );\n}\n\nRadioEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["form","css","marginTop","tokens","spacingS","rightToLeft","direction","clearBtn","marginLeft","spacingL","RadioEditor","props","field","locales","options","getOptions","length","React","PredefinedValuesError","locale","FieldConnector","throttle","isInitiallyDisabled","disabled","value","setValue","clearOption","undefined","Form","testId","className","cx","styles","map","item","index","id","join","checked","Flex","key","alignItems","marginBottom","Radio","isDisabled","String","isChecked","onChange","e","target","parseValue","type","setOption","label","TextLink","as","onClick","defaultProps"],"mappings":"6UAGaA,EAAOC,MAAI,CACtBC,UAAWC,EAAOC,WAGPC,EAAcJ,MAAI,CAC7BK,UAAW,QAGAC,EAAWN,MAAI,CAAEO,WAAYL,EAAOM,oBCmBjCC,EAAYC,OAClBC,EAAmBD,EAAnBC,MAAOC,EAAYF,EAAZE,QAETC,EAAUC,aAAWH,MACc,IAAnBE,EAAQE,cAGrBC,gBAACC,kCAGJZ,EAAYO,EAAQP,UAAUM,EAAMO,SAAW,aAGnDF,gBAACG,kBACCC,SAAU,EACVT,MAAOA,EACPU,oBAAqBX,EAAMW,sBAC1B,gBAAGC,IAAAA,SAAUC,IAAAA,MAAOC,IAAAA,SAIbC,EAAc,WAClBD,OAASE,WAITV,gBAACW,QACCC,OAAO,eACPC,UAAWC,KAAGC,EAA2B,QAAd1B,EAAsB0B,EAAqB,KACrElB,EAAQmB,KAAI,SAACC,EAAMC,OACZC,EAAK,CAAC,SAAUxB,EAAMwB,GAAIxB,EAAMO,OAAQgB,EAAOD,EAAKE,IAAIC,KAAK,KAC7DC,EAAUd,IAAUU,EAAKV,aAE7BP,gBAACsB,QAAKC,IAAKJ,EAAIK,WAAW,SAASC,aAAa,YAC9CzB,gBAAC0B,SACCP,GAAIA,EACJQ,WAAYrB,EACZC,WAAsBG,IAAfO,EAAKV,MAAsB,GAAKqB,OAAOX,EAAKV,OACnDsB,UAAWR,EACXS,SAAU,SAACC,GACLA,EAAEC,OAAOX,SAtBT,SAACd,GACjBC,EAASyB,aAAW1B,EAAOZ,EAAMuC,OAsBnBC,CAAUJ,EAAEC,OAAOzB,SAGtBU,EAAKmB,OAEPf,IAAYf,GACXN,gBAACqC,YAASC,GAAG,SAASzB,UAAWE,EAAiBwB,QAAS9B,oBAc/EhB,EAAY+C,aAAe,CACzBnC,qBAAqB"}
@@ -1,79 +0,0 @@
1
- import { createElement } from 'react';
2
- import { css, cx } from 'emotion';
3
- import { PredefinedValuesError, FieldConnector } from '@contentful/field-editor-shared';
4
- import { getOptions, parseValue } from '@contentful/field-editor-dropdown';
5
- import tokens from '@contentful/f36-tokens';
6
- import { Form, Flex, Radio, TextLink } from '@contentful/f36-components';
7
-
8
- var form = /*#__PURE__*/css({
9
- marginTop: tokens.spacingS
10
- });
11
- var rightToLeft = /*#__PURE__*/css({
12
- direction: 'rtl'
13
- });
14
- var clearBtn = /*#__PURE__*/css({
15
- marginLeft: tokens.spacingL
16
- });
17
-
18
- function RadioEditor(props) {
19
- var field = props.field,
20
- locales = props.locales;
21
- var options = getOptions(field);
22
- var misconfigured = options.length === 0;
23
-
24
- if (misconfigured) {
25
- return createElement(PredefinedValuesError, null);
26
- }
27
-
28
- var direction = locales.direction[field.locale] || 'ltr';
29
- return createElement(FieldConnector, {
30
- throttle: 0,
31
- field: field,
32
- isInitiallyDisabled: props.isInitiallyDisabled
33
- }, function (_ref) {
34
- var disabled = _ref.disabled,
35
- value = _ref.value,
36
- setValue = _ref.setValue;
37
-
38
- var setOption = function setOption(value) {
39
- setValue(parseValue(value, field.type));
40
- };
41
-
42
- var clearOption = function clearOption() {
43
- setValue(undefined);
44
- };
45
-
46
- return createElement(Form, {
47
- testId: "radio-editor",
48
- className: cx(form, direction === 'rtl' ? rightToLeft : '')
49
- }, options.map(function (item, index) {
50
- var id = ['entity', field.id, field.locale, index, item.id].join('.');
51
- var checked = value === item.value;
52
- return createElement(Flex, {
53
- key: id,
54
- alignItems: "center",
55
- marginBottom: "spacingS"
56
- }, createElement(Radio, {
57
- id: id,
58
- isDisabled: disabled,
59
- value: item.value === undefined ? '' : String(item.value),
60
- isChecked: checked,
61
- onChange: function onChange(e) {
62
- if (e.target.checked) {
63
- setOption(e.target.value);
64
- }
65
- }
66
- }, item.label), checked && !disabled && createElement(TextLink, {
67
- as: "button",
68
- className: clearBtn,
69
- onClick: clearOption
70
- }, "Clear"));
71
- }));
72
- });
73
- }
74
- RadioEditor.defaultProps = {
75
- isInitiallyDisabled: true
76
- };
77
-
78
- export { RadioEditor };
79
- //# sourceMappingURL=field-editor-radio.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-editor-radio.esm.js","sources":["../src/styles.ts","../src/RadioEditor.tsx"],"sourcesContent":["import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const form = css({\n marginTop: tokens.spacingS,\n});\n\nexport const rightToLeft = css({\n direction: 'rtl',\n});\n\nexport const clearBtn = css({ marginLeft: tokens.spacingL });\n","import * as React from 'react';\nimport { cx } from 'emotion';\nimport {\n FieldAPI,\n FieldConnector,\n PredefinedValuesError,\n LocalesAPI,\n} from '@contentful/field-editor-shared';\nimport { getOptions, parseValue } from '@contentful/field-editor-dropdown';\nimport * as styles from './styles';\n\nimport { TextLink, Flex, Radio, Form } from '@contentful/f36-components';\n\nexport interface RadioEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n /**\n * sdk.locales\n */\n locales: LocalesAPI;\n}\n\nexport function RadioEditor(props: RadioEditorProps) {\n const { field, locales } = props;\n\n const options = getOptions(field);\n const misconfigured = options.length === 0;\n\n if (misconfigured) {\n return <PredefinedValuesError />;\n }\n\n const direction = locales.direction[field.locale] || 'ltr';\n\n return (\n <FieldConnector<string | number>\n throttle={0}\n field={field}\n isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ disabled, value, setValue }) => {\n const setOption = (value: string) => {\n setValue(parseValue(value, field.type));\n };\n const clearOption = () => {\n setValue(undefined);\n };\n\n return (\n <Form\n testId=\"radio-editor\"\n className={cx(styles.form, direction === 'rtl' ? styles.rightToLeft : '')}>\n {options.map((item, index) => {\n const id = ['entity', field.id, field.locale, index, item.id].join('.');\n const checked = value === item.value;\n return (\n <Flex key={id} alignItems=\"center\" marginBottom=\"spacingS\">\n <Radio\n id={id}\n isDisabled={disabled}\n value={item.value === undefined ? '' : String(item.value)}\n isChecked={checked}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n if (e.target.checked) {\n setOption(e.target.value);\n }\n }}>\n {item.label}\n </Radio>\n {checked && !disabled && (\n <TextLink as=\"button\" className={styles.clearBtn} onClick={clearOption}>\n Clear\n </TextLink>\n )}\n </Flex>\n );\n })}\n </Form>\n );\n }}\n </FieldConnector>\n );\n}\n\nRadioEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["form","css","marginTop","tokens","spacingS","rightToLeft","direction","clearBtn","marginLeft","spacingL","RadioEditor","props","field","locales","options","getOptions","misconfigured","length","React","PredefinedValuesError","locale","FieldConnector","throttle","isInitiallyDisabled","disabled","value","setValue","setOption","parseValue","type","clearOption","undefined","Form","testId","className","cx","styles","map","item","index","id","join","checked","Flex","key","alignItems","marginBottom","Radio","isDisabled","String","isChecked","onChange","e","target","label","TextLink","as","onClick","defaultProps"],"mappings":";;;;;;;AAGO,IAAMA,IAAI,gBAAGC,GAAG,CAAC;AACtBC,EAAAA,SAAS,EAAEC,MAAM,CAACC;AADI,CAAD,CAAhB;AAIA,IAAMC,WAAW,gBAAGJ,GAAG,CAAC;AAC7BK,EAAAA,SAAS,EAAE;AADkB,CAAD,CAAvB;AAIA,IAAMC,QAAQ,gBAAGN,GAAG,CAAC;AAAEO,EAAAA,UAAU,EAAEL,MAAM,CAACM;AAArB,CAAD,CAApB;;SCmBSC,YAAYC;AAC1B,MAAQC,KAAR,GAA2BD,KAA3B,CAAQC,KAAR;AAAA,MAAeC,OAAf,GAA2BF,KAA3B,CAAeE,OAAf;AAEA,MAAMC,OAAO,GAAGC,UAAU,CAACH,KAAD,CAA1B;AACA,MAAMI,aAAa,GAAGF,OAAO,CAACG,MAAR,KAAmB,CAAzC;;AAEA,MAAID,aAAJ,EAAmB;AACjB,WAAOE,aAAA,CAACC,qBAAD,MAAA,CAAP;AACD;;AAED,MAAMb,SAAS,GAAGO,OAAO,CAACP,SAAR,CAAkBM,KAAK,CAACQ,MAAxB,KAAmC,KAArD;AAEA,SACEF,aAAA,CAACG,cAAD;AACEC,IAAAA,QAAQ,EAAE;AACVV,IAAAA,KAAK,EAAEA;AACPW,IAAAA,mBAAmB,EAAEZ,KAAK,CAACY;GAH7B,EAIG;QAAGC,gBAAAA;QAAUC,aAAAA;QAAOC,gBAAAA;;AACnB,QAAMC,SAAS,GAAG,SAAZA,SAAY,CAACF,KAAD;AAChBC,MAAAA,QAAQ,CAACE,UAAU,CAACH,KAAD,EAAQb,KAAK,CAACiB,IAAd,CAAX,CAAR;AACD,KAFD;;AAGA,QAAMC,WAAW,GAAG,SAAdA,WAAc;AAClBJ,MAAAA,QAAQ,CAACK,SAAD,CAAR;AACD,KAFD;;AAIA,WACEb,aAAA,CAACc,IAAD;AACEC,MAAAA,MAAM,EAAC;AACPC,MAAAA,SAAS,EAAEC,EAAE,CAACC,IAAD,EAAc9B,SAAS,KAAK,KAAd,GAAsB8B,WAAtB,GAA2C,EAAzD;KAFf,EAGGtB,OAAO,CAACuB,GAAR,CAAY,UAACC,IAAD,EAAOC,KAAP;AACX,UAAMC,EAAE,GAAG,CAAC,QAAD,EAAW5B,KAAK,CAAC4B,EAAjB,EAAqB5B,KAAK,CAACQ,MAA3B,EAAmCmB,KAAnC,EAA0CD,IAAI,CAACE,EAA/C,EAAmDC,IAAnD,CAAwD,GAAxD,CAAX;AACA,UAAMC,OAAO,GAAGjB,KAAK,KAAKa,IAAI,CAACb,KAA/B;AACA,aACEP,aAAA,CAACyB,IAAD;AAAMC,QAAAA,GAAG,EAAEJ;AAAIK,QAAAA,UAAU,EAAC;AAASC,QAAAA,YAAY,EAAC;OAAhD,EACE5B,aAAA,CAAC6B,KAAD;AACEP,QAAAA,EAAE,EAAEA;AACJQ,QAAAA,UAAU,EAAExB;AACZC,QAAAA,KAAK,EAAEa,IAAI,CAACb,KAAL,KAAeM,SAAf,GAA2B,EAA3B,GAAgCkB,MAAM,CAACX,IAAI,CAACb,KAAN;AAC7CyB,QAAAA,SAAS,EAAER;AACXS,QAAAA,QAAQ,EAAE,kBAACC,CAAD;AACR,cAAIA,CAAC,CAACC,MAAF,CAASX,OAAb,EAAsB;AACpBf,YAAAA,SAAS,CAACyB,CAAC,CAACC,MAAF,CAAS5B,KAAV,CAAT;AACD;AACF;OATH,EAUGa,IAAI,CAACgB,KAVR,CADF,EAaGZ,OAAO,IAAI,CAAClB,QAAZ,IACCN,aAAA,CAACqC,QAAD;AAAUC,QAAAA,EAAE,EAAC;AAAStB,QAAAA,SAAS,EAAEE;AAAiBqB,QAAAA,OAAO,EAAE3B;OAA3D,SAAA,CAdJ,CADF;AAqBD,KAxBA,CAHH,CADF;AA+BD,GA3CH,CADF;AA+CD;AAEDpB,WAAW,CAACgD,YAAZ,GAA2B;AACzBnC,EAAAA,mBAAmB,EAAE;AADI,CAA3B;;;;"}
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-radio.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./field-editor-radio.cjs.development.js')
8
- }