Skip to content

✨ feat(modal): 開閉のアニメーションをモーショントークンで動かす - #381

Merged
touyou merged 2 commits into
motion-component-dialog-1102from
motion-component-modal-1102
Nov 18, 2026
Merged

touyou merged 2 commits into
motion-component-dialog-1102from
motion-component-modal-1102

Conversation

@harukosugimoto

@harukosugimoto harukosugimoto commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

概要

Modal のパネルのアニメーションを、duration-200 などの直書きからモーショントークン(--motion-*)に置き換えます。動きは Dialog(#380)と同じです。設計ガイドラインでも、Modal は Dialog と同じ「下から上へ」「Medium」です。

要素 開くとき 閉じるとき
Modal のパネル animate-motion-pop-in:フェード(fade)と、下からの移動・拡大(move)を別々の時間と easing で動かす animate-motion-pop-out:exit の時間と easing で消える
パネルの中身(Header・Body・Footer) animate-motion-content-in:パネルより遅れてフェードイン パネルと一緒に消える
Overlay #380 で対応済み #380 で対応済み

スタックでの位置

この PR は Stacked PRs の stack #394 の 2 / 8 段目です(goodpatch/sparkle-design-internal#403)。

#380 Dialog → #381 Modal → #382 Tooltip → #383 Select → #385 Switch → #386 Tabs → #387 InlineMessage → #388 Toast

すぐ下は #380 です。差分はこの PR の分だけになっています。モーショントークンを含む CSS の生成し直しは、一番下の #380 に入っています。

下の PR がマージされたら、gh stack rebase && gh stack push で積み直します。2026-11-05 に main の最新の上へ積み直し、各段で型チェック・lint・テストが通ることを確認しました。

依存関係とマージの順番(sparkle-variables#15 → sparkle-design-cli#122 のリリース → CSS の生成し直し)は #380 と同じです。

プレビュー(Storybook)

⚠️ #380 と同じく、Vercel のプレビューデプロイが権限エラーで失敗する見込みです。Vercel チームのメンバーがデプロイを承認すると、このリンクで開けるようになります。

変更点

  • src/components/ui/modal/index.tsx:animate-in / zoom-in-95 / duration-200 などを animate-motion-pop-in / -out、[--motion-pop-from-y:1]、*:animate-motion-content-in に置き換え
  • src/components/ui/modal/index.test.tsx:新しいクラスと、時間を直書きしていないことのテストを追加
  • CHANGELOG.md:Unreleased に追記

中身の遅れは、Dialog と同じく直下の子要素に *: で付けています。ラッパーを足すと flex flex-col と Body のスクロール(grow overflow-auto)の構造が変わるためです。

検証

  • pnpm test:818 件成功(skip 10・todo 18 は既存)
  • pnpm type-check:成功
  • pnpm lint:新しい警告なし(既存の 2 件のみ)
  • Storybook の Modal を Chrome(Playwright)で開閉し、計算値を確認しました(重さは middle)
時点 パネル 中身 Overlay
開いて 20ms フェード 220ms と移動 300ms が並んで動く。不透明度 0.39、下・縮小から戻る途中 75ms 遅れのため不透明度 0 不透明度 0.39
開いて 600ms 不透明度 1、変形なし 不透明度 1 不透明度 1
閉じて 100ms 退場(160ms)の途中、不透明度 0.53 — 48ms 遅れで消え始め、不透明度 0.84
閉じて 180ms 外れている — まだ残っている(不透明度 0.24)
閉じて 260ms 外れている — 外れている

prefers-reduced-motion: reduce では、移動と拡大がなくなり(変形なし)、フェードと中身の遅れだけが残ることも確認しました。

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 2, 2026

Copy link
Copy Markdown

Deployment failed for project sparkle-design with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: sparkle-design.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 36ca0cc6-435b-4281-b1ef-8ca6bc035312
Commits

Reviewing files that changed from the base of the PR and between 191c21d and 4a13168.

Files selected for processing: 3

  • CHANGELOG.md
  • src/components/ui/modal/index.test.tsx
  • src/components/ui/modal/index.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@touyou touyou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dialog と同じ形で Modal を置き換えていて、止める指摘はありません。Approve します。


Generated by Claude Code

- パネルを animate-motion-pop-in / -out で動かし、下から出す(--motion-pop-from-y: 1)
- 中身(Header・Body・Footer)は animate-motion-content-in で、パネルより遅れてフェードインする
- duration-200 などの直書きをなくす
- アニメーションのクラスと、時間を直書きしていないことのテストを追加
- CHANGELOG に追記

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sparkle-design Ready Ready Preview Nov 18, 2026 1:24am UTC

Request Review

@touyou
touyou merged commit 10bed56 into main Nov 18, 2026
3 checks passed
@touyou
touyou deleted the motion-component-modal-1102 branch November 18, 2026 01:25

This branch was successfully deployed

1 active deployment
Preview — 1e7272a9 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants