@heliosgraphics/ui 2.0.0-alpha.86 → 2.0.0-alpha.87

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.
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
 
3
3
  import { Masonry as MasonryPlock } from "react-plock"
4
- import { Children, type ReactElement, type ReactNode, type FC } from "react"
4
+ import { Children, type ReactElement, type FC } from "react"
5
5
  import type { MasonryProps } from "./Masonry.types"
6
6
 
7
7
  export const Masonry: FC<MasonryProps> = ({ children, columns, gap, brakepoints, useBalancedLayout }) => {
@@ -12,7 +12,8 @@ export const Masonry: FC<MasonryProps> = ({ children, columns, gap, brakepoints,
12
12
  return (
13
13
  <MasonryPlock
14
14
  items={mappedChildren}
15
- render={(item: ReactElement): ReactNode => item}
15
+ // @ts-expect-error react-plock render type mismatch with React 19 ReactNode
16
+ render={(item) => item}
16
17
  config={{
17
18
  columns: columns,
18
19
  gap: gap,
@@ -4,12 +4,20 @@ import { useContext } from "react"
4
4
  import { LayoutContext } from "../contexts/LayoutContext"
5
5
  import type { LayoutContextProps } from "../contexts/LayoutContext"
6
6
 
7
+ const DEFAULT_LAYOUT_CONTEXT: LayoutContextProps = {
8
+ asideRef: { current: null },
9
+ hasMounted: false,
10
+ isMenuVisible: false,
11
+ isWideEnough: false,
12
+ onAsideClose: () => {},
13
+ onNavigationToggle: () => {},
14
+ shouldShowNavigation: false,
15
+ }
16
+
7
17
  export const useLayoutContext = (): LayoutContextProps => {
8
18
  const context = useContext(LayoutContext)
9
19
 
10
- if (!context) {
11
- throw new Error("useLayoutContext must be used within a LayoutProvider")
12
- }
20
+ if (!context) return DEFAULT_LAYOUT_CONTEXT
13
21
 
14
22
  return context
15
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heliosgraphics/ui",
3
- "version": "2.0.0-alpha.86",
3
+ "version": "2.0.0-alpha.87",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "author": "Chris Puska <chris@puska.org>",