@thecb/components 8.0.6-beta.5 → 8.0.6-beta.7

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.
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
4
4
 
5
5
  interface ButtonWithActionProps {
6
- action?: React.SyntheticEvent;
6
+ action?: (event: React.ChangeEvent<HTMLInputElement>) => void;
7
7
  variant?: string;
8
8
  text?: string;
9
9
  textWrap?: boolean;
@@ -60,44 +60,53 @@ declare const Card: React.FC<Expand<CardProps> &
60
60
  React.HTMLAttributes<HTMLElement>>;
61
61
 
62
62
  interface ErrorMessage {
63
- [fieldName: string]: string;
63
+ [fieldName: string]: string;
64
+ }
65
+
66
+ interface Field {
67
+ hasErrors?: boolean;
68
+ dirty?: boolean;
69
+ rawValue?: string;
70
+ }
71
+
72
+ interface FieldActions {
73
+ set?: (value: any) => void;
74
+ addValidator?: (validator: any) => void;
75
+ removeValidator?: (validator: any) => void;
76
+ clear?: () => void;
64
77
  }
65
78
 
66
79
  interface FormInputProps {
67
- type?: string;
68
- labelTextWhenNoError?: string;
80
+ extraStyles?: string;
81
+ field?: Field;
82
+ fieldActions?: FieldActions;
83
+ disabled?: boolean;
69
84
  errorMessages?: ErrorMessage[];
70
- isNum?: boolean;
71
- isEmail?: boolean;
72
85
  helperModal?: boolean;
73
- field?: any;
74
- fieldActions?: any;
86
+ isEmail?: boolean;
87
+ isNum?: boolean;
88
+ labelTextWhenNoError?: string;
75
89
  showErrors?: boolean;
76
- formatter?: any;
77
- decorator?: any;
78
- background?: any;
79
- customHeight?: any;
80
- autocomplete?: any;
81
- extraStyles?: any;
82
- removeFromValue?: any;
90
+ type?: string;
83
91
  }
84
92
 
85
93
  declare const FormInput: React.FC<Expand<FormInputProps> &
86
94
  React.HTMLAttributes<HTMLElement>>;
87
95
 
88
96
  interface Option {
89
- text: string;
90
- value: string | number;
97
+ text?: string;
98
+ value?: string | number;
91
99
  }
92
100
 
93
101
  interface FormSelectProps {
102
+ disabled?: boolean;
94
103
  dropdownMaxHeight?: string;
95
104
  labelTextWhenNoError?: string;
96
105
  options?: Option[];
97
- fieldActions?: any;
106
+ fieldActions?: FieldActions;
98
107
  showErrors?: boolean;
99
- errorMessages?: any;
100
- field?: any;
108
+ errorMessages?: ErrorMessage[]
109
+ field?: Field
101
110
  }
102
111
 
103
112
  declare const FormSelect: React.FC<Expand<FormSelectProps> &
@@ -454,8 +463,8 @@ declare const Paragraph: React.FC<Expand<ParagraphProps> &
454
463
  React.HTMLAttributes<HTMLElement>>;
455
464
 
456
465
  interface SpinnerProps {
457
- size: string;
458
- centerSpinner: boolean;
466
+ size?: string;
467
+ centerSpinner?: boolean;
459
468
  }
460
469
 
461
470
  declare const Spinner: React.FC<Expand<SpinnerProps> &
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "8.0.6-beta.5",
3
+ "version": "8.0.6-beta.7",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import Expand from "../../../util/expand";
3
3
 
4
4
  export interface ButtonWithActionProps {
5
- action?: React.SyntheticEvent;
5
+ action?: (event: React.ChangeEvent<HTMLInputElement>) => void;
6
6
  variant?: string;
7
7
  text?: string;
8
8
  textWrap?: boolean;
@@ -1,28 +1,19 @@
1
1
  import React from "react";
2
2
  import Expand from "../../../util/expand";
3
-
4
-
5
- interface ErrorMessage {
6
- [fieldName: string]: string;
7
- }
3
+ import { ErrorMessage, Field, FieldActions } from "../../../types/common";
8
4
 
9
5
  export interface FormInputProps {
10
- type?: string;
11
- labelTextWhenNoError?: string;
6
+ extraStyles?: string;
7
+ field?: Field;
8
+ fieldActions?: FieldActions;
9
+ disabled?: boolean;
12
10
  errorMessages?: ErrorMessage[];
13
- isNum?: boolean;
14
- isEmail?: boolean;
15
11
  helperModal?: boolean;
16
- field?: any;
17
- fieldActions?: any;
12
+ isEmail?: boolean;
13
+ isNum?: boolean;
14
+ labelTextWhenNoError?: string;
18
15
  showErrors?: boolean;
19
- formatter?: any;
20
- decorator?: any;
21
- background?: any;
22
- customHeight?: any;
23
- autocomplete?: any;
24
- extraStyles?: any;
25
- removeFromValue?: any;
16
+ type?: string;
26
17
  }
27
18
 
28
19
  export const FormInput: React.FC<Expand<FormInputProps> &
@@ -1,19 +1,21 @@
1
1
  import React from "react";
2
2
  import Expand from "../../../util/expand";
3
+ import { ErrorMessage, Field, FieldActions} from "../../../types/common";
3
4
 
4
5
  interface Option {
5
- text: string;
6
- value: string | number;
6
+ text?: string;
7
+ value?: string | number;
7
8
  }
8
9
 
9
10
  export interface FormSelectProps {
11
+ disabled?: boolean;
10
12
  dropdownMaxHeight?: string;
11
13
  labelTextWhenNoError?: string;
12
14
  options?: Option[];
13
- fieldActions?: any;
15
+ fieldActions?: FieldActions;
14
16
  showErrors?: boolean;
15
- errorMessages?: any;
16
- field?: any;
17
+ errorMessages?: ErrorMessage[]
18
+ field?: Field
17
19
  }
18
20
 
19
21
  export const FormSelect: React.FC<Expand<FormSelectProps> &
@@ -2,8 +2,8 @@ import React from "react";
2
2
  import Expand from "../../../util/expand";
3
3
 
4
4
  export interface SpinnerProps {
5
- size: string;
6
- centerSpinner: boolean;
5
+ size?: string;
6
+ centerSpinner?: boolean;
7
7
  }
8
8
 
9
9
  export const Spinner: React.FC<Expand<SpinnerProps> &
@@ -0,0 +1,4 @@
1
+ export default interface ErrorMessage {
2
+ [fieldName: string]: string;
3
+ }
4
+
@@ -0,0 +1,5 @@
1
+ export default interface Field {
2
+ hasErrors?: boolean;
3
+ dirty?: boolean;
4
+ rawValue?: string;
5
+ }
@@ -0,0 +1,6 @@
1
+ export default interface FieldActions {
2
+ set?: (value: any) => void;
3
+ addValidator?: (validator: any) => void;
4
+ removeValidator?: (validator: any) => void;
5
+ clear?: () => void;
6
+ }
@@ -0,0 +1,3 @@
1
+ export { default as ErrorMessage } from "./ErrorMessage";
2
+ export { default as Field } from "./Field";
3
+ export { default as FieldActions } from "./FieldActions"