@graphcommerce/next-ui 9.0.4-canary.0 → 9.0.4-canary.10
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 +117 -126
- package/ActionCard/ActionCardAccordion.tsx +5 -4
- package/ActionCard/ActionCardList.tsx +1 -1
- package/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/Breadcrumbs/BreadcrumbsList.tsx +1 -1
- package/CHANGELOG.md +28 -8
- package/ChipMenu/ChipMenu.tsx +1 -1
- package/Container/Container.tsx +5 -2
- package/Form/FormHeader.tsx +1 -1
- package/Form/InputCheckmark.tsx +1 -1
- package/FramerScroller/ItemScroller.tsx +1 -1
- package/Intl/RelativeTimeFormat/RelativeTimeFormat.tsx +1 -3
- package/Intl/RelativeTimeFormat/RelativeToTimeFormat.tsx +3 -5
- package/Intl/useIntlLocalesArgument.ts +1 -3
- package/Layout/components/LayoutHeaderBack.tsx +2 -4
- package/Layout/components/LayoutHeaderClose.tsx +1 -1
- package/Layout/components/LayoutHeaderContent.tsx +4 -2
- package/LayoutDefault/components/LayoutDefault.tsx +2 -1
- package/LayoutParts/DesktopNavBar.tsx +1 -1
- package/MediaQuery/MediaQuery.tsx +5 -3
- package/Navigation/components/NavigationFab.tsx +1 -1
- package/Navigation/components/NavigationItem.tsx +3 -3
- package/Navigation/components/NavigationOverlay.tsx +2 -2
- package/Navigation/components/NavigationProvider.tsx +1 -3
- package/OverlayOrPopperChip/OverlayOrPopperChip.tsx +2 -2
- package/OverlayOrPopperChip/OverlayPanelActions.tsx +1 -1
- package/OverlayOrPopperChip/PopperPanelActions.tsx +1 -1
- package/Page/types.ts +1 -1
- package/Pagination/Pagination.tsx +1 -1
- package/Pagination/PaginationExtended.tsx +1 -1
- package/Row/ButtonLinkList/ButtonLinkListItem.tsx +1 -1
- package/Row/RowLinks/RowLinks.tsx +0 -1
- package/Snackbar/MessageSnackbarImpl.tsx +4 -6
- package/StarRatingField/StarRatingField.tsx +1 -1
- package/Styles/createEmotionCache.ts +3 -1
- package/Styles/withEmotionCache.tsx +1 -1
- package/TextInputNumber/TextInputNumber.tsx +2 -4
- package/Theme/NextLink.tsx +5 -5
- package/Theme/createTheme.ts +1 -1
- package/Theme/themeDefaults.ts +10 -0
- package/ToggleButton/ToggleButton.tsx +1 -1
- package/hooks/memoDeep.ts +2 -1
- package/hooks/useIsSsr.ts +1 -3
- package/package.json +8 -8
- package/utils/cssFlags.tsx +2 -2
- package/utils/normalizeLocale.ts +6 -7
- package/utils/robots.ts +2 -2
- package/utils/sxx.ts +4 -2
@@ -3,6 +3,7 @@ import { alpha, Box, ButtonBase, lighten } from '@mui/material'
|
|
3
3
|
import React from 'react'
|
4
4
|
import { extendableComponent, responsiveVal } from '../Styles'
|
5
5
|
import { breakpointVal } from '../Styles/breakpointVal'
|
6
|
+
import { sxx } from '../utils/sxx'
|
6
7
|
|
7
8
|
type Variants = 'outlined' | 'default'
|
8
9
|
type Size = 'large' | 'medium' | 'small' | 'responsive'
|
@@ -94,11 +95,6 @@ export const actionCardImageSizes = {
|
|
94
95
|
responsive: responsiveVal(60, 120),
|
95
96
|
}
|
96
97
|
|
97
|
-
const combineSx = (defaultSx: SxProps<Theme>, slotSx?: SxProps<Theme>) => [
|
98
|
-
...(Array.isArray(defaultSx) ? defaultSx : [defaultSx]),
|
99
|
-
...(Array.isArray(slotSx) ? slotSx : [slotSx]),
|
100
|
-
]
|
101
|
-
|
102
98
|
/** @public */
|
103
99
|
export function ActionCard<C extends React.ElementType = typeof Box>(props: ActionCardProps<C>) {
|
104
100
|
const {
|
@@ -140,126 +136,124 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
140
136
|
className={classes.root}
|
141
137
|
onClick={onClick ? (event) => onClick(event, value) : undefined}
|
142
138
|
disabled={disabled}
|
143
|
-
sx={
|
144
|
-
|
145
|
-
(
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
139
|
+
sx={sxx(
|
140
|
+
(theme) => ({
|
141
|
+
...breakpointVal(
|
142
|
+
'borderRadius',
|
143
|
+
theme.shape.borderRadius * 1.5,
|
144
|
+
theme.shape.borderRadius * 3,
|
145
|
+
theme.breakpoints.values,
|
146
|
+
),
|
147
|
+
'&.sizeSmall': {
|
148
|
+
px: responsiveVal(8, 12),
|
149
|
+
py: responsiveVal(4, 6),
|
150
|
+
display: 'flex',
|
151
|
+
typography: 'body2',
|
152
|
+
},
|
153
|
+
'&.sizeMedium': {
|
154
|
+
px: responsiveVal(10, 14),
|
155
|
+
py: responsiveVal(10, 12),
|
156
|
+
typography: 'body2',
|
157
|
+
display: 'block',
|
158
|
+
},
|
159
|
+
'&.sizeLarge': {
|
160
|
+
px: responsiveVal(12, 16),
|
161
|
+
py: responsiveVal(12, 14),
|
162
|
+
display: 'block',
|
163
|
+
},
|
164
|
+
'&.sizeResponsive': {
|
165
|
+
px: responsiveVal(8, 16),
|
166
|
+
py: responsiveVal(4, 14),
|
167
|
+
display: { xs: 'flex', md: 'block', lg: 'block' },
|
168
|
+
[theme.breakpoints.down('md')]: { typography: 'body2' },
|
169
|
+
},
|
170
|
+
'&.variantDefault': {
|
171
|
+
position: 'relative',
|
172
|
+
'&.selected': {
|
173
|
+
backgroundColor:
|
174
|
+
theme.palette.mode === 'light'
|
175
|
+
? alpha(theme.palette[color].main, theme.palette.action.hoverOpacity)
|
176
|
+
: lighten(theme.palette.background.default, theme.palette.action.hoverOpacity),
|
157
177
|
},
|
158
|
-
'&.
|
159
|
-
|
160
|
-
py: responsiveVal(10, 12),
|
161
|
-
typography: 'body2',
|
162
|
-
display: 'block',
|
178
|
+
'&.error': {
|
179
|
+
backgroundColor: alpha(theme.palette.error.main, theme.palette.action.hoverOpacity),
|
163
180
|
},
|
164
|
-
'
|
165
|
-
|
166
|
-
|
167
|
-
display: 'block',
|
181
|
+
'&:focus': {
|
182
|
+
outline: 'none',
|
183
|
+
boxShadow: `0 0 0 4px ${alpha(theme.palette[color].main, theme.palette.action.focusOpacity)}`,
|
168
184
|
},
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
185
|
+
},
|
186
|
+
'&.variantOutlined': {
|
187
|
+
backgroundColor: theme.palette.background.paper,
|
188
|
+
boxShadow: `inset 0 0 0 1px ${theme.palette.divider}`,
|
189
|
+
'&:not(:last-of-type)': {
|
190
|
+
marginBottom: '-2px',
|
174
191
|
},
|
175
|
-
'&.
|
176
|
-
|
177
|
-
'
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
192
|
+
'&.layoutList': {
|
193
|
+
borderRadius: 0,
|
194
|
+
'&:first-of-type': {
|
195
|
+
...breakpointVal(
|
196
|
+
'borderTopLeftRadius',
|
197
|
+
theme.shape.borderRadius * 3,
|
198
|
+
theme.shape.borderRadius * 4,
|
199
|
+
theme.breakpoints.values,
|
200
|
+
),
|
201
|
+
...breakpointVal(
|
202
|
+
'borderTopRightRadius',
|
203
|
+
theme.shape.borderRadius * 3,
|
204
|
+
theme.shape.borderRadius * 4,
|
205
|
+
theme.breakpoints.values,
|
206
|
+
),
|
185
207
|
},
|
186
|
-
'&:
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
'&:first-of-type': {
|
200
|
-
...breakpointVal(
|
201
|
-
'borderTopLeftRadius',
|
202
|
-
theme.shape.borderRadius * 3,
|
203
|
-
theme.shape.borderRadius * 4,
|
204
|
-
theme.breakpoints.values,
|
205
|
-
),
|
206
|
-
...breakpointVal(
|
207
|
-
'borderTopRightRadius',
|
208
|
-
theme.shape.borderRadius * 3,
|
209
|
-
theme.shape.borderRadius * 4,
|
210
|
-
theme.breakpoints.values,
|
211
|
-
),
|
212
|
-
},
|
213
|
-
'&:last-of-type': {
|
214
|
-
...breakpointVal(
|
215
|
-
'borderBottomLeftRadius',
|
216
|
-
theme.shape.borderRadius * 3,
|
217
|
-
theme.shape.borderRadius * 4,
|
218
|
-
theme.breakpoints.values,
|
219
|
-
),
|
220
|
-
...breakpointVal(
|
221
|
-
'borderBottomRightRadius',
|
222
|
-
theme.shape.borderRadius * 3,
|
223
|
-
theme.shape.borderRadius * 4,
|
224
|
-
theme.breakpoints.values,
|
225
|
-
),
|
226
|
-
},
|
227
|
-
},
|
228
|
-
'&.selected': {
|
229
|
-
borderColor: 'transparent',
|
230
|
-
boxShadow: `inset 0 0 0 2px ${theme.palette[color].main}`,
|
231
|
-
},
|
232
|
-
'&.selected:focus, &.error:focus': {
|
233
|
-
borderColor: 'transparent',
|
234
|
-
boxShadow: `inset 0 0 0 2px ${theme.palette[color].main}, 0 0 0 4px ${alpha(
|
235
|
-
theme.palette[color].main,
|
236
|
-
theme.palette.action.hoverOpacity,
|
237
|
-
)}`,
|
238
|
-
},
|
239
|
-
'&:focus': {
|
240
|
-
boxShadow: `inset 0 0 0 1px ${theme.palette.divider},0 0 0 4px ${alpha(
|
241
|
-
theme.palette[color].main,
|
242
|
-
theme.palette.action.hoverOpacity,
|
243
|
-
)}`,
|
244
|
-
},
|
245
|
-
'&.error': {
|
246
|
-
boxShadow: `inset 0 0 0 2px ${theme.palette.error.main}`,
|
208
|
+
'&:last-of-type': {
|
209
|
+
...breakpointVal(
|
210
|
+
'borderBottomLeftRadius',
|
211
|
+
theme.shape.borderRadius * 3,
|
212
|
+
theme.shape.borderRadius * 4,
|
213
|
+
theme.breakpoints.values,
|
214
|
+
),
|
215
|
+
...breakpointVal(
|
216
|
+
'borderBottomRightRadius',
|
217
|
+
theme.shape.borderRadius * 3,
|
218
|
+
theme.shape.borderRadius * 4,
|
219
|
+
theme.breakpoints.values,
|
220
|
+
),
|
247
221
|
},
|
248
222
|
},
|
249
223
|
'&.selected': {
|
250
|
-
|
224
|
+
borderColor: 'transparent',
|
225
|
+
boxShadow: `inset 0 0 0 2px ${theme.palette[color].main}`,
|
251
226
|
},
|
252
|
-
'
|
253
|
-
|
227
|
+
'&.selected:focus, &.error:focus': {
|
228
|
+
borderColor: 'transparent',
|
229
|
+
boxShadow: `inset 0 0 0 2px ${theme.palette[color].main}, 0 0 0 4px ${alpha(
|
230
|
+
theme.palette[color].main,
|
231
|
+
theme.palette.action.hoverOpacity,
|
232
|
+
)}`,
|
254
233
|
},
|
255
|
-
'
|
256
|
-
|
257
|
-
|
258
|
-
|
234
|
+
'&:focus': {
|
235
|
+
boxShadow: `inset 0 0 0 1px ${theme.palette.divider},0 0 0 4px ${alpha(
|
236
|
+
theme.palette[color].main,
|
237
|
+
theme.palette.action.hoverOpacity,
|
238
|
+
)}`,
|
259
239
|
},
|
260
|
-
|
261
|
-
|
262
|
-
|
240
|
+
'&.error': {
|
241
|
+
boxShadow: `inset 0 0 0 2px ${theme.palette.error.main}`,
|
242
|
+
},
|
243
|
+
},
|
244
|
+
'&.selected': {
|
245
|
+
zIndex: 1,
|
246
|
+
},
|
247
|
+
'&:focus, &.selected:focus, &.error:focus': {
|
248
|
+
zIndex: 2,
|
249
|
+
},
|
250
|
+
'&.disabled': {
|
251
|
+
background: theme.palette.action.disabledBackground,
|
252
|
+
opacity: theme.palette.action.disabledOpacity,
|
253
|
+
color: theme.palette.action.disabled,
|
254
|
+
},
|
255
|
+
}),
|
256
|
+
sx,
|
263
257
|
slotProps.root?.sx,
|
264
258
|
)}
|
265
259
|
{...slotProps.root}
|
@@ -267,7 +261,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
267
261
|
>
|
268
262
|
<Box
|
269
263
|
className={classes.rootInner}
|
270
|
-
sx={
|
264
|
+
sx={sxx(
|
271
265
|
{
|
272
266
|
display: 'flex',
|
273
267
|
flexDirection: 'row',
|
@@ -291,10 +285,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
291
285
|
{image && (
|
292
286
|
<Box
|
293
287
|
className={classes.image}
|
294
|
-
sx={
|
295
|
-
{ display: 'flex', pr: '15px', alignSelf: 'center' },
|
296
|
-
slotProps.image?.sx,
|
297
|
-
)}
|
288
|
+
sx={sxx({ display: 'flex', pr: '15px', alignSelf: 'center' }, slotProps.image?.sx)}
|
298
289
|
{...slotProps.image}
|
299
290
|
>
|
300
291
|
{image}
|
@@ -310,7 +301,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
310
301
|
{title && (
|
311
302
|
<Box
|
312
303
|
className={classes.title}
|
313
|
-
sx={
|
304
|
+
sx={sxx(
|
314
305
|
{
|
315
306
|
'&.sizeSmall': { typography: 'body1' },
|
316
307
|
'&.sizeMedium': { typography: 'body1' },
|
@@ -327,7 +318,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
327
318
|
{details && (
|
328
319
|
<Box
|
329
320
|
className={classes.details}
|
330
|
-
sx={
|
321
|
+
sx={sxx({ color: 'text.secondary' }, slotProps.details?.sx)}
|
331
322
|
{...slotProps.details}
|
332
323
|
>
|
333
324
|
{details}
|
@@ -336,7 +327,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
336
327
|
{secondaryAction && (
|
337
328
|
<Box
|
338
329
|
className={classes.secondaryAction}
|
339
|
-
sx={
|
330
|
+
sx={sxx({}, slotProps.secondaryAction?.sx)}
|
340
331
|
{...slotProps.secondaryAction}
|
341
332
|
>
|
342
333
|
{secondaryAction}
|
@@ -346,7 +337,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
346
337
|
</Box>
|
347
338
|
<Box
|
348
339
|
className={classes.end}
|
349
|
-
sx={
|
340
|
+
sx={sxx(
|
350
341
|
{
|
351
342
|
display: 'flex',
|
352
343
|
flexDirection: 'column',
|
@@ -360,7 +351,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
360
351
|
{action && (
|
361
352
|
<Box
|
362
353
|
className={classes.action}
|
363
|
-
sx={
|
354
|
+
sx={sxx(
|
364
355
|
(theme) => ({ marginBottom: '5px', color: theme.palette[color].main }),
|
365
356
|
slotProps.action?.sx,
|
366
357
|
)}
|
@@ -372,7 +363,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
372
363
|
{price && !disabled && (
|
373
364
|
<Box
|
374
365
|
className={classes.price}
|
375
|
-
sx={
|
366
|
+
sx={sxx(
|
376
367
|
{
|
377
368
|
textAlign: 'right',
|
378
369
|
typography: 'body1',
|
@@ -390,7 +381,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
390
381
|
</Box>
|
391
382
|
</Box>
|
392
383
|
{after && (
|
393
|
-
<Box className={classes.after} sx={
|
384
|
+
<Box className={classes.after} sx={sxx({}, slotProps.after?.sx)} {...slotProps.after}>
|
394
385
|
{after}
|
395
386
|
</Box>
|
396
387
|
)}
|
@@ -2,8 +2,9 @@ import type { SxProps, Theme } from '@mui/material'
|
|
2
2
|
import { Accordion, AccordionDetails, AccordionSummary } from '@mui/material'
|
3
3
|
import type { ReactNode } from 'react'
|
4
4
|
import { useState } from 'react'
|
5
|
-
import { IconSvg } from '../IconSvg'
|
6
5
|
import { iconChevronDown } from '../icons'
|
6
|
+
import { IconSvg } from '../IconSvg'
|
7
|
+
import { sxx } from '../utils/sxx'
|
7
8
|
|
8
9
|
export type ActionCardAccordionProps = {
|
9
10
|
summary: ReactNode
|
@@ -25,7 +26,7 @@ export function ActionCardAccordion(props: ActionCardAccordionProps) {
|
|
25
26
|
expanded={expanded}
|
26
27
|
variant='outlined'
|
27
28
|
disableGutters
|
28
|
-
sx={
|
29
|
+
sx={sxx(
|
29
30
|
(theme) => ({
|
30
31
|
backgroundColor: 'transparent ',
|
31
32
|
'&.Mui-expanded': { my: 0 },
|
@@ -34,8 +35,8 @@ export function ActionCardAccordion(props: ActionCardAccordionProps) {
|
|
34
35
|
borderBottom: `1px solid ${theme.palette.divider}`,
|
35
36
|
'&:not(.Mui-expanded)': { borderBottom: `1px solid ${theme.palette.divider}` },
|
36
37
|
}),
|
37
|
-
|
38
|
-
|
38
|
+
sx,
|
39
|
+
)}
|
39
40
|
>
|
40
41
|
<AccordionSummary
|
41
42
|
onClick={(e) => e.preventDefault()}
|
@@ -4,9 +4,9 @@ import { Alert } from '@mui/material'
|
|
4
4
|
import React from 'react'
|
5
5
|
import { isFragment } from 'react-is'
|
6
6
|
import { Button } from '../Button'
|
7
|
+
import { iconChevronDown } from '../icons'
|
7
8
|
import { IconSvg } from '../IconSvg'
|
8
9
|
import { extendableComponent } from '../Styles'
|
9
|
-
import { iconChevronDown } from '../icons'
|
10
10
|
import type { ActionCardProps } from './ActionCard'
|
11
11
|
import { ActionCardLayout } from './ActionCardLayout'
|
12
12
|
|
@@ -19,8 +19,8 @@ import dynamic from 'next/dynamic'
|
|
19
19
|
import type { MouseEvent } from 'react'
|
20
20
|
import { useState } from 'react'
|
21
21
|
import { Button } from '../Button'
|
22
|
-
import { IconSvg } from '../IconSvg'
|
23
22
|
import { iconClose, iconEllypsis } from '../icons'
|
23
|
+
import { IconSvg } from '../IconSvg'
|
24
24
|
import type { BreadcrumbsType } from './types'
|
25
25
|
|
26
26
|
const BreadcrumbsPopper = dynamic(
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Trans } from '@lingui/react'
|
2
|
-
import { Box, Link,
|
2
|
+
import { alpha, Box, Link, useTheme } from '@mui/material'
|
3
3
|
import type { KeyboardEvent } from 'react'
|
4
4
|
import { useEffect, useRef } from 'react'
|
5
5
|
import type { BreadcrumbsType } from './types'
|
package/CHANGELOG.md
CHANGED
@@ -1,22 +1,42 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## 9.0.4-canary.
|
3
|
+
## 9.0.4-canary.10
|
4
4
|
|
5
|
-
## 9.0.
|
5
|
+
## 9.0.4-canary.9
|
6
6
|
|
7
|
-
## 9.0.
|
7
|
+
## 9.0.4-canary.8
|
8
8
|
|
9
|
-
## 9.0.
|
9
|
+
## 9.0.4-canary.7
|
10
10
|
|
11
|
-
## 9.0.
|
11
|
+
## 9.0.4-canary.6
|
12
12
|
|
13
|
-
|
13
|
+
### Patch Changes
|
14
|
+
|
15
|
+
- [#2478](https://github.com/graphcommerce-org/graphcommerce/pull/2478) [`32bccbb`](https://github.com/graphcommerce-org/graphcommerce/commit/32bccbba4b000247d7e01e487f6d48b6dec07fb5) - Nesting multiple Containers will not increase the padding, will only be applied once. ([@paales](https://github.com/paales))
|
16
|
+
|
17
|
+
## 9.0.4-canary.5
|
18
|
+
|
19
|
+
## 9.0.4-canary.4
|
20
|
+
|
21
|
+
## 9.0.4-canary.3
|
22
|
+
|
23
|
+
## 9.0.4-canary.2
|
14
24
|
|
15
25
|
### Patch Changes
|
16
26
|
|
17
|
-
- [#
|
27
|
+
- [#2473](https://github.com/graphcommerce-org/graphcommerce/pull/2473) [`8df172e`](https://github.com/graphcommerce-org/graphcommerce/commit/8df172e4fa1364892d53bc96a437d037d245de35) - Do not warn about `:first-child` since all css is hoisted out of the components. ([@paales](https://github.com/paales))
|
18
28
|
|
19
|
-
|
29
|
+
- [#2473](https://github.com/graphcommerce-org/graphcommerce/pull/2473) [`b076b2a`](https://github.com/graphcommerce-org/graphcommerce/commit/b076b2ae4881bebf1d2debd5333a83f220c26ca7) - Also accept false as value for sxx ([@paales](https://github.com/paales))
|
30
|
+
|
31
|
+
## 9.0.4-canary.1
|
32
|
+
|
33
|
+
### Patch Changes
|
34
|
+
|
35
|
+
- [#2470](https://github.com/graphcommerce-org/graphcommerce/pull/2470) [`8f047a0`](https://github.com/graphcommerce-org/graphcommerce/commit/8f047a0860f9b915717f6db52be64805094d0b09) - Modify the type that is exposed for createTheme, should be faster for TypeScript to check. ([@paales](https://github.com/paales))
|
36
|
+
|
37
|
+
## 9.0.4-canary.0
|
38
|
+
|
39
|
+
## 9.0.1
|
20
40
|
|
21
41
|
### Patch Changes
|
22
42
|
|
package/ChipMenu/ChipMenu.tsx
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
import type { ChipProps, MenuProps, SxProps, Theme } from '@mui/material'
|
2
2
|
import { Chip, Menu, menuClasses } from '@mui/material'
|
3
3
|
import React, { useState } from 'react'
|
4
|
+
import { iconCancelAlt, iconChevronDown, iconChevronUp } from '../icons'
|
4
5
|
import { IconSvg } from '../IconSvg'
|
5
6
|
import { SectionHeader } from '../SectionHeader/SectionHeader'
|
6
7
|
import { responsiveVal } from '../Styles/responsiveVal'
|
7
|
-
import { iconCancelAlt, iconChevronDown, iconChevronUp } from '../icons'
|
8
8
|
|
9
9
|
export type ChipMenuProps = Omit<ChipProps<'button'>, 'children' | 'component'> & {
|
10
10
|
selectedLabel?: React.ReactNode
|
package/Container/Container.tsx
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { Box, useTheme } from '@mui/material'
|
2
2
|
import type { ContainerProps } from '@mui/material'
|
3
|
-
import clsx from 'clsx'
|
4
3
|
import React from 'react'
|
5
4
|
import type { LiteralUnion } from 'type-fest'
|
6
5
|
import { extendableComponent } from '../Styles/extendableComponent'
|
@@ -74,13 +73,17 @@ export const Container = React.forwardRef(
|
|
74
73
|
<Box
|
75
74
|
{...rest}
|
76
75
|
ref={ref}
|
77
|
-
className={
|
76
|
+
className={[className, classes.root].filter((v) => !!v).join(' ')}
|
78
77
|
sx={[
|
79
78
|
{
|
79
|
+
width: '100%',
|
80
80
|
pl: !breakoutLeft ? padding : undefined,
|
81
81
|
pr: !breakoutRight ? padding : undefined,
|
82
82
|
'&.breakoutLeft': { pl: 'unset' },
|
83
83
|
'&.breakoutRight': { pr: 'unset' },
|
84
|
+
|
85
|
+
// Nesting containers will not have padding applied.
|
86
|
+
'.MuiContainer-root &': { pl: 0, pr: 0 },
|
84
87
|
},
|
85
88
|
...(Array.isArray(sx) ? sx : [sx]),
|
86
89
|
]}
|
package/Form/FormHeader.tsx
CHANGED
package/Form/InputCheckmark.tsx
CHANGED
@@ -2,10 +2,10 @@ import type { ScrollerButtonProps } from '@graphcommerce/framer-scroller'
|
|
2
2
|
import { Scroller, ScrollerButton, ScrollerProvider } from '@graphcommerce/framer-scroller'
|
3
3
|
import type { SxProps, Theme } from '@mui/material'
|
4
4
|
import { Box } from '@mui/material'
|
5
|
+
import { iconChevronLeft, iconChevronRight } from '../icons'
|
5
6
|
import { IconSvg } from '../IconSvg'
|
6
7
|
import { extendableComponent, responsiveVal } from '../Styles'
|
7
8
|
import { useFabSize } from '../Theme'
|
8
|
-
import { iconChevronLeft, iconChevronRight } from '../icons'
|
9
9
|
|
10
10
|
const { classes } = extendableComponent('ItemScroller', [
|
11
11
|
'root',
|
@@ -8,9 +8,7 @@ export type RelativeTimeFormatProps = {
|
|
8
8
|
unit?: Intl.RelativeTimeFormatUnit
|
9
9
|
} & UseIntlRelativeTimeFormatOptions
|
10
10
|
|
11
|
-
/**
|
12
|
-
* Alternative: {@link file://./RelativeToTimeFormat.tsx}
|
13
|
-
*/
|
11
|
+
/** Alternative: {@link file://./RelativeToTimeFormat.tsx} */
|
14
12
|
export const RelativeTimeFormat = forwardRef<HTMLSpanElement, RelativeTimeFormatProps>(
|
15
13
|
(props, ref) => {
|
16
14
|
const { children, unit, locale, localeMatcher, numeric, styleFormat, ...rest } = props
|
@@ -5,13 +5,11 @@ import type { RelativeTimeFormatProps } from './RelativeTimeFormat'
|
|
5
5
|
import { RelativeTimeFormat } from './RelativeTimeFormat'
|
6
6
|
|
7
7
|
type RelativeToTimeFormatProps = Omit<RelativeTimeFormatProps, 'children'> & {
|
8
|
-
/**
|
9
|
-
* Date to format a relative value for.
|
10
|
-
*/
|
8
|
+
/** Date to format a relative value for. */
|
11
9
|
children: DateValue
|
12
10
|
/**
|
13
|
-
* If provided, the component will format a relative value to this date.
|
14
|
-
*
|
11
|
+
* If provided, the component will format a relative value to this date. Else, it will format a
|
12
|
+
* relative value to the current date.
|
15
13
|
*/
|
16
14
|
to?: DateValue
|
17
15
|
}
|
@@ -10,14 +10,12 @@ import { Box } from '@mui/material'
|
|
10
10
|
import { useRouter } from 'next/router'
|
11
11
|
import type { LinkOrButtonProps } from '../../Button/LinkOrButton'
|
12
12
|
import { LinkOrButton } from '../../Button/LinkOrButton'
|
13
|
+
import { iconChevronLeft } from '../../icons'
|
13
14
|
import { IconSvg } from '../../IconSvg'
|
14
15
|
import { responsiveVal } from '../../Styles'
|
15
|
-
import { iconChevronLeft } from '../../icons'
|
16
16
|
|
17
17
|
export type BackProps = Omit<LinkOrButtonProps, 'onClick' | 'children'> & {
|
18
|
-
/**
|
19
|
-
* Will not use `router.back()` if available, and will always use the `up.href`
|
20
|
-
*/
|
18
|
+
/** Will not use `router.back()` if available, and will always use the `up.href` */
|
21
19
|
disableBackNavigation?: boolean
|
22
20
|
}
|
23
21
|
|
@@ -2,9 +2,9 @@ import { useGo, usePageContext } from '@graphcommerce/framer-next-pages'
|
|
2
2
|
import { i18n } from '@lingui/core'
|
3
3
|
import { Fab } from '@mui/material'
|
4
4
|
import { useState } from 'react'
|
5
|
+
import { iconClose } from '../../icons'
|
5
6
|
import { IconSvg, useIconSvgSize } from '../../IconSvg'
|
6
7
|
import { useFabSize } from '../../Theme'
|
7
|
-
import { iconClose } from '../../icons'
|
8
8
|
|
9
9
|
export type LayoutHeaderCloseProps = {
|
10
10
|
onClose?: () => void
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { useMotionValueValue } from '@graphcommerce/framer-utils'
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import type { SxProps, Theme } from '@mui/material'
|
3
|
+
import { Box, styled } from '@mui/material'
|
4
|
+
import type { LayoutProps } from 'framer-motion'
|
5
|
+
import { m } from 'framer-motion'
|
4
6
|
import React, { useRef } from 'react'
|
5
7
|
import { Container } from '../../Container/Container'
|
6
8
|
import { extendableComponent } from '../../Styles'
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { useScrollOffset } from '@graphcommerce/framer-next-pages'
|
2
2
|
import { dvh } from '@graphcommerce/framer-utils'
|
3
|
-
import {
|
3
|
+
import type { SxProps, Theme } from '@mui/material'
|
4
|
+
import { Box } from '@mui/material'
|
4
5
|
import { useScroll, useTransform } from 'framer-motion'
|
5
6
|
import { Container } from '../../Container/Container'
|
6
7
|
import { LayoutProvider } from '../../Layout/components/LayoutProvider'
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { Scroller, ScrollerButton, ScrollerProvider } from '@graphcommerce/framer-scroller'
|
2
2
|
import type { BoxProps } from '@mui/material'
|
3
3
|
import React from 'react'
|
4
|
+
import { iconChevronLeft, iconChevronRight } from '../icons'
|
4
5
|
import type { IconSvgProps } from '../IconSvg'
|
5
6
|
import { IconSvg } from '../IconSvg'
|
6
7
|
import { MediaQuery } from '../MediaQuery'
|
7
8
|
import { extendableComponent } from '../Styles/extendableComponent'
|
8
|
-
import { iconChevronLeft, iconChevronRight } from '../icons'
|
9
9
|
|
10
10
|
export type MenuTabsProps = {
|
11
11
|
children: React.ReactNode
|
@@ -57,9 +57,7 @@ export type MediaQueryProps<C extends React.ElementType = 'div'> = BoxProps<C> &
|
|
57
57
|
* hydrates the component if the query matches. If it doesn't match, it will NOT render the
|
58
58
|
* component (and thus not execute the JS).
|
59
59
|
*/
|
60
|
-
|
61
|
-
props: MediaQueryProps<Component>,
|
62
|
-
) {
|
60
|
+
function MediaQueryBase(props: MediaQueryProps) {
|
63
61
|
const { query, sx, children, display = 'contents', ...elementProps } = props
|
64
62
|
|
65
63
|
const theme = useTheme()
|
@@ -109,3 +107,7 @@ export function MediaQuery<Component extends React.ElementType = 'div'>(
|
|
109
107
|
/>
|
110
108
|
)
|
111
109
|
}
|
110
|
+
|
111
|
+
export const MediaQuery = MediaQueryBase as <C extends React.ElementType = 'div'>(
|
112
|
+
props: MediaQueryProps<C>,
|
113
|
+
) => React.ReactNode
|
@@ -4,12 +4,12 @@ import { Box, Fab, styled, useTheme } from '@mui/material'
|
|
4
4
|
import { m } from 'framer-motion'
|
5
5
|
import { useRouter } from 'next/router'
|
6
6
|
import React, { useEffect } from 'react'
|
7
|
+
import { iconClose, iconMenu } from '../../icons'
|
7
8
|
import { IconSvg } from '../../IconSvg'
|
8
9
|
import { useScrollY } from '../../Layout/hooks/useScrollY'
|
9
10
|
import { useFabAnimation } from '../../LayoutParts/useFabAnimation'
|
10
11
|
import { extendableComponent } from '../../Styles/extendableComponent'
|
11
12
|
import { useFabSize } from '../../Theme'
|
12
|
-
import { iconClose, iconMenu } from '../../icons'
|
13
13
|
|
14
14
|
const MotionDiv = styled(m.div)({})
|
15
15
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
2
2
|
import { useMotionValueValue } from '@graphcommerce/framer-utils'
|
3
|
-
import { Box, ListItemButton,
|
3
|
+
import { alpha, Box, ListItemButton, styled, useEventCallback } from '@mui/material'
|
4
4
|
import React from 'react'
|
5
|
+
import { useMatchMedia } from '../../hooks'
|
6
|
+
import { iconChevronRight } from '../../icons'
|
5
7
|
import { IconSvg } from '../../IconSvg'
|
6
8
|
import { extendableComponent } from '../../Styles/extendableComponent'
|
7
9
|
import { NextLink } from '../../Theme'
|
8
|
-
import { useMatchMedia } from '../../hooks'
|
9
|
-
import { iconChevronRight } from '../../icons'
|
10
10
|
import type { NavigationNode } from '../hooks/useNavigation'
|
11
11
|
import {
|
12
12
|
isNavigationButton,
|
@@ -5,14 +5,14 @@ import { Box, Fab, styled, useEventCallback, useTheme } from '@mui/material'
|
|
5
5
|
import { m } from 'framer-motion'
|
6
6
|
import React, { useEffect, useRef } from 'react'
|
7
7
|
import type { LiteralUnion } from 'type-fest'
|
8
|
+
import { useMatchMedia } from '../../hooks'
|
9
|
+
import { iconChevronLeft, iconClose } from '../../icons'
|
8
10
|
import { IconSvg, useIconSvgSize } from '../../IconSvg'
|
9
11
|
import { LayoutHeaderContent } from '../../Layout/components/LayoutHeaderContent'
|
10
12
|
import { LayoutTitle } from '../../Layout/components/LayoutTitle'
|
11
13
|
import { OverlaySsr } from '../../Overlay/components/OverlaySsr'
|
12
14
|
import { extendableComponent } from '../../Styles/extendableComponent'
|
13
15
|
import { useFabSize } from '../../Theme'
|
14
|
-
import { useMatchMedia } from '../../hooks'
|
15
|
-
import { iconChevronLeft, iconClose } from '../../icons'
|
16
16
|
import { useNavigation } from '../hooks/useNavigation'
|
17
17
|
import type { mouseEventPref } from './NavigationItem'
|
18
18
|
import { NavigationList } from './NavigationList'
|
@@ -15,9 +15,7 @@ import { NavigationContext, NavigationNodeType } from '../hooks/useNavigation'
|
|
15
15
|
export type NavigationProviderBaseProps = {
|
16
16
|
items: (NavigationNode | React.ReactElement)[]
|
17
17
|
hideRootOnNavigate?: boolean
|
18
|
-
/**
|
19
|
-
* @deprecated No longer used
|
20
|
-
*/
|
18
|
+
/** @deprecated No longer used */
|
21
19
|
closeAfterNavigate?: boolean
|
22
20
|
children?: React.ReactNode
|
23
21
|
animationDuration?: number
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { ChipProps, SxProps, Theme } from '@mui/material'
|
2
|
-
import { Badge, Chip,
|
2
|
+
import { Badge, Chip, lighten, Typography, useEventCallback } from '@mui/material'
|
3
3
|
import React, { useState } from 'react'
|
4
|
+
import { iconChevronDown, iconChevronUp } from '../icons'
|
4
5
|
import { IconSvg } from '../IconSvg'
|
5
6
|
import { responsiveVal } from '../Styles'
|
6
|
-
import { iconChevronDown, iconChevronUp } from '../icons'
|
7
7
|
import type { OverlayOrPopperPanelProps } from './OverlayOrPopperPanel'
|
8
8
|
import { OverlayOrPopperPanel } from './OverlayOrPopperPanel'
|
9
9
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { i18n } from '@lingui/core'
|
2
2
|
import { Trans } from '@lingui/react'
|
3
3
|
import { Box, Button, Fab, Typography } from '@mui/material'
|
4
|
+
import { iconClose } from '../icons'
|
4
5
|
import { IconSvg, useIconSvgSize } from '../IconSvg'
|
5
6
|
import { LayoutOverlayHeader } from '../LayoutOverlay'
|
6
7
|
import { OverlayStickyBottom } from '../Overlay/components/OverlayStickyBottom'
|
7
8
|
import { extendableComponent } from '../Styles'
|
8
9
|
import { useFabSize } from '../Theme'
|
9
|
-
import { iconClose } from '../icons'
|
10
10
|
import type { PanelActionsProps } from './types'
|
11
11
|
|
12
12
|
const { classes } = extendableComponent(
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { i18n } from '@lingui/core'
|
2
2
|
import { Trans } from '@lingui/react'
|
3
3
|
import { Box, Button, Fab, Typography } from '@mui/material'
|
4
|
+
import { iconClose } from '../icons'
|
4
5
|
import { IconSvg, useIconSvgSize } from '../IconSvg'
|
5
6
|
import { LayoutHeader } from '../Layout'
|
6
7
|
import { OverlayStickyBottom } from '../Overlay/components/OverlayStickyBottom'
|
7
8
|
import { useFabSize } from '../Theme'
|
8
|
-
import { iconClose } from '../icons'
|
9
9
|
import type { PanelActionsProps } from './types'
|
10
10
|
|
11
11
|
export function PopperPanelActions(props: PanelActionsProps) {
|
package/Page/types.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { ParsedUrlQuery } from 'querystring'
|
1
2
|
import type { UpPage } from '@graphcommerce/framer-next-pages/types'
|
2
3
|
// todo: remove references to GraphQL
|
3
4
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
@@ -6,7 +7,6 @@ import type {
|
|
6
7
|
GetServerSideProps as GetServerSidePropsNext,
|
7
8
|
GetStaticProps as GetStaticPropsNext,
|
8
9
|
} from 'next'
|
9
|
-
import type { ParsedUrlQuery } from 'querystring'
|
10
10
|
|
11
11
|
type AnyObj = Record<string, unknown>
|
12
12
|
|
@@ -4,9 +4,9 @@ import { Box, IconButton } from '@mui/material'
|
|
4
4
|
import type { UsePaginationItem } from '@mui/material/usePagination'
|
5
5
|
import usePagination from '@mui/material/usePagination'
|
6
6
|
import React from 'react'
|
7
|
+
import { iconChevronLeft, iconChevronRight } from '../icons'
|
7
8
|
import { IconSvg } from '../IconSvg'
|
8
9
|
import { extendableComponent } from '../Styles'
|
9
|
-
import { iconChevronLeft, iconChevronRight } from '../icons'
|
10
10
|
|
11
11
|
export type PagePaginationProps = {
|
12
12
|
count: number
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { PaginationProps, PaginationRenderItemParams, SxProps, Theme } from '@mui/material'
|
2
2
|
import { Box, Pagination, PaginationItem } from '@mui/material'
|
3
|
+
import { iconChevronLeft, iconChevronRight } from '../icons'
|
3
4
|
import { IconSvg } from '../IconSvg'
|
4
5
|
import { extendableComponent } from '../Styles'
|
5
6
|
import { NextLink } from '../Theme'
|
6
|
-
import { iconChevronLeft, iconChevronRight } from '../icons'
|
7
7
|
|
8
8
|
export type PaginationExtendedProps = {
|
9
9
|
count: number
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { ListItemButtonProps } from '@mui/material'
|
2
2
|
import { ListItemButton, ListItemIcon, ListItemText } from '@mui/material'
|
3
3
|
import React from 'react'
|
4
|
+
import { iconChevronRight } from '../../icons'
|
4
5
|
import { IconSvg } from '../../IconSvg'
|
5
6
|
import { NextLink } from '../../Theme'
|
6
|
-
import { iconChevronRight } from '../../icons'
|
7
7
|
|
8
8
|
export type ButtonLinkListItemProps = {
|
9
9
|
endIcon?: React.ReactNode
|
@@ -8,7 +8,6 @@ import { iconChevronLeft, iconChevronRight } from '../../icons'
|
|
8
8
|
import { IconSvg } from '../../IconSvg'
|
9
9
|
import { extendableComponent } from '../../Styles'
|
10
10
|
import { useFabSize } from '../../Theme'
|
11
|
-
import { Row } from '../Row'
|
12
11
|
|
13
12
|
export type RowLinksProps = {
|
14
13
|
title: string
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { i18n } from '@lingui/core'
|
2
2
|
import type { SnackbarProps, SxProps, Theme } from '@mui/material'
|
3
|
-
import { Box, Fab, Portal, Snackbar, SnackbarContent
|
3
|
+
import { Box, Fab, lighten, Portal, Snackbar, SnackbarContent } from '@mui/material'
|
4
4
|
import React, { useEffect, useState } from 'react'
|
5
|
+
import { iconCheckmark, iconClose, iconSadFace } from '../icons'
|
6
|
+
import iconInfo from '../icons/info.svg'
|
5
7
|
import type { IconSvgProps } from '../IconSvg'
|
6
8
|
import { IconSvg } from '../IconSvg'
|
7
9
|
import { breakpointVal, extendableComponent } from '../Styles'
|
8
|
-
import { iconCheckmark, iconClose, iconSadFace } from '../icons'
|
9
|
-
import iconInfo from '../icons/info.svg'
|
10
10
|
|
11
11
|
type Size = 'normal' | 'wide'
|
12
12
|
type Variant = 'contained' | 'pill'
|
@@ -29,9 +29,7 @@ type OwnerState = {
|
|
29
29
|
size?: Size
|
30
30
|
severity?: 'success' | 'info' | 'warning' | 'error'
|
31
31
|
variant?: Variant
|
32
|
-
/**
|
33
|
-
* Setting this to true allows interaction with the rest of the page without closing the Snackbar
|
34
|
-
*/
|
32
|
+
/** Setting this to true allows interaction with the rest of the page without closing the Snackbar */
|
35
33
|
disableBackdropClick?: boolean
|
36
34
|
disableClose?: boolean
|
37
35
|
disableIcon?: boolean
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { RatingProps } from '@mui/material'
|
2
2
|
import { Rating } from '@mui/material'
|
3
|
+
import { iconStar } from '../icons'
|
3
4
|
import { IconSvg } from '../IconSvg'
|
4
5
|
import { extendableComponent } from '../Styles'
|
5
|
-
import { iconStar } from '../icons'
|
6
6
|
|
7
7
|
export type StarRatingFieldProps = {
|
8
8
|
id?: string
|
@@ -10,5 +10,7 @@ export const createEmotionCache = () => {
|
|
10
10
|
insertionPoint = emotionInsertionPoint ?? undefined
|
11
11
|
}
|
12
12
|
|
13
|
-
|
13
|
+
const cache = createCache({ key: 'mui-style', insertionPoint, stylisPlugins: [] })
|
14
|
+
cache.compat = true
|
15
|
+
return cache
|
14
16
|
}
|
@@ -5,8 +5,8 @@ import type { AppType } from 'next/app'
|
|
5
5
|
import type NextDocument from 'next/document'
|
6
6
|
// eslint-disable-next-line @next/next/no-document-import-in-page
|
7
7
|
import type { DocumentContext } from 'next/document'
|
8
|
-
import type { EmotionProviderProps } from './EmotionProvider'
|
9
8
|
import { createEmotionCache } from './createEmotionCache'
|
9
|
+
import type { EmotionProviderProps } from './EmotionProvider'
|
10
10
|
|
11
11
|
export type EmotionCacheProps = { emotionStyleTags: EmotionJSX.Element[] }
|
12
12
|
|
@@ -8,10 +8,10 @@ import {
|
|
8
8
|
} from '@mui/material'
|
9
9
|
import type { ChangeEvent, Ref } from 'react'
|
10
10
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
11
|
+
import { iconMin, iconPlus } from '../icons'
|
11
12
|
import { IconSvg } from '../IconSvg'
|
12
13
|
import { extendableComponent } from '../Styles'
|
13
14
|
import { responsiveVal } from '../Styles/responsiveVal'
|
14
|
-
import { iconMin, iconPlus } from '../icons'
|
15
15
|
|
16
16
|
export type IconButtonPropsOmit = Omit<
|
17
17
|
IconButtonProps,
|
@@ -29,9 +29,7 @@ const name = 'TextInputNumber'
|
|
29
29
|
const parts = ['quantity', 'quantityInput', 'button'] as const
|
30
30
|
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
|
31
31
|
|
32
|
-
/**
|
33
|
-
* @deprecated Please us NumberFieldElement
|
34
|
-
*/
|
32
|
+
/** @deprecated Please us NumberFieldElement */
|
35
33
|
export function TextInputNumber(props: TextInputNumberProps) {
|
36
34
|
const {
|
37
35
|
DownProps = {},
|
package/Theme/NextLink.tsx
CHANGED
@@ -15,8 +15,8 @@ export type LinkProps = AnchorWithoutLinkProps & Partial<NextLinkPropsBase> & {
|
|
15
15
|
* This is a wrapper around the Next.js Link component which can be used with MUI's Link component
|
16
16
|
* or any ButtonBase derivative.
|
17
17
|
*
|
18
|
-
* By default you can use the props provided by the Link or Button component, but you can pass
|
19
|
-
*
|
18
|
+
* By default you can use the props provided by the Link or Button component, but you can pass any
|
19
|
+
* next/link specific props like `prefetch`, `replace`, `scroll`, `shallow`
|
20
20
|
*
|
21
21
|
* ```typescript
|
22
22
|
* const button = (
|
@@ -40,9 +40,9 @@ export const NextLink = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) =>
|
|
40
40
|
const isFullUrl = href.includes(':') || href.startsWith('//')
|
41
41
|
|
42
42
|
/**
|
43
|
-
* When an internal link is provided and it is on the same domain, extract the locale
|
44
|
-
*
|
45
|
-
*
|
43
|
+
* When an internal link is provided and it is on the same domain, extract the locale from the URL
|
44
|
+
* and make the URL relative without the locale. Prevents Next.js prefixing again with the current
|
45
|
+
* locale.
|
46
46
|
*/
|
47
47
|
if (!locale && isFullUrl && href.startsWith(canonicalBaseUrl)) {
|
48
48
|
const url = new URL(href)
|
package/Theme/createTheme.ts
CHANGED
package/Theme/themeDefaults.ts
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import type { Components, Theme, ThemeOptions } from '@mui/material'
|
2
|
+
import { createTheme as createMuiTheme } from '@mui/material'
|
1
3
|
import type { Shadows } from '@mui/material/styles/shadows'
|
2
4
|
import { spreadVal } from '../Styles/spreadVal'
|
3
5
|
import { breakpoints } from './breakpoints'
|
@@ -37,3 +39,11 @@ export const themeBaseDefaults = {
|
|
37
39
|
spreadVal,
|
38
40
|
shadows,
|
39
41
|
}
|
42
|
+
|
43
|
+
// https://github.com/tjx666/ts-perf-issue#createtheme
|
44
|
+
export const createTheme = createMuiTheme as unknown as (
|
45
|
+
baseTheme: ThemeOptions,
|
46
|
+
options?: {
|
47
|
+
components: Components<Theme>
|
48
|
+
},
|
49
|
+
) => Theme
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
2
|
import type { ButtonProps } from '@mui/material'
|
3
|
-
import {
|
3
|
+
import { alpha, Button } from '@mui/material'
|
4
4
|
import type { FormEvent } from 'react'
|
5
5
|
import React from 'react'
|
6
6
|
import { extendableComponent } from '../Styles'
|
package/hooks/memoDeep.ts
CHANGED
@@ -6,7 +6,8 @@ import { memo } from 'react'
|
|
6
6
|
/**
|
7
7
|
* This is a deep comparison version of React's `memo` function.
|
8
8
|
*
|
9
|
-
* This method isn't too expensive to run, but will be rerun every time a parent component is
|
9
|
+
* This method isn't too expensive to run, but will be rerun every time a parent component is
|
10
|
+
* rendered.
|
10
11
|
*
|
11
12
|
* This should probably only be used as the result of a performance profiling session.
|
12
13
|
*/
|
package/hooks/useIsSsr.ts
CHANGED
@@ -2,9 +2,7 @@ import { useSyncExternalStore } from 'react'
|
|
2
2
|
|
3
3
|
const emptySubscribe = () => () => {}
|
4
4
|
|
5
|
-
/**
|
6
|
-
* This method will return true on the server and during hydration and false after that.
|
7
|
-
*/
|
5
|
+
/** This method will return true on the server and during hydration and false after that. */
|
8
6
|
export function useIsSSR() {
|
9
7
|
return useSyncExternalStore(
|
10
8
|
emptySubscribe,
|
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": "9.0.4-canary.
|
5
|
+
"version": "9.0.4-canary.10",
|
6
6
|
"sideEffects": false,
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
8
8
|
"eslintConfig": {
|
@@ -24,13 +24,13 @@
|
|
24
24
|
"@emotion/react": "^11",
|
25
25
|
"@emotion/server": "^11",
|
26
26
|
"@emotion/styled": "^11",
|
27
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.4-canary.
|
28
|
-
"@graphcommerce/framer-next-pages": "^9.0.4-canary.
|
29
|
-
"@graphcommerce/framer-scroller": "^9.0.4-canary.
|
30
|
-
"@graphcommerce/framer-utils": "^9.0.4-canary.
|
31
|
-
"@graphcommerce/image": "^9.0.4-canary.
|
32
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.4-canary.
|
33
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.4-canary.
|
27
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.4-canary.10",
|
28
|
+
"@graphcommerce/framer-next-pages": "^9.0.4-canary.10",
|
29
|
+
"@graphcommerce/framer-scroller": "^9.0.4-canary.10",
|
30
|
+
"@graphcommerce/framer-utils": "^9.0.4-canary.10",
|
31
|
+
"@graphcommerce/image": "^9.0.4-canary.10",
|
32
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.4-canary.10",
|
33
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.4-canary.10",
|
34
34
|
"@lingui/core": "^4.2.1",
|
35
35
|
"@lingui/macro": "^4.2.1",
|
36
36
|
"@lingui/react": "^4.2.1",
|
package/utils/cssFlags.tsx
CHANGED
@@ -35,7 +35,7 @@ export function getCssFlag(flagName: string) {
|
|
35
35
|
* Example:
|
36
36
|
*
|
37
37
|
* ```tsx
|
38
|
-
*
|
38
|
+
* ;<Box sx={{ [cssFlagSelector('dark')]: { color: 'white' } }} />
|
39
39
|
* ```
|
40
40
|
*/
|
41
41
|
export const cssFlag = <T extends string>(flagName: T) => `html[data-${flagName}] &` as const
|
@@ -46,7 +46,7 @@ export const cssFlag = <T extends string>(flagName: T) => `html[data-${flagName}
|
|
46
46
|
* Example:
|
47
47
|
*
|
48
48
|
* ```tsx
|
49
|
-
*
|
49
|
+
* ;<Box sx={{ [cssNotFlagSelector('dark')]: { color: 'black' } }} />
|
50
50
|
* ```
|
51
51
|
*/
|
52
52
|
export const cssNotFlag = <T extends string>(flagName: T) =>
|
package/utils/normalizeLocale.ts
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
import { storefrontConfig, storefrontConfigDefault } from './storefrontConfig'
|
2
2
|
|
3
3
|
/**
|
4
|
-
* To support using multiple storefronts using the same language locale (which
|
5
|
-
*
|
6
|
-
*
|
4
|
+
* To support using multiple storefronts using the same language locale (which next.js does not
|
5
|
+
* support), we use an additional 'tag' in the locale code in which we specify a unique string (i.e.
|
6
|
+
* a Magento store code).
|
7
7
|
*
|
8
|
-
* This makes next.js happy, as it still follows the BCP47 spec. However, the
|
9
|
-
*
|
8
|
+
* This makes next.js happy, as it still follows the BCP47 spec. However, the Intl API and other
|
9
|
+
* places may not accept this as a valid locale.
|
10
10
|
*
|
11
|
-
* Use this method to get a 'normalized' locale that can safely be used in such
|
12
|
-
* places.
|
11
|
+
* Use this method to get a 'normalized' locale that can safely be used in such places.
|
13
12
|
*/
|
14
13
|
export function normalizeLocale(locale: string | undefined = storefrontConfigDefault().locale) {
|
15
14
|
const linguiLocale = storefrontConfig(locale)?.linguiLocale
|
package/utils/robots.ts
CHANGED
@@ -3,8 +3,8 @@ import type { GetServerSidePropsContext } from 'next'
|
|
3
3
|
type Stringifyable = boolean | string | number | null | undefined
|
4
4
|
|
5
5
|
/**
|
6
|
-
* Tagged template literal for robots.txt that will automatically stringify values and indent them
|
7
|
-
* https://developers.google.com/search/docs/crawling-indexing/robots/robots_txt#syntax
|
6
|
+
* Tagged template literal for robots.txt that will automatically stringify values and indent them
|
7
|
+
* correctly. https://developers.google.com/search/docs/crawling-indexing/robots/robots_txt#syntax
|
8
8
|
*/
|
9
9
|
export function robotsTxt(strings: TemplateStringsArray, ...values: Stringifyable[]) {
|
10
10
|
return strings
|
package/utils/sxx.ts
CHANGED
@@ -9,8 +9,10 @@ import type { SxProps, Theme } from '@mui/material'
|
|
9
9
|
* sxx({ position: 'absolute', right: 0, top: 0 }, props.sx)
|
10
10
|
* ```
|
11
11
|
*/
|
12
|
-
export const sxx = (
|
12
|
+
export const sxx = (
|
13
|
+
...sxPropsArray: (SxProps<Theme> | undefined | null | false)[]
|
14
|
+
): SxProps<Theme> =>
|
13
15
|
sxPropsArray
|
14
|
-
.filter((v) => v
|
16
|
+
.filter((v) => !!v)
|
15
17
|
.map((sx) => (Array.isArray(sx) ? sx : [sx]))
|
16
18
|
.flat(1)
|