Prevent wp.components loading on frontend (https://github.com/woocommerce/woocommerce-blocks/pull/1918)
* Avoid importing @wordpress/components in icon library * Avoid @wordpress/compose and @wordpress/components in `base` * Move hocs used on frontend to base * Revert "Move hocs used on frontend to base" This reverts commit bf09016fdc2fc1bea2f465018fecc76945f69d5e.
This commit is contained in:
parent
952638a3ed
commit
514642395a
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { Placeholder, Button } from '@wordpress/components';
|
||||
import { Placeholder, Button } from 'wordpress-components';
|
||||
import { Icon, truck } from '@woocommerce/icons';
|
||||
import { ADMIN_URL } from '@woocommerce/settings';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { useState } from '@wordpress/element';
|
||||
import { withInstanceId } from '@wordpress/compose';
|
||||
import withComponentId from '@woocommerce/base-hocs/with-component-id';
|
||||
import classnames from 'classnames';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
|
@ -41,7 +41,7 @@ const Tabs = ( {
|
|||
tabs,
|
||||
activeClass = 'is-active',
|
||||
initialTabName,
|
||||
instanceId,
|
||||
componentId,
|
||||
ariaLabel = __( 'Tabbed Content', 'woo-gutenberg-products-block' ),
|
||||
children,
|
||||
} ) => {
|
||||
|
@ -59,7 +59,7 @@ const Tabs = ( {
|
|||
if ( ! selectedTab ) {
|
||||
throw new Error( 'There is no available tab for the selected item' );
|
||||
}
|
||||
const selectedId = `${ instanceId }-${ selectedTab.name }`;
|
||||
const selectedId = `${ componentId }-${ selectedTab.name }`;
|
||||
return (
|
||||
<div className={ classnames( 'wc-component__tabs', className ) }>
|
||||
<div
|
||||
|
@ -76,8 +76,8 @@ const Tabs = ( {
|
|||
[ activeClass ]: tab.name === selected,
|
||||
}
|
||||
) }
|
||||
tabId={ `${ instanceId }-${ tab.name }` }
|
||||
aria-controls={ `${ instanceId }-${ tab.name }-view` }
|
||||
tabId={ `${ componentId }-${ tab.name }` }
|
||||
aria-controls={ `${ componentId }-${ tab.name }-view` }
|
||||
selected={ tab.name === selected }
|
||||
key={ tab.name }
|
||||
ariaLabel={ tab.ariaLabel || null }
|
||||
|
@ -102,4 +102,4 @@ const Tabs = ( {
|
|||
);
|
||||
};
|
||||
|
||||
export default withInstanceId( Tabs );
|
||||
export default withComponentId( Tabs );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { cloneElement, isValidElement } from '@wordpress/element';
|
||||
import { cloneElement, isValidElement } from 'wordpress-element';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
function Icon( { srcElement, size = 24, ...props } ) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const grid = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const card = (
|
||||
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const cart = (
|
||||
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const comment = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const discussion = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const exclamation = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const external = (
|
||||
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const folderStarred = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const folder = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const grid = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const image = (
|
||||
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const list = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const more = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const notes = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const notice = (
|
||||
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const radioSelected = (
|
||||
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const radioUnselected = (
|
||||
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const review = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const search = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const server = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const star = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
// 🤫
|
||||
const stonks = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const tag = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const tags = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const thumbUp = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const toggle = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
// This uses `delete_outline` icon from Material.
|
||||
// https://material.io/resources/icons/?icon=delete_outline&style=baseline
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const truck = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
|
||||
const widgets = (
|
||||
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { SVG } from '@wordpress/components';
|
||||
import { SVG } from 'wordpress-components';
|
||||
import classnames from 'classnames';
|
||||
const woo = ( { className, size } ) => (
|
||||
<SVG
|
||||
|
|
Loading…
Reference in New Issue