loon-bulma-react 2023.0.2 → 2023.0.4
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/README.md +1 -1
- package/dist/contexts/Confirm/ConfirmContextProvider.d.ts +36 -5
- package/dist/index.js +651 -1211
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +651 -1211
- package/dist/index.modern.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -264,7 +264,7 @@ export function MyComponent() {
|
|
|
264
264
|
|
|
265
265
|
De `useConfirm()`-hook exporteert nog meer dan alleen de `confirm()`-function. Deze functies zijn voor intern gebruik.
|
|
266
266
|
|
|
267
|
-
- confirm: `(content: string) => Promise<boolean>`;
|
|
267
|
+
- confirm: `(content: string|React.ReactNode) => Promise<boolean>`;
|
|
268
268
|
- (AFBLIJVEN) onConfirm: `() => void`;
|
|
269
269
|
- (AFBLIJVEN) onCancel: `() => void`;
|
|
270
270
|
- (AFBLIJVEN) confirmState: `State` van de confirm req;
|
|
@@ -6,7 +6,19 @@ declare type State = {
|
|
|
6
6
|
cancel: string;
|
|
7
7
|
others?: React.ReactNode;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Confirm provider om `useConfirm`-hook te kunnen gebruiken.
|
|
11
|
+
* @param children de children
|
|
12
|
+
* @returns
|
|
13
|
+
* @example // index.tsx of App.tsx
|
|
14
|
+
* root.render(
|
|
15
|
+
* <ConfirmProvider>
|
|
16
|
+
* <>
|
|
17
|
+
* // ...
|
|
18
|
+
* </>
|
|
19
|
+
* </ConfirmProvider>)
|
|
20
|
+
*/
|
|
21
|
+
declare function ConfirmProvider({ children }: {
|
|
10
22
|
children: React.ReactNode;
|
|
11
23
|
}): JSX.Element;
|
|
12
24
|
/**
|
|
@@ -14,12 +26,31 @@ export declare function ConfirmProvider({ children }: {
|
|
|
14
26
|
* @param ok tekst voor op de OK-button (default = 'Ok')
|
|
15
27
|
* @param cancel tekst voor opd e cancel-button (default = 'Annuleren')
|
|
16
28
|
* @param others eventuele andere buttons (default = undefined)
|
|
17
|
-
* @returns
|
|
29
|
+
* @returns onConfirm-fn, onCancel-fn, confirm-fn, confirmState
|
|
30
|
+
* @example
|
|
31
|
+
* const { confirm } = useConfirm("Ja", "Nee", <Button>Extra</Button>);
|
|
32
|
+
* const confirmSomethingFromString = (msg: string) => {
|
|
33
|
+
* const isConfirmed = await (confirm(msg))
|
|
34
|
+
* }
|
|
35
|
+
* @example
|
|
36
|
+
* const { confirm } = useConfirm("Ja", "Nee", <Button>Extra</Button>);
|
|
37
|
+
* const confirmSomethingFromFragment = (fragment: React.ReactNode) => {
|
|
38
|
+
* const isConfirmed = await (confirm(fragment))
|
|
39
|
+
* }
|
|
18
40
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
41
|
+
declare function useConfirm(ok?: string, cancel?: string, others?: React.ReactNode): {
|
|
42
|
+
/** INTERNAL USE ONLY - DO NOT USE */
|
|
21
43
|
onConfirm: () => void;
|
|
44
|
+
/** INTERNAL USE ONLY - DO NOT USE */
|
|
22
45
|
onCancel: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* awaitable confirm function. Geef een string of Fragment op om iets in de confirm-modal te tonen
|
|
48
|
+
* @param content string of Fragment met de boodschap voor de confirm
|
|
49
|
+
* @returns Promise<boolean> met true als de gebruiker op OK heeft geklikt, false als anders
|
|
50
|
+
* @example const isConfirmed = await confirm("Weet je het zeker?")
|
|
51
|
+
*/
|
|
52
|
+
confirm: (content: string | React.ReactNode) => Promise<boolean>;
|
|
53
|
+
/** INTERNAL USE ONLY - DO NOT USE */
|
|
23
54
|
confirmState: State;
|
|
24
55
|
};
|
|
25
|
-
export {};
|
|
56
|
+
export { ConfirmProvider, useConfirm };
|