-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add ContextMenu2SortableItem #1703
Conversation
🦋 Changeset detectedLatest commit: 1fbb559 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for ingred-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
"@dnd-kit/core": "^6.3.1", | ||
"@dnd-kit/modifiers": "^9.0.0", | ||
"@dnd-kit/sortable": "^10.0.0", | ||
"@dnd-kit/utilities": "^3.2.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ドラッグ & ドロップの入れ替えを実現するために dnd-kit を追加しました
@yomotsu (そもそもドラッグとスイッチの役割が別なので実装として疎結合にした方が良いということであればそうしていただいて構いません) |
補足ありがとうございます。
があるということで理解しました。 もうすこしクリアにしたいところがありまして、同じ Figma 内の以下の UI は、スイッチの並びで、「disable らしき項目は、スイッチも表示されていない」となっていますが、上記とこれの「disabled のスイッチとしての見た目の違い」はどう判断したらいいでしょう? |
@yomotsu こちらは列の並び替え、表示制御とは別でフィルタが適用されている列の情報を示しているものです。 スマホで閲覧している時や表に横スクロールが発生している時に列が隠れてしまい、フィルタ項目が不明になるのを補助する目的があります。同時に、フィルタ条件を解除することができます。 ただ、OFFにできてもONにできないのでユーザーは最初戸惑うかもしれませんが、慣れれば利便性は高いと考えております。 |
なるほどありがとうございます。 |
良さそうです! |
@deatiger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@yomotsu @noronaoki |
この PR は、 ContextMenu2 の追加パーツとなる、「並べ替えができるリスト」のコンポーネントを追加する PR です
Screen.Recording.2025-01-28.at.14.13.42.mp4
hover 起動を選択した場合(state で open 状態を自分で制御していない場合)、ContextMenu2 はマウスアウトすると自動で閉じますが、並べ替えドラッグ中はマウスアウトしても閉じないようにしています。
※ 実際には、open 状態は hover に任せるのではなく、自分で制御して利用することになるかとは思います
大まかな利用例
ContextMenu2
の中で利用しますContextMenu2SortableGroup
で括りますContextMenu2SortableItem
には ID を指定しますContextMenu2SortableItem
の中には、既存のContextMenu2***Item
を 1 つ入れて使います(以下の例ではContextMenu2SwitchItem
を入れています)並べ替えの対象にしたくない場合(順番固定にしたい場合)は、
ContextMenu2SortableGroup
の外に配置します(以下の場合、1は場所固定、2,3 は入れ替え可能)
Check List (If️ you added new component in this PR)
src/components/index.ts
.storybook/documents/Information/Samples/Samples.stories.tsx