11import { forwardRef } from 'react' ;
22import { Group , Rect , Text } from 'react-konva' ;
33import { ShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions' ;
4- import { useGroupShapeProps } from '../mock-components.utils' ;
4+ import { useGroupShapeProps } from '../../ mock-components.utils' ;
55import { fitSizeToShapeSizeRestrictions } from '@/common/utils/shapes/shape-restrictions' ;
66import { ShapeType } from '@/core/model' ;
7- import { ShapeProps } from '../shape.model' ;
8- import { useShapeProps } from '../../shapes/use-shape-props.hook' ;
9- import { INPUT_SHAPE } from '../front-components/shape.const' ;
7+ import { ShapeProps } from '../../shape.model' ;
8+ import { useShapeProps } from '../../../shapes/use-shape-props.hook' ;
9+ import { INPUT_SHAPE } from '../../front-components/shape.const' ;
10+ import { getTextFieldWidth } from './input-stepper.business' ;
1011
1112// Size restrictions (igual patrón que file-tree)
1213export const inputStepperShapeRestrictions : ShapeSizeRestrictions = {
@@ -49,17 +50,7 @@ export const InputWithStepper = forwardRef<any, ShapeProps>((props, ref) => {
4950
5051 const { width : restrictedWidth } = restrictedSize ;
5152
52- const getInputWidth = ( restrictedWidth : number ) : number => {
53- const inputWidth = restrictedWidth * 0.3 ;
54- const minInputWidth = 30 ;
55- const maxInputWidth = 70 ;
56-
57- if ( inputWidth < minInputWidth ) return minInputWidth ;
58- if ( inputWidth > maxInputWidth ) return maxInputWidth ;
59- return inputWidth ;
60- } ;
61-
62- const a = getInputWidth ( restrictedWidth ) ;
53+ const textFieldWidth = getTextFieldWidth ( restrictedWidth ) ;
6354
6455 return (
6556 < Group { ...commonGroupProps } { ...shapeProps } >
@@ -78,9 +69,9 @@ export const InputWithStepper = forwardRef<any, ShapeProps>((props, ref) => {
7869
7970 { /* Texto del input */ }
8071 < Text
81- x = { 0 } // Alinear a la derecha
72+ x = { 0 }
8273 y = { height / 2 - 8 } // Centrar verticalmente
83- width = { restrictedWidth - a - 8 }
74+ width = { restrictedWidth - textFieldWidth - 8 }
8475 text = { text }
8576 fontFamily = "Arial"
8677 fontSize = { 16 }
0 commit comments