From c8bb7985d04694beab4382ee3136b50db383d40b Mon Sep 17 00:00:00 2001 From: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com> Date: Thu, 6 May 2021 05:59:29 -0700 Subject: [PATCH 1/5] components: Promote View --- docs/manifest.json | 6 ++++++ packages/components/src/flex/flex/component.js | 2 +- packages/components/src/flex/stories/index.js | 2 +- packages/components/src/flex/test/index.js | 2 +- packages/components/src/grid/stories/index.js | 2 +- packages/components/src/grid/test/grid.js | 2 +- packages/components/src/h-stack/stories/index.js | 2 +- packages/components/src/h-stack/test/index.js | 2 +- packages/components/src/index.js | 1 + .../components/src/ui/__storybook-utils/example-grid.js | 2 +- packages/components/src/ui/__storybook-utils/page.js | 2 +- packages/components/src/ui/card/body.js | 2 +- packages/components/src/ui/card/component.js | 2 +- packages/components/src/ui/card/inner-body.js | 2 +- packages/components/src/ui/elevation/stories/index.js | 2 +- packages/components/src/ui/form-group/form-group.js | 2 +- packages/components/src/ui/index.js | 1 - packages/components/src/ui/popover/content.js | 2 +- packages/components/src/ui/scrollable/stories/index.js | 2 +- packages/components/src/ui/tooltip/content.js | 2 +- packages/components/src/ui/utils/create-component.tsx | 2 +- packages/components/src/v-stack/test/index.js | 2 +- packages/components/src/{ui => }/view/README.md | 9 +++++++-- packages/components/src/{ui => }/view/component.js | 2 +- packages/components/src/{ui => }/view/index.js | 0 .../src/{ui => }/view/test/__snapshots__/index.js.snap | 0 packages/components/src/{ui => }/view/test/index.js | 0 packages/components/tsconfig.json | 3 ++- 28 files changed, 36 insertions(+), 24 deletions(-) rename packages/components/src/{ui => }/view/README.md (79%) rename packages/components/src/{ui => }/view/component.js (88%) rename packages/components/src/{ui => }/view/index.js (100%) rename packages/components/src/{ui => }/view/test/__snapshots__/index.js.snap (100%) rename packages/components/src/{ui => }/view/test/index.js (100%) diff --git a/docs/manifest.json b/docs/manifest.json index a5199ab8eaf631..cf405bbc8e4715 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1187,6 +1187,12 @@ "markdown_source": "../packages/components/src/v-stack/README.md", "parent": "components" }, + { + "title": "View", + "slug": "view", + "markdown_source": "../packages/components/src/view/README.md", + "parent": "components" + }, { "title": "VisuallyHidden", "slug": "visually-hidden", diff --git a/packages/components/src/flex/flex/component.js b/packages/components/src/flex/flex/component.js index 310b85c53369be..758b4fc98e9f1f 100644 --- a/packages/components/src/flex/flex/component.js +++ b/packages/components/src/flex/flex/component.js @@ -4,7 +4,7 @@ import { contextConnect } from '../../ui/context'; import { useFlex } from './hook'; import { FlexContext } from './../context'; -import { View } from '../../ui/view'; +import { View } from '../../view'; /** * @param {import('../../ui/context').ViewOwnProps} props diff --git a/packages/components/src/flex/stories/index.js b/packages/components/src/flex/stories/index.js index c5860db4c3ee3c..14e739ff1f5b49 100644 --- a/packages/components/src/flex/stories/index.js +++ b/packages/components/src/flex/stories/index.js @@ -2,7 +2,7 @@ * Internal dependencies */ import { Flex, FlexItem } from '../'; -import { View } from '../../ui/view'; +import { View } from '../../view'; export default { component: Flex, diff --git a/packages/components/src/flex/test/index.js b/packages/components/src/flex/test/index.js index a4ce8fb8ef141a..42facc3c12ad9f 100644 --- a/packages/components/src/flex/test/index.js +++ b/packages/components/src/flex/test/index.js @@ -6,7 +6,7 @@ import { render } from '@testing-library/react'; /** * Internal dependencies */ -import { View } from '../../ui/view'; +import { View } from '../../view'; import { Flex, FlexBlock, FlexItem } from '../'; describe( 'props', () => { diff --git a/packages/components/src/grid/stories/index.js b/packages/components/src/grid/stories/index.js index 58b0b45f153680..0d7b5c29b0563f 100644 --- a/packages/components/src/grid/stories/index.js +++ b/packages/components/src/grid/stories/index.js @@ -6,7 +6,7 @@ import { number } from '@storybook/addon-knobs'; /** * Internal dependencies */ -import { View } from '../../ui/view'; +import { View } from '../../view'; import { Grid } from '..'; export default { diff --git a/packages/components/src/grid/test/grid.js b/packages/components/src/grid/test/grid.js index 887a9aac4a3cf1..c7b8a6d40cc44c 100644 --- a/packages/components/src/grid/test/grid.js +++ b/packages/components/src/grid/test/grid.js @@ -6,7 +6,7 @@ import { render } from '@testing-library/react'; /** * Internal dependencies */ -import { View } from '../../ui/view'; +import { View } from '../../view'; import { Grid } from '..'; import CONFIG from '../../utils/config-values'; diff --git a/packages/components/src/h-stack/stories/index.js b/packages/components/src/h-stack/stories/index.js index f452b76e872954..2947fe857275cf 100644 --- a/packages/components/src/h-stack/stories/index.js +++ b/packages/components/src/h-stack/stories/index.js @@ -1,7 +1,7 @@ /** * Internal dependencies */ -import { View } from '../../ui/view'; +import { View } from '../../view'; import { HStack } from '..'; export default { diff --git a/packages/components/src/h-stack/test/index.js b/packages/components/src/h-stack/test/index.js index f11e9f8ea0117c..56190f81db4cdd 100644 --- a/packages/components/src/h-stack/test/index.js +++ b/packages/components/src/h-stack/test/index.js @@ -6,7 +6,7 @@ import { render } from '@testing-library/react'; /** * Internal dependencies */ -import { View } from '../../ui/view'; +import { View } from '../../view'; import { HStack } from '..'; describe( 'props', () => { diff --git a/packages/components/src/index.js b/packages/components/src/index.js index a6485fe0e95593..a9772b0bbf69d0 100644 --- a/packages/components/src/index.js +++ b/packages/components/src/index.js @@ -128,6 +128,7 @@ export { export { default as TreeSelect } from './tree-select'; export { Truncate as __experimentalTruncate } from './truncate'; export { default as __experimentalUnitControl } from './unit-control'; +export { View as __experimentalView } from './view'; export { VisuallyHidden } from './visually-hidden'; export { VStack as __experimentalVStack } from './v-stack'; export { default as IsolatedEventContainer } from './isolated-event-container'; diff --git a/packages/components/src/ui/__storybook-utils/example-grid.js b/packages/components/src/ui/__storybook-utils/example-grid.js index 947e19c71093cd..c0693b3268b482 100644 --- a/packages/components/src/ui/__storybook-utils/example-grid.js +++ b/packages/components/src/ui/__storybook-utils/example-grid.js @@ -4,7 +4,7 @@ import { Grid } from '../../grid'; import { Surface } from '../surface'; import { Text } from '../../text'; -import { View } from '../view'; +import { View } from '../../view'; import { VStack } from '../../v-stack'; const Container = ( { children } ) => ( diff --git a/packages/components/src/ui/__storybook-utils/page.js b/packages/components/src/ui/__storybook-utils/page.js index 232c9502af9f2f..92950201624662 100644 --- a/packages/components/src/ui/__storybook-utils/page.js +++ b/packages/components/src/ui/__storybook-utils/page.js @@ -2,7 +2,7 @@ * Internal dependencies */ import { VStack } from '../../v-stack'; -import { View } from '../view'; +import { View } from '../../view'; import { Heading } from '../../heading'; import { Divider } from '../divider'; diff --git a/packages/components/src/ui/card/body.js b/packages/components/src/ui/card/body.js index 098b29170ca66c..b0514c654f21fe 100644 --- a/packages/components/src/ui/card/body.js +++ b/packages/components/src/ui/card/body.js @@ -13,7 +13,7 @@ import { useMemo } from '@wordpress/element'; */ import { contextConnect, useContextSystem } from '../context'; import { Scrollable } from '../scrollable'; -import { View } from '../view'; +import { View } from '../../view'; import * as styles from './styles'; /** diff --git a/packages/components/src/ui/card/component.js b/packages/components/src/ui/card/component.js index 4fc8a50770a493..e6edf7f0836442 100644 --- a/packages/components/src/ui/card/component.js +++ b/packages/components/src/ui/card/component.js @@ -13,7 +13,7 @@ import { useMemo } from '@wordpress/element'; */ import { contextConnect } from '../context'; import { Elevation } from '../elevation'; -import { View } from '../view'; +import { View } from '../../view'; import * as styles from './styles'; import { useCard } from './hook'; import CONFIG from '../../utils/config-values'; diff --git a/packages/components/src/ui/card/inner-body.js b/packages/components/src/ui/card/inner-body.js index 43204482c456ee..59efaf6e92567a 100644 --- a/packages/components/src/ui/card/inner-body.js +++ b/packages/components/src/ui/card/inner-body.js @@ -6,7 +6,7 @@ import { cx } from 'emotion'; /** * Internal dependencies */ -import { View } from '../view'; +import { View } from '../../view'; import { contextConnect, useContextSystem } from '../context'; import * as styles from './styles'; diff --git a/packages/components/src/ui/elevation/stories/index.js b/packages/components/src/ui/elevation/stories/index.js index 5771474827689b..52b263504bb052 100644 --- a/packages/components/src/ui/elevation/stories/index.js +++ b/packages/components/src/ui/elevation/stories/index.js @@ -8,7 +8,7 @@ import { number } from '@storybook/addon-knobs'; */ import { Elevation } from '../index'; import { Grid } from '../../../grid'; -import { View } from '../../view'; +import { View } from '../../../view'; import { HStack } from '../../../h-stack'; import { Divider } from '../../divider'; import { diff --git a/packages/components/src/ui/form-group/form-group.js b/packages/components/src/ui/form-group/form-group.js index 910be83b94f10c..0c05df1bb81110 100644 --- a/packages/components/src/ui/form-group/form-group.js +++ b/packages/components/src/ui/form-group/form-group.js @@ -3,7 +3,7 @@ */ import { contextConnect } from '../context'; import { Grid } from '../../grid'; -import { View } from '../view'; +import { View } from '../../view'; import FormGroupContent from './form-group-content'; import { useFormGroup } from './use-form-group'; diff --git a/packages/components/src/ui/index.js b/packages/components/src/ui/index.js index 8d41ecbba53c51..14577d74d9e2db 100644 --- a/packages/components/src/ui/index.js +++ b/packages/components/src/ui/index.js @@ -6,4 +6,3 @@ export * from './elevation'; export * from './form-group'; export * from './shortcut'; export * from './spinner'; -export * from './view'; diff --git a/packages/components/src/ui/popover/content.js b/packages/components/src/ui/popover/content.js index 06713ecc01bb06..0c161e248b9852 100644 --- a/packages/components/src/ui/popover/content.js +++ b/packages/components/src/ui/popover/content.js @@ -9,7 +9,7 @@ import { Popover as ReakitPopover } from 'reakit'; * Internal dependencies */ import { Card } from '../card'; -import { View } from '../view'; +import { View } from '../../view'; import { usePopoverContext } from './context'; import * as styles from './styles'; import { contextConnect, useContextSystem } from '../context'; diff --git a/packages/components/src/ui/scrollable/stories/index.js b/packages/components/src/ui/scrollable/stories/index.js index 714dd728ca92a4..4c8717d2a9d423 100644 --- a/packages/components/src/ui/scrollable/stories/index.js +++ b/packages/components/src/ui/scrollable/stories/index.js @@ -1,7 +1,7 @@ /** * Internal dependencies */ -import { View } from '../../index'; +import { View } from '../../../index'; import { Scrollable } from '../index'; export default { diff --git a/packages/components/src/ui/tooltip/content.js b/packages/components/src/ui/tooltip/content.js index 26dd1ac6bef45b..370dee96a7644f 100644 --- a/packages/components/src/ui/tooltip/content.js +++ b/packages/components/src/ui/tooltip/content.js @@ -9,7 +9,7 @@ import { Tooltip as ReakitTooltip } from 'reakit'; * Internal dependencies */ import { contextConnect, useContextSystem } from '../context'; -import { View } from '../view'; +import { View } from '../../view'; import { useTooltipContext } from './context'; import * as styles from './styles'; diff --git a/packages/components/src/ui/utils/create-component.tsx b/packages/components/src/ui/utils/create-component.tsx index 960a0572b9f47c..45b77424489423 100644 --- a/packages/components/src/ui/utils/create-component.tsx +++ b/packages/components/src/ui/utils/create-component.tsx @@ -16,7 +16,7 @@ import type { ElementTypeFromViewOwnProps, ViewOwnProps, } from '../context'; -import { View } from '../view'; +import { View } from '../../view'; interface Options< A extends As, P extends ViewOwnProps< {}, A > > { as: A; diff --git a/packages/components/src/v-stack/test/index.js b/packages/components/src/v-stack/test/index.js index deb49e4e2d7bdb..29cd5c5be51bb9 100644 --- a/packages/components/src/v-stack/test/index.js +++ b/packages/components/src/v-stack/test/index.js @@ -6,7 +6,7 @@ import { render } from '@testing-library/react'; /** * Internal dependencies */ -import { View } from '../../ui/view'; +import { View } from '../../view'; import { VStack } from '..'; describe( 'props', () => { diff --git a/packages/components/src/ui/view/README.md b/packages/components/src/view/README.md similarity index 79% rename from packages/components/src/ui/view/README.md rename to packages/components/src/view/README.md index 130578920bd75e..f991f2d95c7334 100644 --- a/packages/components/src/ui/view/README.md +++ b/packages/components/src/view/README.md @@ -1,4 +1,6 @@ -# View (Experimental) +# View + +> **Experimental!** `View` is a core component that renders everything in the library. It is the principle component in the entire library. @@ -7,7 +9,10 @@ ## Usage ```jsx -import { Text, View } from '@wordpress/components/ui'; +import { + __experimentalText as Text, + __experimentalView as View +} from '@wordpress/components'; function Example() { return ( diff --git a/packages/components/src/ui/view/component.js b/packages/components/src/view/component.js similarity index 88% rename from packages/components/src/ui/view/component.js rename to packages/components/src/view/component.js index 49b001ef89893e..cd45ebf4d9fcbb 100644 --- a/packages/components/src/ui/view/component.js +++ b/packages/components/src/view/component.js @@ -9,7 +9,7 @@ import styled from '@emotion/styled'; * * @example * ```jsx - * import { View } from `@wordpress/components/ui`; + * import { View } from `@wordpress/components`; * * function Example() { * return ( diff --git a/packages/components/src/ui/view/index.js b/packages/components/src/view/index.js similarity index 100% rename from packages/components/src/ui/view/index.js rename to packages/components/src/view/index.js diff --git a/packages/components/src/ui/view/test/__snapshots__/index.js.snap b/packages/components/src/view/test/__snapshots__/index.js.snap similarity index 100% rename from packages/components/src/ui/view/test/__snapshots__/index.js.snap rename to packages/components/src/view/test/__snapshots__/index.js.snap diff --git a/packages/components/src/ui/view/test/index.js b/packages/components/src/view/test/index.js similarity index 100% rename from packages/components/src/ui/view/test/index.js rename to packages/components/src/view/test/index.js diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json index c93cc82efe1bb6..ad80a95934e818 100644 --- a/packages/components/tsconfig.json +++ b/packages/components/tsconfig.json @@ -35,7 +35,8 @@ "src/grid/**/*", "src/__next/**/*", "src/h-stack/**/*", - "src/v-stack/**/*" + "src/v-stack/**/*", + "src/view/**/*" ], "exclude": [ "src/**/*.android.js", From 54e9162f0fbdb349eb156ef189a91a9a8732df6b Mon Sep 17 00:00:00 2001 From: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com> Date: Thu, 6 May 2021 06:27:02 -0700 Subject: [PATCH 2/5] Update snapshots for moved view --- .../test/__snapshots__/index.js.snap | 2 +- .../test/__snapshots__/index.js.snap | 20 ++++++++-------- .../src/flex/test/__snapshots__/index.js.snap | 6 ++--- .../ui/card/test/__snapshots__/index.js.snap | 16 ++++++------- .../popover/test/__snapshots__/index.js.snap | 12 +++++----- .../surface/test/__snapshots__/index.js.snap | 24 +++++++++---------- 6 files changed, 40 insertions(+), 40 deletions(-) diff --git a/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap b/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap index 25950cca507de7..43a6e4b0476981 100644 --- a/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap +++ b/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Basic rendering should render 1`] = `""`; +exports[`Basic rendering should render 1`] = `""`; diff --git a/packages/components/src/color-picker/test/__snapshots__/index.js.snap b/packages/components/src/color-picker/test/__snapshots__/index.js.snap index 0f3cc97a39aca3..9076c0d0462e89 100644 --- a/packages/components/src/color-picker/test/__snapshots__/index.js.snap +++ b/packages/components/src/color-picker/test/__snapshots__/index.js.snap @@ -39,7 +39,7 @@ Snapshot Diff: type="button" />
@@ -86,7 +86,7 @@ Snapshot Diff: tabIndex="0" />

@@ -161,7 +161,7 @@ Snapshot Diff: type="button" />

@@ -208,7 +208,7 @@ Snapshot Diff: tabIndex="0" />

@@ -283,7 +283,7 @@ Snapshot Diff: type="button" />

@@ -330,7 +330,7 @@ Snapshot Diff: tabIndex="0" />

@@ -405,7 +405,7 @@ Snapshot Diff: type="button" />

@@ -452,7 +452,7 @@ Snapshot Diff: tabIndex="0" />

@@ -511,7 +511,7 @@ Snapshot Diff: type="button" />

@@ -537,7 +537,7 @@ Snapshot Diff: tabIndex="0" />

diff --git a/packages/components/src/flex/test/__snapshots__/index.js.snap b/packages/components/src/flex/test/__snapshots__/index.js.snap index 6d30b0cc90e2c6..7a5389de420edc 100644 --- a/packages/components/src/flex/test/__snapshots__/index.js.snap +++ b/packages/components/src/flex/test/__snapshots__/index.js.snap @@ -6,16 +6,16 @@ Snapshot Diff: + Second value @@ -7,14 +7,10 @@ - class="components-flex-item css-1636tkh-Item css-1mm2cvy-View egi4jkx0" + class="components-flex-item css-1636tkh-Item css-1mm2cvy-View em57xhy0" data-wp-c16t="true" data-wp-component="FlexItem" />

-
-
diff --git a/packages/components/src/ui/card/test/__snapshots__/index.js.snap b/packages/components/src/ui/card/test/__snapshots__/index.js.snap index 294f65732019a9..2d53af3921455e 100644 --- a/packages/components/src/ui/card/test/__snapshots__/index.js.snap +++ b/packages/components/src/ui/card/test/__snapshots__/index.js.snap @@ -11,8 +11,8 @@ Snapshot Diff: title="WordPress.org" />