Skip to content

Commit d6b6d9c

Browse files
author
Kubit
committed
Include optionChecked icon and error props to InputSearch
1 parent 20a45b5 commit d6b6d9c

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

src/components/inputSearch/components/optionsList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const OptionsListComponent = (
4848
ref={sendRef}
4949
caseSensitive={props.caseSensitive}
5050
charsHighlighted={props.searchText?.toString()}
51+
checkedIcon={props.optionCheckedIcon}
5152
dataTestId={props.dataTestId}
5253
hightlightedOptionVariant={props.stylesListOption?.hightlightedOptionVariant}
5354
id={props['aria-controls']}

src/components/inputSearch/components/popoverSearchList.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export const PopoverSearchListComponent = (
7676
loader={props.loader}
7777
loading={props.loading}
7878
loadingText={props.loadingText}
79+
optionCheckedIcon={props.optionCheckedIcon}
7980
optionVariant={section?.optionVariant}
8081
options={section?.options || []}
8182
searchText={labelInResultTextWrittenByUser}
@@ -165,6 +166,7 @@ export const PopoverSearchListComponent = (
165166
variant={props.styles?.[props.state]?.popoverVariant?.[props.device]}
166167
onCloseInternally={() => {
167168
props.onOpenOptions(false);
169+
refInput?.current?.focus();
168170
}}
169171
>
170172
{useActionBottomSheet ? (

src/components/inputSearch/inputSearch.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ const InputSearchComponent = React.forwardRef(
117117
blockBackPopover={blockBackPopover}
118118
caseSensitive={caseSensitive}
119119
device={device}
120+
error={error}
120121
hasHighlightedOption={showHighlightedOption}
121122
hasResultTextWrittenByUser={hasResultTextWrittenByUser}
122123
highlightedOption={highlightedOption}

src/components/inputSearch/inputSearchStandAlone.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { InputSearchStyled } from './inputSearch.styled';
1515
import { IInputSearchStandAlone } from './types';
1616

1717
export const InputSearchStandAloneComponent = (
18-
props: IInputSearchStandAlone,
18+
{ error, ...props }: IInputSearchStandAlone,
1919
ref: ForwardedRef<HTMLInputElement | undefined | null>
2020
): JSX.Element => {
2121
const inputWrapperRef = useRef(null);
@@ -80,6 +80,9 @@ export const InputSearchStandAloneComponent = (
8080
overrideStyles: props.styles,
8181
placeholder: props.placeholder,
8282
value: props.inputPopoverValue,
83+
error: error,
84+
errorIcon: props.errorIcon,
85+
errorMessage: props.errorMessage,
8386
// The variant is the same for all the states
8487
variant:
8588
props.inputPopoverVariant ?? (props.styles?.[props.state]?.inputVariant as string),
@@ -93,6 +96,7 @@ export const InputSearchStandAloneComponent = (
9396
loadingText={props.loadingText}
9497
noResultsText={props.noResultsText}
9598
open={props.open}
99+
optionCheckedIcon={props.optionCheckedIcon}
96100
optionList={props.optionList}
97101
optionsListDefaultArias={props.optionsListDefaultArias}
98102
preventCloseOnClickElements={[

src/components/inputSearch/types/inputSearch.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export type PopoverSearchInputType = {
5858
placeholder?: string;
5959
value?: string;
6060
variant?: string;
61+
error?: boolean;
62+
errorIcon?: IElementOrIcon;
63+
errorMessage?: InputSearchLoadingTextType;
6164
onChange?: React.ChangeEventHandler<HTMLInputElement>;
6265
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
6366
onIconClick?: React.MouseEventHandler<HTMLButtonElement>;
@@ -91,6 +94,7 @@ export interface IPopoverSearchList {
9194
regex?: string | RegExp;
9295
value?: string;
9396
caseSensitive?: boolean;
97+
optionCheckedIcon?: IElementOrIcon;
9498
// Functions
9599
onOpenOptions: (value: boolean) => void;
96100
onValueSelected: (value: string) => void;
@@ -116,6 +120,7 @@ export interface IOptionsListSearchList extends OptionGroupAriasTypes {
116120
loadingText?: InputSearchLoadingTextType;
117121
value?: string;
118122
searchText?: string;
123+
optionCheckedIcon?: IElementOrIcon;
119124
}
120125

121126
export interface ILoadingIcon {
@@ -154,6 +159,7 @@ export interface IInputSearchStandAlone extends Omit<IInputStandAlone, propsToOm
154159
// Modifiers
155160
inputVariant?: string;
156161
open: boolean;
162+
error?: boolean;
157163
searchText?: string;
158164
value?: string;
159165
titleActionBottomSheet?: string;
@@ -163,6 +169,7 @@ export interface IInputSearchStandAlone extends Omit<IInputStandAlone, propsToOm
163169
listOptionsHeight: string;
164170
optionList: IOptionGroup[];
165171
optionsListDefaultArias?: OptionGroupAriasTypes;
172+
optionCheckedIcon?: IElementOrIcon;
166173
loadingList?: boolean;
167174
loadingText?: InputSearchLoadingTextType;
168175
elementsToShow?: number;
@@ -223,7 +230,6 @@ export interface IInputSearch<V = undefined extends string ? unknown : string>
223230
variant: V;
224231
open?: boolean;
225232
disabled?: boolean;
226-
error?: boolean;
227233
searchFilterConfig?: SearchFilterConfig;
228234
disableErrorInvalidOption?: boolean;
229235
regex?: string | RegExp;

0 commit comments

Comments
 (0)