@graphcommerce/next-ui 9.0.0-canary.98 → 9.0.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.
Files changed (189) hide show
  1. package/ActionCard/ActionCard.tsx +219 -203
  2. package/ActionCard/ActionCardAccordion.tsx +4 -2
  3. package/ActionCard/ActionCardLayout.tsx +3 -2
  4. package/ActionCard/ActionCardList.tsx +6 -5
  5. package/Blog/BlogAuthor/BlogAuthor.tsx +5 -4
  6. package/Blog/BlogContent/BlogContent.tsx +3 -2
  7. package/Blog/BlogHeader/BlogHeader.tsx +4 -3
  8. package/Blog/BlogList/BlogList.tsx +3 -3
  9. package/Blog/BlogListItem/BlogListItem.tsx +6 -5
  10. package/Blog/BlogTags/BlogTag.tsx +3 -2
  11. package/Blog/BlogTags/BlogTags.tsx +1 -1
  12. package/Breadcrumbs/Breadcrumbs.tsx +25 -19
  13. package/Breadcrumbs/BreadcrumbsList.tsx +3 -2
  14. package/Breadcrumbs/jsonLdBreadcrumb.tsx +1 -1
  15. package/Breadcrumbs/types.ts +1 -2
  16. package/Button/Button.tsx +2 -1
  17. package/Button/LinkOrButton.tsx +4 -2
  18. package/CHANGELOG.md +294 -1342
  19. package/ChipMenu/ChipMenu.tsx +3 -2
  20. package/Config.graphqls +28 -10
  21. package/Container/Container.tsx +90 -0
  22. package/ContainerWithHeader/ContainerWithHeader.tsx +2 -1
  23. package/Document/DocumentBodyEnd.tsx +1 -1
  24. package/Document/DocumentBodyStart.tsx +1 -1
  25. package/Document/DocumentHeadEnd.tsx +1 -1
  26. package/Document/DocumentHeadStart.tsx +1 -1
  27. package/Fab/Fab.tsx +15 -17
  28. package/FlagAvatar/FlagAvatar.tsx +2 -1
  29. package/Footer/Footer.tsx +14 -10
  30. package/Form/Form.tsx +2 -1
  31. package/Form/FormHeader.tsx +1 -1
  32. package/Form/FormRow.tsx +1 -1
  33. package/Form/InputCheckmark.tsx +2 -1
  34. package/FramerScroller/ItemScroller.tsx +5 -8
  35. package/FramerScroller/SidebarGallery.tsx +23 -30
  36. package/FramerScroller/SidebarSlider.tsx +8 -7
  37. package/FullPageMessage/FullPageMessage.tsx +2 -1
  38. package/IconHeader/IconHeader.tsx +5 -3
  39. package/IconSvg/IconSvg.tsx +8 -7
  40. package/Intl/DateTimeFormat/DateFormat.tsx +6 -4
  41. package/Intl/DateTimeFormat/DateTimeFormat.tsx +10 -14
  42. package/Intl/DateTimeFormat/TimeFormat.tsx +6 -4
  43. package/Intl/DateTimeFormat/index.ts +1 -0
  44. package/Intl/DateTimeFormat/useIntlDateTimeFormat.ts +13 -0
  45. package/Intl/DisplayNames/DisplayNames.tsx +5 -13
  46. package/Intl/DisplayNames/index.ts +1 -0
  47. package/Intl/DisplayNames/useIntlDisplayNames.ts +12 -0
  48. package/Intl/{ListFormat.tsx → ListFormat/ListFormat.tsx} +8 -13
  49. package/Intl/ListFormat/index.ts +2 -0
  50. package/Intl/ListFormat/useIntlListFormat.ts +15 -0
  51. package/Intl/NumberFormat/CurrencyFormat.tsx +4 -2
  52. package/Intl/NumberFormat/NumberFormat.tsx +15 -17
  53. package/Intl/NumberFormat/PercentFormat.tsx +6 -2
  54. package/Intl/NumberFormat/UnitFormat.tsx +5 -5
  55. package/Intl/NumberFormat/index.ts +1 -0
  56. package/Intl/NumberFormat/useIntlNumberFormat.ts +17 -0
  57. package/Intl/RelativeTimeFormat/RelativeTimeFormat.tsx +6 -13
  58. package/Intl/RelativeTimeFormat/RelativeToTimeFormat.tsx +4 -2
  59. package/Intl/RelativeTimeFormat/index.ts +1 -0
  60. package/Intl/RelativeTimeFormat/useIntlRelativeTimeFormat.ts +15 -0
  61. package/Intl/useIntlLocalesArgument.ts +16 -0
  62. package/Layout/components/LayoutHeader.tsx +7 -4
  63. package/Layout/components/LayoutHeaderBack.tsx +6 -4
  64. package/Layout/components/LayoutHeaderClose.tsx +1 -1
  65. package/Layout/components/LayoutHeaderContent.tsx +11 -12
  66. package/Layout/components/LayoutProvider.tsx +1 -1
  67. package/Layout/components/LayoutTitle.tsx +5 -3
  68. package/Layout/context/layoutContext.tsx +1 -1
  69. package/Layout/types.ts +1 -1
  70. package/LayoutDefault/components/LayoutDefault.tsx +12 -10
  71. package/LayoutOverlay/components/LayoutOverlay.tsx +3 -2
  72. package/LayoutOverlay/components/LayoutOverlayHeader.tsx +2 -1
  73. package/LayoutOverlay/test/LayoutOverlayDemo.tsx +4 -1
  74. package/LayoutParts/DesktopHeaderBadge.tsx +2 -1
  75. package/LayoutParts/DesktopNavBar.tsx +26 -22
  76. package/LayoutParts/DesktopNavBarItem.tsx +11 -7
  77. package/LayoutParts/Logo.tsx +5 -5
  78. package/LayoutParts/MenuFab.tsx +7 -13
  79. package/LayoutParts/MenuFabItem.tsx +6 -1
  80. package/LayoutParts/MenuFabSecondaryItem.tsx +11 -7
  81. package/LayoutParts/MobileTopRight.tsx +24 -0
  82. package/LayoutParts/PlaceholderFab.tsx +2 -1
  83. package/LayoutParts/StickyBelowHeader.tsx +2 -1
  84. package/LayoutParts/index.ts +1 -0
  85. package/LazyHydrate/LazyHydrate.tsx +18 -21
  86. package/MediaQuery/MediaQuery.tsx +111 -0
  87. package/MediaQuery/index.ts +1 -0
  88. package/Navigation/components/NavigationFab.tsx +3 -2
  89. package/Navigation/components/NavigationItem.tsx +3 -3
  90. package/Navigation/components/NavigationList.tsx +4 -3
  91. package/Navigation/components/NavigationOverlay.tsx +18 -11
  92. package/Navigation/components/NavigationProvider.tsx +9 -8
  93. package/Navigation/components/NavigationTitle.tsx +5 -5
  94. package/Navigation/hooks/useNavigation.ts +4 -2
  95. package/Overlay/components/Overlay.tsx +3 -2
  96. package/Overlay/components/OverlayBase.tsx +71 -30
  97. package/Overlay/components/OverlayContainer.tsx +2 -2
  98. package/Overlay/components/OverlayHeader.tsx +7 -4
  99. package/Overlay/components/OverlaySsr.tsx +2 -1
  100. package/Overlay/components/OverlayStickyBottom.tsx +2 -1
  101. package/Overlay/utils/variantsToScrollSnapType.ts +2 -2
  102. package/OverlayOrPopperChip/OverlayOrPopperChip.tsx +5 -12
  103. package/OverlayOrPopperChip/OverlayOrPopperPanel.tsx +3 -3
  104. package/OverlayOrPopperChip/OverlayPanel.tsx +13 -7
  105. package/OverlayOrPopperChip/OverlayPanelActions.tsx +2 -2
  106. package/OverlayOrPopperChip/PopperPanel.tsx +3 -2
  107. package/OverlayOrPopperChip/PopperPanelActions.tsx +2 -2
  108. package/OverlayOrPopperChip/types.ts +2 -2
  109. package/OverlayOrPopperChip/useHandleClickNotDrag.ts +3 -1
  110. package/Page/CssAndFramerMotionProvider.tsx +2 -1
  111. package/Page/types.ts +5 -5
  112. package/PageLoadIndicator/PageLoadIndicator.tsx +3 -2
  113. package/PageMeta/PageMeta.tsx +3 -2
  114. package/PageMeta/canonicalize.ts +7 -3
  115. package/Pagination/Pagination.tsx +4 -2
  116. package/Pagination/PaginationExtended.tsx +2 -9
  117. package/RenderType/RenderType.tsx +6 -0
  118. package/Row/ButtonLinkList/ButtonLinkList.tsx +4 -7
  119. package/Row/ButtonLinkList/ButtonLinkListItem.tsx +2 -1
  120. package/Row/ColumnOne/variant/VariantMessage.tsx +2 -4
  121. package/Row/ColumnOneBoxed/ColumnOneBoxed.tsx +4 -2
  122. package/Row/ColumnOneCentered/ColumnOneCentered.tsx +4 -2
  123. package/Row/ColumnThree/ColumnThree.tsx +6 -5
  124. package/Row/ColumnTwo/ColumnTwo.tsx +8 -7
  125. package/Row/ColumnTwoSpread/ColumnTwoSpread.tsx +7 -5
  126. package/Row/ColumnTwoWithTop/ColumnTwoWithTop.tsx +5 -4
  127. package/Row/ContentLinks/ContentLinks.tsx +4 -3
  128. package/Row/HeroBanner/HeroBanner.tsx +3 -2
  129. package/Row/IconBlocks/IconBlock.tsx +3 -2
  130. package/Row/IconBlocks/IconBlocks.tsx +3 -2
  131. package/Row/ImageText/ImageText.tsx +3 -2
  132. package/Row/ImageTextBoxed/ImageTextBoxed.tsx +4 -3
  133. package/Row/ParagraphWithSidebarSlide/ParagraphWithSidebarSlide.tsx +3 -2
  134. package/Row/Quote/Quote.tsx +1 -1
  135. package/Row/Row.tsx +2 -1
  136. package/Row/RowLinks/RowLinks.tsx +36 -34
  137. package/Row/RowLinks/variant/VariantImageLabelSwiper.tsx +6 -2
  138. package/Row/RowLinks/variant/VariantInline.tsx +6 -2
  139. package/Row/RowLinks/variant/VariantLogoSwiper.tsx +2 -1
  140. package/Row/RowLinks/variant/VariantUsps.tsx +2 -1
  141. package/Row/SpecialBanner/SpecialBanner.tsx +3 -2
  142. package/SectionContainer/SectionContainer.tsx +3 -2
  143. package/SectionHeader/SectionHeader.tsx +2 -1
  144. package/Separator/Separator.tsx +3 -2
  145. package/Snackbar/DismissibleSnackbar.tsx +1 -1
  146. package/Snackbar/ErrorSnackbar.tsx +1 -1
  147. package/Snackbar/MessageSnackbarImpl.tsx +7 -16
  148. package/StarRatingField/StarRatingField.tsx +3 -2
  149. package/Stepper/Stepper.tsx +3 -2
  150. package/Styles/__tests__/spreadVal.test.ts +4 -4
  151. package/Styles/extendableComponent.ts +4 -3
  152. package/Styles/withEmotionCache.tsx +2 -2
  153. package/Styles/withTheme.tsx +4 -1
  154. package/TextInputNumber/TextInputNumber.tsx +5 -8
  155. package/Theme/DarkLightModeThemeProvider.tsx +10 -7
  156. package/Theme/MuiButton.ts +2 -1
  157. package/Theme/MuiChip.ts +2 -1
  158. package/Theme/MuiFab.ts +2 -1
  159. package/Theme/MuiSlider.ts +3 -3
  160. package/Theme/MuiSnackbar.ts +1 -1
  161. package/Theme/NextLink.tsx +35 -15
  162. package/Theme/createTheme.ts +6 -0
  163. package/Theme/index.ts +1 -0
  164. package/Theme/themeDefaults.ts +10 -10
  165. package/Theme/useContainerSizing.ts +20 -0
  166. package/TimeAgo/TimeAgo.tsx +3 -3
  167. package/ToggleButton/ToggleButton.tsx +6 -4
  168. package/ToggleButtonGroup/ToggleButtonGroup.tsx +99 -94
  169. package/UspList/UspList.tsx +3 -2
  170. package/UspList/UspListItem.tsx +3 -2
  171. package/hooks/memoDeep.ts +3 -2
  172. package/hooks/useDateTimeFormat.ts +3 -1
  173. package/hooks/useMatchMedia.ts +2 -1
  174. package/hooks/useMemoDeep.ts +2 -1
  175. package/hooks/useNumberFormat.ts +3 -1
  176. package/index.ts +3 -1
  177. package/package.json +17 -18
  178. package/utils/cookie.ts +4 -3
  179. package/utils/robots.ts +1 -1
  180. package/utils/sitemap.ts +3 -2
  181. package/utils/sxx.ts +16 -0
  182. package/AnimatedRow/AnimatedRow.tsx +0 -23
  183. package/docs/building-components.mdx +0 -3
  184. package/docs/components/ComponentBasic.tsx +0 -26
  185. package/docs/components/ComponentChild.tsx +0 -49
  186. package/docs/components/ComponentChildVariant.tsx +0 -55
  187. package/docs/components/ComponentChildVariantExtendable.tsx +0 -63
  188. package/docs/components/ComponentStylable.tsx +0 -32
  189. package/docs/pages/building-components.tsx +0 -62
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- import { Box, ToggleButtonGroupProps as ToggleButtonGroupPropsBase } from '@mui/material'
2
+ import type { ToggleButtonGroupProps as ToggleButtonGroupPropsBase } from '@mui/material'
3
+ import { Box } from '@mui/material'
3
4
  import React from 'react'
