@faststore/core 2.0.74-alpha.0 → 2.0.76-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.
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +12 -0
- package/package.json +4 -4
- package/src/components/cart/CartSidebar/CartSidebar.tsx +5 -1
- package/src/components/common/Navbar/navbar.module.scss +0 -1
- package/src/components/search/SearchInput/SearchInput.tsx +7 -3
- package/src/components/search/SearchInput/search-input.module.scss +0 -8
- package/src/components/search/{SearchProductCard/SearchProductCard.tsx → SearchProductItem/SearchProductItem.tsx} +25 -22
- package/src/components/search/SearchProductItem/index.ts +1 -0
- package/src/components/search/SearchSuggestions/SearchSuggestions.tsx +27 -79
- package/src/components/search/search.module.scss +9 -80
- package/.next/BUILD_ID +0 -1
- package/.next/build-manifest.json +0 -103
- package/.next/cache/.tsbuildinfo +0 -1
- package/.next/cache/config.json +0 -7
- package/.next/cache/eslint/.cache_1gneedd +0 -1
- package/.next/cache/next-server.js.nft.json +0 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/export-marker.json +0 -1
- package/.next/images-manifest.json +0 -1
- package/.next/next-server.js.nft.json +0 -1
- package/.next/package.json +0 -1
- package/.next/prerender-manifest.json +0 -1
- package/.next/react-loadable-manifest.json +0 -50
- package/.next/required-server-files.json +0 -1
- package/.next/routes-manifest.json +0 -1
- package/.next/server/chunks/104.js +0 -196
- package/.next/server/chunks/143.js +0 -106
- package/.next/server/chunks/154.js +0 -201
- package/.next/server/chunks/183.js +0 -72
- package/.next/server/chunks/247.js +0 -61
- package/.next/server/chunks/264.js +0 -67
- package/.next/server/chunks/280.js +0 -417
- package/.next/server/chunks/287.js +0 -79
- package/.next/server/chunks/307.js +0 -109
- package/.next/server/chunks/312.js +0 -708
- package/.next/server/chunks/317.js +0 -126
- package/.next/server/chunks/350.js +0 -120
- package/.next/server/chunks/371.js +0 -1467
- package/.next/server/chunks/377.js +0 -82
- package/.next/server/chunks/394.js +0 -3801
- package/.next/server/chunks/439.js +0 -175
- package/.next/server/chunks/444.js +0 -464
- package/.next/server/chunks/465.js +0 -91
- package/.next/server/chunks/576.js +0 -72
- package/.next/server/chunks/650.js +0 -216
- package/.next/server/chunks/664.js +0 -124
- package/.next/server/chunks/676.js +0 -32
- package/.next/server/chunks/732.js +0 -51
- package/.next/server/chunks/746.js +0 -237
- package/.next/server/chunks/849.js +0 -665
- package/.next/server/chunks/854.js +0 -72
- package/.next/server/chunks/859.js +0 -959
- package/.next/server/chunks/872.js +0 -378
- package/.next/server/chunks/881.js +0 -320
- package/.next/server/chunks/898.js +0 -240
- package/.next/server/chunks/914.js +0 -96
- package/.next/server/chunks/953.js +0 -673
- package/.next/server/chunks/98.js +0 -266
- package/.next/server/chunks/992.js +0 -562
- package/.next/server/chunks/font-manifest.json +0 -1
- package/.next/server/font-manifest.json +0 -1
- package/.next/server/middleware-build-manifest.js +0 -1
- package/.next/server/middleware-manifest.json +0 -6
- package/.next/server/middleware-react-loadable-manifest.js +0 -1
- package/.next/server/pages/404.js.nft.json +0 -1
- package/.next/server/pages/500.js.nft.json +0 -1
- package/.next/server/pages/[...slug].js +0 -609
- package/.next/server/pages/[...slug].js.nft.json +0 -1
- package/.next/server/pages/[slug]/p.js +0 -2560
- package/.next/server/pages/[slug]/p.js.nft.json +0 -1
- package/.next/server/pages/_app.js +0 -2041
- package/.next/server/pages/_app.js.nft.json +0 -1
- package/.next/server/pages/_document.js +0 -304
- package/.next/server/pages/_document.js.nft.json +0 -1
- package/.next/server/pages/_error.js +0 -164
- package/.next/server/pages/_error.js.nft.json +0 -1
- package/.next/server/pages/account.js.nft.json +0 -1
- package/.next/server/pages/api/graphql.js +0 -259
- package/.next/server/pages/api/graphql.js.nft.json +0 -1
- package/.next/server/pages/api/preview.js +0 -118
- package/.next/server/pages/api/preview.js.nft.json +0 -1
- package/.next/server/pages/checkout.js.nft.json +0 -1
- package/.next/server/pages/en-US/404.html +0 -81
- package/.next/server/pages/en-US/500.html +0 -81
- package/.next/server/pages/en-US/account.html +0 -81
- package/.next/server/pages/en-US/checkout.html +0 -81
- package/.next/server/pages/en-US/login.html +0 -81
- package/.next/server/pages/en-US/s.html +0 -81
- package/.next/server/pages/en-US.html +0 -81
- package/.next/server/pages/en-US.json +0 -1
- package/.next/server/pages/index.js +0 -407
- package/.next/server/pages/index.js.nft.json +0 -1
- package/.next/server/pages/login.js.nft.json +0 -1
- package/.next/server/pages/s.js.nft.json +0 -1
- package/.next/server/pages-manifest.json +0 -16
- package/.next/server/webpack-api-runtime.js +0 -229
- package/.next/server/webpack-runtime.js +0 -229
- package/.next/static/M7OQ7A7JAyTrgvf0m1Ztu/_buildManifest.js +0 -1
- package/.next/static/M7OQ7A7JAyTrgvf0m1Ztu/_ssgManifest.js +0 -1
- package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
- package/.next/static/chunks/153-a20e3f2da180607e.js +0 -1
- package/.next/static/chunks/260-994385416f68673d.js +0 -1
- package/.next/static/chunks/307.10facde65af3066a.js +0 -1
- package/.next/static/chunks/337-4b719ca7a86d8d8c.js +0 -1
- package/.next/static/chunks/351-a4e28d64f48c5269.js +0 -1
- package/.next/static/chunks/588.591fb3bf1a136c66.js +0 -1
- package/.next/static/chunks/650.807852d1c36bfe44.js +0 -1
- package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
- package/.next/static/chunks/686.36adeba271636edd.js +0 -1
- package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
- package/.next/static/chunks/791.e9be2b77d132c1b1.js +0 -1
- package/.next/static/chunks/817-728f854c2948afc0.js +0 -1
- package/.next/static/chunks/953.77a48c854f628dcf.js +0 -1
- package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
- package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
- package/.next/static/chunks/main-9746772201fe3ac1.js +0 -1
- package/.next/static/chunks/pages/404-ba608a2a9f0c420a.js +0 -1
- package/.next/static/chunks/pages/500-910883c20541d9ce.js +0 -1
- package/.next/static/chunks/pages/[...slug]-9443b18a60d89746.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-cb8ef12f6449cf26.js +0 -1
- package/.next/static/chunks/pages/_app-286bcfa03a5e17a7.js +0 -1
- package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
- package/.next/static/chunks/pages/account-f19102933e6fd84c.js +0 -1
- package/.next/static/chunks/pages/checkout-f8cb7cb22225ef9d.js +0 -1
- package/.next/static/chunks/pages/index-6717326cc207d674.js +0 -1
- package/.next/static/chunks/pages/login-0b9ea80d9fa0f91b.js +0 -1
- package/.next/static/chunks/pages/s-86fe1e3303388123.js +0 -1
- package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
- package/.next/static/chunks/webpack-8f397ae160440a8e.js +0 -1
- package/.next/static/css/430b8cafbf7c23c1.css +0 -1
- package/.next/static/css/43d61b402f41569b.css +0 -1
- package/.next/static/css/4d7e7f156483493d.css +0 -1
- package/.next/static/css/6507cb48401e73a4.css +0 -1
- package/.next/static/css/9dd1d1084d254c66.css +0 -1
- package/.next/static/css/b2f16bd4b93e0aca.css +0 -1
- package/.next/static/css/bd743407c8049677.css +0 -1
- package/.next/static/css/d78f4c5305f398ac.css +0 -1
- package/.next/static/css/e1c24beb73906eed.css +0 -1
- package/.next/static/css/e63697a078fd522e.css +0 -1
- package/.next/static/media/brandless-neutral.76ddf63a.png +0 -0
- package/.next/trace +0 -64
- package/public/~partytown/debug/partytown-atomics.js +0 -556
- package/public/~partytown/debug/partytown-media.js +0 -374
- package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
- package/public/~partytown/debug/partytown-sw.js +0 -59
- package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
- package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
- package/public/~partytown/debug/partytown.js +0 -72
- package/public/~partytown/partytown-atomics.js +0 -2
- package/public/~partytown/partytown-media.js +0 -2
- package/public/~partytown/partytown-sw.js +0 -2
- package/public/~partytown/partytown.js +0 -2
- package/src/components/search/SearchHistory/SearchHistory.stories.mdx +0 -54
- package/src/components/search/SearchProductCard/SearchProductCard.stories.mdx +0 -95
- package/src/components/search/SearchProductCard/index.ts +0 -1
- package/src/components/search/SearchSuggestions/SearchSuggestions.stories.mdx +0 -58
- package/src/components/search/SearchTop/SearchTop.stories.mdx +0 -57
package/.turbo/turbo-build.log
CHANGED
|
@@ -40,9 +40,9 @@ Route (pages) Size First Load JS
|
|
|
40
40
|
+ First Load JS shared by all 120 kB
|
|
41
41
|
├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
|
|
42
42
|
├ chunks/main-9746772201fe3ac1.js 23.9 kB
|
|
43
|
-
├ chunks/pages/_app-
|
|
44
|
-
├ chunks/webpack-
|
|
45
|
-
└ css/
|
|
43
|
+
├ chunks/pages/_app-9cc7312632f19e94.js 28.9 kB
|
|
44
|
+
├ chunks/webpack-499a79772d3ef1c5.js 2.22 kB
|
|
45
|
+
└ css/14ebc84fc6d6c80c.css 19.9 kB
|
|
46
46
|
|
|
47
47
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
|
48
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.76-alpha.0](https://github.com/vtex/faststore/compare/v2.0.75-alpha.0...v2.0.76-alpha.0) (2023-03-15)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Adds missing test id ([#1666](https://github.com/vtex/faststore/issues/1666)) ([470584d](https://github.com/vtex/faststore/commit/470584d7a7213742bc7d9fbcf9e52e28c6595676)), closes [/github.com/vtex/faststore/pull/1649/files#diff-bc55adb273e27dfb220da8699e7463fac6bc3e1292439e1fa7530e09e9a6d009](https://github.com/vtex//github.com/vtex/faststore/pull/1649/files/issues/diff-bc55adb273e27dfb220da8699e7463fac6bc3e1292439e1fa7530e09e9a6d009)
|
|
11
|
+
|
|
12
|
+
## [2.0.75-alpha.0](https://github.com/vtex/faststore/compare/v2.0.74-alpha.0...v2.0.75-alpha.0) (2023-03-15)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- Add `SearchSuggestions` components ([#1654](https://github.com/vtex/faststore/issues/1654)) ([5dc8077](https://github.com/vtex/faststore/commit/5dc8077421267af882d22e85ddbbb8eacf807690))
|
|
17
|
+
|
|
6
18
|
## 2.0.74-alpha.0 (2023-03-15)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.76-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.
|
|
33
|
+
"@faststore/components": "^2.0.75-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.
|
|
36
|
+
"@faststore/ui": "^2.0.75-alpha.0",
|
|
37
37
|
"@types/react": "^18.0.14",
|
|
38
38
|
"@vtex/client-cms": "^0.2.12",
|
|
39
39
|
"autoprefixer": "^10.4.0",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"msw": {
|
|
108
108
|
"workerDirectory": "public"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "40b59fd76d0d908980ff4d4b655a858dc3c61a59"
|
|
111
111
|
}
|
|
@@ -72,7 +72,11 @@ function CartSidebar() {
|
|
|
72
72
|
className={styles.fsCartSidebar}
|
|
73
73
|
onTransitionEnd={() => fade === 'out' && closeCart()}
|
|
74
74
|
>
|
|
75
|
-
<UISlideOverHeader
|
|
75
|
+
<UISlideOverHeader
|
|
76
|
+
closeBtnProps={closeBtnProps}
|
|
77
|
+
onClose={fadeOut}
|
|
78
|
+
data-testid="cart-sidebar"
|
|
79
|
+
>
|
|
76
80
|
<div data-fs-cart-sidebar-title>
|
|
77
81
|
<p data-fs-cart-sidebar-title-text className="text__lead">
|
|
78
82
|
Your Cart
|
|
@@ -26,7 +26,8 @@ import {
|
|
|
26
26
|
import type { SearchInputContextValue } from 'src/sdk/search/useSearchInput'
|
|
27
27
|
import useOnClickOutside from 'src/sdk/ui/useOnClickOutside'
|
|
28
28
|
|
|
29
|
-
import
|
|
29
|
+
import inputStyles from './search-input.module.scss'
|
|
30
|
+
import styles from '../search.module.scss'
|
|
30
31
|
|
|
31
32
|
const SearchDropdown = lazy(
|
|
32
33
|
() => import('src/components/search/SearchDropdown')
|
|
@@ -84,7 +85,7 @@ const SearchInput = forwardRef<SearchInputRef, SearchInputProps>(
|
|
|
84
85
|
<div
|
|
85
86
|
ref={searchRef}
|
|
86
87
|
data-fs-search-input-wrapper
|
|
87
|
-
className={
|
|
88
|
+
className={inputStyles.fsSearchInput}
|
|
88
89
|
data-fs-search-input-dropdown-visible={searchDropdownVisible}
|
|
89
90
|
style={containerStyle}
|
|
90
91
|
>
|
|
@@ -114,7 +115,10 @@ const SearchInput = forwardRef<SearchInputRef, SearchInputProps>(
|
|
|
114
115
|
|
|
115
116
|
{searchDropdownVisible && (
|
|
116
117
|
<Suspense fallback={null}>
|
|
117
|
-
<div
|
|
118
|
+
<div
|
|
119
|
+
data-fs-search-input-dropdown-wrapper
|
|
120
|
+
className={styles.fsSearch}
|
|
121
|
+
>
|
|
118
122
|
<SearchDropdown term={searchQueryDeferred} />
|
|
119
123
|
</div>
|
|
120
124
|
</Suspense>
|
|
@@ -134,13 +134,5 @@
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
[data-fs-search-input-loading-text] { padding: var(--fs-spacing-3); }
|
|
137
|
-
|
|
138
|
-
[data-fs-search-section] {
|
|
139
|
-
border-bottom: var(--fs-border-width) solid var(--fs-border-color-light);
|
|
140
|
-
|
|
141
|
-
&:last-child {
|
|
142
|
-
border-bottom-width: 0;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
137
|
}
|
|
146
138
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
SearchProductItem as UISearchProductItem,
|
|
3
|
+
SearchProductItemContent as UISearchProductItemContent,
|
|
4
|
+
SearchProductItemImage as UISearchProductItemImage,
|
|
5
5
|
} from '@faststore/ui'
|
|
6
6
|
|
|
7
7
|
import { Image } from 'src/components/ui/Image'
|
|
@@ -10,9 +10,9 @@ import { useProductLink } from 'src/sdk/product/useProductLink'
|
|
|
10
10
|
import useSearchInput from 'src/sdk/search/useSearchInput'
|
|
11
11
|
import type { ProductSummary_ProductFragment } from '@generated/graphql'
|
|
12
12
|
|
|
13
|
-
type
|
|
13
|
+
type SearchProductItemProps = {
|
|
14
14
|
/**
|
|
15
|
-
* Product to be showed in `
|
|
15
|
+
* Product to be showed in `SearchProductItem`.
|
|
16
16
|
*/
|
|
17
17
|
product: ProductSummary_ProductFragment
|
|
18
18
|
/**
|
|
@@ -21,13 +21,14 @@ type SearchProductCardProps = {
|
|
|
21
21
|
index: number
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function
|
|
24
|
+
function SearchProductItem({
|
|
25
25
|
product,
|
|
26
26
|
index,
|
|
27
27
|
...otherProps
|
|
28
|
-
}:
|
|
28
|
+
}: SearchProductItemProps) {
|
|
29
29
|
const { onSearchInputSelection } = useSearchInput()
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
const { href, onClick, ...baseLinkProps } = useProductLink({
|
|
31
32
|
product,
|
|
32
33
|
selectedOffer: 0,
|
|
33
34
|
index,
|
|
@@ -42,28 +43,30 @@ function SearchProductCard({
|
|
|
42
43
|
},
|
|
43
44
|
} = product
|
|
44
45
|
|
|
46
|
+
const linkProps = {
|
|
47
|
+
href,
|
|
48
|
+
onClick: () => {
|
|
49
|
+
onClick()
|
|
50
|
+
onSearchInputSelection?.(name, href)
|
|
51
|
+
},
|
|
52
|
+
...baseLinkProps,
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
return (
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
onLinkClick={() => {
|
|
49
|
-
linkProps.onClick
|
|
50
|
-
onSearchInputSelection?.(name, linkProps.href)
|
|
51
|
-
}}
|
|
52
|
-
{...otherProps}
|
|
53
|
-
>
|
|
54
|
-
<UISearchProductCardImage>
|
|
56
|
+
<UISearchProductItem linkProps={linkProps} {...otherProps}>
|
|
57
|
+
<UISearchProductItemImage>
|
|
55
58
|
<Image src={img.url} alt={img.alternateName} width={56} height={56} />
|
|
56
|
-
</
|
|
57
|
-
<
|
|
59
|
+
</UISearchProductItemImage>
|
|
60
|
+
<UISearchProductItemContent
|
|
58
61
|
title={name}
|
|
59
62
|
price={{
|
|
60
63
|
value: spotPrice,
|
|
61
64
|
listPrice: listPrice,
|
|
62
65
|
formatter: useFormattedPrice,
|
|
63
66
|
}}
|
|
64
|
-
></
|
|
65
|
-
</
|
|
67
|
+
></UISearchProductItemContent>
|
|
68
|
+
</UISearchProductItem>
|
|
66
69
|
)
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
export default
|
|
72
|
+
export default SearchProductItem
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SearchProductItem'
|
|
@@ -1,58 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
SearchAutoComplete as UISearchAutoComplete,
|
|
3
|
+
SearchAutoCompleteTerm as UISearchAutoCompleteTerm,
|
|
4
|
+
SearchProducts,
|
|
5
|
+
} from '@faststore/ui'
|
|
2
6
|
import type { HTMLAttributes } from 'react'
|
|
3
|
-
import { Fragment } from 'react'
|
|
4
7
|
|
|
5
|
-
import
|
|
6
|
-
import Icon from 'src/components/ui/Icon'
|
|
7
|
-
import Link from 'src/components/ui/Link'
|
|
8
|
+
import SearchProductItem from 'src/components/search/SearchProductItem'
|
|
8
9
|
import useSearchInput, { formatSearchPath } from 'src/sdk/search/useSearchInput'
|
|
9
10
|
import type { ProductSummary_ProductFragment } from '@generated/graphql'
|
|
10
11
|
|
|
11
12
|
import styles from '../search.module.scss'
|
|
12
13
|
|
|
13
|
-
function formatSearchTerm(
|
|
14
|
-
indexSubstring: number,
|
|
15
|
-
searchTerm: string,
|
|
16
|
-
suggestion: string
|
|
17
|
-
) {
|
|
18
|
-
if (indexSubstring === 0) {
|
|
19
|
-
return searchTerm
|
|
20
|
-
.split('')
|
|
21
|
-
.map((char, idx) =>
|
|
22
|
-
idx === 0 && suggestion.indexOf(char.toUpperCase()) === 0
|
|
23
|
-
? char.toUpperCase()
|
|
24
|
-
: char.toLowerCase()
|
|
25
|
-
)
|
|
26
|
-
.join('')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return searchTerm.toLowerCase()
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function handleSuggestions(suggestion: string, searchTerm: string) {
|
|
33
|
-
const suggestionSubstring = suggestion
|
|
34
|
-
.toLowerCase()
|
|
35
|
-
.split(searchTerm.toLowerCase())
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<p>
|
|
39
|
-
{suggestionSubstring.map((substring, indexSubstring) => (
|
|
40
|
-
<Fragment key={[substring, indexSubstring].join()}>
|
|
41
|
-
{substring.length > 0 && (
|
|
42
|
-
<b data-fs-search-item-bold>
|
|
43
|
-
{indexSubstring === 0
|
|
44
|
-
? substring.charAt(0).toUpperCase() + substring.slice(1)
|
|
45
|
-
: substring}
|
|
46
|
-
</b>
|
|
47
|
-
)}
|
|
48
|
-
{indexSubstring !== suggestionSubstring.length - 1 &&
|
|
49
|
-
formatSearchTerm(indexSubstring, searchTerm, suggestion)}
|
|
50
|
-
</Fragment>
|
|
51
|
-
))}
|
|
52
|
-
</p>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
14
|
export interface SearchSuggestionsProps extends HTMLAttributes<HTMLDivElement> {
|
|
57
15
|
/**
|
|
58
16
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
@@ -89,45 +47,35 @@ function SearchSuggestions({
|
|
|
89
47
|
{...otherProps}
|
|
90
48
|
>
|
|
91
49
|
{terms.length > 0 && (
|
|
92
|
-
<
|
|
50
|
+
<UISearchAutoComplete data-fs-search-section>
|
|
93
51
|
{terms?.map(({ value: suggestion }) => (
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
52
|
+
<UISearchAutoCompleteTerm
|
|
53
|
+
key={suggestion}
|
|
54
|
+
term={term}
|
|
55
|
+
suggestion={suggestion}
|
|
56
|
+
linkProps={{
|
|
57
|
+
href: formatSearchPath(suggestion),
|
|
58
|
+
onClick: () =>
|
|
99
59
|
onSearchInputSelection?.(
|
|
100
60
|
suggestion,
|
|
101
61
|
formatSearchPath(suggestion)
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<Icon
|
|
106
|
-
name="MagnifyingGlass"
|
|
107
|
-
width={18}
|
|
108
|
-
height={18}
|
|
109
|
-
data-fs-search-item-icon
|
|
110
|
-
/>
|
|
111
|
-
{handleSuggestions(suggestion, term)}
|
|
112
|
-
</Link>
|
|
113
|
-
</li>
|
|
62
|
+
),
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
114
65
|
))}
|
|
115
|
-
</
|
|
66
|
+
</UISearchAutoComplete>
|
|
116
67
|
)}
|
|
117
68
|
|
|
118
69
|
{products.length > 0 && (
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
))}
|
|
129
|
-
</UIList>
|
|
130
|
-
</div>
|
|
70
|
+
<SearchProducts data-fs-search-section>
|
|
71
|
+
{products.map((product, index) => (
|
|
72
|
+
<SearchProductItem
|
|
73
|
+
key={product.id}
|
|
74
|
+
product={product}
|
|
75
|
+
index={index}
|
|
76
|
+
/>
|
|
77
|
+
))}
|
|
78
|
+
</SearchProducts>
|
|
131
79
|
)}
|
|
132
80
|
</section>
|
|
133
81
|
)
|
|
@@ -2,89 +2,18 @@
|
|
|
2
2
|
// --------------------------------------------------------
|
|
3
3
|
// Design Tokens for Search
|
|
4
4
|
// --------------------------------------------------------
|
|
5
|
-
--fs-search-
|
|
5
|
+
--fs-search-border-bottom-width : var(--fs-border-width);
|
|
6
|
+
--fs-search-border-bottom-color : var(--fs-border-color-light);
|
|
6
7
|
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// Link
|
|
12
|
-
--fs-search-item-link-color : var(--fs-color-text-light);
|
|
13
|
-
--fs-search-item-link-padding-right : var(--fs-spacing-3);
|
|
14
|
-
--fs-search-item-link-padding-left : var(--fs-search-item-link-padding-right);
|
|
15
|
-
|
|
16
|
-
// Item
|
|
17
|
-
--fs-search-item-text-size : var(--fs-text-size-2);
|
|
18
|
-
--fs-search-item-line-height : 1.25;
|
|
19
|
-
--fs-search-item-bkg-color-hover : var(--fs-color-tertiary-bkg-hover);
|
|
20
|
-
|
|
21
|
-
// Icon
|
|
22
|
-
--fs-search-item-icon-color : var(--fs-color-neutral-4);
|
|
23
|
-
--fs-search-item-icon-margin-right : var(--fs-spacing-1);
|
|
24
|
-
|
|
25
|
-
// Badge
|
|
26
|
-
--fs-search-badge-margin-right : var(--fs-spacing-1);
|
|
27
|
-
|
|
28
|
-
// Default properties
|
|
29
|
-
[data-fs-search-header] {
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
justify-content: space-between;
|
|
33
|
-
min-height: var(--fs-search-min-height);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
[data-fs-search-title] {
|
|
37
|
-
font-size: var(--fs-search-title-size);
|
|
38
|
-
line-height: var(--fs-search-title-line-height);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
[data-fs-search-item-link] {
|
|
42
|
-
color: var(--fs-search-item-link-color);
|
|
43
|
-
|
|
44
|
-
> span {
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
text-overflow: ellipsis;
|
|
47
|
-
white-space: nowrap;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
[data-fs-search-item] {
|
|
52
|
-
margin-right: calc(-1 * var(--fs-search-item-link-padding-right));
|
|
53
|
-
margin-left: calc(-1 * var(--fs-search-item-link-padding-right));
|
|
54
|
-
font-size: var(--fs-search-item-text-size);
|
|
55
|
-
line-height: var(--fs-search-item-line-height);
|
|
56
|
-
|
|
57
|
-
&:hover {
|
|
58
|
-
background-color: var(--fs-search-item-bkg-color-hover);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
[data-fs-search-product-card-link], [data-fs-search-item-link] {
|
|
62
|
-
display: flex;
|
|
63
|
-
align-items: center;
|
|
64
|
-
justify-content: flex-start;
|
|
65
|
-
padding-left: var(--fs-search-item-link-padding-left);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
[data-fs-search-item-link] {
|
|
69
|
-
margin-right: var(--fs-search-item-link-padding-right);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
[data-fs-search-badge] {
|
|
73
|
-
margin-right: var(--fs-search-badge-margin-right);
|
|
74
|
-
}
|
|
8
|
+
// --------------------------------------------------------
|
|
9
|
+
// Structural Styles
|
|
10
|
+
// --------------------------------------------------------
|
|
75
11
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
flex-shrink: 0;
|
|
79
|
-
margin-right: var(--fs-search-item-icon-margin-right);
|
|
80
|
-
color: var(--fs-search-item-icon-color);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
12
|
+
[data-fs-search-section] {
|
|
13
|
+
border-bottom: var(--fs-search-border-bottom-width) solid var(--fs-search-border-bottom-color);
|
|
83
14
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
font-weight: var(--fs-text-weight-bold);
|
|
87
|
-
color: var(--fs-color-neutral-7);
|
|
15
|
+
&:last-child {
|
|
16
|
+
border-bottom-width: 0;
|
|
88
17
|
}
|
|
89
18
|
}
|
|
90
19
|
}
|
package/.next/BUILD_ID
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
M7OQ7A7JAyTrgvf0m1Ztu
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"polyfillFiles": [
|
|
3
|
-
"static/chunks/polyfills-c67a75d1b6f99dc8.js"
|
|
4
|
-
],
|
|
5
|
-
"devFiles": [],
|
|
6
|
-
"ampDevFiles": [],
|
|
7
|
-
"lowPriorityFiles": [
|
|
8
|
-
"static/M7OQ7A7JAyTrgvf0m1Ztu/_buildManifest.js",
|
|
9
|
-
"static/M7OQ7A7JAyTrgvf0m1Ztu/_ssgManifest.js"
|
|
10
|
-
],
|
|
11
|
-
"rootMainFiles": [],
|
|
12
|
-
"pages": {
|
|
13
|
-
"/": [
|
|
14
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
15
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
16
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
17
|
-
"static/chunks/351-a4e28d64f48c5269.js",
|
|
18
|
-
"static/chunks/260-994385416f68673d.js",
|
|
19
|
-
"static/chunks/817-728f854c2948afc0.js",
|
|
20
|
-
"static/css/43d61b402f41569b.css",
|
|
21
|
-
"static/chunks/pages/index-6717326cc207d674.js"
|
|
22
|
-
],
|
|
23
|
-
"/404": [
|
|
24
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
25
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
26
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
27
|
-
"static/chunks/351-a4e28d64f48c5269.js",
|
|
28
|
-
"static/chunks/pages/404-ba608a2a9f0c420a.js"
|
|
29
|
-
],
|
|
30
|
-
"/500": [
|
|
31
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
32
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
33
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
34
|
-
"static/chunks/351-a4e28d64f48c5269.js",
|
|
35
|
-
"static/chunks/pages/500-910883c20541d9ce.js"
|
|
36
|
-
],
|
|
37
|
-
"/[...slug]": [
|
|
38
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
39
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
40
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
41
|
-
"static/chunks/351-a4e28d64f48c5269.js",
|
|
42
|
-
"static/chunks/260-994385416f68673d.js",
|
|
43
|
-
"static/chunks/337-4b719ca7a86d8d8c.js",
|
|
44
|
-
"static/css/430b8cafbf7c23c1.css",
|
|
45
|
-
"static/chunks/pages/[...slug]-9443b18a60d89746.js"
|
|
46
|
-
],
|
|
47
|
-
"/[slug]/p": [
|
|
48
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
49
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
50
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
51
|
-
"static/chunks/351-a4e28d64f48c5269.js",
|
|
52
|
-
"static/chunks/260-994385416f68673d.js",
|
|
53
|
-
"static/chunks/817-728f854c2948afc0.js",
|
|
54
|
-
"static/css/e63697a078fd522e.css",
|
|
55
|
-
"static/chunks/pages/[slug]/p-cb8ef12f6449cf26.js"
|
|
56
|
-
],
|
|
57
|
-
"/_app": [
|
|
58
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
59
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
60
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
61
|
-
"static/css/d78f4c5305f398ac.css",
|
|
62
|
-
"static/chunks/pages/_app-286bcfa03a5e17a7.js"
|
|
63
|
-
],
|
|
64
|
-
"/_error": [
|
|
65
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
66
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
67
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
68
|
-
"static/chunks/pages/_error-a7a0c1d9bfbb4f38.js"
|
|
69
|
-
],
|
|
70
|
-
"/account": [
|
|
71
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
72
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
73
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
74
|
-
"static/chunks/351-a4e28d64f48c5269.js",
|
|
75
|
-
"static/chunks/pages/account-f19102933e6fd84c.js"
|
|
76
|
-
],
|
|
77
|
-
"/checkout": [
|
|
78
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
79
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
80
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
81
|
-
"static/chunks/351-a4e28d64f48c5269.js",
|
|
82
|
-
"static/chunks/pages/checkout-f8cb7cb22225ef9d.js"
|
|
83
|
-
],
|
|
84
|
-
"/login": [
|
|
85
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
86
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
87
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
88
|
-
"static/chunks/351-a4e28d64f48c5269.js",
|
|
89
|
-
"static/chunks/pages/login-0b9ea80d9fa0f91b.js"
|
|
90
|
-
],
|
|
91
|
-
"/s": [
|
|
92
|
-
"static/chunks/webpack-8f397ae160440a8e.js",
|
|
93
|
-
"static/chunks/framework-dfd14d7ce6600b03.js",
|
|
94
|
-
"static/chunks/main-9746772201fe3ac1.js",
|
|
95
|
-
"static/chunks/351-a4e28d64f48c5269.js",
|
|
96
|
-
"static/chunks/153-a20e3f2da180607e.js",
|
|
97
|
-
"static/chunks/337-4b719ca7a86d8d8c.js",
|
|
98
|
-
"static/css/9dd1d1084d254c66.css",
|
|
99
|
-
"static/chunks/pages/s-86fe1e3303388123.js"
|
|
100
|
-
]
|
|
101
|
-
},
|
|
102
|
-
"ampFirstPages": []
|
|
103
|
-
}
|