@jasperoosthoek/react-toolbox 0.6.2 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 jasperoosthoek
3
+ Copyright (c) 2025 jasperoosthoek
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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 `onKeyPress` instead of deprecated `onKeyPress` handler
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 `ShowCreateModalButton` and `ShowEditModalButton`
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
@@ -253,6 +253,14 @@
253
253
  ##### Version 0.6.1
254
254
  - New `downloadFile` function in `utils`
255
255
 
256
-
257
256
  ##### Version 0.6.2
258
- - `SearchBox` has optional label & placeholder and is wrapped by `Form.Group` component
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: ReactElement | string;
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?: (props: FormComponentProps | FormSelectProps) => ReactElement;
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 ShowCreateModalButton = ButtonProps;
10
- export declare const ShowCreateModalButton: ({ onClick, ...props }: ButtonProps) => React.JSX.Element;
11
- export interface ShowEditModalButtonProps<T, K> extends ButtonProps {
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 ShowEditModalButton: ({ state, onClick, ...props }: ShowEditModalButtonProps<T, K>) => React.JSX.Element;
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>;