@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,7 +1,7 @@
|
|
|
1
1
|
import { __, sprintf } from '@wordpress/i18n';
|
|
2
2
|
import { Icon, check, closeSmall } from '@wordpress/icons';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import
|
|
4
|
+
import {
|
|
5
5
|
createContext,
|
|
6
6
|
useContext,
|
|
7
7
|
Children,
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
PricingTableHeaderProps,
|
|
22
22
|
PricingTableItemProps,
|
|
23
23
|
} from './types.ts';
|
|
24
|
+
import type { FC } from 'react';
|
|
24
25
|
|
|
25
26
|
const INCLUDED_TEXT = __( 'Included', 'jetpack-components' );
|
|
26
27
|
const NOT_INCLUDED_TEXT = __( 'Not included', 'jetpack-components' );
|
|
@@ -49,7 +50,7 @@ const getItemLabels = ( isComingSoon, isIncluded, featureNameLabel ) => {
|
|
|
49
50
|
};
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
export const PricingTableItem:
|
|
53
|
+
export const PricingTableItem: FC< PricingTableItemProps > = ( {
|
|
53
54
|
isIncluded = false,
|
|
54
55
|
isComingSoon = false,
|
|
55
56
|
index = 0,
|
|
@@ -102,11 +103,11 @@ export const PricingTableItem: React.FC< PricingTableItemProps > = ( {
|
|
|
102
103
|
);
|
|
103
104
|
};
|
|
104
105
|
|
|
105
|
-
export const PricingTableHeader:
|
|
106
|
+
export const PricingTableHeader: FC< PricingTableHeaderProps > = ( { children } ) => (
|
|
106
107
|
<div className={ styles.header }>{ children }</div>
|
|
107
108
|
);
|
|
108
109
|
|
|
109
|
-
export const PricingTableColumn:
|
|
110
|
+
export const PricingTableColumn: FC< PricingTableColumnProps > = ( {
|
|
110
111
|
primary = false,
|
|
111
112
|
children,
|
|
112
113
|
} ) => {
|
|
@@ -130,7 +131,7 @@ export const PricingTableColumn: React.FC< PricingTableColumnProps > = ( {
|
|
|
130
131
|
);
|
|
131
132
|
};
|
|
132
133
|
|
|
133
|
-
const PricingTable:
|
|
134
|
+
const PricingTable: FC< PricingTableProps > = ( {
|
|
134
135
|
title,
|
|
135
136
|
items,
|
|
136
137
|
children,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Placement } from '../icon-tooltip/types.ts';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
export type PricingTableProps = {
|
|
4
5
|
/**
|
|
@@ -11,7 +12,7 @@ export type PricingTableProps = {
|
|
|
11
12
|
*/
|
|
12
13
|
items: {
|
|
13
14
|
name: string;
|
|
14
|
-
tooltipInfo?:
|
|
15
|
+
tooltipInfo?: ReactNode;
|
|
15
16
|
tooltipTitle?: string;
|
|
16
17
|
tooltipPlacement?: Placement;
|
|
17
18
|
}[];
|
|
@@ -19,7 +20,7 @@ export type PricingTableProps = {
|
|
|
19
20
|
/**
|
|
20
21
|
* The columns to add to the table.
|
|
21
22
|
*/
|
|
22
|
-
children:
|
|
23
|
+
children: ReactNode;
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Whether to show the intro offer disclaimer text with the ToS.
|
|
@@ -36,14 +37,14 @@ export type PricingTableColumnProps = {
|
|
|
36
37
|
/**
|
|
37
38
|
* Items to show in a column.
|
|
38
39
|
*/
|
|
39
|
-
children:
|
|
40
|
+
children: ReactElement[];
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
export type PricingTableHeaderProps = {
|
|
43
44
|
/**
|
|
44
45
|
* Items to show in a header.
|
|
45
46
|
*/
|
|
46
|
-
children:
|
|
47
|
+
children: ReactNode;
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
export type PricingTableItemProps = {
|
|
@@ -60,7 +61,7 @@ export type PricingTableItemProps = {
|
|
|
60
61
|
/**
|
|
61
62
|
* A custom label to display instead of the default one.
|
|
62
63
|
*/
|
|
63
|
-
label?: string | number |
|
|
64
|
+
label?: string | number | ReactElement;
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
67
|
* Index of the item, relative to other PricingTableItem components. Internal use only.
|
|
@@ -70,7 +71,7 @@ export type PricingTableItemProps = {
|
|
|
70
71
|
/*
|
|
71
72
|
* If the item has more description a popover info can contain that.
|
|
72
73
|
*/
|
|
73
|
-
tooltipInfo?:
|
|
74
|
+
tooltipInfo?: ReactNode;
|
|
74
75
|
|
|
75
76
|
/**
|
|
76
77
|
* Title for the popover, not required.
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { Icon, plus } from '@wordpress/icons';
|
|
2
|
-
import
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
3
|
import { getIconBySlug } from '../icons/index.tsx';
|
|
4
4
|
import styles from './style.module.scss';
|
|
5
5
|
import { IconsCardProps } from './types.ts';
|
|
6
|
+
import type { FC, ReactNode } from 'react';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Icons composition for a bundle product,
|
|
9
10
|
* based on the list of supported products.
|
|
10
11
|
*
|
|
11
12
|
* @param {IconsCardProps} props - Component props.
|
|
12
|
-
* @return {
|
|
13
|
+
* @return {ReactNode} Bundle product icons react component.
|
|
13
14
|
*/
|
|
14
|
-
export const IconsCard:
|
|
15
|
+
export const IconsCard: FC< IconsCardProps > = ( { products, icon, size = 24 } ) => {
|
|
15
16
|
if ( icon ) {
|
|
16
17
|
const CustomIcon = getIconBySlug( icon );
|
|
17
18
|
return (
|
|
@@ -10,15 +10,15 @@ import { IconsCard } from './icons-card.tsx';
|
|
|
10
10
|
import { ProductOfferHeader } from './product-offer-header.tsx';
|
|
11
11
|
import styles from './style.module.scss';
|
|
12
12
|
import { ProductOfferProps } from './types.ts';
|
|
13
|
-
import type
|
|
13
|
+
import type { FC, ReactNode } from 'react';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Product Detail component.
|
|
17
17
|
*
|
|
18
18
|
* @param {ProductOfferProps} props - Component props.
|
|
19
|
-
* @return {
|
|
19
|
+
* @return {ReactNode} - ProductOffer react component.
|
|
20
20
|
*/
|
|
21
|
-
const ProductOffer:
|
|
21
|
+
const ProductOffer: FC< ProductOfferProps > = ( {
|
|
22
22
|
addProductUrl,
|
|
23
23
|
buttonDisclaimer,
|
|
24
24
|
buttonText = '',
|
|
@@ -3,15 +3,15 @@ import { Icon, starFilled as star } from '@wordpress/icons';
|
|
|
3
3
|
import Text from '../text/index.tsx';
|
|
4
4
|
import styles from './style.module.scss';
|
|
5
5
|
import { ProductOfferHeaderProps } from './types.ts';
|
|
6
|
-
import type
|
|
6
|
+
import type { FC, ReactNode } from 'react';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Product Detail Card Header component.
|
|
10
10
|
*
|
|
11
11
|
* @param {ProductOfferHeaderProps} props - Component props.
|
|
12
|
-
* @return {
|
|
12
|
+
* @return {ReactNode} ProductOfferHeader react component.
|
|
13
13
|
*/
|
|
14
|
-
export const ProductOfferHeader:
|
|
14
|
+
export const ProductOfferHeader: FC< ProductOfferHeaderProps > = ( {
|
|
15
15
|
title = __( 'Popular upgrade', 'jetpack-components' ),
|
|
16
16
|
} ) => {
|
|
17
17
|
return (
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ProductPriceProps } from '../product-price/types.ts';
|
|
2
2
|
import type { JetpackIconSlug } from '../icons/index.tsx';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
export type ProductOfferProps = {
|
|
5
6
|
/**
|
|
@@ -90,7 +91,7 @@ export type ProductOfferProps = {
|
|
|
90
91
|
/**
|
|
91
92
|
* Content displayed below the Add button.
|
|
92
93
|
*/
|
|
93
|
-
buttonDisclaimer?:
|
|
94
|
+
buttonDisclaimer?: ReactNode;
|
|
94
95
|
|
|
95
96
|
/**
|
|
96
97
|
* Error message.
|
|
@@ -10,15 +10,15 @@ import Text from '../text/index.tsx';
|
|
|
10
10
|
import { Price } from './price.tsx';
|
|
11
11
|
import styles from './style.module.scss';
|
|
12
12
|
import type { ProductPriceProps } from './types.ts';
|
|
13
|
-
import type
|
|
13
|
+
import type { FC, ReactNode } from 'react';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* React component to render the price.
|
|
17
17
|
*
|
|
18
18
|
* @param {ProductPriceProps} props - Component props.
|
|
19
|
-
* @return {
|
|
19
|
+
* @return {ReactNode} Price react component.
|
|
20
20
|
*/
|
|
21
|
-
const ProductPrice:
|
|
21
|
+
const ProductPrice: FC< ProductPriceProps > = ( {
|
|
22
22
|
price,
|
|
23
23
|
offPrice,
|
|
24
24
|
currency = '',
|
|
@@ -3,15 +3,15 @@ import clsx from 'clsx';
|
|
|
3
3
|
import Text from '../text/index.tsx';
|
|
4
4
|
import styles from './style.module.scss';
|
|
5
5
|
import type { PriceProps } from './types.ts';
|
|
6
|
-
import type
|
|
6
|
+
import type { FC, ReactNode } from 'react';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* React component to render a Price composition.
|
|
10
10
|
*
|
|
11
11
|
* @param {PriceProps} props - Component props.
|
|
12
|
-
* @return {
|
|
12
|
+
* @return {ReactNode} -Price react component.
|
|
13
13
|
*/
|
|
14
|
-
export const Price:
|
|
14
|
+
export const Price: FC< PriceProps > = ( { value, currency, isOff, hidePriceFraction } ) => {
|
|
15
15
|
const classNames = clsx( styles.price, 'product-price_price', {
|
|
16
16
|
[ styles[ 'is-not-off-price' ] ]: ! isOff,
|
|
17
17
|
} );
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
1
3
|
export type ProductPriceProps = {
|
|
2
4
|
/**
|
|
3
5
|
* Product price.
|
|
@@ -47,7 +49,7 @@ export type ProductPriceProps = {
|
|
|
47
49
|
/**
|
|
48
50
|
* Alternative legend with HTML syntax
|
|
49
51
|
*/
|
|
50
|
-
children?:
|
|
52
|
+
children?: ReactNode;
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
export type PriceProps = {
|
|
@@ -7,15 +7,15 @@ import clsx from 'clsx';
|
|
|
7
7
|
*/
|
|
8
8
|
import styles from './style.module.scss';
|
|
9
9
|
import { ProgressBarProps } from './types.ts';
|
|
10
|
-
import type
|
|
10
|
+
import type { FC, ReactNode } from 'react';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Progress Bar component
|
|
14
14
|
*
|
|
15
15
|
* @param {ProgressBarProps} props - Component props.
|
|
16
|
-
* @return {
|
|
16
|
+
* @return {ReactNode} - ProgressBar react component.
|
|
17
17
|
*/
|
|
18
|
-
const ProgressBar:
|
|
18
|
+
const ProgressBar: FC< ProgressBarProps > = ( {
|
|
19
19
|
className,
|
|
20
20
|
progressClassName,
|
|
21
21
|
progress,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { QRCodeCanvas, QRCodeSVG } from 'qrcode.react';
|
|
2
|
-
import type
|
|
2
|
+
import type { ComponentProps, FC, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
type QRCodeCanvasProps =
|
|
5
|
-
type QRCodeSVGProps =
|
|
4
|
+
type QRCodeCanvasProps = ComponentProps< typeof QRCodeCanvas >;
|
|
5
|
+
type QRCodeSVGProps = ComponentProps< typeof QRCodeSVG >;
|
|
6
6
|
|
|
7
7
|
export type QRCodeProps = {
|
|
8
8
|
/**
|
|
@@ -50,9 +50,9 @@ export type QRCodeProps = {
|
|
|
50
50
|
* Renders a QR Code.
|
|
51
51
|
*
|
|
52
52
|
* @param {QRCodeProps} props - Component props
|
|
53
|
-
* @return {
|
|
53
|
+
* @return {ReactNode} - React component.
|
|
54
54
|
*/
|
|
55
|
-
const QRCode:
|
|
55
|
+
const QRCode: FC< QRCodeProps > = ( {
|
|
56
56
|
value = 'https://jetpack.com',
|
|
57
57
|
size = 248,
|
|
58
58
|
bgColor,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RadioControl as WPRadioControl } from '@wordpress/components';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import styles from './styles.module.scss';
|
|
4
|
+
import type { FC, ReactNode } from 'react';
|
|
4
5
|
|
|
5
6
|
interface RadioControlProps {
|
|
6
7
|
/** The current value. */
|
|
@@ -13,10 +14,10 @@ interface RadioControlProps {
|
|
|
13
14
|
disabled?: boolean;
|
|
14
15
|
|
|
15
16
|
/** Additional information to display below the radio control. */
|
|
16
|
-
help?:
|
|
17
|
+
help?: ReactNode;
|
|
17
18
|
|
|
18
19
|
/** The label for the radio control. */
|
|
19
|
-
label?:
|
|
20
|
+
label?: ReactNode;
|
|
20
21
|
|
|
21
22
|
/** If true, the label will only be visible to screen readers. */
|
|
22
23
|
hideLabelFromVision?: boolean;
|
|
@@ -28,7 +29,7 @@ interface RadioControlProps {
|
|
|
28
29
|
onChange: ( value: string ) => void;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
const RadioControl:
|
|
32
|
+
const RadioControl: FC< RadioControlProps > = ( {
|
|
32
33
|
selected,
|
|
33
34
|
className,
|
|
34
35
|
disabled,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { formatNumber } from '@automattic/number-formatters';
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import type { FC, ReactElement } from 'react';
|
|
5
6
|
|
|
6
7
|
import './style.scss';
|
|
7
8
|
|
|
@@ -63,9 +64,9 @@ export type RecordMeterBarProps = {
|
|
|
63
64
|
* Generate Record Meter bar
|
|
64
65
|
*
|
|
65
66
|
* @param {RecordMeterBarProps} props - Props
|
|
66
|
-
* @return {
|
|
67
|
+
* @return {ReactElement} - JSX element
|
|
67
68
|
*/
|
|
68
|
-
const RecordMeterBar:
|
|
69
|
+
const RecordMeterBar: FC< RecordMeterBarProps > = ( {
|
|
69
70
|
totalCount,
|
|
70
71
|
items = [],
|
|
71
72
|
showLegendLabelBeforeCount = false,
|
|
@@ -8,10 +8,10 @@ Spinner is a React component for rendering a loading indicator.
|
|
|
8
8
|
## Usage
|
|
9
9
|
|
|
10
10
|
```jsx
|
|
11
|
-
import
|
|
11
|
+
import { Component } from 'react';
|
|
12
12
|
import Spinner from '@automattic/jetpack-components';
|
|
13
13
|
|
|
14
|
-
export default class extends
|
|
14
|
+
export default class extends Component {
|
|
15
15
|
render() {
|
|
16
16
|
return <Spinner />;
|
|
17
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button, Flex, DropdownMenu } from '@wordpress/components';
|
|
2
2
|
import styles from './style.module.scss';
|
|
3
3
|
import { SplitButtonProps } from './types.ts';
|
|
4
|
-
import type
|
|
4
|
+
import type { FC } from 'react';
|
|
5
5
|
|
|
6
6
|
const DownIcon = () => (
|
|
7
7
|
<svg width="15" height="9" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="10 9 4 7">
|
|
@@ -13,7 +13,7 @@ const DownIcon = () => (
|
|
|
13
13
|
</svg>
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
const SplitButton:
|
|
16
|
+
const SplitButton: FC< SplitButtonProps > = ( {
|
|
17
17
|
variant,
|
|
18
18
|
controls,
|
|
19
19
|
popoverProps,
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import type { Button, DropdownMenu } from '@wordpress/components';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
5
3
|
|
|
6
4
|
type AllowedDropdownMenuProps = Pick<
|
|
7
|
-
|
|
5
|
+
ComponentProps< typeof DropdownMenu >,
|
|
8
6
|
'controls' | 'popoverProps' | 'toggleProps' | 'label'
|
|
9
7
|
>;
|
|
10
8
|
|
|
11
|
-
export type SplitButtonProps = Omit<
|
|
9
|
+
export type SplitButtonProps = Omit< ComponentProps< typeof Button >, 'controls' > &
|
|
12
10
|
AllowedDropdownMenuProps &
|
|
13
11
|
// make `controls` prop required
|
|
14
12
|
Required< Pick< AllowedDropdownMenuProps, 'controls' > >;
|
|
@@ -10,13 +10,13 @@ import clsx from 'clsx';
|
|
|
10
10
|
import Text from '../text/index.tsx';
|
|
11
11
|
import styles from './style.module.scss';
|
|
12
12
|
import { StatCardProps } from './types.ts';
|
|
13
|
-
import type
|
|
13
|
+
import type { ReactNode } from 'react';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* StatCard component
|
|
17
17
|
*
|
|
18
18
|
* @param {StatCardProps} props - Component props.
|
|
19
|
-
* @return {
|
|
19
|
+
* @return {ReactNode} - StatCard react component.
|
|
20
20
|
*/
|
|
21
21
|
const StatCard = ( {
|
|
22
22
|
className,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
|
|
1
3
|
export type StatCardProps = {
|
|
2
4
|
/**
|
|
3
5
|
* Custom className to be inserted.
|
|
@@ -12,7 +14,7 @@ export type StatCardProps = {
|
|
|
12
14
|
/**
|
|
13
15
|
* The stat card icon.
|
|
14
16
|
*/
|
|
15
|
-
icon:
|
|
17
|
+
icon: JSX.Element;
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* The stat label.
|
|
@@ -2,6 +2,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import Text from '../text/index.tsx';
|
|
4
4
|
import styles from './style.module.scss';
|
|
5
|
+
import type { JSX } from 'react';
|
|
5
6
|
|
|
6
7
|
interface StatusProps {
|
|
7
8
|
status?: 'active' | 'error' | 'inactive' | 'action' | 'initializing';
|
|
@@ -9,7 +10,7 @@ interface StatusProps {
|
|
|
9
10
|
className?: string;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
const Status = ( { className, label, status = 'inactive' }: StatusProps ):
|
|
13
|
+
const Status = ( { className, label, status = 'inactive' }: StatusProps ): JSX.Element => {
|
|
13
14
|
const defaultLabels: Record< string, string > = {
|
|
14
15
|
active: __( 'Active', 'jetpack-components' ),
|
|
15
16
|
error: __( 'Error', 'jetpack-components' ),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import
|
|
2
|
+
import { Children, useState, useLayoutEffect, useRef, useCallback, useEffect } from 'react';
|
|
3
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
3
4
|
|
|
4
5
|
import './style.scss';
|
|
5
6
|
|
|
@@ -17,10 +18,10 @@ const TRANSITION_DURATION = '300ms';
|
|
|
17
18
|
/**
|
|
18
19
|
* Custom hook to observe and handle resize events on a DOM element.
|
|
19
20
|
*
|
|
20
|
-
* @return {[
|
|
21
|
+
* @return {[Dispatch<SetStateAction<HTMLElement | null>>, ResizeObserverEntry | null]} Tuple containing setter and entry
|
|
21
22
|
*/
|
|
22
23
|
function useResizeObserver(): [
|
|
23
|
-
|
|
24
|
+
Dispatch< SetStateAction< HTMLElement | null > >,
|
|
24
25
|
ResizeObserverEntry | null,
|
|
25
26
|
] {
|
|
26
27
|
const [ observerEntry, setObserverEntry ] = useState< ResizeObserverEntry | null >( null );
|
|
@@ -5,9 +5,10 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { getRedirectUrl } from '../../index.ts';
|
|
6
6
|
import Text from '../text/index.tsx';
|
|
7
7
|
import type { TermsOfServiceProps } from './types.ts';
|
|
8
|
+
import type { FC, ReactNode } from 'react';
|
|
8
9
|
import './styles.scss';
|
|
9
10
|
|
|
10
|
-
const TermsOfService:
|
|
11
|
+
const TermsOfService: FC< TermsOfServiceProps > = ( {
|
|
11
12
|
className,
|
|
12
13
|
multipleButtons,
|
|
13
14
|
agreeButtonLabel,
|
|
@@ -92,7 +93,7 @@ const TermsOfServiceTextOnly = () =>
|
|
|
92
93
|
}
|
|
93
94
|
);
|
|
94
95
|
|
|
95
|
-
const Link:
|
|
96
|
+
const Link: FC< { slug: string; children?: ReactNode } > = ( { slug, children } ) => (
|
|
96
97
|
<ExternalLink className="terms-of-service__link" href={ getRedirectUrl( slug ) }>
|
|
97
98
|
{ children }
|
|
98
99
|
</ExternalLink>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import
|
|
2
|
+
import { forwardRef, useMemo } from 'react';
|
|
3
3
|
import { BOX_MODEL_VALUES, VARIANTS_MAPPING } from './constants.ts';
|
|
4
4
|
import styles from './style.module.scss';
|
|
5
5
|
import type { H3Props, TextProps, TitleProps } from './types.ts';
|
|
6
|
+
import type { FC, ReactElement } from 'react';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Text component.
|
|
9
10
|
*
|
|
10
11
|
* @param {TextProps} props - Component props.
|
|
11
|
-
* @return {
|
|
12
|
+
* @return {ReactElement} - JSX.Element
|
|
12
13
|
*/
|
|
13
14
|
const Text = forwardRef< HTMLElement, TextProps >(
|
|
14
15
|
( { variant = 'body', children, component, className, ...componentProps }, ref ) => {
|
|
@@ -45,9 +46,9 @@ export default Text;
|
|
|
45
46
|
* Heading component - Medium size.
|
|
46
47
|
*
|
|
47
48
|
* @param {TextProps} props - Component props.
|
|
48
|
-
* @return {
|
|
49
|
+
* @return {ReactElement} - JSX.Element
|
|
49
50
|
*/
|
|
50
|
-
export const H2:
|
|
51
|
+
export const H2: FC< TextProps > = ( { children, ...componentProps } ) => (
|
|
51
52
|
<Text variant="headline-medium" mb={ 3 } { ...componentProps }>
|
|
52
53
|
{ children }
|
|
53
54
|
</Text>
|
|
@@ -57,9 +58,9 @@ export const H2: React.FC< TextProps > = ( { children, ...componentProps } ) =>
|
|
|
57
58
|
* Heading component - Small size,
|
|
58
59
|
*
|
|
59
60
|
* @param {H3Props} props - Component props.
|
|
60
|
-
* @return {
|
|
61
|
+
* @return {ReactElement} - JSX.Element
|
|
61
62
|
*/
|
|
62
|
-
export const H3:
|
|
63
|
+
export const H3: FC< H3Props > = ( { children, weight = 'bold', ...componentProps } ) => {
|
|
63
64
|
const variant = `headline-small${
|
|
64
65
|
weight === 'bold' ? '' : `-${ weight }`
|
|
65
66
|
}` as TextProps[ 'variant' ];
|
|
@@ -75,13 +76,9 @@ export const H3: React.FC< H3Props > = ( { children, weight = 'bold', ...compone
|
|
|
75
76
|
* Title component, based on Text component.
|
|
76
77
|
*
|
|
77
78
|
* @param {TitleProps} props - Component props.
|
|
78
|
-
* @return {
|
|
79
|
+
* @return {ReactElement} - JSX.Element
|
|
79
80
|
*/
|
|
80
|
-
export const Title:
|
|
81
|
-
children,
|
|
82
|
-
size = 'medium',
|
|
83
|
-
...componentProps
|
|
84
|
-
} ) => (
|
|
81
|
+
export const Title: FC< TitleProps > = ( { children, size = 'medium', ...componentProps } ) => (
|
|
85
82
|
<Text variant={ `title-${ size }` } mb={ 1 } { ...componentProps }>
|
|
86
83
|
{ children }
|
|
87
84
|
</Text>
|
package/components/text/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VARIANTS_MAPPING } from './constants.ts';
|
|
2
|
-
import type
|
|
2
|
+
import type { CSSProperties, ElementType, FC, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
export type SpacingValue = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
|
5
5
|
|
|
@@ -36,10 +36,10 @@ export type TextProps = {
|
|
|
36
36
|
/** HTML Class */
|
|
37
37
|
className?: string;
|
|
38
38
|
/** The text itself that will be rendered. */
|
|
39
|
-
children:
|
|
39
|
+
children: ReactNode;
|
|
40
40
|
/** Force an specific tag (span, div) or use a custom component that will receive className and children */
|
|
41
|
-
component?:
|
|
42
|
-
style?:
|
|
41
|
+
component?: FC< { [ prop: string ]: unknown } > | ElementType;
|
|
42
|
+
style?: CSSProperties;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export type H3Props = TextProps & {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
2
2
|
import styles from './globals.module.scss';
|
|
3
3
|
import { ThemeInstance, ThemeProviderProps } from './types.ts';
|
|
4
|
+
import type { FC, ReactNode } from 'react';
|
|
4
5
|
|
|
5
6
|
export const typography = {
|
|
6
7
|
// Headline
|
|
@@ -112,9 +113,9 @@ const setup = ( root: HTMLElement, id: string, withGlobalStyles?: boolean ) => {
|
|
|
112
113
|
* ThemeProvider React component.
|
|
113
114
|
*
|
|
114
115
|
* @param {ThemeProviderProps} props - Component properties.
|
|
115
|
-
* @return {
|
|
116
|
+
* @return {ReactNode} ThemeProvider component.
|
|
116
117
|
*/
|
|
117
|
-
const ThemeProvider:
|
|
118
|
+
const ThemeProvider: FC< ThemeProviderProps > = ( {
|
|
118
119
|
children = null,
|
|
119
120
|
targetDom,
|
|
120
121
|
id,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
1
3
|
export type ThemeProviderProps = {
|
|
2
4
|
/**
|
|
3
5
|
* An optional id to register and identify the provider instance.
|
|
@@ -12,7 +14,7 @@ export type ThemeProviderProps = {
|
|
|
12
14
|
/**
|
|
13
15
|
* Content
|
|
14
16
|
*/
|
|
15
|
-
children?:
|
|
17
|
+
children?: ReactNode;
|
|
16
18
|
/**
|
|
17
19
|
* Inser global/reset styles
|
|
18
20
|
*/
|
|
@@ -2,6 +2,7 @@ import { ToggleControl as WPToggleControl } from '@wordpress/components';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import styles from './styles.module.scss';
|
|
5
|
+
import type { FC, ReactNode } from 'react';
|
|
5
6
|
|
|
6
7
|
interface ToggleControlProps {
|
|
7
8
|
/** Whether or not the toggle is currently enabled. */
|
|
@@ -14,13 +15,13 @@ interface ToggleControlProps {
|
|
|
14
15
|
disabled?: boolean;
|
|
15
16
|
|
|
16
17
|
/** Additional information to display below the toggle. */
|
|
17
|
-
help?:
|
|
18
|
+
help?: ReactNode;
|
|
18
19
|
|
|
19
20
|
/** Whether or not the toggling is currently toggling. */
|
|
20
21
|
toggling?: boolean;
|
|
21
22
|
|
|
22
23
|
/** The label for the toggle. */
|
|
23
|
-
label?:
|
|
24
|
+
label?: ReactNode;
|
|
24
25
|
|
|
25
26
|
/** The size of the toggle. */
|
|
26
27
|
size?: 'small' | 'normal';
|
|
@@ -29,7 +30,7 @@ interface ToggleControlProps {
|
|
|
29
30
|
onChange: ( value: boolean ) => void;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
const ToggleControl:
|
|
33
|
+
const ToggleControl: FC< ToggleControlProps > = ( {
|
|
33
34
|
checked,
|
|
34
35
|
className,
|
|
35
36
|
disabled,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Card, CardBody } from '@wordpress/components';
|
|
2
2
|
import { createInterpolateElement } from '@wordpress/element';
|
|
3
|
-
import React from 'react';
|
|
4
3
|
import { Button } from '@automattic/jetpack-components';
|
|
5
4
|
import { UpsellBannerProps } from './types.ts';
|
|
5
|
+
import type { FC, ReactNode } from 'react';
|
|
6
6
|
|
|
7
7
|
import './style.scss';
|
|
8
8
|
|
|
@@ -13,9 +13,9 @@ import './style.scss';
|
|
|
13
13
|
* - The secondary CTA is the first button, at the left position.
|
|
14
14
|
*
|
|
15
15
|
* @param {UpsellBannerProps} props - Component props.
|
|
16
|
-
* @return {
|
|
16
|
+
* @return {ReactNode} - UpsellBanner component.
|
|
17
17
|
*/
|
|
18
|
-
const UpsellBanner:
|
|
18
|
+
const UpsellBanner: FC< UpsellBannerProps > = props => {
|
|
19
19
|
const {
|
|
20
20
|
icon,
|
|
21
21
|
title,
|