Replace react imports with wordpress/element (https://github.com/woocommerce/woocommerce-blocks/pull/8520)
* Replace react imports with wordpress/element * Fix TS errors * Update a couple of React type imports
This commit is contained in:
parent
363fe84039
commit
1d0adeed28
|
@ -70,6 +70,19 @@ module.exports = {
|
|||
allowedTextDomain: [ 'woo-gutenberg-products-block' ],
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: 'react',
|
||||
message:
|
||||
'Please use React API through `@wordpress/element` instead.',
|
||||
allowTypeImports: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
camelcase: [
|
||||
'error',
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ import { __ } from '@wordpress/i18n';
|
|||
import { decodeEntities } from '@wordpress/html-entities';
|
||||
import { SelectControl } from 'wordpress-components';
|
||||
import type { SelectControl as SelectControlType } from '@wordpress/components';
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect } from '@wordpress/element';
|
||||
import classnames from 'classnames';
|
||||
import { ValidationInputError } from '@woocommerce/blocks-checkout';
|
||||
import { VALIDATION_STORE_KEY } from '@woocommerce/block-data';
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
import { useColorProps, useTypographyProps } from '@woocommerce/base-hooks';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { withProductDataContext } from '@woocommerce/shared-hocs';
|
||||
import { HTMLAttributes } from 'react';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -14,8 +14,8 @@ import {
|
|||
useTypographyProps,
|
||||
} from '@woocommerce/base-hooks';
|
||||
import { withProductDataContext } from '@woocommerce/shared-hocs';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
import { CurrencyCode } from '@woocommerce/type-defs/currency';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
BlockControls,
|
||||
useBlockProps,
|
||||
} from '@wordpress/block-editor';
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect } from '@wordpress/element';
|
||||
import type { BlockAlignment } from '@wordpress/blocks';
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
useBlockProps,
|
||||
} from '@wordpress/block-editor';
|
||||
import type { BlockEditProps } from '@wordpress/blocks';
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect } from '@wordpress/element';
|
||||
import { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import { useBlockProps } from '@wordpress/block-editor';
|
||||
import type { BlockEditProps } from '@wordpress/blocks';
|
||||
import { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -5,7 +5,7 @@ import { __ } from '@wordpress/i18n';
|
|||
import type { BlockEditProps } from '@wordpress/blocks';
|
||||
import EditProductLink from '@woocommerce/editor-components/edit-product-link';
|
||||
import { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -5,7 +5,7 @@ import EditProductLink from '@woocommerce/editor-components/edit-product-link';
|
|||
import { useBlockProps } from '@wordpress/block-editor';
|
||||
import type { BlockEditProps } from '@wordpress/blocks';
|
||||
import { ProductQueryContext as Context } from '@woocommerce/blocks/product-query/types';
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import classnames from 'classnames';
|
||||
import { HTMLAttributes } from 'react';
|
||||
import {
|
||||
useInnerBlockLayoutContext,
|
||||
useProductDataContext,
|
||||
|
@ -16,6 +15,7 @@ import {
|
|||
useTypographyProps,
|
||||
useColorProps,
|
||||
} from '@woocommerce/base-hooks';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Component } from 'react';
|
||||
import { Component } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
import classNames from 'classnames';
|
||||
import { _n, sprintf } from '@wordpress/i18n';
|
||||
import { decodeEntities } from '@wordpress/html-entities';
|
||||
import type { ReactElement } from 'react';
|
||||
import { Panel } from '@woocommerce/blocks-checkout';
|
||||
import Label from '@woocommerce/base-components/label';
|
||||
import { useCallback } from '@wordpress/element';
|
||||
|
@ -14,6 +13,7 @@ import {
|
|||
} from '@woocommerce/base-context/hooks';
|
||||
import { sanitizeHTML } from '@woocommerce/utils';
|
||||
import { debounce } from 'lodash';
|
||||
import type { ReactElement } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { ReactElement } from 'react';
|
||||
import { CartResponseShippingRate } from '@woocommerce/type-defs/cart-response';
|
||||
import type { ReactElement } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -13,6 +13,7 @@ import {
|
|||
import { useSelect } from '@wordpress/data';
|
||||
import { VALIDATION_STORE_KEY } from '@woocommerce/block-data';
|
||||
import classnames from 'classnames';
|
||||
import type { MouseEvent } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -62,13 +63,13 @@ export const TotalsCoupon = ( {
|
|||
};
|
||||
} );
|
||||
const handleCouponAnchorClick = (
|
||||
e: React.MouseEvent< HTMLAnchorElement, MouseEvent >
|
||||
e: MouseEvent< HTMLAnchorElement, MouseEvent >
|
||||
) => {
|
||||
e.preventDefault();
|
||||
setIsCouponFormHidden( false );
|
||||
};
|
||||
const handleCouponSubmit = (
|
||||
e: React.MouseEvent< HTMLButtonElement, MouseEvent >
|
||||
e: MouseEvent< HTMLButtonElement, MouseEvent >
|
||||
) => {
|
||||
e.preventDefault();
|
||||
if ( onSubmit !== undefined ) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { ChangeEventHandler } from 'react';
|
||||
import { ProductResponseItem } from '@woocommerce/types';
|
||||
import type { ChangeEventHandler } from 'react';
|
||||
import type { ProductResponseItem } from '@woocommerce/types';
|
||||
|
||||
interface GenerateQueryProps {
|
||||
sortValue: string;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import { decodeEntities } from '@wordpress/html-entities';
|
||||
import classnames from 'classnames';
|
||||
import { AnchorHTMLAttributes, HTMLAttributes } from 'react';
|
||||
import type { AnchorHTMLAttributes, HTMLAttributes } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import React, { createRef, Component } from 'react';
|
||||
import { createRef, Component } from '@wordpress/element';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import type { MouseEvent, RefObject, ReactNode } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -13,7 +14,7 @@ export interface ReadMoreProps {
|
|||
/**
|
||||
* The entire content to clamp
|
||||
*/
|
||||
children: React.ReactNode;
|
||||
children: ReactNode;
|
||||
/**
|
||||
* Class names for the wrapped component
|
||||
*/
|
||||
|
@ -56,7 +57,7 @@ interface ReadMoreState {
|
|||
/**
|
||||
* Content is passed in via children.
|
||||
*/
|
||||
content: React.ReactNode;
|
||||
content: ReactNode;
|
||||
/**
|
||||
* Summary content generated from content HTML.
|
||||
*/
|
||||
|
@ -79,8 +80,8 @@ export const defaultProps = {
|
|||
class ReadMore extends Component< ReadMoreProps, ReadMoreState > {
|
||||
static defaultProps = defaultProps;
|
||||
|
||||
private reviewSummary: React.RefObject< HTMLDivElement >;
|
||||
private reviewContent: React.RefObject< HTMLDivElement >;
|
||||
private reviewSummary: RefObject< HTMLDivElement >;
|
||||
private reviewContent: RefObject< HTMLDivElement >;
|
||||
|
||||
constructor( props: ReadMoreProps ) {
|
||||
super( props );
|
||||
|
@ -192,7 +193,7 @@ class ReadMore extends Component< ReadMoreProps, ReadMoreState > {
|
|||
/**
|
||||
* Handles the click event for the read more/less button.
|
||||
*/
|
||||
onClick( e: React.MouseEvent< HTMLAnchorElement, MouseEvent > ): void {
|
||||
onClick( e: MouseEvent< HTMLAnchorElement, MouseEvent > ): void {
|
||||
e.preventDefault();
|
||||
|
||||
const { isExpanded } = this.state;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import SortSelect from '@woocommerce/base-components/sort-select';
|
||||
import { ChangeEventHandler } from 'react';
|
||||
import type { ChangeEventHandler } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { forwardRef } from 'react';
|
||||
import { forwardRef } from '@wordpress/element';
|
||||
import classNames from 'classnames';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { forwardRef } from 'react';
|
||||
import { forwardRef } from '@wordpress/element';
|
||||
import classNames from 'classnames';
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import classNames from 'classnames';
|
||||
import Label from '@woocommerce/base-components/label';
|
||||
import { withInstanceId } from '@wordpress/compose';
|
||||
import { ChangeEventHandler } from 'react';
|
||||
import type { ChangeEventHandler } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import { RawHTML, useMemo } from '@wordpress/element';
|
||||
import { WordCountType } from '@woocommerce/block-settings';
|
||||
import { CSSProperties } from 'react';
|
||||
import type { CSSProperties } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import classNames from 'classnames';
|
||||
import { ReactNode } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Component } from 'react';
|
||||
import { Component } from '@wordpress/element';
|
||||
import PropTypes from 'prop-types';
|
||||
import isShallowEqual from '@wordpress/is-shallow-equal';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { useEffect, useState } from '@wordpress/element';
|
||||
import { Dispatch, SetStateAction } from 'react';
|
||||
import type { Dispatch, SetStateAction } from 'react';
|
||||
|
||||
export const useLocalStorageState = < T >(
|
||||
key: string,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { useRef, useEffect } from 'react';
|
||||
import { useRef, useEffect } from '@wordpress/element';
|
||||
|
||||
interface Validation< T > {
|
||||
( value: T, previousValue: T | undefined ): boolean;
|
||||
|
|
|
@ -19,10 +19,11 @@ import {
|
|||
import { isTextField } from '@wordpress/dom';
|
||||
import { subscribe, select as _select } from '@wordpress/data';
|
||||
import { useEffect, useRef } from '@wordpress/element';
|
||||
import { MutableRefObject } from 'react';
|
||||
import { BACKSPACE, DELETE } from '@wordpress/keycodes';
|
||||
import { hasFilter } from '@wordpress/hooks';
|
||||
import { getBlockType } from '@wordpress/blocks';
|
||||
import type { MutableRefObject } from 'react';
|
||||
|
||||
/**
|
||||
* Toggle class on body.
|
||||
*
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { Component } from 'react';
|
||||
import { Component } from '@wordpress/element';
|
||||
import PropTypes from 'prop-types';
|
||||
import { CURRENT_USER_IS_ADMIN } from '@woocommerce/settings';
|
||||
import { StoreNoticesContainer } from '@woocommerce/blocks-checkout';
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
BlockInstance,
|
||||
} from '@wordpress/blocks';
|
||||
import type { Block, TemplateArray } from '@wordpress/blocks';
|
||||
import { MutableRefObject } from 'react';
|
||||
import type { MutableRefObject } from 'react';
|
||||
|
||||
interface LockableBlock extends Block {
|
||||
attributes: {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { type ReactElement } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { useShippingData } from '@woocommerce/base-context/hooks';
|
||||
import { ShippingRatesControl } from '@woocommerce/base-components/cart-checkout';
|
||||
|
@ -21,6 +20,7 @@ import type {
|
|||
PackageRateOption,
|
||||
CartShippingPackageShippingRate,
|
||||
} from '@woocommerce/types';
|
||||
import type { ReactElement } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { ComponentType, Dispatch, SetStateAction } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import {
|
||||
AlignmentToolbar,
|
||||
BlockControls as BlockControlsWrapper,
|
||||
MediaReplaceFlow,
|
||||
} from '@wordpress/block-editor';
|
||||
import type { BlockAlignment } from '@wordpress/blocks';
|
||||
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
||||
import { crop } from '@wordpress/icons';
|
||||
import { WP_REST_API_Category } from 'wp-types';
|
||||
import { ProductResponseItem } from '@woocommerce/types';
|
||||
import TextToolbarButton from '@woocommerce/editor-components/text-toolbar-button';
|
||||
import type { ComponentType, Dispatch, SetStateAction } from 'react';
|
||||
import type { BlockAlignment } from '@wordpress/blocks';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import classnames from 'classnames';
|
||||
import { useState } from 'react';
|
||||
import { useState } from '@wordpress/element';
|
||||
import { ResizableBox } from '@wordpress/components';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { FunctionComponent } from 'react';
|
||||
import { useBlockProps } from '@wordpress/block-editor';
|
||||
import type { FunctionComponent } from 'react';
|
||||
|
||||
export function Edit< T >( Block: FunctionComponent< T > ) {
|
||||
return function WithBlock( props: T ): JSX.Element {
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { ComponentType, Dispatch, SetStateAction } from 'react';
|
||||
import { WP_REST_API_Category } from 'wp-types';
|
||||
import { ProductResponseItem } from '@woocommerce/types';
|
||||
import {
|
||||
__experimentalImageEditingProvider as ImageEditingProvider,
|
||||
__experimentalImageEditor as GutenbergImageEditor,
|
||||
} from '@wordpress/block-editor';
|
||||
import type { ComponentType, Dispatch, SetStateAction } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { ComponentType } from 'react';
|
||||
import { WP_REST_API_Category } from 'wp-types';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import {
|
||||
|
@ -22,6 +21,7 @@ import {
|
|||
ExternalLink,
|
||||
} from '@wordpress/components';
|
||||
import { LooselyMustHave, ProductResponseItem } from '@woocommerce/types';
|
||||
import type { ComponentType } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import type { BlockConfiguration } from '@wordpress/blocks';
|
||||
import { FunctionComponent } from 'react';
|
||||
import { InnerBlocks } from '@wordpress/block-editor';
|
||||
import { registerBlockType } from '@wordpress/blocks';
|
||||
import { getSetting } from '@woocommerce/settings';
|
||||
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
||||
import type { FunctionComponent } from 'react';
|
||||
import type { BlockConfiguration } from '@wordpress/blocks';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
getImageSrcFromProduct,
|
||||
getImageIdFromProduct,
|
||||
} from '@woocommerce/utils';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useState } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -5,7 +5,7 @@ import ErrorPlaceholder, {
|
|||
ErrorObject,
|
||||
} from '@woocommerce/editor-components/error-placeholder';
|
||||
import type { Block } from '@wordpress/blocks';
|
||||
import { ComponentType } from 'react';
|
||||
import type { ComponentType } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Placeholder, Icon, Button } from '@wordpress/components';
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import ProductCategoryControl from '@woocommerce/editor-components/product-category-control';
|
||||
import ProductControl from '@woocommerce/editor-components/product-control';
|
||||
import { ComponentType } from 'react';
|
||||
import type { ComponentType } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { ComponentType, useEffect, useState } from 'react';
|
||||
import { useEffect, useState } from '@wordpress/element';
|
||||
import type { ComponentType } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -9,15 +9,10 @@ import { __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles
|
|||
import { Icon, Placeholder, Spinner } from '@wordpress/components';
|
||||
import classnames from 'classnames';
|
||||
import { isEmpty } from 'lodash';
|
||||
import {
|
||||
ComponentType,
|
||||
Dispatch,
|
||||
SetStateAction,
|
||||
useCallback,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { useCallback, useState } from '@wordpress/element';
|
||||
import { WP_REST_API_Category } from 'wp-types';
|
||||
import { useBorderProps } from '@woocommerce/base-hooks';
|
||||
import type { ComponentType, Dispatch, SetStateAction } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { ComponentType, useEffect, useMemo, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from '@wordpress/element';
|
||||
import { WP_REST_API_Category } from 'wp-types';
|
||||
import { ProductResponseItem } from '@woocommerce/types';
|
||||
import { useDispatch, useSelect } from '@wordpress/data';
|
||||
import type { ComponentType } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
|
||||
import type { ReactElement } from 'react';
|
||||
import { formatPrice } from '@woocommerce/price-format';
|
||||
import {
|
||||
PanelBody,
|
||||
|
@ -14,6 +13,7 @@ import {
|
|||
import { getSetting } from '@woocommerce/settings';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import Noninteractive from '@woocommerce/base-components/noninteractive';
|
||||
import type { ReactElement } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import type { ReactElement } from 'react';
|
||||
import { useBlockProps, InnerBlocks } from '@wordpress/block-editor';
|
||||
import { EditorProvider } from '@woocommerce/base-context';
|
||||
import type { TemplateArray } from '@wordpress/blocks';
|
||||
import { useEffect } from '@wordpress/element';
|
||||
import type { ReactElement } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { useStoreCart } from '@woocommerce/base-context/hooks';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useEffect, useRef } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { ElementType } from 'react';
|
||||
import type { ElementType } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { InspectorControls } from '@wordpress/block-editor';
|
||||
import { useSelect } from '@wordpress/data';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Component } from 'react';
|
||||
import { Component } from '@wordpress/element';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ProductListContainer } from '@woocommerce/base-components/product-list';
|
||||
import { InnerBlockLayoutContextProvider } from '@woocommerce/shared-context';
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { type ReactElement } from 'react';
|
||||
import { __, sprintf } from '@wordpress/i18n';
|
||||
import { speak } from '@wordpress/a11y';
|
||||
import { Icon, chevronDown } from '@wordpress/icons';
|
||||
|
@ -30,6 +29,7 @@ import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
|||
import { changeUrl } from '@woocommerce/utils';
|
||||
import classnames from 'classnames';
|
||||
import { difference } from 'lodash';
|
||||
import type { ReactElement } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import React from 'react';
|
||||
import React from '@wordpress/element';
|
||||
import { render, screen, waitFor, within } from '@testing-library/react';
|
||||
import * as hooks from '@woocommerce/base-context/hooks';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { Component } from 'react';
|
||||
import { Component } from '@wordpress/element';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Disabled } from '@wordpress/components';
|
||||
import { getSetting } from '@woocommerce/settings';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import { __, _n, sprintf } from '@wordpress/i18n';
|
||||
import { speak } from '@wordpress/a11y';
|
||||
import { Component } from 'react';
|
||||
import { Component } from '@wordpress/element';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import React from 'react';
|
||||
import React from '@wordpress/element';
|
||||
import { render, screen, within, waitFor } from '@testing-library/react';
|
||||
import { default as fetchMock } from 'jest-fetch-mock';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { Card, CardBody } from '@wordpress/components';
|
||||
import type { ReactNode } from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
const StyledCard = styled( Card )`
|
||||
border-radius: 3px;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import React from 'react';
|
||||
import React from '@wordpress/element';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
const StyledSectionWrapper = styled.div`
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { DebouncedFunc, throttle, ThrottleSettings } from 'lodash';
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
import { useCallback, useEffect, useRef } from '@wordpress/element';
|
||||
|
||||
/**
|
||||
* Throttles a function inside a React functional component
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import type { LazyExoticComponent } from 'react';
|
||||
import type { LazyExoticComponent } from '@wordpress/element';
|
||||
import type { BlockConfiguration } from '@wordpress/blocks';
|
||||
import type { RegisteredBlockComponent } from '@woocommerce/types';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Component } from 'react';
|
||||
import { Component } from '@wordpress/element';
|
||||
|
||||
class CheckoutSlotErrorBoundary extends Component {
|
||||
state = { errorMessage: '', hasError: false };
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { useState } from '@wordpress/element';
|
||||
import type { ReactNode, ReactElement } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { Icon, chevronUp, chevronDown } from '@wordpress/icons';
|
||||
import type { ReactNode, ReactElement } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { forwardRef, InputHTMLAttributes } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import { useState } from '@wordpress/element';
|
||||
import { forwardRef, useState } from '@wordpress/element';
|
||||
import type { InputHTMLAttributes } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import {
|
||||
useRef,
|
||||
useEffect,
|
||||
useState,
|
||||
useCallback,
|
||||
InputHTMLAttributes,
|
||||
} from 'react';
|
||||
import { useRef, useEffect, useState, useCallback } from '@wordpress/element';
|
||||
import classnames from 'classnames';
|
||||
import { withInstanceId } from '@wordpress/compose';
|
||||
import { isObject } from '@woocommerce/types';
|
||||
import { useDispatch, useSelect } from '@wordpress/data';
|
||||
import { VALIDATION_STORE_KEY } from '@woocommerce/block-data';
|
||||
import { usePrevious } from '@woocommerce/base-hooks';
|
||||
import type { InputHTMLAttributes } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import classnames from 'classnames';
|
||||
import { Children, ReactNode } from 'react';
|
||||
import { Children } from '@wordpress/element';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { getSetting } from '@woocommerce/settings';
|
||||
import type { Currency } from '@woocommerce/price-format';
|
||||
import type { ReactElement } from 'react';
|
||||
import { getSetting } from '@woocommerce/settings';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
|
@ -6,7 +6,7 @@ import { __ } from '@wordpress/i18n';
|
|||
import { getSetting } from '@woocommerce/settings';
|
||||
import type { Currency } from '@woocommerce/price-format';
|
||||
import type { CartTotalsTaxLineItem } from '@woocommerce/types';
|
||||
import { ReactElement } from 'react';
|
||||
import type { ReactElement } from 'react';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
|
Loading…
Reference in New Issue