'use client' // packages/ui/src/components/ds/PhysicalButton.tsx // High-End Tactile Button with Button-in-Button Trailing Icon & Spring Physics import React from 'react' import { Button, Box, type ButtonProps } from '@mui/material' import { d3roPalette, d3roFontSans, d3roShadow, d3roRadius, d3roTypo } from '../../theme' export interface PhysicalButtonProps extends Omit { /** Active selected state (renders primary accent gradient) */ selected?: boolean /** Visual button tone */ tone?: 'accent' | 'glass' | 'danger' | 'success' | 'ghost' /** Trailing icon rendered in a nested circular capsule (Button-in-Button pattern) */ trailingIcon?: React.ReactNode } export function PhysicalButton({ selected = false, tone = 'glass', trailingIcon, children, sx, ...props }: PhysicalButtonProps): React.ReactElement { const isAccent = selected || tone === 'accent' const isDanger = tone === 'danger' const isSuccess = tone === 'success' let bg: string = d3roPalette.glass.raised let bgImage: string = 'none' let textColor: string = d3roPalette.text.primary let borderColor: string = d3roPalette.glass.hairline let shadow: string = 'none' if (isAccent) { bg = 'transparent' bgImage = d3roPalette.gradient.accent textColor = d3roPalette.text.inverse borderColor = 'transparent' shadow = d3roShadow.glowAccent } else if (isDanger) { bg = d3roPalette.tag.redBg textColor = d3roPalette.tag.red borderColor = d3roPalette.tag.redGlow } else if (isSuccess) { bg = d3roPalette.tag.greenBg textColor = d3roPalette.tag.green borderColor = d3roPalette.tag.greenGlow } return ( ) }