@graphcommerce/next-ui 9.0.0-canary.98 → 9.0.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 +294 -1342
  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,10 +1,12 @@
1
- import { DateTimeFormat, DateTimeFormatPropsType } from './DateTimeFormat'
1
+ import type { DateTimeFormatProps } from './DateTimeFormat'
2
+ import { DateTimeFormat } from './DateTimeFormat'
2
3
 
3
- type TimeFormatProps = Omit<
4
- DateTimeFormatPropsType,
5
- 'dateStyle' | 'month' | 'day' | 'era' | 'month' | 'weekday' | 'year'
4
+ export type TimeFormatProps = Omit<
5
+ DateTimeFormatProps,
6
+ 'dateStyle' | 'month' | 'day' | 'era' | 'weekday' | 'year'
6
7
  >
7
8
 
9
+ /** @public */
8
10
  export function TimeFormat(props: TimeFormatProps) {
9
11
  return <DateTimeFormat dateStyle={undefined} {...props} />
10
12
  }
@@ -1,3 +1,4 @@
1
1
  export * from './DateTimeFormat'
2
2
  export * from './DateFormat'
3
3
  export * from './TimeFormat'
4
+ export * from './useIntlDateTimeFormat'
@@ -0,0 +1,13 @@
1
+ import { useMemo } from 'react'
2
+ import { useMemoObject } from '../../hooks/useMemoObject'
3
+ import type { UseIntlLocalesArgumentOptions } from '../useIntlLocalesArgument'
4
+ import { useIntlLocalesArgument } from '../useIntlLocalesArgument'
5
+
6
+ export type UseIntlDateTimeFormatOptions = Intl.DateTimeFormatOptions &
7
+ UseIntlLocalesArgumentOptions
8
+
9
+ export function useIntlDateTimeFormat(props: UseIntlDateTimeFormatOptions) {
10
+ const [locales, options] = useIntlLocalesArgument(props)
11
+ const memoOptions = useMemoObject(options)
12
+ return useMemo(() => new Intl.DateTimeFormat(locales, memoOptions), [locales, memoOptions])
13
+ }
@@ -1,22 +1,14 @@
1
- import { useMemo } from 'react'
2
- import { useLocale } from '../../hooks/useLocale'
3
- import { useMemoObject } from '../../hooks/useMemoObject'
1
+ import type { UseIntlDisplayNamesOptions } from './useIntlDisplayNames'
2
+ import { useIntlDisplayNames } from './useIntlDisplayNames'
4
3
 
