gantri-components 1.43.0 → 1.45.1

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,12 +1,12 @@
1
1
  import { TextVariant } from '../typography/typography.types';
2
- export interface CheckboxProps {
2
+ import { FieldChangeEvent } from '../text-field';
3
+ export interface CheckboxProps<T = boolean> {
3
4
  checked?: boolean;
4
5
  disabled?: boolean;
5
- extraProps?: any;
6
6
  labelPosition?: 'left' | 'right';
7
7
  labelText?: string;
8
8
  labelTx?: string;
9
9
  labelVariant?: TextVariant;
10
10
  name?: string;
11
- onChange?: (value: boolean, extraProps?: any) => void;
11
+ onChange?: (event: FieldChangeEvent<T>) => void;
12
12
  }
@@ -0,0 +1,3 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { FormikInputProps } from './formik-input.types';
3
+ export declare const FormikInput: FC<PropsWithChildren<FormikInputProps>>;
@@ -0,0 +1,2 @@
1
+ import { FormikInputProps } from './formik-input.types';
2
+ export declare const FormikInputPresets: Partial<FormikInputProps>;
@@ -0,0 +1,12 @@
1
+ import { ReactElement } from 'react';
2
+ import { TextFieldProps } from '../text-field';
3
+ export interface FormikInputProps<FieldType = Record<string, unknown>> extends TextFieldProps {
4
+ Field?: ReactElement<FieldType, any>;
5
+ /**
6
+ * standard wraps a formik Field component
7
+ * fast wraps a formik FastField component
8
+ * Refer to https://formik.org/docs/api/fastfield for more information
9
+ */
10
+ fieldVariant?: 'standard' | 'fast';
11
+ name: string;
12
+ }
@@ -0,0 +1 @@
1
+ export * from './formik-input';
@@ -3,11 +3,14 @@ export * from './badge';
3
3
  export * from './box';
4
4
  export * from './button';
5
5
  export * from './cell';
6
+ export * from './checkbox';
6
7
  export * from './flex';
8
+ export * from './formik-input';
7
9
  export * from './grid';
8
10
  export * from './icon';
9
11
  export * from './image';
10
12
  export * from './radio';
11
13
  export * from './stack';
14
+ export * from './text-area';
15
+ export * from './text-field';
12
16
  export * from './typography';
13
- export * from './checkbox';
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { ErrorMessageProps } from '../text-field';
3
+ export declare const ErrorMessage: FC<ErrorMessageProps>;
@@ -0,0 +1,2 @@
1
+ export * from './text-area';
2
+ export * from './text-area.types';
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { TextAreaProps } from './text-area.types';
3
+ export declare const TextArea: FC<TextAreaProps>;
@@ -0,0 +1,2 @@
1
+ import { TextAreaProps } from './text-area.types';
2
+ export declare const TextAreaPresets: Partial<TextAreaProps>;
@@ -0,0 +1,7 @@
1
+ import { DefaultTheme } from 'styled-components';
2
+ import { StyledInputContainerProps, StyledParentContainerProps } from '../text-field';
3
+ export declare const StyledTextareaParentContainer: import("styled-components").StyledComponent<"div", DefaultTheme, StyledParentContainerProps, never>;
4
+ export declare const StyledIconContainer: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
5
+ export declare const StyledContainer: import("styled-components").StyledComponent<"div", DefaultTheme, StyledInputContainerProps, never>;
6
+ export declare const StyledInputWrapper: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
7
+ export declare const StyledTextarea: import("styled-components").StyledComponent<"textarea", DefaultTheme, {}, never>;
@@ -0,0 +1,5 @@
1
+ import { TextFieldProps } from '../text-field';
2
+ export interface TextAreaProps extends Pick<TextFieldProps, Exclude<keyof TextFieldProps, 'icon' | 'type' | 'autoFocus' | 'minValue' | 'maxValue'>> {
3
+ cols?: number;
4
+ rows?: number;
5
+ }
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { ErrorMessageProps } from './text-field.types';
3
+ export declare const ErrorMessage: FC<ErrorMessageProps>;
@@ -0,0 +1,2 @@
1
+ export * from './text-field';
2
+ export * from './text-field.types';
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { TextFieldProps } from './text-field.types';
3
+ export declare const TextField: FC<TextFieldProps>;
@@ -0,0 +1,2 @@
1
+ import { TextFieldProps } from './text-field.types';
2
+ export declare const TextFieldPresets: Partial<TextFieldProps>;
@@ -0,0 +1,7 @@
1
+ import { DefaultTheme } from 'styled-components';
2
+ import { StyledInputContainerProps, StyledParentContainerProps } from './text-field.types';
3
+ export declare const StyledParentContainer: import("styled-components").StyledComponent<"div", DefaultTheme, StyledParentContainerProps, never>;
4
+ export declare const StyledIconContainer: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
5
+ export declare const StyledContainer: import("styled-components").StyledComponent<"div", DefaultTheme, StyledInputContainerProps, never>;
6
+ export declare const StyledInputWrapper: import("styled-components").StyledComponent<"div", DefaultTheme, {}, never>;
7
+ export declare const StyledInput: import("styled-components").StyledComponent<"input", DefaultTheme, {}, never>;
@@ -0,0 +1,67 @@
1
+ import { ChangeEvent, CSSProperties, FocusEvent, KeyboardEventHandler, ReactElement } from 'react';
2
+ export declare type ErrorMessageType = string | {
3
+ tx: string;
4
+ values?: {
5
+ [key: string]: string;
6
+ };
7
+ };
8
+ export interface TextFieldProps {
9
+ ariaLabel?: string;
10
+ ariaLabelTx?: string;
11
+ autoComplete?: string;
12
+ autoFocus?: boolean;
13
+ className?: string;
14
+ debounce?: number;
15
+ disabled?: boolean;
16
+ /**
17
+ * This field is used to map the error message, it can be a string
18
+ * or an object that contains tx and the values used to be mapped
19
+ * against translation keys.
20
+ * */
21
+ errorMessage?: ErrorMessageType;
22
+ hideErrors?: boolean;
23
+ icon?: ReactElement;
24
+ id?: string;
25
+ labelPosition?: 'top' | 'left';
26
+ labelText?: string;
27
+ labelTx?: string;
28
+ labelTxValues?: Record<string, unknown>;
29
+ maxLength?: number;
30
+ maxValue?: number;
31
+ minValue?: number;
32
+ name?: string;
33
+ onBlur?: (event: FocusEvent) => void;
34
+ onChange?: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
35
+ onFocus?: (event: FocusEvent) => void;
36
+ onKeyDown?: KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
37
+ onKeyUp?: KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
38
+ onTextChange?: (value: string) => void;
39
+ placeholder?: string;
40
+ placeholderTx?: string;
41
+ placeholderTxValues?: {
42
+ [key: string]: string;
43
+ };
44
+ readOnly?: boolean;
45
+ required?: boolean;
46
+ style?: CSSProperties;
47
+ throttle?: number;
48
+ type?: string;
49
+ value?: string;
50
+ variant?: 'line' | 'filled';
51
+ }
52
+ export interface FieldChangeEvent<T = boolean> extends Pick<ChangeEvent<Partial<HTMLInputElement>>, Exclude<keyof ChangeEvent<HTMLInputElement>, 'target'>> {
53
+ target: {
54
+ name: string;
55
+ value: T;
56
+ };
57
+ }
58
+ export interface StyledInputContainerProps extends Pick<TextFieldProps, 'variant'> {
59
+ $disabled: boolean;
60
+ $withErrors: boolean;
61
+ }
62
+ export interface StyledParentContainerProps extends Pick<TextFieldProps, 'labelPosition'> {
63
+ }
64
+ export interface ErrorMessageProps {
65
+ errorMessage?: ErrorMessageType;
66
+ required?: boolean;
67
+ }
@@ -0,0 +1 @@
1
+ export { useId } from './useId';
@@ -0,0 +1 @@
1
+ export declare const useId: () => string;
@@ -0,0 +1 @@
1
+ export * from './hooks';