@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
package/Row/index.tsx
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { Container, styled } from '@material
|
|
1
|
+
import { Container, styled } from '@mui/material'
|
|
2
2
|
|
|
3
|
-
const Row = styled(Container)(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}),
|
|
7
|
-
{ name: 'Row' },
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
export default Row
|
|
3
|
+
export const Row = styled(Container, { name: 'Row' })(({ theme }) => ({
|
|
4
|
+
marginBottom: theme.spacings.xxl,
|
|
5
|
+
}))
|
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import SectionHeader, { SectionHeaderProps } from '../SectionHeader'
|
|
5
|
-
import { UseStyles } from '../Styles'
|
|
1
|
+
import { Box } from '@mui/material'
|
|
2
|
+
import { SectionHeader, SectionHeaderProps } from '../SectionHeader'
|
|
3
|
+
import { extendableComponent } from '../Styles'
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
sectionContainer: {},
|
|
10
|
-
sectionHeaderSidePadding: {},
|
|
11
|
-
sectionHeaderWrapper: {
|
|
12
|
-
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
13
|
-
paddingBottom: theme.spacings.xxs,
|
|
14
|
-
marginBottom: theme.spacings.xxs,
|
|
15
|
-
},
|
|
16
|
-
labelLeft: {},
|
|
17
|
-
labelRight: {},
|
|
18
|
-
borderBottom: {
|
|
19
|
-
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
20
|
-
},
|
|
21
|
-
}),
|
|
22
|
-
{ name: 'SectionContainer' },
|
|
23
|
-
)
|
|
5
|
+
export type SectionContainerProps = SectionHeaderProps &
|
|
6
|
+
OwnerState & { children?: React.ReactNode; className?: string }
|
|
24
7
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
type OwnerState = { borderBottom?: boolean }
|
|
9
|
+
const name = 'SectionContainer' as const
|
|
10
|
+
const parts = ['root'] as const
|
|
11
|
+
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
|
|
28
12
|
|
|
29
|
-
export
|
|
30
|
-
const { children, borderBottom } = props
|
|
31
|
-
const {
|
|
13
|
+
export function SectionContainer(props: SectionContainerProps) {
|
|
14
|
+
const { children, className, borderBottom, sx = [], ...sectionHeaderProps } = props
|
|
15
|
+
const classes = withState({ borderBottom })
|
|
32
16
|
|
|
33
17
|
return (
|
|
34
|
-
<
|
|
35
|
-
|
|
18
|
+
<Box
|
|
19
|
+
className={`${classes.root} ${className ?? ''}`}
|
|
20
|
+
sx={[
|
|
21
|
+
(theme) => ({
|
|
22
|
+
'&.borderBottom': {
|
|
23
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
27
|
+
]}
|
|
28
|
+
>
|
|
29
|
+
<SectionHeader
|
|
30
|
+
{...sectionHeaderProps}
|
|
31
|
+
sx={(theme) => ({
|
|
32
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
33
|
+
paddingBottom: theme.spacings.xxs,
|
|
34
|
+
marginBottom: theme.spacings.xxs,
|
|
35
|
+
})}
|
|
36
|
+
/>
|
|
36
37
|
{children}
|
|
37
|
-
</
|
|
38
|
+
</Box>
|
|
38
39
|
)
|
|
39
40
|
}
|
package/SectionHeader/index.tsx
CHANGED
|
@@ -1,63 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import clsx from 'clsx'
|
|
1
|
+
import { Box, Typography, TypographyProps, SxProps, Theme } from '@mui/material'
|
|
3
2
|
import React from 'react'
|
|
4
|
-
import {
|
|
3
|
+
import { extendableComponent } from '../Styles'
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
sectionHeaderWrapper: {
|
|
13
|
-
position: 'relative',
|
|
14
|
-
'&:focus': {
|
|
15
|
-
outline: 'none',
|
|
16
|
-
},
|
|
17
|
-
display: 'flex',
|
|
18
|
-
justifyContent: 'space-between',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
marginTop: theme.spacings.sm,
|
|
21
|
-
marginBottom: theme.spacings.xxs,
|
|
22
|
-
},
|
|
23
|
-
labelLeft: {},
|
|
24
|
-
labelRight: {
|
|
25
|
-
color: theme.palette.text.primary,
|
|
26
|
-
lineHeight: 1,
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
{ name: 'SectionHeader' },
|
|
30
|
-
)
|
|
5
|
+
const { classes, selectors } = extendableComponent('SectionHeader', [
|
|
6
|
+
'root',
|
|
7
|
+
'left',
|
|
8
|
+
'right',
|
|
9
|
+
] as const)
|
|
31
10
|
|
|
32
11
|
export type SectionHeaderProps = {
|
|
33
12
|
variantLeft?: TypographyProps['variant']
|
|
34
13
|
variantRight?: TypographyProps['variant']
|
|
35
14
|
usePadding?: boolean
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
15
|
+
sx?: SxProps<Theme>
|
|
16
|
+
} & (
|
|
17
|
+
| { labelLeft: React.ReactNode; labelRight?: React.ReactNode }
|
|
18
|
+
| { labelLeft?: React.ReactNode; labelRight: React.ReactNode }
|
|
19
|
+
)
|
|
41
20
|
|
|
42
|
-
export
|
|
21
|
+
export function SectionHeader(props: SectionHeaderProps) {
|
|
43
22
|
const {
|
|
44
23
|
labelLeft,
|
|
45
24
|
labelRight,
|
|
46
25
|
usePadding,
|
|
47
26
|
variantLeft = 'overline',
|
|
48
27
|
variantRight = 'body2',
|
|
28
|
+
sx = [],
|
|
49
29
|
} = props
|
|
50
|
-
const classes = useStyles(props)
|
|
51
30
|
|
|
52
31
|
return (
|
|
53
|
-
<
|
|
54
|
-
className={
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
32
|
+
<Box
|
|
33
|
+
className={classes.root}
|
|
34
|
+
sx={[
|
|
35
|
+
(theme) => ({
|
|
36
|
+
position: 'relative',
|
|
37
|
+
'&:focus': {
|
|
38
|
+
outline: 'none',
|
|
39
|
+
},
|
|
40
|
+
display: 'flex',
|
|
41
|
+
justifyContent: 'space-between',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
marginTop: theme.spacings.sm,
|
|
44
|
+
marginBottom: theme.spacings.xxs,
|
|
45
|
+
}),
|
|
46
|
+
usePadding === true &&
|
|
47
|
+
((theme) => ({
|
|
48
|
+
paddingLeft: theme.spacings.xxs,
|
|
49
|
+
paddingRight: theme.spacings.xxs,
|
|
50
|
+
})),
|
|
51
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
52
|
+
]}
|
|
58
53
|
>
|
|
59
54
|
<Typography
|
|
60
|
-
className={classes.
|
|
55
|
+
className={classes.left}
|
|
61
56
|
variant={variantLeft}
|
|
62
57
|
color='textSecondary'
|
|
63
58
|
component='div'
|
|
@@ -66,14 +61,17 @@ export default function SectionHeader(props: SectionHeaderProps) {
|
|
|
66
61
|
</Typography>
|
|
67
62
|
{labelRight && (
|
|
68
63
|
<Typography
|
|
69
|
-
className={classes.
|
|
64
|
+
className={classes.right}
|
|
70
65
|
variant={variantRight}
|
|
71
66
|
color='textSecondary'
|
|
72
67
|
component='div'
|
|
68
|
+
sx={{ color: 'text.primary', lineHeight: 1 }}
|
|
73
69
|
>
|
|
74
70
|
{labelRight}
|
|
75
71
|
</Typography>
|
|
76
72
|
)}
|
|
77
|
-
</
|
|
73
|
+
</Box>
|
|
78
74
|
)
|
|
79
75
|
}
|
|
76
|
+
|
|
77
|
+
SectionHeader.selectors = selectors
|
package/Separator/index.tsx
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Box, Typography, TypographyProps } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import {
|
|
3
|
+
import { extendableComponent } from '../Styles'
|
|
4
4
|
|
|
5
5
|
export type DividedLinksProps = {
|
|
6
6
|
icon?: React.ReactNode
|
|
7
|
-
} & Pick<TypographyProps, 'color'>
|
|
8
|
-
UseStyles<typeof useStyles>
|
|
7
|
+
} & Pick<TypographyProps, 'color' | 'sx'>
|
|
9
8
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
display: 'inline',
|
|
14
|
-
padding: `0 ${theme.spacings.xxs} 0 ${theme.spacings.xxs}`,
|
|
15
|
-
},
|
|
16
|
-
}),
|
|
17
|
-
{ name: 'Separator' },
|
|
18
|
-
)
|
|
9
|
+
const name = 'Separator' as const
|
|
10
|
+
const parts = ['root'] as const
|
|
11
|
+
const { classes } = extendableComponent(name, parts)
|
|
19
12
|
|
|
20
|
-
export
|
|
21
|
-
const { color, icon } = props
|
|
22
|
-
const classes = useStyles(props)
|
|
13
|
+
export function Separator(props: DividedLinksProps) {
|
|
14
|
+
const { color, icon, sx = [] } = props
|
|
23
15
|
|
|
24
16
|
return (
|
|
25
|
-
<
|
|
17
|
+
<Box
|
|
18
|
+
className={classes.root}
|
|
19
|
+
sx={[
|
|
20
|
+
(theme) => ({
|
|
21
|
+
display: 'inline',
|
|
22
|
+
padding: `0 ${theme.spacings.xxs} 0 ${theme.spacings.xxs}`,
|
|
23
|
+
}),
|
|
24
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
25
|
+
]}
|
|
26
|
+
>
|
|
26
27
|
{icon ?? (
|
|
27
28
|
<Typography component='span' variant='body1' color={color}>
|
|
28
29
|
|
|
|
29
30
|
</Typography>
|
|
30
31
|
)}
|
|
31
|
-
</
|
|
32
|
+
</Box>
|
|
32
33
|
)
|
|
33
34
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import dynamic from 'next/dynamic'
|
|
2
2
|
|
|
3
3
|
/** Always load the MessageSnackbar dynamically */
|
|
4
|
-
const MessageSnackbar = dynamic(() => import('./MessageSnackbarImpl'), { ssr: false })
|
|
5
|
-
export default MessageSnackbar
|
|
4
|
+
export const MessageSnackbar = dynamic(() => import('./MessageSnackbarImpl'), { ssr: false })
|
|
@@ -1,106 +1,44 @@
|
|
|
1
|
+
import { Portal } from '@mui/base'
|
|
1
2
|
import {
|
|
2
3
|
Fab,
|
|
3
|
-
makeStyles,
|
|
4
4
|
Snackbar,
|
|
5
5
|
SnackbarContent,
|
|
6
6
|
SnackbarProps,
|
|
7
|
-
Theme,
|
|
8
|
-
Portal,
|
|
9
7
|
lighten,
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
Box,
|
|
9
|
+
SxProps,
|
|
10
|
+
Theme,
|
|
11
|
+
} from '@mui/material'
|
|
12
12
|
import React, { useEffect, useState } from 'react'
|
|
13
|
-
import
|
|
13
|
+
import { extendableComponent } from '../Styles'
|
|
14
|
+
import { SvgIcon } from '../SvgIcon/SvgIcon'
|
|
14
15
|
import { iconClose, iconCheckmark, iconSadFace } from '../icons'
|
|
15
16
|
|
|
16
17
|
type Size = 'normal' | 'wide'
|
|
17
18
|
type Variant = 'contained' | 'pill'
|
|
18
19
|
|
|
19
|
-
const useStyles = makeStyles(
|
|
20
|
-
(theme: Theme) => ({
|
|
21
|
-
snackbarRoot: {},
|
|
22
|
-
anchorOriginBottomCenter: {
|
|
23
|
-
left: 0,
|
|
24
|
-
right: 0,
|
|
25
|
-
transform: 'unset',
|
|
26
|
-
bottom: 0,
|
|
27
|
-
pointerEvents: 'none',
|
|
28
|
-
[theme.breakpoints.up('md')]: {
|
|
29
|
-
padding: `${theme.page.vertical} ${theme.page.horizontal}`,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
root: {
|
|
33
|
-
pointerEvents: 'all',
|
|
34
|
-
padding: `16px ${theme.page.horizontal}px max(16px, env(safe-area-inset-bottom))`,
|
|
35
|
-
},
|
|
36
|
-
rootPill: {
|
|
37
|
-
backgroundColor: theme.palette.background.paper,
|
|
38
|
-
color: theme.palette.text.primary,
|
|
39
|
-
[theme.breakpoints.up('md')]: {
|
|
40
|
-
borderRadius: '99em',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
rootPillLarge: {},
|
|
44
|
-
rootPillSeverityInfo: {},
|
|
45
|
-
rootPillSeverityError: {},
|
|
46
|
-
message: {
|
|
47
|
-
width: '100%',
|
|
48
|
-
padding: theme.spacings.xxs,
|
|
49
|
-
display: 'grid',
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
gap: theme.spacings.xs,
|
|
52
|
-
gridTemplate: `
|
|
53
|
-
"children close"
|
|
54
|
-
"action action"
|
|
55
|
-
`,
|
|
56
|
-
gridTemplateColumns: '1fr auto',
|
|
57
|
-
[theme.breakpoints.up('md')]: {
|
|
58
|
-
gridTemplate: `"children action close"`,
|
|
59
|
-
gridTemplateColumns: 'auto auto auto',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
children: {
|
|
63
|
-
display: 'flex',
|
|
64
|
-
columnGap: 10,
|
|
65
|
-
gridArea: 'children',
|
|
66
|
-
...theme.typography.subtitle1,
|
|
67
|
-
fontWeight: 400,
|
|
68
|
-
},
|
|
69
|
-
actionButton: {
|
|
70
|
-
gridArea: 'action',
|
|
71
|
-
'&:hover, &:focus': {
|
|
72
|
-
backgroundColor: 'transparent',
|
|
73
|
-
},
|
|
74
|
-
[theme.breakpoints.down('md')]: {
|
|
75
|
-
'& .MuiPillButton-pill': {
|
|
76
|
-
width: '100%',
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
close: {
|
|
81
|
-
backgroundColor: lighten(theme.palette.background.paper, 0.1),
|
|
82
|
-
},
|
|
83
|
-
sticky: {
|
|
84
|
-
position: 'sticky',
|
|
85
|
-
},
|
|
86
|
-
}),
|
|
87
|
-
{ name: 'MessageSnackbar' },
|
|
88
|
-
)
|
|
89
|
-
|
|
90
20
|
export type MessageSnackbarImplProps = Omit<
|
|
91
21
|
SnackbarProps,
|
|
92
22
|
'autoHideDuration' | 'anchorOrigin' | 'color'
|
|
93
23
|
> & {
|
|
94
24
|
autoHide?: boolean
|
|
95
|
-
sticky?: boolean
|
|
96
|
-
variant?: Variant
|
|
97
|
-
size?: Size
|
|
98
|
-
severity?: 'success' | 'info' | 'warning' | 'error'
|
|
99
25
|
action?: React.ReactNode
|
|
100
26
|
children?: React.ReactNode
|
|
101
27
|
onClose?: () => void
|
|
28
|
+
sx?: SxProps<Theme>
|
|
29
|
+
} & OwnerState
|
|
30
|
+
|
|
31
|
+
type OwnerState = {
|
|
32
|
+
sticky?: boolean
|
|
33
|
+
size?: Size
|
|
34
|
+
severity?: 'success' | 'info' | 'warning' | 'error'
|
|
35
|
+
variant?: Variant
|
|
102
36
|
}
|
|
103
37
|
|
|
38
|
+
const name = 'MessageSnackbarImpl' as const
|
|
39
|
+
const parts = ['root', 'content', 'children', 'actionButton', 'close'] as const
|
|
40
|
+
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
|
|
41
|
+
|
|
104
42
|
export default function MessageSnackbarImpl(props: MessageSnackbarImplProps) {
|
|
105
43
|
const [showSnackbar, setShowSnackbar] = useState<boolean>(false)
|
|
106
44
|
|
|
@@ -115,10 +53,11 @@ export default function MessageSnackbarImpl(props: MessageSnackbarImplProps) {
|
|
|
115
53
|
children,
|
|
116
54
|
onClose,
|
|
117
55
|
severity = 'info',
|
|
56
|
+
sx,
|
|
118
57
|
...snackbarProps
|
|
119
58
|
} = props
|
|
120
59
|
|
|
121
|
-
const classes =
|
|
60
|
+
const classes = withState({ sticky, size, severity, variant })
|
|
122
61
|
|
|
123
62
|
useEffect(() => {
|
|
124
63
|
setShowSnackbar(!!open)
|
|
@@ -129,19 +68,6 @@ export default function MessageSnackbarImpl(props: MessageSnackbarImplProps) {
|
|
|
129
68
|
onClose?.()
|
|
130
69
|
}
|
|
131
70
|
|
|
132
|
-
const clsxBonus = (base: string) => {
|
|
133
|
-
const Size = size[0].toUpperCase() + size.slice(1)
|
|
134
|
-
const Severity = severity[0].toUpperCase() + severity.slice(1)
|
|
135
|
-
const Variant = variant[0].toUpperCase() + variant.slice(1)
|
|
136
|
-
|
|
137
|
-
return clsx(
|
|
138
|
-
classes[base],
|
|
139
|
-
classes[`${base}${Variant}`],
|
|
140
|
-
classes[`${base}${Variant}Size${Size}`],
|
|
141
|
-
classes[`${base}${Variant}Severity${Severity}`],
|
|
142
|
-
)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
71
|
let icon = iconCheckmark
|
|
146
72
|
if (severity === 'error') icon = iconSadFace
|
|
147
73
|
|
|
@@ -153,35 +79,62 @@ export default function MessageSnackbarImpl(props: MessageSnackbarImplProps) {
|
|
|
153
79
|
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
|
|
154
80
|
open={showSnackbar}
|
|
155
81
|
autoHideDuration={autoHide ? 6000 : null}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
anchorOriginBottomCenter: clsx(
|
|
159
|
-
classes.anchorOriginBottomCenter,
|
|
160
|
-
sticky && classes.sticky,
|
|
161
|
-
),
|
|
162
|
-
}}
|
|
82
|
+
className={classes.root}
|
|
83
|
+
sx={sx}
|
|
163
84
|
onClose={hideSnackbar}
|
|
164
85
|
>
|
|
165
86
|
<SnackbarContent
|
|
166
87
|
elevation={12}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
88
|
+
className={classes.content}
|
|
89
|
+
sx={(theme) => ({
|
|
90
|
+
'&.variantPill': {
|
|
91
|
+
backgroundColor: theme.palette.background.paper,
|
|
92
|
+
color: theme.palette.text.primary,
|
|
93
|
+
[theme.breakpoints.up('md')]: {
|
|
94
|
+
borderRadius: '99em',
|
|
95
|
+
},
|
|
96
|
+
padding: theme.spacings.xxs,
|
|
97
|
+
},
|
|
98
|
+
'& .MuiSnackbarContent-message': {
|
|
99
|
+
width: '100%',
|
|
100
|
+
padding: 0,
|
|
101
|
+
display: 'grid',
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
gap: theme.spacings.xxs,
|
|
104
|
+
gridTemplate: {
|
|
105
|
+
xs: `"icon children close" "action action action"`,
|
|
106
|
+
md: '"icon children action close"',
|
|
107
|
+
},
|
|
108
|
+
gridTemplateColumns: {
|
|
109
|
+
xs: 'min-content 1fr auto',
|
|
110
|
+
md: 'min-content 1fr max-content auto',
|
|
111
|
+
},
|
|
112
|
+
typography: 'subtitle1',
|
|
113
|
+
'&.SvgIcon': {
|
|
114
|
+
gridArea: 'children',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
})}
|
|
172
118
|
message={
|
|
173
119
|
<>
|
|
174
|
-
<
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
</div>
|
|
120
|
+
<SvgIcon src={icon} size='large' />
|
|
121
|
+
<Box gridArea='children'>{children}</Box>
|
|
122
|
+
{/* </Box> */}
|
|
178
123
|
{action && (
|
|
179
|
-
<
|
|
124
|
+
<Box className={classes.actionButton} onClick={hideSnackbar} gridArea='action'>
|
|
180
125
|
{action}
|
|
181
|
-
</
|
|
126
|
+
</Box>
|
|
182
127
|
)}
|
|
183
|
-
<Fab
|
|
184
|
-
|
|
128
|
+
<Fab
|
|
129
|
+
className={classes.close}
|
|
130
|
+
aria-label='Close'
|
|
131
|
+
size='small'
|
|
132
|
+
onClick={hideSnackbar}
|
|
133
|
+
sx={(theme) => ({
|
|
134
|
+
backgroundColor: lighten(theme.palette.background.paper, 0.1),
|
|
135
|
+
})}
|
|
136
|
+
>
|
|
137
|
+
<SvgIcon src={iconClose} />
|
|
185
138
|
</Fab>
|
|
186
139
|
</>
|
|
187
140
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import SvgImageSimple from '../SvgImage/SvgImageSimple'
|
|
1
|
+
import { RatingProps, Rating } from '@mui/material'
|
|
2
|
+
import { extendableComponent } from '../Styles'
|
|
3
|
+
import { SvgIcon } from '../SvgIcon/SvgIcon'
|
|
5
4
|
import { iconStar } from '../icons'
|
|
6
5
|
|
|
7
6
|
export type StarRatingFieldProps = {
|
|
@@ -9,35 +8,35 @@ export type StarRatingFieldProps = {
|
|
|
9
8
|
onChange?: (id: string, value: number) => void
|
|
10
9
|
} & Omit<RatingProps, 'id' | 'onChange'>
|
|
11
10
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
fill: '#FFDA1C',
|
|
16
|
-
stroke: 'none',
|
|
17
|
-
margin: '0 3px',
|
|
18
|
-
},
|
|
19
|
-
iconStarEmpty: {
|
|
20
|
-
fill: theme.palette.grey[300],
|
|
21
|
-
stroke: 'none',
|
|
22
|
-
margin: '0 3px',
|
|
23
|
-
},
|
|
24
|
-
}),
|
|
25
|
-
{
|
|
26
|
-
name: 'StarRatingField',
|
|
27
|
-
},
|
|
28
|
-
)
|
|
11
|
+
const name = 'StarRatingField' as const
|
|
12
|
+
const parts = ['root', 'startEmpty', 'starFull'] as const
|
|
13
|
+
const { classes } = extendableComponent(name, parts)
|
|
29
14
|
|
|
30
|
-
export
|
|
15
|
+
export function StarRatingField(props: StarRatingFieldProps) {
|
|
31
16
|
const { id, onChange = () => {}, ...ratingProps } = props
|
|
32
|
-
const classes = useStyles(props)
|
|
33
17
|
|
|
34
18
|
return (
|
|
35
19
|
<Rating
|
|
20
|
+
className={classes.root}
|
|
36
21
|
name={`star-rating-${id}`}
|
|
37
22
|
max={5}
|
|
38
23
|
size='small'
|
|
39
|
-
emptyIcon={
|
|
40
|
-
|
|
24
|
+
emptyIcon={
|
|
25
|
+
<SvgIcon
|
|
26
|
+
src={iconStar}
|
|
27
|
+
size='large'
|
|
28
|
+
className={classes.startEmpty}
|
|
29
|
+
sx={{ fill: '#FFDA1C', stroke: 'none', margin: '0 3px' }}
|
|
30
|
+
/>
|
|
31
|
+
}
|
|
32
|
+
icon={
|
|
33
|
+
<SvgIcon
|
|
34
|
+
src={iconStar}
|
|
35
|
+
size='large'
|
|
36
|
+
className={classes.starFull}
|
|
37
|
+
sx={(theme) => ({ fill: theme.palette.divider, stroke: 'none', margin: '0 3px' })}
|
|
38
|
+
/>
|
|
39
|
+
}
|
|
41
40
|
onChange={(event, value) => {
|
|
42
41
|
onChange(id ?? '', value ?? 0)
|
|
43
42
|
}}
|
package/Stepper/Stepper.tsx
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { UseStyles } from '../Styles'
|
|
1
|
+
import { Box, SxProps, Theme } from '@mui/material'
|
|
2
|
+
import { extendableComponent } from '../Styles'
|
|
5
3
|
import { responsiveVal } from '../Styles/responsiveVal'
|
|
6
4
|
|
|
7
|
-
const useStyles = makeStyles(
|
|
8
|
-
(theme: Theme) => ({
|
|
9
|
-
root: {
|
|
10
|
-
marginTop: '-2px',
|
|
11
|
-
display: 'grid',
|
|
12
|
-
gridAutoFlow: 'column',
|
|
13
|
-
gap: responsiveVal(8, 12),
|
|
14
|
-
// padding: `0 ${theme.page.horizontal}`,
|
|
15
|
-
},
|
|
16
|
-
step: {
|
|
17
|
-
height: responsiveVal(2, 3),
|
|
18
|
-
background: theme.palette.divider,
|
|
19
|
-
},
|
|
20
|
-
current: {
|
|
21
|
-
background: theme.palette.secondary.main,
|
|
22
|
-
},
|
|
23
|
-
}),
|
|
24
|
-
{ name: 'Stepper' },
|
|
25
|
-
)
|
|
26
|
-
|
|
27
5
|
export type StepperProps = {
|
|
28
6
|
steps: number
|
|
29
7
|
currentStep: number
|
|
30
|
-
|
|
8
|
+
sx?: SxProps<Theme>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const name = 'Stepper' as const
|
|
12
|
+
const parts = ['root', 'step', 'activeStep'] as const
|
|
13
|
+
const { classes } = extendableComponent(name, parts)
|
|
31
14
|
|
|
32
|
-
export
|
|
33
|
-
const { steps, currentStep } = props
|
|
34
|
-
const classes = useStyles(props)
|
|
15
|
+
export function Stepper(props: StepperProps) {
|
|
16
|
+
const { steps, currentStep, sx = [] } = props
|
|
35
17
|
|
|
36
18
|
return (
|
|
37
|
-
<
|
|
19
|
+
<Box
|
|
20
|
+
className={classes.root}
|
|
21
|
+
sx={[
|
|
22
|
+
(theme) => ({
|
|
23
|
+
marginTop: '-2px',
|
|
24
|
+
display: 'grid',
|
|
25
|
+
gridAutoFlow: 'column',
|
|
26
|
+
gap: theme.spacings.xxs,
|
|
27
|
+
}),
|
|
28
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
29
|
+
]}
|
|
30
|
+
>
|
|
38
31
|
{[...Array(steps).keys()].map((step: number) => (
|
|
39
|
-
<
|
|
40
|
-
|
|
32
|
+
<Box
|
|
33
|
+
sx={[
|
|
34
|
+
{
|
|
35
|
+
height: responsiveVal(2, 3),
|
|
36
|
+
bgcolor: 'divider',
|
|
37
|
+
},
|
|
38
|
+
currentStep - 1 >= step && {
|
|
39
|
+
bgcolor: 'secondary.main',
|
|
40
|
+
},
|
|
41
|
+
]}
|
|
42
|
+
className={`${classes.step} ${currentStep - 1 >= step ? classes.activeStep : ''}`}
|
|
41
43
|
key={step}
|
|
42
44
|
/>
|
|
43
45
|
))}
|
|
44
|
-
</
|
|
46
|
+
</Box>
|
|
45
47
|
)
|
|
46
48
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import createCache from '@emotion/cache'
|
|
2
|
+
import type { EmotionCache } from '@emotion/cache'
|
|
3
|
+
import { CacheProvider } from '@emotion/react'
|
|
4
|
+
|
|
5
|
+
let muiCache: EmotionCache | undefined
|
|
6
|
+
export const createMuiCache = () => {
|
|
7
|
+
muiCache = createCache({ key: 'mui', prepend: true })
|
|
8
|
+
return muiCache
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Provider that is supposed to be used in your `pages/_app.tsx` */
|
|
12
|
+
export function EmotionProvider({ children }: { children: React.ReactNode }) {
|
|
13
|
+
return <CacheProvider value={muiCache ?? createMuiCache()}>{children}</CacheProvider>
|
|
14
|
+
}
|