eManPrague / frui.ts

Pragmatic MVVM frontend framework
MIT License
14 stars 5 forks source link

Support special attributes for different input types #56

Closed kopecmi8 closed 2 years ago

kopecmi8 commented 2 years ago

Different input types has different props. Now its little bit tricky to pass standard attributes for specific input type to Input control component.

I think Input control component should export specific interfaces for standard types.

For example, Input of type number by documentation has these specific attributes

To do it we should add interface like this

export interface InputNumberProps {
  min?: number;
  max?: number;
  step?: number;
}

Second example for input type "password"

export interface InputPasswordProps {
  autocomplete?: string;
  inputmode?: string;
  maxlength?: number;
  minlength?: number;
  pattern?: string;
}

We should also think about usage

<Input<any, InputPasswordProps> type="password" autocomplete="new-password" disabled={disabled} />

Now its little bit tricky because first required attribute is TTarget not the TOtherProps.

kopecmi8 commented 2 years ago

There is problem with size props wich specify both FormControlProps and React.InputHTMLAttributes<FormControlElement> differently once as 'sm' | 'lg' second time as number.