@contentful/field-editor-url 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,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "UrlEditor", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return UrlEditor;
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
+ function _getRequireWildcardCache(nodeInterop) {
15
+ if (typeof WeakMap !== "function") return null;
16
+ var cacheBabelInterop = new WeakMap();
17
+ var cacheNodeInterop = new WeakMap();
18
+ return (_getRequireWildcardCache = function(nodeInterop) {
19
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
20
+ })(nodeInterop);
21
+ }
22
+ function _interop_require_wildcard(obj, nodeInterop) {
23
+ if (!nodeInterop && obj && obj.__esModule) {
24
+ return obj;
25
+ }
26
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
27
+ return {
28
+ default: obj
29
+ };
30
+ }
31
+ var cache = _getRequireWildcardCache(nodeInterop);
32
+ if (cache && cache.has(obj)) {
33
+ return cache.get(obj);
34
+ }
35
+ var newObj = {};
36
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
37
+ for(var key in obj){
38
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
39
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
40
+ if (desc && (desc.get || desc.set)) {
41
+ Object.defineProperty(newObj, key, desc);
42
+ } else {
43
+ newObj[key] = obj[key];
44
+ }
45
+ }
46
+ }
47
+ newObj.default = obj;
48
+ if (cache) {
49
+ cache.set(obj, newObj);
50
+ }
51
+ return newObj;
52
+ }
53
+ function UrlEditor(props) {
54
+ const { field } = props;
55
+ return _react.createElement(_fieldeditorshared.FieldConnector, {
56
+ field: field,
57
+ isInitiallyDisabled: props.isInitiallyDisabled
58
+ }, ({ value , errors , disabled , setValue })=>{
59
+ return _react.createElement("div", {
60
+ "data-test-id": "url-editor"
61
+ }, _react.createElement(_f36components.TextInput, {
62
+ isRequired: field.required,
63
+ isInvalid: errors.length > 0,
64
+ isDisabled: disabled,
65
+ value: value || '',
66
+ onChange: (e)=>{
67
+ setValue(e.target.value);
68
+ }
69
+ }), typeof props.children === 'function' ? props.children({
70
+ value
71
+ }) : null);
72
+ });
73
+ }
74
+ UrlEditor.defaultProps = {
75
+ isInitiallyDisabled: true
76
+ };
@@ -0,0 +1,152 @@
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 _UrlEditor = require("./UrlEditor");
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('UrlEditor', ()=>{
64
+ afterEach(_react1.cleanup);
65
+ it('renders without crashing', ()=>{
66
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)();
67
+ (0, _react1.render)(_react.createElement(_UrlEditor.UrlEditor, {
68
+ field: field,
69
+ isInitiallyDisabled: false
70
+ }));
71
+ });
72
+ it('reads initial value from field.getValue', ()=>{
73
+ const initialValue = 'initial-value';
74
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
75
+ return {
76
+ ...field,
77
+ id: 'field-id',
78
+ getValue: ()=>{
79
+ return initialValue;
80
+ }
81
+ };
82
+ });
83
+ const { getByTestId } = (0, _react1.render)(_react.createElement(_UrlEditor.UrlEditor, {
84
+ field: field,
85
+ isInitiallyDisabled: false
86
+ }));
87
+ expect(getByTestId('cf-ui-text-input')).toHaveValue(initialValue);
88
+ });
89
+ it('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
90
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
91
+ jest.spyOn(field, 'setValue');
92
+ jest.spyOn(field, 'removeValue');
93
+ return {
94
+ ...field,
95
+ id: 'field-id'
96
+ };
97
+ });
98
+ const { getByTestId } = (0, _react1.render)(_react.createElement(_UrlEditor.UrlEditor, {
99
+ field: field,
100
+ isInitiallyDisabled: false
101
+ }));
102
+ const $input = getByTestId('cf-ui-text-input');
103
+ expect($input).toHaveValue('');
104
+ _react1.fireEvent.change($input, {
105
+ target: {
106
+ value: 'new-value'
107
+ }
108
+ });
109
+ await (0, _react1.waitFor)(()=>{
110
+ expect($input).toHaveValue('new-value');
111
+ expect(field.setValue).toHaveBeenCalledTimes(1);
112
+ expect(field.setValue).toHaveBeenLastCalledWith('new-value');
113
+ });
114
+ _react1.fireEvent.change($input, {
115
+ target: {
116
+ value: ''
117
+ }
118
+ });
119
+ await (0, _react1.waitFor)(()=>{
120
+ expect($input).toHaveValue('');
121
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
122
+ expect(field.removeValue).toHaveBeenLastCalledWith();
123
+ });
124
+ });
125
+ it('gives an ability to render custom preview', ()=>{
126
+ const initialValue = 'initial-value';
127
+ const [field] = (0, _fieldeditortestutils.createFakeFieldAPI)((field)=>{
128
+ return {
129
+ ...field,
130
+ id: 'field-id',
131
+ getValue: ()=>{
132
+ return initialValue;
133
+ }
134
+ };
135
+ });
136
+ const { getByTestId , getByText } = (0, _react1.render)(_react.createElement(_UrlEditor.UrlEditor, {
137
+ field: field,
138
+ isInitiallyDisabled: false
139
+ }, ({ value })=>{
140
+ return _react.createElement("div", null, "Custom preview: ", value);
141
+ }));
142
+ const $input = getByTestId('cf-ui-text-input');
143
+ expect($input).toHaveValue(initialValue);
144
+ expect(getByText('Custom preview: initial-value')).toBeInTheDocument();
145
+ _react1.fireEvent.change($input, {
146
+ target: {
147
+ value: 'new-value'
148
+ }
149
+ });
150
+ expect(getByText('Custom preview: new-value')).toBeInTheDocument();
151
+ });
152
+ });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "UrlEditor", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _UrlEditor.UrlEditor;
9
+ }
10
+ });
11
+ const _UrlEditor = require("./UrlEditor");
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ import { TextInput } from '@contentful/f36-components';
3
+ import { FieldConnector } from '@contentful/field-editor-shared';
4
+ export function UrlEditor(props) {
5
+ const { field } = props;
6
+ return React.createElement(FieldConnector, {
7
+ field: field,
8
+ isInitiallyDisabled: props.isInitiallyDisabled
9
+ }, ({ value , errors , disabled , setValue })=>{
10
+ return React.createElement("div", {
11
+ "data-test-id": "url-editor"
12
+ }, React.createElement(TextInput, {
13
+ isRequired: field.required,
14
+ isInvalid: errors.length > 0,
15
+ isDisabled: disabled,
16
+ value: value || '',
17
+ onChange: (e)=>{
18
+ setValue(e.target.value);
19
+ }
20
+ }), typeof props.children === 'function' ? props.children({
21
+ value
22
+ }) : null);
23
+ });
24
+ }
25
+ UrlEditor.defaultProps = {
26
+ isInitiallyDisabled: true
27
+ };
@@ -0,0 +1,104 @@
1
+ import * as React from 'react';
2
+ import { createFakeFieldAPI } 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 { UrlEditor } from './UrlEditor';
7
+ configure({
8
+ testIdAttribute: 'data-test-id'
9
+ });
10
+ jest.mock('lodash/throttle', ()=>({
11
+ default: identity
12
+ }), {
13
+ virtual: true
14
+ });
15
+ describe('UrlEditor', ()=>{
16
+ afterEach(cleanup);
17
+ it('renders without crashing', ()=>{
18
+ const [field] = createFakeFieldAPI();
19
+ render(React.createElement(UrlEditor, {
20
+ field: field,
21
+ isInitiallyDisabled: false
22
+ }));
23
+ });
24
+ it('reads initial value from field.getValue', ()=>{
25
+ const initialValue = 'initial-value';
26
+ const [field] = createFakeFieldAPI((field)=>{
27
+ return {
28
+ ...field,
29
+ id: 'field-id',
30
+ getValue: ()=>{
31
+ return initialValue;
32
+ }
33
+ };
34
+ });
35
+ const { getByTestId } = render(React.createElement(UrlEditor, {
36
+ field: field,
37
+ isInitiallyDisabled: false
38
+ }));
39
+ expect(getByTestId('cf-ui-text-input')).toHaveValue(initialValue);
40
+ });
41
+ it('calls field.setValue when user types and calls field.removeValue when user clears the input', async ()=>{
42
+ const [field] = createFakeFieldAPI((field)=>{
43
+ jest.spyOn(field, 'setValue');
44
+ jest.spyOn(field, 'removeValue');
45
+ return {
46
+ ...field,
47
+ id: 'field-id'
48
+ };
49
+ });
50
+ const { getByTestId } = render(React.createElement(UrlEditor, {
51
+ field: field,
52
+ isInitiallyDisabled: false
53
+ }));
54
+ const $input = getByTestId('cf-ui-text-input');
55
+ expect($input).toHaveValue('');
56
+ fireEvent.change($input, {
57
+ target: {
58
+ value: 'new-value'
59
+ }
60
+ });
61
+ await waitFor(()=>{
62
+ expect($input).toHaveValue('new-value');
63
+ expect(field.setValue).toHaveBeenCalledTimes(1);
64
+ expect(field.setValue).toHaveBeenLastCalledWith('new-value');
65
+ });
66
+ fireEvent.change($input, {
67
+ target: {
68
+ value: ''
69
+ }
70
+ });
71
+ await waitFor(()=>{
72
+ expect($input).toHaveValue('');
73
+ expect(field.removeValue).toHaveBeenCalledTimes(1);
74
+ expect(field.removeValue).toHaveBeenLastCalledWith();
75
+ });
76
+ });
77
+ it('gives an ability to render custom preview', ()=>{
78
+ const initialValue = 'initial-value';
79
+ const [field] = createFakeFieldAPI((field)=>{
80
+ return {
81
+ ...field,
82
+ id: 'field-id',
83
+ getValue: ()=>{
84
+ return initialValue;
85
+ }
86
+ };
87
+ });
88
+ const { getByTestId , getByText } = render(React.createElement(UrlEditor, {
89
+ field: field,
90
+ isInitiallyDisabled: false
91
+ }, ({ value })=>{
92
+ return React.createElement("div", null, "Custom preview: ", value);
93
+ }));
94
+ const $input = getByTestId('cf-ui-text-input');
95
+ expect($input).toHaveValue(initialValue);
96
+ expect(getByText('Custom preview: initial-value')).toBeInTheDocument();
97
+ fireEvent.change($input, {
98
+ target: {
99
+ value: 'new-value'
100
+ }
101
+ });
102
+ expect(getByText('Custom preview: new-value')).toBeInTheDocument();
103
+ });
104
+ });
@@ -0,0 +1 @@
1
+ export { UrlEditor } from './UrlEditor';
@@ -1,21 +1,21 @@
1
- import * as React from 'react';
2
- import { FieldAPI } from '@contentful/field-editor-shared';
3
- export interface UrlEditorProps {
4
- /**
5
- * is the field disabled initially
6
- */
7
- isInitiallyDisabled: boolean;
8
- /**
9
- * sdk.field
10
- */
11
- field: FieldAPI;
12
- children?: (props: {
13
- value: string | null | undefined;
14
- }) => React.ReactNode;
15
- }
16
- export declare function UrlEditor(props: UrlEditorProps): JSX.Element;
17
- export declare namespace UrlEditor {
18
- var defaultProps: {
19
- isInitiallyDisabled: boolean;
20
- };
21
- }
1
+ import * as React from 'react';
2
+ import { FieldAPI } from '@contentful/field-editor-shared';
3
+ export interface UrlEditorProps {
4
+ /**
5
+ * is the field disabled initially
6
+ */
7
+ isInitiallyDisabled: boolean;
8
+ /**
9
+ * sdk.field
10
+ */
11
+ field: FieldAPI;
12
+ children?: (props: {
13
+ value: string | null | undefined;
14
+ }) => React.ReactNode;
15
+ }
16
+ export declare function UrlEditor(props: UrlEditorProps): React.JSX.Element;
17
+ export declare namespace UrlEditor {
18
+ var defaultProps: {
19
+ isInitiallyDisabled: boolean;
20
+ };
21
+ }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -1 +1 @@
1
- export { UrlEditor } from './UrlEditor';
1
+ export { UrlEditor } from './UrlEditor';
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-url",
3
- "version": "1.1.11",
4
- "main": "dist/index.js",
5
- "module": "dist/field-editor-url.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,186 +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-url@1.1.10...@contentful/field-editor-url@1.1.11) (2023-03-14)
7
-
8
- **Note:** Version bump only for package @contentful/field-editor-url
9
-
10
- ## [1.1.10](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.1.9...@contentful/field-editor-url@1.1.10) (2023-03-10)
11
-
12
- **Note:** Version bump only for package @contentful/field-editor-url
13
-
14
- ## [1.1.9](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.1.8...@contentful/field-editor-url@1.1.9) (2023-02-21)
15
-
16
- **Note:** Version bump only for package @contentful/field-editor-url
17
-
18
- ## [1.1.8](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.1.7...@contentful/field-editor-url@1.1.8) (2023-02-07)
19
-
20
- **Note:** Version bump only for package @contentful/field-editor-url
21
-
22
- ## [1.1.7](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.1.6...@contentful/field-editor-url@1.1.7) (2022-12-08)
23
-
24
- **Note:** Version bump only for package @contentful/field-editor-url
25
-
26
- ## [1.1.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.1.5...@contentful/field-editor-url@1.1.6) (2022-07-29)
27
-
28
- **Note:** Version bump only for package @contentful/field-editor-url
29
-
30
- ## [1.1.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.1.4...@contentful/field-editor-url@1.1.5) (2022-07-29)
31
-
32
- **Note:** Version bump only for package @contentful/field-editor-url
33
-
34
- ## [1.1.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.1.3...@contentful/field-editor-url@1.1.4) (2022-07-11)
35
-
36
- **Note:** Version bump only for package @contentful/field-editor-url
37
-
38
- ## [1.1.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.1.2...@contentful/field-editor-url@1.1.3) (2022-06-22)
39
-
40
- **Note:** Version bump only for package @contentful/field-editor-url
41
-
42
- ## [1.1.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.1.1...@contentful/field-editor-url@1.1.2) (2022-02-15)
43
-
44
- ### Bug Fixes
45
-
46
- - bump f36 packages ([#1025](https://github.com/contentful/field-editors/issues/1025)) ([ec37a40](https://github.com/contentful/field-editors/commit/ec37a4000db7cd75c66dd9621136b2272c9feeea))
47
-
48
- ## [1.1.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.1.0...@contentful/field-editor-url@1.1.1) (2022-02-14)
49
-
50
- **Note:** Version bump only for package @contentful/field-editor-url
51
-
52
- # [1.1.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.0.3...@contentful/field-editor-url@1.1.0) (2022-01-11)
53
-
54
- ### Features
55
-
56
- - 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))
57
-
58
- ## [1.0.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.0.2...@contentful/field-editor-url@1.0.3) (2021-12-23)
59
-
60
- ### Bug Fixes
61
-
62
- - markdown buttons ([#968](https://github.com/contentful/field-editors/issues/968)) ([9803b98](https://github.com/contentful/field-editors/commit/9803b98c25d92df6148686ffe2749a77f7efdbb9))
63
-
64
- ## [1.0.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.0.1...@contentful/field-editor-url@1.0.2) (2021-12-20)
65
-
66
- **Note:** Version bump only for package @contentful/field-editor-url
67
-
68
- ## [1.0.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@1.0.0...@contentful/field-editor-url@1.0.1) (2021-11-17)
69
-
70
- ### Bug Fixes
71
-
72
- - **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))
73
-
74
- # [1.0.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.13.0...@contentful/field-editor-url@1.0.0) (2021-11-04)
75
-
76
- **Note:** Version bump only for package @contentful/field-editor-url
77
-
78
- # [0.13.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.12.6...@contentful/field-editor-url@0.13.0) (2021-11-04)
79
-
80
- ### Features
81
-
82
- - Forma v4 components adoption ([#805](https://github.com/contentful/field-editors/issues/805)) ([526bde6](https://github.com/contentful/field-editors/commit/526bde6e10e0ee3789705ec10fb31489af7ca59e))
83
-
84
- ### BREAKING CHANGES
85
-
86
- - adopts a new Forma v4 beta
87
-
88
- ## [0.12.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.12.5...@contentful/field-editor-url@0.12.6) (2021-10-14)
89
-
90
- **Note:** Version bump only for package @contentful/field-editor-url
91
-
92
- ## [0.12.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.12.4...@contentful/field-editor-url@0.12.5) (2021-10-06)
93
-
94
- **Note:** Version bump only for package @contentful/field-editor-url
95
-
96
- ## [0.12.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.12.3...@contentful/field-editor-url@0.12.4) (2021-09-17)
97
-
98
- **Note:** Version bump only for package @contentful/field-editor-url
99
-
100
- ## [0.12.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.12.2...@contentful/field-editor-url@0.12.3) (2021-09-16)
101
-
102
- **Note:** Version bump only for package @contentful/field-editor-url
103
-
104
- ## [0.12.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.12.1...@contentful/field-editor-url@0.12.2) (2021-08-19)
105
-
106
- **Note:** Version bump only for package @contentful/field-editor-url
107
-
108
- ## [0.12.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.12.0...@contentful/field-editor-url@0.12.1) (2021-07-29)
109
-
110
- **Note:** Version bump only for package @contentful/field-editor-url
111
-
112
- # [0.12.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.11.6...@contentful/field-editor-url@0.12.0) (2021-07-23)
113
-
114
- ### Features
115
-
116
- - 💡 new color tokens ([#778](https://github.com/contentful/field-editors/issues/778)) ([fba548d](https://github.com/contentful/field-editors/commit/fba548de32305016df7f2685634eefb14294828f))
117
-
118
- ## [0.11.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.11.3...@contentful/field-editor-url@0.11.6) (2021-07-06)
119
-
120
- **Note:** Version bump only for package @contentful/field-editor-url
121
-
122
- ## [0.11.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.11.3...@contentful/field-editor-url@0.11.5) (2021-07-06)
123
-
124
- **Note:** Version bump only for package @contentful/field-editor-url
125
-
126
- ## [0.11.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.11.3...@contentful/field-editor-url@0.11.4) (2021-06-23)
127
-
128
- **Note:** Version bump only for package @contentful/field-editor-url
129
-
130
- ## [0.11.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.11.2...@contentful/field-editor-url@0.11.3) (2021-06-23)
131
-
132
- **Note:** Version bump only for package @contentful/field-editor-url
133
-
134
- ## [0.11.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.11.1...@contentful/field-editor-url@0.11.2) (2021-06-22)
135
-
136
- **Note:** Version bump only for package @contentful/field-editor-url
137
-
138
- ## [0.11.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.11.0...@contentful/field-editor-url@0.11.1) (2021-03-05)
139
-
140
- **Note:** Version bump only for package @contentful/field-editor-url
141
-
142
- # [0.11.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.10.2...@contentful/field-editor-url@0.11.0) (2021-02-19)
143
-
144
- ### Features
145
-
146
- - bump min version of forma-36 ([#606](https://github.com/contentful/field-editors/issues/606)) ([fd57c7a](https://github.com/contentful/field-editors/commit/fd57c7a4312766af38c01507f17706ab22992617))
147
-
148
- ## [0.10.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.10.1...@contentful/field-editor-url@0.10.2) (2021-02-09)
149
-
150
- **Note:** Version bump only for package @contentful/field-editor-url
151
-
152
- ## [0.10.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.10.0...@contentful/field-editor-url@0.10.1) (2021-02-01)
153
-
154
- **Note:** Version bump only for package @contentful/field-editor-url
155
-
156
- # [0.10.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.9.0...@contentful/field-editor-url@0.10.0) (2021-01-20)
157
-
158
- ### Features
159
-
160
- - 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))
161
-
162
- # [0.9.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.8.5...@contentful/field-editor-url@0.9.0) (2021-01-12)
163
-
164
- ### Features
165
-
166
- - 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))
167
-
168
- ## [0.8.5](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.8.4...@contentful/field-editor-url@0.8.5) (2020-12-16)
169
-
170
- **Note:** Version bump only for package @contentful/field-editor-url
171
-
172
- ## [0.8.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.8.3...@contentful/field-editor-url@0.8.4) (2020-11-06)
173
-
174
- **Note:** Version bump only for package @contentful/field-editor-url
175
-
176
- ## [0.8.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.8.2...@contentful/field-editor-url@0.8.3) (2020-11-06)
177
-
178
- **Note:** Version bump only for package @contentful/field-editor-url
179
-
180
- ## [0.8.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.8.1...@contentful/field-editor-url@0.8.2) (2020-10-28)
181
-
182
- **Note:** Version bump only for package @contentful/field-editor-url
183
-
184
- ## [0.8.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-url@0.8.0...@contentful/field-editor-url@0.8.1) (2020-08-24)
185
-
186
- **Note:** Version bump only for package @contentful/field-editor-url
@@ -1,39 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var fieldEditorShared = require('@contentful/field-editor-shared');
7
- var f36Components = require('@contentful/f36-components');
8
-
9
- function UrlEditor(props) {
10
- var field = props.field;
11
- return React.createElement(fieldEditorShared.FieldConnector, {
12
- field: field,
13
- isInitiallyDisabled: props.isInitiallyDisabled
14
- }, function (_ref) {
15
- var value = _ref.value,
16
- errors = _ref.errors,
17
- disabled = _ref.disabled,
18
- setValue = _ref.setValue;
19
- return React.createElement("div", {
20
- "data-test-id": "url-editor"
21
- }, React.createElement(f36Components.TextInput, {
22
- isRequired: field.required,
23
- isInvalid: errors.length > 0,
24
- isDisabled: disabled,
25
- value: value || '',
26
- onChange: function onChange(e) {
27
- setValue(e.target.value);
28
- }
29
- }), typeof props.children === 'function' ? props.children({
30
- value: value
31
- }) : null);
32
- });
33
- }
34
- UrlEditor.defaultProps = {
35
- isInitiallyDisabled: true
36
- };
37
-
38
- exports.UrlEditor = UrlEditor;
39
- //# sourceMappingURL=field-editor-url.cjs.development.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-editor-url.cjs.development.js","sources":["../src/UrlEditor.tsx"],"sourcesContent":["import * as React from 'react';\nimport { FieldAPI, FieldConnector } from '@contentful/field-editor-shared';\n\nimport { TextInput } from '@contentful/f36-components';\n\nexport interface UrlEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n children?: (props: { value: string | null | undefined }) => React.ReactNode;\n}\n\nexport function UrlEditor(props: UrlEditorProps) {\n const { field } = props;\n\n return (\n <FieldConnector<string> field={field} isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ value, errors, disabled, setValue }) => {\n return (\n <div data-test-id=\"url-editor\">\n <TextInput\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 {typeof props.children === 'function' ? props.children({ value }) : null}\n </div>\n );\n }}\n </FieldConnector>\n );\n}\n\nUrlEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["UrlEditor","props","field","React","FieldConnector","isInitiallyDisabled","value","errors","disabled","setValue","TextInput","isRequired","required","isInvalid","length","isDisabled","onChange","e","target","children","defaultProps"],"mappings":";;;;;;;;SAmBgBA,UAAUC;AACxB,MAAQC,KAAR,GAAkBD,KAAlB,CAAQC,KAAR;AAEA,SACEC,mBAAA,CAACC,gCAAD;AAAwBF,IAAAA,KAAK,EAAEA;AAAOG,IAAAA,mBAAmB,EAAEJ,KAAK,CAACI;GAAjE,EACG;QAAGC,aAAAA;QAAOC,cAAAA;QAAQC,gBAAAA;QAAUC,gBAAAA;AAC3B,WACEN,mBAAA,MAAA;sBAAkB;KAAlB,EACEA,mBAAA,CAACO,uBAAD;AACEC,MAAAA,UAAU,EAAET,KAAK,CAACU;AAClBC,MAAAA,SAAS,EAAEN,MAAM,CAACO,MAAP,GAAgB;AAC3BC,MAAAA,UAAU,EAAEP;AACZF,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAChBU,MAAAA,QAAQ,EAAE,kBAACC,CAAD;AACRR,QAAAA,QAAQ,CAACQ,CAAC,CAACC,MAAF,CAASZ,KAAV,CAAR;AACD;KAPH,CADF,EAUG,OAAOL,KAAK,CAACkB,QAAb,KAA0B,UAA1B,GAAuClB,KAAK,CAACkB,QAAN,CAAe;AAAEb,MAAAA,KAAK,EAALA;AAAF,KAAf,CAAvC,GAAmE,IAVtE,CADF;AAcD,GAhBH,CADF;AAoBD;AAEDN,SAAS,CAACoB,YAAV,GAAyB;AACvBf,EAAAA,mBAAmB,EAAE;AADE,CAAzB;;;;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@contentful/field-editor-shared"),i=require("@contentful/f36-components");function r(r){var l=r.field;return e.createElement(t.FieldConnector,{field:l,isInitiallyDisabled:r.isInitiallyDisabled},(function(t){var n=t.value,a=t.setValue;return e.createElement("div",{"data-test-id":"url-editor"},e.createElement(i.TextInput,{isRequired:l.required,isInvalid:t.errors.length>0,isDisabled:t.disabled,value:n||"",onChange:function(e){a(e.target.value)}}),"function"==typeof r.children?r.children({value:n}):null)}))}r.defaultProps={isInitiallyDisabled:!0},exports.UrlEditor=r;
2
- //# sourceMappingURL=field-editor-url.cjs.production.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-editor-url.cjs.production.min.js","sources":["../src/UrlEditor.tsx"],"sourcesContent":["import * as React from 'react';\nimport { FieldAPI, FieldConnector } from '@contentful/field-editor-shared';\n\nimport { TextInput } from '@contentful/f36-components';\n\nexport interface UrlEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n children?: (props: { value: string | null | undefined }) => React.ReactNode;\n}\n\nexport function UrlEditor(props: UrlEditorProps) {\n const { field } = props;\n\n return (\n <FieldConnector<string> field={field} isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ value, errors, disabled, setValue }) => {\n return (\n <div data-test-id=\"url-editor\">\n <TextInput\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 {typeof props.children === 'function' ? props.children({ value }) : null}\n </div>\n );\n }}\n </FieldConnector>\n );\n}\n\nUrlEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["UrlEditor","props","field","React","FieldConnector","isInitiallyDisabled","value","setValue","TextInput","isRequired","required","isInvalid","errors","length","isDisabled","disabled","onChange","e","target","children","defaultProps"],"mappings":"yLAmBgBA,EAAUC,OAChBC,EAAUD,EAAVC,aAGNC,gBAACC,kBAAuBF,MAAOA,EAAOG,oBAAqBJ,EAAMI,sBAC9D,gBAAGC,IAAAA,MAAyBC,IAAAA,gBAEzBJ,sCAAkB,cAChBA,gBAACK,aACCC,WAAYP,EAAMQ,SAClBC,YALGC,OAKeC,OAAS,EAC3BC,aANWC,SAOXT,MAAOA,GAAS,GAChBU,SAAU,SAACC,GACTV,EAASU,EAAEC,OAAOZ,UAGK,mBAAnBL,EAAMkB,SAA0BlB,EAAMkB,SAAS,CAAEb,MAAAA,IAAW,SAQhFN,EAAUoB,aAAe,CACvBf,qBAAqB"}
@@ -1,35 +0,0 @@
1
- import { createElement } from 'react';
2
- import { FieldConnector } from '@contentful/field-editor-shared';
3
- import { TextInput } from '@contentful/f36-components';
4
-
5
- function UrlEditor(props) {
6
- var field = props.field;
7
- return createElement(FieldConnector, {
8
- field: field,
9
- isInitiallyDisabled: props.isInitiallyDisabled
10
- }, function (_ref) {
11
- var value = _ref.value,
12
- errors = _ref.errors,
13
- disabled = _ref.disabled,
14
- setValue = _ref.setValue;
15
- return createElement("div", {
16
- "data-test-id": "url-editor"
17
- }, createElement(TextInput, {
18
- isRequired: field.required,
19
- isInvalid: errors.length > 0,
20
- isDisabled: disabled,
21
- value: value || '',
22
- onChange: function onChange(e) {
23
- setValue(e.target.value);
24
- }
25
- }), typeof props.children === 'function' ? props.children({
26
- value: value
27
- }) : null);
28
- });
29
- }
30
- UrlEditor.defaultProps = {
31
- isInitiallyDisabled: true
32
- };
33
-
34
- export { UrlEditor };
35
- //# sourceMappingURL=field-editor-url.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-editor-url.esm.js","sources":["../src/UrlEditor.tsx"],"sourcesContent":["import * as React from 'react';\nimport { FieldAPI, FieldConnector } from '@contentful/field-editor-shared';\n\nimport { TextInput } from '@contentful/f36-components';\n\nexport interface UrlEditorProps {\n /**\n * is the field disabled initially\n */\n isInitiallyDisabled: boolean;\n\n /**\n * sdk.field\n */\n field: FieldAPI;\n\n children?: (props: { value: string | null | undefined }) => React.ReactNode;\n}\n\nexport function UrlEditor(props: UrlEditorProps) {\n const { field } = props;\n\n return (\n <FieldConnector<string> field={field} isInitiallyDisabled={props.isInitiallyDisabled}>\n {({ value, errors, disabled, setValue }) => {\n return (\n <div data-test-id=\"url-editor\">\n <TextInput\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 {typeof props.children === 'function' ? props.children({ value }) : null}\n </div>\n );\n }}\n </FieldConnector>\n );\n}\n\nUrlEditor.defaultProps = {\n isInitiallyDisabled: true,\n};\n"],"names":["UrlEditor","props","field","React","FieldConnector","isInitiallyDisabled","value","errors","disabled","setValue","TextInput","isRequired","required","isInvalid","length","isDisabled","onChange","e","target","children","defaultProps"],"mappings":";;;;SAmBgBA,UAAUC;AACxB,MAAQC,KAAR,GAAkBD,KAAlB,CAAQC,KAAR;AAEA,SACEC,aAAA,CAACC,cAAD;AAAwBF,IAAAA,KAAK,EAAEA;AAAOG,IAAAA,mBAAmB,EAAEJ,KAAK,CAACI;GAAjE,EACG;QAAGC,aAAAA;QAAOC,cAAAA;QAAQC,gBAAAA;QAAUC,gBAAAA;AAC3B,WACEN,aAAA,MAAA;sBAAkB;KAAlB,EACEA,aAAA,CAACO,SAAD;AACEC,MAAAA,UAAU,EAAET,KAAK,CAACU;AAClBC,MAAAA,SAAS,EAAEN,MAAM,CAACO,MAAP,GAAgB;AAC3BC,MAAAA,UAAU,EAAEP;AACZF,MAAAA,KAAK,EAAEA,KAAK,IAAI;AAChBU,MAAAA,QAAQ,EAAE,kBAACC,CAAD;AACRR,QAAAA,QAAQ,CAACQ,CAAC,CAACC,MAAF,CAASZ,KAAV,CAAR;AACD;KAPH,CADF,EAUG,OAAOL,KAAK,CAACkB,QAAb,KAA0B,UAA1B,GAAuClB,KAAK,CAACkB,QAAN,CAAe;AAAEb,MAAAA,KAAK,EAALA;AAAF,KAAf,CAAvC,GAAmE,IAVtE,CADF;AAcD,GAhBH,CADF;AAoBD;AAEDN,SAAS,CAACoB,YAAV,GAAyB;AACvBf,EAAAA,mBAAmB,EAAE;AADE,CAAzB;;;;"}
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-url.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./field-editor-url.cjs.development.js')
8
- }