@automattic/jetpack-components 2.2.0 → 2.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ### This is a list detailing changes for the Jetpack RNA Components package releases.
4
4
 
5
+ ## [2.3.0] - 2026-09-01
6
+ ### Added
7
+ - Upsell Banner: Add an optional dismiss button. [#51441]
8
+
9
+ ### Changed
10
+ - Update package dependencies. [#51303] [#51802]
11
+
5
12
  ## [2.2.0] - 2026-08-19
6
13
  ### Added
7
14
  - Gravatar: pick a stable Color Studio background color per email for initials identity avatars via bg_color [#50578]
@@ -1905,6 +1912,7 @@
1905
1912
  ### Changed
1906
1913
  - Update node version requirement to 14.16.1
1907
1914
 
1915
+ [2.3.0]: https://github.com/Automattic/jetpack-components/compare/2.2.0...2.3.0
1908
1916
  [2.2.0]: https://github.com/Automattic/jetpack-components/compare/2.1.1...2.2.0
1909
1917
  [2.1.1]: https://github.com/Automattic/jetpack-components/compare/2.1.0...2.1.1
1910
1918
  [2.1.0]: https://github.com/Automattic/jetpack-components/compare/2.0.1...2.1.0
@@ -1,4 +1,4 @@
1
- declare function ActionButton(props: any): import("react/jsx-runtime").JSX.Element;
1
+ declare function ActionButton(props: any): import("react").JSX.Element;
2
2
  declare namespace ActionButton {
3
3
  var propTypes: {
4
4
  /** The button label. */
@@ -2,5 +2,5 @@
2
2
  * Types
3
3
  */
4
4
  import { ActionPopoverProps } from './types.ts';
5
- declare const ActionPopover: ({ hideCloseButton, title, children, step, totalSteps, buttonContent, buttonDisabled, buttonHref, buttonExternalLink, offset, onClose, onClick, ...otherPopoverProps }: ActionPopoverProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const ActionPopover: ({ hideCloseButton, title, children, step, totalSteps, buttonContent, buttonDisabled, buttonHref, buttonExternalLink, offset, onClose, onClick, ...otherPopoverProps }: ActionPopoverProps) => import("react").JSX.Element;
6
6
  export default ActionPopover;
@@ -23,5 +23,5 @@ interface UplotChartProps {
23
23
  * @param {Annotation[]} props.annotations - The annotations to display in the chart.
24
24
  * @return {ReactElement} The JSX element representing the UplotLineChart component.
25
25
  */
26
- export default function UplotLineChart({ range, periods, annotations }: UplotChartProps): import("react/jsx-runtime").JSX.Element;
26
+ export default function UplotLineChart({ range, periods, annotations }: UplotChartProps): import("react").JSX.Element;
27
27
  export {};
@@ -20,5 +20,5 @@ export interface DecorativeCardProps extends Omit<ComponentProps<'div'>, 'childr
20
20
  * @param {DecorativeCardProps} props - The properties.
21
21
  * @return {import('react').ReactNode} - The DecorativeCard component.
22
22
  */
23
- declare function DecorativeCard({ format, icon, imageUrl, className, ...rest }: DecorativeCardProps): import("react/jsx-runtime").JSX.Element;
23
+ declare function DecorativeCard({ format, icon, imageUrl, className, ...rest }: DecorativeCardProps): import("react").JSX.Element;
24
24
  export default DecorativeCard;
@@ -7,5 +7,5 @@
7
7
  */
8
8
  declare const DetailsViewer: ({ details }: {
9
9
  details: any;
10
- }) => import("react/jsx-runtime").JSX.Element;
10
+ }) => import("react").JSX.Element;
11
11
  export default DetailsViewer;
@@ -1,4 +1,4 @@
1
1
  export declare const DiffViewer: ({ diff }: {
2
2
  diff: any;
3
- }) => import("react/jsx-runtime").JSX.Element;
3
+ }) => import("react").JSX.Element;
4
4
  export default DiffViewer;
@@ -10,5 +10,5 @@ type DotPagerProps = {
10
10
  tracksPrefix?: string;
11
11
  tracksFn?: (eventName: string, data?: Record<string, unknown>) => void;
12
12
  };
13
- declare const DotPager: ({ hasDynamicHeight, children, className, onPageSelected, isClickEnabled, rotateTime, tracksPrefix, tracksFn, ...props }: DotPagerProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const DotPager: ({ hasDynamicHeight, children, className, onPageSelected, isClickEnabled, rotateTime, tracksPrefix, tracksFn, ...props }: DotPagerProps) => import("react").JSX.Element;
14
14
  export default DotPager;
@@ -8,4 +8,4 @@ export type GlobalNoticesProps = {
8
8
  *
9
9
  * @return {import('react').ReactNode} The rendered notices list.
10
10
  */
11
- export declare function GlobalNotices({ maxVisibleNotices }: GlobalNoticesProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function GlobalNotices({ maxVisibleNotices }: GlobalNoticesProps): import("react").JSX.Element;
@@ -4,5 +4,5 @@ declare const LoadingPlaceholder: ({ children, width, height, className, }: {
4
4
  width?: number | string;
5
5
  height?: number;
6
6
  className?: string;
7
- }) => import("react/jsx-runtime").JSX.Element;
7
+ }) => import("react").JSX.Element;
8
8
  export default LoadingPlaceholder;
@@ -1,4 +1,4 @@
1
1
  declare const MarkedLines: ({ context }: {
2
2
  context: any;
3
- }) => import("react/jsx-runtime").JSX.Element;
3
+ }) => import("react").JSX.Element;
4
4
  export default MarkedLines;
@@ -12,4 +12,4 @@ export type FooterProps = React.HTMLAttributes<HTMLDivElement> & {
12
12
  *
13
13
  * @return The rendered footer.
14
14
  */
15
- export declare function Footer({ children, actions, isScreenLocked, className, ...props }: FooterProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function Footer({ children, actions, isScreenLocked, className, ...props }: FooterProps): import("react").JSX.Element;
@@ -26,4 +26,4 @@ export type HeaderProps = {
26
26
  *
27
27
  * @return component
28
28
  */
29
- export declare function Header({ icon, title, isScreenLocked, onGoBack: onGoBackProp, onClose: onCloseProp, }: HeaderProps): import("react/jsx-runtime").JSX.Element;
29
+ export declare function Header({ icon, title, isScreenLocked, onGoBack: onGoBackProp, onClose: onCloseProp, }: HeaderProps): import("react").JSX.Element;
@@ -11,7 +11,7 @@ type NavigatorModalProps = Omit<ModalProps, 'onRequestClose'> & TNavigatorModalC
11
11
  *
12
12
  * @return Component
13
13
  */
14
- declare function NavigatorModalMain({ children, className, initialPath, onClose, isDismissible, ...props }: NavigatorModalProps): import("react/jsx-runtime").JSX.Element;
14
+ declare function NavigatorModalMain({ children, className, initialPath, onClose, isDismissible, ...props }: NavigatorModalProps): import("react").JSX.Element;
15
15
  export declare const NavigatorModal: typeof NavigatorModalMain & {
16
16
  Screen: typeof Screen & {
17
17
  displayName: string;
@@ -42,4 +42,4 @@ export type ScreenProps = Omit<React.ComponentProps<typeof Navigator.Screen>, 'c
42
42
  *
43
43
  * @return The rendered screen.
44
44
  */
45
- export declare function Screen({ path, className, title, sidebar, headerIcon, isScreenLocked, onGoBack, onClose, footerContent, footerActions, children, content, ...props }: ScreenProps): import("react/jsx-runtime").JSX.Element;
45
+ export declare function Screen({ path, className, title, sidebar, headerIcon, isScreenLocked, onGoBack, onClose, footerContent, footerActions, children, content, ...props }: ScreenProps): import("react").JSX.Element;
@@ -5,5 +5,5 @@ import { StatCardProps } from './types.ts';
5
5
  * @param {StatCardProps} props - Component props.
6
6
  * @return {ReactNode} - StatCard react component.
7
7
  */
8
- declare const StatCard: ({ className, hideValue, icon, label, value, variant, }: StatCardProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const StatCard: ({ className, hideValue, icon, label, value, variant, }: StatCardProps) => import("react").JSX.Element;
9
9
  export default StatCard;
@@ -8,5 +8,5 @@ export declare const Swipeable: ({ hasDynamicHeight, children, currentPage, onPa
8
8
  isClickEnabled: any;
9
9
  onPageSelect: any;
10
10
  pageClassName: any;
11
- }) => import("react/jsx-runtime").JSX.Element;
11
+ }) => import("react").JSX.Element;
12
12
  export default Swipeable;
@@ -6,6 +6,7 @@ import './style.scss';
6
6
  *
7
7
  * - The primary CTA is the second button, at the right position.
8
8
  * - The secondary CTA is the first button, at the left position.
9
+ * - Passing `onDismiss` renders a close button in the top corner of the banner.
9
10
  *
10
11
  * @param {UpsellBannerProps} props - Component props.
11
12
  * @return {ReactNode} - UpsellBanner component.
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Card, CardBody } from '@wordpress/components';
3
3
  import { createInterpolateElement } from '@wordpress/element';
4
+ import { __ } from '@wordpress/i18n';
5
+ import { close } from '@wordpress/icons';
4
6
  import Button from '../button/index.js';
5
7
  import './style.scss';
6
8
  /**
@@ -8,13 +10,17 @@ import './style.scss';
8
10
  *
9
11
  * - The primary CTA is the second button, at the right position.
10
12
  * - The secondary CTA is the first button, at the left position.
13
+ * - Passing `onDismiss` renders a close button in the top corner of the banner.
11
14
  *
12
15
  * @param {UpsellBannerProps} props - Component props.
13
16
  * @return {ReactNode} - UpsellBanner component.
14
17
  */
15
18
  const UpsellBanner = props => {
16
- const { icon, title, description, primaryCtaLabel, primaryCtaURL, primaryCtaIsExternalLink, primaryCtaOnClick, secondaryCtaLabel, secondaryCtaURL, secondaryCtaIsExternalLink, secondaryCtaOnClick, } = props;
17
- return (_jsx(Card, { isRounded: true, size: "large", children: _jsxs(CardBody, { className: "upsell-banner", size: "large", children: [icon && (_jsx("div", { className: "upsell-banner--icon", children: _jsx("img", { src: icon, alt: "" }) })), _jsxs("div", { className: "upsell-banner--content", children: [_jsxs("div", { className: "upsell-banner--content-info", children: [_jsx("h3", { children: title }), _jsx("p", { children: createInterpolateElement(description, {
19
+ const { icon, title, description, primaryCtaLabel, primaryCtaURL, primaryCtaIsExternalLink, primaryCtaOnClick, secondaryCtaLabel, secondaryCtaURL, secondaryCtaIsExternalLink, secondaryCtaOnClick, onDismiss, dismissLabel, } = props;
20
+ return (_jsx(Card, { isRounded: true, size: "large", children: _jsxs(CardBody, { className: "upsell-banner", size: "large", children: [onDismiss && (_jsx(Button, { className: "upsell-banner--dismiss", variant: "tertiary", size: "small", icon: close, iconSize: 16,
21
+ // Button wraps its children in a span, so the tooltip an icon-only
22
+ // WPButton would show on its own has to be asked for explicitly.
23
+ showTooltip: true, label: dismissLabel || __('Dismiss', 'jetpack-components'), onClick: onDismiss })), icon && (_jsx("div", { className: "upsell-banner--icon", children: _jsx("img", { src: icon, alt: "" }) })), _jsxs("div", { className: "upsell-banner--content", children: [_jsxs("div", { className: "upsell-banner--content-info", children: [_jsx("h3", { children: title }), _jsx("p", { children: createInterpolateElement(description, {
18
24
  br: _jsx("br", {}),
19
25
  }) })] }), _jsxs("div", { className: "upsell-banner--content-cta", children: [secondaryCtaLabel && secondaryCtaURL && (_jsx(Button, { className: "upsell-banner--content-cta-button secondary", href: secondaryCtaURL, onClick: secondaryCtaOnClick ?? undefined, isExternalLink: secondaryCtaIsExternalLink, children: secondaryCtaLabel })), primaryCtaLabel && primaryCtaURL && (_jsx(Button, { className: "upsell-banner--content-cta-button primary", href: primaryCtaURL, onClick: primaryCtaOnClick ?? undefined, isExternalLink: primaryCtaIsExternalLink, children: primaryCtaLabel }))] })] })] }) }));
20
26
  };
@@ -5,6 +5,7 @@
5
5
  .upsell-banner {
6
6
  display: flex;
7
7
  flex-direction: column;
8
+ position: relative;
8
9
 
9
10
  background: rgb(249, 249, 246);
10
11
  background: linear-gradient(133deg, rgb(206, 217, 242) 0%, rgb(249, 249, 246) 10%, rgb(249, 249, 246) 80%, rgb(245, 230, 179) 100%);
@@ -18,6 +19,13 @@
18
19
  padding: 36px;
19
20
  }
20
21
 
22
+ .upsell-banner--dismiss.components-button {
23
+ position: absolute;
24
+ inset-block-start: 8px;
25
+ inset-inline-end: 8px;
26
+ color: var(--jp-gray-60);
27
+ }
28
+
21
29
  .upsell-banner--icon {
22
30
  display: flex;
23
31
  align-items: flex-start;
@@ -10,4 +10,8 @@ export type UpsellBannerProps = {
10
10
  secondaryCtaURL?: string;
11
11
  secondaryCtaIsExternalLink?: boolean;
12
12
  secondaryCtaOnClick?: () => void;
13
+ /** Renders a dismiss button in the top corner of the banner when provided. */
14
+ onDismiss?: () => void;
15
+ /** Accessible label for the dismiss button. Defaults to "Dismiss". */
16
+ dismissLabel?: string;
13
17
  };
@@ -1,5 +1,7 @@
1
1
  import { Card, CardBody } from '@wordpress/components';
2
2
  import { createInterpolateElement } from '@wordpress/element';
3
+ import { __ } from '@wordpress/i18n';
4
+ import { close } from '@wordpress/icons';
3
5
  import Button from '../button/index.tsx';
4
6
  import { UpsellBannerProps } from './types.ts';
5
7
  import type { FC, ReactNode } from 'react';
@@ -11,6 +13,7 @@ import './style.scss';
11
13
  *
12
14
  * - The primary CTA is the second button, at the right position.
13
15
  * - The secondary CTA is the first button, at the left position.
16
+ * - Passing `onDismiss` renders a close button in the top corner of the banner.
14
17
  *
15
18
  * @param {UpsellBannerProps} props - Component props.
16
19
  * @return {ReactNode} - UpsellBanner component.
@@ -28,11 +31,27 @@ const UpsellBanner: FC< UpsellBannerProps > = props => {
28
31
  secondaryCtaURL,
29
32
  secondaryCtaIsExternalLink,
30
33
  secondaryCtaOnClick,
34
+ onDismiss,
35
+ dismissLabel,
31
36
  } = props;
32
37
 
33
38
  return (
34
39
  <Card isRounded={ true } size="large">
35
40
  <CardBody className="upsell-banner" size="large">
41
+ { onDismiss && (
42
+ <Button
43
+ className="upsell-banner--dismiss"
44
+ variant="tertiary"
45
+ size="small"
46
+ icon={ close }
47
+ iconSize={ 16 }
48
+ // Button wraps its children in a span, so the tooltip an icon-only
49
+ // WPButton would show on its own has to be asked for explicitly.
50
+ showTooltip={ true }
51
+ label={ dismissLabel || __( 'Dismiss', 'jetpack-components' ) }
52
+ onClick={ onDismiss }
53
+ />
54
+ ) }
36
55
  { icon && (
37
56
  <div className="upsell-banner--icon">
38
57
  <img src={ icon } alt="" />
@@ -5,6 +5,7 @@
5
5
  .upsell-banner {
6
6
  display: flex;
7
7
  flex-direction: column;
8
+ position: relative;
8
9
 
9
10
  background: rgb(249, 249, 246);
10
11
  background: linear-gradient(133deg, rgb(206, 217, 242) 0%, rgb(249, 249, 246) 10%, rgb(249, 249, 246) 80%, rgb(245, 230, 179) 100%);
@@ -18,6 +19,13 @@
18
19
  padding: 36px;
19
20
  }
20
21
 
22
+ .upsell-banner--dismiss.components-button {
23
+ position: absolute;
24
+ inset-block-start: 8px;
25
+ inset-inline-end: 8px;
26
+ color: var(--jp-gray-60);
27
+ }
28
+
21
29
  .upsell-banner--icon {
22
30
  display: flex;
23
31
  align-items: flex-start;
@@ -10,4 +10,8 @@ export type UpsellBannerProps = {
10
10
  secondaryCtaURL?: string;
11
11
  secondaryCtaIsExternalLink?: boolean;
12
12
  secondaryCtaOnClick?: () => void;
13
+ /** Renders a dismiss button in the top corner of the banner when provided. */
14
+ onDismiss?: () => void;
15
+ /** Accessible label for the dismiss button. Defaults to "Dismiss". */
16
+ dismissLabel?: string;
13
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-components",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Jetpack Components Package",
5
5
  "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/components/#readme",
6
6
  "bugs": {
@@ -74,28 +74,28 @@
74
74
  "dependencies": {
75
75
  "@automattic/format-currency": "1.0.1",
76
76
  "@automattic/jetpack-api": "^1.0.32",
77
- "@automattic/jetpack-boost-score-api": "^1.0.55",
77
+ "@automattic/jetpack-boost-score-api": "^1.0.56",
78
78
  "@automattic/jetpack-script-data": "^0.6.6",
79
- "@automattic/number-formatters": "^1.2.7",
79
+ "@automattic/number-formatters": "^1.2.8",
80
80
  "@babel/runtime": "^7",
81
81
  "@gravatar-com/hovercards": "0.16.0",
82
- "@wordpress/admin-ui": "2.7.0",
82
+ "@wordpress/admin-ui": "2.8.0",
83
83
  "@wordpress/browserslist-config": "6.51.0",
84
84
  "@wordpress/components": "37.0.0",
85
- "@wordpress/compose": "8.4.0",
85
+ "@wordpress/compose": "8.6.0",
86
86
  "@wordpress/data": "10.51.0",
87
87
  "@wordpress/date": "5.51.0",
88
88
  "@wordpress/element": "8.3.0",
89
89
  "@wordpress/i18n": "6.24.0",
90
- "@wordpress/icons": "15.3.0",
90
+ "@wordpress/icons": "15.4.0",
91
91
  "@wordpress/notices": "5.51.0",
92
- "@wordpress/theme": "1.1.0",
93
- "@wordpress/ui": "0.19.0",
92
+ "@wordpress/theme": "1.2.0",
93
+ "@wordpress/ui": "0.20.0",
94
94
  "clsx": "2.1.1",
95
95
  "js-sha256": "0.11.1",
96
96
  "prop-types": "^15.7.2",
97
97
  "qrcode.react": "4.2.0",
98
- "social-logos": "^3.3.18",
98
+ "social-logos": "^3.3.19",
99
99
  "uplot": "1.6.31",
100
100
  "uplot-react": "1.1.4"
101
101
  },
@@ -109,7 +109,7 @@
109
109
  "@testing-library/react": "16.3.2",
110
110
  "@testing-library/user-event": "14.6.1",
111
111
  "@types/jest": "30.0.0",
112
- "@types/react": "18.3.28",
112
+ "@types/react": "18.3.31",
113
113
  "@types/react-dom": "18.3.7",
114
114
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
115
115
  "jest": "30.4.2",