@graphcommerce/next-ui 7.0.0-canary.21 → 7.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 +7 -8
- package/ActionCard/ActionCardAccordion.tsx +58 -0
- package/ActionCard/ActionCardLayout.tsx +6 -6
- package/ActionCard/ActionCardList.tsx +32 -4
- package/ActionCard/ActionCardListForm.tsx +1 -1
- package/ActionCard/index.ts +1 -0
- package/Blog/BlogListItem/BlogListItem.tsx +15 -14
- package/Button/LinkOrButton.tsx +5 -4
- package/CHANGELOG.md +263 -1
- package/Footer/Footer.tsx +65 -57
- package/FramerScroller/SidebarGallery.tsx +22 -11
- package/IconSvg/IconSvg.tsx +28 -30
- package/Layout/components/LayoutHeader.tsx +4 -1
- package/LayoutOverlay/components/LayoutOverlayHeader.tsx +2 -1
- package/LayoutParts/StickyBelowHeader.tsx +19 -10
- package/Navigation/hooks/useNavigation.ts +1 -0
- package/Overlay/components/OverlayBase.tsx +33 -8
- package/OverlayOrPopperChip/OverlayPanelActions.tsx +1 -1
- package/OverlayOrPopperChip/PopperPanel.tsx +1 -1
- package/OverlayOrPopperChip/PopperPanelActions.tsx +2 -2
- package/PageMeta/PageMeta.tsx +24 -2
- package/Pagination/Pagination.tsx +16 -13
- package/RenderType/RenderType.tsx +1 -1
- package/Row/IconBlocks/IconBlock.tsx +36 -33
- package/Styles/__tests__/spreadVal.test.ts +1 -1
- package/TextInputNumber/TextInputNumber.tsx +50 -30
- package/Theme/MuiButton.ts +4 -4
- package/Theme/MuiFab.ts +15 -1
- package/hooks/useDateTimeFormat.ts +8 -1
- package/hooks/useNumberFormat.ts +8 -1
- package/package.json +17 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spreadLinear, spreadVal } from '../spreadVal'
|
|
2
2
|
|
|
3
3
|
it('generates the right spreadVal', () => {
|
|
4
|
-
const s = (val:
|
|
4
|
+
const s = (val: unknown) => JSON.stringify(val)
|
|
5
5
|
|
|
6
6
|
expect(s(spreadLinear(15, 18, 'xl'))).toMatchInlineSnapshot(`"[15,15.53,16.2,17.28,18]"`)
|
|
7
7
|
expect(s(spreadLinear(15, 18))).toMatchInlineSnapshot(`"[15,16.31,18,18,18]"`)
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { i18n } from '@lingui/core'
|
|
2
2
|
import {
|
|
3
|
-
IconButton,
|
|
4
3
|
IconButtonProps,
|
|
5
4
|
SxProps,
|
|
5
|
+
Box,
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
6
7
|
TextField,
|
|
7
8
|
TextFieldProps,
|
|
8
9
|
useForkRef,
|
|
9
10
|
Theme,
|
|
11
|
+
Fab,
|
|
10
12
|
} from '@mui/material'
|
|
11
13
|
import { ChangeEvent, Ref, useCallback, useEffect, useRef, useState } from 'react'
|
|
12
14
|
import { IconSvg } from '../IconSvg'
|
|
@@ -36,6 +38,7 @@ export function TextInputNumber(props: TextInputNumberProps) {
|
|
|
36
38
|
UpProps = {},
|
|
37
39
|
inputProps = {},
|
|
38
40
|
inputRef,
|
|
41
|
+
variant = 'outlined',
|
|
39
42
|
sx = [],
|
|
40
43
|
...textFieldProps
|
|
41
44
|
} = props
|
|
@@ -91,11 +94,27 @@ export function TextInputNumber(props: TextInputNumberProps) {
|
|
|
91
94
|
<TextField
|
|
92
95
|
{...textFieldProps}
|
|
93
96
|
type='number'
|
|
97
|
+
variant={variant}
|
|
94
98
|
inputRef={forkRef}
|
|
95
99
|
className={`${textFieldProps.className ?? ''} ${classes.quantity}`}
|
|
96
100
|
sx={[
|
|
97
101
|
{
|
|
98
|
-
width: responsiveVal(
|
|
102
|
+
width: responsiveVal(90, 120),
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
'& .MuiOutlinedInput-root': {
|
|
106
|
+
px: '3px',
|
|
107
|
+
display: 'grid',
|
|
108
|
+
gridTemplateColumns: '1fr auto 1fr',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
variant === 'standard' && {
|
|
112
|
+
'& .MuiOutlinedInput-input': {
|
|
113
|
+
padding: 0,
|
|
114
|
+
},
|
|
115
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
|
116
|
+
display: 'none',
|
|
117
|
+
},
|
|
99
118
|
},
|
|
100
119
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
101
120
|
]}
|
|
@@ -103,36 +122,36 @@ export function TextInputNumber(props: TextInputNumberProps) {
|
|
|
103
122
|
InputProps={{
|
|
104
123
|
...textFieldProps.InputProps,
|
|
105
124
|
startAdornment: (
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
</
|
|
125
|
+
<Box>
|
|
126
|
+
<Fab
|
|
127
|
+
aria-label={i18n._(/* i18n */ 'Decrease')}
|
|
128
|
+
size='smaller'
|
|
129
|
+
sx={{ boxShadow: variant === 'standard' ? 4 : 0, minHeight: '30px' }}
|
|
130
|
+
onPointerDown={() => setDirection('down')}
|
|
131
|
+
onPointerUp={stop}
|
|
132
|
+
tabIndex={-1}
|
|
133
|
+
{...DownProps}
|
|
134
|
+
className={`${classes.button} ${DownProps.className ?? ''}`}
|
|
135
|
+
>
|
|
136
|
+
{DownProps.children ?? <IconSvg src={iconMin} size='small' />}
|
|
137
|
+
</Fab>
|
|
138
|
+
</Box>
|
|
120
139
|
),
|
|
121
140
|
endAdornment: (
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</
|
|
141
|
+
<Box>
|
|
142
|
+
<Fab
|
|
143
|
+
aria-label={i18n._(/* i18n */ 'Increase')}
|
|
144
|
+
size='smaller'
|
|
145
|
+
sx={{ boxShadow: variant === 'standard' ? 4 : 0, minHeight: '30px' }}
|
|
146
|
+
onPointerDown={() => setDirection('up')}
|
|
147
|
+
onPointerUp={() => setDirection(null)}
|
|
148
|
+
tabIndex={-1}
|
|
149
|
+
{...UpProps}
|
|
150
|
+
className={`${classes.button} ${UpProps.className ?? ''}`}
|
|
151
|
+
>
|
|
152
|
+
{UpProps.children ?? <IconSvg src={iconPlus} size='small' />}
|
|
153
|
+
</Fab>
|
|
154
|
+
</Box>
|
|
136
155
|
),
|
|
137
156
|
}}
|
|
138
157
|
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
@@ -144,6 +163,7 @@ export function TextInputNumber(props: TextInputNumberProps) {
|
|
|
144
163
|
'aria-label': i18n._(/* i18n */ 'Number'),
|
|
145
164
|
sx: [
|
|
146
165
|
{
|
|
166
|
+
typography: 'body1',
|
|
147
167
|
textAlign: 'center',
|
|
148
168
|
'&::-webkit-inner-spin-button,&::-webkit-outer-spin-button': {
|
|
149
169
|
appearance: 'none',
|
package/Theme/MuiButton.ts
CHANGED
|
@@ -89,19 +89,19 @@ export const MuiButtonPill: ButtonVariants = [
|
|
|
89
89
|
{
|
|
90
90
|
props: { variant: 'pill', size: 'small' },
|
|
91
91
|
style: ({ theme }) => ({
|
|
92
|
-
'&:not(.Mui-disabled)': { boxShadow: theme.shadows[2] },
|
|
92
|
+
'&:not(.Mui-disabled):not(.MuiButton-disableElevation)': { boxShadow: theme.shadows[2] },
|
|
93
93
|
}),
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
props: { variant: 'pill', size: 'medium' },
|
|
97
97
|
style: ({ theme }) => ({
|
|
98
|
-
'&:not(.Mui-disabled)': { boxShadow: theme.shadows[4] },
|
|
98
|
+
'&:not(.Mui-disabled):not(.MuiButton-disableElevation)': { boxShadow: theme.shadows[4] },
|
|
99
99
|
}),
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
props: { variant: 'pill', size: 'large' },
|
|
103
103
|
style: ({ theme }) => ({
|
|
104
|
-
'&:not(.Mui-disabled)': { boxShadow: theme.shadows[6] },
|
|
104
|
+
'&:not(.Mui-disabled):not(.MuiButton-disableElevation)': { boxShadow: theme.shadows[6] },
|
|
105
105
|
}),
|
|
106
106
|
},
|
|
107
107
|
{
|
|
@@ -161,7 +161,7 @@ export const MuiButtonInline: ButtonVariants = [
|
|
|
161
161
|
{
|
|
162
162
|
props: { variant: 'inline', size: 'small' },
|
|
163
163
|
style: ({ theme }) => ({
|
|
164
|
-
margin: `calc(${theme.spacings.xxs}
|
|
164
|
+
margin: `calc(${theme.spacings.xxs} * -1 )`,
|
|
165
165
|
padding: '3px 9px',
|
|
166
166
|
|
|
167
167
|
'& .MuiLoadingButton-loadingIndicatorEnd': { right: 3 },
|
package/Theme/MuiFab.ts
CHANGED
|
@@ -25,9 +25,12 @@ const defaultSizes: FabSizes = {
|
|
|
25
25
|
* Default values picked from MUI:
|
|
26
26
|
* https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Fab/Fab.js
|
|
27
27
|
*/
|
|
28
|
+
smaller: '30px',
|
|
28
29
|
small: '40px',
|
|
29
30
|
medium: '48px',
|
|
30
31
|
large: '54px',
|
|
32
|
+
responsiveSmall: responsiveVal(30, 40),
|
|
33
|
+
responsiveMedium: responsiveVal(36, 48),
|
|
31
34
|
responsive: responsiveVal(40, 54),
|
|
32
35
|
}
|
|
33
36
|
|
|
@@ -43,6 +46,9 @@ export const useFabSize = (size: FabSize) => {
|
|
|
43
46
|
declare module '@mui/material/Fab/Fab' {
|
|
44
47
|
interface FabPropsSizeOverrides {
|
|
45
48
|
responsive: true
|
|
49
|
+
responsiveSmall: true
|
|
50
|
+
responsiveMedium: true
|
|
51
|
+
smaller: true
|
|
46
52
|
}
|
|
47
53
|
// todo: Wait for the color prop to be exendable and then add inverted
|
|
48
54
|
// https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Fab/Fab.js#L193-L202
|
|
@@ -60,7 +66,15 @@ function fabWidthHeight(size: FabSize, theme: Theme) {
|
|
|
60
66
|
|
|
61
67
|
type FabVariants = NonNullable<ComponentsVariants['MuiFab']>
|
|
62
68
|
|
|
63
|
-
const sizes: FabSize[] = [
|
|
69
|
+
const sizes: FabSize[] = [
|
|
70
|
+
'smaller',
|
|
71
|
+
'small',
|
|
72
|
+
'medium',
|
|
73
|
+
'large',
|
|
74
|
+
'responsive',
|
|
75
|
+
'responsiveSmall',
|
|
76
|
+
'responsiveMedium',
|
|
77
|
+
]
|
|
64
78
|
|
|
65
79
|
/**
|
|
66
80
|
* This defines the sizes for the added responsive variant.
|
|
@@ -5,6 +5,13 @@ export type DateTimeFormatProps = Intl.DateTimeFormatOptions
|
|
|
5
5
|
|
|
6
6
|
export function useDateTimeFormat(props?: DateTimeFormatProps) {
|
|
7
7
|
const { locale } = useRouter()
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
// Remove optional dialect from locale, which Intl.NumberFormat does not support.
|
|
10
|
+
const strippedLocale = locale?.split('-', 2).join('-')
|
|
11
|
+
|
|
12
|
+
const formatter = useMemo(
|
|
13
|
+
() => new Intl.DateTimeFormat(strippedLocale, props),
|
|
14
|
+
[strippedLocale, props],
|
|
15
|
+
)
|
|
9
16
|
return formatter
|
|
10
17
|
}
|
package/hooks/useNumberFormat.ts
CHANGED
|
@@ -5,6 +5,13 @@ export type NumberFormatProps = Intl.NumberFormatOptions
|
|
|
5
5
|
|
|
6
6
|
export function useNumberFormat(props?: NumberFormatProps) {
|
|
7
7
|
const { locale } = useRouter()
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
// Remove optional dialect from locale, which Intl.NumberFormat does not support.
|
|
10
|
+
const strippedLocale = locale?.split('-', 2).join('-')
|
|
11
|
+
|
|
12
|
+
const formatter = useMemo(
|
|
13
|
+
() => new Intl.NumberFormat(strippedLocale, props),
|
|
14
|
+
[strippedLocale, props],
|
|
15
|
+
)
|
|
9
16
|
return formatter
|
|
10
17
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/next-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "7.0.0
|
|
5
|
+
"version": "7.0.0",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -14,29 +14,30 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@emotion/cache": "^11.
|
|
18
|
-
"@emotion/react": "^11.
|
|
19
|
-
"@emotion/server": "^11.
|
|
20
|
-
"@emotion/styled": "^11.
|
|
21
|
-
"@graphcommerce/framer-next-pages": "7.0.0
|
|
22
|
-
"@graphcommerce/framer-scroller": "7.0.0
|
|
23
|
-
"@graphcommerce/framer-utils": "7.0.0
|
|
24
|
-
"@graphcommerce/image": "7.0.0
|
|
17
|
+
"@emotion/cache": "^11.11.0",
|
|
18
|
+
"@emotion/react": "^11.11.1",
|
|
19
|
+
"@emotion/server": "^11.11.0",
|
|
20
|
+
"@emotion/styled": "^11.11.0",
|
|
21
|
+
"@graphcommerce/framer-next-pages": "7.0.0",
|
|
22
|
+
"@graphcommerce/framer-scroller": "7.0.0",
|
|
23
|
+
"@graphcommerce/framer-utils": "7.0.0",
|
|
24
|
+
"@graphcommerce/image": "7.0.0",
|
|
25
25
|
"cookie": "^0.5.0",
|
|
26
26
|
"react-is": "^18.2.0",
|
|
27
27
|
"schema-dts": "^1.1.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@graphcommerce/eslint-config-pwa": "7.0.0
|
|
31
|
-
"@graphcommerce/prettier-config-pwa": "7.0.0
|
|
32
|
-
"@graphcommerce/typescript-config-pwa": "7.0.0
|
|
30
|
+
"@graphcommerce/eslint-config-pwa": "7.0.0",
|
|
31
|
+
"@graphcommerce/prettier-config-pwa": "7.0.0",
|
|
32
|
+
"@graphcommerce/typescript-config-pwa": "7.0.0",
|
|
33
33
|
"@types/cookie": "^0.5.1",
|
|
34
|
-
"@types/react-is": "^
|
|
35
|
-
"typescript": "
|
|
34
|
+
"@types/react-is": "^18.2.1",
|
|
35
|
+
"typescript": "5.1.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@lingui/core": "^
|
|
39
|
-
"@lingui/react": "^
|
|
38
|
+
"@lingui/core": "^4.2.1",
|
|
39
|
+
"@lingui/react": "^4.2.1",
|
|
40
|
+
"@lingui/macro": "^4.2.1",
|
|
40
41
|
"@mui/lab": "^5.0.0-alpha.68",
|
|
41
42
|
"@mui/material": "^5.10.16",
|
|
42
43
|
"framer-motion": "^10.0.0",
|