import React, { forwardRef, type JSX } from "react"; import * as RadixTooltip from "@radix-ui/react-tooltip"; import { theme } from "tailwind.config"; import { CardThemeProvider, NestedCardThemeProvider, } from "./ThemeManager/ThemeProvider"; import { useReplicache } from "src/replicache"; import { PopoverArrow } from "./Icons/PopoverArrow"; type ButtonProps = Omit; export const ButtonPrimary = forwardRef< HTMLButtonElement, ButtonProps & { fullWidth?: boolean; fullWidthOnMobile?: boolean; children: React.ReactNode; compact?: boolean; } >((props, ref) => { let { className, fullWidth, fullWidthOnMobile, compact, children, ...buttonProps } = props; return ( ); }); ButtonPrimary.displayName = "ButtonPrimary"; export const ButtonSecondary = forwardRef< HTMLButtonElement, ButtonProps & { fullWidth?: boolean; fullWidthOnMobile?: boolean; children: React.ReactNode; compact?: boolean; } >((props, ref) => { let { className, fullWidth, fullWidthOnMobile, compact, children, ...buttonProps } = props; return ( ); }); ButtonSecondary.displayName = "ButtonSecondary"; export const ButtonTertiary = forwardRef< HTMLButtonElement, { fullWidth?: boolean; fullWidthOnMobile?: boolean; children: React.ReactNode; compact?: boolean; } & ButtonProps >((props, ref) => { let { className, fullWidth, fullWidthOnMobile, compact, children, ...buttonProps } = props; return ( ); }); ButtonTertiary.displayName = "ButtonTertiary"; export const TooltipButton = (props: { onMouseDown?: (e: React.MouseEvent) => void | Promise; disabled?: boolean; className?: string; children: React.ReactNode; tooltipContent: React.ReactNode; side?: "top" | "right" | "bottom" | "left" | undefined; open?: boolean; delayDuration?: number; }) => { let { undoManager } = useReplicache(); return ( // toolbar button does not control the highlight theme setter // if toolbar button is updated, be sure to update there as well { e.preventDefault(); undoManager.startGroup(); props.onMouseDown && (await props.onMouseDown(e)); undoManager.endGroup(); }} > {props.children} {props.tooltipContent} ); };