Skip to content

Commit

Permalink
[CPT-1479] Enable select clear button for the qb (#4084)
Browse files Browse the repository at this point in the history
* [CPT-1479] Enable select clear button for the qb

* [CPT-1479] Change multiselect field type
  • Loading branch information
angelinastavniiciuc authored Jan 12, 2024
1 parent 349ec37 commit a1ee7a5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-buckets-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@toptal/picasso-query-builder': minor
---

- add `enableReset` property for `multiselect` filter type
2 changes: 1 addition & 1 deletion packages/picasso-query-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"url": "https://github.com/toptal/picasso/issues"
},
"peerDependencies": {
"@toptal/picasso": ">=38.0.0",
"@toptal/picasso": "^42.0.0",
"react": ">=16.12.0 < 19.0.0",
"react-dom": ">=16.12.0 < 19.0.0",
"typescript": "~4.7.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const MultiSelect = ({
value={values}
status={hasError ? 'error' : undefined}
data-testid={valueEditorTestId}
enableReset={fieldData?.enableReset}
enableResetSearch={fieldData?.enableResetSearch}
/>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ const fields: Field[] = [
label: 'Also plays',
valueEditorType: 'multiselect',
enableResetSearch: true,
enableReset: true,
values: musicalInstruments,
defaultValue: 'More cowbell',
},
Expand Down
8 changes: 3 additions & 5 deletions packages/picasso-query-builder/src/types/query-builder.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { SelectProps } from '@toptal/picasso'
import type { ReactNode } from 'react'
import type {
Field as QueryBuilderField,
Expand Down Expand Up @@ -36,11 +37,8 @@ interface BooleanField
}
interface MultiSelectField
extends Omit<QueryBuilderField, 'inputType' | 'valueEditorType'> {
valueEditorType?: 'multiselect'
/**
* Allow search input reset
*/
enableResetSearch?: boolean
valueEditorType?: 'multiselect' &
Pick<SelectProps, 'enableReset' | 'enableResetSearch'>
}

interface AutoCompleteField
Expand Down

0 comments on commit a1ee7a5

Please sign in to comment.