diff --git a/packages/wethegit-components-cli/CHANGELOG.md b/packages/wethegit-components-cli/CHANGELOG.md index f999f45d..48134d54 100644 --- a/packages/wethegit-components-cli/CHANGELOG.md +++ b/packages/wethegit-components-cli/CHANGELOG.md @@ -1,5 +1,12 @@ # @wethegit/components-cli +## 3.0.8 + +### Patch Changes + +- Updated dependencies [d9b8ddd] + - @wethegit/components@2.3.10 + ## 3.0.7 ### Patch Changes diff --git a/packages/wethegit-components-cli/package.json b/packages/wethegit-components-cli/package.json index 6dacb753..859d7034 100644 --- a/packages/wethegit-components-cli/package.json +++ b/packages/wethegit-components-cli/package.json @@ -1,6 +1,6 @@ { "name": "@wethegit/components-cli", - "version": "3.0.7", + "version": "3.0.8", "type": "module", "license": "MIT", "exports": "./dist/index.js", @@ -46,6 +46,6 @@ "ts-morph": "^22.0.0" }, "peerDependencies": { - "@wethegit/components": "2.3.9" + "@wethegit/components": "2.3.10" } } diff --git a/packages/wethegit-components/CHANGELOG.md b/packages/wethegit-components/CHANGELOG.md index c3780120..842c9499 100644 --- a/packages/wethegit-components/CHANGELOG.md +++ b/packages/wethegit-components/CHANGELOG.md @@ -1,5 +1,11 @@ # @wethegit/components +## 2.3.10 + +### Patch Changes + +- d9b8ddd: fix: updates inView to latest version + ## 2.3.9 ### Patch Changes diff --git a/packages/wethegit-components/package.json b/packages/wethegit-components/package.json index 84987d92..605e383c 100644 --- a/packages/wethegit-components/package.json +++ b/packages/wethegit-components/package.json @@ -1,6 +1,6 @@ { "name": "@wethegit/components", - "version": "2.3.9", + "version": "2.3.10", "main": "./src/index.ts", "sideEffects": false, "license": "MIT", @@ -29,7 +29,7 @@ "typecheck": "tsc --noEmit" }, "peerDependencies": { - "@wethegit/react-hooks": "^2.0.0", + "@wethegit/react-hooks": "^3.0.1", "@wethegit/react-modal": "^2.0.0", "react": "17 - 18", "react-dom": "17 - 18", @@ -56,7 +56,7 @@ "@storybook/addon-themes": "^8.1.5", "@storybook/manager-api": "^8.1.5", "@storybook/theming": "^8.1.5", - "@wethegit/react-hooks": "^2.0.0", + "@wethegit/react-hooks": "^3.0.1", "@wethegit/react-modal": "^2.0.0", "eslint": "^8.15.0", "eslint-config-custom": "*", diff --git a/packages/wethegit-components/src/components/in-view/components/in-view-item/in-view-item.tsx b/packages/wethegit-components/src/components/in-view/components/in-view-item/in-view-item.tsx index 6b474fca..a51baa84 100644 --- a/packages/wethegit-components/src/components/in-view/components/in-view-item/in-view-item.tsx +++ b/packages/wethegit-components/src/components/in-view/components/in-view-item/in-view-item.tsx @@ -1,8 +1,7 @@ import { useContext, useMemo } from "react" -import { Tag } from "@local/components" +import { Tag, InViewContext } from "@local/components" import type { TagProps } from "@local/components" -import { InViewContext } from "@local/components/in-view" import { classnames, fixedForwardRef } from "@local/utilities" import type { diff --git a/packages/wethegit-components/src/components/in-view/in-view.stories.tsx b/packages/wethegit-components/src/components/in-view/in-view.stories.tsx index 01db62b6..f59542dc 100644 --- a/packages/wethegit-components/src/components/in-view/in-view.stories.tsx +++ b/packages/wethegit-components/src/components/in-view/in-view.stories.tsx @@ -8,10 +8,9 @@ const meta: Meta = { title: "components/in-view/Example usage", component: InView, args: { - threshold: 0.3, + observerOptions: 0.3, once: false, setInViewIfScrolledPast: false, - matchRootMarginToThreshold: true, }, decorators: [ (Story) => ( diff --git a/packages/wethegit-components/src/components/in-view/in-view.tsx b/packages/wethegit-components/src/components/in-view/in-view.tsx index eaea107d..8fc23055 100644 --- a/packages/wethegit-components/src/components/in-view/in-view.tsx +++ b/packages/wethegit-components/src/components/in-view/in-view.tsx @@ -1,10 +1,12 @@ -import { createContext, ElementType, useMemo } from "react" +"use client" + +import { createContext, ElementType } from "react" import { useInView } from "@wethegit/react-hooks" import { Tag } from "@local/components" import type { TagProps } from "@local/components" -export type InViewContext = { +export type InViewContextReturn = { isInView: boolean domNode: HTMLElement | undefined } @@ -12,52 +14,36 @@ export type InViewContext = { export type InViewProps = TagProps & { /** * Percentage of the entry within the viewport for it to be considered in - * view; a number between 0 and 1. + * view; a number between 0 and 1. Also accepts an IntersectionObserver options + * object. */ - threshold?: number + observerOptions?: number | IntersectionObserverInit /** - * Unobserve the entry once it is considered to be in view. + * Whether to detach the observer from the DOM element after the first + * intersection callback is invoked. */ once?: boolean /** - * Consider the entry "in view" if it is above the viewport when the page loads - * initially. This is most often used for ensuring that content is already - * animated in, when loading a document from a scroll position other than the top. + * Whether to consider the element already "in-view", if it is already scrolled + * beyond the bounds of the viewport when the element is mounted. */ setInViewIfScrolledPast?: boolean - /** - * Ensure that the entry remains in view until it fully exits the viewport, - * regardless of the threshold. Note that this will not have any effect within - * an `