Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
64c2947
Move components to own files
brookewp Dec 12, 2023
4250494
Add legacy adapter
brookewp Jan 18, 2024
d3da53a
Add legacy tests
brookewp Dec 12, 2023
c3d6a80
Update naming and remove unnecessary tests
brookewp Dec 12, 2023
4c9f32f
Add legacy props to adapter
brookewp Jan 16, 2024
7d9bc28
Create new component to forward store
brookewp Jan 17, 2024
d2b30d6
Create legacy component
brookewp Jan 17, 2024
905b9fe
Remove useDeprecatedProps hook and update adapter
brookewp Jan 17, 2024
940cdaf
Separate stories
brookewp Jan 17, 2024
82b33d1
Update stories and types
brookewp Jan 18, 2024
f1b5320
Convert function into variable instead
brookewp Jan 18, 2024
c3f4a23
Update legacy changeObject to match existing properties
brookewp Jan 18, 2024
a98e38c
Add tests for onChange function
brookewp Jan 19, 2024
09e9c47
add rest of legacy props
brookewp Jan 20, 2024
80158a6
Update sizing
brookewp Jan 20, 2024
2ccdc91
Memoize selected render value
brookewp Jan 23, 2024
46283b5
Remove deprecated prop to fix test failures
brookewp Jan 23, 2024
2526b8e
Add `unmountOnHide` and require `defaultValue` as a result
brookewp Jan 23, 2024
a8b4e8a
Update styling for experimental hint
brookewp Jan 24, 2024
bc1cbe7
Connect CustomSelectButton to context system for legacy sizing
brookewp Jan 25, 2024
002bd2e
Update sizing logic and types
brookewp Jan 26, 2024
85993fd
Fix styling to match legacy including hints
brookewp Jan 26, 2024
1524180
Clean up props
brookewp Jan 26, 2024
eb4e946
Omit ‘onChange’ from WordPressComponentProps to prevent conflict
brookewp Jan 29, 2024
fdabba7
Update checkmark icon
brookewp Jan 31, 2024
2bc69ef
Update select arrow
brookewp Jan 31, 2024
63c3dd4
Update types
brookewp Jan 31, 2024
1280774
Add static typing test
brookewp Jan 31, 2024
d25764b
Update story for better manual testing
brookewp Jan 31, 2024
18e15e9
Control mount state for legacy keyboard behaviour
brookewp Jan 31, 2024
e0caf2d
Remove export that is no longer needed
brookewp Jan 31, 2024
cafbdf8
Update legacy onChange type
brookewp Jan 31, 2024
7b86a97
Update tests
brookewp Feb 1, 2024
bc7027e
Update naming
brookewp Feb 1, 2024
4f9f6f9
Try mounting on first render to avoid required defaultValue
brookewp Feb 1, 2024
71b2c1a
Add WordPressComponentProps to default export
brookewp Feb 1, 2024
be17780
Update types
brookewp Feb 2, 2024
287c354
Replace RTL/userEvent with ariakit/test
brookewp Feb 2, 2024
7eb2134
Remove unmountOnHide and related logic for first iteration
brookewp Feb 5, 2024
c794d06
Update docs
brookewp Feb 6, 2024
5c58f78
Update naming
brookewp Feb 6, 2024
c73ce18
Merge new tests and update to ariakit/test
brookewp Feb 6, 2024
795df54
Fix typo in readme
mirka Feb 7, 2024
4171c67
Legacy: Clean up stories
mirka Feb 9, 2024
8d70b4f
Default: Clean up stories
mirka Feb 9, 2024
cb88b8b
Add todo comment about BaseControl
mirka Feb 9, 2024
d2dfe8b
Fix styles
mirka Feb 9, 2024
ddc8e6b
Rename styled components for consistency
mirka Feb 9, 2024
faa6d7b
Fix typo in readme
mirka Feb 9, 2024
797e139
Merge branch 'trunk' into add/legacy-adapter-customselectcontrol
mirka Feb 9, 2024
f8446f8
Rename for clarity
mirka Feb 9, 2024
3a2be41
Update changelog
mirka Feb 9, 2024
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
Remove useDeprecatedProps hook and update adapter
  • Loading branch information
brookewp committed Feb 6, 2024
commit 905b9feda7c50dd8cf46f872c81d3a8521097095
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Internal dependencies
*/
export { LegacyAdapter as CustomSelect } from './legacy-adapter';
export { DefaultExport as CustomSelect } from './legacy-adapter';
export { default as CustomSelectItem } from './custom-select-item';
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
/**
* Internal dependencies
*/
import CustomSelect from './custom-select';
import type { LegacyCustomSelectProps } from './types';
import { useDeprecatedProps } from './use-deprecated-props';
import _LegacyCustomSelect from './legacy-component';
import _NewCustomSelect from './default-component';
import type { CustomSelectProps, LegacyCustomSelectProps } from './types';

export function LegacyAdapter( props: LegacyCustomSelectProps ) {
function isLegacy( props: any ): props is LegacyCustomSelectProps {
return (
<CustomSelect
{ ...useDeprecatedProps( props ) }
hideLabelFromVision={ props.hideLabelFromVision }
/>
typeof props.options !== 'undefined' ||
props.__experimentalShowSelectedHint !== undefined
);
}

export function DefaultExport(
props: LegacyCustomSelectProps | CustomSelectProps
) {
if ( isLegacy( props ) ) {
return <_LegacyCustomSelect { ...props } />;
}

return <_NewCustomSelect { ...props } />;
}
4 changes: 2 additions & 2 deletions packages/components/src/custom-select-control-v2/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import type * as Ariakit from '@ariakit/react';
/**
* Internal dependencies
*/
import type { useDeprecatedProps } from './use-deprecated-props';

export type LegacyAdapterProps = Parameters< typeof useDeprecatedProps >[ 0 ];
export type CustomSelectStore = {
/**
* The store object returned by Ariakit's `useSelectStore` hook.
Expand Down Expand Up @@ -75,6 +73,8 @@ type Option = {
*/
type OnChangeObject = {
selectedItem: Option;
highlightedIndex?: number;
isOpen?: boolean;
};

export type LegacyCustomSelectProps = {
Expand Down

This file was deleted.