diff --git a/src/components/popover-menu/popover-menu-panel-button.tsx b/src/components/popover-menu/popover-menu-panel-button.tsx
new file mode 100644
index 00000000..b40162af
--- /dev/null
+++ b/src/components/popover-menu/popover-menu-panel-button.tsx
@@ -0,0 +1,49 @@
+import React from "react";
+import { PopoverButton as HeadlessUiPopoverButton } from "@headlessui/react";
+import { classNames } from "../../util/class-names";
+
+const itemIntents = {
+ neutral: "text-neutral-700 fill-neutral-700 hover:bg-neutral-100",
+ danger: "text-danger-500 fill-danger-500 hover:bg-danger-100",
+};
+
+const activeItemIntents = {
+ neutral: "bg-primary-100 fill-primary-400 text-primary-400 before:bg-primary-400",
+ danger: "bg-danger-100 fill-danger-400 text-danger-500 before:bg-danger-400",
+};
+
+export interface PopoverMenuPanelButtonProps {
+ children: React.ReactNode;
+ onClick?: () => void;
+ Icon?: React.ComponentType<{ className: string }>;
+ variant?: keyof typeof itemIntents;
+ selected?: boolean;
+ disabled?: boolean;
+}
+
+export const PopoverMenuPanelButton = ({
+ children,
+ onClick,
+ Icon,
+ variant = "neutral",
+ selected,
+ disabled,
+}: PopoverMenuPanelButtonProps) => {
+ return (
+
+ {Icon && }
+ {children}
+
+ );
+};
diff --git a/src/components/popover-menu/popover-menu-panel-item.tsx b/src/components/popover-menu/popover-menu-panel-item.tsx
index d4bf4f3b..1e7a1e50 100644
--- a/src/components/popover-menu/popover-menu-panel-item.tsx
+++ b/src/components/popover-menu/popover-menu-panel-item.tsx
@@ -2,13 +2,14 @@ import React from "react";
import { classNames } from "../../util/class-names";
const itemIntents = {
- neutral: "text-neutral-700 fill-neutral-700 hover:bg-primary-100",
- danger: "text-danger-500 fill-danger-500 hover:bg-danger-100",
+ neutral: "text-neutral-700 fill-neutral-700 hover:bg-neutral-100",
+ danger: "text-danger-500 fill-danger-500 hover:bg-danger-50",
};
-const activeItemIntents = {
- neutral: "bg-primary-100 fill-primary-400 text-primary-400 before:bg-primary-400",
- danger: "bg-danger-100 fill-danger-400 text-danger-500 before:bg-danger-400",
+const selectedItemIntents = {
+ neutral:
+ "bg-primary-100 fill-primary-400 text-primary-400 before:bg-primary-400 hover:text-primary-400 hover:fill-primary-400 hover:bg-primary-100",
+ danger: "bg-danger-100 fill-danger-700 text-danger-500 before:bg-danger-400 hover:text-danger-500 hover:fill-danger-400 hover:bg-danger-100",
};
export interface PopoverMenuPanelItemProps {
@@ -16,7 +17,8 @@ export interface PopoverMenuPanelItemProps {
onClick?: () => void;
Icon?: React.ComponentType<{ className: string }>;
variant?: keyof typeof itemIntents;
- active?: boolean;
+ selected?: boolean;
+ disabled?: boolean;
}
export const PopoverMenuPanelItem = ({
@@ -24,23 +26,24 @@ export const PopoverMenuPanelItem = ({
onClick,
Icon,
variant = "neutral",
- active,
+ selected,
+ disabled,
}: PopoverMenuPanelItemProps) => {
- const intentStyles = itemIntents[variant];
-
return (
{Icon &&
}
{children}
diff --git a/src/components/popover-menu/popover-menu-panel.tsx b/src/components/popover-menu/popover-menu-panel.tsx
index 7f8d2422..74e6b7af 100644
--- a/src/components/popover-menu/popover-menu-panel.tsx
+++ b/src/components/popover-menu/popover-menu-panel.tsx
@@ -5,6 +5,7 @@ import { PopoverMenuPanelGroup } from "./popover-menu-panel-group";
import { PopoverMenuPanelItem } from "./popover-menu-panel-item";
import { PopoverMenuPanelDivider } from "./popover-menu-panel-divider";
import { PopoverMenuPanelTitle } from "./popover-menu-panel-title";
+import { PopoverMenuPanelButton } from "./popover-menu-panel-button";
export interface PopoverMenuPanelProps {
children: React.ReactNode;
@@ -28,6 +29,7 @@ const PopoverMenuPanel = ({ children }: PopoverMenuPanelProps) => {
};
PopoverMenuPanel.Item = PopoverMenuPanelItem;
+PopoverMenuPanel.Button = PopoverMenuPanelButton;
PopoverMenuPanel.Group = PopoverMenuPanelGroup;
PopoverMenuPanel.Divider = PopoverMenuPanelDivider;
PopoverMenuPanel.Title = PopoverMenuPanelTitle;
diff --git a/src/components/popover-menu/popover-menu.stories.tsx b/src/components/popover-menu/popover-menu.stories.tsx
index b910b1ad..3bcbd964 100644
--- a/src/components/popover-menu/popover-menu.stories.tsx
+++ b/src/components/popover-menu/popover-menu.stories.tsx
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react";
import React from "react";
import { PopoverMenu } from "./popover-menu";
-import { AddIcon, ChatIcon, DeleteIcon, EditIcon } from "../../icons";
+import { ChatIcon, DeleteIcon, EditIcon } from "../../icons";
const meta: Meta
= {
title: "Popover Menu",
@@ -18,31 +18,43 @@ export default meta;
type Story = StoryObj;
export const Default: Story = {
- render: () => (
-
-
- Open Popover Menu
+ render: () => {
+ const [isActive, setIsActive] = React.useState(false);
-
+ return (
+
+
+ Open Popover Menu
-
- You
+
- Edit profile
- Support
- Invite member
+
+ You
-
-
-
- Danger Zone
+ setIsActive(!isActive)}
+ >
+ Activate Mfa
+
-
- Item 1
+
+ Support
-
-
-
-
- ),
+
+
+
+
+ Danger Zone
+
+
+ Close this Dialog
+
+
+
+
+
+ );
+ },
};