5
- export type UseDisplayNamesProps = Intl.DisplayNamesOptions
6
-
7
- export function useDisplayNames(props: UseDisplayNamesProps) {
8
- const locale = useLocale()
9
- const memoOptions = useMemoObject(props)
10
- return useMemo(() => new Intl.DisplayNames(locale, memoOptions), [locale, memoOptions])
11
- }
12
-
13
- type DisplayNamesProps = UseDisplayNamesProps & {
4
+ export type DisplayNamesProps = UseIntlDisplayNamesOptions & {
14
5
  code: string
15
6
  }
16
7
 
8
+ /** @public */
17
9
  export function DisplayNames(props: DisplayNamesProps) {
18
10
  const { code, ...options } = props
19
- const formatter = useDisplayNames(options)
11
+ const formatter = useIntlDisplayNames(options)
20
12
 
21
13
  return <span suppressHydrationWarning>{formatter.of(code)}</span>
22
14
  }
@@ -1 +1,2 @@
1
1
  export * from './DisplayNames'
2
+ export * from './useIntlDisplayNames'
@@ -0,0 +1,12 @@
1
+ import { useMemo } from 'react'
2
+ import { useMemoObject } from '../../hooks/useMemoObject'
3
+ import type { UseIntlLocalesArgumentOptions } from '../useIntlLocalesArgument'
4
+ import { useIntlLocalesArgument } from '../useIntlLocalesArgument'
5
+
6
+ export type UseIntlDisplayNamesOptions = Intl.DisplayNamesOptions & UseIntlLocalesArgumentOptions
7
+
8
+ export function useIntlDisplayNames(props: UseIntlDisplayNamesOptions) {
9
+ const [locales, options] = useIntlLocalesArgument(props)
10
+ const memoOptions = useMemoObject(options)
11
+ return useMemo(() => new Intl.DisplayNames(locales, memoOptions), [locales, memoOptions])
12
+ }
@@ -1,20 +1,15 @@
1
- import React, { useMemo } from 'react'
2
- import { useLocale } from '../hooks'
1
+ import React from 'react'
2
+ import type { UseIntlListFormatOptions } from './useIntlListFormat'
3
+ import { useIntlListFormat } from './useIntlListFormat'
3
4
 
4
- type ListFormatProps = {
5
+ export type ListFormatProps = {
5
6
  children: React.ReactNode[]
6
- listStyle?: Intl.ListFormatOptions['style']
7
- } & Omit<Intl.ListFormatOptions, 'style'>
7
+ } & UseIntlListFormatOptions
8
8
 
9
+ /** @public */
9
10
  export function ListFormat(props: ListFormatProps) {
10
- const { children, localeMatcher, listStyle: style, type } = props
11
-
12
- const locale = useLocale()
13
-
14
- const formatter = useMemo(
15
- () => new Intl.ListFormat(locale, { localeMatcher, style, type }),
16
- [locale, localeMatcher, style, type],
17
- )
11
+ const { children, ...options } = props
12
+ const formatter = useIntlListFormat(options)
18
13
 
19
14
  const childArray = React.Children.toArray(children)
20
15
  const fauxChildren = childArray.map((child, index) => `${index}`) ?? []
@@ -0,0 +1,2 @@
1
+ export * from './ListFormat'
2
+ export * from './useIntlListFormat'
@@ -0,0 +1,15 @@
1
+ import { useMemo } from 'react'
2
+ import { useMemoObject } from '../../hooks'
3
+ import type { UseIntlLocalesArgumentOptions } from '../useIntlLocalesArgument'
4
+ import { useIntlLocalesArgument } from '../useIntlLocalesArgument'
5
+
6
+ export type UseIntlListFormatOptions = {
7
+ listStyle?: Intl.ListFormatOptions['style']
8
+ } & Omit<Intl.ListFormatOptions, 'style'> &
9
+ UseIntlLocalesArgumentOptions
10
+
11
+ export function useIntlListFormat(props: UseIntlListFormatOptions) {
12
+ const [locales, options] = useIntlLocalesArgument(props)
13
+ const memoOptions = useMemoObject({ ...options })
14
+ return useMemo(() => new Intl.ListFormat(locales, memoOptions), [locales, memoOptions])
15
+ }
@@ -1,4 +1,5 @@
1
- import { NumberFormat, NumberFormatPropsType } from './NumberFormat'
1
+ import type { NumberFormatProps } from './NumberFormat'
2
+ import { NumberFormat } from './NumberFormat'
2
3
 
3
4
  // https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes
4
5
  type Currency =
@@ -182,10 +183,11 @@ type Currency =
182
183
  | 'ZMW'
183
184
  | 'ZWL'
184
185
 
185
- export type CurrencyFormatProps = Omit<NumberFormatPropsType, 'numberStyle'> & {
186
+ export type CurrencyFormatProps = Omit<NumberFormatProps, 'numberStyle'> & {
186
187
  currency: Currency | (string & Record<never, never>)
187
188
  }
188
189
 
190
+ /** @public */
189
191
  export function CurrencyFormat(props: CurrencyFormatProps) {
190
192
  return <NumberFormat {...props} numberStyle='currency' />
191
193
  }
@@ -1,24 +1,22 @@
1
- import { Box, SxProps, Theme } from '@mui/material'
2
- import { useMemo } from 'react'
3
- import { useLocale } from '../../hooks/useLocale'
4
- import { useMemoObject } from '../../hooks/useMemoObject'
1
+ import { Box } from '@mui/material'
2
+ import { forwardRef } from 'react'
3
+ import type { UseIntlNumberFormatOptions } from './useIntlNumberFormat'
4
+ import { useIntlNumberFormat } from './useIntlNumberFormat'
5
5
 
6
- export type NumberFormatPropsType = {
7
- children?: number | bigint | null | undefined
8
- numberStyle: Intl.NumberFormatOptions['style']
9
- sx?: SxProps<Theme>
10
- } & Omit<Intl.NumberFormatOptions, 'style'>
6
+ export type NumberFormatValue = number | bigint | Intl.StringNumericLiteral
11
7
 
12
- export function NumberFormat(props: NumberFormatPropsType) {
13
- const { children, numberStyle, ...options } = props
8
+ export type NumberFormatProps = UseIntlNumberFormatOptions & {
9
+ value: NumberFormatValue
10
+ }
14
11
 
15
- const memoOptions = useMemoObject({ ...options, style: numberStyle })
16
- const locale = useLocale()
17
- const formatter = useMemo(() => new Intl.NumberFormat(locale, memoOptions), [locale, memoOptions])
12
+ /** @public */
13
+ export const NumberFormat = forwardRef<HTMLSpanElement, NumberFormatProps>((props, ref) => {
14
+ const { value, ...options } = props
15
+ const formatter = useIntlNumberFormat(options)
18
16
 
19
17
  return (
20
- <Box component='span' suppressHydrationWarning>
21
- {children ? formatter.format(children) : null}
18
+ <Box component='span' suppressHydrationWarning ref={ref}>
19
+ {formatter.format(value)}
22
20
  </Box>
23
21
  )
24
- }
22
+ })
@@ -1,5 +1,9 @@
1
- import { NumberFormat, NumberFormatPropsType } from './NumberFormat'
1
+ import type { NumberFormatProps } from './NumberFormat'
2
+ import { NumberFormat } from './NumberFormat'
2
3
 
3
- export function PercentFormat(props: Omit<NumberFormatPropsType, 'numberStyle'>) {
4
+ export type PercentFormatProps = Omit<NumberFormatProps, 'numberStyle'>
5
+
6
+ /** @public */
7
+ export function PercentFormat(props: PercentFormatProps) {
4
8
  return <NumberFormat {...props} numberStyle='percent' />
5
9
  }
@@ -1,8 +1,7 @@
1
- import { NumberFormatPropsType, NumberFormat } from './NumberFormat'
1
+ import type { NumberFormatProps } from './NumberFormat'
2
+ import { NumberFormat } from './NumberFormat'
2
3
 
3
- /**
4
- * https://tc39.es/ecma402/#table-sanctioned-single-unit-identifiers
5
- */
4
+ /** https://tc39.es/ecma402/#table-sanctioned-single-unit-identifiers */
6
5
  type Unit =
7
6
  | 'acre'
8
7
  | 'bit'
@@ -50,10 +49,11 @@ type Unit =
50
49
  | 'yard'
51
50
  | 'year'
52
51
 
53
- export type UnitFormatProps = Omit<NumberFormatPropsType, 'numberStyle'> & {
52
+ export type UnitFormatProps = Omit<NumberFormatProps, 'numberStyle'> & {
54
53
  unit: Unit | (string & Record<never, never>)
55
54
  }
56
55
 
56
+ /** @public */
57
57
  export function UnitFormat(props: UnitFormatProps) {
58
58
  return <NumberFormat {...props} numberStyle='unit' />
59
59
  }
@@ -2,3 +2,4 @@ export * from './CurrencyFormat'
2
2
  export * from './NumberFormat'
3
3
  export * from './UnitFormat'
4
4
  export * from './PercentFormat'
5
+ export * from './useIntlNumberFormat'
@@ -0,0 +1,17 @@
1
+ import type { SxProps, Theme } from '@mui/material'
2
+ import { useMemo } from 'react'
3
+ import { useMemoObject } from '../../hooks/useMemoObject'
4
+ import type { UseIntlLocalesArgumentOptions } from '../useIntlLocalesArgument'
5
+ import { useIntlLocalesArgument } from '../useIntlLocalesArgument'
6
+
7
+ export type UseIntlNumberFormatOptions = {
8
+ numberStyle: Intl.NumberFormatOptions['style']
9
+ sx?: SxProps<Theme>
10
+ } & Omit<Intl.NumberFormatOptions, 'style'> &
11
+ UseIntlLocalesArgumentOptions
12
+
13
+ export function useIntlNumberFormat(props: UseIntlNumberFormatOptions) {
14
+ const [locales, { numberStyle, ...options }] = useIntlLocalesArgument(props)
15
+ const memoOptions = useMemoObject({ ...options, style: numberStyle })
16
+ return useMemo(() => new Intl.NumberFormat(locales, memoOptions), [locales, memoOptions])
17
+ }
@@ -1,27 +1,20 @@
1
- import { forwardRef, useMemo } from 'react'
2
- import { useLocale } from '../../hooks/useLocale'
3
- import { useMemoObject } from '../../hooks/useMemoObject'
1
+ import { forwardRef } from 'react'
4
2
  import { relativeTimeFormatUnitAuto } from './relativeTimeFormatAutoUnit'
5
-
6
- export function useRelativeTimeFormatter(props: Intl.RelativeTimeFormatOptions) {
7
- const locale = useLocale()
8
- const memoOptions = useMemoObject(props)
9
- return useMemo(() => new Intl.RelativeTimeFormat(locale, memoOptions), [locale, memoOptions])
10
- }
3
+ import type { UseIntlRelativeTimeFormatOptions } from './useIntlRelativeTimeFormat'
4
+ import { useIntlRelativeTimeFormat } from './useIntlRelativeTimeFormat'
11
5
 
12
6
  export type RelativeTimeFormatProps = {
13
7
  children: number
14
8
  unit?: Intl.RelativeTimeFormatUnit
15
- styleFormat?: Intl.RelativeTimeFormatStyle
16
- } & Omit<Intl.RelativeTimeFormatOptions, 'style'>
9
+ } & UseIntlRelativeTimeFormatOptions
17
10
 
18
11
  /**
19
12
  * Alternative: {@link file://./RelativeToTimeFormat.tsx}
20
13
  */
21
14
  export const RelativeTimeFormat = forwardRef<HTMLSpanElement, RelativeTimeFormatProps>(
22
15
  (props, ref) => {
23
- const { children, unit, styleFormat, localeMatcher, numeric, ...rest } = props
24
- const formatter = useRelativeTimeFormatter({ localeMatcher, numeric, style: styleFormat })
16
+ const { children, unit, locale, localeMatcher, numeric, styleFormat, ...rest } = props
17
+ const formatter = useIntlRelativeTimeFormat({ locale, localeMatcher, numeric, styleFormat })
25
18
 
26
19
  const [value, autoUnit] = relativeTimeFormatUnitAuto({ value: children, unit })
27
20
 
@@ -1,6 +1,8 @@
1
1
  import { forwardRef, useMemo } from 'react'
2
- import { DateValue, toDate } from '../DateTimeFormat/toDate'
3
- import { RelativeTimeFormat, RelativeTimeFormatProps } from './RelativeTimeFormat'
2
+ import type { DateValue } from '../DateTimeFormat/toDate'
3
+ import { toDate } from '../DateTimeFormat/toDate'
4
+ import type { RelativeTimeFormatProps } from './RelativeTimeFormat'
5
+ import { RelativeTimeFormat } from './RelativeTimeFormat'
4
6
 
5
7
  type RelativeToTimeFormatProps = Omit<RelativeTimeFormatProps, 'children'> & {
6
8
  /**
@@ -1,2 +1,3 @@
1
1
  export * from './RelativeTimeFormat'
2
2
  export * from './RelativeToTimeFormat'
3
+ export * from './useIntlRelativeTimeFormat'
@@ -0,0 +1,15 @@
1
+ import { useMemo } from 'react'
2
+ import { useMemoObject } from '../../hooks/useMemoObject'
3
+ import type { UseIntlLocalesArgumentOptions } from '../useIntlLocalesArgument'
4
+ import { useIntlLocalesArgument } from '../useIntlLocalesArgument'
5
+
6
+ export type UseIntlRelativeTimeFormatOptions = {
7
+ styleFormat?: Intl.RelativeTimeFormatStyle
8
+ } & Omit<Intl.RelativeTimeFormatOptions, 'style'> &
9
+ UseIntlLocalesArgumentOptions
10
+
11
+ export function useIntlRelativeTimeFormat(props: UseIntlRelativeTimeFormatOptions) {
12
+ const [locales, { styleFormat, ...options }] = useIntlLocalesArgument(props)
13
+ const memoOptions = useMemoObject({ ...options, style: styleFormat })
14
+ return useMemo(() => new Intl.RelativeTimeFormat(locales, memoOptions), [locales, memoOptions])
15
+ }
@@ -0,0 +1,16 @@
1
+ import { useLocale, useMemoObject } from '../hooks'
2
+
3
+ export type UseIntlLocalesArgumentOptions<T extends object = object> = {
4
+ /**
5
+ * @default useLocale()
6
+ */
7
+ locale?: Intl.LocalesArgument
8
+ } & T
9
+
10
+ export function useIntlLocalesArgument<T extends object = object>(
11
+ props: UseIntlLocalesArgumentOptions<T>,
12
+ ) {
13
+ const { locale, ...options } = props
14
+ const storeLocale = useLocale()
15
+ return [useMemoObject(locale ?? storeLocale), options] as const
16
+ }
@@ -1,10 +1,13 @@
1
- import { Box, SxProps, Theme } from '@mui/material'
1
+ import type { SxProps, Theme } from '@mui/material'
2
+ import { Box } from '@mui/material'
2
3
  import React from 'react'
3
4
  import { extendableComponent } from '../../Styles'
4
- import { BackProps, LayoutHeaderBack, useShowBack } from './LayoutHeaderBack'
5
+ import type { BackProps } from './LayoutHeaderBack'
6
+ import { LayoutHeaderBack, useShowBack } from './LayoutHeaderBack'
5
7
  import { LayoutHeaderClose, useShowClose } from './LayoutHeaderClose'
6
- import { LayoutHeaderContent, LayoutHeaderContentProps } from './LayoutHeaderContent'
7
- import { FloatingProps } from './LayoutHeadertypes'
8
+ import type { LayoutHeaderContentProps } from './LayoutHeaderContent'
9
+ import { LayoutHeaderContent } from './LayoutHeaderContent'
10
+ import type { FloatingProps } from './LayoutHeadertypes'
8
11
 
9
12
  export type LayoutHeaderProps = FloatingProps &
10
13
  Omit<LayoutHeaderContentProps, 'left' | 'right'> &
@@ -1,13 +1,15 @@
1
1
  import {
2
- useUp,
3
- usePrevUp,
4
2
  usePageContext,
5
3
  usePrevPageRouter,
4
+ usePrevUp,
5
+ useUp,
6
6
  } from '@graphcommerce/framer-next-pages'
7
7
  import { i18n } from '@lingui/core'
8
- import { Box, SxProps, Theme } from '@mui/material'
8
+ import type { SxProps, Theme } from '@mui/material'
9
+ import { Box } from '@mui/material'
9
10
  import { useRouter } from 'next/router'
10
- import { LinkOrButton, LinkOrButtonProps } from '../../Button/LinkOrButton'
11
+ import type { LinkOrButtonProps } from '../../Button/LinkOrButton'
12
+ import { LinkOrButton } from '../../Button/LinkOrButton'
11
13
  import { IconSvg } from '../../IconSvg'
12
14
  import { responsiveVal } from '../../Styles'
13
15
  import { iconChevronLeft } from '../../icons'
@@ -6,7 +6,7 @@ import { IconSvg, useIconSvgSize } from '../../IconSvg'
6
6
  import { useFabSize } from '../../Theme'
7
7
  import { iconClose } from '../../icons'
8
8
 
9
- type LayoutHeaderCloseProps = {
9
+ export type LayoutHeaderCloseProps = {
10
10
  onClose?: () => void
11
11
  }
12
12
 
@@ -2,9 +2,10 @@ import { useMotionValueValue } from '@graphcommerce/framer-utils'
2
2
  import { Box, styled, SxProps, Theme } from '@mui/material'
3
3
  import { LayoutProps, m } from 'framer-motion'
4
4
  import React, { useRef } from 'react'
5
+ import { Container } from '../../Container/Container'
5
6
  import { extendableComponent } from '../../Styles'
6
7
  import { useScrollY } from '../hooks/useScrollY'
7
- import { FloatingProps } from './LayoutHeadertypes'
8
+ import type { FloatingProps } from './LayoutHeadertypes'
8
9
 
9
10
  const MotionDiv = styled(m.div)({})
10
11
 
@@ -30,7 +31,7 @@ type OwnerState = {
30
31
  bgColor?: 'paper' | 'default'
31
32
  }
32
33
 
33
- const name = 'LayoutHeaderContent' as const
34
+ const name = 'LayoutHeaderContent'
34
35
  const parts = ['bg', 'content', 'left', 'center', 'right', 'divider'] as const
35
36
  const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
36
37
 
@@ -92,7 +93,7 @@ export function LayoutHeaderContent(props: LayoutHeaderContentProps) {
92
93
  },
93
94
 
94
95
  opacity: 0,
95
- transition: `opacity 150ms`,
96
+ transition: 'opacity 150ms',
96
97
  '&.scrolled': {
97
98
  opacity: 1,
98
99
  },
@@ -104,22 +105,22 @@ export function LayoutHeaderContent(props: LayoutHeaderContentProps) {
104
105
  ...(Array.isArray(sxBg) ? sxBg : [sxBg]),
105
106
  ]}
106
107
  />
107
- <Box
108
+ <Container
109
+ maxWidth={false}
108
110
  className={classes.content}
111
+ sizing='shell'
109
112
  ref={ref}
110
113
  sx={[
111
114
  (theme) => ({
112
115
  position: 'absolute',
113
- left: 0,
116
+ inset: 0,
114
117
  width: '100%',
115
118
  display: 'grid',
116
- gridTemplateAreas: `"left center right"`,
119
+ gridTemplateAreas: '"left center right"',
117
120
  gridTemplateColumns: '1fr auto 1fr',
118
121
  alignItems: 'center',
119
122
  gap: theme.page.horizontal,
120
-
121
123
  height: theme.appShell.headerHeightSm,
122
- px: theme.page.horizontal,
123
124
  [theme.breakpoints.up('md')]: {
124
125
  height: theme.appShell.appBarHeightMd,
125
126
  },
@@ -133,14 +134,12 @@ export function LayoutHeaderContent(props: LayoutHeaderContentProps) {
133
134
 
134
135
  '&.floatingSm': {
135
136
  [theme.breakpoints.down('md')]: {
136
- px: theme.page.horizontal,
137
137
  background: 'none',
138
138
  pointerEvents: 'none',
139
139
  },
140
140
  },
141
141
  '&.floatingMd': {
142
142
  [theme.breakpoints.up('md')]: {
143
- px: theme.page.horizontal,
144
143
  background: 'none',
145
144
  pointerEvents: 'none',
146
145
  },
@@ -177,7 +176,7 @@ export function LayoutHeaderContent(props: LayoutHeaderContentProps) {
177
176
  overflow: 'hidden',
178
177
  justifySelf: 'center',
179
178
 
180
- transition: `opacity 150ms`,
179
+ transition: 'opacity 150ms',
181
180
  opacity: 0,
182
181
  '&.scrolled': {
183
182
  opacity: 1,
@@ -243,7 +242,7 @@ export function LayoutHeaderContent(props: LayoutHeaderContentProps) {
243
242
  {divider}
244
243
  </Box>
245
244
  )}
246
- </Box>
245
+ </Container>
247
246
  </>
248
247
  )
249
248
  }
@@ -1,6 +1,6 @@
1
1
  import { useMemo } from 'react'
2
2
  import { layoutContext } from '../context/layoutContext'
3
- import { LayoutContext } from '../types'
3
+ import type { LayoutContext } from '../types'
4
4
 
5
5
  export type LayoutProviderProps = {
6
6
  children: React.ReactNode
@@ -1,6 +1,8 @@
1
- import { Box, SxProps, Theme, Typography, TypographyProps } from '@mui/material'
1
+ import type { SxProps, Theme, TypographyProps } from '@mui/material'
2
+ import { Box, Typography } from '@mui/material'
2
3
  import React from 'react'
3
- import { IconSvg, IconSvgProps } from '../../IconSvg'
4
+ import type { IconSvgProps } from '../../IconSvg'
5
+ import { IconSvg } from '../../IconSvg'
4
6
  import { extendableComponent, responsiveVal } from '../../Styles'
5
7
 
6
8
  type OwnerState = {
@@ -39,7 +41,7 @@ export const LayoutTitle = React.forwardRef<HTMLDivElement, TitleProps>((props,
39
41
  display: 'flex',
40
42
  alignItems: 'center',
41
43
  justifyContent: 'center',
42
- gap: `6px`,
44
+ gap: '6px',
43
45
  '&.sizeSmall': {
44
46
  overflow: 'hidden',
45
47
  '& svg': {
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { LayoutContext } from '../types'
2
+ import type { LayoutContext } from '../types'
3
3
 
4
4
  export const layoutContext = React.createContext<null | LayoutContext>(null)
5
5
  layoutContext.displayName = 'layoutContext'
package/Layout/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { MotionValue } from 'framer-motion'
1
+ import type { MotionValue } from 'framer-motion'
2
2
 
3
3
  export type LayoutContext = {
4
4
  scroll: MotionValue<number>
@@ -1,7 +1,8 @@
1
1
  import { useScrollOffset } from '@graphcommerce/framer-next-pages'
2
2
  import { dvh } from '@graphcommerce/framer-utils'
3
3
  import { Box, SxProps, Theme } from '@mui/material'
4
- import { useTransform, useScroll } from 'framer-motion'
4
+ import { useScroll, useTransform } from 'framer-motion'
5
+ import { Container } from '../../Container/Container'
5
6
  import { LayoutProvider } from '../../Layout/components/LayoutProvider'
6
7
  import { SkipLink } from '../../SkipLink/SkipLink'
7
8
  import { extendableComponent } from '../../Styles'
@@ -48,7 +49,6 @@ export function LayoutDefault(props: LayoutDefaultProps) {
48
49
  )
49
50
 
50
51
  const classes = withState({ noSticky })
51
-
52
52
  const fabIconSize = useFabSize('responsive')
53
53
 
54
54
  return (
@@ -61,7 +61,7 @@ export function LayoutDefault(props: LayoutDefaultProps) {
61
61
  minHeight: '-webkit-fill-available',
62
62
  },
63
63
  display: 'grid',
64
- gridTemplateRows: `auto auto 1fr auto`,
64
+ gridTemplateRows: { xs: 'auto 1fr auto', md: 'auto auto 1fr auto' },
65
65
  gridTemplateColumns: '100%',
66
66
  background: theme.palette.background.default,
67
67
  }),
@@ -71,7 +71,9 @@ export function LayoutDefault(props: LayoutDefaultProps) {
71
71
  <SkipLink />
72
72
  <LayoutProvider scroll={scrollYOffset}>
73
73
  {beforeHeader}
74
- <Box
74
+ <Container
75
+ sizing='shell'
76
+ maxWidth={false}
75
77
  component='header'
76
78
  className={classes.header}
77
79
  sx={(theme) => ({
@@ -86,7 +88,6 @@ export function LayoutDefault(props: LayoutDefaultProps) {
86
88
  },
87
89
  [theme.breakpoints.up('md')]: {
88
90
  height: theme.appShell.headerHeightMd,
89
- padding: `0 ${theme.page.horizontal} 0`,
90
91
  top: 0,
91
92
  display: 'flex',
92
93
  justifyContent: 'left',
@@ -101,9 +102,11 @@ export function LayoutDefault(props: LayoutDefaultProps) {
101
102
  })}
102
103
  >
103
104
  {header}
104
- </Box>
105
+ </Container>
105
106
  {menuFab || cartFab ? (
106
- <Box
107
+ <Container
108
+ sizing='shell'
109
+ maxWidth={false}
107
110
  className={classes.fabs}
108
111
  sx={(theme) => ({
109
112
  display: 'flex',
@@ -112,7 +115,6 @@ export function LayoutDefault(props: LayoutDefaultProps) {
112
115
  height: 0,
113
116
  zIndex: 'speedDial',
114
117
  [theme.breakpoints.up('sm')]: {
115
- padding: `0 ${theme.page.horizontal}`,
116
118
  position: 'sticky',
117
119
  marginTop: `calc(${theme.appShell.headerHeightMd} * -1 - calc(${fabIconSize} / 2))`,
118
120
  top: `calc(${theme.appShell.headerHeightMd} / 2 - (${fabIconSize} / 2))`,
@@ -121,7 +123,7 @@ export function LayoutDefault(props: LayoutDefaultProps) {
121
123
  position: 'fixed',
122
124
  top: 'unset',
123
125
  bottom: `calc(20px + ${fabIconSize})`,
124
- padding: `0 20px`,
126
+ padding: '0 20px',
125
127
  '@media (max-height: 530px) and (orientation: portrait)': {
126
128
  display: 'none',
127
129
  },
@@ -144,7 +146,7 @@ export function LayoutDefault(props: LayoutDefaultProps) {
144
146
  {cartFab}
145
147
  </Box>
146
148
  )}
147
- </Box>
149
+ </Container>
148
150
  ) : (
149
151
  <div />
150
152
  )}
@@ -1,10 +1,11 @@
1
- import { usePageContext, useGo, useScrollOffset } from '@graphcommerce/framer-next-pages'
1
+ import { useGo, usePageContext, useScrollOffset } from '@graphcommerce/framer-next-pages'
2
2
  import { ScrollerProvider } from '@graphcommerce/framer-scroller'
3
3
  import { useMotionValueValue } from '@graphcommerce/framer-utils'
4
4
  import { useEventCallback } from '@mui/material'
5
5
  import { usePresence } from 'framer-motion'
6
6
  import type { SetOptional } from 'type-fest'
7
- import { OverlayBase, LayoutOverlayBaseProps } from '../../Overlay/components/OverlayBase'
7
+ import type { LayoutOverlayBaseProps } from '../../Overlay/components/OverlayBase'
8
+ import { OverlayBase } from '../../Overlay/components/OverlayBase'
8
9
  import { variantsToScrollSnapType } from '../../Overlay/utils/variantsToScrollSnapType'
9
10
 
10
11
  export type LayoutOverlayProps = Omit<
@@ -1,4 +1,5 @@
1
- import { LayoutHeaderProps, LayoutHeader } from '../../Layout'
1
+ import type { LayoutHeaderProps } from '../../Layout'
2
+ import { LayoutHeader } from '../../Layout'
2
3
 
3
4
  export function LayoutOverlayHeader(props: LayoutHeaderProps) {
4
5
  const { sx, switchPoint } = props