@graphcommerce/next-ui 4.10.0 → 4.11.2
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/ActionCardListForm.tsx +2 -6
- package/Blog/BlogAuthor/BlogAuthor.tsx +2 -7
- package/Blog/BlogListItem/BlogListItem.tsx +3 -7
- package/CHANGELOG.md +29 -0
- package/Layout/components/LayoutHeaderBack.tsx +1 -1
- package/LayoutOverlay/test/LayoutOverlayDemo.tsx +1 -1
- package/hooks/index.ts +3 -0
- package/hooks/useDateTimeFormat.ts +10 -0
- package/hooks/useNumberFormat.ts +10 -0
- package/{useUrlQuery/useUrlQuery.tsx → hooks/useUrlQuery.ts} +0 -0
- package/index.ts +1 -1
- package/package.json +2 -2
|
@@ -33,18 +33,14 @@ export function ActionCardListForm<T extends ActionCardItemBase>(
|
|
|
33
33
|
{...props}
|
|
34
34
|
control={control}
|
|
35
35
|
name={name}
|
|
36
|
-
rules={{
|
|
37
|
-
required,
|
|
38
|
-
...rules,
|
|
39
|
-
validate: (v) => (v ? true : 'Please select a shipping address'),
|
|
40
|
-
}}
|
|
36
|
+
rules={{ required, ...rules, validate: (v) => (v ? true : errorMessage) }}
|
|
41
37
|
render={({ field: { onChange, value }, fieldState, formState }) => (
|
|
42
38
|
<ActionCardList
|
|
43
39
|
required
|
|
44
40
|
value={value}
|
|
45
41
|
onChange={(_, incomming) => onChange(incomming)}
|
|
46
42
|
error={formState.isSubmitted && !!fieldState.error}
|
|
47
|
-
errorMessage={
|
|
43
|
+
errorMessage={fieldState.error?.message}
|
|
48
44
|
>
|
|
49
45
|
{items.map((item) => (
|
|
50
46
|
<RenderItem
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Avatar, Box, Chip, SxProps, Theme } from '@mui/material'
|
|
2
|
-
import { useRouter } from 'next/router'
|
|
3
|
-
import { useMemo } from 'react'
|
|
4
2
|
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
3
|
+
import { useDateTimeFormat } from '../../hooks'
|
|
5
4
|
|
|
6
5
|
export type BlogAuthorProps = {
|
|
7
6
|
author: string
|
|
@@ -12,11 +11,7 @@ export type BlogAuthorProps = {
|
|
|
12
11
|
export function BlogAuthor(props: BlogAuthorProps) {
|
|
13
12
|
const { author, date, sx = [] } = props
|
|
14
13
|
|
|
15
|
-
const {
|
|
16
|
-
const formatter = useMemo(
|
|
17
|
-
() => new Intl.DateTimeFormat(locale, { month: 'long', day: 'numeric' }),
|
|
18
|
-
[locale],
|
|
19
|
-
)
|
|
14
|
+
const formatter = useDateTimeFormat({ month: 'long', day: 'numeric' })
|
|
20
15
|
|
|
21
16
|
return (
|
|
22
17
|
<Box
|
|
@@ -3,12 +3,12 @@ import PageLink from 'next/link'
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { extendableComponent } from '../../Styles'
|
|
5
5
|
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
6
|
+
import { useDateTimeFormat } from '../../hooks'
|
|
6
7
|
|
|
7
8
|
export type BlogListItemProps = {
|
|
8
9
|
asset: React.ReactNode
|
|
9
10
|
url: string
|
|
10
11
|
date: string
|
|
11
|
-
locale: string
|
|
12
12
|
title: string
|
|
13
13
|
sx?: SxProps<Theme>
|
|
14
14
|
}
|
|
@@ -18,13 +18,9 @@ const parts = ['item', 'date', 'asset', 'title'] as const
|
|
|
18
18
|
const { classes } = extendableComponent(name, parts)
|
|
19
19
|
|
|
20
20
|
export function BlogListItem(props: BlogListItemProps) {
|
|
21
|
-
const { asset, url, date,
|
|
21
|
+
const { asset, url, date, title, sx = [] } = props
|
|
22
22
|
|
|
23
|
-
const formatter =
|
|
24
|
-
year: 'numeric',
|
|
25
|
-
month: 'long',
|
|
26
|
-
day: 'numeric',
|
|
27
|
-
})
|
|
23
|
+
const formatter = useDateTimeFormat({ year: 'numeric', month: 'long', day: 'numeric' })
|
|
28
24
|
|
|
29
25
|
return (
|
|
30
26
|
<Box
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.11.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1538](https://github.com/graphcommerce-org/graphcommerce/pull/1538) [`fe4baa42d`](https://github.com/graphcommerce-org/graphcommerce/commit/fe4baa42db0081ed960d62aef688bd36a7ac974f) Thanks [@paales](https://github.com/paales)! - add missing translations
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @graphcommerce/framer-scroller@2.1.20
|
|
11
|
+
|
|
12
|
+
## 4.11.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#1529](https://github.com/graphcommerce-org/graphcommerce/pull/1529) [`11bca2d2f`](https://github.com/graphcommerce-org/graphcommerce/commit/11bca2d2f7dbb7c5e2827c04eb0db43d4099f2fd) Thanks [@paales](https://github.com/paales)! - issue where the error message of actionCardList was incomplete
|
|
17
|
+
|
|
18
|
+
- Updated dependencies []:
|
|
19
|
+
- @graphcommerce/framer-scroller@2.1.19
|
|
20
|
+
|
|
21
|
+
## 4.11.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- [#1524](https://github.com/graphcommerce-org/graphcommerce/pull/1524) [`9ec0338df`](https://github.com/graphcommerce-org/graphcommerce/commit/9ec0338dfe34d37b0f2c24e36ffa6ed13ea1145e) Thanks [@paales](https://github.com/paales)! - feat: Added useDateTimeFormat and useNumberFormat which automatically use the locales from nextjs.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies []:
|
|
30
|
+
- @graphcommerce/framer-scroller@2.1.18
|
|
31
|
+
|
|
3
32
|
## 4.10.0
|
|
4
33
|
|
|
5
34
|
### Minor Changes
|
|
@@ -46,7 +46,7 @@ export function LayoutHeaderBack(props: BackProps) {
|
|
|
46
46
|
const backIcon = <IconSvg src={iconChevronLeft} size='medium' />
|
|
47
47
|
const canClickBack = backSteps > 0 && path !== prevUp?.href
|
|
48
48
|
|
|
49
|
-
let label = i18n._(/* i18n */
|
|
49
|
+
let label = i18n._(/* i18n */ 'Back')
|
|
50
50
|
if (up?.href === path && up?.title) label = up.title
|
|
51
51
|
if (prevUp?.href === path && prevUp?.title) label = prevUp.title
|
|
52
52
|
|
package/hooks/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRouter } from 'next/router'
|
|
2
|
+
import { useMemo } from 'react'
|
|
3
|
+
|
|
4
|
+
export type DateTimeFormatProps = Intl.DateTimeFormatOptions
|
|
5
|
+
|
|
6
|
+
export function useDateTimeFormat(props?: DateTimeFormatProps) {
|
|
7
|
+
const { locale } = useRouter()
|
|
8
|
+
const formatter = useMemo(() => new Intl.DateTimeFormat(locale, props), [locale, props])
|
|
9
|
+
return formatter
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRouter } from 'next/router'
|
|
2
|
+
import { useMemo } from 'react'
|
|
3
|
+
|
|
4
|
+
export type NumberFormatProps = Intl.NumberFormatOptions
|
|
5
|
+
|
|
6
|
+
export function useNumberFormat(props?: NumberFormatProps) {
|
|
7
|
+
const { locale } = useRouter()
|
|
8
|
+
const formatter = useMemo(() => new Intl.NumberFormat(locale, props), [locale, props])
|
|
9
|
+
return formatter
|
|
10
|
+
}
|
|
File without changes
|
package/index.ts
CHANGED
|
@@ -50,6 +50,6 @@ export * from './Theme'
|
|
|
50
50
|
export * from './TimeAgo/TimeAgo'
|
|
51
51
|
export * from './ToggleButton/ToggleButton'
|
|
52
52
|
export * from './ToggleButtonGroup/ToggleButtonGroup'
|
|
53
|
-
export * from './
|
|
53
|
+
export * from './hooks'
|
|
54
54
|
export * from './UspList/UspList'
|
|
55
55
|
export * from './UspList/UspListItem'
|
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": "4.
|
|
5
|
+
"version": "4.11.2",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@emotion/server": "^11.4.0",
|
|
21
21
|
"@emotion/styled": "^11.6.0",
|
|
22
22
|
"@graphcommerce/framer-next-pages": "3.2.3",
|
|
23
|
-
"@graphcommerce/framer-scroller": "2.1.
|
|
23
|
+
"@graphcommerce/framer-scroller": "2.1.20",
|
|
24
24
|
"@graphcommerce/framer-utils": "3.1.4",
|
|
25
25
|
"@graphcommerce/image": "3.1.7",
|
|
26
26
|
"react-is": "^18.1.0",
|