@faststore/core 2.0.85-alpha.0 → 2.0.88-alpha.0

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.
Files changed (93) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +26 -28
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/eslint/.cache_1gneedd +1 -1
  6. package/.next/cache/webpack/client-production/0.pack +0 -0
  7. package/.next/cache/webpack/client-production/index.pack +0 -0
  8. package/.next/cache/webpack/server-production/0.pack +0 -0
  9. package/.next/cache/webpack/server-production/index.pack +0 -0
  10. package/.next/prerender-manifest.json +1 -1
  11. package/.next/react-loadable-manifest.json +2 -3
  12. package/.next/routes-manifest.json +1 -1
  13. package/.next/server/chunks/312.js +232 -260
  14. package/.next/server/chunks/{849.js → 777.js} +46 -2
  15. package/.next/server/middleware-build-manifest.js +1 -1
  16. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  17. package/.next/server/pages/[...slug].js +1 -1
  18. package/.next/server/pages/[...slug].js.nft.json +1 -1
  19. package/.next/server/pages/[slug]/p.js +123 -218
  20. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  21. package/.next/server/pages/_app.js +1009 -643
  22. package/.next/server/pages/_app.js.nft.json +1 -1
  23. package/.next/server/pages/api/graphql.js.nft.json +1 -1
  24. package/.next/server/pages/en-US/404.html +2 -2
  25. package/.next/server/pages/en-US/500.html +2 -2
  26. package/.next/server/pages/en-US/account.html +2 -2
  27. package/.next/server/pages/en-US/checkout.html +2 -2
  28. package/.next/server/pages/en-US/login.html +2 -2
  29. package/.next/server/pages/en-US/s.html +2 -2
  30. package/.next/server/pages/en-US.html +2 -2
  31. package/.next/server/pages/en-US.json +1 -1
  32. package/.next/server/pages/index.js +1 -1
  33. package/.next/server/pages/index.js.nft.json +1 -1
  34. package/.next/server/pages/s.js.nft.json +1 -1
  35. package/.next/static/NEdGK5jp2ohL_vvU4f2Bi/_buildManifest.js +1 -0
  36. package/.next/static/chunks/291.78e3aea4a7f45595.js +1 -0
  37. package/.next/static/chunks/781-7df372b5b56e3f96.js +1 -0
  38. package/.next/static/chunks/855-05313b1877eceff8.js +1 -0
  39. package/.next/static/chunks/897-97b54479ad1b57d9.js +1 -0
  40. package/.next/static/chunks/pages/[...slug]-a947020e62f4ac94.js +1 -0
  41. package/.next/static/chunks/pages/[slug]/p-0a0c4a0e23758fd1.js +1 -0
  42. package/.next/static/chunks/pages/_app-256a3d53cde1dece.js +1 -0
  43. package/.next/static/chunks/pages/{index-912d65fde37706bb.js → index-d7b3fd29a591657a.js} +1 -1
  44. package/.next/static/chunks/pages/s-56181f57d448f67c.js +1 -0
  45. package/.next/static/chunks/webpack-432485347f98ee3c.js +1 -0
  46. package/.next/static/css/{2caa85943bafc7b1.css → 4ac2b0d468ca74dc.css} +1 -1
  47. package/.next/static/css/{9e7c9877b9f78c63.css → a3aac8b785a9dfe2.css} +1 -1
  48. package/.next/trace +64 -64
  49. package/.turbo/turbo-build.log +16 -17
  50. package/CHANGELOG.md +12 -0
  51. package/package.json +4 -4
  52. package/src/components/common/Navbar/navbar.module.scss +6 -5
  53. package/src/components/regionalization/RegionalizationBar/regionalization-bar.module.scss +4 -0
  54. package/src/components/search/SearchDropdown/SearchDropdown.tsx +44 -33
  55. package/src/components/search/SearchDropdown/index.ts +0 -1
  56. package/src/components/search/SearchHistory/SearchHistory.tsx +5 -3
  57. package/src/components/search/SearchInput/SearchInput.tsx +55 -61
  58. package/src/components/search/SearchProductItem/SearchProductItem.tsx +5 -3
  59. package/src/components/search/SearchTop/SearchTop.tsx +8 -8
  60. package/src/components/sections/ProductDetails/ProductDetails.tsx +7 -5
  61. package/src/components/sections/ProductDetails/product-details.module.scss +0 -5
  62. package/src/components/ui/SkuSelector/Selectors.stories.mdx +5 -1
  63. package/src/components/ui/SkuSelector/Selectors.tsx +40 -54
  64. package/src/components/ui/SkuSelector/index.ts +0 -2
  65. package/src/sdk/cart/index.ts +2 -2
  66. package/src/sdk/search/formatSearchPath.ts +12 -0
  67. package/.next/server/chunks/732.js +0 -51
  68. package/.next/static/U30CqXXD1GphxOr478qYE/_buildManifest.js +0 -1
  69. package/.next/static/chunks/153-a20e3f2da180607e.js +0 -1
  70. package/.next/static/chunks/29.8b3dad75b915d222.js +0 -1
  71. package/.next/static/chunks/337-cf283e91e431869b.js +0 -1
  72. package/.next/static/chunks/380-efd3541ef85300d5.js +0 -1
  73. package/.next/static/chunks/817-58eb9d4b3ee3be23.js +0 -1
  74. package/.next/static/chunks/909.787de82e0ed9eea3.js +0 -1
  75. package/.next/static/chunks/pages/[...slug]-51896262f6760bf1.js +0 -1
  76. package/.next/static/chunks/pages/[slug]/p-08c1f443f7d84d0d.js +0 -1
  77. package/.next/static/chunks/pages/_app-0effc9759a3900cf.js +0 -1
  78. package/.next/static/chunks/pages/s-86fe1e3303388123.js +0 -1
  79. package/.next/static/chunks/webpack-dbb0d4f8be2c2abe.js +0 -1
  80. package/src/components/search/Search.stories.mdx +0 -173
  81. package/src/components/search/SearchDropdown/SearchDropdown.stories.mdx +0 -61
  82. package/src/components/search/SearchInput/SearchInput.stories.mdx +0 -200
  83. package/src/components/search/SearchInput/search-input.module.scss +0 -138
  84. package/src/components/search/SearchSharedTokenTable.mdx +0 -98
  85. package/src/components/search/SearchSuggestions/SearchSuggestions.tsx +0 -84
  86. package/src/components/search/SearchSuggestions/index.ts +0 -2
  87. package/src/components/search/search.module.scss +0 -19
  88. package/src/components/ui/SkuSelector/SkuSelector.stories.mdx +0 -345
  89. package/src/components/ui/SkuSelector/SkuSelector.tsx +0 -46
  90. package/src/components/ui/SkuSelector/sku-selector.module.scss +0 -172
  91. package/src/components/ui/SkuSelector/skuVariants.ts +0 -59
  92. package/src/sdk/search/useSearchInput.tsx +0 -43
  93. /package/.next/static/{U30CqXXD1GphxOr478qYE → NEdGK5jp2ohL_vvU4f2Bi}/_ssgManifest.js +0 -0
