import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useMemo } from "react";
import { cn } from "../../../utils";
import { Checkbox } from "../../../checkbox";
export const ShareOption = (props)=>{
    const { type, curType, setShareOption } = props;
    const text = useMemo(()=>{
        switch(type){
            case "openPrice":
                return "Open price";
            case "openTime":
                return "Opened at";
            case "markPrice":
                return "Mark price";
            case "quantity":
                return "Quantity";
            case "leverage":
                return "Leverage";
        }
    }, [
        type
    ]);
    const isSelected = curType.has(type);
    return /*#__PURE__*/ _jsxs("div", {
        className: cn("orderly-h-[20px] hover:orderly-cursor-pointer orderly-items-center orderly-flex"),
        onClick: ()=>{
            // setPnlFormat(type);
            setShareOption((value)=>{
                const updateSet = new Set(value);
                if (isSelected) {
                    updateSet.delete(type);
                } else {
                    updateSet.add(type);
                }
                return updateSet;
            });
        },
        children: [
            /*#__PURE__*/ _jsx(Checkbox, {
                checked: isSelected,
                onCheckedChange: (checked)=>{
                    setShareOption((value)=>{
                        const updateSet = new Set(value);
                        if (isSelected) {
                            updateSet.delete(type);
                        } else {
                            updateSet.add(type);
                        }
                        return updateSet;
                    });
                }
            }),
            /*#__PURE__*/ _jsx("div", {
                className: "orderly-text-sm orderly-text-base-contrast-54 orderly-pl-1",
                children: text
            })
        ]
    });
};

//# sourceMappingURL=options.js.map