@automattic/jetpack-components 1.1.6 → 1.1.8
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 +10 -0
- package/build/components/action-button/index.d.ts +2 -3
- package/build/components/action-button/index.js +1 -8
- package/build/components/action-popover/types.d.ts +4 -3
- package/build/components/admin-page/index.d.ts +3 -3
- package/build/components/admin-page/index.js +1 -1
- package/build/components/admin-page/types.d.ts +3 -2
- package/build/components/admin-section/basic/index.d.ts +3 -3
- package/build/components/admin-section/basic/index.js +1 -1
- package/build/components/admin-section/hero/index.d.ts +3 -3
- package/build/components/admin-section/hero/index.js +1 -1
- package/build/components/admin-section/types.d.ts +2 -1
- package/build/components/alert/index.d.ts +9 -9
- package/build/components/alert/index.js +7 -7
- package/build/components/automattic-byline-logo/index.d.ts +3 -3
- package/build/components/automattic-byline-logo/index.js +1 -1
- package/build/components/automattic-byline-logo/types.d.ts +2 -2
- package/build/components/automattic-for-agencies-logo/index.d.ts +3 -3
- package/build/components/automattic-for-agencies-logo/index.js +1 -1
- package/build/components/automattic-icon-logo/index.d.ts +3 -3
- package/build/components/automattic-icon-logo/index.js +1 -1
- package/build/components/badge/index.d.ts +4 -4
- package/build/components/badge/index.js +1 -1
- package/build/components/boost-score-graph/index.d.ts +2 -2
- package/build/components/boost-score-graph/index.js +1 -1
- package/build/components/boost-score-graph/uplot-line-chart.d.ts +3 -3
- package/build/components/boost-score-graph/uplot-line-chart.js +1 -1
- package/build/components/boost-score-graph/use-resize.d.ts +4 -4
- package/build/components/boost-score-graph/use-resize.js +2 -2
- package/build/components/button/index.d.ts +2 -3
- package/build/components/button/index.js +1 -7
- package/build/components/button/types.d.ts +4 -4
- package/build/components/chip/index.d.ts +3 -3
- package/build/components/chip/index.js +1 -1
- package/build/components/contextual-upgrade-trigger/index.d.ts +2 -2
- package/build/components/copy-to-clipboard/index.d.ts +2 -2
- package/build/components/decorative-card/index.d.ts +3 -3
- package/build/components/decorative-card/index.js +2 -2
- package/build/components/dialog/index.d.ts +10 -10
- package/build/components/dialog/index.js +6 -6
- package/build/components/donut-meter/index.d.ts +3 -3
- package/build/components/donut-meter/index.js +1 -1
- package/build/components/icon-tooltip/index.d.ts +3 -3
- package/build/components/icon-tooltip/index.js +1 -1
- package/build/components/icon-tooltip/types.d.ts +2 -1
- package/build/components/icons/index.d.ts +51 -51
- package/build/components/icons/index.js +4 -4
- package/build/components/icons/types.d.ts +2 -2
- package/build/components/indeterminate-progress-bar/index.d.ts +3 -3
- package/build/components/indeterminate-progress-bar/index.js +1 -1
- package/build/components/jetpack-footer/index.d.ts +3 -3
- package/build/components/jetpack-footer/index.js +1 -1
- package/build/components/jetpack-logo/index.d.ts +2 -2
- package/build/components/jetpack-protect-logo/index.d.ts +2 -2
- package/build/components/jetpack-search-logo/index.d.ts +2 -2
- package/build/components/jetpack-vaultpress-backup-logo/index.d.ts +2 -2
- package/build/components/jetpack-videopress-logo/index.d.ts +2 -2
- package/build/components/layout/col/index.d.ts +3 -3
- package/build/components/layout/col/index.js +1 -1
- package/build/components/layout/container/index.d.ts +1 -2
- package/build/components/layout/container/index.js +3 -3
- package/build/components/layout/types.d.ts +3 -2
- package/build/components/loading-placeholder/index.d.ts +2 -2
- package/build/components/notice/index.d.ts +12 -12
- package/build/components/notice/index.js +8 -8
- package/build/components/number-slider/index.d.ts +3 -3
- package/build/components/number-slider/index.js +3 -3
- package/build/components/number-slider/types.d.ts +2 -2
- package/build/components/popover/index.d.ts +5 -4
- package/build/components/pricing-card/index.d.ts +3 -3
- package/build/components/pricing-card/index.js +1 -1
- package/build/components/pricing-card/types.d.ts +6 -6
- package/build/components/pricing-table/index.d.ts +5 -5
- package/build/components/pricing-table/types.d.ts +7 -6
- package/build/components/product-offer/icons-card.d.ts +3 -3
- package/build/components/product-offer/icons-card.js +1 -1
- package/build/components/product-offer/index.d.ts +3 -3
- package/build/components/product-offer/index.js +1 -1
- package/build/components/product-offer/product-offer-header.d.ts +3 -3
- package/build/components/product-offer/product-offer-header.js +1 -1
- package/build/components/product-offer/types.d.ts +2 -1
- package/build/components/product-price/index.d.ts +3 -3
- package/build/components/product-price/index.js +1 -1
- package/build/components/product-price/price.d.ts +3 -3
- package/build/components/product-price/price.js +1 -1
- package/build/components/product-price/types.d.ts +2 -1
- package/build/components/progress-bar/index.d.ts +3 -3
- package/build/components/progress-bar/index.js +1 -1
- package/build/components/qr-code/index.d.ts +5 -5
- package/build/components/qr-code/index.js +1 -1
- package/build/components/radio-control/index.d.ts +4 -3
- package/build/components/record-meter-bar/index.d.ts +3 -3
- package/build/components/record-meter-bar/index.js +1 -1
- package/build/components/spinner/index.js +0 -1
- package/build/components/split-button/index.d.ts +2 -2
- package/build/components/split-button/types.d.ts +3 -5
- package/build/components/stat-card/index.d.ts +1 -1
- package/build/components/stat-card/index.js +1 -1
- package/build/components/stat-card/types.d.ts +2 -1
- package/build/components/status/index.d.ts +2 -1
- package/build/components/swipeable/index.js +1 -1
- package/build/components/terms-of-service/index.d.ts +2 -1
- package/build/components/text/index.d.ts +9 -9
- package/build/components/text/index.js +4 -4
- package/build/components/text/types.d.ts +5 -5
- package/build/components/theme-provider/index.d.ts +3 -3
- package/build/components/theme-provider/index.js +1 -1
- package/build/components/theme-provider/types.d.ts +2 -1
- package/build/components/toggle-control/index.d.ts +4 -3
- package/build/components/upsell-banner/index.d.ts +3 -3
- package/build/components/upsell-banner/index.js +1 -1
- package/components/action-button/index.jsx +1 -8
- package/components/action-popover/index.tsx +0 -1
- package/components/action-popover/types.ts +4 -3
- package/components/admin-page/index.tsx +3 -3
- package/components/admin-page/types.ts +3 -2
- package/components/admin-section/basic/index.tsx +3 -3
- package/components/admin-section/hero/index.tsx +3 -3
- package/components/admin-section/types.ts +3 -1
- package/components/alert/index.tsx +9 -14
- package/components/automattic-byline-logo/index.tsx +3 -3
- package/components/automattic-byline-logo/types.ts +2 -2
- package/components/automattic-for-agencies-logo/index.tsx +3 -3
- package/components/automattic-icon-logo/index.tsx +3 -3
- package/components/badge/index.tsx +4 -4
- package/components/boost-score-graph/index.tsx +2 -2
- package/components/boost-score-graph/uplot-line-chart.tsx +5 -4
- package/components/boost-score-graph/use-resize.ts +6 -5
- package/components/button/index.tsx +3 -8
- package/components/button/types.ts +4 -4
- package/components/chip/index.tsx +3 -3
- package/components/contextual-upgrade-trigger/index.tsx +2 -2
- package/components/copy-to-clipboard/index.tsx +4 -4
- package/components/decorative-card/index.tsx +3 -7
- package/components/details-viewer/index.tsx +0 -1
- package/components/dialog/index.tsx +10 -10
- package/components/donut-meter/index.tsx +3 -3
- package/components/dot-pager/index.tsx +1 -1
- package/components/icon-tooltip/index.tsx +3 -3
- package/components/icon-tooltip/types.ts +3 -1
- package/components/icons/index.tsx +23 -32
- package/components/icons/types.ts +2 -2
- package/components/indeterminate-progress-bar/index.tsx +3 -3
- package/components/jetpack-footer/index.tsx +5 -5
- package/components/jetpack-logo/index.tsx +2 -2
- package/components/jetpack-protect-logo/index.tsx +2 -2
- package/components/jetpack-search-logo/index.tsx +2 -2
- package/components/jetpack-vaultpress-backup-logo/index.tsx +2 -2
- package/components/jetpack-videopress-logo/index.tsx +2 -2
- package/components/layout/col/index.tsx +3 -3
- package/components/layout/container/index.tsx +6 -6
- package/components/layout/types.ts +4 -2
- package/components/loading-placeholder/index.tsx +2 -2
- package/components/notice/index.tsx +12 -12
- package/components/number-slider/index.tsx +6 -5
- package/components/number-slider/types.ts +2 -2
- package/components/popover/index.tsx +5 -4
- package/components/pricing-card/index.tsx +3 -3
- package/components/pricing-card/types.ts +6 -6
- package/components/pricing-table/index.tsx +6 -5
- package/components/pricing-table/types.ts +7 -6
- package/components/product-offer/icons-card.tsx +4 -3
- package/components/product-offer/index.tsx +3 -3
- package/components/product-offer/product-offer-header.tsx +3 -3
- package/components/product-offer/types.ts +2 -1
- package/components/product-price/index.tsx +3 -3
- package/components/product-price/price.tsx +3 -3
- package/components/product-price/types.ts +3 -1
- package/components/progress-bar/index.tsx +3 -3
- package/components/qr-code/index.tsx +5 -5
- package/components/radio-control/index.tsx +4 -3
- package/components/record-meter-bar/index.tsx +4 -3
- package/components/spinner/README.md +2 -2
- package/components/spinner/index.jsx +0 -1
- package/components/split-button/index.tsx +2 -2
- package/components/split-button/types.ts +3 -5
- package/components/stat-card/index.tsx +2 -2
- package/components/stat-card/types.ts +3 -1
- package/components/status/index.tsx +2 -1
- package/components/swipeable/index.tsx +4 -3
- package/components/terms-of-service/index.tsx +3 -2
- package/components/text/index.tsx +9 -12
- package/components/text/types.ts +4 -4
- package/components/theme-provider/index.tsx +4 -3
- package/components/theme-provider/types.ts +3 -1
- package/components/toggle-control/index.tsx +4 -3
- package/components/upsell-banner/index.tsx +3 -3
- package/components/zendesk-chat/README.md +0 -1
- package/package.json +5 -5
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
1
2
|
interface ToggleControlProps {
|
|
2
3
|
/** Whether or not the toggle is currently enabled. */
|
|
3
4
|
checked?: boolean;
|
|
@@ -6,15 +7,15 @@ interface ToggleControlProps {
|
|
|
6
7
|
/** Whether or not the toggle is currently disabled. */
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
/** Additional information to display below the toggle. */
|
|
9
|
-
help?:
|
|
10
|
+
help?: ReactNode;
|
|
10
11
|
/** Whether or not the toggling is currently toggling. */
|
|
11
12
|
toggling?: boolean;
|
|
12
13
|
/** The label for the toggle. */
|
|
13
|
-
label?:
|
|
14
|
+
label?: ReactNode;
|
|
14
15
|
/** The size of the toggle. */
|
|
15
16
|
size?: 'small' | 'normal';
|
|
16
17
|
/** A callback function invoked when the toggle is clicked. */
|
|
17
18
|
onChange: (value: boolean) => void;
|
|
18
19
|
}
|
|
19
|
-
declare const ToggleControl:
|
|
20
|
+
declare const ToggleControl: FC<ToggleControlProps>;
|
|
20
21
|
export default ToggleControl;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { UpsellBannerProps } from './types.ts';
|
|
2
|
+
import type { FC } from 'react';
|
|
3
3
|
import './style.scss';
|
|
4
4
|
/**
|
|
5
5
|
* Upsell banner component.
|
|
@@ -8,7 +8,7 @@ import './style.scss';
|
|
|
8
8
|
* - The secondary CTA is the first button, at the left position.
|
|
9
9
|
*
|
|
10
10
|
* @param {UpsellBannerProps} props - Component props.
|
|
11
|
-
* @return {
|
|
11
|
+
* @return {ReactNode} - UpsellBanner component.
|
|
12
12
|
*/
|
|
13
|
-
declare const UpsellBanner:
|
|
13
|
+
declare const UpsellBanner: FC<UpsellBannerProps>;
|
|
14
14
|
export default UpsellBanner;
|
|
@@ -10,7 +10,7 @@ import './style.scss';
|
|
|
10
10
|
* - The secondary CTA is the first button, at the left position.
|
|
11
11
|
*
|
|
12
12
|
* @param {UpsellBannerProps} props - Component props.
|
|
13
|
-
* @return {
|
|
13
|
+
* @return {ReactNode} - UpsellBanner component.
|
|
14
14
|
*/
|
|
15
15
|
const UpsellBanner = props => {
|
|
16
16
|
const { icon, title, description, primaryCtaLabel, primaryCtaURL, primaryCtaIsExternalLink, primaryCtaOnClick, secondaryCtaLabel, secondaryCtaURL, secondaryCtaIsExternalLink, secondaryCtaOnClick, } = props;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { Spinner } from '@wordpress/components';
|
|
5
2
|
import { __ } from '@wordpress/i18n';
|
|
6
3
|
import clsx from 'clsx';
|
|
7
4
|
import PropTypes from 'prop-types';
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import React from 'react';
|
|
12
5
|
import Button from '../button/index.tsx';
|
|
13
6
|
import styles from './style.module.scss';
|
|
14
7
|
|
|
@@ -20,7 +13,7 @@ import styles from './style.module.scss';
|
|
|
20
13
|
* It is useful to async actions when the user has to wait the result of a request or process.
|
|
21
14
|
*
|
|
22
15
|
* @param {object} props - The properties.
|
|
23
|
-
* @return {
|
|
16
|
+
* @return {import('react').ReactNode} The `ActionButton` component.
|
|
24
17
|
*/
|
|
25
18
|
const ActionButton = props => {
|
|
26
19
|
const {
|
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
* Types
|
|
3
3
|
*/
|
|
4
4
|
import type { Popover } from '@wordpress/components';
|
|
5
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
5
6
|
|
|
6
|
-
export type ActionPopoverProps =
|
|
7
|
+
export type ActionPopoverProps = ComponentProps< typeof Popover > & {
|
|
7
8
|
anchor?: Element;
|
|
8
9
|
offset?: number;
|
|
9
10
|
} & {
|
|
10
11
|
hideCloseButton?: boolean;
|
|
11
12
|
title: string;
|
|
12
|
-
children:
|
|
13
|
+
children: ReactNode;
|
|
13
14
|
step?: number;
|
|
14
15
|
totalSteps?: number;
|
|
15
|
-
buttonContent?:
|
|
16
|
+
buttonContent?: ReactNode;
|
|
16
17
|
buttonDisabled?: boolean;
|
|
17
18
|
buttonHref?: string;
|
|
18
19
|
buttonExternalLink?: boolean;
|
|
@@ -8,7 +8,7 @@ import Col from '../layout/col/index.tsx';
|
|
|
8
8
|
import Container from '../layout/container/index.tsx';
|
|
9
9
|
import styles from './style.module.scss';
|
|
10
10
|
import type { AdminPageProps } from './types.ts';
|
|
11
|
-
import type
|
|
11
|
+
import type { FC, ReactNode } from 'react';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* This is the base structure for any admin page. It comes with Header and Footer.
|
|
@@ -16,9 +16,9 @@ import type React from 'react';
|
|
|
16
16
|
* All content must be passed as children wrapped in as many <AdminSection> elements as needed.
|
|
17
17
|
*
|
|
18
18
|
* @param {AdminPageProps} props - Component properties.
|
|
19
|
-
* @return {
|
|
19
|
+
* @return {ReactNode} AdminPage component.
|
|
20
20
|
*/
|
|
21
|
-
const AdminPage:
|
|
21
|
+
const AdminPage: FC< AdminPageProps > = ( {
|
|
22
22
|
children,
|
|
23
23
|
className,
|
|
24
24
|
moduleName = __( 'Jetpack', 'jetpack-components' ),
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { JetpackFooterMenuItem } from '../jetpack-footer/types.ts';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
export type AdminPageProps = {
|
|
4
5
|
/**
|
|
5
6
|
* The page content
|
|
6
7
|
*/
|
|
7
|
-
children:
|
|
8
|
+
children: ReactNode;
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Name of the module, e.g. 'Jetpack Search' that will be displayed in the footer.
|
|
@@ -19,7 +20,7 @@ export type AdminPageProps = {
|
|
|
19
20
|
/**
|
|
20
21
|
* Custom header. Optional
|
|
21
22
|
*/
|
|
22
|
-
header?:
|
|
23
|
+
header?: ReactNode;
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Whether or not to display the Footer
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import styles from './style.module.scss';
|
|
3
2
|
import type { AdminSectionBaseProps } from '../types.ts';
|
|
3
|
+
import type { ReactNode, FC } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* This is the wrapper component to build sections within your admin page.
|
|
7
7
|
*
|
|
8
8
|
* @param {AdminSectionBaseProps} props - Component properties.
|
|
9
|
-
* @return {
|
|
9
|
+
* @return {ReactNode} AdminSection component.
|
|
10
10
|
*/
|
|
11
|
-
const AdminSection:
|
|
11
|
+
const AdminSection: FC< AdminSectionBaseProps > = ( { children } ) => {
|
|
12
12
|
return <div className={ styles.section }>{ children }</div>;
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import styles from './style.module.scss';
|
|
3
2
|
import type { AdminSectionBaseProps } from '../types.ts';
|
|
3
|
+
import type { Component, FC } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The wrapper component for a Hero Section to be used in admin pages.
|
|
7
7
|
*
|
|
8
8
|
* @param {AdminSectionBaseProps} props - Component properties.
|
|
9
|
-
* @return {
|
|
9
|
+
* @return {Component} AdminSectionHero component.
|
|
10
10
|
*/
|
|
11
|
-
const AdminSectionHero:
|
|
11
|
+
const AdminSectionHero: FC< AdminSectionBaseProps > = ( { children } ) => {
|
|
12
12
|
return <div className={ styles[ 'section-hero' ] }>{ children }</div>;
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Icon, warning, info, check } from '@wordpress/icons';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import React from 'react';
|
|
4
3
|
import styles from './style.module.scss';
|
|
4
|
+
import type { ReactNode, Component, ReactElement, FC } from 'react';
|
|
5
5
|
|
|
6
6
|
type AlertProps = {
|
|
7
7
|
/** The severity of the alert. */
|
|
@@ -11,7 +11,7 @@ type AlertProps = {
|
|
|
11
11
|
showIcon?: boolean;
|
|
12
12
|
|
|
13
13
|
/** Children to be rendered inside the alert. */
|
|
14
|
-
children:
|
|
14
|
+
children: ReactNode;
|
|
15
15
|
|
|
16
16
|
/** Wrapper class name */
|
|
17
17
|
className?: string;
|
|
@@ -35,19 +35,14 @@ const getIconByLevel = ( level: AlertProps[ 'level' ] ) => {
|
|
|
35
35
|
/**
|
|
36
36
|
* Alert component
|
|
37
37
|
*
|
|
38
|
-
* @param {object}
|
|
39
|
-
* @param {string}
|
|
40
|
-
* @param {boolean}
|
|
41
|
-
* @param {string}
|
|
42
|
-
* @param {
|
|
43
|
-
* @return {
|
|
38
|
+
* @param {object} props - The component properties.
|
|
39
|
+
* @param {string} props.level - The alert level: error, warning, info, success.
|
|
40
|
+
* @param {boolean} props.showIcon - Whether to show the alert icon.
|
|
41
|
+
* @param {string} props.className - The wrapper class name.
|
|
42
|
+
* @param {Component} props.children - The alert content.
|
|
43
|
+
* @return {ReactElement} The `Alert` component.
|
|
44
44
|
*/
|
|
45
|
-
const Alert:
|
|
46
|
-
level = 'warning',
|
|
47
|
-
children,
|
|
48
|
-
showIcon = true,
|
|
49
|
-
className,
|
|
50
|
-
} ) => {
|
|
45
|
+
const Alert: FC< AlertProps > = ( { level = 'warning', children, showIcon = true, className } ) => {
|
|
51
46
|
const classes = clsx( styles.container, styles[ `is-${ level }` ], className );
|
|
52
47
|
|
|
53
48
|
return (
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import React from 'react';
|
|
4
3
|
import { AutomatticBylineLogoProps } from './types.ts';
|
|
4
|
+
import type { ReactNode, FC } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Automattic "By line" Logo component.
|
|
8
8
|
*
|
|
9
9
|
* @param {AutomatticBylineLogoProps} props - Component properties.
|
|
10
|
-
* @return {
|
|
10
|
+
* @return {ReactNode} AutomatticBylineLogo component.
|
|
11
11
|
*/
|
|
12
|
-
const AutomatticBylineLogo:
|
|
12
|
+
const AutomatticBylineLogo: FC< AutomatticBylineLogoProps > = ( {
|
|
13
13
|
title = __( 'An Automattic Airline', 'jetpack-components' ),
|
|
14
14
|
height = 7,
|
|
15
15
|
className,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
2
|
|
|
3
|
-
export interface AutomatticBylineLogoProps extends
|
|
3
|
+
export interface AutomatticBylineLogoProps extends SVGProps< SVGSVGElement > {
|
|
4
4
|
/**
|
|
5
5
|
* Title for SVG.
|
|
6
6
|
*/
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Path, SVG } from '@wordpress/components';
|
|
2
|
-
import
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Automattic for Agencies Logo component
|
|
6
6
|
*
|
|
7
7
|
* @param {object} props - Component props
|
|
8
8
|
* @param {string} props.color - Color code for the logo text
|
|
9
|
-
* @return {
|
|
9
|
+
* @return {ReactElement} Component template
|
|
10
10
|
*/
|
|
11
11
|
export default function AutomatticForAgenciesLogo( {
|
|
12
12
|
color = '#FFFFFF',
|
|
13
13
|
}: {
|
|
14
14
|
color: string;
|
|
15
|
-
} ):
|
|
15
|
+
} ): ReactElement {
|
|
16
16
|
return (
|
|
17
17
|
<SVG
|
|
18
18
|
clipRule="evenodd"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Path, SVG } from '@wordpress/components';
|
|
2
|
-
import
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Automattic Icon Logo component
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
* @param {object} props - Component props
|
|
8
8
|
* @param {string} props.innerColor - Color code for the line in the middle of the logo.
|
|
9
9
|
* @param {string} props.outerColor - Color code for the logo's outer
|
|
10
|
-
* @return {
|
|
10
|
+
* @return {ReactElement} Component template
|
|
11
11
|
*/
|
|
12
12
|
export default function AutomatticIconLogo( {
|
|
13
13
|
innerColor = '#00A3E0',
|
|
@@ -15,7 +15,7 @@ export default function AutomatticIconLogo( {
|
|
|
15
15
|
}: {
|
|
16
16
|
innerColor: string;
|
|
17
17
|
outerColor: string;
|
|
18
|
-
} ):
|
|
18
|
+
} ): ReactElement {
|
|
19
19
|
return (
|
|
20
20
|
<SVG
|
|
21
21
|
clipRule="evenodd"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import styles from './style.module.scss';
|
|
3
|
+
import type { ReactNode, ReactElement, FC } from 'react';
|
|
4
4
|
|
|
5
5
|
type BadgeProps = {
|
|
6
|
-
children?:
|
|
6
|
+
children?: ReactNode;
|
|
7
7
|
className?: string;
|
|
8
8
|
variant?: 'success' | 'warning' | 'danger';
|
|
9
9
|
[ key: string ]: unknown;
|
|
@@ -17,9 +17,9 @@ type BadgeProps = {
|
|
|
17
17
|
* @param {JSX.Element} props.children - Badge text or content.
|
|
18
18
|
* @param {string} props.className - Additional class name to pass to the Badge component.
|
|
19
19
|
*
|
|
20
|
-
* @return {
|
|
20
|
+
* @return {ReactElement} The `Badge` component.
|
|
21
21
|
*/
|
|
22
|
-
const Badge:
|
|
22
|
+
const Badge: FC< BadgeProps > = ( { children, className, variant, ...props } ) => {
|
|
23
23
|
const classes = clsx(
|
|
24
24
|
styles.badge,
|
|
25
25
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { type FunctionComponent } from 'react';
|
|
2
1
|
import Text from '../text/index.tsx';
|
|
3
2
|
import Background from './background.tsx';
|
|
4
3
|
import UplotLineChart from './uplot-line-chart.tsx';
|
|
4
|
+
import type { FunctionComponent, ReactElement } from 'react';
|
|
5
5
|
import './style.scss';
|
|
6
6
|
|
|
7
7
|
export interface Period {
|
|
@@ -44,7 +44,7 @@ export type ScoreGraphAlignedData = [
|
|
|
44
44
|
* @param {string} props.title - Title for the chart.
|
|
45
45
|
* @param {Period[]} props.periods - The periods to display in the chart.
|
|
46
46
|
* @param {boolean} [props.isLoading=false] - Whether the component is in a loading state.
|
|
47
|
-
* @return {
|
|
47
|
+
* @return {ReactElement} The JSX element representing the BoostScoreGraph component, or null if loading.
|
|
48
48
|
*/
|
|
49
49
|
export const BoostScoreGraph: FunctionComponent< BoostScoreGraphProps > = ( {
|
|
50
50
|
periods = [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatNumber } from '@automattic/number-formatters';
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
|
-
import
|
|
3
|
+
import { useMemo, useRef, useCallback } from 'react';
|
|
4
4
|
import uPlot from 'uplot';
|
|
5
5
|
import UplotReact from 'uplot-react';
|
|
6
6
|
import { getUserLocale } from '../../lib/locale/index.ts';
|
|
@@ -12,6 +12,7 @@ import { tooltipsPlugin } from './tooltips-plugin.ts';
|
|
|
12
12
|
import { useBoostScoreTransform } from './use-boost-score-transform.ts';
|
|
13
13
|
import useResize from './use-resize.ts';
|
|
14
14
|
import './style-uplot.scss';
|
|
15
|
+
import type { ReactElement, RefObject, ComponentType } from 'react';
|
|
15
16
|
|
|
16
17
|
const DEFAULT_DIMENSIONS = {
|
|
17
18
|
height: 300,
|
|
@@ -22,7 +23,7 @@ interface UplotChartProps {
|
|
|
22
23
|
periods: Period[];
|
|
23
24
|
annotations?: Annotation[];
|
|
24
25
|
options?: Partial< uPlot.Options >;
|
|
25
|
-
legendContainer?:
|
|
26
|
+
legendContainer?: RefObject< HTMLDivElement >;
|
|
26
27
|
solidFill?: boolean;
|
|
27
28
|
period?: string;
|
|
28
29
|
range?: { startDate: number; endDate: number };
|
|
@@ -99,7 +100,7 @@ function getColor( score: number, opacity = 'FF' ) {
|
|
|
99
100
|
* @param {{ startDate: number, endDate: number }} props.range - The date range of the chart.
|
|
100
101
|
* @param {Period[]} props.periods - The periods to display in the chart.
|
|
101
102
|
* @param {Annotation[]} props.annotations - The annotations to display in the chart.
|
|
102
|
-
* @return {
|
|
103
|
+
* @return {ReactElement} The JSX element representing the UplotLineChart component.
|
|
103
104
|
*/
|
|
104
105
|
export default function UplotLineChart( { range, periods, annotations = [] }: UplotChartProps ) {
|
|
105
106
|
const uplot = useRef< uPlot | null >( null );
|
|
@@ -215,7 +216,7 @@ export default function UplotLineChart( { range, periods, annotations = [] }: Up
|
|
|
215
216
|
* Type casting to prevent TypeScript error:
|
|
216
217
|
* TS2604: JSX element type 'UplotReact' does not have any construct or call signatures.
|
|
217
218
|
*/
|
|
218
|
-
const TypedUplotReact = UplotReact as unknown as
|
|
219
|
+
const TypedUplotReact = UplotReact as unknown as ComponentType< UplotReactProps >;
|
|
219
220
|
|
|
220
221
|
return (
|
|
221
222
|
<div ref={ uplotContainer } className="boost-uplot-container">
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { throttle } from '@wordpress/compose';
|
|
2
|
-
import
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
3
|
import uPlot from 'uplot';
|
|
4
|
+
import type { RefObject } from 'react';
|
|
4
5
|
|
|
5
6
|
const THROTTLE_DURATION = 400; // in ms
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Custom hook to handle resizing of uPlot charts.
|
|
9
10
|
*
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {RefObject<uPlot>} uplotRef - The ref object for the uPlot instance.
|
|
12
|
+
* @param {RefObject<HTMLDivElement>} containerRef - The ref object for the container div.
|
|
12
13
|
*/
|
|
13
14
|
export default function useResize(
|
|
14
|
-
uplotRef:
|
|
15
|
-
containerRef:
|
|
15
|
+
uplotRef: RefObject< uPlot >,
|
|
16
|
+
containerRef: RefObject< HTMLDivElement >
|
|
16
17
|
) {
|
|
17
18
|
useEffect( () => {
|
|
18
19
|
if ( ! uplotRef.current || ! containerRef.current ) {
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { Button as WPButton, Spinner, VisuallyHidden } from '@wordpress/components';
|
|
5
2
|
import { __ } from '@wordpress/i18n';
|
|
6
3
|
import { Icon, external } from '@wordpress/icons';
|
|
7
4
|
import clsx from 'clsx';
|
|
8
|
-
import
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
5
|
+
import { forwardRef } from 'react';
|
|
12
6
|
import styles from './style.module.scss';
|
|
13
7
|
import type { ButtonProps } from './types.ts';
|
|
8
|
+
import type { ReactNode } from 'react';
|
|
14
9
|
|
|
15
10
|
/**
|
|
16
11
|
* Button component
|
|
17
12
|
*
|
|
18
13
|
* @param {ButtonProps} props - Component Props
|
|
19
|
-
* @return {
|
|
14
|
+
* @return {ReactNode} Rendered button
|
|
20
15
|
*/
|
|
21
16
|
const Button = forwardRef< HTMLInputElement, ButtonProps >( ( props, ref ) => {
|
|
22
17
|
const {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Button } from '@wordpress/components';
|
|
2
|
-
import type
|
|
2
|
+
import type { ComponentProps, ForwardedRef, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
type JetpackButtonBaseProps = {
|
|
5
5
|
className?: string;
|
|
6
|
-
children?:
|
|
6
|
+
children?: ReactNode;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
isDestructive?: boolean;
|
|
9
9
|
isLoading?: boolean;
|
|
@@ -13,9 +13,9 @@ type JetpackButtonBaseProps = {
|
|
|
13
13
|
variant?: 'primary' | 'secondary' | 'link' | 'tertiary';
|
|
14
14
|
weight?: 'bold' | 'regular';
|
|
15
15
|
fullWidth?: boolean;
|
|
16
|
-
ref?:
|
|
16
|
+
ref?: ForwardedRef< unknown >;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
type WPButtonProps = Omit<
|
|
19
|
+
type WPButtonProps = Omit< ComponentProps< typeof Button >, 'size' | 'variant' >;
|
|
20
20
|
|
|
21
21
|
export type ButtonProps = JetpackButtonBaseProps & WPButtonProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import styles from './style.module.scss';
|
|
3
|
+
import type { ReactElement, FC } from 'react';
|
|
4
4
|
|
|
5
5
|
type ChipProps = {
|
|
6
6
|
text?: string;
|
|
@@ -13,9 +13,9 @@ type ChipProps = {
|
|
|
13
13
|
* @param {object} props - The component properties.
|
|
14
14
|
* @param {string} props.type - The type new or info
|
|
15
15
|
* @param {string} props.text - Chip text
|
|
16
|
-
* @return {
|
|
16
|
+
* @return {ReactElement} The `Chip` component.
|
|
17
17
|
*/
|
|
18
|
-
const Chip:
|
|
18
|
+
const Chip: FC< ChipProps > = ( { type = 'info', text } ) => {
|
|
19
19
|
const classes = clsx( styles.chip, styles[ `is-${ type }` ] );
|
|
20
20
|
return <span className={ classes }>{ text }</span>;
|
|
21
21
|
};
|
|
@@ -4,9 +4,9 @@ import IconTooltip from '../icon-tooltip/index.tsx';
|
|
|
4
4
|
import Text from '../text/index.tsx';
|
|
5
5
|
import styles from './style.module.scss';
|
|
6
6
|
import { CutBaseProps } from './types.ts';
|
|
7
|
-
import type
|
|
7
|
+
import type { FC } from 'react';
|
|
8
8
|
|
|
9
|
-
const ContextualUpgradeTrigger:
|
|
9
|
+
const ContextualUpgradeTrigger: FC< CutBaseProps > = ( {
|
|
10
10
|
description,
|
|
11
11
|
cta,
|
|
12
12
|
onClick,
|
|
@@ -4,9 +4,9 @@ import { __ } from '@wordpress/i18n';
|
|
|
4
4
|
import Button from '../button/index.tsx';
|
|
5
5
|
import { ClipboardIcon, CheckmarkIcon } from '../icons/index.tsx';
|
|
6
6
|
import { CopyToClipboardProps } from './types.ts';
|
|
7
|
-
import type
|
|
7
|
+
import type { FC, ReactNode } from 'react';
|
|
8
8
|
|
|
9
|
-
export const CopyToClipboard:
|
|
9
|
+
export const CopyToClipboard: FC< CopyToClipboardProps > = ( {
|
|
10
10
|
buttonStyle = 'icon',
|
|
11
11
|
textToCopy,
|
|
12
12
|
onCopy,
|
|
@@ -40,8 +40,8 @@ export const CopyToClipboard: React.FC< CopyToClipboardProps > = ( {
|
|
|
40
40
|
};
|
|
41
41
|
}, [] );
|
|
42
42
|
|
|
43
|
-
let icon:
|
|
44
|
-
let label:
|
|
43
|
+
let icon: ReactNode = null;
|
|
44
|
+
let label: ReactNode = null;
|
|
45
45
|
|
|
46
46
|
if ( 'text' !== buttonStyle ) {
|
|
47
47
|
icon = hasCopied ? <CheckmarkIcon /> : <ClipboardIcon />;
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import type { DecorativeCardProps } from './types.ts';
|
|
2
|
-
import type
|
|
2
|
+
import type { FC, ReactNode } from 'react';
|
|
3
3
|
import './style.scss';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A decorative card used in the disconnection flow.
|
|
7
7
|
*
|
|
8
8
|
* @param {DecorativeCardProps} props - The properties.
|
|
9
|
-
* @return {
|
|
9
|
+
* @return {ReactNode} - The DecorativeCard component.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const DecorativeCard:
|
|
13
|
-
format = 'horizontal',
|
|
14
|
-
icon,
|
|
15
|
-
imageUrl,
|
|
16
|
-
} ) => {
|
|
12
|
+
const DecorativeCard: FC< DecorativeCardProps > = ( { format = 'horizontal', icon, imageUrl } ) => {
|
|
17
13
|
return (
|
|
18
14
|
<div
|
|
19
15
|
className={
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import Col from '../layout/col/index.tsx';
|
|
4
3
|
import Container from '../layout/container/index.tsx';
|
|
5
4
|
import useBreakpointMatch from '../layout/use-breakpoint-match/index.ts';
|
|
6
5
|
import styles from './style.module.scss';
|
|
6
|
+
import type { ReactNode, FC } from 'react';
|
|
7
7
|
|
|
8
8
|
type DialogProps = {
|
|
9
|
-
primary:
|
|
10
|
-
secondary?:
|
|
9
|
+
primary: ReactNode;
|
|
10
|
+
secondary?: ReactNode;
|
|
11
11
|
isTwoSections?: boolean;
|
|
12
12
|
isCard?: boolean;
|
|
13
13
|
containerProps: object;
|
|
@@ -16,14 +16,14 @@ type DialogProps = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Dialog component.
|
|
18
18
|
*
|
|
19
|
-
* @param {object}
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {boolean}
|
|
23
|
-
* @param {object}
|
|
24
|
-
* @return {
|
|
19
|
+
* @param {object} props - React component props.
|
|
20
|
+
* @param {ReactNode} props.primary - Primary-section content.
|
|
21
|
+
* @param {ReactNode} props.secondary - Secondary-section content.
|
|
22
|
+
* @param {boolean} props.isTwoSections - Handle two sections layout when true.
|
|
23
|
+
* @param {object} props.containerProps - Props to pass to the container component.
|
|
24
|
+
* @return {ReactNode} Rendered dialog
|
|
25
25
|
*/
|
|
26
|
-
const Dialog:
|
|
26
|
+
const Dialog: FC< DialogProps > = ( {
|
|
27
27
|
primary,
|
|
28
28
|
secondary,
|
|
29
29
|
isTwoSections = false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './style.scss';
|
|
2
|
+
import type { ReactElement, FC } from 'react';
|
|
3
3
|
|
|
4
4
|
export type DonutMeterProps = {
|
|
5
5
|
/**
|
|
@@ -72,9 +72,9 @@ const getAdaptiveType = ( percentage: number ) => {
|
|
|
72
72
|
* Generate record meter donut bar
|
|
73
73
|
*
|
|
74
74
|
* @param {DonutMeterProps} props - Props
|
|
75
|
-
* @return {
|
|
75
|
+
* @return {ReactElement} - JSX element
|
|
76
76
|
*/
|
|
77
|
-
const DonutMeter:
|
|
77
|
+
const DonutMeter: FC< DonutMeterProps > = ( {
|
|
78
78
|
className = '',
|
|
79
79
|
description = '',
|
|
80
80
|
donutWidth = '64px',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button } from '@wordpress/components';
|
|
2
2
|
import { __, sprintf } from '@wordpress/i18n';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import
|
|
4
|
+
import { Children, useState, useEffect, ReactNode, useCallback, useMemo } from 'react';
|
|
5
5
|
import { Swipeable } from '../swipeable/index.tsx';
|
|
6
6
|
|
|
7
7
|
import './style.scss';
|