@contentful/field-editor-shared 2.13.5 → 2.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/LocalePublishingEntityStatusBadge/LocalePublishingPopover.js +13 -11
- package/dist/cjs/ReleaseEntityStatusBadge/ReleaseEntityStatusPopover.js +17 -13
- package/dist/cjs/hooks/useReleaseStatus.js +8 -39
- package/dist/cjs/utils/getReleaseStatusBadgeConfig.js +2 -0
- package/dist/esm/LocalePublishingEntityStatusBadge/LocalePublishingPopover.js +13 -11
- package/dist/esm/ReleaseEntityStatusBadge/ReleaseEntityStatusPopover.js +17 -13
- package/dist/esm/hooks/useReleaseStatus.js +8 -39
- package/dist/esm/utils/getReleaseStatusBadgeConfig.js +2 -0
- package/dist/types/hooks/useReleaseStatus.d.ts +1 -1
- package/package.json +2 -2
|
@@ -106,23 +106,25 @@ const generateDynamicStyles = (status)=>{
|
|
|
106
106
|
isHover: false
|
|
107
107
|
})
|
|
108
108
|
},
|
|
109
|
-
'& svg[data-status="tertiary"]': {
|
|
110
|
-
fill: getColor({
|
|
111
|
-
tertiary: status?.tertiary,
|
|
112
|
-
isHover: false
|
|
113
|
-
})
|
|
114
|
-
},
|
|
115
109
|
'&:hover svg[data-status="secondary"]': {
|
|
116
110
|
fill: getColor({
|
|
117
111
|
secondary: status?.secondary,
|
|
118
112
|
isHover: true
|
|
119
113
|
})
|
|
120
114
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
115
|
+
...status?.tertiary && {
|
|
116
|
+
'& svg[data-status="tertiary"]': {
|
|
117
|
+
fill: getColor({
|
|
118
|
+
tertiary: status?.tertiary,
|
|
119
|
+
isHover: false
|
|
120
|
+
})
|
|
121
|
+
},
|
|
122
|
+
'&:hover svg[data-status="tertiary"]': {
|
|
123
|
+
fill: getColor({
|
|
124
|
+
tertiary: status?.tertiary,
|
|
125
|
+
isHover: true
|
|
126
|
+
})
|
|
127
|
+
}
|
|
126
128
|
}
|
|
127
129
|
});
|
|
128
130
|
return wrapperClass;
|
|
@@ -63,8 +63,10 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
63
63
|
}
|
|
64
64
|
const getColor = ({ secondary, tertiary, isHover })=>{
|
|
65
65
|
const status = secondary || tertiary;
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
if (!status) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
return isHover ? (0, _getReleaseStatusBadgeConfig.getReleaseStatusBadgeConfig)(status).hover : (0, _getReleaseStatusBadgeConfig.getReleaseStatusBadgeConfig)(status).default;
|
|
68
70
|
};
|
|
69
71
|
const generateDynamicStyles = (status)=>{
|
|
70
72
|
const wrapperClass = (0, _emotion.css)({
|
|
@@ -74,23 +76,25 @@ const generateDynamicStyles = (status)=>{
|
|
|
74
76
|
isHover: false
|
|
75
77
|
})
|
|
76
78
|
},
|
|
77
|
-
'& svg[data-status="tertiary"]': {
|
|
78
|
-
fill: getColor({
|
|
79
|
-
tertiary: status?.tertiary,
|
|
80
|
-
isHover: false
|
|
81
|
-
})
|
|
82
|
-
},
|
|
83
79
|
'&:hover svg[data-status="secondary"]': {
|
|
84
80
|
fill: getColor({
|
|
85
81
|
secondary: status?.secondary,
|
|
86
82
|
isHover: true
|
|
87
83
|
})
|
|
88
84
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
...status?.tertiary && {
|
|
86
|
+
'& svg[data-status="tertiary"]': {
|
|
87
|
+
fill: getColor({
|
|
88
|
+
tertiary: status?.tertiary,
|
|
89
|
+
isHover: false
|
|
90
|
+
})
|
|
91
|
+
},
|
|
92
|
+
'&:hover svg[data-status="tertiary"]': {
|
|
93
|
+
fill: getColor({
|
|
94
|
+
tertiary: status?.tertiary,
|
|
95
|
+
isHover: true
|
|
96
|
+
})
|
|
97
|
+
}
|
|
94
98
|
}
|
|
95
99
|
});
|
|
96
100
|
return wrapperClass;
|
|
@@ -10,47 +10,16 @@ Object.defineProperty(exports, "useReleaseStatus", {
|
|
|
10
10
|
});
|
|
11
11
|
const _react = require("react");
|
|
12
12
|
const _entityHelpers = require("../utils/entityHelpers");
|
|
13
|
+
const _getReleaseStatusBadgeConfig = require("../utils/getReleaseStatusBadgeConfig");
|
|
13
14
|
const _sanitizeLocales = require("../utils/sanitizeLocales");
|
|
14
15
|
function createReleaseLocaleStatus(locale, status) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
case 'willPublish':
|
|
24
|
-
return {
|
|
25
|
-
variant: 'positive',
|
|
26
|
-
status: 'willPublish',
|
|
27
|
-
label: 'Will publish',
|
|
28
|
-
locale
|
|
29
|
-
};
|
|
30
|
-
case 'becomesDraft':
|
|
31
|
-
return {
|
|
32
|
-
variant: 'warning',
|
|
33
|
-
status: 'becomesDraft',
|
|
34
|
-
label: 'Becomes draft',
|
|
35
|
-
locale
|
|
36
|
-
};
|
|
37
|
-
case 'remainsDraft':
|
|
38
|
-
return {
|
|
39
|
-
variant: 'warning',
|
|
40
|
-
status: 'remainsDraft',
|
|
41
|
-
label: 'Remains draft',
|
|
42
|
-
locale
|
|
43
|
-
};
|
|
44
|
-
case 'notInRelease':
|
|
45
|
-
return {
|
|
46
|
-
variant: 'secondary',
|
|
47
|
-
status: 'notInRelease',
|
|
48
|
-
label: 'Not in release',
|
|
49
|
-
locale
|
|
50
|
-
};
|
|
51
|
-
default:
|
|
52
|
-
throw new Error(`Unknown release entity status: ${status}`);
|
|
53
|
-
}
|
|
16
|
+
const { label, variant } = (0, _getReleaseStatusBadgeConfig.getReleaseStatusBadgeConfig)(status);
|
|
17
|
+
return {
|
|
18
|
+
variant,
|
|
19
|
+
status,
|
|
20
|
+
label,
|
|
21
|
+
locale
|
|
22
|
+
};
|
|
54
23
|
}
|
|
55
24
|
function getReleaseItemLocaleStatus(releaseItem, locale, previousEntityOnTimeline) {
|
|
56
25
|
if ('action' in releaseItem) {
|
|
@@ -50,23 +50,25 @@ const generateDynamicStyles = (status)=>{
|
|
|
50
50
|
isHover: false
|
|
51
51
|
})
|
|
52
52
|
},
|
|
53
|
-
'& svg[data-status="tertiary"]': {
|
|
54
|
-
fill: getColor({
|
|
55
|
-
tertiary: status?.tertiary,
|
|
56
|
-
isHover: false
|
|
57
|
-
})
|
|
58
|
-
},
|
|
59
53
|
'&:hover svg[data-status="secondary"]': {
|
|
60
54
|
fill: getColor({
|
|
61
55
|
secondary: status?.secondary,
|
|
62
56
|
isHover: true
|
|
63
57
|
})
|
|
64
58
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
...status?.tertiary && {
|
|
60
|
+
'& svg[data-status="tertiary"]': {
|
|
61
|
+
fill: getColor({
|
|
62
|
+
tertiary: status?.tertiary,
|
|
63
|
+
isHover: false
|
|
64
|
+
})
|
|
65
|
+
},
|
|
66
|
+
'&:hover svg[data-status="tertiary"]': {
|
|
67
|
+
fill: getColor({
|
|
68
|
+
tertiary: status?.tertiary,
|
|
69
|
+
isHover: true
|
|
70
|
+
})
|
|
71
|
+
}
|
|
70
72
|
}
|
|
71
73
|
});
|
|
72
74
|
return wrapperClass;
|
|
@@ -7,8 +7,10 @@ import { getReleaseStatusBadgeConfig } from '../utils/getReleaseStatusBadgeConfi
|
|
|
7
7
|
import { ReleaseEntityStatusLocalesList } from './ReleaseEntityStatusLocalesList';
|
|
8
8
|
const getColor = ({ secondary, tertiary, isHover })=>{
|
|
9
9
|
const status = secondary || tertiary;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
if (!status) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
return isHover ? getReleaseStatusBadgeConfig(status).hover : getReleaseStatusBadgeConfig(status).default;
|
|
12
14
|
};
|
|
13
15
|
const generateDynamicStyles = (status)=>{
|
|
14
16
|
const wrapperClass = css({
|
|
@@ -18,23 +20,25 @@ const generateDynamicStyles = (status)=>{
|
|
|
18
20
|
isHover: false
|
|
19
21
|
})
|
|
20
22
|
},
|
|
21
|
-
'& svg[data-status="tertiary"]': {
|
|
22
|
-
fill: getColor({
|
|
23
|
-
tertiary: status?.tertiary,
|
|
24
|
-
isHover: false
|
|
25
|
-
})
|
|
26
|
-
},
|
|
27
23
|
'&:hover svg[data-status="secondary"]': {
|
|
28
24
|
fill: getColor({
|
|
29
25
|
secondary: status?.secondary,
|
|
30
26
|
isHover: true
|
|
31
27
|
})
|
|
32
28
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
...status?.tertiary && {
|
|
30
|
+
'& svg[data-status="tertiary"]': {
|
|
31
|
+
fill: getColor({
|
|
32
|
+
tertiary: status?.tertiary,
|
|
33
|
+
isHover: false
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
'&:hover svg[data-status="tertiary"]': {
|
|
37
|
+
fill: getColor({
|
|
38
|
+
tertiary: status?.tertiary,
|
|
39
|
+
isHover: true
|
|
40
|
+
})
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
});
|
|
40
44
|
return wrapperClass;
|
|
@@ -1,46 +1,15 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { getEntityStatus } from '../utils/entityHelpers';
|
|
3
|
+
import { getReleaseStatusBadgeConfig } from '../utils/getReleaseStatusBadgeConfig';
|
|
3
4
|
import { sanitizeLocales } from '../utils/sanitizeLocales';
|
|
4
5
|
function createReleaseLocaleStatus(locale, status) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
case 'willPublish':
|
|
14
|
-
return {
|
|
15
|
-
variant: 'positive',
|
|
16
|
-
status: 'willPublish',
|
|
17
|
-
label: 'Will publish',
|
|
18
|
-
locale
|
|
19
|
-
};
|
|
20
|
-
case 'becomesDraft':
|
|
21
|
-
return {
|
|
22
|
-
variant: 'warning',
|
|
23
|
-
status: 'becomesDraft',
|
|
24
|
-
label: 'Becomes draft',
|
|
25
|
-
locale
|
|
26
|
-
};
|
|
27
|
-
case 'remainsDraft':
|
|
28
|
-
return {
|
|
29
|
-
variant: 'warning',
|
|
30
|
-
status: 'remainsDraft',
|
|
31
|
-
label: 'Remains draft',
|
|
32
|
-
locale
|
|
33
|
-
};
|
|
34
|
-
case 'notInRelease':
|
|
35
|
-
return {
|
|
36
|
-
variant: 'secondary',
|
|
37
|
-
status: 'notInRelease',
|
|
38
|
-
label: 'Not in release',
|
|
39
|
-
locale
|
|
40
|
-
};
|
|
41
|
-
default:
|
|
42
|
-
throw new Error(`Unknown release entity status: ${status}`);
|
|
43
|
-
}
|
|
6
|
+
const { label, variant } = getReleaseStatusBadgeConfig(status);
|
|
7
|
+
return {
|
|
8
|
+
variant,
|
|
9
|
+
status,
|
|
10
|
+
label,
|
|
11
|
+
locale
|
|
12
|
+
};
|
|
44
13
|
}
|
|
45
14
|
function getReleaseItemLocaleStatus(releaseItem, locale, previousEntityOnTimeline) {
|
|
46
15
|
if ('action' in releaseItem) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LocalesAPI } from '@contentful/app-sdk';
|
|
2
2
|
import type { AssetProps, EntryProps, LocaleProps, ReleaseProps } from 'contentful-management/types';
|
|
3
|
-
import type { ReleaseEntityStatus,
|
|
3
|
+
import type { ReleaseEntityStatus, ReleaseStatusMap, ReleaseV2Props } from '../types';
|
|
4
4
|
type UseActiveReleaseLocalesStatuses = {
|
|
5
5
|
entity?: EntryProps | AssetProps;
|
|
6
6
|
locales: LocaleProps[] | LocalesAPI;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-shared",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.7",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"registry": "https://npm.pkg.github.com/"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "2739099a4e68026bdafc1e3f8aa11cec9bc6f900"
|
|
62
62
|
}
|