@graphcommerce/next-ui 3.25.1 → 4.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/AnimatedRow/index.tsx +6 -3
- package/ApolloError/ApolloErrorAlert.tsx +20 -21
- package/ApolloError/ApolloErrorFullPage.tsx +3 -4
- package/ApolloError/ApolloErrorSnackbar.tsx +3 -3
- package/Blog/BlogAuthor/index.tsx +42 -48
- package/Blog/BlogContent/index.tsx +6 -23
- package/Blog/BlogHeader/index.tsx +26 -23
- package/Blog/BlogList/index.tsx +7 -25
- package/Blog/BlogListItem/index.tsx +63 -52
- package/Blog/BlogTags/BlogTag.tsx +27 -0
- package/Blog/BlogTags/index.tsx +7 -32
- package/Blog/BlogTitle/index.tsx +7 -21
- package/Button/Button.tsx +5 -0
- package/Button/LinkOrButton.tsx +80 -0
- package/Button/index.tsx +2 -177
- package/CHANGELOG.md +497 -636
- package/ChipMenu/index.tsx +71 -77
- package/ContainerWithHeader/index.tsx +33 -30
- package/FlagAvatar/index.tsx +2 -12
- package/Footer/Footer.tsx +105 -88
- package/Footer/index.ts +0 -1
- package/Form/Form.tsx +35 -0
- package/Form/FormActions.tsx +9 -14
- package/Form/FormDivider.tsx +8 -13
- package/Form/FormHeader.tsx +5 -26
- package/Form/FormRow.tsx +8 -13
- package/Form/InputCheckmark.tsx +9 -22
- package/FramerScroller/SidebarGallery.tsx +340 -0
- package/FramerScroller/SidebarSlider.tsx +107 -0
- package/FramerScroller/index.ts +2 -0
- package/FullPageMessage/index.tsx +52 -48
- package/Highlight/index.tsx +1 -1
- package/IconHeader/index.tsx +63 -58
- package/JsonLd/index.tsx +3 -2
- package/Layout/components/LayoutHeader.tsx +75 -82
- package/Layout/components/LayoutHeaderBack.tsx +21 -12
- package/Layout/components/LayoutHeaderClose.tsx +9 -22
- package/Layout/components/LayoutHeaderContent.tsx +190 -154
- package/Layout/components/LayoutHeadertypes.ts +1 -1
- package/Layout/components/LayoutTitle.tsx +60 -55
- package/LayoutDefault/components/LayoutDefault.tsx +96 -85
- package/LayoutOverlay/components/LayoutOverlay.tsx +2 -8
- package/LayoutOverlay/components/LayoutOverlayBase.tsx +233 -239
- package/LayoutOverlay/test/LayoutOverlayDemo.tsx +1 -1
- package/LayoutParts/DesktopHeaderBadge.tsx +28 -0
- package/LayoutParts/DesktopNavActions.tsx +15 -0
- package/LayoutParts/DesktopNavBar.tsx +113 -0
- package/LayoutParts/DesktopNavBarItem.tsx +44 -0
- package/{AppShell → LayoutParts}/GlobalHead.tsx +1 -2
- package/LayoutParts/Logo.tsx +77 -0
- package/LayoutParts/MenuFab.tsx +131 -0
- package/LayoutParts/MenuFabItem.tsx +25 -0
- package/LayoutParts/MenuFabSecondaryItem.tsx +37 -0
- package/{AppShell/PlaceholderFab/index.tsx → LayoutParts/PlaceholderFab.tsx} +1 -1
- package/LayoutParts/StickyBelowHeader.tsx +25 -0
- package/LayoutParts/index.ts +12 -0
- package/{AppShell → LayoutParts}/useFabAnimation.ts +0 -0
- package/Page/CssAndFramerMotionProvider.tsx +21 -0
- package/Page/index.ts +2 -0
- package/Page/types.ts +2 -8
- package/PageLoadIndicator/index.tsx +25 -30
- package/PageMeta/index.tsx +1 -1
- package/Pagination/index.tsx +37 -54
- package/RenderType/index.tsx +1 -1
- package/Row/ButtonLinkList/ButtonLinkList.tsx +35 -37
- package/Row/ButtonLinkList/ButtonLinkListItem.tsx +16 -33
- package/Row/ColumnOne/index.tsx +5 -10
- package/Row/ColumnOneBoxed/index.tsx +18 -19
- package/Row/ColumnOneCentered/index.tsx +3 -4
- package/Row/ColumnThree/index.tsx +62 -57
- package/Row/ColumnTwo/index.tsx +37 -35
- package/Row/ColumnTwoSpread/index.tsx +28 -37
- package/Row/ColumnTwoWithTop/index.tsx +37 -43
- package/Row/ContentLinks/index.tsx +24 -25
- package/Row/HeroBanner/index.tsx +98 -82
- package/Row/IconBlocks/IconBlock/index.tsx +45 -37
- package/Row/IconBlocks/index.tsx +29 -44
- package/Row/ImageText/index.tsx +71 -67
- package/Row/ImageTextBoxed/index.tsx +66 -65
- package/Row/ParagraphWithSidebarSlide/index.tsx +80 -76
- package/Row/Quote/index.tsx +3 -3
- package/Row/SpecialBanner/index.tsx +97 -97
- package/Row/index.tsx +4 -9
- package/SectionContainer/index.tsx +32 -31
- package/SectionHeader/index.tsx +41 -43
- package/Separator/index.tsx +19 -18
- package/Snackbar/MessageSnackbar.tsx +1 -2
- package/Snackbar/MessageSnackbarImpl.tsx +68 -115
- package/StarRatingField/index.tsx +24 -25
- package/Stepper/Stepper.tsx +34 -32
- package/Styles/EmotionProvider.tsx +14 -0
- package/Styles/breakpointVal.tsx +16 -10
- package/Styles/extendableComponent.ts +70 -0
- package/Styles/index.tsx +9 -2
- package/Styles/withEmotionCache.tsx +36 -0
- package/Styles/withTheme.tsx +15 -24
- package/SvgIcon/SvgIcon.tsx +60 -0
- package/TextInputNumber/index.tsx +49 -50
- package/Theme/MuiButton.ts +128 -0
- package/Theme/MuiSlider.ts +28 -0
- package/Theme/MuiSnackbar.ts +31 -0
- package/Theme/{types.ts → createTheme.ts} +8 -2
- package/Theme/index.ts +4 -0
- package/Theme/themeDefaults.ts +51 -0
- package/TimeAgo/index.tsx +1 -1
- package/ToggleButton/index.tsx +43 -49
- package/ToggleButtonGroup/index.tsx +39 -39
- package/UspList/UspListItem.tsx +56 -46
- package/UspList/index.tsx +29 -26
- package/docs/building-components.mdx +3 -0
- package/docs/components/ComponentBasic.tsx +26 -0
- package/docs/components/ComponentChild.tsx +48 -0
- package/docs/components/ComponentChildVariant.tsx +54 -0
- package/docs/components/ComponentChildVariantExtendable.tsx +62 -0
- package/docs/components/ComponentStylable.tsx +32 -0
- package/docs/pages/building-components.tsx +62 -0
- package/index.ts +27 -81
- package/package.json +25 -27
- package/types.d.ts +1 -1
- package/AppShell/AppShellSticky/index.tsx +0 -38
- package/AppShell/DesktopNavActions.tsx +0 -32
- package/AppShell/DesktopNavBar.tsx +0 -158
- package/AppShell/Logo.tsx +0 -46
- package/AppShell/Menu.tsx +0 -7
- package/AppShell/MenuFab.tsx +0 -162
- package/AppShell/MenuFabSecondaryItem.tsx +0 -32
- package/AppShell/index.ts +0 -15
- package/AspectRatioContainer/index.tsx +0 -27
- package/Footer/SocialIcon.tsx +0 -23
- package/Form/index.tsx +0 -67
- package/FramerScroller/components/SidebarGallery.tsx +0 -317
- package/FramerScroller/components/SidebarSlider.tsx +0 -97
- package/Page/App.tsx +0 -17
- package/Page/Document.tsx +0 -24
- package/StyledBadge/index.tsx +0 -20
- package/Styles/classesPicker.ts +0 -41
- package/SvgImage/SvgImageSimple.tsx +0 -100
- package/SvgImage/index.tsx +0 -74
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Link, LinkProps, useForkRef } from '@mui/material'
|
|
2
|
+
import React, { useRef } from 'react'
|
|
3
|
+
import { ConditionalExcept } from 'type-fest'
|
|
4
|
+
import { Button, ButtonProps } from './Button'
|
|
5
|
+
|
|
6
|
+
type OmitNever<T extends Record<string, unknown>> = {
|
|
7
|
+
[K in keyof T as T[K] extends never ? never : K]: T[K]
|
|
8
|
+
}
|
|
9
|
+
type SharedProperties<A, B> = OmitNever<
|
|
10
|
+
ConditionalExcept<Pick<A & B, keyof A & keyof B>, Record<string, unknown> | undefined>
|
|
11
|
+
>
|
|
12
|
+
|
|
13
|
+
export type LinkOrButtonProps = {
|
|
14
|
+
button?: ButtonProps
|
|
15
|
+
link?: LinkProps
|
|
16
|
+
breakpoint?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
17
|
+
} & SharedProperties<
|
|
18
|
+
Omit<ButtonProps, 'sx'>,
|
|
19
|
+
Omit<LinkProps, 'color' | 'sx'> & Pick<ButtonProps, 'endIcon' | 'startIcon' | 'color' | 'loading'>
|
|
20
|
+
>
|
|
21
|
+
|
|
22
|
+
/** Renders a Link until the breakpoint is reached and will then render a button. */
|
|
23
|
+
export const LinkOrButton = React.forwardRef<
|
|
24
|
+
HTMLButtonElement & HTMLAnchorElement,
|
|
25
|
+
LinkOrButtonProps
|
|
26
|
+
>((props, ref) => {
|
|
27
|
+
const {
|
|
28
|
+
// Own created props
|
|
29
|
+
breakpoint = 'md',
|
|
30
|
+
button,
|
|
31
|
+
link,
|
|
32
|
+
|
|
33
|
+
// Shared props
|
|
34
|
+
loading,
|
|
35
|
+
children,
|
|
36
|
+
startIcon,
|
|
37
|
+
endIcon,
|
|
38
|
+
color,
|
|
39
|
+
...sharedProps
|
|
40
|
+
} = props
|
|
41
|
+
|
|
42
|
+
const buttonRef = useForkRef(ref, useRef(null))
|
|
43
|
+
const linkRef = useForkRef(ref, useRef(null))
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<Button
|
|
48
|
+
sx={{ display: { xs: 'none', [breakpoint]: 'inline-flex' }, ...button?.sx }}
|
|
49
|
+
ref={buttonRef}
|
|
50
|
+
startIcon={startIcon}
|
|
51
|
+
endIcon={endIcon}
|
|
52
|
+
color={color}
|
|
53
|
+
loading={loading}
|
|
54
|
+
{...sharedProps}
|
|
55
|
+
{...button}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</Button>
|
|
59
|
+
|
|
60
|
+
<Link
|
|
61
|
+
sx={{
|
|
62
|
+
display: { xs: 'inline-flex', [breakpoint]: 'none' },
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
...link?.sx,
|
|
65
|
+
}}
|
|
66
|
+
ref={linkRef}
|
|
67
|
+
color={loading ? 'text.disabled' : color}
|
|
68
|
+
underline='none'
|
|
69
|
+
aria-disabled={loading}
|
|
70
|
+
variant='body2'
|
|
71
|
+
{...sharedProps}
|
|
72
|
+
{...link}
|
|
73
|
+
>
|
|
74
|
+
{startIcon}
|
|
75
|
+
<span>{children}</span>
|
|
76
|
+
{endIcon}
|
|
77
|
+
</Link>
|
|
78
|
+
</>
|
|
79
|
+
)
|
|
80
|
+
})
|
package/Button/index.tsx
CHANGED
|
@@ -1,177 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
ButtonClassKey as MuiButtonClassKey,
|
|
4
|
-
Theme,
|
|
5
|
-
makeStyles,
|
|
6
|
-
} from '@material-ui/core'
|
|
7
|
-
import clsx from 'clsx'
|
|
8
|
-
import React from 'react'
|
|
9
|
-
|
|
10
|
-
type BaseButtonProps = Omit<Parameters<typeof MuiButton>['0'], 'variant' | 'classes'> & {
|
|
11
|
-
variant?: 'text' | 'outlined' | 'contained' | 'pill' | 'pill-link'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type ButtonClassKey =
|
|
15
|
-
| 'pill'
|
|
16
|
-
| 'pillLink'
|
|
17
|
-
| 'pillPrimary'
|
|
18
|
-
| 'pillSecondary'
|
|
19
|
-
| 'pillSizeLarge'
|
|
20
|
-
| 'pillSizeSmall'
|
|
21
|
-
| 'pillNoElevation'
|
|
22
|
-
| 'withStartIcon'
|
|
23
|
-
| 'startIconText'
|
|
24
|
-
| 'loading'
|
|
25
|
-
|
|
26
|
-
type ClassKeys = ButtonClassKey | MuiButtonClassKey
|
|
27
|
-
|
|
28
|
-
export type ButtonProps = BaseButtonProps & {
|
|
29
|
-
classes?: { [index in ClassKeys]?: string }
|
|
30
|
-
loading?: boolean
|
|
31
|
-
text?: Text
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const useStyles = makeStyles<
|
|
35
|
-
Theme,
|
|
36
|
-
BaseButtonProps & { classes?: { [index in ButtonClassKey]?: string } },
|
|
37
|
-
ButtonClassKey
|
|
38
|
-
>(
|
|
39
|
-
(theme: Theme) => ({
|
|
40
|
-
root: {},
|
|
41
|
-
label: {},
|
|
42
|
-
disabled: {},
|
|
43
|
-
withStartIcon: {
|
|
44
|
-
[theme.breakpoints.down('sm')]: {
|
|
45
|
-
height: 40,
|
|
46
|
-
width: 40,
|
|
47
|
-
textAlign: 'center',
|
|
48
|
-
minWidth: 'unset',
|
|
49
|
-
borderRadius: 99,
|
|
50
|
-
'& > span > .MuiButton-startIcon': {
|
|
51
|
-
margin: 'unset',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
pill: {
|
|
56
|
-
borderRadius: '99em',
|
|
57
|
-
},
|
|
58
|
-
pillLink: {
|
|
59
|
-
[theme.breakpoints.up('md')]: {
|
|
60
|
-
// manually match MuiButton and containedPrimary styles
|
|
61
|
-
textTransform: 'none',
|
|
62
|
-
...theme.typography.body2,
|
|
63
|
-
fontWeight: 400,
|
|
64
|
-
borderRadius: '99em',
|
|
65
|
-
boxShadow: theme.shadows[6],
|
|
66
|
-
backgroundColor: theme.palette.background.paper,
|
|
67
|
-
color: theme.palette.text.primary,
|
|
68
|
-
'&:hover': {
|
|
69
|
-
background: theme.palette.background.paper,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
pillPrimary: {
|
|
74
|
-
[theme.breakpoints.up('md')]: {
|
|
75
|
-
backgroundColor: theme.palette.primary.main,
|
|
76
|
-
color: theme.palette.primary.contrastText,
|
|
77
|
-
'&:hover': {
|
|
78
|
-
background: theme.palette.primary.dark,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
pillSecondary: {
|
|
83
|
-
[theme.breakpoints.up('md')]: {
|
|
84
|
-
backgroundColor: theme.palette.secondary.main,
|
|
85
|
-
color: theme.palette.secondary.contrastText,
|
|
86
|
-
'&:hover': {
|
|
87
|
-
background: theme.palette.secondary.dark,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
pillSizeLarge: {},
|
|
92
|
-
pillSizeSmall: {},
|
|
93
|
-
pillNoElevation: {
|
|
94
|
-
/* disableElevation does not stop adding box shadow on active... ?! */
|
|
95
|
-
'&:active': {
|
|
96
|
-
boxShadow: 'none',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
startIconText: {
|
|
100
|
-
display: 'none',
|
|
101
|
-
[theme.breakpoints.up('md')]: {
|
|
102
|
-
display: 'unset',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
loading: {
|
|
106
|
-
'& svg': {
|
|
107
|
-
stroke: theme.palette.text.disabled,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
}),
|
|
111
|
-
{ name: 'MuiPillButton' },
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
export default React.forwardRef<any, ButtonProps>((props, ref) => {
|
|
115
|
-
const { classes = {}, ...baseProps } = props
|
|
116
|
-
const { variant, color, size, className, children, loading, disabled, text, ...buttonProps } =
|
|
117
|
-
baseProps
|
|
118
|
-
const {
|
|
119
|
-
pill,
|
|
120
|
-
pillPrimary,
|
|
121
|
-
pillSecondary,
|
|
122
|
-
pillSizeLarge,
|
|
123
|
-
pillSizeSmall,
|
|
124
|
-
pillLink,
|
|
125
|
-
...buttonClasses
|
|
126
|
-
} = classes
|
|
127
|
-
|
|
128
|
-
const pillClasses = useStyles({
|
|
129
|
-
...baseProps,
|
|
130
|
-
classes: {
|
|
131
|
-
pill,
|
|
132
|
-
pillPrimary,
|
|
133
|
-
pillSecondary,
|
|
134
|
-
pillSizeLarge,
|
|
135
|
-
pillSizeSmall,
|
|
136
|
-
pillLink,
|
|
137
|
-
...buttonClasses,
|
|
138
|
-
},
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
const variantMap = {
|
|
142
|
-
pill: 'contained',
|
|
143
|
-
'pill-link': 'text',
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const withIcon = typeof buttonProps.startIcon !== 'undefined'
|
|
147
|
-
const content = <>{loading ? <>Loading</> : children}</>
|
|
148
|
-
|
|
149
|
-
return (
|
|
150
|
-
<MuiButton
|
|
151
|
-
{...buttonProps}
|
|
152
|
-
classes={buttonClasses}
|
|
153
|
-
color={color}
|
|
154
|
-
variant={variantMap[variant ?? ''] ?? variant}
|
|
155
|
-
size={size}
|
|
156
|
-
ref={ref}
|
|
157
|
-
disabled={loading || disabled}
|
|
158
|
-
className={clsx(
|
|
159
|
-
{
|
|
160
|
-
[pillClasses.pill]: variant?.startsWith('pill'),
|
|
161
|
-
[pillClasses.pillLink]: variant === 'pill-link',
|
|
162
|
-
[pillClasses.pillPrimary]: variant?.startsWith('pill') && color === 'primary',
|
|
163
|
-
[pillClasses.pillSecondary]: variant?.startsWith('pill') && color === 'secondary',
|
|
164
|
-
[pillClasses.pillSizeLarge]: variant?.startsWith('pill') && size === 'large',
|
|
165
|
-
[pillClasses.pillSizeSmall]: variant?.startsWith('pill') && size === 'small',
|
|
166
|
-
[pillClasses.pillNoElevation]: buttonProps.disableElevation,
|
|
167
|
-
[pillClasses.loading]: loading,
|
|
168
|
-
[pillClasses.withStartIcon]: withIcon,
|
|
169
|
-
},
|
|
170
|
-
className,
|
|
171
|
-
)}
|
|
172
|
-
>
|
|
173
|
-
{withIcon && <span className={pillClasses.startIconText}>{content}</span>}
|
|
174
|
-
{!withIcon && content}
|
|
175
|
-
</MuiButton>
|
|
176
|
-
)
|
|
177
|
-
})
|
|
1
|
+
export * from './Button'
|
|
2
|
+
export * from './LinkOrButton'
|