@giro-ds/react 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { TextFieldProps } from './TextField.types';
3
- declare const MemoizedTextField: React.NamedExoticComponent<TextFieldProps>;
4
- export default MemoizedTextField;
3
+ declare const _default: React.NamedExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
4
+ export default _default;
@@ -1,22 +1,32 @@
1
1
  import React from 'react';
2
- export interface TextFieldProps {
3
- name?: string;
4
- className?: string;
5
- value?: string | number;
2
+ export type TextFieldType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url';
3
+ export type TooltipPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
4
+ export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'type'> {
5
+ /** Controlled value */
6
+ value?: string;
7
+ /** Change handler - receives string value */
8
+ onChange?: (value: string) => void;
9
+ /** Label text */
6
10
  label?: string;
7
- placeholder?: string;
8
- type?: string;
9
- onChange?: (value: string | number) => void;
10
- disabled?: boolean;
11
- maxLength?: number;
12
- required?: boolean;
13
- helper?: boolean;
11
+ /** Input type */
12
+ type?: TextFieldType;
13
+ /** Helper text (shown below input) */
14
14
  helperText?: string;
15
+ /** Show tooltip with info icon */
15
16
  tooltip?: boolean;
17
+ /** Tooltip content */
16
18
  tooltipText?: string;
17
- positionTooltip?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
19
+ /** Tooltip position */
20
+ positionTooltip?: TooltipPosition;
21
+ /** Custom error message for validation */
18
22
  errorMessage?: string;
19
- trailingIcon?: boolean;
20
- id?: string;
23
+ /** Leading icon */
21
24
  icon?: React.ReactNode;
22
25
  }
26
+ export interface ValidationParams {
27
+ value: string;
28
+ maxLength?: number;
29
+ type?: TextFieldType;
30
+ errorMessage?: string;
31
+ required?: boolean;
32
+ }
@@ -0,0 +1,2 @@
1
+ export { validateInput } from './validation';
2
+ export type { ValidationParams } from './validation';
@@ -0,0 +1,8 @@
1
+ export interface ValidationParams {
2
+ value: string;
3
+ maxLength?: number;
4
+ type?: string;
5
+ errorMessage?: string;
6
+ required?: boolean;
7
+ }
8
+ export declare const validateInput: ({ value, maxLength, errorMessage, required }: ValidationParams) => string;