@graphcommerce/next-ui 9.0.0-canary.74 → 9.0.0-canary.76

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,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.0-canary.76
4
+
5
+ ## 9.0.0-canary.75
6
+
7
+ ### Patch Changes
8
+
9
+ - [#2348](https://github.com/graphcommerce-org/graphcommerce/pull/2348) [`61b66ef`](https://github.com/graphcommerce-org/graphcommerce/commit/61b66efeab9b377c8daa322015d4b55cdf3db4c1) - Added a new OverlayHeader component to be used in combination with the Overlay component. ([@JoshuaS98](https://github.com/JoshuaS98))
10
+
3
11
  ## 9.0.0-canary.74
4
12
 
5
13
  ## 9.0.0-canary.73
@@ -6,18 +6,24 @@ import { IconSvg, useIconSvgSize } from '../../IconSvg'
6
6
  import { useFabSize } from '../../Theme'
7
7
  import { iconClose } from '../../icons'
8
8
 
9
+ type LayoutHeaderCloseProps = {
10
+ onClose?: () => void
11
+ }
12
+
9
13
  export function useShowClose() {
10
14
  const { overlayGroup } = usePageContext()
11
15
  return !!overlayGroup
12
16
  }
13
17
 
14
- export function LayoutHeaderClose() {
18
+ export function LayoutHeaderClose(props: LayoutHeaderCloseProps) {
19
+ const { onClose } = props
15
20
  const { closeSteps } = usePageContext()
16
21
  const [disabled, setDisabled] = useState(false)
17
22
  const go = useGo(closeSteps * -1)
18
23
  const onClick = () => {
19
24
  setDisabled(true)
20
- go()
25
+
26
+ return onClose ? onClose() : go()
21
27
  }
22
28
 
23
29
  const fabSize = useFabSize('responsive')
@@ -0,0 +1,27 @@
1
+ import { LayoutHeaderProps, LayoutTitle, TitleProps } from '../../Layout'
2
+ import { LayoutHeaderClose } from '../../Layout/components/LayoutHeaderClose'
3
+ import { LayoutOverlayHeader } from '../../LayoutOverlay/components/LayoutOverlayHeader'
4
+
5
+ type OverlayHeaderProps = Omit<LayoutHeaderProps, 'hideBackButton' | 'switchPoint'> &
6
+ Pick<TitleProps, 'icon'> & { onClose: () => void }
7
+
8
+ export const OverlayHeader = (props: OverlayHeaderProps) => {
9
+ const { children, onClose, sx = [], icon, primary, secondary, ...rest } = props
10
+
11
+ return (
12
+ <LayoutOverlayHeader
13
+ noAlign
14
+ sx={[{ '&.noAlign': { mb: 0 } }, ...(Array.isArray(sx) ? sx : [sx])]}
15
+ switchPoint={-10000}
16
+ size='small'
17
+ hideBackButton
18
+ primary={primary ?? <LayoutHeaderClose onClose={onClose} />}
19
+ secondary={primary ? <LayoutHeaderClose onClose={onClose} /> : secondary}
20
+ {...rest}
21
+ >
22
+ <LayoutTitle size='small' component='span' icon={icon}>
23
+ {children}
24
+ </LayoutTitle>
25
+ </LayoutOverlayHeader>
26
+ )
27
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './OverlayBase'
2
2
  export * from './Overlay'
3
3
  export * from './OverlayStickyBottom'
4
+ export * from './OverlayHeader'
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.74",
5
+ "version": "9.0.0-canary.76",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -26,13 +26,13 @@
26
26
  "typescript": "5.5.3"
27
27
  },
28
28
  "peerDependencies": {
29
- "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.74",
30
- "@graphcommerce/framer-next-pages": "^9.0.0-canary.74",
31
- "@graphcommerce/framer-scroller": "^9.0.0-canary.74",
32
- "@graphcommerce/framer-utils": "^9.0.0-canary.74",
33
- "@graphcommerce/image": "^9.0.0-canary.74",
34
- "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.74",
35
- "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.74",
29
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.76",
30
+ "@graphcommerce/framer-next-pages": "^9.0.0-canary.76",
31
+ "@graphcommerce/framer-scroller": "^9.0.0-canary.76",
32
+ "@graphcommerce/framer-utils": "^9.0.0-canary.76",
33
+ "@graphcommerce/image": "^9.0.0-canary.76",
34
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.76",
35
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.76",
36
36
  "@lingui/core": "^4.2.1",
37
37
  "@lingui/macro": "^4.2.1",
38
38
  "@lingui/react": "^4.2.1",