Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STSMACOM-786 Added inputType prop to <SearchAndSort> component to support both input and textarea search boxes #1407

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 9.1.0 IN PROGRESS

* Added `inputType` prop to `<SearchAndSort>` component to support both input and textarea search boxes. Refs STSMACOM-786.

## [9.0.0](https://github.com/folio-org/stripes-smart-components/tree/v9.0.0) (2023-10-11)
[Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v8.0.0...v9.0.0)

Expand Down
6 changes: 6 additions & 0 deletions lib/SearchAndSort/SearchAndSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class SearchAndSort extends React.Component {
initialFilters: PropTypes.string,
initialResultCount: PropTypes.number.isRequired,
initiallySelectedRecord: PropTypes.string,
inputType: PropTypes.string,
isCountHidden: PropTypes.bool,
location: PropTypes.shape({ // provided by withRouter
pathname: PropTypes.string.isRequired,
Expand Down Expand Up @@ -1218,6 +1219,7 @@ class SearchAndSort extends React.Component {
autofocusSearchField,
searchFieldButtonLabel,
advancedSearchOptions,
inputType,
} = this.props;
const {
locallyChangedSearchTerm,
Expand Down Expand Up @@ -1250,6 +1252,10 @@ class SearchAndSort extends React.Component {
onChangeIndex={this.onChangeIndex}
onChange={this.onChangeSearch}
onClear={this.onClearSearchQuery}
inputType={inputType}
lockWidth
newLineOnShiftEnter
onSubmitSearch={this.onSubmitSearch}
/>
)}
</FormattedMessage>
Expand Down
1 change: 1 addition & 0 deletions lib/SearchAndSort/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ filterConfig | array of structures | Configuration for the module's filters, as
hasRowClickHandlers | bool | Defaults to true. Turns row-level click handlers on and off for the results.
initialFilters | string | The initial state of the filters when the application started up, used when resetting to the initial state. Takes the same form as the `filters` part of the URL: a comma-separated list of `group`.`name` filters that are selected.
disableFilters | object whose keys are filter-group names | In the display of filter groups, those that are named in this object are greyed out and cannot be selected.
inputType | string | Type of search box. Can be `input` or `textarea`.
filterChangeCallback | function | If provided, this function is invoked when the user changes a filter. It is passed the new set of filters, in the form of an object whose keys are the `group`.`name` specifiers of each selected filter.
onFilterChange | function | Callback to be called after filter value is changed. Gets filter name and filter values in a form of an object `{ name: <String>, values: <Array> }`.
renderFilters | function | Renders a set of filters. Gets onChange callback to be called after filter value change.
Expand Down