Skip to content

Commit

Permalink
Components: Unite inline Ariakit imports (WordPress#67818)
Browse files Browse the repository at this point in the history
Co-authored-by: tyxla <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
3 people authored and yogeshbhutkar committed Dec 18, 2024
1 parent f702d0f commit 5c85a73
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import * as Ariakit from '@ariakit/react';
import { useStoreState } from '@ariakit/react';

/**
* WordPress dependencies
Expand Down Expand Up @@ -63,7 +62,7 @@ const CustomSelectButton = ( {
CustomSelectStore,
'onChange'
> ) => {
const { value: currentValue } = useStoreState( store );
const { value: currentValue } = Ariakit.useStoreState( store );

const computedRenderSelectedValue = useMemo(
() => renderSelectedValue ?? defaultRenderSelectedValue,
Expand Down
3 changes: 1 addition & 2 deletions packages/components/src/menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import * as Ariakit from '@ariakit/react';
import { useStoreState } from '@ariakit/react';

/**
* WordPress dependencies
Expand Down Expand Up @@ -109,7 +108,7 @@ const UnconnectedMenu = (
// Extract the side from the applied placement — useful for animations.
// Using `currentPlacement` instead of `placement` to make sure that we
// use the final computed placement (including "flips" etc).
const appliedPlacementSide = useStoreState(
const appliedPlacementSide = Ariakit.useStoreState(
menuStore,
'currentPlacement'
).split( '-' )[ 0 ];
Expand Down
3 changes: 1 addition & 2 deletions packages/components/src/radio-group/radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { forwardRef, useContext } from '@wordpress/element';
* External dependencies
*/
import * as Ariakit from '@ariakit/react';
import { useStoreState } from '@ariakit/react';

/**
* Internal dependencies
Expand All @@ -28,7 +27,7 @@ function UnforwardedRadio(
) {
const { store, disabled } = useContext( RadioGroupContext );

const selectedValue = useStoreState( store, 'value' );
const selectedValue = Ariakit.useStoreState( store, 'value' );
const isChecked = selectedValue !== undefined && selectedValue === value;

maybeWarnDeprecated36pxSize( {
Expand Down
3 changes: 1 addition & 2 deletions packages/components/src/tab-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import * as Ariakit from '@ariakit/react';
import { useStoreState } from '@ariakit/react';
import clsx from 'clsx';
import type { ForwardedRef } from 'react';

Expand Down Expand Up @@ -125,7 +124,7 @@ const UnforwardedTabPanel = (
} );

const selectedTabName = extractTabName(
useStoreState( tabStore, 'selectedId' )
Ariakit.useStoreState( tabStore, 'selectedId' )
);

const setTabStoreSelectedId = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import type { ForwardedRef } from 'react';
import * as Ariakit from '@ariakit/react';
import { useStoreState } from '@ariakit/react';

/**
* WordPress dependencies
Expand Down Expand Up @@ -70,7 +69,7 @@ function UnforwardedToggleGroupControlAsRadioGroup(
rtl: isRTL(),
} );

const selectedValue = useStoreState( radio, 'value' );
const selectedValue = Ariakit.useStoreState( radio, 'value' );
const setValue = radio.setValue;

// Ensures that the active id is also reset after the value is "reset" by the consumer.
Expand Down
3 changes: 1 addition & 2 deletions packages/components/src/tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import * as Ariakit from '@ariakit/react';
import { useStoreState } from '@ariakit/react';
import clsx from 'clsx';

/**
Expand Down Expand Up @@ -94,7 +93,7 @@ function UnforwardedTooltip(
placement: computedPlacement,
showTimeout: delay,
} );
const mounted = useStoreState( tooltipStore, 'mounted' );
const mounted = Ariakit.useStoreState( tooltipStore, 'mounted' );

if ( isNestedInTooltip ) {
return isOnlyChild ? (
Expand Down

0 comments on commit 5c85a73

Please sign in to comment.