@graphcommerce/next-ui 9.0.0-canary.99 → 9.0.1-canary.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.
Files changed (189) hide show
  1. package/ActionCard/ActionCard.tsx +219 -203
  2. package/ActionCard/ActionCardAccordion.tsx +4 -2
  3. package/ActionCard/ActionCardLayout.tsx +3 -2
  4. package/ActionCard/ActionCardList.tsx +6 -5
  5. package/Blog/BlogAuthor/BlogAuthor.tsx +5 -4
  6. package/Blog/BlogContent/BlogContent.tsx +3 -2
  7. package/Blog/BlogHeader/BlogHeader.tsx +4 -3
  8. package/Blog/BlogList/BlogList.tsx +3 -3
  9. package/Blog/BlogListItem/BlogListItem.tsx +6 -5
  10. package/Blog/BlogTags/BlogTag.tsx +3 -2
  11. package/Blog/BlogTags/BlogTags.tsx +1 -1
  12. package/Breadcrumbs/Breadcrumbs.tsx +25 -19
  13. package/Breadcrumbs/BreadcrumbsList.tsx +3 -2
  14. package/Breadcrumbs/jsonLdBreadcrumb.tsx +1 -1
  15. package/Breadcrumbs/types.ts +1 -2
  16. package/Button/Button.tsx +2 -1
  17. package/Button/LinkOrButton.tsx +4 -2
  18. package/CHANGELOG.md +295 -1343
  19. package/ChipMenu/ChipMenu.tsx +3 -2
  20. package/Config.graphqls +28 -10
  21. package/Container/Container.tsx +90 -0
  22. package/ContainerWithHeader/ContainerWithHeader.tsx +2 -1
  23. package/Document/DocumentBodyEnd.tsx +1 -1
  24. package/Document/DocumentBodyStart.tsx +1 -1
  25. package/Document/DocumentHeadEnd.tsx +1 -1
  26. package/Document/DocumentHeadStart.tsx +1 -1
  27. package/Fab/Fab.tsx +15 -17
  28. package/FlagAvatar/FlagAvatar.tsx +2 -1
  29. package/Footer/Footer.tsx +14 -10
  30. package/Form/Form.tsx +2 -1
  31. package/Form/FormHeader.tsx +1 -1
  32. package/Form/FormRow.tsx +1 -1
  33. package/Form/InputCheckmark.tsx +2 -1
  34. package/FramerScroller/ItemScroller.tsx +5 -8
  35. package/FramerScroller/SidebarGallery.tsx +23 -30
  36. package/FramerScroller/SidebarSlider.tsx +8 -7
  37. package/FullPageMessage/FullPageMessage.tsx +2 -1
  38. package/IconHeader/IconHeader.tsx +5 -3
  39. package/IconSvg/IconSvg.tsx +8 -7
  40. package/Intl/DateTimeFormat/DateFormat.tsx +6 -4
  41. package/Intl/DateTimeFormat/DateTimeFormat.tsx +10 -14
  42. package/Intl/DateTimeFormat/TimeFormat.tsx +6 -4
  43. package/Intl/DateTimeFormat/index.ts +1 -0
  44. package/Intl/DateTimeFormat/useIntlDateTimeFormat.ts +13 -0
  45. package/Intl/DisplayNames/DisplayNames.tsx +5 -13
  46. package/Intl/DisplayNames/index.ts +1 -0
  47. package/Intl/DisplayNames/useIntlDisplayNames.ts +12 -0
  48. package/Intl/{ListFormat.tsx → ListFormat/ListFormat.tsx} +8 -13
  49. package/Intl/ListFormat/index.ts +2 -0
  50. package/Intl/ListFormat/useIntlListFormat.ts +15 -0
  51. package/Intl/NumberFormat/CurrencyFormat.tsx +4 -2
  52. package/Intl/NumberFormat/NumberFormat.tsx +15 -17
  53. package/Intl/NumberFormat/PercentFormat.tsx +6 -2
  54. package/Intl/NumberFormat/UnitFormat.tsx +5 -5
  55. package/Intl/NumberFormat/index.ts +1 -0
  56. package/Intl/NumberFormat/useIntlNumberFormat.ts +17 -0
  57. package/Intl/RelativeTimeFormat/RelativeTimeFormat.tsx +6 -13
  58. package/Intl/RelativeTimeFormat/RelativeToTimeFormat.tsx +4 -2
  59. package/Intl/RelativeTimeFormat/index.ts +1 -0
  60. package/Intl/RelativeTimeFormat/useIntlRelativeTimeFormat.ts +15 -0
  61. package/Intl/useIntlLocalesArgument.ts +16 -0
  62. package/Layout/components/LayoutHeader.tsx +7 -4
  63. package/Layout/components/LayoutHeaderBack.tsx +6 -4
  64. package/Layout/components/LayoutHeaderClose.tsx +1 -1
  65. package/Layout/components/LayoutHeaderContent.tsx +11 -12
  66. package/Layout/components/LayoutProvider.tsx +1 -1
  67. package/Layout/components/LayoutTitle.tsx +5 -3
  68. package/Layout/context/layoutContext.tsx +1 -1
  69. package/Layout/types.ts +1 -1
  70. package/LayoutDefault/components/LayoutDefault.tsx +12 -10
  71. package/LayoutOverlay/components/LayoutOverlay.tsx +3 -2
  72. package/LayoutOverlay/components/LayoutOverlayHeader.tsx +2 -1
  73. package/LayoutOverlay/test/LayoutOverlayDemo.tsx +4 -1
  74. package/LayoutParts/DesktopHeaderBadge.tsx +2 -1
  75. package/LayoutParts/DesktopNavBar.tsx +26 -22
  76. package/LayoutParts/DesktopNavBarItem.tsx +11 -7
  77. package/LayoutParts/Logo.tsx +5 -5
  78. package/LayoutParts/MenuFab.tsx +7 -13
  79. package/LayoutParts/MenuFabItem.tsx +6 -1
  80. package/LayoutParts/MenuFabSecondaryItem.tsx +11 -7
  81. package/LayoutParts/MobileTopRight.tsx +24 -0
  82. package/LayoutParts/PlaceholderFab.tsx +2 -1
  83. package/LayoutParts/StickyBelowHeader.tsx +2 -1
  84. package/LayoutParts/index.ts +1 -0
  85. package/LazyHydrate/LazyHydrate.tsx +18 -21
  86. package/MediaQuery/MediaQuery.tsx +111 -0
  87. package/MediaQuery/index.ts +1 -0
  88. package/Navigation/components/NavigationFab.tsx +3 -2
  89. package/Navigation/components/NavigationItem.tsx +3 -3
  90. package/Navigation/components/NavigationList.tsx +4 -3
  91. package/Navigation/components/NavigationOverlay.tsx +18 -11
  92. package/Navigation/components/NavigationProvider.tsx +9 -8
  93. package/Navigation/components/NavigationTitle.tsx +5 -5
  94. package/Navigation/hooks/useNavigation.ts +4 -2
  95. package/Overlay/components/Overlay.tsx +3 -2
  96. package/Overlay/components/OverlayBase.tsx +71 -30
  97. package/Overlay/components/OverlayContainer.tsx +2 -2
  98. package/Overlay/components/OverlayHeader.tsx +7 -4
  99. package/Overlay/components/OverlaySsr.tsx +2 -1
  100. package/Overlay/components/OverlayStickyBottom.tsx +2 -1
  101. package/Overlay/utils/variantsToScrollSnapType.ts +2 -2
  102. package/OverlayOrPopperChip/OverlayOrPopperChip.tsx +5 -12
  103. package/OverlayOrPopperChip/OverlayOrPopperPanel.tsx +3 -3
  104. package/OverlayOrPopperChip/OverlayPanel.tsx +13 -7
  105. package/OverlayOrPopperChip/OverlayPanelActions.tsx +2 -2
  106. package/OverlayOrPopperChip/PopperPanel.tsx +3 -2
  107. package/OverlayOrPopperChip/PopperPanelActions.tsx +2 -2
  108. package/OverlayOrPopperChip/types.ts +2 -2
  109. package/OverlayOrPopperChip/useHandleClickNotDrag.ts +3 -1
  110. package/Page/CssAndFramerMotionProvider.tsx +2 -1
  111. package/Page/types.ts +5 -5
  112. package/PageLoadIndicator/PageLoadIndicator.tsx +3 -2
  113. package/PageMeta/PageMeta.tsx +3 -2
  114. package/PageMeta/canonicalize.ts +7 -3
  115. package/Pagination/Pagination.tsx +4 -2
  116. package/Pagination/PaginationExtended.tsx +2 -9
  117. package/RenderType/RenderType.tsx +6 -0
  118. package/Row/ButtonLinkList/ButtonLinkList.tsx +4 -7
  119. package/Row/ButtonLinkList/ButtonLinkListItem.tsx +2 -1
  120. package/Row/ColumnOne/variant/VariantMessage.tsx +2 -4
  121. package/Row/ColumnOneBoxed/ColumnOneBoxed.tsx +4 -2
  122. package/Row/ColumnOneCentered/ColumnOneCentered.tsx +4 -2
  123. package/Row/ColumnThree/ColumnThree.tsx +6 -5
  124. package/Row/ColumnTwo/ColumnTwo.tsx +8 -7
  125. package/Row/ColumnTwoSpread/ColumnTwoSpread.tsx +7 -5
  126. package/Row/ColumnTwoWithTop/ColumnTwoWithTop.tsx +5 -4
  127. package/Row/ContentLinks/ContentLinks.tsx +4 -3
  128. package/Row/HeroBanner/HeroBanner.tsx +3 -2
  129. package/Row/IconBlocks/IconBlock.tsx +3 -2
  130. package/Row/IconBlocks/IconBlocks.tsx +3 -2
  131. package/Row/ImageText/ImageText.tsx +3 -2
  132. package/Row/ImageTextBoxed/ImageTextBoxed.tsx +4 -3
  133. package/Row/ParagraphWithSidebarSlide/ParagraphWithSidebarSlide.tsx +3 -2
  134. package/Row/Quote/Quote.tsx +1 -1
  135. package/Row/Row.tsx +2 -1
  136. package/Row/RowLinks/RowLinks.tsx +36 -34
  137. package/Row/RowLinks/variant/VariantImageLabelSwiper.tsx +6 -2
  138. package/Row/RowLinks/variant/VariantInline.tsx +6 -2
  139. package/Row/RowLinks/variant/VariantLogoSwiper.tsx +2 -1
  140. package/Row/RowLinks/variant/VariantUsps.tsx +2 -1
  141. package/Row/SpecialBanner/SpecialBanner.tsx +3 -2
  142. package/SectionContainer/SectionContainer.tsx +3 -2
  143. package/SectionHeader/SectionHeader.tsx +2 -1
  144. package/Separator/Separator.tsx +3 -2
  145. package/Snackbar/DismissibleSnackbar.tsx +1 -1
  146. package/Snackbar/ErrorSnackbar.tsx +1 -1
  147. package/Snackbar/MessageSnackbarImpl.tsx +7 -16
  148. package/StarRatingField/StarRatingField.tsx +3 -2
  149. package/Stepper/Stepper.tsx +3 -2
  150. package/Styles/__tests__/spreadVal.test.ts +4 -4
  151. package/Styles/extendableComponent.ts +4 -3
  152. package/Styles/withEmotionCache.tsx +2 -2
  153. package/Styles/withTheme.tsx +4 -1
  154. package/TextInputNumber/TextInputNumber.tsx +5 -8
  155. package/Theme/DarkLightModeThemeProvider.tsx +10 -7
  156. package/Theme/MuiButton.ts +2 -1
  157. package/Theme/MuiChip.ts +2 -1
  158. package/Theme/MuiFab.ts +2 -1
  159. package/Theme/MuiSlider.ts +3 -3
  160. package/Theme/MuiSnackbar.ts +1 -1
  161. package/Theme/NextLink.tsx +35 -15
  162. package/Theme/createTheme.ts +6 -0
  163. package/Theme/index.ts +1 -0
  164. package/Theme/themeDefaults.ts +10 -10
  165. package/Theme/useContainerSizing.ts +20 -0
  166. package/TimeAgo/TimeAgo.tsx +3 -3
  167. package/ToggleButton/ToggleButton.tsx +6 -4
  168. package/ToggleButtonGroup/ToggleButtonGroup.tsx +99 -94
  169. package/UspList/UspList.tsx +3 -2
  170. package/UspList/UspListItem.tsx +3 -2
  171. package/hooks/memoDeep.ts +3 -2
  172. package/hooks/useDateTimeFormat.ts +3 -1
  173. package/hooks/useMatchMedia.ts +2 -1
  174. package/hooks/useMemoDeep.ts +2 -1
  175. package/hooks/useNumberFormat.ts +3 -1
  176. package/index.ts +3 -1
  177. package/package.json +17 -18
  178. package/utils/cookie.ts +4 -3
  179. package/utils/robots.ts +1 -1
  180. package/utils/sitemap.ts +3 -2
  181. package/utils/sxx.ts +16 -0
  182. package/AnimatedRow/AnimatedRow.tsx +0 -23
  183. package/docs/building-components.mdx +0 -3
  184. package/docs/components/ComponentBasic.tsx +0 -26
  185. package/docs/components/ComponentChild.tsx +0 -49
  186. package/docs/components/ComponentChildVariant.tsx +0 -55
  187. package/docs/components/ComponentChildVariantExtendable.tsx +0 -63
  188. package/docs/components/ComponentStylable.tsx +0 -32
  189. package/docs/pages/building-components.tsx +0 -62
