@graphcommerce/next-ui 8.1.0-canary.3 → 8.1.0-canary.30

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 (38) hide show
  1. package/ActionCard/ActionCard.tsx +27 -3
  2. package/ActionCard/ActionCardListForm.tsx +41 -33
  3. package/Breadcrumbs/Breadcrumbs.tsx +195 -0
  4. package/Breadcrumbs/BreadcrumbsJsonLd.tsx +13 -0
  5. package/Breadcrumbs/BreadcrumbsList.tsx +101 -0
  6. package/Breadcrumbs/BreadcrumbsPopper.tsx +48 -0
  7. package/Breadcrumbs/index.ts +4 -0
  8. package/Breadcrumbs/jsonLdBreadcrumb.tsx +19 -0
  9. package/Breadcrumbs/types.ts +11 -0
  10. package/CHANGELOG.md +203 -2
  11. package/Config.graphqls +5 -0
  12. package/FramerScroller/SidebarGallery.tsx +48 -28
  13. package/JsonLd/JsonLd.tsx +3 -2
  14. package/Layout/components/LayoutHeader.tsx +3 -0
  15. package/Layout/components/LayoutTitle.tsx +0 -5
  16. package/LayoutOverlay/test/LayoutOverlayDemo.tsx +1 -0
  17. package/LazyHydrate/LazyHydrate.tsx +17 -7
  18. package/Navigation/components/NavigationOverlay.tsx +1 -0
  19. package/Overlay/components/OverlayBase.tsx +5 -3
  20. package/Overlay/components/OverlaySsr.tsx +1 -0
  21. package/PageMeta/PageMeta.tsx +9 -4
  22. package/Styles/createEmotionCache.ts +1 -1
  23. package/Theme/DarkLightModeThemeProvider.tsx +41 -19
  24. package/TimeAgo/TimeAgo.tsx +8 -2
  25. package/hooks/index.ts +2 -0
  26. package/hooks/useDateTimeFormat.ts +3 -7
  27. package/hooks/useLocale.ts +7 -0
  28. package/hooks/useMatchMedia.ts +20 -1
  29. package/hooks/useNumberFormat.ts +3 -8
  30. package/hooks/useSsr.ts +11 -0
  31. package/icons.ts +50 -0
  32. package/index.ts +4 -0
  33. package/package.json +10 -9
  34. package/types.d.ts +0 -6
  35. package/utils/cssFlags.tsx +76 -0
  36. package/utils/robots.ts +41 -0
  37. package/utils/sitemap.ts +47 -0
  38. package/icons/index.ts +0 -48
package/CHANGELOG.md CHANGED
@@ -1,8 +1,209 @@
1
1
  # Change Log
2
2
 
3
- ## 8.1.0-canary.3
3
+ ## 8.1.0-canary.30
4
4
 
