Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Components: move ContextSystemProvider out of /ui (#54847)
* Components: move ContextSystemProvider out of ui folder

* Update imports

* Remove context folder from ui

* Update references in docs/comments

* Fix path to older commit

Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>

* Update changelog

---------

Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
  • Loading branch information
2 people authored and mikachan committed Dec 23, 2023
commit 82fc70d2f09f82067e67b32260ae92491ddf6266
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

- `Tooltip`, `Shortcut`: Remove unused `ui/` components from the codebase ([#54573](https://github.com/WordPress/gutenberg/pull/54573))
- Update `uuid` package to 9.0.1 ([#54725](https://github.com/WordPress/gutenberg/pull/54725)).
- `ContextSystemProvider`: Move out of `ui/` ([#54847](https://github.com/WordPress/gutenberg/pull/54847)).

## 25.8.0 (2023-09-20)

Expand Down
8 changes: 4 additions & 4 deletions packages/components/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ An example of how this is used can be found in the [`Card` component family](/pa
//=========================================================================
// Simplified snippet from `packages/components/src/card/card/hook.ts`
//=========================================================================
import { useContextSystem } from '../../ui/context';
import { useContextSystem } from '../../context';

export function useCard( props ) {
// Read any derived registered prop from the Context System in the `Card` namespace
Expand All @@ -342,7 +342,7 @@ export function useCard( props ) {
//=========================================================================
// Simplified snippet from `packages/components/src/card/card/component.ts`
//=========================================================================
import { contextConnect, ContextSystemProvider } from '../../ui/context';
import { contextConnect, ContextSystemProvider } from '../../context';

function Card( props, forwardedRef ) {
const {
Expand Down Expand Up @@ -379,7 +379,7 @@ export default ConnectedCard;
//=========================================================================
// Simplified snippet from `packages/components/src/card/card-body/hook.ts`
//=========================================================================
import { useContextSystem } from '../../ui/context';
import { useContextSystem } from '../../context';

export function useCardBody( props ) {
// Read any derived registered prop from the Context System in the `CardBody` namespace.
Expand Down Expand Up @@ -581,7 +581,7 @@ Given a component folder (e.g. `packages/components/src/unit-control`):
6. If the component forwards its `...restProps` to an underlying element/component, you should use the `WordPressComponentProps` type for the component's props:

```tsx
import type { WordPressComponentProps } from '../ui/context';
import type { WordPressComponentProps } from '../context';
import type { ComponentOwnProps } from './types';

function UnconnectedMyComponent(
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/alignment-matrix-control/cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
Point,
} from './styles/alignment-matrix-control-styles';
import type { AlignmentMatrixControlCellProps } from './types';
import type { WordPressComponentProps } from '../ui/context';
import type { WordPressComponentProps } from '../context';

export default function Cell( {
isActive = false,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/alignment-matrix-control/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Point,
} from './styles/alignment-matrix-control-icon-styles';
import type { AlignmentMatrixControlIconProps } from './types';
import type { WordPressComponentProps } from '../ui/context';
import type { WordPressComponentProps } from '../context';

const BASE_SIZE = 24;

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/alignment-matrix-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Composite, CompositeGroup, useCompositeState } from '../composite';
import { Root, Row } from './styles/alignment-matrix-control-styles';
import AlignmentMatrixControlIcon from './icon';
import { GRID, getItemId } from './utils';
import type { WordPressComponentProps } from '../ui/context';
import type { WordPressComponentProps } from '../context';
import type {
AlignmentMatrixControlProps,
AlignmentMatrixControlValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
CircleIndicator,
} from './styles/angle-picker-control-styles';

import type { WordPressComponentProps } from '../ui/context';
import type { WordPressComponentProps } from '../context';
import type { AngleCircleProps } from './types';

type UseDraggingArgumentType = Parameters< typeof useDragging >[ 0 ];
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/angle-picker-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import NumberControl from '../number-control';
import AngleCircle from './angle-circle';
import { Root, UnitText } from './styles/angle-picker-control-styles';

import type { WordPressComponentProps } from '../ui/context';
import type { WordPressComponentProps } from '../context';
import type { AnglePickerControlProps } from './types';

function UnforwardedAnglePickerControl(
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/base-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
StyledHelp,
StyledVisualLabel,
} from './styles/base-control-styles';
import type { WordPressComponentProps } from '../ui/context';
import type { WordPressComponentProps } from '../context';

export { useBaseControlProps } from './hooks';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { __ } from '@wordpress/i18n';
import Button from '../../button';
import Tooltip from '../../tooltip';
import { View } from '../../view';
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { useBorderBoxControlLinkedButton } from './hook';

import type { LinkedButtonProps } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useMemo } from '@wordpress/element';
* Internal dependencies
*/
import * as styles from '../styles';
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import { useCx } from '../../utils/hooks/use-cx';

import type { LinkedButtonProps } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { useMergeRefs } from '@wordpress/compose';
import BorderBoxControlVisualizer from '../border-box-control-visualizer';
import { BorderControl } from '../../border-control';
import { Grid } from '../../grid';
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { useBorderBoxControlSplitControls } from './hook';

import type { BorderControlProps } from '../../border-control/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useMemo } from '@wordpress/element';
* Internal dependencies
*/
import * as styles from '../styles';
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import { useCx } from '../../utils/';

import type { SplitControlsProps } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import { View } from '../../view';
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { useBorderBoxControlVisualizer } from './hook';

import type { VisualizerProps } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useMemo } from '@wordpress/element';
* Internal dependencies
*/
import * as styles from '../styles';
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import { useCx } from '../../utils';

import type { VisualizerProps } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { BorderControl } from '../../border-control';
import { StyledLabel } from '../../base-control/styles/base-control-styles';
import { View } from '../../view';
import { VisuallyHidden } from '../../visually-hidden';
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { useBorderBoxControl } from './hook';

import type { BorderBoxControlProps } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
isCompleteBorder,
isEmptyBorder,
} from '../utils';
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import { useCx } from '../../utils/hooks/use-cx';

import type { Border } from '../../border-control/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import ColorPalette from '../../color-palette';
import Dropdown from '../../dropdown';
import { HStack } from '../../h-stack';
import { VStack } from '../../v-stack';
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { useBorderControlDropdown } from './hook';
import { StyledLabel } from '../../base-control/styles/base-control-styles';
import DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { useMemo } from '@wordpress/element';
*/
import * as styles from '../styles';
import { parseQuantityAndUnitFromRawValue } from '../../unit-control/utils';
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import { useCx } from '../../utils/hooks/use-cx';

import type { DropdownProps } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { StyledLabel } from '../../base-control/styles/base-control-styles';
import { View } from '../../view';
import { Flex } from '../../flex';
import { VisuallyHidden } from '../../visually-hidden';
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { useBorderControlStylePicker } from './hook';

import type { LabelProps, StylePickerProps } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useMemo } from '@wordpress/element';
* Internal dependencies
*/
import * as styles from '../styles';
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import { useCx } from '../../utils/hooks/use-cx';

import type { StylePickerProps } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { HStack } from '../../h-stack';
import { StyledLabel } from '../../base-control/styles/base-control-styles';
import { View } from '../../view';
import { VisuallyHidden } from '../../visually-hidden';
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { useBorderControl } from './hook';

import type { BorderControlProps, LabelProps } from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/border-control/border-control/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { useCallback, useMemo, useState } from '@wordpress/element';
*/
import * as styles from '../styles';
import { parseQuantityAndUnitFromRawValue } from '../../unit-control/utils';
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import { useCx } from '../../utils/hooks/use-cx';

import type { Border, BorderControlProps } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/box-control/icon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../ui/context';
import type { WordPressComponentProps } from '../context';
import {
Root,
Viewbox,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/button-group/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { forwardRef } from '@wordpress/element';
* Internal dependencies
*/
import type { ButtonGroupProps } from './types';
import type { WordPressComponentProps } from '../ui/context';
import type { WordPressComponentProps } from '../context';

function UnforwardedButtonGroup(
props: WordPressComponentProps< ButtonGroupProps, 'div', false >,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { ReactNode } from 'react';
*/
import type { Props as IconProps } from '../icon';
import type { PopoverProps } from '../popover/types';
import type { WordPressComponentProps } from '../ui/context/wordpress-component';
import type { WordPressComponentProps } from '../context/wordpress-component';

export type ButtonProps =
| WordPressComponentProps< ButtonAsButtonProps, 'button', false >
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card-body/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { ForwardedRef } from 'react';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { Scrollable } from '../../scrollable';
import { View } from '../../view';
import { useCardBody } from './hook';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card-body/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useMemo } from '@wordpress/element';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import * as styles from '../styles';
import { useCx } from '../../utils/hooks/use-cx';
import type { BodyProps } from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card-divider/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { ForwardedRef } from 'react';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import type { DividerProps } from '../../divider';
import { Divider } from '../../divider';
import { useCardDivider } from './hook';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card-divider/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useMemo } from '@wordpress/element';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import * as styles from '../styles';
import { useCx } from '../../utils/hooks/use-cx';
import type { DividerProps } from '../../divider';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card-footer/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { ForwardedRef } from 'react';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { Flex } from '../../flex';
import { useCardFooter } from './hook';
import type { FooterProps } from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card-footer/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useMemo } from '@wordpress/element';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import * as styles from '../styles';
import { useCx } from '../../utils/hooks/use-cx';
import type { FooterProps } from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card-header/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { ForwardedRef } from 'react';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { Flex } from '../../flex';
import { useCardHeader } from './hook';
import type { HeaderProps } from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card-header/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useMemo } from '@wordpress/element';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import * as styles from '../styles';
import { useCx } from '../../utils/hooks/use-cx';
import type { HeaderProps } from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card-media/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { ForwardedRef } from 'react';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { View } from '../../view';
import { useCardMedia } from './hook';
import type { MediaProps } from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card-media/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useMemo } from '@wordpress/element';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { useContextSystem } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { useContextSystem } from '../../context';
import * as styles from '../styles';
import { useCx } from '../../utils/hooks/use-cx';
import type { MediaProps } from '../types';
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/card/card/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { useMemo } from '@wordpress/element';
/**
* Internal dependencies
*/
import type { WordPressComponentProps } from '../../ui/context';
import { contextConnect, ContextSystemProvider } from '../../ui/context';
import type { WordPressComponentProps } from '../../context';
import { contextConnect, ContextSystemProvider } from '../../context';
import { Elevation } from '../../elevation';
import { View } from '../../view';
import * as styles from '../styles';
Expand Down
Loading