fix(ContractNumberField): wider select, prevent text truncation

- compact: max-w-[180px] → w-auto (fit content)
- SelectTrigger: + w-auto min-w-0 (shrink to fit)
- Preview: + whitespace-nowrap, w-auto
- flex-wrap → flex-nowrap (prevent line breaks)
- Switch: scale-75 → scale-[0.65] (more compact)
- Fixes '#8 ООО...' truncation and label wrapping
This commit is contained in:
iisultanov
2026-07-15 22:22:28 +03:00
parent d3b1869612
commit c4421702b8

View File

@@ -143,14 +143,14 @@ export default function ContractNumberField({
const isGenerated = !!(parsed.mode === 'mine' && parsed.value && parsed.value !== '');
return (
<div className={cn(compact ? 'flex items-center gap-2 flex-wrap' : 'space-y-2')}>
<div className="flex items-center space-x-2 shrink-0">
<div className={cn(compact ? 'flex items-center gap-1.5 flex-nowrap' : 'space-y-2')}>
<div className="flex items-center space-x-1.5 shrink-0">
<Switch
id={`contract-number-mode-${fieldId}`}
checked={mode === 'mine'}
onCheckedChange={(checked: boolean) => handleModeChange(checked ? 'mine' : 'customer')}
disabled={disabled || isGenerated}
className={compact ? 'scale-75' : ''}
className={compact ? 'scale-[0.65]' : ''}
/>
{!compact && (
<Label htmlFor={`contract-number-mode-${fieldId}`} className="cursor-pointer text-xs">
@@ -159,13 +159,13 @@ export default function ContractNumberField({
)}
</div>
<div className={cn('flex-1', compact ? 'min-w-[120px] max-w-[180px]' : 'min-w-[160px] w-full')}>
<div className={cn(compact ? 'w-auto min-w-[100px]' : 'flex-1 min-w-[160px] w-full')}>
<Select
value={legalEntityTaskId?.toString() || ''}
onValueChange={handleLegalEntityChange}
disabled={disabled || isGenerated}
>
<SelectTrigger className={cn(compact && 'h-7 text-xs px-2')}>
<SelectTrigger className={cn(compact && 'h-7 text-xs px-2 min-w-0 w-auto')}>
<SelectValue placeholder={compact ? 'Юрлицо' : 'Выберите юрлицо'} />
</SelectTrigger>
<SelectContent>
@@ -185,12 +185,12 @@ export default function ContractNumberField({
onChange={(e) => handleCustomerChange(e.target.value)}
placeholder={compact ? 'Шифр' : 'Введите шифр заказчика'}
disabled={disabled}
className={cn('flex-1', compact ? 'h-7 text-xs px-2 min-w-[80px] max-w-[160px]' : 'min-w-[160px]')}
className={cn('flex-1', compact ? 'h-7 text-xs px-2 min-w-[60px] w-auto' : 'min-w-[160px]')}
/>
) : (
<div className={cn('relative flex-1', compact ? 'min-w-[100px] max-w-[180px]' : 'min-w-[160px]')}>
<div className={cn('relative', compact ? 'min-w-[80px] w-auto' : 'flex-1 min-w-[160px]')}>
<div className={cn(
'flex items-center gap-1.5 rounded-md border border-input bg-muted/30',
'flex items-center gap-1.5 rounded-md border border-input bg-muted/30 whitespace-nowrap',
compact ? 'px-2 h-7' : 'px-3 py-2'
)}>
<FileSignature className="h-4 w-4 text-muted-foreground shrink-0" />