@graphcommerce/next-ui 9.1.0-canary.16 → 9.1.0-canary.17
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.
@@ -186,9 +186,9 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
186
186
|
'&.variantOutlined': {
|
187
187
|
backgroundColor: theme.palette.background.paper,
|
188
188
|
boxShadow: `inset 0 0 0 1px ${theme.palette.divider}`,
|
189
|
-
'&:not(:last-of-type)': {
|
190
|
-
|
191
|
-
},
|
189
|
+
// '&:not(:last-of-type)': {
|
190
|
+
// marginBottom: '-2px',
|
191
|
+
// },
|
192
192
|
'&.layoutList': {
|
193
193
|
borderRadius: 0,
|
194
194
|
'&:first-of-type': {
|
@@ -296,6 +296,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
296
296
|
display: 'flex',
|
297
297
|
flexDirection: 'column',
|
298
298
|
alignItems: 'flex-start',
|
299
|
+
justifyContent: 'center',
|
299
300
|
}}
|
300
301
|
>
|
301
302
|
{title && (
|
@@ -348,7 +349,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
348
349
|
)}
|
349
350
|
{...slotProps.end}
|
350
351
|
>
|
351
|
-
{action && (
|
352
|
+
{(action || reset) && (
|
352
353
|
<Box
|
353
354
|
className={classes.action}
|
354
355
|
sx={sxx(
|
package/CHANGELOG.md
CHANGED
@@ -1,19 +1,29 @@
|
|
1
|
-
import type {
|
2
|
-
import {
|
1
|
+
import type { BoxProps } from '@mui/material'
|
2
|
+
import { Box } from '@mui/material'
|
3
|
+
import { useIntlDisplayNames } from '../Intl'
|
4
|
+
import { sxx } from '../utils/sxx'
|
3
5
|
|
4
|
-
export type FlagAvatarProps = { country: string } & Omit<
|
6
|
+
export type FlagAvatarProps = { country: string; size: string } & Omit<BoxProps<'img'>, 'src'>
|
5
7
|
|
6
8
|
export function FlagAvatar(props: FlagAvatarProps) {
|
7
|
-
const { country, ...avatarProps } = props
|
9
|
+
const { country, size, sx, ...avatarProps } = props
|
10
|
+
|
11
|
+
const displayName = useIntlDisplayNames({ type: 'region' })
|
8
12
|
|
9
13
|
return (
|
10
|
-
<
|
14
|
+
<Box
|
15
|
+
component='img'
|
11
16
|
{...avatarProps}
|
12
|
-
|
13
|
-
alt={country}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
src={`https://flagcdn.com/${country}.svg`}
|
18
|
+
alt={displayName.of(country)}
|
19
|
+
sx={sxx(
|
20
|
+
{
|
21
|
+
width: size,
|
22
|
+
borderRadius: '2px',
|
23
|
+
height: size,
|
24
|
+
},
|
25
|
+
sx,
|
26
|
+
)}
|
27
|
+
/>
|
18
28
|
)
|
19
29
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Box, type SxProps, type Theme } from '@mui/material'
|
2
2
|
import { forwardRef } from 'react'
|
3
|
+
import { DisplayNames } from '../DisplayNames'
|
3
4
|
import {
|
4
5
|
useIntlNumberFormat,
|
5
6
|
type UseIntlNumberFormatOptions,
|
@@ -7,16 +8,23 @@ import {
|
|
7
8
|
|
8
9
|
export type CurrencySymbolProps = Omit<UseIntlNumberFormatOptions, 'numberStyle'> & {
|
9
10
|
sx?: SxProps<Theme>
|
11
|
+
variant?: 'symbol' | 'full'
|
10
12
|
}
|
11
13
|
|
12
14
|
/** @public */
|
13
15
|
export const CurrencySymbol = forwardRef<HTMLSpanElement, CurrencySymbolProps>((props, ref) => {
|
14
|
-
const { sx, ...options } = props
|
16
|
+
const { sx, variant = 'symbol', ...options } = props
|
15
17
|
const formatter = useIntlNumberFormat({ ...options, numberStyle: 'currency' })
|
16
18
|
|
17
19
|
return (
|
18
20
|
<Box component='span' suppressHydrationWarning ref={ref} sx={sx}>
|
19
21
|
{formatter.formatToParts(1).find((part) => part.type === 'currency')?.value}
|
22
|
+
{options.currency && variant === 'full' && (
|
23
|
+
<>
|
24
|
+
{' – '}
|
25
|
+
{options.currency} – <DisplayNames type='currency' code={options.currency} />
|
26
|
+
</>
|
27
|
+
)}
|
20
28
|
</Box>
|
21
29
|
)
|
22
30
|
})
|
@@ -9,7 +9,7 @@ export type UseIntlListFormatOptions = {
|
|
9
9
|
UseIntlLocalesArgumentOptions
|
10
10
|
|
11
11
|
export function useIntlListFormat(props: UseIntlListFormatOptions) {
|
12
|
-
const [locales, options] = useIntlLocalesArgument(props)
|
13
|
-
const memoOptions = useMemoObject({ ...options })
|
12
|
+
const [locales, { listStyle: style, ...options }] = useIntlLocalesArgument(props)
|
13
|
+
const memoOptions = useMemoObject({ style, ...options })
|
14
14
|
return useMemo(() => new Intl.ListFormat(locales, memoOptions), [locales, memoOptions])
|
15
15
|
}
|
@@ -5,6 +5,6 @@ import { storefrontConfig } from '../utils/storefrontConfig'
|
|
5
5
|
export function useStorefrontConfig(locale?: string | undefined) {
|
6
6
|
const routerLocale = useRouter().locale
|
7
7
|
const config = storefrontConfig(locale ?? routerLocale)
|
8
|
-
if (!config) throw Error(`No storefront config found for locale ${locale}`)
|
8
|
+
if (!config) throw Error(`No storefront config found for locale '${locale}'`)
|
9
9
|
return config
|
10
10
|
}
|
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.1.0-canary.
|
5
|
+
"version": "9.1.0-canary.17",
|
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.1.0-canary.
|
28
|
-
"@graphcommerce/framer-next-pages": "^9.1.0-canary.
|
29
|
-
"@graphcommerce/framer-scroller": "^9.1.0-canary.
|
30
|
-
"@graphcommerce/framer-utils": "^9.1.0-canary.
|
31
|
-
"@graphcommerce/image": "^9.1.0-canary.
|
32
|
-
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.
|
33
|
-
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.
|
27
|
+
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.17",
|
28
|
+
"@graphcommerce/framer-next-pages": "^9.1.0-canary.17",
|
29
|
+
"@graphcommerce/framer-scroller": "^9.1.0-canary.17",
|
30
|
+
"@graphcommerce/framer-utils": "^9.1.0-canary.17",
|
31
|
+
"@graphcommerce/image": "^9.1.0-canary.17",
|
32
|
+
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.17",
|
33
|
+
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.17",
|
34
34
|
"@lingui/core": "^4.2.1",
|
35
35
|
"@lingui/macro": "^4.2.1",
|
36
36
|
"@lingui/react": "^4.2.1",
|