@dismissible/react-client 0.3.2 → 1.0.0
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 +21 -0
- package/README.md +325 -170
- package/dist/components/Dismissible.d.ts +3 -4
- package/dist/contexts/DismissibleContext.d.ts +3 -2
- package/dist/contexts/DismissibleProvider.d.ts +3 -1
- package/dist/dismissible-client.es.js +405 -359
- package/dist/dismissible-client.umd.js +1 -1
- package/dist/hooks/useDismissibleItem.d.ts +6 -7
- package/dist/mockServiceWorker.js +17 -12
- package/dist/{style.css → react-client.css} +1 -1
- package/dist/root.d.ts +0 -1
- package/dist/types/dismissible.types.d.ts +7 -3
- package/dist/utils/auth.utils.d.ts +0 -6
- package/package.json +55 -36
|
@@ -4,23 +4,22 @@ import { default as React } from 'react';
|
|
|
4
4
|
*/
|
|
5
5
|
export interface DismissibleProps {
|
|
6
6
|
/** Unique identifier for the dismissible item */
|
|
7
|
-
|
|
7
|
+
itemId: string;
|
|
8
8
|
/** Content to render when the item is not dismissed */
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
/** Optional callback when item is dismissed */
|
|
11
11
|
onDismiss?: () => void;
|
|
12
12
|
/** Optional custom loading component */
|
|
13
13
|
LoadingComponent?: React.ComponentType<{
|
|
14
|
-
|
|
14
|
+
itemId: string;
|
|
15
15
|
}> | null;
|
|
16
16
|
/** Optional custom error component */
|
|
17
17
|
ErrorComponent?: React.ComponentType<{
|
|
18
|
-
|
|
18
|
+
itemId: string;
|
|
19
19
|
error: Error;
|
|
20
20
|
}> | null;
|
|
21
21
|
/** Optional custom dismiss button component */
|
|
22
22
|
DismissButtonComponent?: React.ComponentType<{
|
|
23
|
-
id: string;
|
|
24
23
|
onDismiss: () => Promise<void>;
|
|
25
24
|
ariaLabel: string;
|
|
26
25
|
}> | null;
|
|
@@ -5,6 +5,7 @@ import { DismissibleContextValue } from '../types/dismissible.types';
|
|
|
5
5
|
export declare const DismissibleContext: import('react').Context<DismissibleContextValue | null>;
|
|
6
6
|
/**
|
|
7
7
|
* Hook to consume the DismissibleContext
|
|
8
|
-
* @
|
|
8
|
+
* @throws Error if used outside of a DismissibleProvider
|
|
9
|
+
* @returns The context value
|
|
9
10
|
*/
|
|
10
|
-
export declare const useDismissibleContext: () => DismissibleContextValue
|
|
11
|
+
export declare const useDismissibleContext: () => DismissibleContextValue;
|
|
@@ -6,12 +6,13 @@ import { DismissibleProviderProps } from '../types/dismissible.types';
|
|
|
6
6
|
* @example
|
|
7
7
|
* ```tsx
|
|
8
8
|
* // With static JWT
|
|
9
|
-
* <DismissibleProvider jwt="eyJhbGciOiJ..." baseUrl="https://api.dismissible.io">
|
|
9
|
+
* <DismissibleProvider userId="user-123" jwt="eyJhbGciOiJ..." baseUrl="https://api.dismissible.io">
|
|
10
10
|
* <App />
|
|
11
11
|
* </DismissibleProvider>
|
|
12
12
|
*
|
|
13
13
|
* // With synchronous JWT function
|
|
14
14
|
* <DismissibleProvider
|
|
15
|
+
* userId="user-123"
|
|
15
16
|
* jwt={() => getAccessToken()}
|
|
16
17
|
* baseUrl="https://api.dismissible.io"
|
|
17
18
|
* >
|
|
@@ -20,6 +21,7 @@ import { DismissibleProviderProps } from '../types/dismissible.types';
|
|
|
20
21
|
*
|
|
21
22
|
* // With asynchronous JWT function
|
|
22
23
|
* <DismissibleProvider
|
|
24
|
+
* userId="user-123"
|
|
23
25
|
* jwt={async () => await fetchAccessToken()}
|
|
24
26
|
* baseUrl="https://api.dismissible.io"
|
|
25
27
|
* >
|