@graphcommerce/next-ui 3.19.1 → 3.20.3

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 (95) hide show
  1. package/AppShell/AppShellSticky/index.tsx +3 -19
  2. package/AppShell/DesktopNavActions.tsx +3 -4
  3. package/AppShell/DesktopNavBar.tsx +2 -3
  4. package/AppShell/FixedFab.tsx +1 -6
  5. package/AppShell/GlobalHead.tsx +36 -0
  6. package/AppShell/Logo.tsx +11 -20
  7. package/AppShell/MenuFab.tsx +5 -3
  8. package/AppShell/MenuFabSecondaryItem.tsx +3 -3
  9. package/AppShell/PlaceholderFab/index.tsx +8 -27
  10. package/AppShell/index.tsx +19 -0
  11. package/AppShell/useFabAnimation.tsx +3 -2
  12. package/AppShell/useFixedFabAnimation.tsx +3 -2
  13. package/Blog/BlogAuthor/index.tsx +1 -1
  14. package/Blog/BlogHeader/index.tsx +2 -3
  15. package/Blog/BlogList/index.tsx +1 -1
  16. package/Blog/BlogListItem/index.tsx +1 -1
  17. package/Blog/BlogTitle/index.tsx +5 -5
  18. package/Button/index.tsx +26 -21
  19. package/CHANGELOG.md +56 -0
  20. package/ChipMenu/index.tsx +2 -2
  21. package/FlagAvatar/index.tsx +3 -3
  22. package/{AppShell/Footer/index.tsx → Footer/Footer.tsx} +3 -3
  23. package/{AppShell/Footer → Footer}/SocialIcon.tsx +3 -3
  24. package/Footer/index.ts +2 -0
  25. package/Form/InputCheckmark.tsx +3 -3
  26. package/Form/index.tsx +1 -1
  27. package/FramerScroller/components/SidebarGallery.tsx +24 -20
  28. package/FramerScroller/components/SidebarSlider.tsx +1 -3
  29. package/FullPageMessage/index.tsx +1 -1
  30. package/IconHeader/index.tsx +2 -15
  31. package/Layout/components/LayoutHeader.tsx +151 -0
  32. package/Layout/components/LayoutHeaderBack.tsx +58 -0
  33. package/Layout/components/LayoutHeaderClose.tsx +27 -0
  34. package/Layout/components/LayoutHeaderContent.tsx +178 -0
  35. package/Layout/components/LayoutHeadertypes.ts +10 -0
  36. package/Layout/components/LayoutProvider.tsx +17 -0
  37. package/{Title/index.tsx → Layout/components/LayoutTitle.tsx} +24 -15
  38. package/Layout/context/layoutContext.tsx +7 -0
  39. package/Layout/hooks/useScrollY.tsx +6 -0
  40. package/Layout/index.ts +5 -0
  41. package/Layout/types.ts +5 -0
  42. package/LayoutDefault/components/LayoutDefault.tsx +90 -0
  43. package/LayoutDefault/index.ts +1 -0
  44. package/LayoutOverlay/components/LayoutOverlay.tsx +25 -0
  45. package/LayoutOverlay/components/LayoutOverlayBase.tsx +362 -0
  46. package/LayoutOverlay/components/LayoutOverlayHeader.tsx +5 -0
  47. package/LayoutOverlay/hooks/useOverlayPosition.ts +70 -0
  48. package/LayoutOverlay/index.ts +2 -0
  49. package/Page/App.tsx +2 -0
  50. package/PageMeta/index.tsx +3 -0
  51. package/Pagination/index.tsx +0 -1
  52. package/Row/ButtonLinkList/index.tsx +1 -1
  53. package/Row/ColumnOneBoxed/index.tsx +1 -1
  54. package/Row/ColumnTwoWithTop/index.tsx +3 -3
  55. package/Row/ContentLinks/index.tsx +3 -3
  56. package/Row/HeroBanner/index.tsx +7 -11
  57. package/Row/IconBlocks/index.tsx +1 -1
  58. package/Row/ImageText/index.tsx +1 -1
  59. package/Row/ImageTextBoxed/index.tsx +1 -1
  60. package/Row/ParagraphWithSidebarSlide/index.tsx +1 -1
  61. package/Row/SpecialBanner/index.tsx +4 -3
  62. package/Row/index.tsx +1 -1
  63. package/Snackbar/MessageSnackbarImpl.tsx +1 -1
  64. package/StarRatingField/index.tsx +3 -4
  65. package/Stepper/Stepper.tsx +1 -1
  66. package/Styles/breakpointVal.tsx +2 -2
  67. package/Styles/classesPicker.ts +41 -0
  68. package/Styles/responsiveVal.tsx +1 -1
  69. package/SvgImage/SvgImageSimple.tsx +9 -8
  70. package/SvgImage/index.tsx +9 -11
  71. package/TextInputNumber/index.tsx +3 -4
  72. package/Theme/types.ts +14 -12
  73. package/ToggleButton/index.tsx +2 -4
  74. package/UspList/UspListItem.tsx +1 -1
  75. package/index.ts +9 -43
  76. package/package.json +8 -9
  77. package/AppShell/AppShellHeader/appShellHeaderContext.tsx +0 -11
  78. package/AppShell/AppShellHeader/index.tsx +0 -439
  79. package/AppShell/AppShellHeader/useAppShellHeaderContext.tsx +0 -6
  80. package/AppShell/AppShellProvider/index.tsx +0 -18
  81. package/AppShell/AppShellTitle/index.tsx +0 -45
  82. package/AppShell/ForwardButton.tsx +0 -53
  83. package/AppShell/FullPageShellBase.tsx +0 -82
  84. package/AppShell/MinimalPageShellBase.tsx +0 -22
  85. package/AppShell/PageShellHeader/index.tsx +0 -14
  86. package/AppShell/SheetShellBase/index.tsx +0 -114
  87. package/AppShell/SheetShellBase/useSheetStyles.ts +0 -18
  88. package/AppShell/SheetShellDragIndicator/index.tsx +0 -55
  89. package/AppShell/SheetShellHeader/index.tsx +0 -28
  90. package/AppShell/ShellBase.tsx +0 -45
  91. package/Debug/DebugSpacer.tsx +0 -51
  92. package/FramerNextPagesSlider/Slide.tsx +0 -71
  93. package/FramerNextPagesSlider/Slider.tsx +0 -39
  94. package/FramerNextPagesSlider/index.ts +0 -1
  95. package/FramerNextPagesSlider/types.ts +0 -3
