@riosst100/pwa-marketplace 1.2.6 → 1.2.7

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 (129) hide show
  1. package/.github/workflows/dependabot.yml +28 -28
  2. package/package.json +18 -18
  3. package/src/Utilities/graphQL.js +76 -76
  4. package/src/componentOverrideMapping.js +17 -16
  5. package/src/components/BecomeSeller/becomeSeller.js +335 -335
  6. package/src/components/BecomeSeller/becomeSeller.module.css +46 -46
  7. package/src/components/BecomeSellerLink/becomeSellerLink.js +52 -52
  8. package/src/components/BecomeSellerLink/becomeSellerLink.module.css +12 -12
  9. package/src/components/BecomeSellerPage/becomeSellerPage.js +45 -45
  10. package/src/components/BecomeSellerPage/becomeSellerPage.module.css +21 -21
  11. package/src/components/Filter/index.js +53 -53
  12. package/src/components/Header/becomeSellerLink.js +28 -28
  13. package/src/components/Header/becomeSellerLink.module.css +12 -12
  14. package/src/components/Header/websiteSwitcher.js +109 -109
  15. package/src/components/Pagination/index.js +49 -40
  16. package/src/components/PhoneTextInput/phoneTextInput.module.css +21 -21
  17. package/src/components/ProductItem/index.js +50 -50
  18. package/src/components/Search/index.js +16 -16
  19. package/src/components/Seller/index.js +1 -1
  20. package/src/components/Seller/seller.js +249 -42
  21. package/src/components/SellerAccountPage/sellerAccountPage.js +110 -110
  22. package/src/components/SellerAccountPage/sellerAccountPage.module.css +55 -55
  23. package/src/components/SellerCountry/sellerCountry.gql.js +11 -11
  24. package/src/components/SellerInformation/index.js +1 -1
  25. package/src/components/SellerInformation/sellerInformation.js +90 -84
  26. package/src/components/SellerLocation/index.js +1 -1
  27. package/src/components/SellerLocation/sellerLocation.js +19 -18
  28. package/src/components/SellerLocation/sellerLocationItem.js +27 -25
  29. package/src/components/SellerPage/sellerPage.js +9 -9
  30. package/src/components/SellerProducts/sellerProducts.js +47 -218
  31. package/src/components/SellerReview/index.js +1 -1
  32. package/src/components/SellerReview/sellerReview.js +143 -143
  33. package/src/components/SellerReviewItem/sellerReviewItem.js +60 -60
  34. package/src/components/SellerVerification/sellerVerification.js +198 -198
  35. package/src/components/SellerVerification/sellerVerification.module.css +47 -47
  36. package/src/components/SellerVerificationPage/sellerVerificationPage.js +43 -43
  37. package/src/components/SellerVerificationPage/sellerVerificationPage.module.css +21 -21
  38. package/src/components/SortBy/index.js +24 -16
  39. package/src/components/WebsiteSwitcher/websiteSwitcher.js +109 -109
  40. package/src/components/commons/Slider/index.js +13 -13
  41. package/src/components/commons/Tabs/index.js +64 -62
  42. package/src/index.js +6 -6
  43. package/src/intercept.js +113 -113
  44. package/src/moduleOverrideWebpackPlugin.js +70 -70
  45. package/src/overwrites/peregrine/lib/store/actions/user/asyncActions.js +96 -96
  46. package/src/overwrites/peregrine/lib/talons/AccountMenu/useAccountMenuItems.js +74 -74
  47. package/src/overwrites/peregrine/lib/talons/Adapter/useAdapter.js +208 -208
  48. package/src/overwrites/peregrine/lib/talons/Header/storeSwitcher.gql.js +45 -45
  49. package/src/overwrites/peregrine/lib/talons/Header/useStoreSwitcher.js +204 -204
  50. package/src/overwrites/peregrine/lib/talons/Region/useRegion.js +102 -102
  51. package/src/overwrites/peregrine/lib/talons/SignIn/signIn.gql.js +56 -56
  52. package/src/overwrites/peregrine/lib/talons/SignIn/useSignIn.js +226 -226
  53. package/src/overwrites/peregrine/lib/util/deriveErrorMessage.js +34 -34
  54. package/src/overwrites/pwa-buildpack/lib/queries/getAvailableStoresConfigData.graphql +11 -11
  55. package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +112 -112
  56. package/src/overwrites/venia-ui/lib/components/Header/header.js +130 -118
  57. package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.js +105 -105
  58. package/src/overwrites/venia-ui/lib/components/Header/switcherItem.js +47 -47
  59. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/MegaMenu.spec.js +91 -91
  60. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/MegaMenuItem.spec.js +123 -123
  61. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/Submenu.spec.js +61 -61
  62. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/SubmenuColumn.spec.js +50 -50
  63. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenu.spec.js.snap +114 -114
  64. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenuItem.spec.js.snap +71 -71
  65. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/Submenu.spec.js.snap +59 -59
  66. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/SubmenuColumn.spec.js.snap +34 -34
  67. package/src/overwrites/venia-ui/lib/components/MegaMenu/index.js +1 -1
  68. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenu.js +90 -90
  69. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenu.module.css +12 -12
  70. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +156 -156
  71. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.module.css +30 -30
  72. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +89 -89
  73. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +42 -42
  74. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +99 -99
  75. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.module.css +28 -28
  76. package/src/overwrites/venia-ui/lib/components/SearchBar/__stories__/searchBar.js +11 -11
  77. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/searchField.spec.js.snap +72 -72
  78. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedCategories.spec.js.snap +30 -30
  79. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedProduct.spec.js.snap +69 -69
  80. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedProducts.spec.js.snap +7 -7
  81. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestions.spec.js.snap +12 -12
  82. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/autocomplete.spec.js +52 -52
  83. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/searchBar.spec.js +82 -82
  84. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/searchField.spec.js +87 -87
  85. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedCategories.spec.js +45 -45
  86. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedProduct.spec.js +43 -43
  87. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedProducts.spec.js +45 -45
  88. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestions.spec.js +110 -110
  89. package/src/overwrites/venia-ui/lib/components/SearchBar/autocomplete.js +172 -172
  90. package/src/overwrites/venia-ui/lib/components/SearchBar/autocomplete.module.css +62 -62
  91. package/src/overwrites/venia-ui/lib/components/SearchBar/index.js +1 -1
  92. package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.js +74 -74
  93. package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.module.css +49 -49
  94. package/src/overwrites/venia-ui/lib/components/SearchBar/searchField.js +40 -40
  95. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategories.js +48 -48
  96. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategories.module.css +13 -13
  97. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategory.js +49 -49
  98. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProduct.js +97 -97
  99. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProduct.module.css +24 -24
  100. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProducts.js +43 -43
  101. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProducts.module.css +13 -13
  102. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestions.js +75 -75
  103. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestions.module.css +6 -6
  104. package/src/overwrites/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js +75 -75
  105. package/src/overwrites/venia-ui/lib/targets/venia-ui-intercept.js +70 -70
  106. package/src/queries/getAvailableWebsitesConfigData.graphql +14 -14
  107. package/src/queries/index.js +30 -30
  108. package/src/talons/BecomeSeller/becomeSeller.gql.js +45 -45
  109. package/src/talons/BecomeSeller/useBecomeSeller.js +145 -145
  110. package/src/talons/BecomeSellerLink/useBecomeSellerLink.js +11 -11
  111. package/src/talons/BecomeSellerPage/useBecomeSellerPage.js +76 -76
  112. package/src/talons/Header/useBecomeSellerLink.js +13 -13
  113. package/src/talons/Header/useWebsiteSwitcher.js +218 -218
  114. package/src/talons/Seller/seller.gql.js +139 -204
  115. package/src/talons/Seller/useSeller.js +66 -71
  116. package/src/talons/SellerAccountPage/useSellerAccountPage.js +174 -174
  117. package/src/talons/SellerCountry/useSellerCountry.js +25 -25
  118. package/src/talons/WebsiteByIp/getWebsiteByIp.gql.js +13 -13
  119. package/src/talons/WebsiteByIp/useWebsiteByIp.js +34 -34
  120. package/src/talons/WebsiteSwitcher/useWebsiteSwitcher.js +218 -218
  121. package/src/theme/vars.js +6 -6
  122. package/src/util/mapSeller.js +7 -7
  123. package/src/components/OperatingHours/index.js +0 -1
  124. package/src/components/OperatingHours/operatingHours.js +0 -32
  125. package/src/components/Seller/sellerAddressCard.js +0 -48
  126. package/src/components/SellerDetail/index.js +0 -1
  127. package/src/components/SellerDetail/sellerDetail.js +0 -158
  128. package/src/components/SellerPage/core.js +0 -10
  129. package/src/talons/SellerProducts/useSellerProducts.js +0 -129
