diff --git a/.changeset/radio-shared-use-id.md b/.changeset/radio-shared-use-id.md new file mode 100644 index 0000000..7b0a700 --- /dev/null +++ b/.changeset/radio-shared-use-id.md @@ -0,0 +1,5 @@ +--- +"@sipe-team/radio": patch +--- + +Source Radio's and RadioGroup's internal `id`/`name` fallback 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/radio/package.json b/packages/radio/package.json index ef15b4e..ca32ec5 100644 --- a/packages/radio/package.json +++ b/packages/radio/package.json @@ -21,6 +21,7 @@ "clean": "rm -rf node_modules dist" }, "dependencies": { + "@sipe-team/hooks": "workspace:*", "@sipe-team/tokens": "workspace:*", "@sipe-team/typography": "workspace:*", "@vanilla-extract/recipes": "catalog:", diff --git a/packages/radio/src/Radio.tsx b/packages/radio/src/Radio.tsx index eb4ae2d..826b8a7 100644 --- a/packages/radio/src/Radio.tsx +++ b/packages/radio/src/Radio.tsx @@ -1,4 +1,6 @@ -import { type ComponentProps, type PropsWithChildren, useContext, useId } from 'react'; +import { type ComponentProps, type PropsWithChildren, useContext } from 'react'; + +import { useId } from '@sipe-team/hooks'; import clsx from 'clsx'; diff --git a/packages/radio/src/RadioGroup.tsx b/packages/radio/src/RadioGroup.tsx index 16b9eb6..5eec847 100644 --- a/packages/radio/src/RadioGroup.tsx +++ b/packages/radio/src/RadioGroup.tsx @@ -1,4 +1,6 @@ -import { createContext, type PropsWithChildren, useId } from 'react'; +import { createContext, type PropsWithChildren } from 'react'; + +import { useId } from '@sipe-team/hooks'; import clsx from 'clsx'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0fc1073..242cc54 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -892,6 +892,9 @@ importers: packages/radio: dependencies: + '@sipe-team/hooks': + specifier: workspace:* + version: link:../hooks '@sipe-team/tokens': specifier: workspace:* version: link:../tokens