4
5
  import { isFragment } from 'react-is'
5
6
  import { extendableComponent } from '../Styles'
@@ -12,112 +13,116 @@ function isValueSelected(value: string, candidate: string | string[]) {
12
13
 
13
14
  type OwnerState = Pick<ToggleButtonGroupPropsBase, 'orientation' | 'size'>
14
15
 
15
- const name = 'ToggleButtonGroup' as const
16
+ const name = 'ToggleButtonGroup'
16
17
  const parts = ['root', 'button'] as const
17
18
  const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
18
19
 
19
20
  export type ToggleButtonGroupProps = ToggleButtonGroupPropsBase & { required?: boolean }
20
21
 
21
- const ToggleButtonGroup = React.forwardRef<HTMLDivElement, ToggleButtonGroupProps>((props, ref) => {
22
- const {
23
- children,
24
- className,
25
- exclusive = false,
26
- required = false,
27
- onChange,
28
- orientation = 'horizontal',
29
- value,
30
- size = 'large',
31
- sx = [],
32
- ...other
33
- } = props
22
+ /** @deprecated @public */
23
+ export const ToggleButtonGroup = React.forwardRef<HTMLDivElement, ToggleButtonGroupProps>(
24
+ (props, ref) => {
25
+ const {
26
+ children,
27
+ className,
28
+ exclusive = false,
29
+ required = false,
30
+ onChange,
31
+ orientation = 'horizontal',
32
+ value,
33
+ size = 'large',
34
+ sx = [],
35
+ ...other
36
+ } = props
34
37
 
35
- const classes = withState({ orientation, size })
38
+ const classes = withState({ orientation, size })
36
39
 
37
- const handleChange = (event: React.MouseEvent<HTMLElement, MouseEvent>, buttonValue: unknown) => {
38
- if (!onChange) return
40
+ const handleChange = (
41
+ event: React.MouseEvent<HTMLElement, MouseEvent>,
42
+ buttonValue: unknown,
43
+ ) => {
44
+ if (!onChange) return
39
45
 
40
- const index = Boolean(value) && (value.indexOf(buttonValue) as number)
41
- let newValue: string[]
46
+ const index = Boolean(value) && (value.indexOf(buttonValue) as number)
47
+ let newValue: string[]
42
48
 
43
- if (value && index && index >= 0) {
44
- newValue = value.slice()
45
- newValue.splice(index, 1)
46
- } else {
47
- newValue = value ? [...value, buttonValue] : [buttonValue]
49
+ if (value && index && index >= 0) {
50
+ newValue = value.slice()
51
+ newValue.splice(index, 1)
52
+ } else {
53
+ newValue = value ? [...value, buttonValue] : [buttonValue]
54
+ }
55
+ onChange(event, newValue)
48
56
  }
49
- onChange(event, newValue)
50
- }
51
57
 
52
- const handleExclusiveChange = (
53
- event: React.MouseEvent<HTMLElement, MouseEvent>,
54
- buttonValue: unknown,
55
- ) => {
56
- if (!onChange || value === buttonValue) return
57
- if (required) onChange(event, buttonValue)
58
- else onChange(event, value === buttonValue ? null : buttonValue)
59
- }
58
+ const handleExclusiveChange = (
59
+ event: React.MouseEvent<HTMLElement, MouseEvent>,
60
+ buttonValue: unknown,
61
+ ) => {
62
+ if (!onChange || value === buttonValue) return
63
+ if (required) onChange(event, buttonValue)
64
+ else onChange(event, value === buttonValue ? null : buttonValue)
65
+ }
60
66
 
61
- return (
62
- <Box
63
- role='group'
64
- className={`${classes.root} ${className ?? ''}`}
65
- sx={[
66
- (theme) => ({
67
- rowGap: theme.spacings.xxs,
68
- columnGap: theme.spacings.xs,
69
- '&.orientationVertical': {
70
- gridAutoFlow: 'column',
71
- },
72
- '&.sizeSmall.orientationHorizontal': {
73
- display: 'flex',
74
- flexWrap: 'wrap',
75
- rowGap: '8px',
76
- columnGap: '8px',
77
- },
78
- '&.sizeMedium.orientationHorizontal': {
79
- display: 'grid',
80
- gridTemplateColumns: 'repeat(2, 1fr)',
81
- },
82
- '&.sizeLarge.orientationHorizontal': {
83
- display: 'grid',
84
- gridTemplateColumns: 'repeat(2, 1fr)',
85
- },
86
- }),
87
- ...(Array.isArray(sx) ? sx : [sx]),
88
- ]}
89
- ref={ref}
90
- {...other}
91
- >
92
- {React.Children.map(children, (child) => {
93
- if (!React.isValidElement(child)) return null
67
+ return (
68
+ <Box
69
+ role='group'
70
+ className={`${classes.root} ${className ?? ''}`}
71
+ sx={[
72
+ (theme) => ({
73
+ rowGap: theme.spacings.xxs,
74
+ columnGap: theme.spacings.xs,
75
+ '&.orientationVertical': {
76
+ gridAutoFlow: 'column',
77
+ },
78
+ '&.sizeSmall.orientationHorizontal': {
79
+ display: 'flex',
80
+ flexWrap: 'wrap',
81
+ rowGap: '8px',
82
+ columnGap: '8px',
83
+ },
84
+ '&.sizeMedium.orientationHorizontal': {
85
+ display: 'grid',
86
+ gridTemplateColumns: 'repeat(2, 1fr)',
87
+ },
88
+ '&.sizeLarge.orientationHorizontal': {
89
+ display: 'grid',
90
+ gridTemplateColumns: 'repeat(2, 1fr)',
91
+ },
92
+ }),
93
+ ...(Array.isArray(sx) ? sx : [sx]),
94
+ ]}
95
+ ref={ref}
96
+ {...other}
97
+ >
98
+ {React.Children.map(children, (child) => {
99
+ if (!React.isValidElement(child)) return null
94
100
 
95
- if (process.env.NODE_ENV !== 'production') {
96
- if (isFragment(child)) {
97
- console.error(
98
- [
99
- "@graphcommerce/next-ui: The ToggleButtonGroup component doesn't accept a Fragment as a child.",
100
- 'Consider providing an array instead.',
101
- ].join('\n'),
102
- )
101
+ if (process.env.NODE_ENV !== 'production') {
102
+ if (isFragment(child)) {
103
+ console.error(
104
+ [
105
+ "@graphcommerce/next-ui: The ToggleButtonGroup component doesn't accept a Fragment as a child.",
106
+ 'Consider providing an array instead.',
107
+ ].join('\n'),
108
+ )
109
+ }
103
110
  }
104
- }
105
111
 
106
- return React.cloneElement(child, {
107
- // @ts-ignore
108
- className: `${classes.button} ${child.props.className ?? ''}`,
109
- onChange: exclusive ? handleExclusiveChange : handleChange,
110
- selected:
112
+ return React.cloneElement(child, {
111
113
  // @ts-ignore
112
- child.props.selected === undefined
113
- ? // @ts-ignore
114
- isValueSelected(child.props.value as string, value as string | string[])
115
- : // @ts-ignore
116
- child.props.selected,
117
- })
118
- })}
119
- </Box>
120
- )
121
- })
122
-
123
- export { ToggleButtonGroup }
114
+ className: `${classes.button} ${child.props.className ?? ''}`,
115
+ onChange: exclusive ? handleExclusiveChange : handleChange,
116
+ selected:
117
+ // @ts-ignore
118
+ child.props.selected === undefined
119
+ ? // @ts-ignore
120
+ isValueSelected(child.props.value as string, value as string | string[])
121
+ : // @ts-ignore
122
+ child.props.selected,
123
+ })
124
+ })}
125
+ </Box>
126
+ )
127
+ },
128
+ )
@@ -1,4 +1,5 @@
1
- import { Box, SxProps, Theme } from '@mui/material'
1
+ import type { SxProps, Theme } from '@mui/material'
2
+ import { Box } from '@mui/material'
2
3
  import { extendableComponent } from '../Styles'
3
4
 
4
5
  export type UspListProps = OwnerState & {
@@ -7,7 +8,7 @@ export type UspListProps = OwnerState & {
7
8
  }
8
9
 
9
10
  type OwnerState = { size?: 'small' | 'medium' }
10
- const name = 'UspList' as const
11
+ const name = 'UspList'
11
12
  const parts = ['root'] as const
12
13
  const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
13
14
 
@@ -1,4 +1,5 @@
1
- import { Box, SxProps, Theme } from '@mui/material'
1
+ import type { SxProps, Theme } from '@mui/material'
2
+ import { Box } from '@mui/material'
2
3
  import { extendableComponent } from '../Styles'
3
4
  import { responsiveVal } from '../Styles/responsiveVal'
4
5
 
@@ -9,7 +10,7 @@ export type UspListItemProps = {
9
10
  } & OwnerState
10
11
 
11
12
  type OwnerState = { size?: 'small' | 'medium' }
12
- const name = 'UspListItem' as const
13
+ const name = 'UspListItem'
13
14
  const parts = ['root', 'icon', 'text'] as const
14
15
  const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
15
16
 
package/hooks/memoDeep.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // eslint-disable-next-line import/no-extraneous-dependencies
2
2
  import { equal } from '@wry/equality'
3
- import { FunctionComponent, memo, NamedExoticComponent } from 'react'
3
+ import type { FunctionComponent, NamedExoticComponent } from 'react'
4
+ import { memo } from 'react'
4
5
 
5
6
  /**
6
7
  * This is a deep comparison version of React's `memo` function.
@@ -23,7 +24,7 @@ export function memoDeep<P extends object>(
23
24
 
24
25
  if (ms < 0.2) return result
25
26
 
26
- console.log(`memoDeep took more than 0.2ms`, {
27
+ console.warn('memoDeep took more than 0.2ms', {
27
28
  result,
28
29
  ms,
29
30
  Component,
@@ -2,7 +2,9 @@ import { useMemo } from 'react'
2
2
  import { useLocale } from './useLocale'
3
3
 
4
4
  /**
5
- * @deprecated use <DateFormat/>, <TimeFormat/> or <DateTimeFormat/> instead
5
+ * @deprecated Use <DateFormat/>, <TimeFormat/> or <DateTimeFormat/> or useIntlDateTimeFormat()
6
+ * instead
7
+ * @public
6
8
  */
7
9
  export function useDateTimeFormat(props?: Intl.DateTimeFormatOptions) {
8
10
  const locale = useLocale()
@@ -1,4 +1,5 @@
1
- import { Breakpoint, useTheme } from '@mui/material'
1
+ import type { Breakpoint } from '@mui/material'
2
+ import { useTheme } from '@mui/material'
2
3
  import { useMotionValue } from 'framer-motion'
3
4
  import { useEffect, useMemo } from 'react'
4
5
 
@@ -1,6 +1,7 @@
1
1
  // eslint-disable-next-line import/no-extraneous-dependencies
2
2
  import { equal } from '@wry/equality'
3
- import { DependencyList, useMemo, useRef } from 'react'
3
+ import type { DependencyList } from 'react'
4
+ import { useMemo, useRef } from 'react'
4
5
 
5
6
  export function useMemoDeep<T>(factory: () => T, deps: DependencyList | undefined): T {
6
7
  const ref = useRef<DependencyList | undefined>(undefined)
@@ -2,7 +2,9 @@ import { useMemo } from 'react'
2
2
  import { useLocale } from './useLocale'
3
3
 
4
4
  /**
5
- * @deprecated use <NumberFormat />, <PercentFormat /> or <UnitFormat /> instead
5
+ * @deprecated Use <NumberFormat />, <PercentFormat /> or <UnitFormat /> or useIntlNumberFormat()
6
+ * instead
7
+ * @public
6
8
  */
7
9
  export function useNumberFormat(props?: Intl.NumberFormatOptions) {
8
10
  const locale = useLocale()
package/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './ActionCard'
2
- export * from './AnimatedRow/AnimatedRow'
3
2
  export * from './Blog/BlogAuthor/BlogAuthor'
4
3
  export * from './Blog/BlogContent/BlogContent'
5
4
  export * from './Blog/BlogHeader/BlogHeader'
@@ -34,6 +33,7 @@ export * from './LayoutDefault'
34
33
  export * from './LayoutOverlay'
35
34
  export * from './LayoutParts'
36
35
  export * from './LazyHydrate'
36
+ export * from './MediaQuery'
37
37
  export * from './Navigation'
38
38
  export * from './Overlay'
39
39
  export * from './OverlayOrPopperChip'
@@ -68,3 +68,5 @@ export * from './utils/normalizeLocale'
68
68
  export * from './utils/robots'
69
69
  export * from './utils/sitemap'
70
70
  export * from './utils/storefrontConfig'
71
+ export * from './utils/sxx'
72
+ export * from './Container/Container'
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.0-canary.98",
5
+ "version": "9.0.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,34 +12,33 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@emotion/cache": "^11.11.0",
16
- "@emotion/react": "^11.11.4",
17
- "@emotion/server": "^11.11.0",
18
- "@emotion/styled": "^11.11.5",
19
- "cookie": "^0.6.0",
20
- "next-sitemap": "4.2.3",
15
+ "cookie": "^1.0.2",
21
16
  "react-is": "^18.3.1"
22
17
  },
23
18
  "devDependencies": {
24
- "@types/cookie": "^0.6.0",
25
- "@types/react-is": "^18.3.0",
26
- "typescript": "5.5.3"
19
+ "@types/react-is": "^18.3.1",
20
+ "typescript": "5.7.2"
27
21
  },
28
22
  "peerDependencies": {
29
- "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.98",
30
- "@graphcommerce/framer-next-pages": "^9.0.0-canary.98",
31
- "@graphcommerce/framer-scroller": "^9.0.0-canary.98",
32
- "@graphcommerce/framer-utils": "^9.0.0-canary.98",
33
- "@graphcommerce/image": "^9.0.0-canary.98",
34
- "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.98",
35
- "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.98",
23
+ "@emotion/cache": "^11",
24
+ "@emotion/react": "^11",
25
+ "@emotion/server": "^11",
26
+ "@emotion/styled": "^11",
27
+ "@graphcommerce/eslint-config-pwa": "^9.0.0",
28
+ "@graphcommerce/framer-next-pages": "^9.0.0",
29
+ "@graphcommerce/framer-scroller": "^9.0.0",
30
+ "@graphcommerce/framer-utils": "^9.0.0",
31
+ "@graphcommerce/image": "^9.0.0",
32
+ "@graphcommerce/prettier-config-pwa": "^9.0.0",
33
+ "@graphcommerce/typescript-config-pwa": "^9.0.0",
36
34
  "@lingui/core": "^4.2.1",
37
35
  "@lingui/macro": "^4.2.1",
38
36
  "@lingui/react": "^4.2.1",
39
37
  "@mui/lab": "^5.0.0-alpha.68",
40
38
  "@mui/material": "^5.10.16",
41
- "framer-motion": "^10.0.0",
39
+ "framer-motion": "^11.0.0",
42
40
  "next": "*",
41
+ "next-sitemap": "4.2.3",
43
42
  "react": "^18.2.0",
44
43
  "react-dom": "^18.2.0"
45
44
  }
package/utils/cookie.ts CHANGED
@@ -1,13 +1,14 @@
1
- import { serialize, parse, CookieSerializeOptions } from 'cookie'
1
+ import type { SerializeOptions } from 'cookie'
2
+ import { parse, serialize } from 'cookie'
2
3
 
3
4
  /** Read a cookie */
4
5
  export function cookie(name: string): string | undefined
5
6
  /** Set a cookie */
6
- export function cookie(name: string, value: string, options?: CookieSerializeOptions): void
7
+ export function cookie(name: string, value: string, options?: SerializeOptions): void
7
8
  /** Delete a cookie */
8
9
  export function cookie(name: string, value: null): void
9
10
  /** Function to handle the three different cases */
10
- export function cookie(name: string, value?: string | null, options?: CookieSerializeOptions) {
11
+ export function cookie(name: string, value?: string | null, options?: SerializeOptions) {
11
12
  if (typeof window === 'undefined') {
12
13
  return undefined
13
14
  }
package/utils/robots.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { GetServerSidePropsContext } from 'next'
1
+ import type { GetServerSidePropsContext } from 'next'
2
2
 
3
3
  type Stringifyable = boolean | string | number | null | undefined
4
4
 
package/utils/sitemap.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { GetServerSidePropsContext, GetStaticPathsResult } from 'next'
2
- import { getServerSideSitemapLegacy, ISitemapField } from 'next-sitemap'
1
+ import type { GetServerSidePropsContext, GetStaticPathsResult } from 'next'
2
+ import type { ISitemapField } from 'next-sitemap'
3
+ import { getServerSideSitemapLegacy } from 'next-sitemap'
3
4
  import { canonicalize } from '../PageMeta/canonicalize'
4
5
 
5
6
  export function excludeSitemap(excludes: string[]) {
package/utils/sxx.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { SxProps, Theme } from '@mui/material'
2
+
3
+ /**
4
+ * Concat an array of SxProps into a single SxProps.
5
+ *
6
+ * Each item in the array can be an array of Sx it's self:
7
+ *
8
+ * ```tsx
9
+ * sxx({ position: 'absolute', right: 0, top: 0 }, props.sx)
10
+ * ```
11
+ */
12
+ export const sxx = (...sxPropsArray: (SxProps<Theme> | undefined)[]): SxProps<Theme> =>
13
+ sxPropsArray
14
+ .filter((v) => v !== undefined)
15
+ .map((sx) => (Array.isArray(sx) ? sx : [sx]))
16
+ .flat(1)
@@ -1,23 +0,0 @@
1
- import { styled, SxProps, Theme } from '@mui/material'
2
- import { HTMLMotionProps, m } from 'framer-motion'
3
- import { ReactHTML } from 'react'
4
-
5
- export type AnimatedRowProps = Omit<
6
- ReactHTML['div'] & HTMLMotionProps<'div'>,
7
- 'initial' | 'animate' | 'exit' | 'transition'
8
- > & { sx?: SxProps<Theme> }
9
-
10
- const StyledDiv = styled(m.div)({})
11
-
12
- /** @deprecated Should be replaced with Box component */
13
- export function AnimatedRow(props: AnimatedRowProps) {
14
- return (
15
- <StyledDiv
16
- {...props}
17
- initial={{ opacity: 0, height: 'auto' }}
18
- animate={{ opacity: 1, height: 'auto' }}
19
- exit={{ opacity: 0, height: 0 }}
20
- transition={{ type: 'tween' }}
21
- />
22
- )
23
- }
@@ -1,3 +0,0 @@
1
- # Building components
2
-
3
- If you are looking to style components, please take a look at.
@@ -1,26 +0,0 @@
1
- import { styled } from '@mui/material'
2
- import React from 'react'
3
-
4
- // ---- Root component ----
5
-
6
- // We're creating a new styled('div') component and apply our styles to it.
7
- const Root = styled('div')(({ theme }) => ({
8
- padding: '3px',
9
- display: 'flex',
10
- color: theme.palette.text.primary,
11
- }))
12
-
13
- // ---- MyComponent component ----
14
-
15
- // Props of the component we are writing
16
- export type MyComponentProps = { children: React.ReactNode }
17
-
18
- export function MyComponent(props: MyComponentProps) {
19
- const { children } = props
20
- return (
21
- <Root as='span'>
22
- My Component
23
- {children}
24
- </Root>
25
- )
26
- }
@@ -1,49 +0,0 @@
1
- /* eslint-disable import/no-extraneous-dependencies */
2
- import { extendableComponent } from '@graphcommerce/next-ui'
3
- import { styled } from '@mui/material'
4
- import { ComponentProps } from 'react'
5
-
6
- // ---- Setup ----
7
-
8
- // To be able to select children from the consuming side, we define the classes.
9
- // Minimal utility to convert the classes to selectors. Hover over `selectors` to see what it means.
10
- const componentName = 'MyComponent' as const
11
- const { classes, selectors } = extendableComponent(componentName, ['root', 'child'] as const)
12
-
13
- // ---- Root component ----
14
-
15
- // We're creating a new styled('div') component and apply our styles to it.
16
- const Root = styled('div', {
17
- name: componentName,
18
- target: classes.root,
19
- })(({ theme }) => ({
20
- display: 'flex',
21
- color: theme.palette.text.primary,
22
- }))
23
-
24
- // ---- Child component ----
25
-
26
- const Child = styled('div', {
27
- name: componentName,
28
- target: classes.child,
29
- })(({ theme }) => ({
30
- backgroundColor: theme.palette.primary.main,
31
- width: 100,
32
- height: 100,
33
- }))
34
-
35
- // ---- MyComponent component ----
36
-
37
- // Props of the component we are writing
38
- export type MyComponentProps = Pick<ComponentProps<typeof Root>, 'sx' | 'children'>
39
-
40
- export function MyComponent(props: MyComponentProps) {
41
- const { sx, children } = props
42
- return (
43
- <Root as='span' sx={sx}>
44
- My Component
45
- <Child>{children}</Child>
46
- </Root>
47
- )
48
- }
49
- MyComponent.selectors = selectors
@@ -1,55 +0,0 @@
1
- /* eslint-disable import/no-extraneous-dependencies */
2
- import { extendableComponent } from '@graphcommerce/next-ui'
3
- import { styled } from '@mui/material'
4
- import { ComponentProps } from 'react'
5
-
6
- // ---- Setup ----
7
-
8
- // To be able to select children from the consuming side, we define the classes.
9
- // Minimal utility to convert the classes to selectors. Hover over `selectors` to see what it means.
10
- const componentName = 'MyComponent' as const
11
- const { classes, selectors } = extendableComponent(componentName, ['root', 'child'] as const)
12
-
13
- // Props that are used in our styled elements to render different CSS
14
- type MyComponentStyleProps = { variant?: 'cool' | 'supercool' }
15
-
16
- // ---- Root component ----
17
-
18
- // We're creating a new styled('div') component and apply our styles to it.
19
- const Root = styled('div', {
20
- name: componentName,
21
- target: classes.root,
22
- })<MyComponentStyleProps>(({ theme }) => ({
23
- // Styles are added
24
- display: 'flex',
25
- color: theme.palette.text.primary,
26
- }))
27
-
28
- // ---- Child component ----
29
-
30
- const Child = styled('div', {
31
- name: componentName,
32
- target: classes.child, // Mandatory for children, adds a class name `MyComponent-child` so it can be styled from the outside.
33
- })<MyComponentStyleProps>(({ theme, variant }) => ({
34
- backgroundColor: theme.palette.primary.main,
35
- width: 100,
36
- height: 100,
37
- fontSize: variant === 'supercool' ? 'large' : 'normal',
38
- }))
39
-
40
- // ---- MyComponent component ----
41
-
42
- // Props of the component we are writing
43
- export type MyComponentProps = Pick<ComponentProps<typeof Root>, 'sx' | 'children'> &
44
- MyComponentStyleProps
45
-
46
- export function MyComponent(props: MyComponentProps) {
47
- const { sx, children, variant } = props
48
- return (
49
- <Root as='span' sx={sx} variant={variant}>
50
- My Component <Child variant={variant}>{children}</Child>
51
- </Root>
52
- )
53
- }
54
-
55
- MyComponent.selectors = selectors