@graphcommerce/next-ui 8.0.5-canary.9 → 8.0.6-canary.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/CHANGELOG.md +32 -0
- package/TimeAgo/TimeAgo.tsx +8 -2
- package/hooks/index.ts +1 -0
- package/hooks/useDateTimeFormat.ts +4 -6
- package/hooks/useLocale.ts +7 -0
- package/hooks/useNumberFormat.ts +3 -8
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 8.0.6-canary.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2196](https://github.com/graphcommerce-org/graphcommerce/pull/2196) [`84c50e4`](https://github.com/graphcommerce-org/graphcommerce/commit/84c50e49a1a7f154d4a8f4045c37e773e20283ad) - Allow Lingui to use linguiLocale with country identifiers like `en-us`, it would always load `en` in this case. Introced a new `useLocale` hook to use the correct locale string to use in Intl methods.
|
|
8
|
+
([@paales](https://github.com/paales))
|
|
9
|
+
|
|
10
|
+
## 8.0.5
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#2236](https://github.com/graphcommerce-org/graphcommerce/pull/2236) [`85fb916`](https://github.com/graphcommerce-org/graphcommerce/commit/85fb916e5ec2a1456a93a59bf92a5f414fee8595) - Solve issue where the inert prop wouldnt be properly forwarded
|
|
15
|
+
([@paales](https://github.com/paales))
|
|
16
|
+
|
|
17
|
+
- [#2235](https://github.com/graphcommerce-org/graphcommerce/pull/2235) [`de99691`](https://github.com/graphcommerce-org/graphcommerce/commit/de9969155e271cc2535147479b80b602a1b9c335) - The Lazyhydrate component to accepts any BoxProps. Replaced `<section>` with a `<Box>` so it doesn't hold symantic meaning.
|
|
18
|
+
|
|
19
|
+
Please note: If you've used child selectors to style the section, please make sure you update your styles. ([@carlocarels90](https://github.com/carlocarels90))
|
|
20
|
+
|
|
21
|
+
- [#2241](https://github.com/graphcommerce-org/graphcommerce/pull/2241) [`6f3fe60`](https://github.com/graphcommerce-org/graphcommerce/commit/6f3fe60441762d55cb46d587279121e8fe469cdd) - Decreased layout shift on product pages by reserving space for sidebar
|
|
22
|
+
([@bramvanderholst](https://github.com/bramvanderholst))
|
|
23
|
+
|
|
24
|
+
- [#2241](https://github.com/graphcommerce-org/graphcommerce/pull/2241) [`cde3c31`](https://github.com/graphcommerce-org/graphcommerce/commit/cde3c310abf2ac3c82d1062d5fb0a4c00ba50cff) - Removed unnecessary vendor prefixes
|
|
25
|
+
([@bramvanderholst](https://github.com/bramvanderholst))
|
|
26
|
+
|
|
27
|
+
- [#2241](https://github.com/graphcommerce-org/graphcommerce/pull/2241) [`4c83636`](https://github.com/graphcommerce-org/graphcommerce/commit/4c836366c324881ee5121c645c5f94fc60e3ebb3) - Prevent horizontal scrollbar on small screens when using SidebarGallery
|
|
28
|
+
([@bramvanderholst](https://github.com/bramvanderholst))
|
|
29
|
+
|
|
30
|
+
- [#2230](https://github.com/graphcommerce-org/graphcommerce/pull/2230) [`1da6b82`](https://github.com/graphcommerce-org/graphcommerce/commit/1da6b82dbb7e1543542d809ea625a8867643ea68) - Fix menu item visibility in accessability tree
|
|
31
|
+
([@JoshuaS98](https://github.com/JoshuaS98))
|
|
32
|
+
|
|
33
|
+
## 8.0.5-canary.10
|
|
34
|
+
|
|
3
35
|
## 8.0.5-canary.9
|
|
4
36
|
|
|
5
37
|
## 8.0.5-canary.8
|
package/TimeAgo/TimeAgo.tsx
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
import { useLocale } from '../hooks/useLocale'
|
|
2
|
+
|
|
1
3
|
export type TimeAgoProps = {
|
|
2
4
|
date: Date
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated No longer used
|
|
7
|
+
*/
|
|
3
8
|
locale?: string
|
|
4
9
|
}
|
|
5
10
|
|
|
6
11
|
export function TimeAgo(props: TimeAgoProps) {
|
|
7
|
-
const { date
|
|
12
|
+
const { date } = props
|
|
8
13
|
const msPerMinute = 60 * 1000
|
|
9
14
|
const msPerHour = msPerMinute * 60
|
|
10
15
|
const msPerDay = msPerHour * 24
|
|
11
16
|
|
|
12
17
|
const timestamp = date.getTime()
|
|
13
18
|
const elapsed = Date.now() - timestamp
|
|
14
|
-
|
|
19
|
+
|
|
20
|
+
const rtf = new Intl.RelativeTimeFormat(useLocale(), { numeric: 'auto' })
|
|
15
21
|
|
|
16
22
|
if (elapsed < msPerMinute) {
|
|
17
23
|
return <span>{rtf.format(-Math.floor(elapsed / 1000), 'seconds')}</span>
|
package/hooks/index.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { normalizeLocale } from '@graphcommerce/lingui-next'
|
|
2
|
-
import { useRouter } from 'next/router'
|
|
3
2
|
import { useMemo } from 'react'
|
|
3
|
+
import { useStorefrontConfig } from './useStorefrontConfig'
|
|
4
|
+
import { useLocale } from '@graphcommerce/next-ui'
|
|
4
5
|
|
|
5
6
|
export type DateTimeFormatProps = Intl.DateTimeFormatOptions
|
|
6
7
|
|
|
7
8
|
export function useDateTimeFormat(props?: DateTimeFormatProps) {
|
|
8
|
-
const
|
|
9
|
+
const locale = useLocale()
|
|
9
10
|
|
|
10
|
-
const formatter = useMemo(
|
|
11
|
-
() => new Intl.DateTimeFormat(normalizeLocale(locale), props),
|
|
12
|
-
[locale, props],
|
|
13
|
-
)
|
|
11
|
+
const formatter = useMemo(() => new Intl.DateTimeFormat(locale, props), [locale, props])
|
|
14
12
|
return formatter
|
|
15
13
|
}
|
package/hooks/useNumberFormat.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { normalizeLocale } from '@graphcommerce/lingui-next'
|
|
2
|
-
import { useRouter } from 'next/router'
|
|
3
1
|
import { useMemo } from 'react'
|
|
2
|
+
import { useLocale } from './useLocale'
|
|
4
3
|
|
|
5
4
|
export type NumberFormatProps = Intl.NumberFormatOptions
|
|
6
5
|
|
|
7
6
|
export function useNumberFormat(props?: NumberFormatProps) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const formatter = useMemo(
|
|
11
|
-
() => new Intl.NumberFormat(normalizeLocale(locale), props),
|
|
12
|
-
[locale, props],
|
|
13
|
-
)
|
|
7
|
+
const locale = useLocale()
|
|
8
|
+
const formatter = useMemo(() => new Intl.NumberFormat(locale, props), [locale, props])
|
|
14
9
|
return formatter
|
|
15
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": "8.0.
|
|
5
|
+
"version": "8.0.6-canary.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"typescript": "5.3.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@graphcommerce/eslint-config-pwa": "^8.0.
|
|
29
|
-
"@graphcommerce/framer-next-pages": "^8.0.
|
|
30
|
-
"@graphcommerce/framer-scroller": "^8.0.
|
|
31
|
-
"@graphcommerce/framer-utils": "^8.0.
|
|
32
|
-
"@graphcommerce/image": "^8.0.
|
|
33
|
-
"@graphcommerce/lingui-next": "^8.0.
|
|
34
|
-
"@graphcommerce/prettier-config-pwa": "^8.0.
|
|
35
|
-
"@graphcommerce/typescript-config-pwa": "^8.0.
|
|
28
|
+
"@graphcommerce/eslint-config-pwa": "^8.0.6-canary.0",
|
|
29
|
+
"@graphcommerce/framer-next-pages": "^8.0.6-canary.0",
|
|
30
|
+
"@graphcommerce/framer-scroller": "^8.0.6-canary.0",
|
|
31
|
+
"@graphcommerce/framer-utils": "^8.0.6-canary.0",
|
|
32
|
+
"@graphcommerce/image": "^8.0.6-canary.0",
|
|
33
|
+
"@graphcommerce/lingui-next": "^8.0.6-canary.0",
|
|
34
|
+
"@graphcommerce/prettier-config-pwa": "^8.0.6-canary.0",
|
|
35
|
+
"@graphcommerce/typescript-config-pwa": "^8.0.6-canary.0",
|
|
36
36
|
"@lingui/core": "^4.2.1",
|
|
37
37
|
"@lingui/macro": "^4.2.1",
|
|
38
38
|
"@lingui/react": "^4.2.1",
|