@@ -1,172 +1,172 @@
1
- import React from 'react';
2
- import { gql } from '@apollo/client';
3
- import { bool, func, shape, string } from 'prop-types';
4
- import { useAutocomplete } from '@magento/peregrine/lib/talons/SearchBar';
5
- import { useIntl } from 'react-intl';
6
-
7
- import defaultClasses from './autocomplete.module.css';
8
- import { useStyle } from '@magento/venia-ui/lib/classify';
9
- import Suggestions from './suggestions';
10
-
11
- const GET_AUTOCOMPLETE_RESULTS = gql`
12
- query getAutocompleteResults($inputText: String!) {
13
- # Limit results to first three.
14
- products(search: $inputText, currentPage: 1, pageSize: 3) {
15
- aggregations {
16
- label
17
- count
18
- attribute_code
19
- options {
20
- label
21
- value
22
- }
23
- position
24
- }
25
- # eslint-disable-next-line @graphql-eslint/require-id-when-available
26
- items {
27
- id
28
- uid
29
- sku
30
- name
31
- small_image {
32
- url
33
- }
34
- url_key
35
- url_suffix
36
- price {
37
- regularPrice {
38
- amount {
39
- value
40
- currency
41
- }
42
- }
43
- }
44
- price_range {
45
- maximum_price {
46
- final_price {
47
- currency
48
- value
49
- }
50
- discount {
51
- amount_off
52
- }
53
- }
54
- }
55
- }
56
- page_info {
57
- total_pages
58
- }
59
- total_count
60
- }
61
- }
62
- `;
63
-
64
- const Autocomplete = props => {
65
- const { setVisible, valid, visible } = props;
66
- const talonProps = useAutocomplete({
67
- queries: {
68
- getAutocompleteResults: GET_AUTOCOMPLETE_RESULTS
69
- },
70
- valid,
71
- visible
72
- });
73
- const {
74
- displayResult,
75
- filters,
76
- messageType,
77
- products,
78
- resultCount,
79
- value
80
- } = talonProps;
81
-
82
- const classes = useStyle(defaultClasses, props.classes);
83
- const rootClassName = visible ? classes.root_visible : classes.root_hidden;
84
-
85
- const { formatMessage } = useIntl();
86
- const MESSAGES = new Map()
87
- .set(
88
- 'ERROR',
89
- formatMessage({
90
- id: 'autocomplete.error',
91
- defaultMessage: 'An error occurred while fetching results.'
92
- })
93
- )
94
- .set(
95
- 'LOADING',
96
- formatMessage({
97
- id: 'autocomplete.loading',
98
- defaultMessage: 'Fetching results...'
99
- })
100
- )
101
- .set(
102
- 'PROMPT',
103
- formatMessage({
104
- id: 'autocomplete.prompt',
105
- defaultMessage: 'Search for a product'
106
- })
107
- )
108
- .set(
109
- 'EMPTY_RESULT',
110
- formatMessage({
111
- id: 'autocomplete.emptyResult',
112
- defaultMessage: 'No results were found.'
113
- })
114
- )
115
- .set('RESULT_SUMMARY', (_, resultCount) =>
116
- formatMessage(
117
- {
118
- id: 'autocomplete.resultSummary',
119
- defaultMessage: '{resultCount} items'
120
- },
121
- { resultCount: resultCount }
122
- )
123
- )
124
- .set(
125
- 'INVALID_CHARACTER_LENGTH',
126
- formatMessage({
127
- id: 'autocomplete.invalidCharacterLength',
128
- defaultMessage: 'Search term must be at least three characters'
129
- })
130
- );
131
-
132
- const messageTpl = MESSAGES.get(messageType);
133
- const message =
134
- typeof messageTpl === 'function'
135
- ? messageTpl`${resultCount}`
136
- : messageTpl;
137
-
138
- return (
139
- <div data-cy="Autocomplete-root" className={rootClassName}>
140
- <label
141
- id="search_query"
142
- data-cy="Autocomplete-message"
143
- className={classes.message}
144
- >
145
- {message}
146
- </label>
147
- <div className={classes.suggestions}>
148
- <Suggestions
149
- displayResult={displayResult}
150
- products={products || {}}
151
- filters={filters}
152
- searchValue={value}
153
- setVisible={setVisible}
154
- visible={visible}
155
- />
156
- </div>
157
- </div>
158
- );
159
- };
160
-
161
- export default Autocomplete;
162
-
163
- Autocomplete.propTypes = {
164
- classes: shape({
165
- message: string,
166
- root_hidden: string,
167
- root_visible: string,
168
- suggestions: string
169
- }),
170
- setVisible: func,
171
- visible: bool
172
- };
1
+ import React from 'react';
2
+ import { gql } from '@apollo/client';
3
+ import { bool, func, shape, string } from 'prop-types';
4
+ import { useAutocomplete } from '@magento/peregrine/lib/talons/SearchBar';
5
+ import { useIntl } from 'react-intl';
6
+
7
+ import defaultClasses from './autocomplete.module.css';
8
+ import { useStyle } from '@magento/venia-ui/lib/classify';
9
+ import Suggestions from './suggestions';
10
+
11
+ const GET_AUTOCOMPLETE_RESULTS = gql`
12
+ query getAutocompleteResults($inputText: String!) {
13
+ # Limit results to first three.
14
+ products(search: $inputText, currentPage: 1, pageSize: 3) {
15
+ aggregations {
16
+ label
17
+ count
18
+ attribute_code
19
+ options {
20
+ label
21
+ value
22
+ }
23
+ position
24
+ }
25
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
26
+ items {
27
+ id
28
+ uid
29
+ sku
30
+ name
31
+ small_image {
32
+ url
33
+ }
34
+ url_key
35
+ url_suffix
36
+ price {
37
+ regularPrice {
38
+ amount {
39
+ value
40
+ currency
41
+ }
42
+ }
43
+ }
44
+ price_range {
45
+ maximum_price {
46
+ final_price {
47
+ currency
48
+ value
49
+ }
50
+ discount {
51
+ amount_off
52
+ }
53
+ }
54
+ }
55
+ }
56
+ page_info {
57
+ total_pages
58
+ }
59
+ total_count
60
+ }
61
+ }
62
+ `;
63
+
64
+ const Autocomplete = props => {
65
+ const { setVisible, valid, visible } = props;
66
+ const talonProps = useAutocomplete({
67
+ queries: {
68
+ getAutocompleteResults: GET_AUTOCOMPLETE_RESULTS
69
+ },
70
+ valid,
71
+ visible
72
+ });
73
+ const {
74
+ displayResult,
75
+ filters,
76
+ messageType,
77
+ products,
78
+ resultCount,
79
+ value
80
+ } = talonProps;
81
+
82
+ const classes = useStyle(defaultClasses, props.classes);
83
+ const rootClassName = visible ? classes.root_visible : classes.root_hidden;
84
+
85
+ const { formatMessage } = useIntl();
86
+ const MESSAGES = new Map()
87
+ .set(
88
+ 'ERROR',
89
+ formatMessage({
90
+ id: 'autocomplete.error',
91
+ defaultMessage: 'An error occurred while fetching results.'
92
+ })
93
+ )
94
+ .set(
95
+ 'LOADING',
96
+ formatMessage({
97
+ id: 'autocomplete.loading',
98
+ defaultMessage: 'Fetching results...'
99
+ })
100
+ )
101
+ .set(
102
+ 'PROMPT',
103
+ formatMessage({
104
+ id: 'autocomplete.prompt',
105
+ defaultMessage: 'Search for a product'
106
+ })
107
+ )
108
+ .set(
109
+ 'EMPTY_RESULT',
110
+ formatMessage({
111
+ id: 'autocomplete.emptyResult',
112
+ defaultMessage: 'No results were found.'
113
+ })
114
+ )
115
+ .set('RESULT_SUMMARY', (_, resultCount) =>
116
+ formatMessage(
117
+ {
118
+ id: 'autocomplete.resultSummary',
119
+ defaultMessage: '{resultCount} items'
120
+ },
121
+ { resultCount: resultCount }
122
+ )
123
+ )
124
+ .set(
125
+ 'INVALID_CHARACTER_LENGTH',
126
+ formatMessage({
127
+ id: 'autocomplete.invalidCharacterLength',
128
+ defaultMessage: 'Search term must be at least three characters'
129
+ })
130
+ );
131
+
132
+ const messageTpl = MESSAGES.get(messageType);
133
+ const message =
134
+ typeof messageTpl === 'function'
135
+ ? messageTpl`${resultCount}`
136
+ : messageTpl;
137
+
138
+ return (
139
+ <div data-cy="Autocomplete-root" className={rootClassName}>
140
+ <label
141
+ id="search_query"
142
+ data-cy="Autocomplete-message"
143
+ className={classes.message}
144
+ >
145
+ {message}
146
+ </label>
147
+ <div className={classes.suggestions}>
148
+ <Suggestions
149
+ displayResult={displayResult}
150
+ products={products || {}}
151
+ filters={filters}
152
+ searchValue={value}
153
+ setVisible={setVisible}
154
+ visible={visible}
155
+ />
156
+ </div>
157
+ </div>
158
+ );
159
+ };
160
+
161
+ export default Autocomplete;
162
+
163
+ Autocomplete.propTypes = {
164
+ classes: shape({
165
+ message: string,
166
+ root_hidden: string,
167
+ root_visible: string,
168
+ suggestions: string
169
+ }),
170
+ setVisible: func,
171
+ visible: bool
172
+ };
@@ -1,62 +1,62 @@
1
- .root {
2
- composes: absolute from global;
3
- composes: bg-white from global;
4
- composes: border-2 from global;
5
- composes: border-input from global;
6
- composes: border-solid from global;
7
- composes: border-t-0 from global;
8
- composes: gap-3 from global;
9
- composes: grid from global;
10
- composes: left-0 from global;
11
- composes: p-xs from global;
12
- composes: right-0 from global;
13
- composes: rounded-b-md from global;
14
- composes: rounded-t-none from global;
15
- composes: shadow-inputFocus from global;
16
- composes: text-sm from global;
17
- composes: top-9 from global;
18
- composes: z-menu from global;
19
- transition-property: opacity, transform, visibility;
20
- }
21
-
22
- .root_hidden {
23
- composes: root;
24
-
25
- composes: invisible from global;
26
- composes: opacity-0 from global;
27
- transform: translate3d(0, -2rem, 0);
28
- transition-duration: 192ms;
29
- transition-timing-function: var(--venia-global-anim-out);
30
- }
31
-
32
- .root_visible {
33
- composes: root;
34
-
35
- composes: opacity-100 from global;
36
- composes: visible from global;
37
- transform: translate3d(0, 0, 0);
38
- transition-duration: 224ms;
39
- transition-timing-function: var(--venia-global-anim-in);
40
- }
41
-
42
- .message {
43
- composes: px-3 from global;
44
- composes: py-0 from global;
45
- composes: text-center from global;
46
- composes: text-subtle from global;
47
- }
48
-
49
- /* TODO @TW: cannot compose */
50
- .message:empty {
51
- padding: 0;
52
- }
53
-
54
- .suggestions {
55
- composes: gap-2xs from global;
56
- composes: grid from global;
57
- }
58
-
59
- /* TODO @TW: cannot compose */
60
- .suggestions:empty {
61
- display: none;
62
- }
1
+ .root {
2
+ composes: absolute from global;
3
+ composes: bg-white from global;
4
+ composes: border-2 from global;
5
+ composes: border-input from global;
6
+ composes: border-solid from global;
7
+ composes: border-t-0 from global;
8
+ composes: gap-3 from global;
9
+ composes: grid from global;
10
+ composes: left-0 from global;
11
+ composes: p-xs from global;
12
+ composes: right-0 from global;
13
+ composes: rounded-b-md from global;
14
+ composes: rounded-t-none from global;
15
+ composes: shadow-inputFocus from global;
16
+ composes: text-sm from global;
17
+ composes: top-9 from global;
18
+ composes: z-menu from global;
19
+ transition-property: opacity, transform, visibility;
20
+ }
21
+
22
+ .root_hidden {
23
+ composes: root;
24
+
25
+ composes: invisible from global;
26
+ composes: opacity-0 from global;
27
+ transform: translate3d(0, -2rem, 0);
28
+ transition-duration: 192ms;
29
+ transition-timing-function: var(--venia-global-anim-out);
30
+ }
31
+
32
+ .root_visible {
33
+ composes: root;
34
+
35
+ composes: opacity-100 from global;
36
+ composes: visible from global;
37
+ transform: translate3d(0, 0, 0);
38
+ transition-duration: 224ms;
39
+ transition-timing-function: var(--venia-global-anim-in);
40
+ }
41
+
42
+ .message {
43
+ composes: px-3 from global;
44
+ composes: py-0 from global;
45
+ composes: text-center from global;
46
+ composes: text-subtle from global;
47
+ }
48
+
49
+ /* TODO @TW: cannot compose */
50
+ .message:empty {
51
+ padding: 0;
52
+ }
53
+
54
+ .suggestions {
55
+ composes: gap-2xs from global;
56
+ composes: grid from global;
57
+ }
58
+
59
+ /* TODO @TW: cannot compose */
60
+ .suggestions:empty {
61
+ display: none;
62
+ }
@@ -1 +1 @@
1
- export { default } from './searchBar';
1
+ export { default } from './searchBar';
@@ -1,74 +1,74 @@
1
- import React from 'react';
2
- import { bool, shape, string } from 'prop-types';
3
- import { Form } from 'informed';
4
- import { useIntl } from 'react-intl';
5
- import { useSearchBar } from '@magento/peregrine/lib/talons/SearchBar';
6
-
7
- import { useStyle } from '@magento/venia-ui/lib/classify';
8
- import Autocomplete from './autocomplete';
9
- import SearchField from './searchField';
10
- import defaultClasses from './searchBar.module.css';
11
-
12
- const SearchBar = React.forwardRef((props, ref) => {
13
- const { isOpen } = props;
14
- const talonProps = useSearchBar();
15
- const {
16
- containerRef,
17
- handleChange,
18
- handleFocus,
19
- handleSubmit,
20
- initialValues,
21
- isAutoCompleteOpen,
22
- setIsAutoCompleteOpen,
23
- valid
24
- } = talonProps;
25
-
26
- const classes = useStyle(defaultClasses, props.classes);
27
- const rootClassName = isOpen ? classes.root_open : classes.root;
28
- const { formatMessage } = useIntl();
29
- return (
30
- <div className={rootClassName} data-cy="SearchBar-root" ref={ref}>
31
- <div ref={containerRef} className={classes.container}>
32
- <Form
33
- autoComplete="off"
34
- className={classes.form}
35
- initialValues={initialValues}
36
- onSubmit={handleSubmit}
37
- >
38
- <div className={classes.search}>
39
- <SearchField
40
- addLabel={formatMessage({
41
- id: 'global.clearText',
42
- defaultMessage: 'Clear Text'
43
- })}
44
- isSearchOpen={isAutoCompleteOpen}
45
- onChange={handleChange}
46
- onFocus={handleFocus}
47
- />
48
- <div className={classes.autocomplete}>
49
- <Autocomplete
50
- setVisible={setIsAutoCompleteOpen}
51
- valid={valid}
52
- visible={isAutoCompleteOpen}
53
- />
54
- </div>
55
- </div>
56
- </Form>
57
- </div>
58
- </div>
59
- );
60
- });
61
-
62
- export default SearchBar;
63
-
64
- SearchBar.propTypes = {
65
- classes: shape({
66
- autocomplete: string,
67
- container: string,
68
- form: string,
69
- root: string,
70
- root_open: string,
71
- search: string
72
- }),
73
- isOpen: bool
74
- };
1
+ import React from 'react';
2
+ import { bool, shape, string } from 'prop-types';
3
+ import { Form } from 'informed';
4
+ import { useIntl } from 'react-intl';
5
+ import { useSearchBar } from '@magento/peregrine/lib/talons/SearchBar';
6
+
7
+ import { useStyle } from '@magento/venia-ui/lib/classify';
8
+ import Autocomplete from './autocomplete';
9
+ import SearchField from './searchField';
10
+ import defaultClasses from './searchBar.module.css';
11
+
12
+ const SearchBar = React.forwardRef((props, ref) => {
13
+ const { isOpen } = props;
14
+ const talonProps = useSearchBar();
15
+ const {
16
+ containerRef,
17
+ handleChange,
18
+ handleFocus,
19
+ handleSubmit,
20
+ initialValues,
21
+ isAutoCompleteOpen,
22
+ setIsAutoCompleteOpen,
23
+ valid
24
+ } = talonProps;
25
+
26
+ const classes = useStyle(defaultClasses, props.classes);
27
+ const rootClassName = isOpen ? classes.root_open : classes.root;
28
+ const { formatMessage } = useIntl();
29
+ return (
30
+ <div className={rootClassName} data-cy="SearchBar-root" ref={ref}>
31
+ <div ref={containerRef} className={classes.container}>
32
+ <Form
33
+ autoComplete="off"
34
+ className={classes.form}
35
+ initialValues={initialValues}
36
+ onSubmit={handleSubmit}
37
+ >
38
+ <div className={classes.search}>
39
+ <SearchField
40
+ addLabel={formatMessage({
41
+ id: 'global.clearText',
42
+ defaultMessage: 'Clear Text'
43
+ })}
44
+ isSearchOpen={isAutoCompleteOpen}
45
+ onChange={handleChange}
46
+ onFocus={handleFocus}
47
+ />
48
+ <div className={classes.autocomplete}>
49
+ <Autocomplete
50
+ setVisible={setIsAutoCompleteOpen}
51
+ valid={valid}
52
+ visible={isAutoCompleteOpen}
53
+ />
54
+ </div>
55
+ </div>
56
+ </Form>
57
+ </div>
58
+ </div>
59
+ );
60
+ });
61
+
62
+ export default SearchBar;
63
+
64
+ SearchBar.propTypes = {
65
+ classes: shape({
66
+ autocomplete: string,
67
+ container: string,
68
+ form: string,
69
+ root: string,
70
+ root_open: string,
71
+ search: string
72
+ }),
73
+ isOpen: bool
74
+ };