@graphcommerce/magento-search 8.0.0-canary.74 → 8.0.0-canary.76

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,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 8.0.0-canary.76
4
+
5
+ ## 8.0.0-canary.75
6
+
7
+ ### Patch Changes
8
+
9
+ - [#2160](https://github.com/graphcommerce-org/graphcommerce/pull/2160) [`9091dbb`](https://github.com/graphcommerce-org/graphcommerce/commit/9091dbb01a47aa6ba40932a66ed055b7f07c1cec) - Make sure the search link in the header is a nextjs navigation
10
+ ([@paales](https://github.com/paales))
11
+
12
+ - [#2160](https://github.com/graphcommerce-org/graphcommerce/pull/2160) [`fe37229`](https://github.com/graphcommerce-org/graphcommerce/commit/fe372294d6a42b1108e0fcef306b297baed5eb71) - Take the per_page configuration in account for the search results
13
+ ([@paales](https://github.com/paales))
14
+
3
15
  ## 8.0.0-canary.74
4
16
 
5
17
  ## 8.0.0-canary.73
@@ -4,10 +4,11 @@ import {
4
4
  IconSvg,
5
5
  extendableComponent,
6
6
  useFabSize,
7
+ useIconSvgSize,
7
8
  } from '@graphcommerce/next-ui'
8
9
  import { Breakpoint, Fab, FabProps, Link, LinkProps } from '@mui/material'
9
10
  import { useRouter } from 'next/router'
10
- import { MouseEventHandler } from 'react'
11
+ import { KeyboardEventHandler, MouseEventHandler } from 'react'
11
12
  import type { SetRequired } from 'type-fest'
12
13
 
13
14
  export type SearchLinkProps = {
@@ -30,6 +31,7 @@ export function SearchLink(props: SearchLinkProps) {
30
31
  const { href, sx = [], children, breakpoint, fab, onClick, ...linkProps } = props
31
32
  const router = useRouter()
32
33
  const fabSize = useFabSize('responsive')
34
+ const iconSize = useIconSvgSize('large')
33
35
  const { sx: fabSx = [], size, color, ...fabProps } = fab ?? {}
34
36
 
35
37
  const handleClick: MouseEventHandler<HTMLAnchorElement> = (e) => {
@@ -38,18 +40,28 @@ export function SearchLink(props: SearchLinkProps) {
38
40
  return router.push(href)
39
41
  }
40
42
 
43
+ const handleKeyDown: KeyboardEventHandler<HTMLAnchorElement> = (e) => {
44
+ if (e.key === 'Enter') {
45
+ e.preventDefault()
46
+ return router.push(href)
47
+ }
48
+ return undefined
49
+ }
50
+
41
51
  return (
42
52
  <>
43
53
  <Link
44
- component='a'
54
+ href={href}
55
+ rel='noindex'
45
56
  className={classes.root}
46
57
  underline='none'
47
58
  onClick={handleClick}
59
+ onKeyDown={handleKeyDown}
60
+ tabIndex={0}
48
61
  sx={[
49
62
  (theme) => ({
50
63
  justifySelf: 'center',
51
- // @todo make abstract, this is the size of a responsive Fab minus the icon size, divided by 2.
52
- marginRight: `calc(${fabSize} / 4)`,
64
+ marginRight: `calc((${fabSize} - ${iconSize}) / 2)`,
53
65
  width: responsiveVal(64, 172),
54
66
  borderRadius: 2,
55
67
  typography: 'body2',
@@ -79,8 +91,8 @@ export function SearchLink(props: SearchLinkProps) {
79
91
  </Link>
80
92
  {breakpoint && (
81
93
  <Fab
82
- component='a'
83
94
  href={href}
95
+ rel='noindex'
84
96
  size={size ?? 'large'}
85
97
  color={color ?? 'inherit'}
86
98
  sx={[
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-search",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.0.0-canary.74",
5
+ "version": "8.0.0-canary.76",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,15 +12,15 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^8.0.0-canary.74",
16
- "@graphcommerce/eslint-config-pwa": "^8.0.0-canary.74",
17
- "@graphcommerce/graphql": "^8.0.0-canary.74",
18
- "@graphcommerce/image": "^8.0.0-canary.74",
19
- "@graphcommerce/magento-product": "^8.0.0-canary.74",
20
- "@graphcommerce/next-ui": "^8.0.0-canary.74",
21
- "@graphcommerce/prettier-config-pwa": "^8.0.0-canary.74",
22
- "@graphcommerce/react-hook-form": "^8.0.0-canary.74",
23
- "@graphcommerce/typescript-config-pwa": "^8.0.0-canary.74",
15
+ "@graphcommerce/ecommerce-ui": "^8.0.0-canary.76",
16
+ "@graphcommerce/eslint-config-pwa": "^8.0.0-canary.76",
17
+ "@graphcommerce/graphql": "^8.0.0-canary.76",
18
+ "@graphcommerce/image": "^8.0.0-canary.76",
19
+ "@graphcommerce/magento-product": "^8.0.0-canary.76",
20
+ "@graphcommerce/next-ui": "^8.0.0-canary.76",
21
+ "@graphcommerce/prettier-config-pwa": "^8.0.0-canary.76",
22
+ "@graphcommerce/react-hook-form": "^8.0.0-canary.76",
23
+ "@graphcommerce/typescript-config-pwa": "^8.0.0-canary.76",
24
24
  "@lingui/core": "^4.2.1",
25
25
  "@lingui/macro": "^4.2.1",
26
26
  "@lingui/react": "^4.2.1",