formica-ui-lib 1.0.225 → 1.0.226

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,11 +12,13 @@ export interface InputProps {
12
12
  className?: string;
13
13
  inputClassName?: string;
14
14
  autoComplete?: string;
15
+ autoFocus?: boolean;
15
16
  leadingIcon?: React.ReactNode;
16
17
  trailingIcon?: React.ReactNode;
17
18
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
18
19
  onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
19
20
  onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
21
+ onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
20
22
  }
21
23
  export interface InputFieldProps extends InputProps {
22
24
  label?: string;
@@ -1,5 +1,6 @@
1
1
  import type { Country } from "../../molecules/selectors/countryselector/CountrySelectorProps";
2
- import type { TopNavLogin, TopNavCartSummary } from "./TopNavBarProps";
2
+ import type { TopNavLogin, TopNavCartSummary, TopNavSearchPayload } from "./TopNavBarProps";
3
+ import type { TopNavSearchResultClickPayload, TopNavSearchResultItem } from "./TopNavSearchResultsProps";
3
4
  export type TopNavActionsProps = {
4
5
  Countries?: Country[];
5
6
  countries?: Country[];
@@ -8,7 +9,13 @@ export type TopNavActionsProps = {
8
9
  Cart?: TopNavCartSummary;
9
10
  showFavorites?: boolean;
10
11
  showLogin?: boolean;
12
+ searchResultItems?: TopNavSearchResultItem[];
13
+ searchViewAllLabel?: string;
11
14
  onSearchClick?: () => void;
15
+ onSearchChange?: (payload: TopNavSearchPayload) => void;
16
+ onSearchSubmit?: (payload: TopNavSearchPayload) => void;
17
+ onSearchResultClick?: (payload: TopNavSearchResultClickPayload) => void;
18
+ onSearchViewAllClick?: (payload: TopNavSearchPayload) => void;
12
19
  onCartClick?: () => void;
13
20
  onLoginClick?: () => void;
14
21
  onFavoritesClick?: () => void;
@@ -1,4 +1,5 @@
1
1
  import { Country } from "../../molecules/selectors/countryselector/CountrySelectorProps";
2
+ import type { TopNavSearchResultClickPayload, TopNavSearchResultItem } from "./TopNavSearchResultsProps";
2
3
  export type NavLinkItem = {
3
4
  id: string;
4
5
  label: string;
@@ -38,6 +39,9 @@ export type TopNavLogo = {
38
39
  className?: string;
39
40
  containerClassName?: string;
40
41
  };
42
+ export type TopNavSearchPayload = {
43
+ query: string;
44
+ };
41
45
  export type TopNavBarProps = {
42
46
  NavMenuWithSubItems?: NavItem[];
43
47
  countries?: Country[];
@@ -47,10 +51,16 @@ export type TopNavBarProps = {
47
51
  showFavorites?: boolean;
48
52
  showLogin?: boolean;
49
53
  Logo?: TopNavLogo;
54
+ searchResultItems?: TopNavSearchResultItem[];
55
+ searchViewAllLabel?: string;
50
56
  onLogoClick?: () => void;
51
57
  onNavItemClick?: (item: NavItem) => void;
52
58
  onMegaMenuLinkClick?: (link: NavLinkItem) => void;
53
59
  onSearchClick?: () => void;
60
+ onSearchChange?: (payload: TopNavSearchPayload) => void;
61
+ onSearchSubmit?: (payload: TopNavSearchPayload) => void;
62
+ onSearchResultClick?: (payload: TopNavSearchResultClickPayload) => void;
63
+ onSearchViewAllClick?: (payload: TopNavSearchPayload) => void;
54
64
  onCartClick?: () => void;
55
65
  onLoginClick?: () => void;
56
66
  onFavoritesClick?: () => void;
@@ -0,0 +1,21 @@
1
+ export type TopNavSearchResultItemVariant = "product" | "article";
2
+ export type TopNavSearchResultItem = {
3
+ id: string;
4
+ variant: TopNavSearchResultItemVariant;
5
+ imageSrc?: string;
6
+ imageAlt?: string;
7
+ title: string;
8
+ subtitle?: string;
9
+ description?: string;
10
+ href?: string;
11
+ };
12
+ export type TopNavSearchResultClickPayload = {
13
+ item: TopNavSearchResultItem;
14
+ };
15
+ export type TopNavSearchResultsProps = {
16
+ id?: string;
17
+ items?: TopNavSearchResultItem[];
18
+ viewAllLabel?: string;
19
+ onResultClick?: (payload: TopNavSearchResultClickPayload) => void;
20
+ onViewAllClick?: () => void;
21
+ };