diff --git a/packages/propel/src/select/index.ts b/packages/propel/src/select/index.ts new file mode 100644 index 0000000000..1efe34c51e --- /dev/null +++ b/packages/propel/src/select/index.ts @@ -0,0 +1 @@ +export * from "./root"; diff --git a/packages/propel/src/select/root.tsx b/packages/propel/src/select/root.tsx index 8d70355487..f553a4ad4f 100644 --- a/packages/propel/src/select/root.tsx +++ b/packages/propel/src/select/root.tsx @@ -4,6 +4,8 @@ import { cn } from "@plane/utils"; // types import { ICustomSelectItemProps, ICustomSelectProps } from "./types"; import { Select } from "@base-ui-components/react/select"; +import { convertPlacementToSideAndAlign } from "../utils/placement"; +import React from "react"; const CustomSelect = (props: ICustomSelectProps) => { const { @@ -23,7 +25,19 @@ const CustomSelect = (props: ICustomSelectProps) => { value, tabIndex, portalElement, + side, + align, + sideOffset = 8, } = props; + // side and align calculations + const { finalSide, finalAlign } = React.useMemo(() => { + if (placement) { + const converted = convertPlacementToSideAndAlign(placement); + return { finalSide: converted.side, finalAlign: converted.align }; + } + return { finalSide: side, finalAlign: align }; + }, [placement, side, align]); + // states return ( @@ -62,7 +76,7 @@ const CustomSelect = (props: ICustomSelectProps) => { - + void; optionsClassName?: string; - placement?: "center" | "start" | "end"; tabIndex?: number; useCaptureForOutsideClick?: boolean; defaultOpen?: boolean; + placement?: TPlacement; + side?: TSide; + align?: TAlign; + sideOffset?: number; } export interface IPortalProps {