tldraw
Version:
A tiny little drawing editor.
45 lines (44 loc) • 1.3 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import classnames from "classnames";
import * as React from "react";
import { TldrawUiTooltip } from "../TldrawUiTooltip.mjs";
const namedClassNamesSoThatICanGrepForThis = {
normal: "tlui-button__normal",
primary: "tlui-button__primary",
danger: "tlui-button__danger",
low: "tlui-button__low",
icon: "tlui-button__icon",
tool: "tlui-button__tool",
menu: "tlui-button__menu",
help: "tlui-button__help"
};
const TldrawUiButton = React.forwardRef(
function TldrawUiButton2({ children, type, htmlButtonType, isActive, tooltip, ...props }, ref) {
const button = /* @__PURE__ */ jsx(
"button",
{
ref,
type: htmlButtonType || "button",
draggable: false,
"data-isactive": isActive,
...props,
className: classnames(
"tlui-button",
namedClassNamesSoThatICanGrepForThis[type],
props.className
),
"aria-label": props["aria-label"] ?? props.title,
title: tooltip ? void 0 : props.title,
children
}
);
if (tooltip) {
return /* @__PURE__ */ jsx(TldrawUiTooltip, { content: tooltip, children: button });
}
return button;
}
);
export {
TldrawUiButton
};
//# sourceMappingURL=TldrawUiButton.mjs.map