Skip to content

Commit

Permalink
components: Remove all withNext wrappers (#32205)
Browse files Browse the repository at this point in the history
* Remove all `withNext` wrappers

* Remove the rest of the helpers

* Remove usages of ComponentSystemProvider
  • Loading branch information
BreadGuy007 committed May 27, 2021
1 parent f13a0aa commit 2505bb1
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 181 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"npm": ">=6.9.0 <7"
},
"config": {
"GUTENBERG_PHASE": 2,
"COMPONENT_SYSTEM_PHASE": 1
"GUTENBERG_PHASE": 2
},
"dependencies": {
"@wordpress/a11y": "file:packages/a11y",
Expand Down
21 changes: 7 additions & 14 deletions packages/block-editor/src/hooks/typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { hasBlockSupport } from '@wordpress/blocks';
/**
* External dependencies
*/
import {
PanelBody,
__unstableComponentSystemProvider as ComponentSystemProvider,
} from '@wordpress/components';
import { PanelBody } from '@wordpress/components';
import { Platform } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

Expand Down Expand Up @@ -73,16 +70,12 @@ export function TypographyPanel( props ) {
return (
<InspectorControls>
<PanelBody title={ __( 'Typography' ) }>
<ComponentSystemProvider
__unstableNextInclude={ [ 'WPComponentsFontSizePicker' ] }
>
<FontFamilyEdit { ...props } />
<FontSizeEdit { ...props } />
<FontAppearanceEdit { ...props } />
<LineHeightEdit { ...props } />
<TextDecorationAndTransformEdit { ...props } />
<LetterSpacingEdit { ...props } />
</ComponentSystemProvider>
<FontFamilyEdit { ...props } />
<FontSizeEdit { ...props } />
<FontAppearanceEdit { ...props } />
<LineHeightEdit { ...props } />
<TextDecorationAndTransformEdit { ...props } />
<LetterSpacingEdit { ...props } />
</PanelBody>
</InspectorControls>
);
Expand Down
6 changes: 0 additions & 6 deletions packages/components/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,3 @@ export {
} from './higher-order/with-focus-return';
export { default as withNotices } from './higher-order/with-notices';
export { default as withSpokenMessages } from './higher-order/with-spoken-messages';

// Component System
export {
withNext as __unstableWithNext,
ComponentSystemProvider as __unstableComponentSystemProvider,
} from './ui/context';
3 changes: 1 addition & 2 deletions packages/components/src/tooltip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { useDebounce } from '@wordpress/compose';
*/
import Popover from '../popover';
import Shortcut from '../shortcut';
import { withNextComponent } from './next';

/**
* Time over children to wait before showing tooltip
Expand Down Expand Up @@ -217,4 +216,4 @@ function Tooltip( { children, position, text, shortcut } ) {
} );
}

export default withNextComponent( Tooltip );
export default Tooltip;
17 changes: 0 additions & 17 deletions packages/components/src/tooltip/next.js

This file was deleted.

36 changes: 0 additions & 36 deletions packages/components/src/ui/context/component-system-provider.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/components/src/ui/context/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export { ComponentSystemProvider } from './component-system-provider';
export { withNext } from './with-next';
export {
ContextSystemProvider,
useComponentsContext,
Expand Down
48 changes: 0 additions & 48 deletions packages/components/src/ui/context/with-next.js

This file was deleted.

3 changes: 1 addition & 2 deletions packages/components/src/visually-hidden/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { forwardRef } from '@wordpress/element';
* Internal dependencies
*/
import { renderAsRenderProps } from './utils';
import { withNextComponent } from './next';

/**
* @template {keyof JSX.IntrinsicElements | import('react').JSXElementConstructor<any>} T
Expand Down Expand Up @@ -43,4 +42,4 @@ function VisuallyHidden( { as = 'div', className, ...props }, forwardedRef ) {
} );
}

export default withNextComponent( forwardRef( VisuallyHidden ) );
export default forwardRef( VisuallyHidden );
31 changes: 0 additions & 31 deletions packages/components/src/visually-hidden/next.js

This file was deleted.

13 changes: 3 additions & 10 deletions packages/edit-site/src/components/sidebar/global-styles-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ import { map, sortBy } from 'lodash';
/**
* WordPress dependencies
*/
import {
Button,
PanelBody,
TabPanel,
__unstableComponentSystemProvider as ComponentSystemProvider,
} from '@wordpress/components';
import { Button, PanelBody, TabPanel } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { getBlockType } from '@wordpress/blocks';
import { useMemo } from '@wordpress/element';
Expand Down Expand Up @@ -50,9 +45,7 @@ function GlobalStylesPanel( {
}

const content = (
<ComponentSystemProvider
__unstableNextInclude={ [ 'WPComponentsFontSizePicker' ] }
>
<>
{ hasTypographyPanel && (
<TypographyPanel
context={ context }
Expand Down Expand Up @@ -83,7 +76,7 @@ function GlobalStylesPanel( {
setStyle={ setStyle }
/>
) }
</ComponentSystemProvider>
</>
);
if ( ! wrapperPanelTitle ) {
return content;
Expand Down
4 changes: 1 addition & 3 deletions storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ const stories = [
'../packages/icons/src/**/stories/*.js',
].filter( Boolean );

const customEnvVariables = {
COMPONENT_SYSTEM_PHASE: 1,
};
const customEnvVariables = {};

module.exports = {
stories,
Expand Down
1 change: 0 additions & 1 deletion typings/gutenberg-env/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
interface Environment {
NODE_ENV: unknown;
COMPONENT_SYSTEM_PHASE: number | undefined;
FORCE_REDUCED_MOTION: boolean | undefined;
}
interface Process {
Expand Down
7 changes: 0 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,6 @@ module.exports = {
10
) || 1
),
// Inject the `COMPONENT_SYSTEM_PHASE` global, used for controlling Component System roll-out.
'process.env.COMPONENT_SYSTEM_PHASE': JSON.stringify(
parseInt(
process.env.npm_package_config_COMPONENT_SYSTEM_PHASE,
10
) || 0
),
'process.env.FORCE_REDUCED_MOTION': JSON.stringify(
process.env.FORCE_REDUCED_MOTION
),
Expand Down

0 comments on commit 2505bb1

Please sign in to comment.