mm
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
import type { ComponentPropsWithoutRef, CSSProperties } from "react";
|
||||
import type { CSSProperties } from "react";
|
||||
import {
|
||||
FloatingFocusManager,
|
||||
FloatingList,
|
||||
FloatingPortal,
|
||||
useMergeRefs,
|
||||
} from "@floating-ui/react";
|
||||
import { useMenuFloatingContext } from "./use-menu-floating-context";
|
||||
import { useMenuContext } from "./use-menu-context";
|
||||
import { mergeClass } from "../../styles/utils/merge-class";
|
||||
import { containerRecipe } from "../../styles/recipes/container-recipe";
|
||||
import { useThemeContext } from "../theme/use-theme-context";
|
||||
import type { CommonProps } from "../../utils/CommonProps";
|
||||
import type { CommonProps } from "../../utils/common-props";
|
||||
import { brandRecipe } from "../../styles/recipes/brand-recipe";
|
||||
|
||||
export type MenuDropdownProps = CommonProps & {
|
||||
@@ -17,30 +18,41 @@ export type MenuDropdownProps = CommonProps & {
|
||||
};
|
||||
|
||||
export const MenuDropdown = (props: MenuDropdownProps) => {
|
||||
const { modal = true, className = "", children, style, ...rest } = props;
|
||||
const {
|
||||
modal = false,
|
||||
className = "",
|
||||
children,
|
||||
style,
|
||||
ref,
|
||||
...rest
|
||||
} = props;
|
||||
|
||||
// =========== Menu Context Consumer ===================================================================================================
|
||||
|
||||
const { size } = useMenuContext()!;
|
||||
|
||||
// =========== Menu Floating Context Consumer ===================================================================================================
|
||||
|
||||
const {
|
||||
refs,
|
||||
elementsRef,
|
||||
context,
|
||||
floatingStyles,
|
||||
getFloatingProps,
|
||||
isNested,
|
||||
isOpen,
|
||||
} = useMenuFloatingContext()!;
|
||||
|
||||
// ==============================================================================================================
|
||||
// =========== Theme Context Consumer ===================================================================================================
|
||||
|
||||
const { themeBaseClass, themeClass } = useThemeContext()!;
|
||||
|
||||
// ===============================================================================================================
|
||||
// ============== Style =================================================================================================
|
||||
|
||||
const rootClass = mergeClass(
|
||||
containerRecipe({
|
||||
boxShadow: true,
|
||||
rounded: size == "sm" ? 4 : 8,
|
||||
padding: size == "sm" ? 4 : 8,
|
||||
rounded: size == "sm" ? 4 : size == "md" ? 8 : undefined,
|
||||
padding: size == "sm" ? 4 : size == "md" ? 8 : undefined,
|
||||
background: "base",
|
||||
hasFocusOutline: "false",
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user