diff --git a/packages/webui/src/components/ui/button.tsx b/packages/webui/src/components/ui/button.tsx index 4fc446ec..045063e7 100644 --- a/packages/webui/src/components/ui/button.tsx +++ b/packages/webui/src/components/ui/button.tsx @@ -4,7 +4,7 @@ import { cva, type VariantProps } from 'class-variance-authority'; import { cn } from '@/lib/utils'; const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/40 focus-visible:border-ring cursor-pointer", + "ui-button inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,background-color,border-color,box-shadow,scale,opacity] duration-150 ease-out disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/40 focus-visible:border-ring cursor-pointer", { variants: { variant: { @@ -16,25 +16,43 @@ const buttonVariants = cva( link: 'text-primary underline-offset-4 hover:underline', }, size: { - default: 'h-9 px-4 py-2', - sm: 'h-8 rounded-md px-3 text-xs', - lg: 'h-10 rounded-md px-6', - icon: 'size-9', - 'icon-sm': 'size-8', + default: 'h-10 px-4 py-2', + sm: 'h-10 rounded-md px-3 text-xs', + lg: 'h-12 rounded-md px-6', + icon: 'ui-button-icon size-10', + 'icon-sm': 'ui-button-icon size-10', + }, + press: { + true: 'active:scale-[0.96] motion-reduce:active:scale-100', + false: '', }, }, - defaultVariants: { variant: 'default', size: 'default' }, + defaultVariants: { variant: 'default', size: 'default', press: true }, } ); -interface ButtonProps extends React.ButtonHTMLAttributes, VariantProps { +type ButtonVariantProps = Omit, 'press'>; + +interface ButtonProps extends React.ButtonHTMLAttributes, ButtonVariantProps { asChild?: boolean; + /** Disable tactile press scaling when motion would distract from the action. */ + static?: boolean; } const Button = React.forwardRef( - ({ className, variant, size, asChild = false, ...props }, ref) => { + ({ className, variant, size, asChild = false, static: isStatic = false, ...props }, ref) => { const Comp = asChild ? Slot : 'button'; - return ; + return ( + + ); } ); Button.displayName = 'Button'; diff --git a/packages/webui/src/components/ui/input.tsx b/packages/webui/src/components/ui/input.tsx index 0b8a1e2d..1d405a7a 100644 --- a/packages/webui/src/components/ui/input.tsx +++ b/packages/webui/src/components/ui/input.tsx @@ -6,8 +6,9 @@ const Input = React.forwardRef