@graphcommerce/next-ui 10.0.0-canary.68 → 10.0.0-canary.72

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,23 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.0.0-canary.72
4
+
5
+ ## 10.0.0-canary.71
6
+
7
+ ## 10.0.0-canary.70
8
+
9
+ ### Major Changes
10
+
11
+ - [#2565](https://github.com/graphcommerce-org/graphcommerce/pull/2565) [`c96dfcd`](https://github.com/graphcommerce-org/graphcommerce/commit/c96dfcdca981baca387c270ad9e2b9515cdd00cc) - Updated to Apollo Client 4 ([@paales](https://github.com/paales))
12
+
13
+ ## 10.0.0-canary.69
14
+
15
+ ### Patch Changes
16
+
17
+ - [#2567](https://github.com/graphcommerce-org/graphcommerce/pull/2567) [`a0ba773`](https://github.com/graphcommerce-org/graphcommerce/commit/a0ba773171bb76c7a998deb5bbacd974e5a3764d) - Fix LayoutOverlayHeader2 text overflowing beyond overlay size constraints ([@paales](https://github.com/paales))
18
+
19
+ - [#2567](https://github.com/graphcommerce-org/graphcommerce/pull/2567) [`4908a45`](https://github.com/graphcommerce-org/graphcommerce/commit/4908a457cac15c429d83d6b9274a8be9c8277ef6) - Allow setting OverlayContainer props, such as event listeners ([@paales](https://github.com/paales))
20
+
3
21
  ## 10.0.0-canary.68
4
22
 
5
23
  ### Major Changes
@@ -139,17 +139,17 @@ export const LayoutOverlayHeader2 = React.memo<LayoutOverlayHeader2Props>((props
139
139
  // Left only
140
140
  '&.left:not(.right)': {
141
141
  gridTemplateAreas: '"left center"',
142
- gridTemplateColumns: justify === 'center' ? '1fr max-content' : 'auto 1fr',
142
+ gridTemplateColumns: justify === 'center' ? '1fr auto' : 'auto 1fr',
143
143
  },
144
144
  // Right only
145
145
  '&.right:not(.left)': {
146
146
  gridTemplateAreas: '"center right"',
147
- gridTemplateColumns: justify === 'center' ? 'max-content 1fr' : '1fr auto',
147
+ gridTemplateColumns: justify === 'center' ? 'auto 1fr' : '1fr auto',
148
148
  },
149
149
  // Both left and right
150
150
  '&.left.right': {
151
151
  gridTemplateAreas: '"left center right"',
152
- gridTemplateColumns: justify === 'center' ? '1fr max-content 1fr' : 'auto 1fr auto',
152
+ gridTemplateColumns: justify === 'center' ? '1fr auto 1fr' : 'auto 1fr auto',
153
153
  },
154
154
  }))}
155
155
  >
@@ -5,20 +5,27 @@ import type { SetOptional } from 'type-fest'
5
5
  import { variantsToScrollSnapType } from '../utils/variantsToScrollSnapType'
6
6
  import type { LayoutOverlayBaseProps } from './OverlayBase'
7
7
  import { OverlayBase } from './OverlayBase'
8
+ import type { OverlayContainerProps } from './OverlayContainer'
8
9
  import { OverlayContainer } from './OverlayContainer'
9
10
 
10
11
  export type OverlayTmpProps = Omit<
11
12
  SetOptional<LayoutOverlayBaseProps, 'variantSm' | 'variantMd'>,
12
13
  'offsetPageY' | 'isPresent' | 'safeToRemove'
13
- >
14
+ > & { overlayContainerProps?: Partial<OverlayContainerProps> }
14
15
 
15
16
  function OverlayUsePresence(props: OverlayTmpProps) {
16
- const { variantSm = 'bottom', variantMd = 'right', active, ...otherProps } = props
17
+ const {
18
+ variantSm = 'bottom',
19
+ variantMd = 'right',
20
+ active,
21
+ overlayContainerProps,
22
+ ...otherProps
23
+ } = props
17
24
  const [isPresent, safeToRemove] = usePresence()
18
25
 
19
26
  return (
20
27
  <Portal>
21
- <OverlayContainer active={active}>
28
+ <OverlayContainer active={active} {...overlayContainerProps}>
22
29
  <ScrollerProvider {...variantsToScrollSnapType(props)}>
23
30
  <OverlayBase
24
31
  active={active}
@@ -1,14 +1,15 @@
1
1
  import { sxx } from '@graphcommerce/next-ui'
2
+ import type { BoxProps } from '@mui/material'
2
3
  import { Box } from '@mui/material'
3
4
  import type { LayoutOverlayBaseProps } from './OverlayBase'
4
5
 
5
6
  export type OverlayContainerProps = Pick<LayoutOverlayBaseProps, 'active'> & {
6
7
  hidden?: boolean
7
8
  children: React.ReactNode
8
- }
9
+ } & BoxProps
9
10
 
10
11
  export function OverlayContainer(props: OverlayContainerProps) {
11
- const { children, active, hidden } = props
12
+ const { children, active, hidden, sx, ...rest } = props
12
13
 
13
14
  return (
14
15
  <Box
@@ -47,7 +48,9 @@ export function OverlayContainer(props: OverlayContainerProps) {
47
48
  boxShadow: 0,
48
49
  },
49
50
  },
51
+ sx,
50
52
  )}
53
+ {...rest}
51
54
  >
52
55
  {children}
53
56
  </Box>
package/Page/types.ts CHANGED
@@ -1,8 +1,5 @@
1
1
  import type { ParsedUrlQuery } from 'querystring'
2
2
  import type { UpPage } from '@graphcommerce/framer-next-pages'
3
- // todo: remove references to GraphQL
4
- // eslint-disable-next-line import/no-extraneous-dependencies
5
- import type { NormalizedCacheObject } from '@graphcommerce/graphql'
6
3
  import type {
7
4
  GetServerSideProps as GetServerSidePropsNext,
8
5
  GetStaticProps as GetStaticPropsNext,
@@ -10,7 +7,7 @@ import type {
10
7
 
11
8
  type AnyObj = Record<string, unknown>
12
9
 
13
- export type ApolloStateProps = { apolloState: NormalizedCacheObject; up?: UpPage | null }
10
+ export type ApolloStateProps = { apolloState: unknown; up?: UpPage | null }
14
11
 
15
12
  export type GetStaticProps<
16
13
  PL extends AnyObj,
@@ -1,4 +1,5 @@
1
- import React from 'react'
1
+ import { createElement } from 'react'
2
+ import type React from 'react'
2
3
 
3
4
  /** To make renderers customizable we need to be able to provide renders for all types */
4
5
  type TypeObject = { __typename: string; [index: string]: unknown }
@@ -24,6 +25,10 @@ export type TypeRenderer<
24
25
  TAdd extends Record<string, unknown> = Record<string, unknown>,
25
26
  > = TypeRenderMap<T, T['__typename'], TAdd>
26
27
 
28
+ function FallbackRenderer({ __typename }: { __typename: string }) {
29
+ return <>{process.env.NODE_ENV !== 'production' ? __typename : ''}</>
30
+ }
31
+
27
32
  /**
28
33
  * A simple array with renderers but with strict typing that validates of the provided Renderer is
29
34
  * actually able to render the Type
@@ -35,11 +40,9 @@ export function RenderType<
35
40
  A extends Record<string, unknown> = Record<string, unknown>,
36
41
  >(props: { renderer: TypeRenderer<T, A> } & FilterTypeByTypename<T, T['__typename']> & A) {
37
42
  const { renderer, __typename, ...typeItemProps } = props
38
- const TypeItem: TypeRenderMethod<typeof typeItemProps> = renderer[__typename]
39
- ? renderer[__typename]
40
- : () => <>{process.env.NODE_ENV !== 'production' ? __typename : ''}</>
43
+ const TypeItem: TypeRenderMethod<typeof typeItemProps> = renderer[__typename] ?? FallbackRenderer
41
44
 
42
- return <TypeItem {...typeItemProps} __typename={__typename} />
45
+ return createElement(TypeItem, { ...typeItemProps, __typename })
43
46
  }
44
47
 
45
48
  /** @public */
@@ -44,21 +44,22 @@ export function withTheme<T>(
44
44
  Component: (value: T & WithSx) => React.ReactElement<any, any> | null,
45
45
  theme: Theme,
46
46
  ): React.FC<T & WithSx> {
47
- return (data: T & WithSx) => {
47
+ // eslint-disable-next-line react/function-component-definition
48
+ return function WithTheme(data: T & WithSx) {
48
49
  const { sx = [] } = data
49
50
  return (
50
51
  <ThemeProvider theme={theme}>
51
- <Component
52
- {...data}
53
- sx={sxx(
52
+ {React.createElement(Component, {
53
+ ...data,
54
+ sx: sxx(
54
55
  {
55
56
  typography: 'body1',
56
57
  color: theme.vars.palette.text.primary,
57
58
  backgroundColor: theme.vars.palette.background.default,
58
59
  },
59
60
  sx,
60
- )}
61
- />
61
+ ),
62
+ })}
62
63
  </ThemeProvider>
63
64
  )
64
65
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/next-ui",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "10.0.0-canary.68",
5
+ "version": "10.0.0-canary.72",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -30,7 +30,7 @@
30
30
  "./RenderType/filterNonNullableKeys": "./RenderType/filterNonNullableKeys.ts"
31
31
  },
32
32
  "dependencies": {
33
- "cookie": "^1.0.2",
33
+ "cookie": "^1.1.1",
34
34
  "react-is": "^19.2.0"
35
35
  },
36
36
  "devDependencies": {
@@ -38,21 +38,21 @@
38
38
  "typescript": "5.9.3"
39
39
  },
40
40
  "peerDependencies": {
41
- "@emotion/cache": "^11",
42
- "@emotion/react": "^11",
43
- "@emotion/server": "^11",
44
- "@emotion/styled": "^11",
45
- "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.68",
46
- "@graphcommerce/framer-next-pages": "^10.0.0-canary.68",
47
- "@graphcommerce/framer-scroller": "^10.0.0-canary.68",
48
- "@graphcommerce/framer-utils": "^10.0.0-canary.68",
49
- "@graphcommerce/image": "^10.0.0-canary.68",
50
- "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.68",
51
- "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.68",
41
+ "@emotion/cache": "^11.14.0",
42
+ "@emotion/react": "^11.14.0",
43
+ "@emotion/server": "^11.11.0",
44
+ "@emotion/styled": "^11.14.1",
45
+ "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.72",
46
+ "@graphcommerce/framer-next-pages": "^10.0.0-canary.72",
47
+ "@graphcommerce/framer-scroller": "^10.0.0-canary.72",
48
+ "@graphcommerce/framer-utils": "^10.0.0-canary.72",
49
+ "@graphcommerce/image": "^10.0.0-canary.72",
50
+ "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.72",
51
+ "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.72",
52
52
  "@lingui/core": "^5",
53
53
  "@lingui/macro": "^5",
54
54
  "@lingui/react": "^5",
55
- "@mui/lab": "^7.0.0-beta.0",
55
+ "@mui/lab": "7.0.1-beta.20",
56
56
  "@mui/material": "^7.0.0",
57
57
  "framer-motion": "^11.0.0",
58
58
  "next": "*",