@@ -17,33 +17,32 @@ info - Generating static pages (0/13)
17
17
  info - Generating static pages (3/13)
18
18
  info - Generating static pages (6/13)
19
19
  info - Generating static pages (9/13)
20
- warn - CallToAction not found. Add a new component for this section or remove it from the CMS
21
20
  info - Generating static pages (13/13)
22
21
  info - Finalizing page optimization...
23
22
 
24
23
  Route (pages) Size First Load JS
25
24
  ┌ ● / 2.83 kB 127 kB
26
25
  ├ └ css/43d61b402f41569b.css 1.84 kB
27
- ├ /_app 0 B 100 kB
28
- ├ ● /[...slug] 6.82 kB 131 kB
26
+ ├ /_app 0 B 105 kB
27
+ ├ ● /[...slug] 9.99 kB 131 kB
29
28
  ├ └ css/430b8cafbf7c23c1.css 2.53 kB
30
- ├ ● /[slug]/p 11.7 kB 136 kB
31
- ├ └ css/9e7c9877b9f78c63.css 3.87 kB
32
- ├ ○ /404 431 B 106 kB
33
- ├ ○ /500 439 B 106 kB
34
- ├ ○ /account 369 B 106 kB
35
- ├ λ /api/graphql 0 B 100 kB
36
- ├ λ /api/preview 0 B 100 kB
37
- ├ ○ /checkout 371 B 106 kB
38
- ├ ○ /login 368 B 106 kB
39
- └ ○ /s 6.14 kB 122 kB
29
+ ├ ● /[slug]/p 11.5 kB 135 kB
30
+ ├ └ css/a3aac8b785a9dfe2.css 3.22 kB
31
+ ├ ○ /404 431 B 110 kB
32
+ ├ ○ /500 439 B 110 kB
33
+ ├ ○ /account 369 B 110 kB
34
+ ├ λ /api/graphql 0 B 105 kB
35
+ ├ λ /api/preview 0 B 105 kB
36
+ ├ ○ /checkout 371 B 110 kB
37
+ ├ ○ /login 368 B 110 kB
38
+ └ ○ /s 895 B 121 kB
40
39
  └ css/9dd1d1084d254c66.css 2.33 kB
