From c8990d4523c4fc9a3b13855f0e388ac856736901 Mon Sep 17 00:00:00 2001 From: Dallas Date: Tue, 21 Nov 2023 20:52:41 -0600 Subject: [PATCH 1/3] :ghost: use pf5 select for set-targets (#1526) Also pulled the select out of the text-content wrapper which was throwing off some styles. --------- Signed-off-by: gitdallas Signed-off-by: Dallas Co-authored-by: Ian Bolton --- .../app/components/SimpleSelectTypeahead.tsx | 15 ++++++-- .../analysis-wizard/set-targets.tsx | 37 +++++++++++-------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/client/src/app/components/SimpleSelectTypeahead.tsx b/client/src/app/components/SimpleSelectTypeahead.tsx index c442c5149d..3e61aea324 100644 --- a/client/src/app/components/SimpleSelectTypeahead.tsx +++ b/client/src/app/components/SimpleSelectTypeahead.tsx @@ -25,7 +25,9 @@ export interface ISimpleSelectBasicProps { toggleId?: string; toggleAriaLabel?: string; selectMultiple?: boolean; + width?: number; noResultsFoundText?: string; + hideClearButton?: boolean; } export const SimpleSelectTypeahead: React.FC = ({ @@ -37,7 +39,9 @@ export const SimpleSelectTypeahead: React.FC = ({ toggleId, toggleAriaLabel, selectMultiple = false, + width, noResultsFoundText, + hideClearButton = false, }) => { const [isOpen, setIsOpen] = React.useState(false); const [selected, setSelected] = React.useState( @@ -190,7 +194,8 @@ export const SimpleSelectTypeahead: React.FC = ({ variant="typeahead" onClick={onToggleClick} isExpanded={isOpen} - isFullWidth + isFullWidth={!width} + style={{ width: width && width + "px" }} > = ({ onChange={onTextInputChange} onKeyDown={onInputKeyDown} onBlur={() => { - setInputValue(""); + selectMultiple + ? setInputValue("") + : setInputValue(selected.toString()); }} id="typeahead-select-input" autoComplete="off" @@ -243,7 +250,7 @@ export const SimpleSelectTypeahead: React.FC = ({ )} - {!selectMultiple && !!inputValue && ( + {!hideClearButton && !selectMultiple && !!inputValue && (