import React from "react";
import clsx from "clsx";
import { Tooltip, Callout } from "@gland/react/popover";
import { preventDefault } from "@gland/function/preventDefault";
import { icons } from "../../icons";
import { toolClasses as classes, toolNormalBtn } from "../style";
export function VerLine(props) {
return
;
}
export function BtnTip(props) {
return (
{props.children}
);
}
export function DropButton(props: { tip; children; list: Array<{ value; label }>; getCurValue; onSelect; mode?: "narrower" | "wider"; style? }) {
const [show, setShow] = React.useState(false);
const attr = React.useRef({} as { root }).current;
const curValue = props.getCurValue && props.getCurValue();
let btn = null;
if (props.mode === "wider") {
btn = (
(attr.root = r)}
onClick={() => {
setShow(!show);
}}
>
{props.children}
);
} else if (props.mode === "narrower") {
btn = (
(attr.root = r)}
onClick={() => {
setShow(!show);
}}
>
{props.children}
);
} else {
btn = (
(attr.root = r)}
onClick={() => {
setShow(!show);
}}
>
{props.children}
);
}
return (
{btn}
{
if (type === "click" && !isTarget) {
setShow(false);
}
}}
onMouseDown={preventDefault}
>
{props.list.map(function (item, index) {
return (
- {
props.onSelect && props.onSelect(item);
setShow(false);
}}
>
{item.label}
);
})}
);
}