@salesforce/retail-react-app 4.0.0 → 4.1.0-nightly-20240812080155
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## v4.1.0-dev (Aug 8, 2024)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
- The unused `njwt` npm package had a security vulnerability, since it was unused, the package has been dropped
|
|
5
|
+
|
|
6
|
+
### Accessibility Improvements
|
|
7
|
+
- A11y: Fix search bar header element focus order [#1969](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1969)
|
|
8
|
+
|
|
1
9
|
## v4.0.0 (Aug 7, 2024)
|
|
2
10
|
|
|
3
11
|
### New Features
|
|
@@ -48,9 +48,39 @@ import {
|
|
|
48
48
|
import {navLinks, messages} from '@salesforce/retail-react-app/app/pages/account/constant'
|
|
49
49
|
import useNavigation from '@salesforce/retail-react-app/app/hooks/use-navigation'
|
|
50
50
|
import LoadingSpinner from '@salesforce/retail-react-app/app/components/loading-spinner'
|
|
51
|
+
import {HideOnDesktop, HideOnMobile} from '@salesforce/retail-react-app/app/components/responsive'
|
|
51
52
|
import {isHydrated, noop} from '@salesforce/retail-react-app/app/utils/utils'
|
|
52
53
|
import {STORE_LOCATOR_IS_ENABLED} from '@salesforce/retail-react-app/app/constants'
|
|
53
54
|
const IconButtonWithRegistration = withRegistration(IconButton)
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Search bar for the header.
|
|
58
|
+
*
|
|
59
|
+
* The search bar is a simple input field with a search icon.
|
|
60
|
+
* It can be used to search for products or navigate to a
|
|
61
|
+
* specific page.
|
|
62
|
+
*
|
|
63
|
+
* @param props {object} the component props
|
|
64
|
+
* @returns {Element} the search bar element
|
|
65
|
+
*/
|
|
66
|
+
const SearchBar = (props) => {
|
|
67
|
+
const styles = useMultiStyleConfig('Header')
|
|
68
|
+
const intl = useIntl()
|
|
69
|
+
const placeholder = intl.formatMessage({
|
|
70
|
+
id: 'header.field.placeholder.search_for_products',
|
|
71
|
+
defaultMessage: 'Search for products...'
|
|
72
|
+
})
|
|
73
|
+
return (
|
|
74
|
+
<Box {...styles.searchContainer}>
|
|
75
|
+
<Search
|
|
76
|
+
aria-label={placeholder}
|
|
77
|
+
placeholder={placeholder}
|
|
78
|
+
{...styles.search}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
</Box>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
54
84
|
/**
|
|
55
85
|
* The header is the main source for accessing
|
|
56
86
|
* navigation, search, basket, and other
|
|
@@ -125,11 +155,6 @@ const Header = ({
|
|
|
125
155
|
}
|
|
126
156
|
}
|
|
127
157
|
|
|
128
|
-
const placeholder = intl.formatMessage({
|
|
129
|
-
id: 'header.field.placeholder.search_for_products',
|
|
130
|
-
defaultMessage: 'Search for products...'
|
|
131
|
-
})
|
|
132
|
-
|
|
133
158
|
return (
|
|
134
159
|
<Box {...styles.container} {...props}>
|
|
135
160
|
<Box {...styles.content}>
|
|
@@ -161,13 +186,9 @@ const Header = ({
|
|
|
161
186
|
onClick={onLogoClick}
|
|
162
187
|
/>
|
|
163
188
|
<Box {...styles.bodyContainer}>{children}</Box>
|
|
164
|
-
<
|
|
165
|
-
<
|
|
166
|
-
|
|
167
|
-
placeholder={placeholder}
|
|
168
|
-
{...styles.search}
|
|
169
|
-
/>
|
|
170
|
-
</Box>
|
|
189
|
+
<HideOnMobile>
|
|
190
|
+
<SearchBar />
|
|
191
|
+
</HideOnMobile>
|
|
171
192
|
<IconButtonWithRegistration
|
|
172
193
|
icon={<AccountIcon />}
|
|
173
194
|
aria-label={intl.formatMessage({
|
|
@@ -318,6 +339,9 @@ const Header = ({
|
|
|
318
339
|
{...styles.icons}
|
|
319
340
|
onClick={onMyCartClick}
|
|
320
341
|
/>
|
|
342
|
+
<HideOnDesktop display={{base: 'contents', lg: 'none'}}>
|
|
343
|
+
<SearchBar />
|
|
344
|
+
</HideOnDesktop>
|
|
321
345
|
</Flex>
|
|
322
346
|
</Box>
|
|
323
347
|
</Box>
|
|
@@ -11,19 +11,29 @@ import {Box} from '@salesforce/retail-react-app/app/components/shared/ui'
|
|
|
11
11
|
/**
|
|
12
12
|
* Render the children in the DOM but visually hide them on desktop
|
|
13
13
|
* @param children - isomorphic components used within a responsive design
|
|
14
|
+
* @param rest - additional props to be passed to the Box component
|
|
14
15
|
*/
|
|
15
|
-
export const HideOnDesktop = ({children}) => (
|
|
16
|
-
<Box display={{base: 'block', lg: 'none'}}
|
|
16
|
+
export const HideOnDesktop = ({children, ...rest}) => (
|
|
17
|
+
<Box display={{base: 'block', lg: 'none'}} {...rest}>
|
|
18
|
+
{children}
|
|
19
|
+
</Box>
|
|
17
20
|
)
|
|
18
|
-
HideOnDesktop.propTypes = {
|
|
21
|
+
HideOnDesktop.propTypes = {
|
|
22
|
+
children: PropTypes.node
|
|
23
|
+
}
|
|
19
24
|
|
|
20
25
|
/**
|
|
21
26
|
* Render the children in the DOM but visually hide them on mobile
|
|
22
27
|
* @param children - isomorphic components used within a responsive design
|
|
28
|
+
* @param rest - additional props to be passed to the Box component
|
|
23
29
|
*/
|
|
24
|
-
export const HideOnMobile = ({children}) => (
|
|
25
|
-
<Box display={{base: 'none', lg: 'block'}}
|
|
30
|
+
export const HideOnMobile = ({children, ...rest}) => (
|
|
31
|
+
<Box display={{base: 'none', lg: 'block'}} {...rest}>
|
|
32
|
+
{children}
|
|
33
|
+
</Box>
|
|
26
34
|
)
|
|
27
|
-
HideOnMobile.propTypes = {
|
|
35
|
+
HideOnMobile.propTypes = {
|
|
36
|
+
children: PropTypes.node
|
|
37
|
+
}
|
|
28
38
|
|
|
29
39
|
export default {HideOnMobile, HideOnDesktop}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/retail-react-app",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0-nightly-20240812080155",
|
|
4
4
|
"license": "See license in LICENSE",
|
|
5
5
|
"author": "cc-pwa-kit@salesforce.com",
|
|
6
6
|
"ccExtensibility": {
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@lhci/cli": "^0.11.0",
|
|
46
46
|
"@loadable/component": "^5.15.3",
|
|
47
47
|
"@peculiar/webcrypto": "^1.4.2",
|
|
48
|
-
"@salesforce/commerce-sdk-react": "3.
|
|
49
|
-
"@salesforce/pwa-kit-dev": "3.
|
|
50
|
-
"@salesforce/pwa-kit-react-sdk": "3.
|
|
51
|
-
"@salesforce/pwa-kit-runtime": "3.
|
|
48
|
+
"@salesforce/commerce-sdk-react": "3.1.0-nightly-20240812080155",
|
|
49
|
+
"@salesforce/pwa-kit-dev": "3.8.0-nightly-20240812080155",
|
|
50
|
+
"@salesforce/pwa-kit-react-sdk": "3.8.0-nightly-20240812080155",
|
|
51
|
+
"@salesforce/pwa-kit-runtime": "3.8.0-nightly-20240812080155",
|
|
52
52
|
"@tanstack/react-query": "^4.28.0",
|
|
53
53
|
"@tanstack/react-query-devtools": "^4.29.1",
|
|
54
54
|
"@testing-library/dom": "^9.0.1",
|
|
@@ -71,7 +71,6 @@
|
|
|
71
71
|
"lodash": "^4.17.21",
|
|
72
72
|
"msw": "^1.2.1",
|
|
73
73
|
"nanoid": "^3.3.4",
|
|
74
|
-
"njwt": "^1.2.0",
|
|
75
74
|
"prop-types": "^15.8.1",
|
|
76
75
|
"query-string": "^7.1.3",
|
|
77
76
|
"raf": "^3.4.1",
|
|
@@ -100,5 +99,5 @@
|
|
|
100
99
|
"maxSize": "320 kB"
|
|
101
100
|
}
|
|
102
101
|
],
|
|
103
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "b47093bf6cc3a30ed04f11edd959baaf12939273"
|
|
104
103
|
}
|