-
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 ContextMenu2 component #1699
Conversation
🦋 Changeset detectedLatest commit: e4632ae 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. |
✅ Deploy Preview for ingred-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@yomotsu スイッチの高さを揃える![]() テキストとスイッチの水平ラインがわずかにずれているので アイコンの色![]() アイコンの色は実装サイドで任意のものに変更できるでしょうか? 水平線のスタイル![]()
見出しのマージン![]() もう少し上下に余裕を持たせたいので4pxの上下マージンを 入れ子の子要素の情報![]() 例示されている inputの横幅![]() inputの横スペースにもう少し余裕を持たせたいので |
その形式も問題なさそうです
なるほど補足ありがとうございます。
はい、その通りの想定でした
の 2 つについては機能が複雑なため、この PR がマージされたあと、それぞれ単体の別の PR として用意しようと考えています。 |
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.
@yomotsu
クライアントで ContextMenu2 を利用する人間としての観点でコメントさせていただきました 🙏
/** | ||
* コンテキストメニューを開くかどうか。省略時は内部で開閉状態を管理される | ||
*/ | ||
open?: boolean; | ||
/** | ||
* 開閉トリガーとなるボタン要素 | ||
*/ | ||
trigger: ReactElement< | ||
ButtonHTMLAttributes<HTMLButtonElement> & { | ||
ref?: React.Ref<HTMLButtonElement>; | ||
}, | ||
"button" | ||
>; |
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.
@yomotsu FYI @noronaoki
コンテキストメニューの開閉をクライアントから制御したい場合に open と onOpenChange を使うと理解しました。現状は trigger がオプショナルではないものの、trigger となる button 要素が不要なケースもありえるのかな?と思いました。
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.
現状は trigger がオプショナルではないものの、trigger となる button 要素が不要なケースもありえるのかな?と思いました。
新 DataTable を実装する際にもあり得そう
https://www.figma.com/design/fUeoFzCzL4rwRuW7CFW4m0/INGRED-UI?node-id=2622-1783&t=gVX4UAFldWFJp9H1-0
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.
button 要素が不要なケース
具体的なユースケースとしては、OS のコンテキストメニューのように、クリックした箇所がそのままトリガーのような振る舞いをする、ということで認識あっているでしょうか?
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.
添付画像の箇所は button じゃないかもと思ったのですが、私の勘違いかもしれないです!
@noronaoki
ContextMenu2 のユースケースとして、button クリック以外をトリガーに表示したいことってありえますかね? 💭
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.
トリガー要素無しでクリックした座標をアンカーにできる機能を追加してみました
Screen.Recording.2025-01-24.at.15.40.36.mp4
const { position, setPosition } = useContextMenu2Anchor();
const [open, setOpen] = useState<boolean>(false);
return (
<ContextMenu2Container>
<ContextMenu2 open={open} trigger={position} width={316}>
...
</ContextMenu2>
</ContextMenu2Container>
);
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.
なお、ページネーションの場合は、「ボタン」の機能を持つコンポーネントをクリックして表示することを想定していました
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.
素敵です!
これがあればほとんどのユースケースに対応できると思います。
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.
@yomotsu |
@noronaoki
|
ありがとうございます、ご指摘のとおり、差し替えたいと思ってます! |
既存の方向アイコンの形状を最新 Figma に合わせて差し替えました。 |
@yomotsu LGTM!! |
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.
私からも Approve をば。LGTM 👏
@deatiger |
なるほど、確認しますね。 @noronaoki |
@deatiger |
小山田さんにやっていただきますか?それともこちらでやった方が良いでしょうか? |
従来は INGRED UI チャンネルに報知したりもしていたので、私の方でやりましょか |
マージしたあとの付随する作業の把握ができていないため、それですと私も大変助かります🙇♂️ |
@deatiger では稲垣さんにお願いできればと思います 🙇🏻 |
@yomotsu @noronaoki |
FYI @yomotsu 3件まとめてリリースまで完了しております 🙏 |
ありがとうございます。助かりました。 |
この PR は、新規に ContextMenu2 コンポーネントを追加するための PR です。
Screen.Recording.2025-01-23.at.16.49.20.mp4
ContextMenu2 の中には、あらかじめ用意した以下を好きなように組み合わせて配置できます。
また、ContextMenu2 の入れ子も可能です。
例
ContextMenu2HeadingItem
ContextMenu2HelpTextItem
ContextMenu2SeparatorItem
ContextMenu2ButtonItem
ContextMenu2CheckItem
ContextMenu2SwitchItem
ContextMenu2TextInputItem
ContextMenu2ButtonControlsItem
ContextMenu2TriggerItem
ContextMenu2/index.ts から全て export されています。
Check List (If️ you added new component in this PR)
src/components/index.ts
.storybook/documents/Information/Samples/Samples.stories.tsx