@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.
Files changed (86) hide show
  1. package/dist/assets/BellRinging.d.ts +4 -0
  2. package/dist/assets/BellRinging.js +6 -0
  3. package/dist/assets/BellRinging.js.map +1 -0
  4. package/dist/assets/MagnifyingGlass.d.ts +3 -2
  5. package/dist/assets/MagnifyingGlass.js +3 -4
  6. package/dist/assets/MagnifyingGlass.js.map +1 -1
  7. package/dist/assets/index.d.ts +1 -0
  8. package/dist/assets/index.js +1 -0
  9. package/dist/assets/index.js.map +1 -1
  10. package/dist/atoms/Loader/Loader.js +1 -1
  11. package/dist/atoms/Loader/Loader.js.map +1 -1
  12. package/dist/hooks/index.d.ts +1 -0
  13. package/dist/hooks/index.js +1 -0
  14. package/dist/hooks/index.js.map +1 -1
  15. package/dist/hooks/useSearch.d.ts +7 -0
  16. package/dist/hooks/useSearch.js +10 -0
  17. package/dist/hooks/useSearch.js.map +1 -0
  18. package/dist/index.d.ts +9 -0
  19. package/dist/index.js +5 -0
  20. package/dist/index.js.map +1 -1
  21. package/dist/molecules/SearchAutoComplete/SearchAutoComplete.d.ts +1 -1
  22. package/dist/molecules/SearchAutoComplete/SearchAutoComplete.js +5 -1
  23. package/dist/molecules/SearchAutoComplete/SearchAutoComplete.js.map +1 -1
  24. package/dist/molecules/SearchDropdown/SearchDropdown.d.ts +14 -0
  25. package/dist/molecules/SearchDropdown/SearchDropdown.js +14 -0
  26. package/dist/molecules/SearchDropdown/SearchDropdown.js.map +1 -0
  27. package/dist/molecules/SearchDropdown/index.d.ts +2 -0
  28. package/dist/molecules/SearchDropdown/index.js +2 -0
  29. package/dist/molecules/SearchDropdown/index.js.map +1 -0
  30. package/dist/molecules/SearchHistory/SearchHistory.d.ts +1 -1
  31. package/dist/molecules/SearchHistory/SearchHistory.js +5 -1
  32. package/dist/molecules/SearchHistory/SearchHistory.js.map +1 -1
  33. package/dist/molecules/SearchInputField/SearchInputField.d.ts +36 -0
  34. package/dist/molecules/SearchInputField/SearchInputField.js +21 -0
  35. package/dist/molecules/SearchInputField/SearchInputField.js.map +1 -0
  36. package/dist/molecules/SearchInputField/index.d.ts +2 -0
  37. package/dist/molecules/SearchInputField/index.js +2 -0
  38. package/dist/molecules/SearchInputField/index.js.map +1 -0
  39. package/dist/molecules/SearchProducts/SearchProductItemContent.d.ts +2 -2
  40. package/dist/molecules/SearchProducts/SearchProducts.d.ts +1 -1
  41. package/dist/molecules/SearchProducts/SearchProducts.js +5 -1
  42. package/dist/molecules/SearchProducts/SearchProducts.js.map +1 -1
  43. package/dist/molecules/SearchProvider/SearchProvider.d.ts +29 -0
  44. package/dist/molecules/SearchProvider/SearchProvider.js +8 -0
  45. package/dist/molecules/SearchProvider/SearchProvider.js.map +1 -0
  46. package/dist/molecules/SearchProvider/index.d.ts +2 -0
  47. package/dist/molecules/SearchProvider/index.js +2 -0
  48. package/dist/molecules/SearchProvider/index.js.map +1 -0
  49. package/dist/molecules/SearchTop/SearchTop.d.ts +0 -8
  50. package/dist/molecules/SearchTop/SearchTop.js +8 -4
  51. package/dist/molecules/SearchTop/SearchTop.js.map +1 -1
  52. package/dist/organisms/OutOfStock/OutOfStock.d.ts +43 -0
  53. package/dist/organisms/OutOfStock/OutOfStock.js +14 -0
  54. package/dist/organisms/OutOfStock/OutOfStock.js.map +1 -0
  55. package/dist/organisms/OutOfStock/index.d.ts +2 -0
  56. package/dist/organisms/OutOfStock/index.js +2 -0
  57. package/dist/organisms/OutOfStock/index.js.map +1 -0
  58. package/dist/organisms/SearchInput/SearchInput.d.ts +26 -0
  59. package/dist/organisms/SearchInput/SearchInput.js +8 -0
  60. package/dist/organisms/SearchInput/SearchInput.js.map +1 -0
  61. package/dist/organisms/SearchInput/index.d.ts +2 -0
  62. package/dist/organisms/SearchInput/index.js +2 -0
  63. package/dist/organisms/SearchInput/index.js.map +1 -0
  64. package/package.json +2 -2
  65. package/src/assets/BellRinging.tsx +18 -0
  66. package/src/assets/MagnifyingGlass.tsx +12 -29
  67. package/src/assets/index.ts +1 -0
  68. package/src/atoms/Loader/Loader.tsx +2 -2
  69. package/src/hooks/index.ts +1 -0
  70. package/src/hooks/useSearch.ts +12 -0
  71. package/src/index.ts +21 -0
  72. package/src/molecules/SearchAutoComplete/SearchAutoComplete.tsx +8 -1
  73. package/src/molecules/SearchDropdown/SearchDropdown.tsx +45 -0
  74. package/src/molecules/SearchDropdown/index.ts +2 -0
  75. package/src/molecules/SearchHistory/SearchHistory.tsx +8 -1
  76. package/src/molecules/SearchInputField/SearchInputField.tsx +100 -0
  77. package/src/molecules/SearchInputField/index.ts +5 -0
  78. package/src/molecules/SearchProducts/SearchProductItemContent.tsx +1 -1
  79. package/src/molecules/SearchProducts/SearchProducts.tsx +6 -1
  80. package/src/molecules/SearchProvider/SearchProvider.tsx +49 -0
  81. package/src/molecules/SearchProvider/index.ts +2 -0
  82. package/src/molecules/SearchTop/SearchTop.tsx +12 -21
  83. package/src/organisms/OutOfStock/OutOfStock.tsx +102 -0
  84. package/src/organisms/OutOfStock/index.tsx +2 -0
  85. package/src/organisms/SearchInput/SearchInput.tsx +55 -0
  86. 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,2 @@
1
+ export { default } from './OutOfStock'
2
+ export type { OutOfStockProps } from './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
@@ -0,0 +1,2 @@
1
+ export { default } from './SearchInput'
2
+ export type { SearchInputProps } from './SearchInput'