diff --git a/packages/components/src/SearchInput.scss b/packages/components/src/SearchInput.scss index ff93f1ca71..9508182233 100644 --- a/packages/components/src/SearchInput.scss +++ b/packages/components/src/SearchInput.scss @@ -55,4 +55,31 @@ border-radius: 1rem; background-color: rgba($white, 0.25); } + + .search-change-selection { + position: absolute; + right: $spacer-1; + top: 15%; + bottom: 15%; + height: 70%; + } + + .search-change-button { + background: none; + border: none; + padding: 1px 2px; + } + + .search-change-text { + background-color: rgba($white, 0.2); + border-radius: 10px; + padding: 1px 5px; + } + + .match_count { + background-color: rgba($white, 0.2); + border-radius: 10px; + padding: 1px 5px; + margin: 0 5px; + } } diff --git a/packages/components/src/SearchInput.tsx b/packages/components/src/SearchInput.tsx index 165292d736..4e1c66e972 100644 --- a/packages/components/src/SearchInput.tsx +++ b/packages/components/src/SearchInput.tsx @@ -1,9 +1,14 @@ import React, { PureComponent } from 'react'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { vsSearch } from '@deephaven/icons'; +import { vsArrowLeft, vsArrowRight, vsSearch } from '@deephaven/icons'; import classNames from 'classnames'; +import Button from './Button'; import './SearchInput.scss'; +interface QueryParams { + queriedColumnIndex: number | undefined; + changeQueriedColumnIndex: (direction: 'forward' | 'back') => void; +} interface SearchInputProps { value: string; placeholder: string; @@ -15,6 +20,7 @@ interface SearchInputProps { matchCount: number; id: string; 'data-testid'?: string; + queryParams?: QueryParams; } class SearchInput extends PureComponent { @@ -27,19 +33,40 @@ class SearchInput extends PureComponent { }, id: '', 'data-testid': undefined, + queryParams: undefined, }; constructor(props: SearchInputProps) { super(props); this.inputField = React.createRef(); + this.searchChangeSelection = React.createRef(); } - inputField: React.RefObject; + componentDidMount(): void { + this.setInputPaddingRight(); + } + + componentDidUpdate(): void { + this.setInputPaddingRight(); + } focus(): void { this.inputField.current?.focus(); } + inputField: React.RefObject; + + searchChangeSelection: React.RefObject; + + setInputPaddingRight(): void { + const inputField = this.inputField.current; + const searchChangeSelection = this.searchChangeSelection.current; + if (inputField && searchChangeSelection) { + const paddingRight = searchChangeSelection.getBoundingClientRect().width; + inputField.style.paddingRight = `${paddingRight}px`; + } + } + render(): JSX.Element { const { value, @@ -52,7 +79,47 @@ class SearchInput extends PureComponent { id, onKeyDown, 'data-testid': dataTestId, + queryParams, } = this.props; + + let matchCountSection; + + if (queryParams && matchCount > 1) { + matchCountSection = ( + <> +