@automattic/jetpack-components 0.45.8 → 0.45.10
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/CHANGELOG.md +13 -0
- package/components/admin-page/types.ts +5 -0
- package/components/icon-tooltip/index.tsx +4 -2
- package/components/icon-tooltip/style.scss +12 -9
- package/components/icon-tooltip/types.ts +10 -0
- package/components/jetpack-footer/README.md +0 -1
- package/components/jetpack-footer/index.tsx +3 -3
- package/package.json +13 -13
- package/tools/get-site-admin-url/README.md +10 -0
- package/tools/get-site-admin-url/index.ts +14 -0
- package/tools/get-site-admin-url/types.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
### This is a list detailing changes for the Jetpack RNA Components package releases.
|
|
4
4
|
|
|
5
|
+
## [0.45.10] - 2024-01-04
|
|
6
|
+
### Changed
|
|
7
|
+
- Updated package dependencies. [#34815] [#34816]
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Added consistency for Jetpack footer links [#34787]
|
|
11
|
+
|
|
12
|
+
## [0.45.9] - 2024-01-02
|
|
13
|
+
### Changed
|
|
14
|
+
- Updated the design and fixed a11y for Quick Share buttons. [#34754]
|
|
15
|
+
|
|
5
16
|
## [0.45.8] - 2023-12-19
|
|
6
17
|
### Changed
|
|
7
18
|
- Updated package dependencies. [#34694, #34696]
|
|
@@ -906,6 +917,8 @@
|
|
|
906
917
|
### Changed
|
|
907
918
|
- Update node version requirement to 14.16.1
|
|
908
919
|
|
|
920
|
+
[0.45.10]: https://github.com/Automattic/jetpack-components/compare/0.45.9...0.45.10
|
|
921
|
+
[0.45.9]: https://github.com/Automattic/jetpack-components/compare/0.45.8...0.45.9
|
|
909
922
|
[0.45.8]: https://github.com/Automattic/jetpack-components/compare/0.45.7...0.45.8
|
|
910
923
|
[0.45.7]: https://github.com/Automattic/jetpack-components/compare/0.45.6...0.45.7
|
|
911
924
|
[0.45.6]: https://github.com/Automattic/jetpack-components/compare/0.45.5...0.45.6
|
|
@@ -39,6 +39,8 @@ const IconTooltip: React.FC< IconTooltipProps > = ( {
|
|
|
39
39
|
popoverAnchorStyle = 'icon',
|
|
40
40
|
forceShow = false,
|
|
41
41
|
wide = false,
|
|
42
|
+
inline = true,
|
|
43
|
+
shift = false,
|
|
42
44
|
} ) => {
|
|
43
45
|
const POPOVER_HELPER_WIDTH = 124;
|
|
44
46
|
const [ isVisible, setIsVisible ] = useState( false );
|
|
@@ -57,7 +59,8 @@ const IconTooltip: React.FC< IconTooltipProps > = ( {
|
|
|
57
59
|
focusOnMount: 'container' as const,
|
|
58
60
|
onClose: hideTooltip,
|
|
59
61
|
className: 'icon-tooltip-container',
|
|
60
|
-
inline
|
|
62
|
+
inline,
|
|
63
|
+
shift,
|
|
61
64
|
};
|
|
62
65
|
|
|
63
66
|
const isAnchorWrapper = popoverAnchorStyle === 'wrapper';
|
|
@@ -76,7 +79,6 @@ const IconTooltip: React.FC< IconTooltipProps > = ( {
|
|
|
76
79
|
<Gridicon className={ iconClassName } icon={ iconCode } size={ iconSize } />
|
|
77
80
|
</Button>
|
|
78
81
|
) }
|
|
79
|
-
|
|
80
82
|
<div
|
|
81
83
|
className={ classNames( 'icon-tooltip-helper', { 'is-wide': wide } ) }
|
|
82
84
|
style={ iconShiftBySize }
|
|
@@ -53,15 +53,6 @@ $arrow-color: var( --jp-gray );
|
|
|
53
53
|
* Fix arrow position for legacy position option - section end
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
|
-
.components-popover__content {
|
|
57
|
-
padding: 24px;
|
|
58
|
-
width: 304px;
|
|
59
|
-
white-space: normal;
|
|
60
|
-
border-radius: 4px;
|
|
61
|
-
outline: none;
|
|
62
|
-
border: 1px solid $arrow-color;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
56
|
&.is-wide .components-popover__content {
|
|
66
57
|
width: 440px;
|
|
67
58
|
}
|
|
@@ -91,6 +82,18 @@ $arrow-color: var( --jp-gray );
|
|
|
91
82
|
.icon-tooltip-container {
|
|
92
83
|
// Recover events
|
|
93
84
|
pointer-events: all;
|
|
85
|
+
|
|
86
|
+
// __content styles here covers both the inline and portal modes
|
|
87
|
+
.components-popover__content {
|
|
88
|
+
padding: 24px;
|
|
89
|
+
width: 304px;
|
|
90
|
+
white-space: normal;
|
|
91
|
+
border-radius: 4px;
|
|
92
|
+
outline: none;
|
|
93
|
+
border: 1px solid $arrow-color;
|
|
94
|
+
max-width: 90vw;
|
|
95
|
+
margin: 0 10px;
|
|
96
|
+
}
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
.icon-tooltip-title {
|
|
@@ -73,4 +73,14 @@ export type IconTooltipProps = {
|
|
|
73
73
|
* Uses a wider content area when enabled.
|
|
74
74
|
*/
|
|
75
75
|
wide?: boolean;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Whether to render the popover inline or as a portal.
|
|
79
|
+
*/
|
|
80
|
+
inline?: boolean;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Enables the Popover to shift in order to stay in view when meeting the viewport edges.
|
|
84
|
+
*/
|
|
85
|
+
shift?: boolean;
|
|
76
86
|
};
|
|
@@ -18,4 +18,3 @@ It takes moduleName and URL to show in the footer.
|
|
|
18
18
|
- `onAboutClick`: () => void - (default: `undefined`) function called when the About link is clicked.
|
|
19
19
|
- `onPrivacyClick`: () => void - (default: `undefined`) function called when the Privacy link is clicked.
|
|
20
20
|
- `onTermsClick`: () => void - (default: `undefined`) function called when the Terms link is clicked.
|
|
21
|
-
- `siteAdminUrl`: String - (default: `undefined`) URL of the site WP Admin. Required to link to internal pages when applicable (e.g., Privacy).
|
|
@@ -5,6 +5,7 @@ import classnames from 'classnames';
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { getRedirectUrl } from '../..';
|
|
7
7
|
import { STORE_ID as CONNECTION_STORE_ID } from '../../../../js-packages/connection/state/store';
|
|
8
|
+
import getSiteAdminUrl from '../../tools/get-site-admin-url';
|
|
8
9
|
import AutomatticBylineLogo from '../automattic-byline-logo';
|
|
9
10
|
import './style.scss';
|
|
10
11
|
import JetpackLogo from '../jetpack-logo';
|
|
@@ -26,7 +27,6 @@ const JetpackFooter: React.FC< JetpackFooterProps > = ( {
|
|
|
26
27
|
className,
|
|
27
28
|
moduleNameHref = 'https://jetpack.com',
|
|
28
29
|
menu,
|
|
29
|
-
siteAdminUrl,
|
|
30
30
|
onAboutClick,
|
|
31
31
|
onPrivacyClick,
|
|
32
32
|
onTermsClick,
|
|
@@ -50,7 +50,7 @@ const JetpackFooter: React.FC< JetpackFooterProps > = ( {
|
|
|
50
50
|
},
|
|
51
51
|
[ CONNECTION_STORE_ID ]
|
|
52
52
|
);
|
|
53
|
-
|
|
53
|
+
const siteAdminUrl = getSiteAdminUrl();
|
|
54
54
|
const areAdminLinksEnabled =
|
|
55
55
|
siteAdminUrl &&
|
|
56
56
|
// Some admin pages require the site to be connected (e.g., Privacy)
|
|
@@ -65,7 +65,7 @@ const JetpackFooter: React.FC< JetpackFooterProps > = ( {
|
|
|
65
65
|
href: areAdminLinksEnabled
|
|
66
66
|
? new URL( 'admin.php?page=jetpack_about', siteAdminUrl ).href
|
|
67
67
|
: getRedirectUrl( 'jetpack-about' ),
|
|
68
|
-
target: '_blank',
|
|
68
|
+
target: areAdminLinksEnabled ? '_self' : '_blank',
|
|
69
69
|
onClick: onAboutClick,
|
|
70
70
|
},
|
|
71
71
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-components",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.10",
|
|
4
4
|
"description": "Jetpack Components Package",
|
|
5
5
|
"author": "Automattic",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@automattic/format-currency": "1.0.1",
|
|
18
|
-
"@automattic/jetpack-boost-score-api": "^0.1.
|
|
18
|
+
"@automattic/jetpack-boost-score-api": "^0.1.19",
|
|
19
19
|
"@babel/runtime": "^7",
|
|
20
|
-
"@wordpress/browserslist-config": "5.
|
|
21
|
-
"@wordpress/components": "25.
|
|
22
|
-
"@wordpress/compose": "6.
|
|
23
|
-
"@wordpress/data": "9.
|
|
24
|
-
"@wordpress/date": "4.
|
|
25
|
-
"@wordpress/element": "5.
|
|
26
|
-
"@wordpress/i18n": "4.
|
|
27
|
-
"@wordpress/icons": "9.
|
|
20
|
+
"@wordpress/browserslist-config": "5.31.0",
|
|
21
|
+
"@wordpress/components": "25.14.0",
|
|
22
|
+
"@wordpress/compose": "6.25.0",
|
|
23
|
+
"@wordpress/data": "9.18.0",
|
|
24
|
+
"@wordpress/date": "4.48.0",
|
|
25
|
+
"@wordpress/element": "5.25.0",
|
|
26
|
+
"@wordpress/i18n": "4.48.0",
|
|
27
|
+
"@wordpress/icons": "9.39.0",
|
|
28
28
|
"classnames": "2.3.2",
|
|
29
29
|
"prop-types": "^15.7.2",
|
|
30
30
|
"qrcode.react": "3.1.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"uplot-react": "1.1.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@automattic/jetpack-base-styles": "^0.6.
|
|
37
|
+
"@automattic/jetpack-base-styles": "^0.6.15",
|
|
38
38
|
"@babel/core": "7.23.5",
|
|
39
39
|
"@babel/preset-react": "7.23.3",
|
|
40
40
|
"@jest/globals": "29.4.3",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@storybook/react": "7.6.5",
|
|
44
44
|
"@testing-library/dom": "9.3.3",
|
|
45
45
|
"@testing-library/react": "14.1.2",
|
|
46
|
-
"@testing-library/user-event": "14.5.
|
|
47
|
-
"@types/jest": "29.5.
|
|
46
|
+
"@testing-library/user-event": "14.5.2",
|
|
47
|
+
"@types/jest": "29.5.11",
|
|
48
48
|
"@types/qrcode.react": "1.0.4",
|
|
49
49
|
"@types/react": "18.2.33",
|
|
50
50
|
"@types/react-dom": "18.2.14",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# GetSiteAdminUrl
|
|
2
|
+
|
|
3
|
+
The `getsiteadminurl` tool is a utility that retrieves the URL of the site administrator for a given website. It is designed to unify the process of obtaining the admin URL.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { getSiteAdminUrl } from '@automattic/jetpack-components';
|
|
9
|
+
getSiteAdminUrl();
|
|
10
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the site admin URL.
|
|
4
|
+
*
|
|
5
|
+
* @returns {?string} The site admin URL or null if not available.
|
|
6
|
+
*/
|
|
7
|
+
export default function getSiteAdminUrl() {
|
|
8
|
+
return (
|
|
9
|
+
window.Initial_State?.adminUrl ||
|
|
10
|
+
window.Jetpack_Editor_Initial_State?.adminUrl ||
|
|
11
|
+
window?.myJetpackInitialState?.adminUrl ||
|
|
12
|
+
null
|
|
13
|
+
);
|
|
14
|
+
}
|