@graphcommerce/magento-category 4.4.1 → 4.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1602](https://github.com/graphcommerce-org/graphcommerce/pull/1602) [`5f781a217`](https://github.com/graphcommerce-org/graphcommerce/commit/5f781a217ce63ed56bc1a9983487b04400a8a315) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Default styles and layout fixes
8
+
9
+ - Scaled icons and fonts down. Size in typography is now more gradual: https://graphcommerce.vercel.app/test/typography
10
+ - Multiple accessibility fixes. Missing button/input labels, and fixed spacing issues resulting in high % appropriately sized tap targets
11
+ - Replaced responsiveVal usage with better performaning breakpointVal where possible
12
+ - All buttons are now Pill by default.
13
+ - Cleaned up checkout styles
14
+
15
+ ### Patch Changes
16
+
17
+ - [#1601](https://github.com/graphcommerce-org/graphcommerce/pull/1601) [`04708dacc`](https://github.com/graphcommerce-org/graphcommerce/commit/04708daccc213c6ea927bc67fa3bd0d5b1fad619) Thanks [@paales](https://github.com/paales)! - Navigation now uses a single `const selection = useNavigationSelection()` motionValue to control the state of the menu, to prevent excessive rerenders.
18
+
19
+ * [#1590](https://github.com/graphcommerce-org/graphcommerce/pull/1590) [`ec96a0eb0`](https://github.com/graphcommerce-org/graphcommerce/commit/ec96a0eb049ee2204f32f9c578455cf9c131dbd2) Thanks [@paales](https://github.com/paales)! - Filtered category pages are now servered by a separate route with getServerSideProps. Since there are practically infinite variations of filters, it doesn't make sense to query those on a URL level and we're leveraging the backend caching possibilities.
20
+
21
+ * Updated dependencies [[`b40a352f7`](https://github.com/graphcommerce-org/graphcommerce/commit/b40a352f7bccdb831dce1d45baf98d51b0921d58), [`04708dacc`](https://github.com/graphcommerce-org/graphcommerce/commit/04708daccc213c6ea927bc67fa3bd0d5b1fad619), [`bb94e7045`](https://github.com/graphcommerce-org/graphcommerce/commit/bb94e7045460cb671c45d612a0833731d7c20c30), [`b0dc4e2e1`](https://github.com/graphcommerce-org/graphcommerce/commit/b0dc4e2e1982d502d38dd50a0f493396360a7a15), [`4a5286dfe`](https://github.com/graphcommerce-org/graphcommerce/commit/4a5286dfeaa1719e594a0078f274fbab53969c4e), [`40983df17`](https://github.com/graphcommerce-org/graphcommerce/commit/40983df170ed0435c47496285dfe30aafeb2eeac), [`d46d5ed0c`](https://github.com/graphcommerce-org/graphcommerce/commit/d46d5ed0cc5794391b7527fc17bbb68ec2212e33), [`5f781a217`](https://github.com/graphcommerce-org/graphcommerce/commit/5f781a217ce63ed56bc1a9983487b04400a8a315), [`ec96a0eb0`](https://github.com/graphcommerce-org/graphcommerce/commit/ec96a0eb049ee2204f32f9c578455cf9c131dbd2)]:
22
+ - @graphcommerce/magento-product@4.5.0
23
+ - @graphcommerce/next-ui@4.22.0
24
+ - @graphcommerce/magento-store@4.2.28
25
+ - @graphcommerce/framer-scroller@2.1.33
26
+ - @graphcommerce/graphql@3.4.7
27
+ - @graphcommerce/image@3.1.9
28
+
3
29
  ## 4.4.1
4
30
 
5
31
  ### Patch Changes
@@ -40,16 +40,14 @@ export function CategoryChildren(props: CategoryChildrenProps) {
40
40
  {children.map((cat) => {
41
41
  if (!cat?.url_path || !cat.name || !cat.include_in_menu) return null
42
42
 
43
- const linkParams = cloneDeep(params)
44
- linkParams.url = cat.url_path
45
- delete linkParams.currentPage
46
-
47
43
  return (
48
44
  <ProductListLink
49
45
  key={cat.url_path}
50
46
  underline='none'
51
47
  color='inherit'
52
- {...linkParams}
48
+ url={cat.url_path}
49
+ filters={{ category_uid: { eq: cat.uid } }}
50
+ sort={params.sort}
53
51
  className={classes.link}
54
52
  sx={(theme) => ({
55
53
  whiteSpace: 'nowrap',
@@ -1,5 +1,5 @@
1
1
  import { ProductListLink } from '@graphcommerce/magento-product'
2
- import { responsiveVal, Row, extendableComponent } from '@graphcommerce/next-ui'
2
+ import { responsiveVal, breakpointVal, Row, extendableComponent } from '@graphcommerce/next-ui'
3
3
  import { Box, SxProps, Theme, Typography } from '@mui/material'
4
4
  import React from 'react'
5
5
  import { CategoryHeroNavFragment } from './CategoryHeroNav.gql'
@@ -33,7 +33,6 @@ export function CategoryHeroNav({ children, title, asset, sx = [] }: CategoryHer
33
33
  marginBottom: theme.spacings.xxl,
34
34
  paddingBottom: theme.page.vertical,
35
35
  [theme.breakpoints.up('md')]: {
36
- rowGap: theme.spacings.md,
37
36
  width: '100%',
38
37
  paddingRight: theme.page.horizontal,
39
38
  paddingTop: 0,
@@ -117,7 +116,12 @@ export function CategoryHeroNav({ children, title, asset, sx = [] }: CategoryHer
117
116
  '& video': {
118
117
  objectFit: 'cover',
119
118
  width: '100%',
120
- borderRadius: responsiveVal(theme.shape.borderRadius * 2, theme.shape.borderRadius * 3),
119
+ ...breakpointVal(
120
+ 'borderRadius',
121
+ theme.shape.borderRadius * 2,
122
+ theme.shape.borderRadius * 3,
123
+ theme.breakpoints.values,
124
+ ),
121
125
  },
122
126
  [theme.breakpoints.up('md')]: {
123
127
  minHeight: '80vh',
@@ -1,5 +1,4 @@
1
1
  fragment CategoryMeta on CategoryTree {
2
- uid
3
2
  name
4
3
  meta_title
5
4
  meta_description
@@ -5,13 +5,10 @@ import { i18n } from '@lingui/core'
5
5
  import { CategoryMetaFragment } from './CategoryMeta.gql'
6
6
 
7
7
  export type CategoryMetaProps = CategoryMetaFragment &
8
- Partial<PageMetaProps> & {
9
- params?: ProductListParams
10
- current_page?: number | null | undefined
11
- }
8
+ Partial<PageMetaProps> & { params?: ProductListParams }
12
9
 
13
10
  export function CategoryMeta(props: CategoryMetaProps) {
14
- const { meta_title, meta_description, name, params, current_page } = props
11
+ const { meta_title, meta_description, name, params } = props
15
12
  let {
16
13
  title = meta_title ?? name ?? '',
17
14
  metaDescription = meta_description ?? undefined,
@@ -21,8 +18,8 @@ export function CategoryMeta(props: CategoryMetaProps) {
21
18
 
22
19
  if (params?.url && !canonical) canonical = `/${params.url}`
23
20
 
24
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
25
- const anyFilterActive = Object.keys(params?.filters ?? {}).length > 0
21
+ const anyFilterActive =
22
+ Object.keys(params?.filters ?? {}).filter((k) => k !== 'category_uid').length > 0
26
23
  const currentPage = params?.currentPage ?? 1
27
24
  const isPaginated = currentPage > 1 && !anyFilterActive
28
25
 
package/index.ts CHANGED
@@ -3,5 +3,5 @@ export * from './components/CategoryDescription/CategoryDescription'
3
3
  export * from './components/CategoryHeroNav/CategoryHeroNav'
4
4
  export * from './components/CategoryHeroNav/CategoryHeroNavTitle'
5
5
  export * from './components/CategoryMeta/CategoryMeta'
6
- export * from './hooks/useMagentoMenuToNavigation'
6
+ export * from './utils/magentoMenuToNavigation'
7
7
  export * from './queries/getCategoryStaticPaths'
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-category",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "4.4.1",
5
+ "version": "4.5.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,12 +19,12 @@
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/framer-scroller": "2.1.32",
23
- "@graphcommerce/graphql": "3.4.6",
24
- "@graphcommerce/image": "3.1.8",
25
- "@graphcommerce/magento-product": "4.4.25",
26
- "@graphcommerce/magento-store": "4.2.27",
27
- "@graphcommerce/next-ui": "4.21.0"
22
+ "@graphcommerce/framer-scroller": "2.1.33",
23
+ "@graphcommerce/graphql": "3.4.7",
24
+ "@graphcommerce/image": "3.1.9",
25
+ "@graphcommerce/magento-product": "4.5.0",
26
+ "@graphcommerce/magento-store": "4.2.28",
27
+ "@graphcommerce/next-ui": "4.22.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@lingui/react": "^3.13.2",
@@ -43,8 +43,18 @@ export function categoryToNav(props: Item | null | undefined): NavigationNode |
43
43
  * Converts the Magento GraphQL category tree to a NavigationNode tree, which can be used in the
44
44
  * Navigation component.
45
45
  */
46
- export function useMagentoMenuToNavigation(menu: MenuQueryFragment['menu'], includeRoot: boolean) {
46
+ export function magentoMenuToNavigation(menu: MenuQueryFragment['menu'], includeRoot: boolean) {
47
47
  return ((includeRoot ? menu?.items : menu?.items?.[0]?.children) || [])
48
48
  .map(categoryToNav)
49
49
  .filter(nonNullable)
50
50
  }
51
+
52
+ /**
53
+ * Converts the Magento GraphQL category tree to a NavigationNode tree, which can be used in the
54
+ * Navigation component.
55
+ *
56
+ * @deprecated Please use magentoMenuToNavigation instead.
57
+ */
58
+ export function useMagentoMenuToNavigation(menu: MenuQueryFragment['menu'], includeRoot: boolean) {
59
+ return magentoMenuToNavigation(menu, includeRoot)
60
+ }