Repository navigation
✨ feat(tooltip): 開閉のアニメーションをモーショントークンで動かす - #382
Conversation
|
Deployment failed for project sparkle-design with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
touyou
left a comment
There was a problem hiding this comment.
表示する側に応じて方向を変える指定と、origin-(--radix-…) への書き換え(Tailwind v4 で無効だった不具合の修正)が良いと思います。止める指摘はないので Approve します。
メモ: 文字を span[data-slot="tooltip-text"](block)で包むようになったので、利用側が TooltipContent の子に直接スタイルを当てている場合は 1 段深くなります。CHANGELOG に書いてもらっているので、このままで大丈夫です。
Generated by Claude Code
- 箱を animate-motion-pop-in-small / -out-small で動かし、表示する側に応じてアンカーの側から出す(--motion-pop-from-x / -y) - 文字を data-slot="tooltip-text" の要素で包み、animate-motion-content-in-tooltip で箱より遅れてフェードインさせる - origin-[--radix-…](Tailwind v4 では無効な CSS になる)を origin-(--radix-tooltip-content-transform-origin) に直し、拡大の支点をアンカー側にする - テストを文字の包みに合わせ、アニメーションのクラスと時間を直書きしていないことのテストを追加 - CHANGELOG に追記 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
04801ed to
5b6fc47
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016SVVD7wjdNHeN8F7cqRc5t
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
概要
Tooltip のアニメーションを、tw-animate-css の
animate-in/zoom-in-95などからモーショントークン(--motion-*)に置き換えます。設計ガイドラインでは Tooltip は Small(移動距離 40px 以下)なので、移動と退場の時間に*-small(0.75 倍)を使います。animate-motion-pop-in-small:フェードと、アンカーの側からの移動・拡大animate-motion-pop-out-smallanimate-motion-content-in-tooltip:箱より少し遅れてフェードイン(移動時間の 10%)出る方向は表示する側(
data-side)で決めます。上に出るときは下から上へ(ガイドラインの「下から上へ/アンカー側」)、下に出るときは上から下へ、左右も同じくアンカーの側から出ます。スタックでの位置
この PR は Stacked PRs の stack #394 の 3 / 8 段目です(goodpatch/sparkle-design-internal#403)。
#380 Dialog → #381 Modal → #382 Tooltip → #383 Select → #385 Switch → #386 Tabs → #387 InlineMessage → #388 Toast
すぐ下は #381 です。差分はこの PR の分だけになっています。モーショントークンを含む CSS の生成し直しは、一番下の #380 に入っています。
下の PR がマージされたら、
gh stack rebase && gh stack pushで積み直します。2026-11-05 に main の最新の上へ積み直し、各段で型チェック・lint・テストが通ることを確認しました。依存関係とマージの順番は #380 と同じです。
プレビュー(Storybook)
レビューしてほしい点
origin-[--radix-tooltip-content-transform-origin]は Tailwind v3 の書き方で、v4 ではtransform-origin: --radix-tooltip-content-transform-originという無効な CSS になります(Tailwind でコンパイルして確認)。このため、拡大が中央から始まっていました。origin-(--radix-tooltip-content-transform-origin)に直し、アンカー側から拡大するようにしています<span data-slot="tooltip-text" class="block">で包んでいます。Tooltip の本体(data-slot="tooltip-content")の直下に文字がある前提で書かれたコードやテストは影響を受けます。このリポジトリでは Tooltip のテスト 4 か所が該当したので、closest('[data-slot="tooltip-content"]')で本体を探すように直しました変更点
src/components/ui/tooltip/index.tsx:アニメーションのクラスの置き換え、data-sideごとの--motion-pop-from-x/-y、origin-(...)への修正、文字の包みsrc/components/ui/tooltip/index.test.tsx:文字の包みに合わせた修正と、アニメーションのクラス・時間を直書きしていないことのテストCHANGELOG.md:Unreleased の Changed と Fixed に追記検証
pnpm test:818 件成功(skip 10・todo 18 は既存)pnpm type-check:成功pnpm lint:新しい警告なし(既存の 2 件のみ)🤖 Generated with Claude Code