41
- + First Load JS shared by all 121 kB
40
+ + First Load JS shared by all 125 kB
42
41
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
43
42
  ├ chunks/main-9746772201fe3ac1.js 23.9 kB
44
- ├ chunks/pages/_app-0effc9759a3900cf.js 29.1 kB
45
- ├ chunks/webpack-dbb0d4f8be2c2abe.js 2.2 kB
46
- └ css/2caa85943bafc7b1.css 20.4 kB
43
+ ├ chunks/pages/_app-256a3d53cde1dece.js 33.2 kB
44
+ ├ chunks/webpack-432485347f98ee3c.js 2.18 kB
45
+ └ css/4ac2b0d468ca74dc.css 20.9 kB
47
46
 
48
47
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
49
48
  ○ (Static) automatically rendered as static HTML (uses no initial props)
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.88-alpha.0](https://github.com/vtex/faststore/compare/v2.0.87-alpha.0...v2.0.88-alpha.0) (2023-03-29)
7
+
8
+ ### Features
9
+
10
+ - Adds `SearchInput`, `SearchInputField` and `SearchDropdown` components ([#1676](https://github.com/vtex/faststore/issues/1676)) ([edba839](https://github.com/vtex/faststore/commit/edba8399a27f183f2092086b3c9d69cf5c1e8f52))
11
+
12
+ ## [2.0.87-alpha.0](https://github.com/vtex/faststore/compare/v2.0.86-alpha.0...v2.0.87-alpha.0) (2023-03-24)
13
+
14
+ ### Features
15
+
16
+ - Adds `SkuSelector` component ([#1677](https://github.com/vtex/faststore/issues/1677)) ([696a14e](https://github.com/vtex/faststore/commit/696a14e6d9633ececcd2818e4a32b32ce8ad2e2b))
17
+
6
18
  ## [2.0.85-alpha.0](https://github.com/vtex/faststore/compare/v2.0.84-alpha.0...v2.0.85-alpha.0) (2023-03-22)
7
19
 
8
20
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.0.85-alpha.0",
3
+ "version": "2.0.88-alpha.0",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -30,10 +30,10 @@
30
30
  "@envelop/parser-cache": "^2.2.0",
31
31
  "@envelop/validation-cache": "^2.2.0",
32
32
  "@faststore/api": "^2.0.3-alpha.0",
33
- "@faststore/components": "^2.0.85-alpha.0",
33
+ "@faststore/components": "^2.0.88-alpha.0",
34
34
  "@faststore/graphql-utils": "^2.0.3-alpha.0",
35
35
  "@faststore/sdk": "^2.0.3-alpha.0",
36
- "@faststore/ui": "^2.0.85-alpha.0",
36
+ "@faststore/ui": "^2.0.88-alpha.0",
37
37
  "@types/react": "^18.0.14",
38
38
  "@vtex/client-cms": "^0.2.12",
39
39
  "autoprefixer": "^10.4.0",
@@ -108,5 +108,5 @@
108
108
  "msw": {
109
109
  "workerDirectory": "public"
110
110
  },
111
- "gitHead": "24590eae428eae6be0b7c43cbec9fe236270794e"
111
+ "gitHead": "a9aa7a6572c08e0bd26e384bb66464e633f1ad84"
112
112
  }
@@ -72,7 +72,7 @@
72
72
  }
73
73
  }
74
74
 
75
- [data-fs-search-input-wrapper] {
75
+ [data-fs-search-input] {
76
76
  flex: 1 0 100%;
77
77
  order: 2;
78
78
 
@@ -125,7 +125,7 @@
125
125
  }
126
126
  }
127
127
 
128
- [data-fs-search-input-wrapper] {
128
+ [data-fs-search-input] {
129
129
  display: none;
130
130
  transition: flex var(--fs-navbar-transition-timing) var(--fs-navbar-transition-function);
131
131
 
@@ -136,7 +136,7 @@
136
136
  order: 0;
137
137
  width: min-content;
138
138
 
139
- &[data-fs-search-input-dropdown-visible="false"] [data-fs-search-input] {
139
+ &[data-fs-search-input-dropdown-visible="false"] [data-fs-search-input-field-input] {
140
140
  width: 0;
141
141
  padding: 0;
142
142
  border-width: 0;
@@ -162,12 +162,12 @@
162
162
  &[data-fs-navbar-search-expanded="true"] {
163
163
  width: 100%;
164
164
 
165
- [data-fs-search-input-wrapper] {
165
+ [data-fs-search-input] {
166
166
  flex: 1 1;
167
167
  margin-right: var(--fs-navbar-search-expanded-input-wrapper-margin-right);
168
168
  margin-left: var(--fs-navbar-search-expanded-input-wrapper-margin-left);
169
169
 
170
- [data-fs-search-input] {
170
+ [data-fs-search-input-field] [data-fs-search-input-field-input] {
171
171
  width: var(--fs-navbar-search-expanded-input-width);
172
172
  padding: var(--fs-spacing-2);
173
173
  }
@@ -186,6 +186,7 @@
186
186
 
187
187
  [data-fs-navbar-header] {
188
188
  padding: var(--fs-navbar-header-padding);
189
+ overflow-x: clip;
189
190
  background-color: var(--fs-navbar-bkg-color);
190
191
  backdrop-filter: blur(10px);
191
192
  }
@@ -37,6 +37,10 @@
37
37
  background-color: var(--fs-regionalization-bar-bkg-color);
38
38
  border-bottom: var(--fs-regionalization-bar-border-bottom-width) solid var(--fs-regionalization-bar-border-bottom-color);
39
39
  border-radius: 0;
40
+
41
+ > span {
42
+ display: contents;
43
+ }
40
44
  }
41
45
 
42
46
  [data-fs-regionalization-bar-cta] {
@@ -1,43 +1,54 @@
1
- import type { SearchSuggestionsProps } from 'src/components/search/SearchSuggestions'
2
- import SearchSuggestions from 'src/components/search/SearchSuggestions'
3
- import useSuggestions from 'src/sdk/search/useSuggestions'
1
+ import {
2
+ SearchAutoComplete as UISearchAutoComplete,
3
+ SearchAutoCompleteTerm as UISearchAutoCompleteTerm,
4
+ SearchDropdown as UISearchDropdown,
5
+ SearchProducts,
6
+ useSearch,
7
+ } from '@faststore/ui'
4
8
 
5
9
  import { SearchHistory } from '../SearchHistory'
6
10
  import { SearchTop } from '../SearchTop'
7
11
 
8
- export type SearchDropdownProps = SearchSuggestionsProps
12
+ import SearchProductItem from 'src/components/search/SearchProductItem'
13
+ import { formatSearchPath } from 'src/sdk/search/formatSearchPath'
14
+ import { ProductSummary_ProductFragment } from '@generated/graphql'
9
15
 
10
- function SearchDropdown({
11
- term = '',
12
- style,
13
- ...otherProps
14
- }: SearchDropdownProps) {
15
- const { terms, products, isLoading } = useSuggestions(term)
16
-
17
- if (term.length === 0 && !isLoading) {
18
- return (
19
- <>
20
- <SearchHistory data-fs-search-section />
21
- <SearchTop data-fs-search-section />
22
- </>
23
- )
24
- }
25
-
26
- if (isLoading) {
27
- return <p data-fs-search-input-loading-text>Loading...</p>
28
- }
29
-
30
- if (terms.length === 0 && products.length === 0) {
31
- return null
32
- }
16
+ function SearchDropdown({ ...otherProps }) {
17
+ const {
18
+ values: { onSearchSelection, products, term, terms },
19
+ } = useSearch()
33
20
 
34
21
  return (
35
- <SearchSuggestions
36
- term={term}
37
- terms={terms}
38
- products={products}
39
- {...otherProps}
40
- />
22
+ <UISearchDropdown {...otherProps}>
23
+ <SearchHistory />
24
+ <SearchTop />
25
+ <UISearchAutoComplete>
26
+ {terms?.map(({ value: suggestion }) => (
27
+ <UISearchAutoCompleteTerm
28
+ key={suggestion}
29
+ term={term}
30
+ suggestion={suggestion}
31
+ linkProps={{
32
+ href: formatSearchPath(suggestion),
33
+ onClick: () =>
34
+ onSearchSelection?.(suggestion, formatSearchPath(suggestion)),
35
+ }}
36
+ />
37
+ ))}
38
+ </UISearchAutoComplete>
39
+ <SearchProducts>
40
+ {products.map((product, index) => {
41
+ const productParsed = product as ProductSummary_ProductFragment
42
+ return (
43
+ <SearchProductItem
44
+ key={productParsed.id}
45
+ product={productParsed}
46
+ index={index}
47
+ />
48
+ )
49
+ })}
50
+ </SearchProducts>
51
+ </UISearchDropdown>
41
52
  )
42
53
  }
43
54
 
@@ -1,2 +1 @@
1
1
  export { default } from './SearchDropdown'
2
- export type { SearchDropdownProps } from './SearchDropdown'
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  SearchHistory as UISearchHistory,
3
3
  SearchHistoryTerm as UISearchHistoryTerm,
4
+ useSearch,
4
5
  } from '@faststore/ui'
5
6
  import useSearchHistory from 'src/sdk/search/useSearchHistory'
6
- import useSearchInput from 'src/sdk/search/useSearchInput'
7
7
 
8
8
  const SearchHistory = ({ ...props }) => {
9
- const { onSearchInputSelection } = useSearchInput()
9
+ const {
10
+ values: { onSearchSelection },
11
+ } = useSearch()
10
12
  const { searchHistory, clearSearchHistory } = useSearchHistory()
11
13
 
12
14
  if (!searchHistory.length) {
@@ -21,7 +23,7 @@ const SearchHistory = ({ ...props }) => {
21
23
  value={item.term}
22
24
  linkProps={{
23
25
  href: item.path,
24
- onClick: () => onSearchInputSelection?.(item.term, item.path),
26
+ onClick: () => onSearchSelection?.(item.term, item.path),
25
27
  }}
26
28
  />
27
29
  ))}
@@ -11,23 +11,20 @@ import type { CSSProperties } from 'react'
11
11
  import { useRouter } from 'next/router'
12
12
  import { sendAnalyticsEvent } from '@faststore/sdk'
13
13
  import type { SearchEvent } from '@faststore/sdk'
14
- import { SearchInput as UISearchInput } from '@faststore/ui'
14
+ import {
15
+ SearchInputField as UISearchInputField,
16
+ SearchInput as UISearchInput,
17
+ SearchProviderContextValue,
18
+ } from '@faststore/ui'
15
19
  import type {
16
- SearchInputProps as UISearchInputProps,
17
- SearchInputRef as UISearchInputRef,
20
+ SearchInputFieldProps as UISearchInputFieldProps,
21
+ SearchInputFieldRef as UISearchInputFieldRef,
18
22
  } from '@faststore/ui'
19
23
 
20
- import Icon from 'src/components/ui/Icon'
21
24
  import useSearchHistory from 'src/sdk/search/useSearchHistory'
22
- import {
23
- formatSearchPath,
24
- SearchInputProvider,
25
- } from 'src/sdk/search/useSearchInput'
26
- import type { SearchInputContextValue } from 'src/sdk/search/useSearchInput'
25
+ import { formatSearchPath } from 'src/sdk/search/formatSearchPath'
27
26
  import useOnClickOutside from 'src/sdk/ui/useOnClickOutside'
28
-
29
- import inputStyles from './search-input.module.scss'
30
- import styles from '../search.module.scss'
27
+ import useSuggestions from 'src/sdk/search/useSuggestions'
31
28
 
32
29
  const SearchDropdown = lazy(
33
30
  () => import('src/components/search/SearchDropdown')
@@ -37,9 +34,11 @@ export type SearchInputProps = {
37
34
  onSearchClick?: () => void
38
35
  buttonTestId?: string
39
36
  containerStyle?: CSSProperties
40
- } & Omit<UISearchInputProps, 'onSubmit'>
37
+ } & Omit<UISearchInputFieldProps, 'onSubmit'>
41
38
 
42
- export type SearchInputRef = UISearchInputRef & { resetSearchInput: () => void }
39
+ export type SearchInputRef = UISearchInputFieldRef & {
40
+ resetSearchInput: () => void
41
+ }
43
42
 
44
43
  const sendAnalytics = async (term: string) => {
45
44
  sendAnalyticsEvent<SearchEvent>({
@@ -52,7 +51,7 @@ const SearchInput = forwardRef<SearchInputRef, SearchInputProps>(
52
51
  function SearchInput(
53
52
  {
54
53
  onSearchClick,
55
- buttonTestId = 'store-search-button',
54
+ buttonTestId = 'fs-search-button',
56
55
  containerStyle,
57
56
  ...otherProps
58
57
  },
@@ -71,60 +70,55 @@ const SearchInput = forwardRef<SearchInputRef, SearchInputProps>(
71
70
  resetSearchInput: () => setSearchQuery(''),
72
71
  }))
73
72
 
74
- const onSearchInputSelection: SearchInputContextValue['onSearchInputSelection'] =
75
- (term, path) => {
76
- addToSearchHistory({ term, path })
77
- sendAnalytics(term)
78
- setSearchDropdownVisible(false)
79
- setSearchQuery(term)
80
- }
73
+ const onSearchSelection: SearchProviderContextValue['onSearchSelection'] = (
74
+ term,
75
+ path
76
+ ) => {
77
+ addToSearchHistory({ term, path })
78
+ sendAnalytics(term)
79
+ setSearchDropdownVisible(false)
80
+ setSearchQuery(term)
81
+ }
81
82
 
82
83
  useOnClickOutside(searchRef, () => setSearchDropdownVisible(false))
83
84
 
85
+ const { terms, products, isLoading } = useSuggestions(searchQueryDeferred)
86
+
84
87
  return (
85
- <div
88
+ <UISearchInput
86
89
  ref={searchRef}
87
- data-fs-search-input-wrapper
88
- className={inputStyles.fsSearchInput}
89
- data-fs-search-input-dropdown-visible={searchDropdownVisible}
90
- style={containerStyle}
90
+ visibleDropdown={searchDropdownVisible}
91
+ onSearchSelection={onSearchSelection}
92
+ term={searchQueryDeferred}
93
+ terms={terms}
94
+ products={products}
95
+ isLoading={isLoading}
91
96
  >
92
- <SearchInputProvider onSearchInputSelection={onSearchInputSelection}>
93
- <UISearchInput
94
- data-fs-search-input
95
- ref={ref}
96
- icon={
97
- <Icon
98
- name="MagnifyingGlass"
99
- onClick={onSearchClick}
100
- data-testid={buttonTestId}
101
- />
102
- }
103
- placeholder="Search everything at the store"
104
- onChange={(e) => setSearchQuery(e.target.value)}
105
- onSubmit={(term) => {
106
- const path = formatSearchPath(term)
97
+ <UISearchInputField
98
+ ref={ref}
99
+ buttonProps={{
100
+ onClick: onSearchClick,
101
+ testId: buttonTestId,
102
+ }}
103
+ placeholder="Search everything at the store"
104
+ onChange={(e) => setSearchQuery(e.target.value)}
105
+ onSubmit={(term) => {
106
+ const path = formatSearchPath(term)
107
107
 
108
- onSearchInputSelection(term, path)
109
- router.push(path)
110
- }}
111
- onFocus={() => setSearchDropdownVisible(true)}
112
- value={searchQuery}
113
- {...otherProps}
114
- />
108
+ onSearchSelection(term, path)
109
+ router.push(path)
110
+ }}
111
+ onFocus={() => setSearchDropdownVisible(true)}
112
+ value={searchQuery}
113
+ {...otherProps}
114
+ />
115
115
 
116
- {searchDropdownVisible && (
117
- <Suspense fallback={null}>
118
- <div
119
- data-fs-search-input-dropdown-wrapper
120
- className={styles.fsSearch}
121
- >
122
- <SearchDropdown term={searchQueryDeferred} />
123
- </div>
124
- </Suspense>
125
- )}
126
- </SearchInputProvider>
127
- </div>
116
+ {searchDropdownVisible && (
117
+ <Suspense fallback={null}>
118
+ <SearchDropdown />
119
+ </Suspense>
120
+ )}
121
+ </UISearchInput>
128
122
  )
129
123
  }
130
124
  )
@@ -2,12 +2,12 @@ import {
2
2
  SearchProductItem as UISearchProductItem,
3
3
  SearchProductItemContent as UISearchProductItemContent,
4
4
  SearchProductItemImage as UISearchProductItemImage,
5
+ useSearch,
5
6
  } from '@faststore/ui'
6
7
 
7
8
  import { Image } from 'src/components/ui/Image'
8
9
  import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
9
10
  import { useProductLink } from 'src/sdk/product/useProductLink'
10
- import useSearchInput from 'src/sdk/search/useSearchInput'
11
11
  import type { ProductSummary_ProductFragment } from '@generated/graphql'
12
12
 
13
13
  type SearchProductItemProps = {
@@ -26,7 +26,9 @@ function SearchProductItem({
26
26
  index,
27
27
  ...otherProps
28
28
  }: SearchProductItemProps) {
29
- const { onSearchInputSelection } = useSearchInput()
29
+ const {
30
+ values: { onSearchSelection },
31
+ } = useSearch()
30
32
 
31
33
  const { href, onClick, ...baseLinkProps } = useProductLink({
32
34
  product,
@@ -47,7 +49,7 @@ function SearchProductItem({
47
49
  href,
48
50
  onClick: () => {
49
51
  onClick()
50
- onSearchInputSelection?.(name, href)
52
+ onSearchSelection?.(name, href)
51
53
  },
52
54
  ...baseLinkProps,
53
55
  }
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  SearchTop as UISearchTop,
3
3
  SearchTopTerm as UISearchTopTerm,
4
+ useSearch,
4
5
  } from '@faststore/ui'
5
6
  import type { HTMLAttributes } from 'react'
6
7
 
7
8
  import type { StoreSuggestionTerm } from '@generated/graphql'
8
- import useSearchInput, { formatSearchPath } from 'src/sdk/search/useSearchInput'
9
+ import { formatSearchPath } from 'src/sdk/search/formatSearchPath'
9
10
  import useTopSearch from 'src/sdk/search/useTopSearch'
10
11
 
11
12
  export interface SearchTopProps extends HTMLAttributes<HTMLDivElement> {
@@ -16,15 +17,17 @@ export interface SearchTopProps extends HTMLAttributes<HTMLDivElement> {
16
17
  }
17
18
 
18
19
  function SearchTop({ topTerms, ...otherProps }: SearchTopProps) {
19
- const { onSearchInputSelection } = useSearchInput()
20
- const { terms, isLoading } = useTopSearch(topTerms)
20
+ const {
21
+ values: { onSearchSelection },
22
+ } = useSearch()
23
+ const { terms } = useTopSearch(topTerms)
21
24
 
22
25
  if (terms.length === 0) {
23
26
  return null
24
27
  }
25
28
 
26
29
  return (
27
- <UISearchTop title="Top Search" isLoading={isLoading} {...otherProps}>
30
+ <UISearchTop title="Top Search" {...otherProps}>
28
31
  {terms.map((term, index) => (
29
32
  <UISearchTopTerm
30
33
  key={index}
@@ -33,10 +36,7 @@ function SearchTop({ topTerms, ...otherProps }: SearchTopProps) {
33
36
  linkProps={{
34
37
  href: formatSearchPath(term.value),
35
38
  onClick: () =>
36
- onSearchInputSelection?.(
37
- term.value,
38
- formatSearchPath(term.value)
39
- ),
39
+ onSearchSelection?.(term.value, formatSearchPath(term.value)),
40
40
  }}
41
41
  />
42
42
  ))}
@@ -170,10 +170,12 @@ function ProductDetails({ context: staleProduct }: Props) {
170
170
  </section>
171
171
  {skuVariants && (
172
172
  <Selectors
173
- slugsMap={skuVariants.slugsMap}
174
- availableVariations={skuVariants.availableVariations}
175
- activeVariations={skuVariants.activeVariations}
176
173
  data-fs-product-details-selectors
174
+ slugsMap={isVariantOf.skuVariants.slugsMap}
175
+ activeVariations={isVariantOf.skuVariants.activeVariations}
176
+ availableVariations={
177
+ isVariantOf.skuVariants.availableVariations
178
+ }
177
179
  />
178
180
  )}
179
181
  {/* NOTE: A loading skeleton had to be used to avoid a Lighthouse's
@@ -284,8 +286,8 @@ export const fragment = gql`
284
286
  productGroupID
285
287
  skuVariants {
286
288
  activeVariations
287
- slugsMap(dominantVariantName: "Color")
288
- availableVariations(dominantVariantName: "Color")
289
+ slugsMap
290
+ availableVariations
289
291
  }
290
292
  }
291
293
 
@@ -38,11 +38,6 @@
38
38
  [data-fs-product-details-section] {
39
39
  height: fit-content;
40
40
 
41
- [data-fs-sku-selector] {
42
- margin-bottom: var(--fs-product-details-vertical-spacing);
43
- &:last-of-type { margin-bottom: var(--fs-spacing-7); }
44
- }
45
-
46
41
  [data-fs-buy-button] {
47
42
  width: 100%;
48
43
  margin-top: var(--fs-spacing-3);
@@ -39,12 +39,16 @@ The code snippet below is an example of what `Selectors` props should look like,
39
39
  ]}
40
40
  >
41
41
  <Selectors
42
- activeVariations={{ Size: '41', Color: 'White' }}
42
+ activeVariations={{
43
+ Color: 'White',
44
+ Size: '42',
45
+ }}
43
46
  slugsMap={{
44
47
  'Color-Pink-Size-42': 'classic-shoes-37',
45
48
  'Color-White-Size-42': 'classic-shoes-36',
46
49
  'Color-White-Size-41': 'classic-shoes-310124175',
47
50
  }}
51
+ dominantVariation: 'Color'
48
52
  availableVariations={{
49
53
  Size: [
50
54
  {