@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.
- package/ActionCard/ActionCard.tsx +219 -203
- package/ActionCard/ActionCardAccordion.tsx +4 -2
- package/ActionCard/ActionCardLayout.tsx +3 -2
- package/ActionCard/ActionCardList.tsx +6 -5
- package/Blog/BlogAuthor/BlogAuthor.tsx +5 -4
- package/Blog/BlogContent/BlogContent.tsx +3 -2
- package/Blog/BlogHeader/BlogHeader.tsx +4 -3
- package/Blog/BlogList/BlogList.tsx +3 -3
- package/Blog/BlogListItem/BlogListItem.tsx +6 -5
- package/Blog/BlogTags/BlogTag.tsx +3 -2
- package/Blog/BlogTags/BlogTags.tsx +1 -1
- package/Breadcrumbs/Breadcrumbs.tsx +25 -19
- package/Breadcrumbs/BreadcrumbsList.tsx +3 -2
- package/Breadcrumbs/jsonLdBreadcrumb.tsx +1 -1
- package/Breadcrumbs/types.ts +1 -2
- package/Button/Button.tsx +2 -1
- package/Button/LinkOrButton.tsx +4 -2
- package/CHANGELOG.md +294 -1342
- package/ChipMenu/ChipMenu.tsx +3 -2
- package/Config.graphqls +28 -10
- package/Container/Container.tsx +90 -0
- package/ContainerWithHeader/ContainerWithHeader.tsx +2 -1
- package/Document/DocumentBodyEnd.tsx +1 -1
- package/Document/DocumentBodyStart.tsx +1 -1
- package/Document/DocumentHeadEnd.tsx +1 -1
- package/Document/DocumentHeadStart.tsx +1 -1
- package/Fab/Fab.tsx +15 -17
- package/FlagAvatar/FlagAvatar.tsx +2 -1
- package/Footer/Footer.tsx +14 -10
- package/Form/Form.tsx +2 -1
- package/Form/FormHeader.tsx +1 -1
- package/Form/FormRow.tsx +1 -1
- package/Form/InputCheckmark.tsx +2 -1
- package/FramerScroller/ItemScroller.tsx +5 -8
- package/FramerScroller/SidebarGallery.tsx +23 -30
- package/FramerScroller/SidebarSlider.tsx +8 -7
- package/FullPageMessage/FullPageMessage.tsx +2 -1
- package/IconHeader/IconHeader.tsx +5 -3
- package/IconSvg/IconSvg.tsx +8 -7
- package/Intl/DateTimeFormat/DateFormat.tsx +6 -4
- package/Intl/DateTimeFormat/DateTimeFormat.tsx +10 -14
- package/Intl/DateTimeFormat/TimeFormat.tsx +6 -4
- package/Intl/DateTimeFormat/index.ts +1 -0
- package/Intl/DateTimeFormat/useIntlDateTimeFormat.ts +13 -0
- package/Intl/DisplayNames/DisplayNames.tsx +5 -13
- package/Intl/DisplayNames/index.ts +1 -0
- package/Intl/DisplayNames/useIntlDisplayNames.ts +12 -0
- package/Intl/{ListFormat.tsx → ListFormat/ListFormat.tsx} +8 -13
- package/Intl/ListFormat/index.ts +2 -0
- package/Intl/ListFormat/useIntlListFormat.ts +15 -0
- package/Intl/NumberFormat/CurrencyFormat.tsx +4 -2
- package/Intl/NumberFormat/NumberFormat.tsx +15 -17
- package/Intl/NumberFormat/PercentFormat.tsx +6 -2
- package/Intl/NumberFormat/UnitFormat.tsx +5 -5
- package/Intl/NumberFormat/index.ts +1 -0
- package/Intl/NumberFormat/useIntlNumberFormat.ts +17 -0
- package/Intl/RelativeTimeFormat/RelativeTimeFormat.tsx +6 -13
- package/Intl/RelativeTimeFormat/RelativeToTimeFormat.tsx +4 -2
- package/Intl/RelativeTimeFormat/index.ts +1 -0
- package/Intl/RelativeTimeFormat/useIntlRelativeTimeFormat.ts +15 -0
- package/Intl/useIntlLocalesArgument.ts +16 -0
- package/Layout/components/LayoutHeader.tsx +7 -4
- package/Layout/components/LayoutHeaderBack.tsx +6 -4
- package/Layout/components/LayoutHeaderClose.tsx +1 -1
- package/Layout/components/LayoutHeaderContent.tsx +11 -12
- package/Layout/components/LayoutProvider.tsx +1 -1
- package/Layout/components/LayoutTitle.tsx +5 -3
- package/Layout/context/layoutContext.tsx +1 -1
- package/Layout/types.ts +1 -1
- package/LayoutDefault/components/LayoutDefault.tsx +12 -10
- package/LayoutOverlay/components/LayoutOverlay.tsx +3 -2
- package/LayoutOverlay/components/LayoutOverlayHeader.tsx +2 -1
- package/LayoutOverlay/test/LayoutOverlayDemo.tsx +4 -1
- package/LayoutParts/DesktopHeaderBadge.tsx +2 -1
- package/LayoutParts/DesktopNavBar.tsx +26 -22
- package/LayoutParts/DesktopNavBarItem.tsx +11 -7
- package/LayoutParts/Logo.tsx +5 -5
- package/LayoutParts/MenuFab.tsx +7 -13
- package/LayoutParts/MenuFabItem.tsx +6 -1
- package/LayoutParts/MenuFabSecondaryItem.tsx +11 -7
- package/LayoutParts/MobileTopRight.tsx +24 -0
- package/LayoutParts/PlaceholderFab.tsx +2 -1
- package/LayoutParts/StickyBelowHeader.tsx +2 -1
- package/LayoutParts/index.ts +1 -0
- package/LazyHydrate/LazyHydrate.tsx +18 -21
- package/MediaQuery/MediaQuery.tsx +111 -0
- package/MediaQuery/index.ts +1 -0
- package/Navigation/components/NavigationFab.tsx +3 -2
- package/Navigation/components/NavigationItem.tsx +3 -3
- package/Navigation/components/NavigationList.tsx +4 -3
- package/Navigation/components/NavigationOverlay.tsx +18 -11
- package/Navigation/components/NavigationProvider.tsx +9 -8
- package/Navigation/components/NavigationTitle.tsx +5 -5
- package/Navigation/hooks/useNavigation.ts +4 -2
- package/Overlay/components/Overlay.tsx +3 -2
- package/Overlay/components/OverlayBase.tsx +71 -30
- package/Overlay/components/OverlayContainer.tsx +2 -2
- package/Overlay/components/OverlayHeader.tsx +7 -4
- package/Overlay/components/OverlaySsr.tsx +2 -1
- package/Overlay/components/OverlayStickyBottom.tsx +2 -1
- package/Overlay/utils/variantsToScrollSnapType.ts +2 -2
- package/OverlayOrPopperChip/OverlayOrPopperChip.tsx +5 -12
- package/OverlayOrPopperChip/OverlayOrPopperPanel.tsx +3 -3
- package/OverlayOrPopperChip/OverlayPanel.tsx +13 -7
- package/OverlayOrPopperChip/OverlayPanelActions.tsx +2 -2
- package/OverlayOrPopperChip/PopperPanel.tsx +3 -2
- package/OverlayOrPopperChip/PopperPanelActions.tsx +2 -2
- package/OverlayOrPopperChip/types.ts +2 -2
- package/OverlayOrPopperChip/useHandleClickNotDrag.ts +3 -1
- package/Page/CssAndFramerMotionProvider.tsx +2 -1
- package/Page/types.ts +5 -5
- package/PageLoadIndicator/PageLoadIndicator.tsx +3 -2
- package/PageMeta/PageMeta.tsx +3 -2
- package/PageMeta/canonicalize.ts +7 -3
- package/Pagination/Pagination.tsx +4 -2
- package/Pagination/PaginationExtended.tsx +2 -9
- package/RenderType/RenderType.tsx +6 -0
- package/Row/ButtonLinkList/ButtonLinkList.tsx +4 -7
- package/Row/ButtonLinkList/ButtonLinkListItem.tsx +2 -1
- package/Row/ColumnOne/variant/VariantMessage.tsx +2 -4
- package/Row/ColumnOneBoxed/ColumnOneBoxed.tsx +4 -2
- package/Row/ColumnOneCentered/ColumnOneCentered.tsx +4 -2
- package/Row/ColumnThree/ColumnThree.tsx +6 -5
- package/Row/ColumnTwo/ColumnTwo.tsx +8 -7
- package/Row/ColumnTwoSpread/ColumnTwoSpread.tsx +7 -5
- package/Row/ColumnTwoWithTop/ColumnTwoWithTop.tsx +5 -4
- package/Row/ContentLinks/ContentLinks.tsx +4 -3
- package/Row/HeroBanner/HeroBanner.tsx +3 -2
- package/Row/IconBlocks/IconBlock.tsx +3 -2
- package/Row/IconBlocks/IconBlocks.tsx +3 -2
- package/Row/ImageText/ImageText.tsx +3 -2
- package/Row/ImageTextBoxed/ImageTextBoxed.tsx +4 -3
- package/Row/ParagraphWithSidebarSlide/ParagraphWithSidebarSlide.tsx +3 -2
- package/Row/Quote/Quote.tsx +1 -1
- package/Row/Row.tsx +2 -1
- package/Row/RowLinks/RowLinks.tsx +36 -34
- package/Row/RowLinks/variant/VariantImageLabelSwiper.tsx +6 -2
- package/Row/RowLinks/variant/VariantInline.tsx +6 -2
- package/Row/RowLinks/variant/VariantLogoSwiper.tsx +2 -1
- package/Row/RowLinks/variant/VariantUsps.tsx +2 -1
- package/Row/SpecialBanner/SpecialBanner.tsx +3 -2
- package/SectionContainer/SectionContainer.tsx +3 -2
- package/SectionHeader/SectionHeader.tsx +2 -1
- package/Separator/Separator.tsx +3 -2
- package/Snackbar/DismissibleSnackbar.tsx +1 -1
- package/Snackbar/ErrorSnackbar.tsx +1 -1
- package/Snackbar/MessageSnackbarImpl.tsx +7 -16
- package/StarRatingField/StarRatingField.tsx +3 -2
- package/Stepper/Stepper.tsx +3 -2
- package/Styles/__tests__/spreadVal.test.ts +4 -4
- package/Styles/extendableComponent.ts +4 -3
- package/Styles/withEmotionCache.tsx +2 -2
- package/Styles/withTheme.tsx +4 -1
- package/TextInputNumber/TextInputNumber.tsx +5 -8
- package/Theme/DarkLightModeThemeProvider.tsx +10 -7
- package/Theme/MuiButton.ts +2 -1
- package/Theme/MuiChip.ts +2 -1
- package/Theme/MuiFab.ts +2 -1
- package/Theme/MuiSlider.ts +3 -3
- package/Theme/MuiSnackbar.ts +1 -1
- package/Theme/NextLink.tsx +35 -15
- package/Theme/createTheme.ts +6 -0
- package/Theme/index.ts +1 -0
- package/Theme/themeDefaults.ts +10 -10
- package/Theme/useContainerSizing.ts +20 -0
- package/TimeAgo/TimeAgo.tsx +3 -3
- package/ToggleButton/ToggleButton.tsx +6 -4
- package/ToggleButtonGroup/ToggleButtonGroup.tsx +99 -94
- package/UspList/UspList.tsx +3 -2
- package/UspList/UspListItem.tsx +3 -2
- package/hooks/memoDeep.ts +3 -2
- package/hooks/useDateTimeFormat.ts +3 -1
- package/hooks/useMatchMedia.ts +2 -1
- package/hooks/useMemoDeep.ts +2 -1
- package/hooks/useNumberFormat.ts +3 -1
- package/index.ts +3 -1
- package/package.json +17 -18
- package/utils/cookie.ts +4 -3
- package/utils/robots.ts +1 -1
- package/utils/sitemap.ts +3 -2
- package/utils/sxx.ts +16 -0
- package/AnimatedRow/AnimatedRow.tsx +0 -23
- package/docs/building-components.mdx +0 -3
- package/docs/components/ComponentBasic.tsx +0 -26
- package/docs/components/ComponentChild.tsx +0 -49
- package/docs/components/ComponentChildVariant.tsx +0 -55
- package/docs/components/ComponentChildVariantExtendable.tsx +0 -63
- package/docs/components/ComponentStylable.tsx +0 -32
- package/docs/pages/building-components.tsx +0 -62
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DateTimeFormatProps } from './DateTimeFormat'
|
|
2
|
+
import { DateTimeFormat } from './DateTimeFormat'
|
|
2
3
|
|
|
3
|
-
type TimeFormatProps = Omit<
|
|
4
|
-
|
|
5
|
-
'dateStyle' | 'month' | 'day' | 'era' | '
|
|
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
|
}
|
|
@@ -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 {
|
|
2
|
-
import {
|
|
3
|
-
import { useMemoObject } from '../../hooks/useMemoObject'
|
|
1
|
+
import type { UseIntlDisplayNamesOptions } from './useIntlDisplayNames'
|
|
2
|
+
import { useIntlDisplayNames } from './useIntlDisplayNames'
|
|
4
3
|
|
|
5
|
-
export type
|
|
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 =
|
|
11
|
+
const formatter = useIntlDisplayNames(options)
|
|
20
12
|
|
|
21
13
|
return <span suppressHydrationWarning>{formatter.of(code)}</span>
|
|
22
14
|
}
|
|
@@ -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
|
|
2
|
-
import {
|
|
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
|
-
|
|
7
|
-
} & Omit<Intl.ListFormatOptions, 'style'>
|
|
7
|
+
} & UseIntlListFormatOptions
|
|
8
8
|
|
|
9
|
+
/** @public */
|
|
9
10
|
export function ListFormat(props: ListFormatProps) {
|
|
10
|
-
const { children,
|
|
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,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 {
|
|
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<
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
|
|
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
|
|
13
|
-
|
|
8
|
+
export type NumberFormatProps = UseIntlNumberFormatOptions & {
|
|
9
|
+
value: NumberFormatValue
|
|
10
|
+
}
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
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
|
-
{
|
|
18
|
+
<Box component='span' suppressHydrationWarning ref={ref}>
|
|
19
|
+
{formatter.format(value)}
|
|
22
20
|
</Box>
|
|
23
21
|
)
|
|
24
|
-
}
|
|
22
|
+
})
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { NumberFormatProps } from './NumberFormat'
|
|
2
|
+
import { NumberFormat } from './NumberFormat'
|
|
2
3
|
|
|
3
|
-
export
|
|
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 {
|
|
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<
|
|
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
|
}
|
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
24
|
-
const formatter =
|
|
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
|
|
3
|
-
import {
|
|
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
|
/**
|
|
@@ -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 {
|
|
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
|
|
5
|
+
import type { BackProps } from './LayoutHeaderBack'
|
|
6
|
+
import { LayoutHeaderBack, useShowBack } from './LayoutHeaderBack'
|
|
5
7
|
import { LayoutHeaderClose, useShowClose } from './LayoutHeaderClose'
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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 {
|
|
8
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
9
|
+
import { Box } from '@mui/material'
|
|
9
10
|
import { useRouter } from 'next/router'
|
|
10
|
-
import {
|
|
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'
|
|
@@ -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'
|
|
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:
|
|
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
|
-
<
|
|
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
|
-
|
|
116
|
+
inset: 0,
|
|
114
117
|
width: '100%',
|
|
115
118
|
display: 'grid',
|
|
116
|
-
gridTemplateAreas:
|
|
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:
|
|
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
|
-
</
|
|
245
|
+
</Container>
|
|
247
246
|
</>
|
|
248
247
|
)
|
|
249
248
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SxProps, Theme, TypographyProps } from '@mui/material'
|
|
2
|
+
import { Box, Typography } from '@mui/material'
|
|
2
3
|
import React from 'react'
|
|
3
|
-
import {
|
|
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:
|
|
44
|
+
gap: '6px',
|
|
43
45
|
'&.sizeSmall': {
|
|
44
46
|
overflow: 'hidden',
|
|
45
47
|
'& svg': {
|
package/Layout/types.ts
CHANGED
|
@@ -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 {
|
|
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:
|
|
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
|
-
<
|
|
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
|
-
</
|
|
105
|
+
</Container>
|
|
105
106
|
{menuFab || cartFab ? (
|
|
106
|
-
<
|
|
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:
|
|
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
|
-
</
|
|
149
|
+
</Container>
|
|
148
150
|
) : (
|
|
149
151
|
<div />
|
|
150
152
|
)}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
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<
|