@jasperoosthoek/react-toolbox 0.6.1 → 0.6.3
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/LICENSE +1 -1
- package/change-log.md +15 -3
- package/dist/components/buttons/ConfirmButton.d.ts +1 -1
- package/dist/components/buttons/IconButtons.d.ts +1 -0
- package/dist/components/forms/FormModal.d.ts +2 -1
- package/dist/components/forms/FormModalProvider.d.ts +4 -4
- package/dist/components/tables/SearchBox.d.ts +4 -2
- package/dist/index.js +2 -2
- package/dist/localization/LocalizationContext.d.ts +3 -0
- package/dist/localization/localization.d.ts +4 -3
- package/dist/login/Login.d.ts +1 -1
- package/dist/utils/hooks.d.ts +1 -1
- package/package.json +5 -5
- package/src/components/buttons/ConfirmButton.tsx +1 -1
- package/src/components/buttons/IconButtons.tsx +6 -4
- package/src/components/forms/FormModal.tsx +6 -4
- package/src/components/forms/FormModalProvider.tsx +8 -5
- package/src/components/tables/DataTable.tsx +6 -6
- package/src/components/tables/SearchBox.tsx +39 -21
- package/src/localization/LocalizationContext.tsx +28 -4
- package/src/localization/localization.ts +6 -5
- package/src/login/Login.tsx +3 -5
package/LICENSE
CHANGED
package/change-log.md
CHANGED
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
- New French translation
|
|
111
111
|
- New `storeState` & `retrieveState` functions to store and retrieve state object from `localStorage`
|
|
112
112
|
- Convert everything to Typescript
|
|
113
|
-
- `CreateEditModal` component uses `
|
|
113
|
+
- `CreateEditModal` component uses `onKeyDown` instead of deprecated `onKeyPress` handler
|
|
114
114
|
|
|
115
115
|
##### Version 0.3.5
|
|
116
116
|
- New `SaveButton` component
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
- Allow `validate` function in `CreateEditModal` to allow objects with empty values
|
|
216
216
|
|
|
217
217
|
##### Version 0.4.25
|
|
218
|
-
- Usable `onClick` handler in
|
|
218
|
+
- Usable `onClick` handler in `ShowCreateModalButton` and `ShowEditModalButton`
|
|
219
219
|
|
|
220
220
|
##### Version 0.4.26
|
|
221
221
|
- Prop `orderByColumn` of `DataTable` can be a function that yields a number
|
|
@@ -251,4 +251,16 @@
|
|
|
251
251
|
- Update to React 19
|
|
252
252
|
|
|
253
253
|
##### Version 0.6.1
|
|
254
|
-
- New `downloadFile` function in `utils`
|
|
254
|
+
- New `downloadFile` function in `utils`
|
|
255
|
+
|
|
256
|
+
##### Version 0.6.2
|
|
257
|
+
- `SearchBox` has optional label & placeholder and is wrapped by `Form.Group` component
|
|
258
|
+
|
|
259
|
+
##### Version 0.6.3
|
|
260
|
+
- New `textByLang` localization function in `useLocalization`
|
|
261
|
+
- New `combineLocalization` helper function
|
|
262
|
+
- Rename `ShowCreateModalButton` to `FormCreateModalButton`
|
|
263
|
+
- Rename `ShowEditModalButton` to `FormEditModalButton`
|
|
264
|
+
- Fix incorrect calculation of number of pages in `DataTable`
|
|
265
|
+
- Fix `FormModalProvider` does not pass `validate` function to create and edit modals
|
|
266
|
+
- New `ResetButton` component
|
|
@@ -2,7 +2,7 @@ import React, { ReactElement } from 'react';
|
|
|
2
2
|
import { Button } from 'react-bootstrap';
|
|
3
3
|
import { ButtonProps } from './IconButtons';
|
|
4
4
|
export interface ConfirmButtonProps extends ButtonProps {
|
|
5
|
-
modalTitle
|
|
5
|
+
modalTitle?: ReactElement | string;
|
|
6
6
|
modalBody?: ReactElement | string;
|
|
7
7
|
confirmText?: ReactElement | string;
|
|
8
8
|
cancelText?: ReactElement | string;
|
|
@@ -46,6 +46,7 @@ export declare const UpButton: (props: ButtonProps) => React.JSX.Element;
|
|
|
46
46
|
export declare const UploadButton: (props: ButtonProps) => React.JSX.Element;
|
|
47
47
|
export declare const QuestionnaireButton: (props: ButtonProps) => React.JSX.Element;
|
|
48
48
|
export declare const DropdownButton: (props: ButtonProps) => React.JSX.Element;
|
|
49
|
+
export declare const ResetButton: (props: ButtonProps) => React.JSX.Element;
|
|
49
50
|
export interface UploadTextButtonProps extends ButtonProps {
|
|
50
51
|
accept?: string;
|
|
51
52
|
onLoadFile: (result: string | ArrayBuffer) => void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
import { FormComponentProps, FormSelectProps, FormOnChange, FormValue } from './FormFields';
|
|
3
|
+
export type FormFieldComponent = (props: FormComponentProps | FormSelectProps) => ReactElement;
|
|
3
4
|
export type FormField = {
|
|
4
5
|
initialValue?: any;
|
|
5
6
|
type?: 'string' | 'number';
|
|
6
7
|
required?: boolean;
|
|
7
8
|
formProps?: any;
|
|
8
|
-
component?:
|
|
9
|
+
component?: FormFieldComponent;
|
|
9
10
|
onChange?: FormOnChange;
|
|
10
11
|
label?: ReactElement | string;
|
|
11
12
|
};
|
|
@@ -6,14 +6,14 @@ export type ShowCreateModal = (show?: boolean) => void;
|
|
|
6
6
|
export type ShowEditModal<T, K> = (state: {
|
|
7
7
|
[key in keyof T]: FormValue;
|
|
8
8
|
} & K) => void;
|
|
9
|
-
export type
|
|
10
|
-
export declare const
|
|
11
|
-
export interface
|
|
9
|
+
export type FormCreateModalButton = ButtonProps;
|
|
10
|
+
export declare const FormCreateModalButton: ({ onClick, ...props }: ButtonProps) => React.JSX.Element;
|
|
11
|
+
export interface FormEditModalButtonProps<T, K> extends ButtonProps {
|
|
12
12
|
state: {
|
|
13
13
|
[key in keyof T]: FormValue;
|
|
14
14
|
} & K;
|
|
15
15
|
}
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const FormEditModalButton: ({ state, onClick, ...props }: FormEditModalButtonProps<T, K>) => React.JSX.Element;
|
|
17
17
|
type FormModalContextType<T, K> = {
|
|
18
18
|
showCreateModal: ShowCreateModal;
|
|
19
19
|
showEditModal: ShowEditModal<T, K>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
export type SearchBoxProps = {
|
|
3
3
|
className?: string;
|
|
4
4
|
value: string;
|
|
5
5
|
onChange: (value: string) => void;
|
|
6
6
|
onClear?: () => void;
|
|
7
7
|
onSearch?: () => void;
|
|
8
|
+
label?: ReactNode | string | number;
|
|
9
|
+
placeholder?: string | false;
|
|
8
10
|
};
|
|
9
|
-
export declare const SearchBox: ({ className, value, onChange, onClear, onSearch }: SearchBoxProps) => React.JSX.Element;
|
|
11
|
+
export declare const SearchBox: ({ className, value, onChange, onClear, onSearch, label, placeholder, }: SearchBoxProps) => React.JSX.Element;
|