@@ -1,114 +0,0 @@
1
- import { usePageContext, usePageRouter } from '@graphcommerce/framer-next-pages'
2
- import {
3
- ClassKeys,
4
- Sheet,
5
- SheetBackdrop,
6
- SheetContainer,
7
- SheetPanel,
8
- SheetProps,
9
- SnapPoint,
10
- styles as sheetStyles,
11
- } from '@graphcommerce/framer-sheet'
12
- import { makeStyles, StyleRules, Theme } from '@material-ui/core'
13
- import { useDomEvent } from 'framer-motion'
14
- import { useRouter } from 'next/router'
15
- import React, { useEffect, useRef, useState } from 'react'
16
- import responsiveVal from '../../Styles/responsiveVal'
17
- import AppShellProvider from '../AppShellProvider'
18
- import ShellBase, { PageLayoutBaseProps } from '../ShellBase'
19
- import useSheetStyles from './useSheetStyles'
20
-
21
- export type SheetShellBaseProps = {
22
- header?: React.ReactNode
23
- children?: React.ReactNode
24
- } & Pick<SheetProps, 'size' | 'variant'> &
25
- PageLayoutBaseProps
26
-
27
- const styles = sheetStyles as StyleRules<ClassKeys>
28
-
29
- const useStyles = makeStyles(
30
- (theme: Theme) => ({
31
- container: {
32
- ...styles.container,
33
- },
34
- containertop: {
35
- ...styles.containertop,
36
- },
37
- containerbottom: {
38
- ...styles.containerbottom,
39
- paddingTop: `calc(${theme.page.headerInnerHeight.md} * 0.55)`,
40
- [theme.breakpoints.up('md')]: {
41
- // offset top is x% of the header height, so it slightly overlaps the logo
42
- paddingTop: `calc(${theme.page.headerInnerHeight.md} * 0.85)`,
43
- },
44
- },
45
- containerleft: {
46
- ...styles.containerleft,
47
- paddingRight: responsiveVal(26, 48),
48
- },
49
- containerright: {
50
- ...styles.containerright,
51
- paddingLeft: responsiveVal(26, 48),
52
- },
53
- }),
54
- { name: 'SheetShellBase' },
55
- )
56
-
57
- function SheetShellBase(props: SheetShellBaseProps) {
58
- const { children, variant, size, name } = props
59
- const sheetContainerClasses = useStyles()
60
- const sheetClasses = useSheetStyles(props)
61
- const router = useRouter()
62
- const pageRouter = usePageRouter()
63
- const { depth, closeSteps, active, direction } = usePageContext()
64
- const open = depth < 0 || router.asPath === pageRouter.asPath
65
- const initialLocale = useRef(router.locale)
66
- const [isNavigating, setIsNavigating] = useState<boolean>(false)
67
-
68
- function handleClose() {
69
- if (!isNavigating) {
70
- setIsNavigating(true)
71
- return initialLocale.current !== router.locale
72
- ? pageRouter.push('/')
73
- : pageRouter.go(closeSteps * -1)
74
- }
75
- }
76
-
77
- function handleSnap(snapPoint: SnapPoint) {
78
- if (snapPoint !== 'closed') return
79
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
80
- handleClose()
81
- }
82
-
83
- const windowRef = useRef(typeof window !== 'undefined' ? window : null)
84
-
85
- function handleEscapeKey(e: KeyboardEvent | Event) {
86
- if (active) {
87
- if ((e as KeyboardEvent)?.key === 'Escape') {
88
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
89
- handleClose()
90
- }
91
- }
92
- }
93
-
94
- useDomEvent(windowRef, 'keyup', handleEscapeKey, { passive: true })
95
-
96
- return (
97
- <AppShellProvider>
98
- <ShellBase name={name}>
99
- <Sheet open={open} onSnap={handleSnap} variant={variant} size={size}>
100
- <SheetBackdrop onTap={handleClose} classes={sheetClasses} />
101
- <SheetContainer classes={sheetContainerClasses}>
102
- <SheetPanel initial={direction === -1 ? 'snapPoint1' : 'closed'} classes={sheetClasses}>
103
- {/* <FocusLock returnFocus={{ preventScroll: true }} disabled={!isActive}> */}
104
- {children}
105
- {/* </FocusLock> */}
106
- </SheetPanel>
107
- </SheetContainer>
108
- </Sheet>
109
- </ShellBase>
110
- </AppShellProvider>
111
- )
112
- }
113
-
114
- export default SheetShellBase
@@ -1,18 +0,0 @@
1
- import styles, { ClassKeys } from '@graphcommerce/framer-sheet/styles'
2
- import { makeStyles, StyleRules, Theme } from '@material-ui/core'
3
- import { ClassNameMap } from '@material-ui/styles'
4
-
5
- type UseSheetStylesReturn = (props?: Record<string, unknown>) => ClassNameMap<ClassKeys>
6
-
7
- const useSheetStyles = makeStyles<Theme, never, ClassKeys>(
8
- (theme: Theme) => ({
9
- ...(styles as StyleRules<ClassKeys>),
10
- content: {
11
- ...styles.content,
12
- backgroundColor: theme.palette.background.default,
13
- },
14
- }),
15
- { name: 'Sheet' },
16
- ) as UseSheetStylesReturn
17
-
18
- export default useSheetStyles
@@ -1,55 +0,0 @@
1
- import {
2
- SheetDragIndicator,
3
- SheetDragIndicatorProps,
4
- styles as sheetStyles,
5
- ClassKeys,
6
- } from '@graphcommerce/framer-sheet'
7
- import { makeStyles, StyleRules } from '@material-ui/core'
8
- import React from 'react'
9
- import responsiveVal from '../../Styles/responsiveVal'
10
-
11
- const styles = sheetStyles as StyleRules<ClassKeys>
12
-
13
- const useStyles = makeStyles(
14
- () => ({
15
- indicatorRoot: {
16
- ...styles.indicatorRoot,
17
- position: 'absolute',
18
- left: 0,
19
- right: 0,
20
- top: 0,
21
- },
22
- indicatorRoottop: {
23
- ...styles.indicatorRoottop,
24
- padding: `${responsiveVal(4, 8)} 4px 4px 4px`,
25
- },
26
- indicatorRootbottom: {
27
- ...styles.indicatorRootbottom,
28
- padding: `${responsiveVal(4, 8)} 4px 4px 4px`,
29
- },
30
- indicatorRootleft: {
31
- ...styles.indicatorRootleft,
32
- },
33
- indicatorRootright: {
34
- ...styles.indicatorRootright,
35
- },
36
- indicator: {
37
- ...styles.indicator,
38
- borderRadius: 99,
39
- backgroundColor: '#ddd',
40
- },
41
- indicatortop: { ...styles.indicatortop, width: responsiveVal(12, 40), height: 4 },
42
- indicatorbottom: { ...styles.indicatorbottom, width: responsiveVal(12, 40), height: 4 },
43
- indicatorleft: { ...styles.indicatorleft, width: 4, height: responsiveVal(12, 40) },
44
- indicatorright: { ...styles.indicatorright, width: 4, height: responsiveVal(12, 40) },
45
- }),
46
- { name: 'SheetShellDragIndicator' },
47
- )
48
-
49
- type SheetShellDragIndicatorProps = SheetDragIndicatorProps
50
-
51
- export default function SheetShellDragIndicator(props: SheetShellDragIndicatorProps) {
52
- const classes = useStyles()
53
-
54
- return <SheetDragIndicator {...props} classes={classes} />
55
- }
@@ -1,28 +0,0 @@
1
- import useSheetContext from '@graphcommerce/framer-sheet/hooks/useSheetContext'
2
- import { useElementScroll } from '@graphcommerce/framer-utils'
3
- import React from 'react'
4
- import AppShellHeader, { AppShellHeaderProps } from '../AppShellHeader'
5
- import useSheetStyles from '../SheetShellBase/useSheetStyles'
6
- import SheetShellDragIndicator from '../SheetShellDragIndicator'
7
-
8
- type SheetShellHeaderProps = {
9
- hideDragIndicator?: boolean
10
- } & Omit<AppShellHeaderProps, 'scrollY'>
11
-
12
- export default function SheetShellHeader(props: SheetShellHeaderProps) {
13
- const { hideDragIndicator } = props
14
- const { contentRef } = useSheetContext()
15
- const { y } = useElementScroll(contentRef)
16
- const sheetClasses = useSheetStyles()
17
-
18
- return (
19
- <AppShellHeader
20
- {...props}
21
- scrollY={y}
22
- dragIndicator={
23
- hideDragIndicator ? undefined : <SheetShellDragIndicator classes={sheetClasses} />
24
- }
25
- sheet
26
- />
27
- )
28
- }
@@ -1,45 +0,0 @@
1
- import { useTheme } from '@material-ui/core'
2
- import Head from 'next/head'
3
- import React from 'react'
4
- import PageLoadIndicator from '../PageLoadIndicator'
5
-
6
- export type PageLayoutBaseProps = { name: string; children?: React.ReactNode }
7
-
8
- const ShellBase = (props: { name: string; children?: React.ReactNode }) => {
9
- const { children, name } = props
10
- const theme = useTheme()
11
-
12
- return (
13
- <>
14
- <PageLoadIndicator />
15
- <Head>
16
- <meta name='theme-color' content={theme.palette.background.default} key='theme-color' />
17
- <meta
18
- name='viewport'
19
- content='minimum-scale=1, initial-scale=1, width=device-width'
20
- key='viewport'
21
- />
22
- <meta name='application-name' content={name} key='application-name' />
23
- <meta
24
- name='apple-mobile-web-app-capable'
25
- content='yes'
26
- key='apple-mobile-web-app-capable'
27
- />
28
- <meta
29
- name='apple-mobile-web-app-status-bar-style'
30
- content='default'
31
- key='apple-mobile-web-app-status-bar-style'
32
- />
33
- <meta name='apple-mobile-web-app-title' content={name} key='apple-mobile-web-app-title' />
34
- <meta name='format-detection' content='telephone=no' key='format-detection' />
35
- <meta name='mobile-web-app-capable' content='yes' key='mobile-web-app-capable' />
36
- <link rel='apple-touch-icon' href='/manifest/icon-512-512.png' key='apple-touch-icon' />
37
- <link rel='manifest' href='/manifest.webmanifest' key='manifest' />
38
- <link rel='shortcut icon' href='/manifest/favicon.ico' key='shortcut icon' />
39
- </Head>
40
- {children}
41
- </>
42
- )
43
- }
44
-
45
- export default ShellBase
@@ -1,51 +0,0 @@
1
- import { makeStyles } from '@material-ui/core'
2
- import { CSSProperties } from '@material-ui/styles'
3
- import { AnimatePresence, HTMLMotionProps, m } from 'framer-motion'
4
-
5
- export type DebugSpacerProps = {
6
- height?: number
7
- color?: CSSProperties['color']
8
- } & HTMLMotionProps<'div'>
9
-
10
- const useStyles = makeStyles(() => ({
11
- root: {
12
- background: `repeating-linear-gradient(-45deg, transparent, transparent 20px, #f6f6f6 20px, #f6f6f6 40px) top left`,
13
- boxShadow: `#eee 0px 0px 0px 3px inset`,
14
- overflow: 'hidden',
15
- },
16
- div: {
17
- color: `rgba(0,0,0,0.1)`,
18
- overflow: 'hidden',
19
- width: '100%',
20
- textAlign: 'center',
21
- fontSize: 20,
22
- display: 'grid',
23
- alignItems: 'center',
24
- },
25
- }))
26
- export default function DebugSpacer({ height = 250, ...divProps }: DebugSpacerProps) {
27
- const classes = useStyles()
28
- let increment = 0
29
- // eslint-disable-next-line no-return-assign
30
- const rows = new Array(Math.ceil(height / 100)).fill(0).map(() => {
31
- increment += 100
32
- return Math.min(increment, height)
33
- })
34
-
35
- return (
36
- <m.div className={classes.root} {...divProps} animate={{ height }}>
37
- <AnimatePresence>
38
- {rows.map((nr) => (
39
- <div
40
- data-key={`debug-row-${nr}`}
41
- className={classes.div}
42
- style={{ height: nr % 100 || 100, borderTop: `3px solid #efefef` }}
43
- key={`debug-row-${nr}`}
44
- >
45
- {nr}
46
- </div>
47
- ))}
48
- </AnimatePresence>
49
- </m.div>
50
- )
51
- }
@@ -1,71 +0,0 @@
1
- import { usePageContext, usePageRouter } from '@graphcommerce/framer-next-pages'
2
- import { SPRING_ANIM } from '@graphcommerce/framer-sheet'
3
- import { makeStyles } from '@material-ui/core'
4
- import { m, motionValue, useElementScroll } from 'framer-motion'
5
- import React, { useEffect, useRef } from 'react'
6
- import { ScrollPositions } from './types'
7
-
8
- const useStyles = makeStyles(
9
- () => ({
10
- slide: {
11
- position: 'absolute',
12
- left: 0,
13
- top: 0,
14
- right: 0,
15
- height: '100%',
16
- overflowY: 'auto',
17
- },
18
- }),
19
- { name: 'FramerNextPagesSlider' },
20
- )
21
-
22
- type Custom = {
23
- depth: number
24
- direction: 1 | -1
25
- exiting: boolean
26
- }
27
-
28
- export type RouterSlideProps = {
29
- children?: React.ReactNode
30
- scrollPositions: React.MutableRefObject<ScrollPositions>
31
- }
32
-
33
- export default function RouterSlide({ children, scrollPositions }: RouterSlideProps) {
34
- const classes = useStyles()
35
- const ref = useRef<HTMLDivElement>(null)
36
- const { scrollY } = useElementScroll(ref)
37
- const { direction, depth } = usePageContext()
38
- const router = usePageRouter()
39
-
40
- useEffect(() => {
41
- scrollPositions.current[router.asPath] ??= motionValue(0)
42
- scrollY.onChange((v) => scrollPositions.current[router.asPath].set(v))
43
- }, [router.asPath, scrollPositions, scrollY])
44
-
45
- useEffect(() => {
46
- const scroll = scrollPositions.current[router.asPath].get()
47
- if (ref.current && scroll) ref.current.scrollTop = scroll
48
- }, [router.asPath, scrollPositions])
49
-
50
- return (
51
- <m.div
52
- className={classes.slide}
53
- ref={ref}
54
- custom={{ depth, direction, exiting: false }}
55
- initial='initial'
56
- animate={{ x: 0 }}
57
- exit='exit'
58
- variants={{
59
- initial: (c: Custom) => (c.direction === 1 ? { x: '100%' } : { x: '-100%' }),
60
- exit: (c: Custom) => {
61
- if (!c.depth && c.exiting && c.direction === 1) return { x: '-100%' }
62
- if (!c.depth && c.exiting && c.direction === -1) return { x: '100%' }
63
- return { x: 0 }
64
- },
65
- }}
66
- transition={{ ...SPRING_ANIM, restDelta: 0.01, damping: 20 }}
67
- >
68
- {children}
69
- </m.div>
70
- )
71
- }
@@ -1,39 +0,0 @@
1
- import { usePageContext, usePageRouter } from '@graphcommerce/framer-next-pages'
2
- import { makeStyles } from '@material-ui/core'
3
- import { AnimatePresence } from 'framer-motion'
4
- import React, { useRef } from 'react'
5
- import RouterSlide from './Slide'
6
- import { ScrollPositions } from './types'
7
-
8
- const useStyles = makeStyles(
9
- {
10
- slider: {
11
- position: 'relative',
12
- width: '100%',
13
- height: '100%',
14
- },
15
- },
16
- { name: 'FramerNextPagesSlider' },
17
- )
18
-
19
- export type SliderRouteProps = { children?: React.ReactNode }
20
-
21
- /** RouteSlider provides an iOS settings style navigation */
22
- export default function Slider(props: SliderRouteProps) {
23
- const classes = useStyles()
24
- const { children } = props
25
- const { depth, direction } = usePageContext()
26
- const router = usePageRouter()
27
-
28
- const scrollPositions = useRef<ScrollPositions>({})
29
-
30
- return (
31
- <div className={classes.slider}>
32
- <AnimatePresence initial={false} custom={{ depth, direction, exiting: true }}>
33
- <RouterSlide key={router.asPath} scrollPositions={scrollPositions}>
34
- {children}
35
- </RouterSlide>
36
- </AnimatePresence>
37
- </div>
38
- )
39
- }
@@ -1 +0,0 @@
1
- export { default } from './Slider'
@@ -1,3 +0,0 @@
1
- import { MotionValue } from 'framer-motion'
2
-
3
- export type ScrollPositions = { [key: string]: MotionValue<number> }