@automattic/jetpack-components 1.1.7 → 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.
Files changed (189) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/build/components/action-button/index.d.ts +2 -3
  3. package/build/components/action-button/index.js +1 -8
  4. package/build/components/action-popover/types.d.ts +4 -3
  5. package/build/components/admin-page/index.d.ts +3 -3
  6. package/build/components/admin-page/index.js +1 -1
  7. package/build/components/admin-page/types.d.ts +3 -2
  8. package/build/components/admin-section/basic/index.d.ts +3 -3
  9. package/build/components/admin-section/basic/index.js +1 -1
  10. package/build/components/admin-section/hero/index.d.ts +3 -3
  11. package/build/components/admin-section/hero/index.js +1 -1
  12. package/build/components/admin-section/types.d.ts +2 -1
  13. package/build/components/alert/index.d.ts +9 -9
  14. package/build/components/alert/index.js +7 -7
  15. package/build/components/automattic-byline-logo/index.d.ts +3 -3
  16. package/build/components/automattic-byline-logo/index.js +1 -1
  17. package/build/components/automattic-byline-logo/types.d.ts +2 -2
  18. package/build/components/automattic-for-agencies-logo/index.d.ts +3 -3
  19. package/build/components/automattic-for-agencies-logo/index.js +1 -1
  20. package/build/components/automattic-icon-logo/index.d.ts +3 -3
  21. package/build/components/automattic-icon-logo/index.js +1 -1
  22. package/build/components/badge/index.d.ts +4 -4
  23. package/build/components/badge/index.js +1 -1
  24. package/build/components/boost-score-graph/index.d.ts +2 -2
  25. package/build/components/boost-score-graph/index.js +1 -1
  26. package/build/components/boost-score-graph/uplot-line-chart.d.ts +3 -3
  27. package/build/components/boost-score-graph/uplot-line-chart.js +1 -1
  28. package/build/components/boost-score-graph/use-resize.d.ts +4 -4
  29. package/build/components/boost-score-graph/use-resize.js +2 -2
  30. package/build/components/button/index.d.ts +2 -3
  31. package/build/components/button/index.js +1 -7
  32. package/build/components/button/types.d.ts +4 -4
  33. package/build/components/chip/index.d.ts +3 -3
  34. package/build/components/chip/index.js +1 -1
  35. package/build/components/contextual-upgrade-trigger/index.d.ts +2 -2
  36. package/build/components/copy-to-clipboard/index.d.ts +2 -2
  37. package/build/components/decorative-card/index.d.ts +3 -3
  38. package/build/components/decorative-card/index.js +2 -2
  39. package/build/components/dialog/index.d.ts +10 -10
  40. package/build/components/dialog/index.js +6 -6
  41. package/build/components/donut-meter/index.d.ts +3 -3
  42. package/build/components/donut-meter/index.js +1 -1
  43. package/build/components/icon-tooltip/index.d.ts +3 -3
  44. package/build/components/icon-tooltip/index.js +1 -1
  45. package/build/components/icon-tooltip/types.d.ts +2 -1
  46. package/build/components/icons/index.d.ts +51 -51
  47. package/build/components/icons/index.js +4 -4
  48. package/build/components/icons/types.d.ts +2 -2
  49. package/build/components/indeterminate-progress-bar/index.d.ts +3 -3
  50. package/build/components/indeterminate-progress-bar/index.js +1 -1
  51. package/build/components/jetpack-footer/index.d.ts +3 -3
  52. package/build/components/jetpack-footer/index.js +1 -1
  53. package/build/components/jetpack-logo/index.d.ts +2 -2
  54. package/build/components/jetpack-protect-logo/index.d.ts +2 -2
  55. package/build/components/jetpack-search-logo/index.d.ts +2 -2
  56. package/build/components/jetpack-vaultpress-backup-logo/index.d.ts +2 -2
  57. package/build/components/jetpack-videopress-logo/index.d.ts +2 -2
  58. package/build/components/layout/col/index.d.ts +3 -3
  59. package/build/components/layout/col/index.js +1 -1
  60. package/build/components/layout/container/index.d.ts +1 -2
  61. package/build/components/layout/container/index.js +3 -3
  62. package/build/components/layout/types.d.ts +3 -2
  63. package/build/components/loading-placeholder/index.d.ts +2 -2
  64. package/build/components/notice/index.d.ts +12 -12
  65. package/build/components/notice/index.js +8 -8
  66. package/build/components/number-slider/index.d.ts +3 -3
  67. package/build/components/number-slider/index.js +3 -3
  68. package/build/components/number-slider/types.d.ts +2 -2
  69. package/build/components/popover/index.d.ts +5 -4
  70. package/build/components/pricing-card/index.d.ts +3 -3
  71. package/build/components/pricing-card/index.js +1 -1
  72. package/build/components/pricing-card/types.d.ts +6 -6
  73. package/build/components/pricing-table/index.d.ts +5 -5
  74. package/build/components/pricing-table/types.d.ts +7 -6
  75. package/build/components/product-offer/icons-card.d.ts +3 -3
  76. package/build/components/product-offer/icons-card.js +1 -1
  77. package/build/components/product-offer/index.d.ts +3 -3
  78. package/build/components/product-offer/index.js +1 -1
  79. package/build/components/product-offer/product-offer-header.d.ts +3 -3
  80. package/build/components/product-offer/product-offer-header.js +1 -1
  81. package/build/components/product-offer/types.d.ts +2 -1
  82. package/build/components/product-price/index.d.ts +3 -3
  83. package/build/components/product-price/index.js +1 -1
  84. package/build/components/product-price/price.d.ts +3 -3
  85. package/build/components/product-price/price.js +1 -1
  86. package/build/components/product-price/types.d.ts +2 -1
  87. package/build/components/progress-bar/index.d.ts +3 -3
  88. package/build/components/progress-bar/index.js +1 -1
  89. package/build/components/qr-code/index.d.ts +5 -5
  90. package/build/components/qr-code/index.js +1 -1
  91. package/build/components/radio-control/index.d.ts +4 -3
  92. package/build/components/record-meter-bar/index.d.ts +3 -3
  93. package/build/components/record-meter-bar/index.js +1 -1
  94. package/build/components/spinner/index.js +0 -1
  95. package/build/components/split-button/index.d.ts +2 -2
  96. package/build/components/split-button/types.d.ts +3 -5
  97. package/build/components/stat-card/index.d.ts +1 -1
  98. package/build/components/stat-card/index.js +1 -1
  99. package/build/components/stat-card/types.d.ts +2 -1
  100. package/build/components/status/index.d.ts +2 -1
  101. package/build/components/swipeable/index.js +1 -1
  102. package/build/components/terms-of-service/index.d.ts +2 -1
  103. package/build/components/text/index.d.ts +9 -9
  104. package/build/components/text/index.js +4 -4
  105. package/build/components/text/types.d.ts +5 -5
  106. package/build/components/theme-provider/index.d.ts +3 -3
  107. package/build/components/theme-provider/index.js +1 -1
  108. package/build/components/theme-provider/types.d.ts +2 -1
  109. package/build/components/toggle-control/index.d.ts +4 -3
  110. package/build/components/upsell-banner/index.d.ts +3 -3
  111. package/build/components/upsell-banner/index.js +1 -1
  112. package/components/action-button/index.jsx +1 -8
  113. package/components/action-popover/index.tsx +0 -1
  114. package/components/action-popover/types.ts +4 -3
  115. package/components/admin-page/index.tsx +3 -3
  116. package/components/admin-page/types.ts +3 -2
  117. package/components/admin-section/basic/index.tsx +3 -3
  118. package/components/admin-section/hero/index.tsx +3 -3
  119. package/components/admin-section/types.ts +3 -1
  120. package/components/alert/index.tsx +9 -14
  121. package/components/automattic-byline-logo/index.tsx +3 -3
  122. package/components/automattic-byline-logo/types.ts +2 -2
  123. package/components/automattic-for-agencies-logo/index.tsx +3 -3
  124. package/components/automattic-icon-logo/index.tsx +3 -3
  125. package/components/badge/index.tsx +4 -4
  126. package/components/boost-score-graph/index.tsx +2 -2
  127. package/components/boost-score-graph/uplot-line-chart.tsx +5 -4
  128. package/components/boost-score-graph/use-resize.ts +6 -5
  129. package/components/button/index.tsx +3 -8
  130. package/components/button/types.ts +4 -4
  131. package/components/chip/index.tsx +3 -3
  132. package/components/contextual-upgrade-trigger/index.tsx +2 -2
  133. package/components/copy-to-clipboard/index.tsx +4 -4
  134. package/components/decorative-card/index.tsx +3 -7
  135. package/components/details-viewer/index.tsx +0 -1
  136. package/components/dialog/index.tsx +10 -10
  137. package/components/donut-meter/index.tsx +3 -3
  138. package/components/dot-pager/index.tsx +1 -1
  139. package/components/icon-tooltip/index.tsx +3 -3
  140. package/components/icon-tooltip/types.ts +3 -1
  141. package/components/icons/index.tsx +23 -32
  142. package/components/icons/types.ts +2 -2
  143. package/components/indeterminate-progress-bar/index.tsx +3 -3
  144. package/components/jetpack-footer/index.tsx +5 -5
  145. package/components/jetpack-logo/index.tsx +2 -2
  146. package/components/jetpack-protect-logo/index.tsx +2 -2
  147. package/components/jetpack-search-logo/index.tsx +2 -2
  148. package/components/jetpack-vaultpress-backup-logo/index.tsx +2 -2
  149. package/components/jetpack-videopress-logo/index.tsx +2 -2
  150. package/components/layout/col/index.tsx +3 -3
  151. package/components/layout/container/index.tsx +6 -6
  152. package/components/layout/types.ts +4 -2
  153. package/components/loading-placeholder/index.tsx +2 -2
  154. package/components/notice/index.tsx +12 -12
  155. package/components/number-slider/index.tsx +6 -5
  156. package/components/number-slider/types.ts +2 -2
  157. package/components/popover/index.tsx +5 -4
  158. package/components/pricing-card/index.tsx +3 -3
  159. package/components/pricing-card/types.ts +6 -6
  160. package/components/pricing-table/index.tsx +6 -5
  161. package/components/pricing-table/types.ts +7 -6
  162. package/components/product-offer/icons-card.tsx +4 -3
  163. package/components/product-offer/index.tsx +3 -3
  164. package/components/product-offer/product-offer-header.tsx +3 -3
  165. package/components/product-offer/types.ts +2 -1
  166. package/components/product-price/index.tsx +3 -3
  167. package/components/product-price/price.tsx +3 -3
  168. package/components/product-price/types.ts +3 -1
  169. package/components/progress-bar/index.tsx +3 -3
  170. package/components/qr-code/index.tsx +5 -5
  171. package/components/radio-control/index.tsx +4 -3
  172. package/components/record-meter-bar/index.tsx +4 -3
  173. package/components/spinner/README.md +2 -2
  174. package/components/spinner/index.jsx +0 -1
  175. package/components/split-button/index.tsx +2 -2
  176. package/components/split-button/types.ts +3 -5
  177. package/components/stat-card/index.tsx +2 -2
  178. package/components/stat-card/types.ts +3 -1
  179. package/components/status/index.tsx +2 -1
  180. package/components/swipeable/index.tsx +4 -3
  181. package/components/terms-of-service/index.tsx +3 -2
  182. package/components/text/index.tsx +9 -12
  183. package/components/text/types.ts +4 -4
  184. package/components/theme-provider/index.tsx +4 -3
  185. package/components/theme-provider/types.ts +3 -1
  186. package/components/toggle-control/index.tsx +4 -3
  187. package/components/upsell-banner/index.tsx +3 -3
  188. package/components/zendesk-chat/README.md +0 -1
  189. package/package.json +4 -4