@@ -1,21 +1,23 @@
1
- import { MotionConfig, useMotionValue, useTransform } from 'framer-motion'
1
+ import { useMotionValueValue } from '@graphcommerce/framer-utils'
2
+ import { MotionConfig, useMotionValue } from 'framer-motion'
2
3
  import React, { useMemo } from 'react'
3
4
  import { isElement } from 'react-is'
4
5
  import { LazyHydrate } from '../../LazyHydrate'
5
6
  import { nonNullable } from '../../RenderType/nonNullable'
6
- import {
7
- NavigationNode,
7
+ import type {
8
8
  NavigationContextType,
9
- NavigationContext,
10
- UseNavigationSelection,
11
- NavigationNodeType,
9
+ NavigationNode,
12
10
  NavigationNodeComponent,
11
+ UseNavigationSelection,
13
12
  } from '../hooks/useNavigation'
14
- import { useMotionValueValue } from '@graphcommerce/framer-utils'
13
+ import { NavigationContext, NavigationNodeType } from '../hooks/useNavigation'
15
14
 
16
15
  export type NavigationProviderBaseProps = {
17
16
  items: (NavigationNode | React.ReactElement)[]
18
17
  hideRootOnNavigate?: boolean
18
+ /**
19
+ * @deprecated No longer used
20
+ */
19
21
  closeAfterNavigate?: boolean
20
22
  children?: React.ReactNode
21
23
  animationDuration?: number
@@ -29,7 +31,6 @@ const NavigationProviderBase = React.memo<NavigationProviderBaseProps>((props) =
29
31
  const {
30
32
  items,
31
33
  hideRootOnNavigate = true,
32
- closeAfterNavigate = false,
33
34
  animationDuration = 0.225,
34
35
  children,
35
36
  selection,
@@ -1,11 +1,11 @@
1
1
  import { useMotionValueValue } from '@graphcommerce/framer-utils'
2
2
  import { Trans } from '@lingui/react'
3
- import {
4
- NavigationPath,
5
- NavigationNodeHref,
3
+ import type {
6
4
  NavigationNodeButton,
7
- useNavigation,
5
+ NavigationNodeHref,
6
+ NavigationPath,
8
7
  } from '../hooks/useNavigation'
8
+ import { useNavigation } from '../hooks/useNavigation'
9
9
 
10
10
  function findCurrent(
11
11
  items,
@@ -32,7 +32,7 @@ function findCurrent(
32
32
  return result
33
33
  }
34
34
 
35
- export const NavigationTitle = () => {
35
+ export function NavigationTitle() {
36
36
  const { selection, items } = useNavigation()
37
37
  return (
38
38
  <>{useMotionValueValue(selection, (v) => findCurrent(items, v))?.name ?? <Trans id='Menu' />}</>
@@ -1,5 +1,7 @@
1
- import { MotionValue, useMotionValue } from 'framer-motion'
2
- import React, { createContext, useContext } from 'react'
1
+ import type { MotionValue } from 'framer-motion'
2
+ import { useMotionValue } from 'framer-motion'
3
+ import type React from 'react'
4
+ import { createContext, useContext } from 'react'
3
5
 
4
6
  export type NavigationId = string | number
5
7
  export type NavigationPath = NavigationId[]
@@ -3,12 +3,13 @@ import { Portal } from '@mui/material'
3
3
  import { AnimatePresence, usePresence } from 'framer-motion'
4
4
  import type { SetOptional } from 'type-fest'
5
5
  import { variantsToScrollSnapType } from '../utils/variantsToScrollSnapType'
6
- import { OverlayBase, LayoutOverlayBaseProps } from './OverlayBase'
6
+ import type { LayoutOverlayBaseProps } from './OverlayBase'
7
+ import { OverlayBase } from './OverlayBase'
7
8
  import { OverlayContainer } from './OverlayContainer'
8
9
 
9
10
  export type OverlayTmpProps = Omit<
10
11
  SetOptional<LayoutOverlayBaseProps, 'variantSm' | 'variantMd'>,
11
- 'direction' | 'offsetPageY' | 'isPresent' | 'safeToRemove'
12
+ 'offsetPageY' | 'isPresent' | 'safeToRemove'
12
13
  >
13
14
 
14
15
  function OverlayUsePresence(props: OverlayTmpProps) {
@@ -1,4 +1,4 @@
1
- import { Direction } from '@graphcommerce/framer-next-pages'
1
+ import type { Direction } from '@graphcommerce/framer-next-pages'
2
2
  import { Scroller, useScrollerContext, useScrollTo } from '@graphcommerce/framer-scroller'
3
3
  import {
4
4
  dvh,
@@ -7,10 +7,11 @@ import {
7
7
  useElementScroll,
8
8
  useIsomorphicLayoutEffect,
9
9
  } from '@graphcommerce/framer-utils'
10
- import { Box, styled, SxProps, Theme, useTheme, useThemeProps } from '@mui/material'
10
+ import type { SxProps, Theme } from '@mui/material'
11
+ import { Box, styled, useTheme, useThemeProps } from '@mui/material'
12
+ import type { MotionProps } from 'framer-motion'
11
13
  import {
12
14
  m,
13
- MotionProps,
14
15
  motionValue,
15
16
  useDomEvent,
16
17
  useMotionValue,
@@ -18,11 +19,13 @@ import {
18
19
  useTransform,
19
20
  } from 'framer-motion'
20
21
  import React, { useCallback, useEffect, useRef } from 'react'
21
- import { LayoutProvider } from '../../Layout/components/LayoutProvider'
22
- import { ExtendableComponent, extendableComponent } from '../../Styles'
23
22
  import { useMatchMedia } from '../../hooks/useMatchMedia'
23
+ import { LayoutProvider } from '../../Layout/components/LayoutProvider'
24
+ import type { ExtendableComponent } from '../../Styles'
25
+ import { extendableComponent } from '../../Styles'
26
+ import { useContainerSizing } from '../../Theme'
24
27
 
25
- export type LayoutOverlayVariant = 'left' | 'bottom' | 'right'
28
+ export type LayoutOverlayVariant = 'left' | 'bottom' | 'right' | 'top'
26
29
  export type LayoutOverlaySize = 'floating' | 'minimal' | 'full'
27
30
  export type LayoutOverlayAlign = 'start' | 'end' | 'center' | 'stretch'
28
31
 
@@ -60,6 +63,9 @@ export type LayoutOverlayBaseProps = {
60
63
 
61
64
  /* For `variantMd='left|right' */
62
65
  widthMd?: string | false
66
+
67
+ disableAnimation?: boolean
68
+ disableDrag?: boolean
63
69
  } & StyleProps &
64
70
  OverridableProps
65
71
 
@@ -69,7 +75,7 @@ enum OverlayPosition {
69
75
  CLOSED = 0,
70
76
  }
71
77
 
72
- const name = 'LayoutOverlayBase' as const
78
+ const name = 'LayoutOverlayBase'
73
79
  const parts = [
74
80
  'scroller',
75
81
  'backdrop',
@@ -114,6 +120,8 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
114
120
  disableInert,
115
121
  widthMd = 'max(800px, 50vw)',
116
122
  widthSm = 'max(300px, 80vw)',
123
+ disableAnimation = false,
124
+ disableDrag = false,
117
125
  } = props
118
126
 
119
127
  const th = useTheme()
@@ -136,10 +144,15 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
136
144
  const overlayPaneScroll = useElementScroll(overlayPaneRef)
137
145
 
138
146
  const classes = withState({ variantSm, variantMd, sizeSm, sizeMd, justifySm, justifyMd })
147
+ const containerSizing = useContainerSizing('shell')
139
148
 
140
149
  const match = useMatchMedia()
141
150
  const positions = useConstant(() => ({
142
- open: { x: motionValue(0), y: motionValue(0), visible: motionValue(direction === 0 ? 1 : 0) },
151
+ open: {
152
+ x: motionValue(0),
153
+ y: motionValue(0),
154
+ visible: motionValue(direction === 0 || disableDrag ? 1 : 0),
155
+ },
143
156
  closed: { x: motionValue(0), y: motionValue(0) },
144
157
  }))
145
158
 
@@ -161,6 +174,9 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
161
174
  if (variant() === 'right') {
162
175
  return { open: [x.length - 1, 0], closed: [0, 0] }
163
176
  }
177
+ if (variant() === 'top') {
178
+ return { open: [0, y.length - 2], closed: [0, y.length - 1] }
179
+ }
164
180
  return { open: [0, y.length - 1], closed: [0, 0] }
165
181
  }, [getScrollSnapPositions, variant])
166
182
 
@@ -176,6 +192,10 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
176
192
  positions.closed.x.set(x[x.length - 1])
177
193
  positions.open.x.set(x[x.length - 2])
178
194
  }
195
+ if (variant() === 'top') {
196
+ positions.closed.y.set(y[y.length - 1])
197
+ positions.open.y.set(y[y.length - 2])
198
+ }
179
199
  if (variant() === 'right') {
180
200
  positions.open.x.set(x[x.length - 1])
181
201
  positions.closed.x.set(0)
@@ -197,8 +217,8 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
197
217
  scroll.y.set(positions.closed.y.get())
198
218
  } else {
199
219
  disableSnap()
200
- scroller.scrollLeft = scroll.x.getPrevious()
201
- scroller.scrollTop = scroll.y.getPrevious()
220
+ scroller.scrollLeft = scroll.x.getPrevious() ?? 0
221
+ scroller.scrollTop = scroll.y.getPrevious() ?? 0
202
222
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
203
223
  scrollTo(openClosePositions().open, { stopAnimationOnScroll: false })
204
224
  }
@@ -212,6 +232,10 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
212
232
  const closedX = positions.closed.x.get()
213
233
  vis = closedX === 0 ? 0 : clampRound((scroll.x.get() - closedX) / -closedX)
214
234
  }
235
+ if (variant() === 'top') {
236
+ const closedY = positions.closed.y.get()
237
+ vis = closedY === 0 ? 0 : clampRound((scroll.y.get() - closedY) / -closedY)
238
+ }
215
239
  if (variant() === 'right') {
216
240
  const openedX = positions.open.x.get()
217
241
  vis = openedX === 0 ? 0 : clampRound(scroll.x.get() / openedX)
@@ -283,7 +307,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
283
307
 
284
308
  if (variant() === 'right') document.body.style.overflow = 'hidden'
285
309
 
286
- if (direction === 0) {
310
+ if (direction === 0 || disableAnimation) {
287
311
  disableSnap()
288
312
  scroller.scrollTop = positions.open.y.get()
289
313
  scroller.scrollLeft = positions.open.x.get()
@@ -299,6 +323,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
299
323
  }
300
324
  }, [
301
325
  direction,
326
+ disableAnimation,
302
327
  disableSnap,
303
328
  enableSnap,
304
329
  isPresent,
@@ -319,12 +344,15 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
319
344
  const scroller = scrollerRef.current
320
345
  if (isPresent || !scroller) return
321
346
 
322
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
323
- scrollTo(openClosePositions().closed, { stopAnimationOnScroll: false }).then(() => {
347
+ const doAfter = () => {
324
348
  safeToRemove?.()
325
349
  document.body.style.overflow = ''
326
- })
327
- }, [isPresent, openClosePositions, position, positions, safeToRemove, scrollTo, scrollerRef])
350
+ }
351
+
352
+ if (disableAnimation) doAfter()
353
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
354
+ else scrollTo(openClosePositions().closed, { stopAnimationOnScroll: false }).then(doAfter)
355
+ }, [disableAnimation, isPresent, openClosePositions, safeToRemove, scrollTo, scrollerRef])
328
356
 
329
357
  // Only go back to a previous page if the overlay isn't closed.
330
358
  const closeOverlay = useCallback(() => {
@@ -416,6 +444,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
416
444
  className={`${classes.scroller} ${className ?? ''}`}
417
445
  grid={false}
418
446
  onClick={onClickAway}
447
+ disableDrag={disableDrag}
419
448
  hideScrollbar
420
449
  sx={[
421
450
  (theme) => ({
@@ -435,22 +464,22 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
435
464
  overscrollBehaviorX: 'none',
436
465
  },
437
466
  '&.variantSmLeft': {
438
- gridTemplate: `"overlay beforeOverlay"`,
467
+ gridTemplate: '"overlay beforeOverlay"',
439
468
  borderTopRightRadius: theme.shape.borderRadius * 3,
440
469
  borderBottomRightRadius: theme.shape.borderRadius * 3,
441
470
  },
442
471
  '&.variantSmRight': {
443
- gridTemplate: `"beforeOverlay overlay"`,
472
+ gridTemplate: '"beforeOverlay overlay"',
444
473
  borderTopLeftRadius: theme.shape.borderRadius * 3,
445
474
  borderBottomLeftRadius: theme.shape.borderRadius * 3,
446
475
  },
447
476
  '&.variantSmBottom': {
448
477
  overscrollBehaviorY: 'none',
449
- gridTemplate: `"beforeOverlay" "overlay"`,
478
+ gridTemplate: '"beforeOverlay" "overlay"',
450
479
  height: `calc(${dvh(100)} - 1px)`,
451
480
 
452
481
  '&::after': {
453
- content: `""`,
482
+ content: '""',
454
483
  display: 'block',
455
484
  position: 'absolute',
456
485
  width: '100%',
@@ -463,20 +492,22 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
463
492
  },
464
493
  [theme.breakpoints.up('md')]: {
465
494
  '&.variantMdLeft': {
466
- gridTemplate: `"overlay beforeOverlay"`,
495
+ gridTemplate: '"overlay beforeOverlay"',
467
496
  borderTopRightRadius: theme.shape.borderRadius * 4,
468
497
  borderBottomRightRadius: theme.shape.borderRadius * 4,
469
498
  },
470
499
  '&.variantMdRight': {
471
- gridTemplate: `"beforeOverlay overlay"`,
500
+ gridTemplate: '"beforeOverlay overlay"',
472
501
  borderTopLeftRadius: theme.shape.borderRadius * 4,
473
502
  borderBottomLeftRadius: theme.shape.borderRadius * 4,
474
503
  },
475
504
  '&.variantMdBottom': {
476
- [theme.breakpoints.up('md')]: {
477
- gridTemplate: `"beforeOverlay" "overlay"`,
478
- height: dvh(100),
479
- },
505
+ gridTemplate: '"beforeOverlay" "overlay"',
506
+ height: dvh(100),
507
+ },
508
+ '&.variantMdTop': {
509
+ gridTemplate: '"overlay" "beforeOverlay"',
510
+ height: dvh(100),
480
511
  },
481
512
  },
482
513
  }),
@@ -504,7 +535,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
504
535
  '&.variantMdLeft, &.variantMdRight': {
505
536
  width: dvw(100),
506
537
  },
507
- '&.variantMdBottom': {
538
+ '&.variantMdBottom, &.variantMdTop': {
508
539
  height: dvh(100),
509
540
  },
510
541
  },
@@ -521,7 +552,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
521
552
  '&.variantMdBottom, &.variantMdRight': {
522
553
  scrollSnapAlign: 'end',
523
554
  },
524
- '&.variantMdLeft': {
555
+ '&.variantMdTop, &.variantMdLeft': {
525
556
  scrollSnapAlign: 'start',
526
557
  },
527
558
  [theme.breakpoints.down('md')]: {
@@ -535,7 +566,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
535
566
  justifyContent: justifyMd,
536
567
  alignItems: justifyMd,
537
568
 
538
- '&.variantMdBottom': {
569
+ '&.variantMdBottom, &.variantMdTop': {
539
570
  display: 'grid',
540
571
  },
541
572
  '&.sizeMdFloating': {
@@ -543,6 +574,8 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
543
574
  },
544
575
  '&.sizeMdFloating.variantMdBottom': {
545
576
  marginTop: `calc(${theme.page.vertical} * -1)`,
577
+ maxWidth: containerSizing.value ?? 'unset',
578
+ mx: 'auto',
546
579
  },
547
580
  },
548
581
  })}
@@ -582,6 +615,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
582
615
  borderTopLeftRadius: `${theme.shape.borderRadius * 3}px`,
583
616
  borderTopRightRadius: `${theme.shape.borderRadius * 3}px`,
584
617
  },
618
+
585
619
  '&.variantSmLeft, &.variantSmRight': {
586
620
  overscrollBehaviorY: 'none',
587
621
  width: widthSm || 'max-content',
@@ -603,11 +637,14 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
603
637
  overflowY: 'auto',
604
638
  overflowX: 'hidden',
605
639
  overscrollBehavior: 'contain',
640
+ '&.variantMdTop.sizeMdFloating:not(.justifyMdStretch)': {
641
+ width: widthMd,
642
+ },
606
643
  '&.variantMdBottom.sizeMdFloating:not(.justifyMdStretch)': {
607
644
  width: widthMd,
608
645
  },
609
646
 
610
- '&.variantMdBottom': {
647
+ '&.variantMdBottom, &.variantMdTop': {
611
648
  maxHeight: `calc(${dvh(100)} - ${mdSpacingTop})`,
612
649
  paddingTop: mdSpacingTop,
613
650
  boxSizing: 'border-box',
@@ -670,9 +707,13 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
670
707
  borderTopLeftRadius: theme.shape.borderRadius * 4,
671
708
  borderTopRightRadius: theme.shape.borderRadius * 4,
672
709
  },
710
+ '&.variantMdTop': {
711
+ borderBottomLeftRadius: theme.shape.borderRadius * 4,
712
+ borderBottomRightRadius: theme.shape.borderRadius * 4,
713
+ },
673
714
  '&.sizeMdFull': {
674
715
  minHeight: dvh(100),
675
- '&.variantMdBottom': {
716
+ '&.variantMdBottom, &.variantMdTop': {
676
717
  minHeight: '100%',
677
718
  },
678
719
  },
@@ -1,7 +1,7 @@
1
1
  import { Box } from '@mui/material'
2
- import { LayoutOverlayBaseProps } from './OverlayBase'
2
+ import type { LayoutOverlayBaseProps } from './OverlayBase'
3
3
 
4
- type OverlayContainerProps = Pick<LayoutOverlayBaseProps, 'active'> & {
4
+ export type OverlayContainerProps = Pick<LayoutOverlayBaseProps, 'active'> & {
5
5
  hidden?: boolean
6
6
  children: React.ReactNode
7
7
  }
@@ -1,11 +1,14 @@
1
- import { LayoutHeaderProps, LayoutTitle, TitleProps } from '../../Layout'
1
+ import React from 'react'
2
+ import type { LayoutHeaderProps, TitleProps } from '../../Layout'
3
+ import { LayoutTitle } from '../../Layout'
2
4
  import { LayoutHeaderClose } from '../../Layout/components/LayoutHeaderClose'
3
5
  import { LayoutOverlayHeader } from '../../LayoutOverlay/components/LayoutOverlayHeader'
4
6
 
5
- type OverlayHeaderProps = Omit<LayoutHeaderProps, 'hideBackButton' | 'switchPoint'> &
7
+ export type OverlayHeaderProps = Omit<LayoutHeaderProps, 'hideBackButton' | 'switchPoint'> &
6
8
  Pick<TitleProps, 'icon'> & { onClose: () => void }
7
9
 
8
- export const OverlayHeader = (props: OverlayHeaderProps) => {
10
+ /** @public */
11
+ export function OverlayHeader(props: OverlayHeaderProps) {
9
12
  const { children, onClose, sx = [], icon, primary, secondary, ...rest } = props
10
13
 
11
14
  return (
@@ -13,7 +16,7 @@ export const OverlayHeader = (props: OverlayHeaderProps) => {
13
16
  noAlign
14
17
  sx={[{ '&.noAlign': { mb: 0 } }, ...(Array.isArray(sx) ? sx : [sx])]}
15
18
  switchPoint={-10000}
16
- size='small'
19
+ size='responsive'
17
20
  hideBackButton
18
21
  primary={primary ?? <LayoutHeaderClose onClose={onClose} />}
19
22
  secondary={primary ? <LayoutHeaderClose onClose={onClose} /> : secondary}
@@ -2,7 +2,8 @@ import { ScrollerProvider } from '@graphcommerce/framer-scroller'
2
2
  import { startTransition, useEffect, useState } from 'react'
3
3
  import type { SetOptional } from 'type-fest'
4
4
  import { variantsToScrollSnapType } from '../utils/variantsToScrollSnapType'
5
- import { OverlayBase, LayoutOverlayBaseProps } from './OverlayBase'
5
+ import type { LayoutOverlayBaseProps } from './OverlayBase'
6
+ import { OverlayBase } from './OverlayBase'
6
7
  import { OverlayContainer } from './OverlayContainer'
7
8
 
8
9
  export type OverlayProps = Omit<
@@ -1,4 +1,5 @@
1
- import { styled, SxProps, Theme } from '@mui/material'
1
+ import type { SxProps, Theme } from '@mui/material'
2
+ import { styled } from '@mui/material'
2
3
  import { m, useTransform } from 'framer-motion'
3
4
  import { useScrollY } from '../../Layout'
4
5
 
@@ -1,5 +1,5 @@
1
- import { ScrollerProviderProps } from '@graphcommerce/framer-scroller'
2
- import { LayoutOverlayBaseProps } from '../components/OverlayBase'
1
+ import type { ScrollerProviderProps } from '@graphcommerce/framer-scroller'
2
+ import type { LayoutOverlayBaseProps } from '../components/OverlayBase'
3
3
 
4
4
  type Variants = Partial<Pick<LayoutOverlayBaseProps, 'variantSm' | 'variantMd'>>
5
5
 
@@ -1,18 +1,11 @@
1
- import {
2
- lighten,
3
- Badge,
4
- Chip,
5
- ChipProps,
6
- SxProps,
7
- Typography,
8
- useEventCallback,
9
- Theme,
10
- } from '@mui/material'
1
+ import type { ChipProps, SxProps, Theme } from '@mui/material'
2
+ import { Badge, Chip, Typography, lighten, useEventCallback } from '@mui/material'
11
3
  import React, { useState } from 'react'
12
4
  import { IconSvg } from '../IconSvg'
13
5
  import { responsiveVal } from '../Styles'
14
6
  import { iconChevronDown, iconChevronUp } from '../icons'
15
- import { OverlayOrPopperPanel, OverlayOrPopperPanelProps } from './OverlayOrPopperPanel'
7
+ import type { OverlayOrPopperPanelProps } from './OverlayOrPopperPanel'
8
+ import { OverlayOrPopperPanel } from './OverlayOrPopperPanel'
16
9
 
17
10
  function isMulti(
18
11
  selectedLabel: React.ReactNode | React.ReactNode[],
@@ -61,7 +54,7 @@ export function ChipOverlayOrPopper(props: ChipOverlayOrPopperProps) {
61
54
  )
62
55
  }
63
56
 
64
- selectedLabel = Array.isArray(selectedLabel) ? selectedLabel[0] : selectedLabel ?? '·'
57
+ selectedLabel = Array.isArray(selectedLabel) ? selectedLabel[0] : (selectedLabel ?? '·')
65
58
 
66
59
  const chipSx = chipProps?.sx ?? []
67
60
  return (
@@ -1,9 +1,9 @@
1
- import { Breakpoint } from '@mui/material'
1
+ import type { Breakpoint } from '@mui/material'
2
2
  import dynamic from 'next/dynamic'
3
3
  import { startTransition, useEffect, useState } from 'react'
4
4
  import { useMatchMedia } from '../hooks'
5
- import { OverlayPanelProps } from './OverlayPanel'
6
- import { PopperPanelProps } from './PopperPanel'
5
+ import type { OverlayPanelProps } from './OverlayPanel'
6
+ import type { PopperPanelProps } from './PopperPanel'
7
7
 
8
8
  const OverlayPanel = dynamic(async () => (await import('./OverlayPanel')).OverlayPanel)
9
9
 
@@ -1,7 +1,8 @@
1
1
  import { Overlay } from '../Overlay/components/Overlay'
2
- import { OverlayProps } from '../Overlay/components/OverlaySsr'
2
+ import type { OverlayProps } from '../Overlay/components/OverlaySsr'
3
+ import { nonNullable } from '../RenderType/nonNullable'
3
4
  import { OverlayPanelActions } from './OverlayPanelActions'
4
- import { PanelProps } from './types'
5
+ import type { PanelProps } from './types'
5
6
 
6
7
  export type OverlayPanelProps = PanelProps & {
7
8
  overlayProps?: Omit<OverlayProps, 'active' | 'onClosed' | 'children'>
@@ -15,12 +16,17 @@ export function OverlayPanel(props: OverlayPanelProps) {
15
16
  {...overlayProps}
16
17
  onClosed={onClose}
17
18
  active={Boolean(activeEl)}
18
- sx={{
19
- '& .LayoutOverlayBase-overlayPane': {
20
- display: 'grid',
21
- gridTemplateRows: 'min-content auto min-content',
19
+ sx={[
20
+ {
21
+ '& .LayoutOverlayBase-overlayPane': {
22
+ display: 'grid',
23
+ gridTemplateRows: 'min-content auto min-content',
24
+ },
22
25
  },
23
- }}
26
+ ...(Array.isArray(overlayProps?.sx) ? overlayProps.sx : [overlayProps?.sx]).filter(
27
+ nonNullable,
28
+ ),
29
+ ]}
24
30
  >
25
31
  {() => (
26
32
  <OverlayPanelActions onClose={onClose} {...rest}>
@@ -7,14 +7,14 @@ import { OverlayStickyBottom } from '../Overlay/components/OverlayStickyBottom'
7
7
  import { extendableComponent } from '../Styles'
8
8
  import { useFabSize } from '../Theme'
9
9
  import { iconClose } from '../icons'
10
- import { PanelActionsProps } from './types'
10
+ import type { PanelActionsProps } from './types'
11
11
 
12
12
  const { classes } = extendableComponent(
13
13
  'OverlayPanelActions' as const,
14
14
  ['root', 'header', 'content', 'footer'] as const,
15
15
  )
16
16
 
17
- export const OverlayPanelActions = (props: PanelActionsProps) => {
17
+ export function OverlayPanelActions(props: PanelActionsProps) {
18
18
  const { title, children, onReset, onApply, onClose, sx = [] } = props
19
19
 
20
20
  const fabSize = useFabSize('small')
@@ -1,7 +1,8 @@
1
- import { ClickAwayListener, Popper, PopperProps } from '@mui/material'
1
+ import type { PopperProps } from '@mui/material'
2
+ import { ClickAwayListener, Popper } from '@mui/material'
2
3
  import { useRef } from 'react'
3
4
  import { PopperPanelActions } from './PopperPanelActions'
4
- import { PanelProps } from './types'
5
+ import type { PanelProps } from './types'
5
6
  import { useHandleClickNotDrag } from './useHandleClickNotDrag'
6
7
 
7
8
  export type PopperPanelProps = PanelProps & {
@@ -1,12 +1,12 @@
1
1
  import { i18n } from '@lingui/core'
2
2
  import { Trans } from '@lingui/react'
3
- import { Fab, Button, Box, Typography } from '@mui/material'
3
+ import { Box, Button, Fab, Typography } from '@mui/material'
4
4
  import { IconSvg, useIconSvgSize } from '../IconSvg'
5
5
  import { LayoutHeader } from '../Layout'
6
6
  import { OverlayStickyBottom } from '../Overlay/components/OverlayStickyBottom'
7
7
  import { useFabSize } from '../Theme'
8
8
  import { iconClose } from '../icons'
9
- import { PanelActionsProps } from './types'
9
+ import type { PanelActionsProps } from './types'
10
10
 
11
11
  export function PopperPanelActions(props: PanelActionsProps) {
12
12
  const { title, children, onReset, onClose, onApply, sx = [] } = props
@@ -1,5 +1,5 @@
1
- import { Theme, SxProps } from '@mui/material'
2
- import React from 'react'
1
+ import type { SxProps, Theme } from '@mui/material'
2
+ import type React from 'react'
3
3
 
4
4
  export type PanelActionsProps = {
5
5
  children: React.ReactNode
@@ -1,7 +1,9 @@
1
1
  import { useMotionValue } from 'framer-motion'
2
- import React, { useEffect } from 'react'
2
+ import type React from 'react'
3
+ import { useEffect } from 'react'
3
4
 
4
5
  /** When an element is dragged it will still register clicks. */
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
7
  export function useHandleClickNotDrag(elementRef: React.MutableRefObject<any>) {
6
8
  const movement = useMotionValue<'click' | 'drag' | null>(null)
7
9
 
@@ -1,6 +1,7 @@
1
1
  import { GlobalStyles } from '@mui/material'
2
2
  import { LazyMotion } from 'framer-motion'
3
- import { EmotionProvider, EmotionProviderProps } from '../Styles/EmotionProvider'
3
+ import type { EmotionProviderProps } from '../Styles/EmotionProvider'
4
+ import { EmotionProvider } from '../Styles/EmotionProvider'
4
5
 
5
6
  export type CssAndFramerMotionProviderProps = EmotionProviderProps
6
7
 
package/Page/types.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { ParsedUrlQuery } from 'querystring'
2
- import { UpPage } from '@graphcommerce/framer-next-pages/types'
1
+ import type { UpPage } from '@graphcommerce/framer-next-pages/types'
3
2
  // todo: remove references to GraphQL
4
3
  // eslint-disable-next-line import/no-extraneous-dependencies
5
- import { NormalizedCacheObject } from '@graphcommerce/graphql'
6
- import {
7
- GetStaticProps as GetStaticPropsNext,
4
+ import type { NormalizedCacheObject } from '@graphcommerce/graphql'
5
+ import type {
8
6
  GetServerSideProps as GetServerSidePropsNext,
7
+ GetStaticProps as GetStaticPropsNext,
9
8
  } from 'next'
9
+ import type { ParsedUrlQuery } from 'querystring'
10
10
 
11
11
  type AnyObj = Record<string, unknown>
12
12
 
@@ -1,11 +1,12 @@
1
- import { LinearProgress, LinearProgressProps } from '@mui/material'
1
+ import type { LinearProgressProps } from '@mui/material'
2
+ import { LinearProgress } from '@mui/material'
2
3
  import { m, motionValue, useTransform } from 'framer-motion'
3
4
  import { useRouter } from 'next/router'
4
5
  import { forwardRef, useEffect, useState } from 'react'
5
6
 
6
7
  export const showPageLoadIndicator = motionValue(false)
7
8
 
8
- const MLinearProgress = m(
9
+ const MLinearProgress = m.create(
9
10
  forwardRef((props: Omit<LinearProgressProps, 'style'>, ref: LinearProgressProps['ref']) => (
10
11
  <LinearProgress ref={ref} {...props} />
11
12
  )),