5
- ## 8.1.0-canary.2
5
+ ## 8.1.0-canary.29
6
+
7
+ ## 8.1.0-canary.28
8
+
9
+ ## 8.1.0-canary.27
10
+
11
+ ### Minor Changes
12
+
13
+ - [#2273](https://github.com/graphcommerce-org/graphcommerce/pull/2273) [`77955c5`](https://github.com/graphcommerce-org/graphcommerce/commit/77955c56ac8633ab1c5e0f3ddb25e3a87236e2bb) - Improve Breadcrumbs on Category and Product pages
14
+ ([@Jessevdpoel](https://github.com/Jessevdpoel))
15
+
16
+ ## 8.1.0-canary.26
17
+
18
+ ### Minor Changes
19
+
20
+ - [#2274](https://github.com/graphcommerce-org/graphcommerce/pull/2274) [`4a24813`](https://github.com/graphcommerce-org/graphcommerce/commit/4a248130041484833768fe6018f91d05a59522de) - Add props to DarkLightModeThemeProvider to disable dark/light mode or to change the default ssr mode. Save user chosen mode in localStorage
21
+ ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
22
+
23
+ ### Patch Changes
24
+
25
+ - [#2274](https://github.com/graphcommerce-org/graphcommerce/pull/2274) [`57131cf`](https://github.com/graphcommerce-org/graphcommerce/commit/57131cfcc43695cc3e22f28912feb2a8439620a7) - Created a cssFlags functionality to allow for conditional rendering based on stored flags in the localStorage
26
+ ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
27
+
28
+ ## 8.1.0-canary.25
29
+
30
+ ## 8.1.0-canary.24
31
+
32
+ ## 8.1.0-canary.23
33
+
34
+ ## 8.1.0-canary.22
35
+
36
+ ## 8.1.0-canary.21
37
+
38
+ ## 8.1.0-canary.20
39
+
40
+ ## 8.1.0-canary.19
41
+
42
+ ## 8.1.0-canary.18
43
+
44
+ ## 8.1.0-canary.17
45
+
46
+ ### Minor Changes
47
+
48
+ - [#2209](https://github.com/graphcommerce-org/graphcommerce/pull/2209) [`2872cab`](https://github.com/graphcommerce-org/graphcommerce/commit/2872cabdca9ee4f0378fd411c6a633f71bb92f1f) - Removed useMediaQuery from the wishlist and cart ItemActionCard and replaced it with a new responsive size prop.
49
+ ([@Jessevdpoel](https://github.com/Jessevdpoel))
50
+
51
+ ## 8.1.0-canary.16
52
+
53
+ ## 8.1.0-canary.15
54
+
55
+ ## 8.1.0-canary.14
56
+
57
+ ## 8.1.0-canary.13
58
+
59
+ ## 8.1.0-canary.12
60
+
61
+ ## 8.1.0-canary.11
62
+
63
+ ## 8.1.0-canary.10
64
+
65
+ ## 8.1.0-canary.9
66
+
67
+ ### Patch Changes
68
+
69
+ - [#2223](https://github.com/graphcommerce-org/graphcommerce/pull/2223) [`d7459fe`](https://github.com/graphcommerce-org/graphcommerce/commit/d7459feb6e6902af09ab9ff766c0b3b1a74fb723) - Updated canonicalize helper for better multi domain support
70
+ ([@bramvanderholst](https://github.com/bramvanderholst))
71
+
72
+ ## 8.1.0-canary.8
73
+
74
+ ### Patch Changes
75
+
76
+ - [#2247](https://github.com/graphcommerce-org/graphcommerce/pull/2247) [`444e446`](https://github.com/graphcommerce-org/graphcommerce/commit/444e446a218cc9da3defb940a6d5cce0229ff845) - Added clear upgrade instructions for linguiLocale
77
+ ([@paales](https://github.com/paales))
78
+
79
+ ## 8.1.0-canary.7
80
+
81
+ ## 8.1.0-canary.6
82
+
83
+ ## 8.1.0-canary.5
84
+
85
+ ## 8.0.6-canary.4
86
+
87
+ ## 8.0.6-canary.3
88
+
89
+ ## 8.0.6-canary.2
90
+
91
+ ### Patch Changes
92
+
93
+ - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`43bd04a`](https://github.com/graphcommerce-org/graphcommerce/commit/43bd04a777c5800cc7e01bee1e123a5aad82f194) - Added useIsSSR hook that will properly resolve when the page is rendered on the server and on first render, but will return false when a component is rendered on the client directly.
94
+ ([@FrankHarland](https://github.com/FrankHarland))
95
+
96
+ - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`0767bc4`](https://github.com/graphcommerce-org/graphcommerce/commit/0767bc40f7b596209f24ca4e745ff0441f3275c9) - Upgrade input components to no longer use muiRegister, which improves INP scores
97
+ ([@FrankHarland](https://github.com/FrankHarland))
98
+
99
+ ## 8.0.6-canary.1
100
+
101
+ ## 8.0.6-canary.0
102
+
103
+ ### Patch Changes
104
+
105
+ - [#2196](https://github.com/graphcommerce-org/graphcommerce/pull/2196) [`84c50e4`](https://github.com/graphcommerce-org/graphcommerce/commit/84c50e49a1a7f154d4a8f4045c37e773e20283ad) - Allow Lingui to use linguiLocale with country identifiers like `en-us`, it would always load `en` in this case. Introced a new `useLocale` hook to use the correct locale string to use in Intl methods.
106
+ ([@paales](https://github.com/paales))
107
+
108
+ ## 8.0.5
109
+
110
+ ### Patch Changes
111
+
112
+ - [#2236](https://github.com/graphcommerce-org/graphcommerce/pull/2236) [`85fb916`](https://github.com/graphcommerce-org/graphcommerce/commit/85fb916e5ec2a1456a93a59bf92a5f414fee8595) - Solve issue where the inert prop wouldnt be properly forwarded
113
+ ([@paales](https://github.com/paales))
114
+
115
+ - [#2235](https://github.com/graphcommerce-org/graphcommerce/pull/2235) [`de99691`](https://github.com/graphcommerce-org/graphcommerce/commit/de9969155e271cc2535147479b80b602a1b9c335) - The Lazyhydrate component to accepts any BoxProps. Replaced `<section>` with a `<Box>` so it doesn't hold symantic meaning.
116
+
117
+ Please note: If you've used child selectors to style the section, please make sure you update your styles. ([@carlocarels90](https://github.com/carlocarels90))
118
+
119
+ - [#2241](https://github.com/graphcommerce-org/graphcommerce/pull/2241) [`6f3fe60`](https://github.com/graphcommerce-org/graphcommerce/commit/6f3fe60441762d55cb46d587279121e8fe469cdd) - Decreased layout shift on product pages by reserving space for sidebar
120
+ ([@bramvanderholst](https://github.com/bramvanderholst))
121
+
122
+ - [#2241](https://github.com/graphcommerce-org/graphcommerce/pull/2241) [`cde3c31`](https://github.com/graphcommerce-org/graphcommerce/commit/cde3c310abf2ac3c82d1062d5fb0a4c00ba50cff) - Removed unnecessary vendor prefixes
123
+ ([@bramvanderholst](https://github.com/bramvanderholst))
124
+
125
+ - [#2241](https://github.com/graphcommerce-org/graphcommerce/pull/2241) [`4c83636`](https://github.com/graphcommerce-org/graphcommerce/commit/4c836366c324881ee5121c645c5f94fc60e3ebb3) - Prevent horizontal scrollbar on small screens when using SidebarGallery
126
+ ([@bramvanderholst](https://github.com/bramvanderholst))
127
+
128
+ - [#2230](https://github.com/graphcommerce-org/graphcommerce/pull/2230) [`1da6b82`](https://github.com/graphcommerce-org/graphcommerce/commit/1da6b82dbb7e1543542d809ea625a8867643ea68) - Fix menu item visibility in accessability tree
129
+ ([@JoshuaS98](https://github.com/JoshuaS98))
130
+
131
+ ## 8.0.5-canary.10
132
+
133
+ ## 8.0.5-canary.9
134
+
135
+ ## 8.0.5-canary.8
136
+
137
+ ## 8.0.5-canary.7
138
+
139
+ ### Patch Changes
140
+
141
+ - [#2241](https://github.com/graphcommerce-org/graphcommerce/pull/2241) [`6f3fe60`](https://github.com/graphcommerce-org/graphcommerce/commit/6f3fe60441762d55cb46d587279121e8fe469cdd) - Decreased layout shift on product pages by reserving space for sidebar
142
+ ([@bramvanderholst](https://github.com/bramvanderholst))
143
+
144
+ - [#2241](https://github.com/graphcommerce-org/graphcommerce/pull/2241) [`cde3c31`](https://github.com/graphcommerce-org/graphcommerce/commit/cde3c310abf2ac3c82d1062d5fb0a4c00ba50cff) - Removed unnecessary vendor prefixes
145
+ ([@bramvanderholst](https://github.com/bramvanderholst))
146
+
147
+ - [#2241](https://github.com/graphcommerce-org/graphcommerce/pull/2241) [`4c83636`](https://github.com/graphcommerce-org/graphcommerce/commit/4c836366c324881ee5121c645c5f94fc60e3ebb3) - Prevent horizontal scrollbar on small screens when using SidebarGallery
148
+ ([@bramvanderholst](https://github.com/bramvanderholst))
149
+
150
+ ## 8.0.5-canary.6
151
+
152
+ ## 8.0.5-canary.5
153
+
154
+ ## 8.0.5-canary.4
155
+
156
+ ## 8.0.5-canary.3
157
+
158
+ ### Patch Changes
159
+
160
+ - [#2236](https://github.com/graphcommerce-org/graphcommerce/pull/2236) [`85fb916`](https://github.com/graphcommerce-org/graphcommerce/commit/85fb916e5ec2a1456a93a59bf92a5f414fee8595) - Solve issue where the inert prop wouldnt be properly forwarded
161
+ ([@paales](https://github.com/paales))
162
+
163
+ ## 8.0.5-canary.2
164
+
165
+ ### Patch Changes
166
+
167
+ - [#2235](https://github.com/graphcommerce-org/graphcommerce/pull/2235) [`de99691`](https://github.com/graphcommerce-org/graphcommerce/commit/de9969155e271cc2535147479b80b602a1b9c335) - The Lazyhydrate component to accepts any BoxProps. Replaced `<section>` with a `<Box>` so it doesn't hold symantic meaning.
168
+
169
+ Please note: If you've used child selectors to style the section, please make sure you update your styles. ([@carlocarels90](https://github.com/carlocarels90))
170
+
171
+ ## 8.0.5-canary.1
172
+
173
+ ## 8.0.5-canary.0
174
+
175
+ ### Patch Changes
176
+
177
+ - [#2230](https://github.com/graphcommerce-org/graphcommerce/pull/2230) [`1da6b82`](https://github.com/graphcommerce-org/graphcommerce/commit/1da6b82dbb7e1543542d809ea625a8867643ea68) - Fix menu item visibility in accessability tree
178
+ ([@JoshuaS98](https://github.com/JoshuaS98))
179
+
180
+ ## 8.0.4
181
+
182
+ ### Patch Changes
183
+
184
+ - [#2228](https://github.com/graphcommerce-org/graphcommerce/pull/2228) [`0c0cacb`](https://github.com/graphcommerce-org/graphcommerce/commit/0c0cacb8725f0a626ea5d3acf154d83c433c3eb7) - apply correct type for the inert property
185
+ ([@carlocarels90](https://github.com/carlocarels90))
186
+
187
+ ## 8.0.4-canary.1
188
+
189
+ ## 8.0.4-canary.0
190
+
191
+ ### Patch Changes
192
+
193
+ - [#2228](https://github.com/graphcommerce-org/graphcommerce/pull/2228) [`0c0cacb`](https://github.com/graphcommerce-org/graphcommerce/commit/0c0cacb8725f0a626ea5d3acf154d83c433c3eb7) - apply correct type for the inert property
194
+ ([@carlocarels90](https://github.com/carlocarels90))
195
+
196
+ ## 8.0.3
197
+
198
+ ## 8.0.3-canary.6
199
+
200
+ ## 8.0.3-canary.5
201
+
202
+ ## 8.0.3-canary.4
203
+
204
+ ## 8.0.3-canary.3
205
+
206
+ ## 8.0.3-canary.2
6
207
 
7
208
  ## 8.0.3-canary.1
8
209
 
package/Config.graphqls CHANGED
@@ -3,6 +3,11 @@ extend input GraphCommerceConfig {
3
3
  Configuration for the SidebarGallery component
4
4
  """
5
5
  sidebarGallery: SidebarGalleryConfig
6
+
7
+ """
8
+ Configuration for the SidebarGallery component
9
+ """
10
+ breadcrumbs: Boolean = false
6
11
  }
7
12
 
8
13
  """
@@ -31,7 +31,14 @@ import { iconChevronLeft, iconChevronRight, iconFullscreen, iconFullscreenExit }
31
31
 
32
32
  const MotionBox = styled(m.div)({})
33
33
 
34
- type OwnerState = { zoomed: boolean; disableZoom: boolean }
34
+ type SidebarGalleryVariant = 'default' | 'oneColumn'
35
+
36
+ type OwnerState = {
37
+ zoomed: boolean
38
+ disableZoom: boolean
39
+ sticky: boolean
40
+ variantMd: SidebarGalleryVariant
41
+ }
35
42
  const name = 'SidebarGallery' as const
36
43
  const parts = [
37
44
  'row',
@@ -60,6 +67,8 @@ export type SidebarGalleryProps = {
60
67
  routeHash?: string
61
68
  sx?: SxProps<Theme>
62
69
  disableZoom?: boolean
70
+ disableSticky?: boolean
71
+ variantMd?: SidebarGalleryVariant
63
72
  } & Pick<ScrollerButtonProps, 'showButtons'>
64
73
 
65
74
  export function SidebarGallery(props: SidebarGalleryProps) {
@@ -71,6 +80,8 @@ export function SidebarGallery(props: SidebarGalleryProps) {
71
80
  routeHash = 'gallery',
72
81
  showButtons,
73
82
  disableZoom = false,
83
+ disableSticky = false,
84
+ variantMd = 'default',
74
85
  } = props
75
86
 
76
87
  const router = useRouter()
@@ -103,7 +114,7 @@ export function SidebarGallery(props: SidebarGalleryProps) {
103
114
  }
104
115
  }
105
116
 
106
- const classes = withState({ zoomed, disableZoom })
117
+ const classes = withState({ zoomed, disableZoom, sticky: !disableSticky, variantMd })
107
118
  const theme = useTheme()
108
119
  const windowRef = useRef(typeof window !== 'undefined' ? window : null)
109
120
 
@@ -144,23 +155,31 @@ export function SidebarGallery(props: SidebarGalleryProps) {
144
155
  display: 'grid',
145
156
  gridTemplate: '"left" "right"',
146
157
  [theme.breakpoints.up('md')]: {
147
- // gridTemplateColumns: '1fr auto',
148
- gridTemplate: '"left right" / 1fr auto',
158
+ '&:not(.variantMdOneColumn)': {
159
+ gridTemplate: `"left right" / 1fr calc(${responsiveVal(300, 500, theme.breakpoints.values.lg)} + ${
160
+ theme.page.horizontal
161
+ } * 2)`,
162
+ },
149
163
  },
150
164
  background:
151
165
  theme.palette.mode === 'light'
152
166
  ? theme.palette.background.image
153
167
  : theme.palette.background.paper,
154
- paddingRight: `calc((100% - ${theme.breakpoints.values.lg}px) / 2)`,
155
- },
156
- zoomed && {
157
- position: 'relative',
158
- zIndex: theme.zIndex.modal,
159
- marginTop: `calc(${theme.appShell.headerHeightSm} * -1)`,
160
- [theme.breakpoints.up('md')]: {
161
- marginTop: `calc(${theme.appShell.headerHeightMd} * -1 - ${theme.spacings.lg})`,
168
+
169
+ '&:not(.variantMdOneColumn)': {
170
+ paddingRight: `calc((100% - ${theme.breakpoints.values.lg}px) / 2)`,
171
+ },
172
+
173
+ '&.zoomed': {
174
+ position: 'relative',
175
+ zIndex: theme.zIndex.modal,
176
+ marginTop: `calc(${theme.appShell.headerHeightSm} * -1)`,
177
+ [theme.breakpoints.up('md')]: {
178
+ marginTop: `calc(${theme.appShell.headerHeightMd} * -1 - ${theme.spacings.lg})`,
179
+ gridTemplateColumns: '1fr auto',
180
+ },
181
+ paddingRight: 0,
162
182
  },
163
- paddingRight: 0,
164
183
  },
165
184
  ]}
166
185
  >
@@ -178,14 +197,18 @@ export function SidebarGallery(props: SidebarGalleryProps) {
178
197
  position: 'relative',
179
198
  paddingTop: `min(${ratio}, ${maxHeight})`,
180
199
  [theme.breakpoints.down('md')]: {
181
- width: '100vw',
200
+ width: '100%',
182
201
  },
183
202
  [theme.breakpoints.up('md')]: {
184
- height: `calc(${dvh(100)} - ${theme.appShell.headerHeightMd} - ${
185
- theme.spacings.lg
186
- })`,
187
- position: 'sticky',
188
- top: theme.appShell.headerHeightMd,
203
+ '&:not(.variantMdOneColumn)': {
204
+ height: `calc(${dvh(100)} - ${theme.appShell.headerHeightMd} - ${
205
+ theme.spacings.lg
206
+ })`,
207
+ '&.sticky': {
208
+ position: 'sticky',
209
+ },
210
+ top: theme.appShell.headerHeightMd,
211
+ },
189
212
  },
190
213
  },
191
214
  zoomed && {
@@ -333,7 +356,7 @@ export function SidebarGallery(props: SidebarGalleryProps) {
333
356
  'THUMBNAILS_BOTTOM' ? (
334
357
  <ScrollerThumbnails images={images} />
335
358
  ) : (
336
- <ScrollerDots />
359
+ <ScrollerDots layout />
337
360
  )}
338
361
  </Box>
339
362
  </MotionBox>
@@ -348,11 +371,6 @@ export function SidebarGallery(props: SidebarGalleryProps) {
348
371
  justifyItems: 'start',
349
372
  alignContent: 'center',
350
373
  position: 'relative',
351
- [theme.breakpoints.up('md')]: {
352
- width: `calc(${responsiveVal(300, 500, theme.breakpoints.values.lg)} + ${
353
- theme.page.horizontal
354
- } * 2)`,
355
- },
356
374
  },
357
375
  zoomed && {
358
376
  [theme.breakpoints.up('md')]: {
@@ -373,9 +391,11 @@ export function SidebarGallery(props: SidebarGalleryProps) {
373
391
  sx={{
374
392
  boxSizing: 'border-box',
375
393
  width: '100%',
376
- padding: `${theme.spacings.lg} ${theme.page.horizontal}`,
377
- [theme.breakpoints.up('md')]: {
378
- paddingLeft: theme.spacings.lg,
394
+ '&:not(.variantMdOneColumn)': {
395
+ padding: `${theme.spacings.lg} ${theme.page.horizontal}`,
396
+ [theme.breakpoints.up('md')]: {
397
+ paddingLeft: theme.spacings.lg,
398
+ },
379
399
  },
380
400
  }}
381
401
  >
package/JsonLd/JsonLd.tsx CHANGED
@@ -2,14 +2,15 @@ import Head from 'next/head'
2
2
  import { safeJsonLdReplacer } from './safeJsonLdReplacer'
3
3
 
4
4
  export function JsonLd<T extends { '@type': string }>(props: {
5
+ keyVal?: string
5
6
  item: T & { '@context': 'https://schema.org' }
6
7
  }) {
7
- const { item } = props
8
+ const { item, keyVal } = props
8
9
 
9
10
  return (
10
11
  <Head>
11
12
  <script
12
- key='jsonld'
13
+ key={keyVal ?? 'jsonld'}
13
14
  type='application/ld+json'
14
15
  // eslint-disable-next-line react/no-danger
15
16
  dangerouslySetInnerHTML={{ __html: JSON.stringify(item, safeJsonLdReplacer) }}
@@ -140,6 +140,9 @@ export function LayoutHeader(props: LayoutHeaderProps) {
140
140
  '&.divider': {
141
141
  marginBottom: 0,
142
142
  },
143
+ '& .LayoutHeaderContent-left': import.meta.graphCommerce.breadcrumbs && {
144
+ display: 'none',
145
+ },
143
146
  },
144
147
  }),
145
148
  ...(Array.isArray(sx) ? sx : [sx]),
@@ -40,12 +40,7 @@ export const LayoutTitle = React.forwardRef<HTMLDivElement, TitleProps>((props,
40
40
  alignItems: 'center',
41
41
  justifyContent: 'center',
42
42
  gap: `6px`,
43
- flexFlow: 'unset',
44
- [theme.breakpoints.up('md')]: {
45
- flexFlow: 'column',
46
- },
47
43
  '&.sizeSmall': {
48
- flexFlow: 'unset',
49
44
  overflow: 'hidden',
50
45
  '& svg': {
51
46
  width: responsiveVal(24, 28),
@@ -9,6 +9,7 @@ export type LayoutOverlayState = Omit<
9
9
  | 'mdSpacingTop'
10
10
  | 'smSpacingTop'
11
11
  | 'overlayPaneProps'
12
+ | 'disableInert'
12
13
  | 'widthMd'
13
14
  | 'widthSm'
14
15
  >
@@ -1,9 +1,10 @@
1
+ import { Box, BoxProps } from '@mui/material'
1
2
  import React, { useState, useRef, startTransition, useLayoutEffect, useEffect } from 'react'
2
3
 
3
4
  // Make sure the server doesn't choke on the useLayoutEffect
4
5
  export const useLayoutEffect2 = typeof window !== 'undefined' ? useLayoutEffect : useEffect
5
6
 
6
- export type LazyHydrateProps = {
7
+ export type LazyHydrateProps = BoxProps<'div'> & {
7
8
  /**
8
9
  * The content is always rendered on the server and on the client it uses the server rendered HTML until it is hydrated.
9
10
  */
@@ -25,8 +26,8 @@ export type LazyHydrateProps = {
25
26
  * This can be a way to improve the TBT of a page.
26
27
  */
27
28
  export function LazyHydrate(props: LazyHydrateProps) {
28
- const { hydrated, children } = props
29
- const rootRef = useRef<HTMLElement>(null)
29
+ const { hydrated, children, ...elementProps } = props
30
+ const rootRef = useRef<HTMLDivElement>(null)
30
31
 
31
32
  const [isHydrated, setIsHydrated] = useState(hydrated || false)
32
33
  if (!isHydrated && hydrated) setIsHydrated(true)
@@ -58,15 +59,24 @@ export function LazyHydrate(props: LazyHydrateProps) {
58
59
  }, [hydrated, isHydrated])
59
60
 
60
61
  if (isHydrated) {
61
- return <section>{children}</section>
62
+ return <Box {...elementProps}>{children}</Box>
62
63
  }
63
64
 
64
65
  if (typeof window === 'undefined') {
65
- return <section data-lazy-hydrate>{children}</section>
66
+ return (
67
+ <Box data-lazy-hydrate {...elementProps}>
68
+ {children}
69
+ </Box>
70
+ )
66
71
  }
67
72
 
68
73
  return (
69
- // eslint-disable-next-line react/no-danger
70
- <section ref={rootRef} dangerouslySetInnerHTML={{ __html: '' }} suppressHydrationWarning />
74
+ <Box
75
+ ref={rootRef}
76
+ // eslint-disable-next-line react/no-danger
77
+ dangerouslySetInnerHTML={{ __html: '' }}
78
+ suppressHydrationWarning
79
+ {...elementProps}
80
+ />
71
81
  )
72
82
  }
@@ -162,6 +162,7 @@ export const NavigationOverlay = React.memo((props: NavigationOverlayProps) => {
162
162
  }
163
163
  right={
164
164
  <Fab
165
+ disabled={!activeAndNotClosing}
165
166
  color='inherit'
166
167
  onClick={handleClose}
167
168
  sx={{ boxShadow: 'none', my: fabMarginY }}
@@ -52,6 +52,7 @@ export type LayoutOverlayBaseProps = {
52
52
  isPresent: boolean
53
53
  safeToRemove?: (() => void) | null | undefined
54
54
  overlayPaneProps?: MotionProps
55
+ disableInert?: boolean
55
56
 
56
57
  /* For `variantSm='left|right' */
57
58
  widthSm?: string | false
@@ -109,6 +110,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
109
110
  isPresent,
110
111
  safeToRemove,
111
112
  overlayPaneProps,
113
+ disableInert,
112
114
  widthMd = 'max(800px, 50vw)',
113
115
  widthSm = 'max(300px, 80vw)',
114
116
  } = props
@@ -247,7 +249,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
247
249
  const cancelY = scroll.y.on('change', handleScroll)
248
250
 
249
251
  const ro = new ResizeObserver(handleResize)
250
- ro.observe(scrollerRef.current)
252
+ if (scrollerRef.current) ro.observe(scrollerRef.current)
251
253
  ro.observe(beforeRef.current)
252
254
  ro.observe(overlayPaneRef.current)
253
255
  ro.observe(overlayRef.current)
@@ -363,7 +365,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
363
365
  return (
364
366
  <>
365
367
  <MotionDiv
366
- inert={active ? undefined : 'true'}
368
+ inert={active ? undefined : ('true' as unknown as boolean)}
367
369
  className={classes.backdrop}
368
370
  style={{ opacity: positions.open.visible }}
369
371
  sx={[
@@ -385,7 +387,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
385
387
  ]}
386
388
  />
387
389
  <Scroller
388
- inert={active ? undefined : 'true'}
390
+ inert={disableInert || active ? undefined : ('true' as unknown as boolean)}
389
391
  className={`${classes.scroller} ${className ?? ''}`}
390
392
  grid={false}
391
393
  onClick={onClickAway}
@@ -31,6 +31,7 @@ export function OverlaySsr(props: OverlayProps) {
31
31
  <OverlayContainer active={active} hidden={hidden}>
32
32
  <ScrollerProvider {...variantsToScrollSnapType(props)}>
33
33
  <OverlayBase
34
+ disableInert
34
35
  variantMd={variantMd}
35
36
  variantSm={variantSm}
36
37
  active={active}
@@ -70,11 +70,16 @@ export function canonicalize(router: PartialNextRouter, incoming?: Canonical) {
70
70
  if (localeDomain) {
71
71
  canonical = localeDomain
72
72
  } else {
73
- href = addBasePath(addLocale(as, curLocale, router.defaultLocale))
73
+ const conf = storefrontConfig(router.locale)
74
+
75
+ href = addBasePath(
76
+ addLocale(as, curLocale, conf?.domain ? conf.locale : router.defaultLocale),
77
+ )
78
+
79
+ let siteUrl = conf?.canonicalBaseUrl || import.meta.graphCommerce.canonicalBaseUrl
80
+
81
+ if (conf?.domain && !conf?.canonicalBaseUrl) siteUrl = `https://${conf.domain}`
74
82
 
75
- let siteUrl =
76
- storefrontConfig(router.locale)?.canonicalBaseUrl ||
77
- import.meta.graphCommerce.canonicalBaseUrl
78
83
  if (siteUrl.endsWith('/')) siteUrl = siteUrl.slice(0, -1)
79
84
 
80
85
  canonical = `${siteUrl}${href}`
@@ -10,5 +10,5 @@ export const createEmotionCache = () => {
10
10
  insertionPoint = emotionInsertionPoint ?? undefined
11
11
  }
12
12
 
13
- return createCache({ key: 'mui-style', insertionPoint })
13
+ return createCache({ key: 'mui-style', insertionPoint, stylisPlugins: [] })
14
14
  }