@@ -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?: React.ReactNode;
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?: React.ReactNode;
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: React.FC<ToggleControlProps>;
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 {React.ReactNode} - UpsellBanner component.
11
+ * @return {ReactNode} - UpsellBanner component.
12
12
  */
13
- declare const UpsellBanner: React.FC<UpsellBannerProps>;
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 {React.ReactNode} - UpsellBanner component.
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 {React.ReactNode} The `ActionButton` component.
16
+ * @return {import('react').ReactNode} The `ActionButton` component.
24
17
  */
25
18
  const ActionButton = props => {
26
19
  const {
@@ -16,7 +16,6 @@ import styles from './styles.module.scss';
16
16
  * Types
17
17
  */
18
18
  import { ActionPopoverProps } from './types.ts';
19
- import type React from 'react';
20
19
 
21
20
  const ActionPopover = ( {
22
21
  hideCloseButton = false,
@@ -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 = React.ComponentProps< typeof Popover > & {
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: React.ReactNode;
13
+ children: ReactNode;
13
14
  step?: number;
14
15
  totalSteps?: number;
15
- buttonContent?: React.ReactNode;
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 React from 'react';
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 {React.ReactNode} AdminPage component.
19
+ * @return {ReactNode} AdminPage component.
20
20
  */
21
- const AdminPage: React.FC< AdminPageProps > = ( {
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: React.ReactNode;
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?: React.ReactNode;
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 {React.ReactNode} AdminSection component.
9
+ * @return {ReactNode} AdminSection component.
10
10
  */
11
- const AdminSection: React.FC< AdminSectionBaseProps > = ( { children } ) => {
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 {React.Component} AdminSectionHero component.
9
+ * @return {Component} AdminSectionHero component.
10
10
  */
11
- const AdminSectionHero: React.FC< AdminSectionBaseProps > = ( { children } ) => {
11
+ const AdminSectionHero: FC< AdminSectionBaseProps > = ( { children } ) => {
12
12
  return <div className={ styles[ 'section-hero' ] }>{ children }</div>;
13
13
  };
14
14
 
@@ -1,7 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+
1
3
  export type AdminSectionBaseProps = {
2
4
  /**
3
5
  * The section content
4
6
  */
5
- children: React.ReactNode;
7
+ children: ReactNode;
6
8
  className?: string;
7
9
  };
@@ -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: React.ReactNode;
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} 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 {React.Component} props.children - The alert content.
43
- * @return {React.ReactElement} The `Alert` component.
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: React.FC< AlertProps > = ( {
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 {React.ReactNode} AutomatticBylineLogo component.
10
+ * @return {ReactNode} AutomatticBylineLogo component.
11
11
  */
12
- const AutomatticBylineLogo: React.FC< AutomatticBylineLogoProps > = ( {
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 React from 'react';
1
+ import type { SVGProps } from 'react';
2
2
 
3
- export interface AutomatticBylineLogoProps extends React.SVGProps< SVGSVGElement > {
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 React from 'react';
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 {React.ReactElement} Component template
9
+ * @return {ReactElement} Component template
10
10
  */
11
11
  export default function AutomatticForAgenciesLogo( {
12
12
  color = '#FFFFFF',
13
13
  }: {
14
14
  color: string;
15
- } ): React.ReactElement {
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 React from 'react';
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 {React.ReactElement} Component template
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
- } ): React.ReactElement {
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?: React.ReactNode;
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 {React.ReactElement} The `Badge` component.
20
+ * @return {ReactElement} The `Badge` component.
21
21
  */
22
- const Badge: React.FC< BadgeProps > = ( { children, className, variant, ...props } ) => {
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 {React.ReactElement} The JSX element representing the BoostScoreGraph component, or null if loading.
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 React, { useMemo, useRef, useCallback } from 'react';
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?: React.RefObject< HTMLDivElement >;
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 {React.Element} The JSX element representing the UplotLineChart component.
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 React.ComponentType< UplotReactProps >;
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 React, { useEffect } from 'react';
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 {React.RefObject<uPlot>} uplotRef - The ref object for the uPlot instance.
11
- * @param {React.RefObject<HTMLDivElement>} containerRef - The ref object for the container div.
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: React.RefObject< uPlot >,
15
- containerRef: React.RefObject< HTMLDivElement >
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 React, { forwardRef } from 'react';
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 {React.ReactNode} Rendered button
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 React from 'react';
2
+ import type { ComponentProps, ForwardedRef, ReactNode } from 'react';
3
3
 
4
4
  type JetpackButtonBaseProps = {
5
5
  className?: string;
6
- children?: React.ReactNode;
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?: React.ForwardedRef< unknown >;
16
+ ref?: ForwardedRef< unknown >;
17
17
  };
18
18
 
19
- type WPButtonProps = Omit< React.ComponentProps< typeof Button >, 'size' | 'variant' >;
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 {React.ReactElement} The `Chip` component.
16
+ * @return {ReactElement} The `Chip` component.
17
17
  */
18
- const Chip: React.FC< ChipProps > = ( { type = 'info', text } ) => {
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 React from 'react';
7
+ import type { FC } from 'react';
8
8
 
9
- const ContextualUpgradeTrigger: React.FC< CutBaseProps > = ( {
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 React from 'react';
7
+ import type { FC, ReactNode } from 'react';
8
8
 
9
- export const CopyToClipboard: React.FC< CopyToClipboardProps > = ( {
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: React.ReactNode = null;
44
- let label: React.ReactNode = null;
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 React from 'react';
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 {React.ReactNode} - The DecorativeCard component.
9
+ * @return {ReactNode} - The DecorativeCard component.
10
10
  */
11
11
 
12
- const DecorativeCard: React.FC< DecorativeCardProps > = ( {
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,4 +1,3 @@
1
- import React from 'react';
2
1
  import styles from './styles.module.scss';
3
2
 
4
3
  /**
@@ -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: React.ReactNode;
10
- secondary?: React.ReactNode;
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} props - React component props.
20
- * @param {React.ReactNode} props.primary - Primary-section content.
21
- * @param {React.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 {React.ReactNode} Rendered dialog
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: React.FC< DialogProps > = ( {
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 {React.ReactElement} - JSX element
75
+ * @return {ReactElement} - JSX element
76
76
  */
77
- const DonutMeter: React.FC< DonutMeterProps > = ( {
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 React, { Children, useState, useEffect, ReactNode, useCallback, useMemo } from 'react';
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';