@graphcommerce/next-ui 9.1.0-canary.43 → 9.1.0-canary.44

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.1.0-canary.44
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b423879`](https://github.com/graphcommerce-org/graphcommerce/commit/b4238796f1f8cce62325e57d90cc7a84a921a0fa) - DateTimeFormat, NumberFormat and RelativeTimeFormat (and all derivatives) will now wrap all number parts in a span, so that individual parts can be styled properly. ([@paales](https://github.com/paales))
8
+
3
9
  ## 9.1.0-canary.43
4
10
 
5
11
  ## 9.1.0-canary.42
@@ -17,8 +17,13 @@ export function DateTimeFormat(props: DateTimeFormatProps) {
17
17
 
18
18
  const dateValue = useMemo(() => toDate(date), [date])
19
19
  return (
20
- <Box component='span' suppressHydrationWarning sx={sx}>
21
- {dateValue ? formatter.format(dateValue) : null}
20
+ <Box component='span' className='DateTimeFormat' suppressHydrationWarning sx={sx}>
21
+ {dateValue &&
22
+ formatter.formatToParts(dateValue).map((part) => (
23
+ <span className={part.type} key={part.type} suppressHydrationWarning>
24
+ {part.value}
25
+ </span>
26
+ ))}
22
27
  </Box>
23
28
  )
24
29
  }
@@ -16,8 +16,12 @@ export const NumberFormat = forwardRef<HTMLSpanElement, NumberFormatProps>((prop
16
16
  const formatter = useIntlNumberFormat(options)
17
17
 
18
18
  return (
19
- <Box component='span' suppressHydrationWarning ref={ref} sx={sx}>
20
- {formatter.format(value)}
19
+ <Box component='span' className='NumberFormat' suppressHydrationWarning ref={ref} sx={sx}>
20
+ {formatter.formatToParts(value).map((part) => (
21
+ <span className={part.type} key={part.type} suppressHydrationWarning>
22
+ {part.value}
23
+ </span>
24
+ ))}
21
25
  </Box>
22
26
  )
23
27
  })
@@ -34,8 +34,19 @@ export const RelativeTimeFormat = forwardRef<HTMLSpanElement, RelativeTimeFormat
34
34
  const result = relativeTimeFormatUnitAuto({ value, unit })
35
35
 
36
36
  return (
37
- <Box component='span' suppressHydrationWarning ref={ref} {...rest}>
38
- {result.value ? formatter.format(result.value, result.unit) : null}
37
+ <Box
38
+ component='span'
39
+ className='RelativeTimeFormat'
40
+ suppressHydrationWarning
41
+ ref={ref}
42
+ {...rest}
43
+ >
44
+ {result.value &&
45
+ formatter.formatToParts(result.value, result.unit).map((part) => (
46
+ <span className={part.type} key={part.type} suppressHydrationWarning>
47
+ {part.value}
48
+ </span>
49
+ ))}
39
50
  </Box>
40
51
  )
41
52
  },
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.43",
5
+ "version": "9.1.0-canary.44",
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.43",
28
- "@graphcommerce/framer-next-pages": "^9.1.0-canary.43",
29
- "@graphcommerce/framer-scroller": "^9.1.0-canary.43",
30
- "@graphcommerce/framer-utils": "^9.1.0-canary.43",
31
- "@graphcommerce/image": "^9.1.0-canary.43",
32
- "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.43",
33
- "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.43",
27
+ "@graphcommerce/eslint-config-pwa": "^9.1.0-canary.44",
28
+ "@graphcommerce/framer-next-pages": "^9.1.0-canary.44",
29
+ "@graphcommerce/framer-scroller": "^9.1.0-canary.44",
30
+ "@graphcommerce/framer-utils": "^9.1.0-canary.44",
31
+ "@graphcommerce/image": "^9.1.0-canary.44",
32
+ "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.44",
33
+ "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.44",
34
34
  "@lingui/core": "^4.2.1",
35
35
  "@lingui/macro": "^4.2.1",
36
36
  "@lingui/react": "^4.2.1",