@jasperoosthoek/react-toolbox 0.6.5 → 0.6.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/change-log.md CHANGED
@@ -270,3 +270,11 @@
270
270
 
271
271
  ##### Version 0.6.5
272
272
  - The `DataTable` `selector` function can output `null` as well
273
+
274
+ ##### Version 0.6.6
275
+ - Improve types of `FormFields`
276
+ - Validate `list` argument of `FormDropdown` component
277
+
278
+ ##### Version 0.6.7
279
+ - New `customHeader` in `DataTable` component
280
+ - Stricter types in `FormDropdown` component
@@ -24,28 +24,28 @@ export type FormType = {
24
24
  keyName: string;
25
25
  pristine: boolean;
26
26
  };
27
- export type FormInputProps = Omit<FormControlProps, 'onChange'> & FormType & {
27
+ export interface FormInputProps extends Omit<FormControlProps, 'onChange'>, FormType {
28
28
  onChange: (value: FormValue) => void;
29
29
  controlId?: string;
30
30
  label?: ReactElement;
31
31
  onEnter?: () => void;
32
32
  rows?: number;
33
- };
33
+ }
34
34
  export declare const FormInput: ({ label, value, onEnter, placeholder, onChange, controlId, state, setState, initialState, initialValue, keyName, pristine, id, ...formProps }: FormInputProps) => React.JSX.Element;
35
35
  export declare const FormTextArea: ({ as, rows, ...restProps }: FormInputProps) => React.JSX.Element;
36
36
  export declare const FormDate: (props: FormInputProps) => React.JSX.Element;
37
- export type FormDateTimeProps = Omit<FormInputProps, 'onChange' | 'value'> & {
37
+ export interface FormDateTimeProps extends Omit<FormInputProps, 'onChange' | 'value'> {
38
38
  value: string | Moment;
39
39
  onChange: (value: string) => void;
40
- };
40
+ }
41
41
  export declare const FormDateTime: ({ value, onChange, ...restProps }: FormDateTimeProps) => React.JSX.Element;
42
- export type FormCheckboxProps = Omit<FormCheckProps, 'onChange'> & FormType & {
42
+ export interface FormCheckboxProps extends Omit<FormCheckProps, 'onChange'>, FormType {
43
43
  onChange: (value: boolean) => void;
44
44
  controlId?: string;
45
45
  label?: ReactElement;
46
46
  onEnter?: () => void;
47
47
  rows?: number;
48
- };
48
+ }
49
49
  export declare const FormCheckbox: ({ value, onChange, state, label, keyName, controlId, initialState, initialValue, setState, pristine, id, ...restProps }: FormCheckboxProps) => React.JSX.Element;
50
50
  export declare const FormSwitch: ({ className, ...restProps }: FormCheckboxProps) => React.JSX.Element;
51
51
  export type DisabledProps = {
@@ -55,7 +55,7 @@ export type DisabledProps = {
55
55
  initialState: any;
56
56
  initialValue: any;
57
57
  };
58
- export type FormSelectProps = Omit<FormInputProps, 'disabled' | 'onChange'> & {
58
+ export interface FormSelectProps extends Omit<FormInputProps, 'disabled' | 'onChange' | 'list'> {
59
59
  onChange: (value: number | string | number[] | string[] | null) => void;
60
60
  list: any[];
61
61
  multiple?: boolean;
@@ -63,7 +63,7 @@ export type FormSelectProps = Omit<FormInputProps, 'disabled' | 'onChange'> & {
63
63
  formatTitle?: (item: any) => ReactElement;
64
64
  idKey?: string;
65
65
  disabled?: boolean | ((props: DisabledProps) => boolean);
66
- };
66
+ }
67
67
  export declare const FormSelect: ({ list, idKey, integer, value, defaultValue, onChange, label, controlId, htmlSize, state, formatTitle, multiple, disabled, isInvalid, initialState, initialValue, keyName, pristine, }: FormSelectProps) => React.JSX.Element;
68
68
  export interface BadgeSelectionProps extends BadgeProps {
69
69
  selected: boolean;
@@ -73,11 +73,12 @@ export interface BadgeSelectionProps extends BadgeProps {
73
73
  export declare const BadgeSelection: ({ selected, disabled, cursor, onClick, style, bg, ...restProps }: BadgeSelectionProps) => React.JSX.Element;
74
74
  export type FormBadgesSelectionProps = FormSelectProps;
75
75
  export declare const FormBadgesSelection: ({ list, idKey, value, onChange, multiple, label, integer, controlId, isInvalid, state, setState, disabled, initialState, initialValue, keyName, pristine, ...restProps }: FormBadgesSelectionProps) => React.JSX.Element;
76
- export type FormDropdownProps = Omit<FormInputProps, 'disabled' | 'onChange'> & {
76
+ export interface FormDropdownProps<T> extends Omit<FormInputProps, 'disabled' | 'onChange' | 'list'> {
77
77
  onChange: (value: number | string | number[] | string[] | null) => void;
78
- list: any[];
79
- idKey?: string;
78
+ list: T[];
79
+ idKey?: keyof T;
80
+ nameKey?: keyof T;
80
81
  disabled?: boolean | ((props: DisabledProps) => boolean);
81
82
  variant?: Variant;
82
- };
83
- export declare const FormDropdown: ({ list, id, value, onChange, label, controlId, isInvalid, state, setState, disabled, initialState, initialValue, variant, keyName, pristine, ...restProps }: FormDropdownProps) => React.JSX.Element;
83
+ }
84
+ export declare const FormDropdown: <T>({ list: listBase, idKey, nameKey, value, onChange, label, controlId, isInvalid, state, setState, disabled, initialState, initialValue, variant, pristine, keyName, ...restProps }: FormDropdownProps<T>) => React.JSX.Element;
@@ -30,6 +30,7 @@ export type DataTableHeader = {
30
30
  search?: boolean;
31
31
  numberOfRows?: boolean;
32
32
  pagination?: boolean;
33
+ customHeader?: ReactElement | string;
33
34
  };
34
35
  export type DataTableProps<D extends any[]> = {
35
36
  data: D;