* 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:
Mike Jolley 2020-03-10 11:20:40 +00:00 committed by GitHub
parent 952638a3ed
commit 514642395a
33 changed files with 38 additions and 38 deletions

View File

@ -2,7 +2,7 @@
* External dependencies * External dependencies
*/ */
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { Placeholder, Button } from '@wordpress/components'; import { Placeholder, Button } from 'wordpress-components';
import { Icon, truck } from '@woocommerce/icons'; import { Icon, truck } from '@woocommerce/icons';
import { ADMIN_URL } from '@woocommerce/settings'; import { ADMIN_URL } from '@woocommerce/settings';

View File

@ -2,7 +2,7 @@
* External dependencies * External dependencies
*/ */
import { useState } from '@wordpress/element'; import { useState } from '@wordpress/element';
import { withInstanceId } from '@wordpress/compose'; import withComponentId from '@woocommerce/base-hocs/with-component-id';
import classnames from 'classnames'; import classnames from 'classnames';
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
@ -41,7 +41,7 @@ const Tabs = ( {
tabs, tabs,
activeClass = 'is-active', activeClass = 'is-active',
initialTabName, initialTabName,
instanceId, componentId,
ariaLabel = __( 'Tabbed Content', 'woo-gutenberg-products-block' ), ariaLabel = __( 'Tabbed Content', 'woo-gutenberg-products-block' ),
children, children,
} ) => { } ) => {
@ -59,7 +59,7 @@ const Tabs = ( {
if ( ! selectedTab ) { if ( ! selectedTab ) {
throw new Error( 'There is no available tab for the selected item' ); throw new Error( 'There is no available tab for the selected item' );
} }
const selectedId = `${ instanceId }-${ selectedTab.name }`; const selectedId = `${ componentId }-${ selectedTab.name }`;
return ( return (
<div className={ classnames( 'wc-component__tabs', className ) }> <div className={ classnames( 'wc-component__tabs', className ) }>
<div <div
@ -76,8 +76,8 @@ const Tabs = ( {
[ activeClass ]: tab.name === selected, [ activeClass ]: tab.name === selected,
} }
) } ) }
tabId={ `${ instanceId }-${ tab.name }` } tabId={ `${ componentId }-${ tab.name }` }
aria-controls={ `${ instanceId }-${ tab.name }-view` } aria-controls={ `${ componentId }-${ tab.name }-view` }
selected={ tab.name === selected } selected={ tab.name === selected }
key={ tab.name } key={ tab.name }
ariaLabel={ tab.ariaLabel || null } ariaLabel={ tab.ariaLabel || null }
@ -102,4 +102,4 @@ const Tabs = ( {
); );
}; };
export default withInstanceId( Tabs ); export default withComponentId( Tabs );

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { cloneElement, isValidElement } from '@wordpress/element'; import { cloneElement, isValidElement } from 'wordpress-element';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
function Icon( { srcElement, size = 24, ...props } ) { function Icon( { srcElement, size = 24, ...props } ) {

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const grid = ( const grid = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const card = ( const card = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const cart = ( const cart = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const comment = ( const comment = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const discussion = ( const discussion = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const exclamation = ( const exclamation = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const external = ( const external = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const folderStarred = ( const folderStarred = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const folder = ( const folder = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const grid = ( const grid = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const image = ( const image = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const list = ( const list = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const more = ( const more = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const notes = ( const notes = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const notice = ( const notice = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const radioSelected = ( const radioSelected = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const radioUnselected = ( const radioUnselected = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const review = ( const review = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const search = ( const search = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const server = ( const server = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const star = ( const star = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
// 🤫 // 🤫
const stonks = ( const stonks = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const tag = ( const tag = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const tags = ( const tags = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const thumbUp = ( const thumbUp = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const toggle = ( const toggle = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
// This uses `delete_outline` icon from Material. // This uses `delete_outline` icon from Material.
// https://material.io/resources/icons/?icon=delete_outline&style=baseline // https://material.io/resources/icons/?icon=delete_outline&style=baseline

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const truck = ( const truck = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
const widgets = ( const widgets = (
<SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24"> <SVG xmlns="http://www.w3.org/2000/SVG" viewBox="0 0 24 24">

View File

@ -1,7 +1,7 @@
/** /**
* External dependencies * External dependencies
*/ */
import { SVG } from '@wordpress/components'; import { SVG } from 'wordpress-components';
import classnames from 'classnames'; import classnames from 'classnames';
const woo = ( { className, size } ) => ( const woo = ( { className, size } ) => (
<SVG <SVG