@faststore/components 2.0.87-alpha.0 → 2.0.89-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/BellRinging.d.ts +4 -0
- package/dist/assets/BellRinging.js +6 -0
- package/dist/assets/BellRinging.js.map +1 -0
- package/dist/assets/MagnifyingGlass.d.ts +3 -2
- package/dist/assets/MagnifyingGlass.js +3 -4
- package/dist/assets/MagnifyingGlass.js.map +1 -1
- package/dist/assets/index.d.ts +1 -0
- package/dist/assets/index.js +1 -0
- package/dist/assets/index.js.map +1 -1
- package/dist/atoms/Loader/Loader.js +1 -1
- package/dist/atoms/Loader/Loader.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useSearch.d.ts +7 -0
- package/dist/hooks/useSearch.js +10 -0
- package/dist/hooks/useSearch.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/molecules/SearchAutoComplete/SearchAutoComplete.d.ts +1 -1
- package/dist/molecules/SearchAutoComplete/SearchAutoComplete.js +5 -1
- package/dist/molecules/SearchAutoComplete/SearchAutoComplete.js.map +1 -1
- package/dist/molecules/SearchDropdown/SearchDropdown.d.ts +14 -0
- package/dist/molecules/SearchDropdown/SearchDropdown.js +14 -0
- package/dist/molecules/SearchDropdown/SearchDropdown.js.map +1 -0
- package/dist/molecules/SearchDropdown/index.d.ts +2 -0
- package/dist/molecules/SearchDropdown/index.js +2 -0
- package/dist/molecules/SearchDropdown/index.js.map +1 -0
- package/dist/molecules/SearchHistory/SearchHistory.d.ts +1 -1
- package/dist/molecules/SearchHistory/SearchHistory.js +5 -1
- package/dist/molecules/SearchHistory/SearchHistory.js.map +1 -1
- package/dist/molecules/SearchInputField/SearchInputField.d.ts +36 -0
- package/dist/molecules/SearchInputField/SearchInputField.js +21 -0
- package/dist/molecules/SearchInputField/SearchInputField.js.map +1 -0
- package/dist/molecules/SearchInputField/index.d.ts +2 -0
- package/dist/molecules/SearchInputField/index.js +2 -0
- package/dist/molecules/SearchInputField/index.js.map +1 -0
- package/dist/molecules/SearchProducts/SearchProductItemContent.d.ts +2 -2
- package/dist/molecules/SearchProducts/SearchProducts.d.ts +1 -1
- package/dist/molecules/SearchProducts/SearchProducts.js +5 -1
- package/dist/molecules/SearchProducts/SearchProducts.js.map +1 -1
- package/dist/molecules/SearchProvider/SearchProvider.d.ts +29 -0
- package/dist/molecules/SearchProvider/SearchProvider.js +8 -0
- package/dist/molecules/SearchProvider/SearchProvider.js.map +1 -0
- package/dist/molecules/SearchProvider/index.d.ts +2 -0
- package/dist/molecules/SearchProvider/index.js +2 -0
- package/dist/molecules/SearchProvider/index.js.map +1 -0
- package/dist/molecules/SearchTop/SearchTop.d.ts +0 -8
- package/dist/molecules/SearchTop/SearchTop.js +8 -4
- package/dist/molecules/SearchTop/SearchTop.js.map +1 -1
- package/dist/organisms/OutOfStock/OutOfStock.d.ts +43 -0
- package/dist/organisms/OutOfStock/OutOfStock.js +14 -0
- package/dist/organisms/OutOfStock/OutOfStock.js.map +1 -0
- package/dist/organisms/OutOfStock/index.d.ts +2 -0
- package/dist/organisms/OutOfStock/index.js +2 -0
- package/dist/organisms/OutOfStock/index.js.map +1 -0
- package/dist/organisms/SearchInput/SearchInput.d.ts +26 -0
- package/dist/organisms/SearchInput/SearchInput.js +8 -0
- package/dist/organisms/SearchInput/SearchInput.js.map +1 -0
- package/dist/organisms/SearchInput/index.d.ts +2 -0
- package/dist/organisms/SearchInput/index.js +2 -0
- package/dist/organisms/SearchInput/index.js.map +1 -0
- package/package.json +2 -2
- package/src/assets/BellRinging.tsx +18 -0
- package/src/assets/MagnifyingGlass.tsx +12 -29
- package/src/assets/index.ts +1 -0
- package/src/atoms/Loader/Loader.tsx +2 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useSearch.ts +12 -0
- package/src/index.ts +21 -0
- package/src/molecules/SearchAutoComplete/SearchAutoComplete.tsx +8 -1
- package/src/molecules/SearchDropdown/SearchDropdown.tsx +45 -0
- package/src/molecules/SearchDropdown/index.ts +2 -0
- package/src/molecules/SearchHistory/SearchHistory.tsx +8 -1
- package/src/molecules/SearchInputField/SearchInputField.tsx +100 -0
- package/src/molecules/SearchInputField/index.ts +5 -0
- package/src/molecules/SearchProducts/SearchProductItemContent.tsx +1 -1
- package/src/molecules/SearchProducts/SearchProducts.tsx +6 -1
- package/src/molecules/SearchProvider/SearchProvider.tsx +49 -0
- package/src/molecules/SearchProvider/index.ts +2 -0
- package/src/molecules/SearchTop/SearchTop.tsx +12 -21
- package/src/organisms/OutOfStock/OutOfStock.tsx +102 -0
- package/src/organisms/OutOfStock/index.tsx +2 -0
- package/src/organisms/SearchInput/SearchInput.tsx +55 -0
- package/src/organisms/SearchInput/index.ts +2 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { FormHTMLAttributes } from 'react'
|
|
3
|
+
import { BellRinging } from '../../assets'
|
|
4
|
+
import { Button, Icon, InputField } from '../..'
|
|
5
|
+
|
|
6
|
+
export interface OutOfStockProps extends FormHTMLAttributes<HTMLFormElement> {
|
|
7
|
+
/**
|
|
8
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
9
|
+
* testing-library, and jest).
|
|
10
|
+
*/
|
|
11
|
+
testId?: string
|
|
12
|
+
/**
|
|
13
|
+
* The Out of Stock Section's title.
|
|
14
|
+
*/
|
|
15
|
+
title?: string
|
|
16
|
+
/**
|
|
17
|
+
* Additional message displayed with the title.
|
|
18
|
+
*/
|
|
19
|
+
subtitle?: string
|
|
20
|
+
/**
|
|
21
|
+
* The email input label.
|
|
22
|
+
*/
|
|
23
|
+
inputLabel: string
|
|
24
|
+
/**
|
|
25
|
+
* The button label.
|
|
26
|
+
*/
|
|
27
|
+
buttonLabel?: string
|
|
28
|
+
/**
|
|
29
|
+
* Specifies a label for loading state.
|
|
30
|
+
*/
|
|
31
|
+
loadingLabel?: string
|
|
32
|
+
/**
|
|
33
|
+
* Error message displayed when error.
|
|
34
|
+
*/
|
|
35
|
+
errorMessage?: string
|
|
36
|
+
/**
|
|
37
|
+
* Specifies that the submit button should be disabled.
|
|
38
|
+
*/
|
|
39
|
+
disabled: boolean
|
|
40
|
+
/**
|
|
41
|
+
* Event emitted when form is submitted.
|
|
42
|
+
*/
|
|
43
|
+
onSubmit: (event: React.FormEvent<HTMLFormElement>) => void
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const OutOfStock = forwardRef<HTMLFormElement, OutOfStockProps>(
|
|
47
|
+
function OutOfStock(
|
|
48
|
+
{
|
|
49
|
+
testId = 'fs-out-of-stock',
|
|
50
|
+
title,
|
|
51
|
+
buttonLabel = 'Notify Me',
|
|
52
|
+
loadingLabel = 'Loading',
|
|
53
|
+
inputLabel,
|
|
54
|
+
subtitle,
|
|
55
|
+
disabled,
|
|
56
|
+
errorMessage,
|
|
57
|
+
onSubmit,
|
|
58
|
+
...otherProps
|
|
59
|
+
},
|
|
60
|
+
ref
|
|
61
|
+
) {
|
|
62
|
+
return (
|
|
63
|
+
<form
|
|
64
|
+
data-fs-out-of-stock
|
|
65
|
+
ref={ref}
|
|
66
|
+
data-testid={testId}
|
|
67
|
+
onSubmit={onSubmit}
|
|
68
|
+
{...otherProps}
|
|
69
|
+
>
|
|
70
|
+
<h2 data-fs-out-of-stock-title>{title}</h2>
|
|
71
|
+
{subtitle && (
|
|
72
|
+
<p data-fs-out-of-stock-message>
|
|
73
|
+
<Icon component={<BellRinging size={16} />} />
|
|
74
|
+
{subtitle}
|
|
75
|
+
</p>
|
|
76
|
+
)}
|
|
77
|
+
<InputField
|
|
78
|
+
id="out-of-stock-email"
|
|
79
|
+
name="out-of-stock-email"
|
|
80
|
+
label={inputLabel}
|
|
81
|
+
aria-label={inputLabel}
|
|
82
|
+
error={errorMessage}
|
|
83
|
+
required
|
|
84
|
+
/>
|
|
85
|
+
<Button
|
|
86
|
+
data-fs-out-of-stock-button
|
|
87
|
+
type="submit"
|
|
88
|
+
loading={disabled}
|
|
89
|
+
loadingLabel={loadingLabel}
|
|
90
|
+
disabled={disabled}
|
|
91
|
+
variant="primary"
|
|
92
|
+
icon={<BellRinging />}
|
|
93
|
+
iconPosition="left"
|
|
94
|
+
>
|
|
95
|
+
{buttonLabel}
|
|
96
|
+
</Button>
|
|
97
|
+
</form>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
export default OutOfStock
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
3
|
+
import SearchProvider, { SearchProviderContextValue } from '../../molecules/SearchProvider'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export type SearchInputProps = {
|
|
7
|
+
/**
|
|
8
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
9
|
+
* testing-library, and jest).
|
|
10
|
+
*/
|
|
11
|
+
testId?: string
|
|
12
|
+
/**
|
|
13
|
+
* The current status of the Search Dropdown.
|
|
14
|
+
*/
|
|
15
|
+
visibleDropdown: boolean
|
|
16
|
+
} & HTMLAttributes<HTMLDivElement> & SearchProviderContextValue
|
|
17
|
+
|
|
18
|
+
const SearchInput = forwardRef<HTMLDivElement, SearchInputProps>(
|
|
19
|
+
function SearchInput(
|
|
20
|
+
{
|
|
21
|
+
children,
|
|
22
|
+
visibleDropdown = false,
|
|
23
|
+
testId = 'fs-search-input',
|
|
24
|
+
isLoading,
|
|
25
|
+
products,
|
|
26
|
+
term,
|
|
27
|
+
terms,
|
|
28
|
+
onSearchSelection,
|
|
29
|
+
...otherProps
|
|
30
|
+
},
|
|
31
|
+
ref
|
|
32
|
+
) {
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
ref={ref}
|
|
36
|
+
data-fs-search-input
|
|
37
|
+
data-fs-search-input-dropdown-visible={visibleDropdown}
|
|
38
|
+
data-testid={testId}
|
|
39
|
+
{...otherProps}
|
|
40
|
+
>
|
|
41
|
+
<SearchProvider
|
|
42
|
+
onSearchSelection={onSearchSelection}
|
|
43
|
+
isLoading={isLoading}
|
|
44
|
+
term={term}
|
|
45
|
+
products={products}
|
|
46
|
+
terms={terms}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</SearchProvider>
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
export default SearchInput
|