diff --git a/.changeset/tooltip-shared-use-id.md b/.changeset/tooltip-shared-use-id.md new file mode 100644 index 0000000..6e956c4 --- /dev/null +++ b/.changeset/tooltip-shared-use-id.md @@ -0,0 +1,5 @@ +--- +"@sipe-team/tooltip": patch +--- + +Source Tooltip's internal `id` from `@sipe-team/hooks`'s `useId` instead of calling React's `useId` directly. Behavior is unchanged aside from the generated id now carrying a `side-` prefix. diff --git a/packages/tooltip/package.json b/packages/tooltip/package.json index 34ca0a7..af2d4a9 100644 --- a/packages/tooltip/package.json +++ b/packages/tooltip/package.json @@ -22,6 +22,7 @@ }, "dependencies": { "@radix-ui/react-slot": "catalog:", + "@sipe-team/hooks": "workspace:*", "@sipe-team/tokens": "workspace:*", "@vanilla-extract/recipes": "catalog:", "clsx": "catalog:" diff --git a/packages/tooltip/src/Tooltip.tsx b/packages/tooltip/src/Tooltip.tsx index 99a29dc..7fec179 100644 --- a/packages/tooltip/src/Tooltip.tsx +++ b/packages/tooltip/src/Tooltip.tsx @@ -6,12 +6,13 @@ import { forwardRef, type ReactNode, useEffect, - useId, useImperativeHandle, useState, } from 'react'; import { createPortal } from 'react-dom'; +import { useId } from '@sipe-team/hooks'; + import { Slot } from '@radix-ui/react-slot'; import clsx from 'clsx'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0fc1073..9a56251 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1205,6 +1205,9 @@ importers: '@radix-ui/react-slot': specifier: 'catalog:' version: 1.1.0(@types/react@18.3.13)(react@18.3.1) + '@sipe-team/hooks': + specifier: workspace:* + version: link:../hooks '@sipe-team/tokens': specifier: workspace:* version: link:../tokens