@faststore/components 2.0.74-alpha.0 → 2.0.78-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/dist/assets/ClockClockwise.js +4 -4
- package/dist/assets/ClockClockwise.js.map +1 -1
- package/dist/assets/FadersHorizontal.d.ts +3 -0
- package/dist/assets/FadersHorizontal.js +12 -0
- package/dist/assets/FadersHorizontal.js.map +1 -0
- package/dist/assets/MagnifyingGlass.d.ts +3 -0
- package/dist/assets/MagnifyingGlass.js +8 -0
- package/dist/assets/MagnifyingGlass.js.map +1 -0
- package/dist/assets/TagIcon.js +1 -1
- package/dist/assets/TagIcon.js.map +1 -1
- package/dist/assets/index.d.ts +2 -0
- package/dist/assets/index.js +2 -0
- package/dist/assets/index.js.map +1 -1
- package/dist/hooks/UIProvider.d.ts +1 -1
- package/dist/hooks/UIProvider.js +1 -2
- package/dist/hooks/UIProvider.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/molecules/SearchAutoComplete/SearchAutoComplete.d.ts +9 -0
- package/dist/molecules/SearchAutoComplete/SearchAutoComplete.js +8 -0
- package/dist/molecules/SearchAutoComplete/SearchAutoComplete.js.map +1 -0
- package/dist/molecules/SearchAutoComplete/SearchAutoCompleteTerm.d.ts +27 -0
- package/dist/molecules/SearchAutoComplete/SearchAutoCompleteTerm.js +28 -0
- package/dist/molecules/SearchAutoComplete/SearchAutoCompleteTerm.js.map +1 -0
- package/dist/molecules/SearchAutoComplete/index.d.ts +4 -0
- package/dist/molecules/SearchAutoComplete/index.js +3 -0
- package/dist/molecules/SearchAutoComplete/index.js.map +1 -0
- package/dist/molecules/SearchProducts/SearchProductItem.d.ts +16 -0
- package/dist/molecules/SearchProducts/SearchProductItem.js +8 -0
- package/dist/molecules/SearchProducts/SearchProductItem.js.map +1 -0
- package/dist/molecules/{SearchProductCard/SearchProductCardContent.d.ts → SearchProducts/SearchProductItemContent.d.ts} +4 -4
- package/dist/molecules/{SearchProductCard/SearchProductCardContent.js → SearchProducts/SearchProductItemContent.js} +7 -7
- package/dist/molecules/SearchProducts/SearchProductItemContent.js.map +1 -0
- package/dist/molecules/{SearchProductCard/SearchProductCardImage.d.ts → SearchProducts/SearchProductItemImage.d.ts} +3 -3
- package/dist/molecules/SearchProducts/SearchProductItemImage.js +6 -0
- package/dist/molecules/SearchProducts/SearchProductItemImage.js.map +1 -0
- package/dist/molecules/SearchProducts/SearchProducts.d.ts +13 -0
- package/dist/molecules/SearchProducts/SearchProducts.js +10 -0
- package/dist/molecules/SearchProducts/SearchProducts.js.map +1 -0
- package/dist/molecules/SearchProducts/index.d.ts +8 -0
- package/dist/molecules/SearchProducts/index.js +5 -0
- package/dist/molecules/SearchProducts/index.js.map +1 -0
- package/package.json +2 -2
- package/src/assets/ClockClockwise.tsx +12 -12
- package/src/assets/FadersHorizontal.tsx +84 -0
- package/src/assets/MagnifyingGlass.tsx +39 -0
- package/src/assets/TagIcon.tsx +2 -2
- package/src/assets/index.ts +2 -0
- package/src/hooks/UIProvider.tsx +2 -3
- package/src/index.ts +18 -8
- package/src/molecules/SearchAutoComplete/SearchAutoComplete.tsx +24 -0
- package/src/molecules/SearchAutoComplete/SearchAutoCompleteTerm.tsx +92 -0
- package/src/molecules/SearchAutoComplete/index.ts +5 -0
- package/src/molecules/SearchProducts/SearchProductItem.tsx +34 -0
- package/src/molecules/{SearchProductCard/SearchProductCardContent.tsx → SearchProducts/SearchProductItemContent.tsx} +9 -9
- package/src/molecules/{SearchProductCard/SearchProductCardImage.tsx → SearchProducts/SearchProductItemImage.tsx} +7 -7
- package/src/molecules/SearchProducts/SearchProducts.tsx +31 -0
- package/src/molecules/SearchProducts/index.ts +11 -0
- package/dist/molecules/SearchProductCard/SearchProductCard.d.ts +0 -20
- package/dist/molecules/SearchProductCard/SearchProductCard.js +0 -8
- package/dist/molecules/SearchProductCard/SearchProductCard.js.map +0 -1
- package/dist/molecules/SearchProductCard/SearchProductCardContent.js.map +0 -1
- package/dist/molecules/SearchProductCard/SearchProductCardImage.js +0 -6
- package/dist/molecules/SearchProductCard/SearchProductCardImage.js.map +0 -1
- package/dist/molecules/SearchProductCard/index.d.ts +0 -6
- package/dist/molecules/SearchProductCard/index.js +0 -4
- package/dist/molecules/SearchProductCard/index.js.map +0 -1
- package/src/molecules/SearchProductCard/SearchProductCard.tsx +0 -54
- package/src/molecules/SearchProductCard/index.ts +0 -8
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { FC } from 'react'
|
|
3
|
+
|
|
4
|
+
// Icon from Phosphor Icons
|
|
5
|
+
const FadersHorizontal: FC = () => (
|
|
6
|
+
<svg
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
fill="currentColor"
|
|
9
|
+
viewBox="0 0 256 256"
|
|
10
|
+
strokeWidth="16"
|
|
11
|
+
width={24}
|
|
12
|
+
height={24}
|
|
13
|
+
>
|
|
14
|
+
<rect width="256" height="256" fill="none"></rect>
|
|
15
|
+
<line
|
|
16
|
+
x1="136"
|
|
17
|
+
y1="172"
|
|
18
|
+
x2="40"
|
|
19
|
+
y2="172"
|
|
20
|
+
fill="none"
|
|
21
|
+
stroke="currentColor"
|
|
22
|
+
strokeLinecap="round"
|
|
23
|
+
strokeLinejoin="round"
|
|
24
|
+
strokeWidth="16"
|
|
25
|
+
></line>
|
|
26
|
+
<line
|
|
27
|
+
x1="216"
|
|
28
|
+
y1="172"
|
|
29
|
+
x2="168"
|
|
30
|
+
y2="172"
|
|
31
|
+
fill="none"
|
|
32
|
+
stroke="currentColor"
|
|
33
|
+
strokeLinecap="round"
|
|
34
|
+
strokeLinejoin="round"
|
|
35
|
+
strokeWidth="16"
|
|
36
|
+
></line>
|
|
37
|
+
<line
|
|
38
|
+
x1="72"
|
|
39
|
+
y1="84"
|
|
40
|
+
x2="40"
|
|
41
|
+
y2="84"
|
|
42
|
+
fill="none"
|
|
43
|
+
stroke="currentColor"
|
|
44
|
+
strokeLinecap="round"
|
|
45
|
+
strokeLinejoin="round"
|
|
46
|
+
strokeWidth="16"
|
|
47
|
+
></line>
|
|
48
|
+
<line
|
|
49
|
+
x1="216"
|
|
50
|
+
y1="84"
|
|
51
|
+
x2="104"
|
|
52
|
+
y2="84"
|
|
53
|
+
fill="none"
|
|
54
|
+
stroke="currentColor"
|
|
55
|
+
strokeLinecap="round"
|
|
56
|
+
strokeLinejoin="round"
|
|
57
|
+
strokeWidth="16"
|
|
58
|
+
></line>
|
|
59
|
+
<line
|
|
60
|
+
x1="104"
|
|
61
|
+
y1="60"
|
|
62
|
+
x2="104"
|
|
63
|
+
y2="108"
|
|
64
|
+
fill="none"
|
|
65
|
+
stroke="currentColor"
|
|
66
|
+
strokeLinecap="round"
|
|
67
|
+
strokeLinejoin="round"
|
|
68
|
+
strokeWidth="16"
|
|
69
|
+
></line>
|
|
70
|
+
<line
|
|
71
|
+
x1="168"
|
|
72
|
+
y1="196"
|
|
73
|
+
x2="168"
|
|
74
|
+
y2="148"
|
|
75
|
+
fill="none"
|
|
76
|
+
stroke="currentColor"
|
|
77
|
+
strokeLinecap="round"
|
|
78
|
+
strokeLinejoin="round"
|
|
79
|
+
strokeWidth="16"
|
|
80
|
+
></line>
|
|
81
|
+
</svg>
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
export default FadersHorizontal
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { FC } from 'react'
|
|
3
|
+
|
|
4
|
+
// Icon from Phosphor Icons
|
|
5
|
+
const MagnifyingGlass: FC = () => (
|
|
6
|
+
<svg
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
fill="currentColor"
|
|
9
|
+
viewBox="0 0 256 256"
|
|
10
|
+
strokeWidth="16"
|
|
11
|
+
width={24}
|
|
12
|
+
height={24}
|
|
13
|
+
>
|
|
14
|
+
<rect width="256" height="256" fill="none"></rect>
|
|
15
|
+
<circle
|
|
16
|
+
cx="116"
|
|
17
|
+
cy="116"
|
|
18
|
+
r="84"
|
|
19
|
+
fill="none"
|
|
20
|
+
stroke="currentColor"
|
|
21
|
+
strokeLinecap="round"
|
|
22
|
+
strokeLinejoin="round"
|
|
23
|
+
strokeWidth="16"
|
|
24
|
+
></circle>
|
|
25
|
+
<line
|
|
26
|
+
x1="175.4"
|
|
27
|
+
y1="175.4"
|
|
28
|
+
x2="224"
|
|
29
|
+
y2="224"
|
|
30
|
+
fill="none"
|
|
31
|
+
stroke="currentColor"
|
|
32
|
+
strokeLinecap="round"
|
|
33
|
+
strokeLinejoin="round"
|
|
34
|
+
strokeWidth="16"
|
|
35
|
+
></line>
|
|
36
|
+
</svg>
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
export default MagnifyingGlass
|
package/src/assets/TagIcon.tsx
CHANGED
|
@@ -5,10 +5,10 @@ import React from 'react'
|
|
|
5
5
|
const TagIcon: FC = () => (
|
|
6
6
|
<svg
|
|
7
7
|
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
-
width="192"
|
|
9
|
-
height="192"
|
|
10
8
|
fill="currentColor"
|
|
11
9
|
viewBox="0 0 256 256"
|
|
10
|
+
width={24}
|
|
11
|
+
height={24}
|
|
12
12
|
>
|
|
13
13
|
<rect width="256" height="256" fill="none"></rect>
|
|
14
14
|
<path
|
package/src/assets/index.ts
CHANGED
|
@@ -7,10 +7,12 @@ export { default as CaretDown } from './CaretDown'
|
|
|
7
7
|
export { default as Checked } from './Checked'
|
|
8
8
|
export { default as ClockClockwise } from './ClockClockwise'
|
|
9
9
|
export { default as DotsThree } from './DotsThree'
|
|
10
|
+
export { default as FadersHorizontal } from './FadersHorizontal'
|
|
10
11
|
export { default as Heart } from './Heart'
|
|
11
12
|
export { default as House } from './House'
|
|
12
13
|
export { default as Minus } from './Minus'
|
|
13
14
|
export { default as Plus } from './Plus'
|
|
15
|
+
export { default as MagnifyingGlass } from './MagnifyingGlass'
|
|
14
16
|
export { default as MinusCircle } from './MinusCircle'
|
|
15
17
|
export { default as PlusCircle } from './PlusCircle'
|
|
16
18
|
export { default as Ruler } from './Ruler'
|
package/src/hooks/UIProvider.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { createContext, useContext, useMemo, useReducer } from 'react'
|
|
3
1
|
import type { PropsWithChildren } from 'react'
|
|
2
|
+
import React, { createContext, useContext, useMemo, useReducer } from 'react'
|
|
4
3
|
|
|
5
4
|
interface Toast {
|
|
6
5
|
message: string
|
|
@@ -108,7 +107,7 @@ interface Context extends State {
|
|
|
108
107
|
|
|
109
108
|
const UIContext = createContext<Context | undefined>(undefined)
|
|
110
109
|
|
|
111
|
-
function UIProvider({ children }: PropsWithChildren) {
|
|
110
|
+
function UIProvider({ children }: PropsWithChildren<unknown>) {
|
|
112
111
|
const [ui, dispatch] = useReducer(reducer, undefined, initializer)
|
|
113
112
|
|
|
114
113
|
const callbacks = useMemo(
|
package/src/index.ts
CHANGED
|
@@ -116,6 +116,14 @@ export { default as RadioGroup, RadioOption } from './molecules/RadioGroup'
|
|
|
116
116
|
export type { RadioGroupProps, RadioOptionProps } from './molecules/RadioGroup'
|
|
117
117
|
export { default as Rating } from './molecules/Rating'
|
|
118
118
|
export type { RatingProps } from './molecules/Rating'
|
|
119
|
+
export {
|
|
120
|
+
default as SearchAutoComplete,
|
|
121
|
+
SearchAutoCompleteTerm,
|
|
122
|
+
} from './molecules/SearchAutoComplete'
|
|
123
|
+
export type {
|
|
124
|
+
SearchAutoCompleteProps,
|
|
125
|
+
SearchAutoCompleteTermProps,
|
|
126
|
+
} from './molecules/SearchAutoComplete'
|
|
119
127
|
export {
|
|
120
128
|
default as SearchHistory,
|
|
121
129
|
SearchHistoryTerm,
|
|
@@ -125,15 +133,17 @@ export type {
|
|
|
125
133
|
SearchHistoryTermProps,
|
|
126
134
|
} from './molecules/SearchHistory'
|
|
127
135
|
export {
|
|
128
|
-
default as
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
default as SearchProducts,
|
|
137
|
+
SearchProductItem,
|
|
138
|
+
SearchProductItemImage,
|
|
139
|
+
SearchProductItemContent,
|
|
140
|
+
} from './molecules/SearchProducts'
|
|
132
141
|
export type {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
SearchProductsProps,
|
|
143
|
+
SearchProductItemProps,
|
|
144
|
+
SearchProductItemImageProps,
|
|
145
|
+
SearchProductItemContentProps,
|
|
146
|
+
} from './molecules/SearchProducts'
|
|
137
147
|
export { default as SearchTop, SearchTopTerm } from './molecules/SearchTop'
|
|
138
148
|
export type { SearchTopProps, SearchTopTermProps } from './molecules/SearchTop'
|
|
139
149
|
export { default as SelectField } from './molecules/SelectField'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from 'react'
|
|
2
|
+
import { List } from '../..'
|
|
3
|
+
|
|
4
|
+
export interface SearchAutoCompleteProps
|
|
5
|
+
extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
8
|
+
*/
|
|
9
|
+
testId?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const SearchAutoComplete = ({
|
|
13
|
+
testId = 'fs-search-auto-complete',
|
|
14
|
+
children,
|
|
15
|
+
...otherProps
|
|
16
|
+
}: SearchAutoCompleteProps) => {
|
|
17
|
+
return (
|
|
18
|
+
<section data-testid={testId} data-fs-search-auto-complete {...otherProps}>
|
|
19
|
+
<List as="ol">{children}</List>
|
|
20
|
+
</section>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default SearchAutoComplete
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import React, { HTMLAttributes, Fragment } from 'react'
|
|
3
|
+
import { Icon, MagnifyingGlass, Link, LinkProps, LinkElementType } from '../..'
|
|
4
|
+
|
|
5
|
+
function formatSearchTerm(
|
|
6
|
+
indexSubstring: number,
|
|
7
|
+
searchTerm: string,
|
|
8
|
+
suggestion: string
|
|
9
|
+
) {
|
|
10
|
+
if (indexSubstring === 0) {
|
|
11
|
+
return searchTerm
|
|
12
|
+
.split('')
|
|
13
|
+
.map((char, idx) =>
|
|
14
|
+
idx === 0 && suggestion.indexOf(char.toUpperCase()) === 0
|
|
15
|
+
? char.toUpperCase()
|
|
16
|
+
: char.toLowerCase()
|
|
17
|
+
)
|
|
18
|
+
.join('')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return searchTerm.toLowerCase()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface SearchAutoCompleteTermProps
|
|
25
|
+
extends HTMLAttributes<HTMLDivElement> {
|
|
26
|
+
/**
|
|
27
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
28
|
+
*/
|
|
29
|
+
testId?: string
|
|
30
|
+
/**
|
|
31
|
+
* Props for the link from term component.
|
|
32
|
+
*/
|
|
33
|
+
linkProps?: Partial<LinkProps<LinkElementType>>
|
|
34
|
+
/**
|
|
35
|
+
* A React component that will be rendered as an icon.
|
|
36
|
+
*/
|
|
37
|
+
icon?: ReactNode
|
|
38
|
+
/**
|
|
39
|
+
* Term researched.
|
|
40
|
+
*/
|
|
41
|
+
term: string
|
|
42
|
+
/**
|
|
43
|
+
* Suggestion proposed with auto complete.
|
|
44
|
+
*/
|
|
45
|
+
suggestion: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const SearchAutoCompleteTerm = ({
|
|
49
|
+
testId = 'fs-search-auto-complete-term',
|
|
50
|
+
suggestion,
|
|
51
|
+
term,
|
|
52
|
+
linkProps,
|
|
53
|
+
icon,
|
|
54
|
+
}: SearchAutoCompleteTermProps) => {
|
|
55
|
+
const autoCompleteIcon = icon ? icon : <MagnifyingGlass />
|
|
56
|
+
|
|
57
|
+
const suggestionSubstring = suggestion.toLowerCase().split(term.toLowerCase())
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<li data-fs-search-auto-complete-item data-testid={testId}>
|
|
61
|
+
<Link
|
|
62
|
+
{...linkProps}
|
|
63
|
+
data-fs-search-auto-complete-item-link
|
|
64
|
+
variant="display"
|
|
65
|
+
>
|
|
66
|
+
{autoCompleteIcon && (
|
|
67
|
+
<Icon
|
|
68
|
+
component={autoCompleteIcon}
|
|
69
|
+
data-fs-search-auto-complete-item-icon
|
|
70
|
+
/>
|
|
71
|
+
)}
|
|
72
|
+
<p>
|
|
73
|
+
{suggestionSubstring.map((substring, indexSubstring) => (
|
|
74
|
+
<Fragment key={[substring, indexSubstring].join()}>
|
|
75
|
+
{substring.length > 0 && (
|
|
76
|
+
<strong data-fs-search-auto-complete-item-suggestion>
|
|
77
|
+
{indexSubstring === 0
|
|
78
|
+
? substring.charAt(0).toUpperCase() + substring.slice(1)
|
|
79
|
+
: substring}
|
|
80
|
+
</strong>
|
|
81
|
+
)}
|
|
82
|
+
{indexSubstring !== suggestionSubstring.length - 1 &&
|
|
83
|
+
formatSearchTerm(indexSubstring, term, suggestion)}
|
|
84
|
+
</Fragment>
|
|
85
|
+
))}
|
|
86
|
+
</p>
|
|
87
|
+
</Link>
|
|
88
|
+
</li>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default SearchAutoCompleteTerm
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default } from './SearchAutoComplete'
|
|
2
|
+
export type { SearchAutoCompleteProps } from './SearchAutoComplete'
|
|
3
|
+
|
|
4
|
+
export { default as SearchAutoCompleteTerm } from './SearchAutoCompleteTerm'
|
|
5
|
+
export type { SearchAutoCompleteTermProps } from './SearchAutoCompleteTerm'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
3
|
+
|
|
4
|
+
import { Link, LinkProps, LinkElementType } from '../..'
|
|
5
|
+
|
|
6
|
+
export interface SearchProductItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
/**
|
|
8
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
9
|
+
* testing-library, and jest).
|
|
10
|
+
*/
|
|
11
|
+
testId?: string
|
|
12
|
+
/**
|
|
13
|
+
* Props for the link from SearchProduct component.
|
|
14
|
+
*/
|
|
15
|
+
linkProps?: Partial<LinkProps<LinkElementType>>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const SearchProductItem = forwardRef<HTMLDivElement, SearchProductItemProps>(
|
|
19
|
+
function ProductItem({
|
|
20
|
+
testId = 'fs-search-product-item',
|
|
21
|
+
linkProps,
|
|
22
|
+
children,
|
|
23
|
+
}) {
|
|
24
|
+
return (
|
|
25
|
+
<li data-fs-search-product-item data-testid={testId}>
|
|
26
|
+
<Link {...linkProps} data-fs-search-product-item-link variant="display">
|
|
27
|
+
{children}
|
|
28
|
+
</Link>
|
|
29
|
+
</li>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
export default SearchProductItem
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
|
-
import { Price } from '
|
|
2
|
+
import { Price } from '../..'
|
|
3
3
|
import type { PriceFormatter } from '../../atoms/Price/Price'
|
|
4
4
|
|
|
5
5
|
interface Price {
|
|
@@ -8,7 +8,7 @@ interface Price {
|
|
|
8
8
|
formatter: PriceFormatter
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export type
|
|
11
|
+
export type SearchProductItemContentProps = {
|
|
12
12
|
/**
|
|
13
13
|
* Specifies the product's title.
|
|
14
14
|
*/
|
|
@@ -19,14 +19,14 @@ export type SearchProductCardContentProps = {
|
|
|
19
19
|
price: Price
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const SearchProductItemContent = forwardRef<
|
|
23
23
|
HTMLElement,
|
|
24
|
-
|
|
25
|
-
>(function
|
|
24
|
+
SearchProductItemContentProps
|
|
25
|
+
>(function SearchProductItemContent({ price, title, ...otherProps }, ref) {
|
|
26
26
|
return (
|
|
27
|
-
<section ref={ref} data-fs-search-product-
|
|
28
|
-
<p data-fs-search-product-
|
|
29
|
-
<span data-fs-search-product-
|
|
27
|
+
<section ref={ref} data-fs-search-product-item-content {...otherProps}>
|
|
28
|
+
<p data-fs-search-product-item-title>{title}</p>
|
|
29
|
+
<span data-fs-search-product-item-prices>
|
|
30
30
|
<Price
|
|
31
31
|
value={price?.listPrice ? price.listPrice : 0}
|
|
32
32
|
formatter={price?.formatter}
|
|
@@ -48,4 +48,4 @@ const SearchProductCardContent = forwardRef<
|
|
|
48
48
|
)
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
export default
|
|
51
|
+
export default SearchProductItemContent
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react'
|
|
2
2
|
import React, { forwardRef } from 'react'
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface SearchProductItemImageProps
|
|
5
5
|
extends HTMLAttributes<HTMLDivElement> {
|
|
6
6
|
/**
|
|
7
7
|
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
@@ -9,17 +9,17 @@ export interface SearchProductCardImageProps
|
|
|
9
9
|
testId?: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const SearchProductItemImage = forwardRef<
|
|
13
13
|
HTMLDivElement,
|
|
14
|
-
|
|
15
|
-
>(function
|
|
16
|
-
{ testId = 'fs-search-product-
|
|
14
|
+
SearchProductItemImageProps
|
|
15
|
+
>(function SearchProductItemImage(
|
|
16
|
+
{ testId = 'fs-search-product-item-image', children, ...otherProps },
|
|
17
17
|
ref
|
|
18
18
|
) {
|
|
19
19
|
return (
|
|
20
20
|
<div
|
|
21
21
|
ref={ref}
|
|
22
|
-
data-fs-search-product-
|
|
22
|
+
data-fs-search-product-item-image
|
|
23
23
|
data-testid={testId}
|
|
24
24
|
{...otherProps}
|
|
25
25
|
>
|
|
@@ -28,4 +28,4 @@ const SearchProductCardImage = forwardRef<
|
|
|
28
28
|
)
|
|
29
29
|
})
|
|
30
30
|
|
|
31
|
-
export default
|
|
31
|
+
export default SearchProductItemImage
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from 'react'
|
|
2
|
+
import { List } from '../..'
|
|
3
|
+
|
|
4
|
+
export interface SearchProductsProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
|
+
*/
|
|
8
|
+
testId?: string
|
|
9
|
+
/**
|
|
10
|
+
* Title attribute for the <section> tag rendered by this component.
|
|
11
|
+
*/
|
|
12
|
+
title?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const SearchProductsProps = ({
|
|
16
|
+
testId = 'fs-search-products',
|
|
17
|
+
title = 'Suggested Products',
|
|
18
|
+
children,
|
|
19
|
+
...otherProps
|
|
20
|
+
}: SearchProductsProps) => {
|
|
21
|
+
return (
|
|
22
|
+
<section data-testid={testId} data-fs-search-products {...otherProps}>
|
|
23
|
+
<header data-fs-search-products-header>
|
|
24
|
+
<p data-fs-search-products-title>{title}</p>
|
|
25
|
+
</header>
|
|
26
|
+
<List as="ol">{children}</List>
|
|
27
|
+
</section>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default SearchProductsProps
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default } from './SearchProducts'
|
|
2
|
+
export type { SearchProductsProps } from './SearchProducts'
|
|
3
|
+
|
|
4
|
+
export { default as SearchProductItem } from './SearchProductItem'
|
|
5
|
+
export type { SearchProductItemProps } from './SearchProductItem'
|
|
6
|
+
|
|
7
|
+
export { default as SearchProductItemImage } from './SearchProductItemImage'
|
|
8
|
+
export type { SearchProductItemImageProps } from './SearchProductItemImage'
|
|
9
|
+
|
|
10
|
+
export { default as SearchProductItemContent } from './SearchProductItemContent'
|
|
11
|
+
export type { SearchProductItemContentProps } from './SearchProductItemContent'
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { HTMLAttributes } from 'react';
|
|
3
|
-
import { LinkProps, LinkElementType } from '../../';
|
|
4
|
-
export interface SearchProductCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
/**
|
|
6
|
-
* ID to find this component in testing tools (e.g.: cypress,
|
|
7
|
-
* testing-library, and jest).
|
|
8
|
-
*/
|
|
9
|
-
testId?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Props for the link from SearchProduct component.
|
|
12
|
-
*/
|
|
13
|
-
linkProps?: Partial<LinkProps<LinkElementType>>;
|
|
14
|
-
/**
|
|
15
|
-
* Callback function when SearchProduct link is clicked.
|
|
16
|
-
*/
|
|
17
|
-
onLinkClick?: () => void;
|
|
18
|
-
}
|
|
19
|
-
declare const SearchProductCard: React.ForwardRefExoticComponent<SearchProductCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
-
export default SearchProductCard;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { Link } from '../../';
|
|
3
|
-
const SearchProductCard = forwardRef(function ProductCard({ testId = 'fs-search-product-card', linkProps, onLinkClick, children, ...otherProps }, ref) {
|
|
4
|
-
return (React.createElement("article", { ref: ref, "data-fs-search-product-card": true, "data-testid": testId, ...otherProps },
|
|
5
|
-
React.createElement(Link, { ...linkProps, "data-fs-search-product-card-link": true, title: name, variant: "display", onClick: onLinkClick }, children)));
|
|
6
|
-
});
|
|
7
|
-
export default SearchProductCard;
|
|
8
|
-
//# sourceMappingURL=SearchProductCard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SearchProductCard.js","sourceRoot":"","sources":["../../../src/molecules/SearchProductCard/SearchProductCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,IAAI,EAA8B,MAAM,QAAQ,CAAA;AAkBzD,MAAM,iBAAiB,GAAG,UAAU,CAClC,SAAS,WAAW,CAClB,EACE,MAAM,GAAG,wBAAwB,EACjC,SAAS,EACT,WAAW,EACX,QAAQ,EACR,GAAG,UAAU,EACd,EACD,GAAG;IAEH,OAAO,CACL,iCACE,GAAG,EAAE,GAAG,sDAEK,MAAM,KACf,UAAU;QAEd,oBAAC,IAAI,OACC,SAAS,4CAEb,KAAK,EAAE,IAAI,EACX,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,WAAW,IAEnB,QAAQ,CACJ,CACC,CACX,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SearchProductCardContent.js","sourceRoot":"","sources":["../../../src/molecules/SearchProductCard/SearchProductCardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAoB9B,MAAM,wBAAwB,GAAG,UAAU,CAGzC,SAAS,wBAAwB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,EAAE,GAAG;IACtE,OAAO,CACL,iCAAS,GAAG,EAAE,GAAG,kDAA0C,UAAU;QACnE,wEAAsC,KAAK,CAAK;QAChD;YACE,oBAAC,KAAK,IACJ,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAC7C,SAAS,EAAE,KAAK,EAAE,SAAS,EAC3B,MAAM,EAAC,YAAY,gBACP,KAAK,EAAE,SAAS,EAC5B,OAAO,EAAC,SAAS,EACjB,MAAM,EAAC,iBAAiB,GACxB;YACF,oBAAC,KAAK,IACJ,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACrC,SAAS,EAAE,KAAK,EAAE,SAAS,EAC3B,MAAM,EAAC,OAAO,gBACF,KAAK,EAAE,KAAK,EACxB,OAAO,EAAC,MAAM,EACd,MAAM,EAAC,QAAQ,GACf,CACG,CACC,CACX,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,wBAAwB,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
const SearchProductCardImage = forwardRef(function SearchProductCardImage({ testId = 'fs-search-product-card-image', children, ...otherProps }, ref) {
|
|
3
|
-
return (React.createElement("div", { ref: ref, "data-fs-search-product-card-image": true, "data-testid": testId, ...otherProps }, children));
|
|
4
|
-
});
|
|
5
|
-
export default SearchProductCardImage;
|
|
6
|
-
//# sourceMappingURL=SearchProductCardImage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SearchProductCardImage.js","sourceRoot":"","sources":["../../../src/molecules/SearchProductCard/SearchProductCardImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAUzC,MAAM,sBAAsB,GAAG,UAAU,CAGvC,SAAS,sBAAsB,CAC/B,EAAE,MAAM,GAAG,8BAA8B,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EACpE,GAAG;IAEH,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,4DAEK,MAAM,KACf,UAAU,IAEb,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,sBAAsB,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default } from './SearchProductCard';
|
|
2
|
-
export type { SearchProductCardProps } from './SearchProductCard';
|
|
3
|
-
export { default as SearchProductCardImage } from './SearchProductCardImage';
|
|
4
|
-
export type { SearchProductCardImageProps } from './SearchProductCardImage';
|
|
5
|
-
export { default as SearchProductCardContent } from './SearchProductCardContent';
|
|
6
|
-
export type { SearchProductCardContentProps } from './SearchProductCardContent';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/molecules/SearchProductCard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAG7C,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAG5E,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAA"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react'
|
|
2
|
-
import type { HTMLAttributes } from 'react'
|
|
3
|
-
|
|
4
|
-
import { Link, LinkProps, LinkElementType } from '../../'
|
|
5
|
-
|
|
6
|
-
export interface SearchProductCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
/**
|
|
8
|
-
* ID to find this component in testing tools (e.g.: cypress,
|
|
9
|
-
* testing-library, and jest).
|
|
10
|
-
*/
|
|
11
|
-
testId?: string
|
|
12
|
-
/**
|
|
13
|
-
* Props for the link from SearchProduct component.
|
|
14
|
-
*/
|
|
15
|
-
linkProps?: Partial<LinkProps<LinkElementType>>
|
|
16
|
-
/**
|
|
17
|
-
* Callback function when SearchProduct link is clicked.
|
|
18
|
-
*/
|
|
19
|
-
onLinkClick?: () => void
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const SearchProductCard = forwardRef<HTMLDivElement, SearchProductCardProps>(
|
|
23
|
-
function ProductCard(
|
|
24
|
-
{
|
|
25
|
-
testId = 'fs-search-product-card',
|
|
26
|
-
linkProps,
|
|
27
|
-
onLinkClick,
|
|
28
|
-
children,
|
|
29
|
-
...otherProps
|
|
30
|
-
},
|
|
31
|
-
ref
|
|
32
|
-
) {
|
|
33
|
-
return (
|
|
34
|
-
<article
|
|
35
|
-
ref={ref}
|
|
36
|
-
data-fs-search-product-card
|
|
37
|
-
data-testid={testId}
|
|
38
|
-
{...otherProps}
|
|
39
|
-
>
|
|
40
|
-
<Link
|
|
41
|
-
{...linkProps}
|
|
42
|
-
data-fs-search-product-card-link
|
|
43
|
-
title={name}
|
|
44
|
-
variant="display"
|
|
45
|
-
onClick={onLinkClick}
|
|
46
|
-
>
|
|
47
|
-
{children}
|
|
48
|
-
</Link>
|
|
49
|
-
</article>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
export default SearchProductCard
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default } from './SearchProductCard'
|
|
2
|
-
export type { SearchProductCardProps } from './SearchProductCard'
|
|
3
|
-
|
|
4
|
-
export { default as SearchProductCardImage } from './SearchProductCardImage'
|
|
5
|
-
export type { SearchProductCardImageProps } from './SearchProductCardImage'
|
|
6
|
-
|
|
7
|
-
export { default as SearchProductCardContent } from './SearchProductCardContent'
|
|
8
|
-
export type { SearchProductCardContentProps } from './SearchProductCardContent'
|