-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CPT-1478] Add enableResetSearch prop to Select and QB
- Loading branch information
1 parent
d3176e0
commit 761a51d
Showing
13 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@toptal/picasso-query-builder': minor | ||
'@toptal/picasso': minor | ||
--- | ||
|
||
- add `enableResetSearch` prop to `Select` component and expose it for `QueryBuilder` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/picasso/src/SelectBase/hooks/use-select-props/use-search-reset-handler/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './use-search-reset-handler' |
16 changes: 16 additions & 0 deletions
16
packages/picasso/src/SelectBase/hooks/use-select-props/use-search-reset-handler/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { renderHook } from '@testing-library/react' | ||
|
||
import { getUseSelectPropsMock } from '../mocks' | ||
import useSearchResetHandler from './use-search-reset-handler' | ||
|
||
describe('useSearchResetHandler', () => { | ||
it('handles reset', () => { | ||
const props = getUseSelectPropsMock() | ||
const { result } = renderHook(() => useSearchResetHandler(props)) | ||
|
||
result.current() | ||
|
||
expect(props.selectState.setFilterOptionsValue).toHaveBeenCalledTimes(1) | ||
expect(props.selectState.setFilterOptionsValue).toHaveBeenCalledWith('') | ||
}) | ||
}) |
10 changes: 10 additions & 0 deletions
10
...rc/SelectBase/hooks/use-select-props/use-search-reset-handler/use-search-reset-handler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { ValueType, UseSelectProps } from '../../../types' | ||
|
||
const useSearchResetHandler = | ||
<T extends ValueType, M extends boolean = false>({ | ||
selectState: { setFilterOptionsValue }, | ||
}: UseSelectProps<T, M>) => | ||
() => | ||
setFilterOptionsValue('') | ||
|
||
export default useSearchResetHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters