@limboai/react 0.1.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/README.md +134 -0
- package/dist/icons/CRLogo.d.ts +12 -0
- package/dist/icons/LinkedInIcon.d.ts +13 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/index.cjs +2169 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.mjs +2147 -0
- package/dist/index.mjs.map +1 -0
- package/dist/shared/hooks/index.d.ts +2 -0
- package/dist/shared/hooks/useTooltipVisibility.d.ts +32 -0
- package/dist/shared/index.d.ts +2 -0
- package/dist/types/index.d.ts +59 -0
- package/dist/types/media.d.ts +56 -0
- package/dist/ui/core/Slot.d.ts +33 -0
- package/dist/ui/core/credential/CredentialBadge.d.ts +63 -0
- package/dist/ui/core/credential/CredentialOverlayContent.d.ts +23 -0
- package/dist/ui/core/credential/CredentialOverlayRoot.d.ts +35 -0
- package/dist/ui/core/credential/CredentialOverlayTrigger.d.ts +23 -0
- package/dist/ui/core/credential/context/CredentialBadgeContext.d.ts +8 -0
- package/dist/ui/core/credential/context/CredentialOverlayContext.d.ts +21 -0
- package/dist/ui/core/credential/context/index.d.ts +2 -0
- package/dist/ui/core/credential/hooks/index.d.ts +2 -0
- package/dist/ui/core/credential/hooks/useCredentialBadgeContext.d.ts +15 -0
- package/dist/ui/core/credential/hooks/useCredentialOverlayContext.d.ts +23 -0
- package/dist/ui/core/credential/index.d.ts +36 -0
- package/dist/ui/core/index.d.ts +2 -0
- package/dist/ui/core/passport/PassportActions.d.ts +27 -0
- package/dist/ui/core/passport/PassportCopyButton.d.ts +38 -0
- package/dist/ui/core/passport/PassportField.d.ts +39 -0
- package/dist/ui/core/passport/PassportFooter.d.ts +20 -0
- package/dist/ui/core/passport/PassportHeader.d.ts +19 -0
- package/dist/ui/core/passport/PassportIdentities.d.ts +35 -0
- package/dist/ui/core/passport/PassportLogo.d.ts +25 -0
- package/dist/ui/core/passport/PassportRoot.d.ts +24 -0
- package/dist/ui/core/passport/PassportSigners.d.ts +28 -0
- package/dist/ui/core/passport/PassportTitle.d.ts +30 -0
- package/dist/ui/core/passport/context/PassportContext.d.ts +12 -0
- package/dist/ui/core/passport/context/index.d.ts +1 -0
- package/dist/ui/core/passport/hooks/index.d.ts +2 -0
- package/dist/ui/core/passport/hooks/usePassportContext.d.ts +20 -0
- package/dist/ui/core/passport/hooks/usePassportData.d.ts +22 -0
- package/dist/ui/core/passport/index.d.ts +49 -0
- package/dist/ui/default/LimboBadge.d.ts +22 -0
- package/dist/ui/default/LimboImage.d.ts +66 -0
- package/dist/ui/default/LimboPassport.d.ts +30 -0
- package/dist/ui/default/LimboVideo.d.ts +64 -0
- package/dist/ui/default/constants.d.ts +19 -0
- package/dist/ui/default/index.d.ts +10 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/media/MediaImage.d.ts +87 -0
- package/dist/ui/media/MediaVideo.d.ts +85 -0
- package/dist/ui/media/context/MediaContext.d.ts +19 -0
- package/dist/ui/media/context/index.d.ts +1 -0
- package/dist/ui/media/hooks/index.d.ts +3 -0
- package/dist/ui/media/hooks/useHeicConversion.d.ts +32 -0
- package/dist/ui/media/hooks/useMediaContext.d.ts +13 -0
- package/dist/ui/media/hooks/useMediaOverlay.d.ts +37 -0
- package/dist/ui/media/index.d.ts +5 -0
- package/package.json +71 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
3
|
+
import type { ValidationStatusType } from "../../../types";
|
|
4
|
+
export interface CredentialOverlayRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Validation result from @limboai/node SDK (null if not validated yet) */
|
|
6
|
+
validation?: C2PAValidationResponse | null;
|
|
7
|
+
/** Current validation status */
|
|
8
|
+
status?: ValidationStatusType;
|
|
9
|
+
/** Children to render */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** Delay in ms before hiding the tooltip (default: 300ms) */
|
|
12
|
+
hideDelay?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* CredentialOverlay.Root - Provider wrapper for the CredentialOverlay compound component
|
|
16
|
+
*
|
|
17
|
+
* Provides context with validation data and visibility state to all child components.
|
|
18
|
+
* Manages tooltip visibility with configurable hide delay.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <CredentialOverlay.Root validation={validation} status="success">
|
|
23
|
+
* <CredentialOverlay.Trigger className="absolute top-2 right-2">
|
|
24
|
+
* <button className="bg-green-500 p-2 rounded-full">✓</button>
|
|
25
|
+
* </CredentialOverlay.Trigger>
|
|
26
|
+
*
|
|
27
|
+
* <CredentialOverlay.Content className="absolute top-12 right-0 bg-white shadow-lg rounded-lg p-4">
|
|
28
|
+
* <Passport.Root validation={validation}>
|
|
29
|
+
* ...
|
|
30
|
+
* </Passport.Root>
|
|
31
|
+
* </CredentialOverlay.Content>
|
|
32
|
+
* </CredentialOverlay.Root>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const CredentialOverlayRoot: import("react").ForwardRefExoticComponent<CredentialOverlayRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface CredentialOverlayTriggerProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
3
|
+
/** Use child element instead of default div */
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
/** Children to render */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* CredentialOverlay.Trigger - Trigger element for showing/hiding the overlay
|
|
10
|
+
*
|
|
11
|
+
* Attaches hover and click handlers to show/hide the tooltip.
|
|
12
|
+
* Use asChild to render your own element.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <CredentialOverlay.Trigger asChild>
|
|
17
|
+
* <button className="bg-green-500 p-2 rounded-full">
|
|
18
|
+
* <CheckIcon />
|
|
19
|
+
* </button>
|
|
20
|
+
* </CredentialOverlay.Trigger>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const CredentialOverlayTrigger: import("react").ForwardRefExoticComponent<CredentialOverlayTriggerProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ValidationStatusType } from "../../../../types";
|
|
2
|
+
export interface CredentialBadgeContextValue {
|
|
3
|
+
/** Current validation status */
|
|
4
|
+
status: ValidationStatusType;
|
|
5
|
+
/** Whether the content has credentials */
|
|
6
|
+
hasCredentials: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const CredentialBadgeContext: import("react").Context<CredentialBadgeContextValue | null>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import type { ValidationStatusType } from "../../../../types";
|
|
3
|
+
export interface CredentialOverlayContextValue {
|
|
4
|
+
/** Validation result from @limboai/node SDK */
|
|
5
|
+
validation?: C2PAValidationResponse | null;
|
|
6
|
+
/** Current validation status */
|
|
7
|
+
status: ValidationStatusType;
|
|
8
|
+
/** Whether the content has credentials */
|
|
9
|
+
hasCredentials: boolean;
|
|
10
|
+
/** Whether the tooltip is visible */
|
|
11
|
+
isVisible: boolean;
|
|
12
|
+
/** Show the tooltip */
|
|
13
|
+
show: () => void;
|
|
14
|
+
/** Hide the tooltip */
|
|
15
|
+
hide: () => void;
|
|
16
|
+
/** Toggle tooltip visibility */
|
|
17
|
+
toggle: () => void;
|
|
18
|
+
/** Unique ID for aria associations */
|
|
19
|
+
overlayId: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const CredentialOverlayContext: import("react").Context<CredentialOverlayContextValue | null>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CredentialBadgeContextValue } from "../context/CredentialBadgeContext";
|
|
2
|
+
/**
|
|
3
|
+
* Access the CredentialBadge context
|
|
4
|
+
*
|
|
5
|
+
* Must be used within a CredentialBadge.Root component
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* function MyBadgeContent() {
|
|
10
|
+
* const { status, hasCredentials } = useCredentialBadgeContext();
|
|
11
|
+
* return <div>{status}</div>;
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function useCredentialBadgeContext(): CredentialBadgeContextValue;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type CredentialOverlayContextValue } from "../context/CredentialOverlayContext";
|
|
2
|
+
/**
|
|
3
|
+
* Access the CredentialOverlay context
|
|
4
|
+
*
|
|
5
|
+
* Must be used within a CredentialOverlay.Root component
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* function MyTrigger() {
|
|
10
|
+
* const { show, hide, toggle, isVisible } = useCredentialOverlayContext();
|
|
11
|
+
* return (
|
|
12
|
+
* <button
|
|
13
|
+
* onMouseEnter={show}
|
|
14
|
+
* onMouseLeave={hide}
|
|
15
|
+
* onClick={toggle}
|
|
16
|
+
* >
|
|
17
|
+
* {isVisible ? "Hide" : "Show"}
|
|
18
|
+
* </button>
|
|
19
|
+
* );
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useCredentialOverlayContext(): CredentialOverlayContextValue;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CredentialBadge } from "./CredentialBadge";
|
|
2
|
+
export { CredentialBadge };
|
|
3
|
+
/**
|
|
4
|
+
* CredentialOverlay - Headless compound component for trigger + tooltip pattern
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { CredentialOverlay, Passport, CredentialBadge } from "@limboai/react";
|
|
9
|
+
*
|
|
10
|
+
* <div className="relative">
|
|
11
|
+
* <img src="/photo.jpg" />
|
|
12
|
+
*
|
|
13
|
+
* <CredentialOverlay.Root validation={validation} status={status}>
|
|
14
|
+
* <CredentialOverlay.Trigger className="absolute top-2 right-2">
|
|
15
|
+
* <CredentialBadge.Root status={status} hasCredentials={hasCredentials}>
|
|
16
|
+
* <CredentialBadge.Verified>
|
|
17
|
+
* <button className="bg-green-500 p-2 rounded-full">✓</button>
|
|
18
|
+
* </CredentialBadge.Verified>
|
|
19
|
+
* </CredentialBadge.Root>
|
|
20
|
+
* </CredentialOverlay.Trigger>
|
|
21
|
+
*
|
|
22
|
+
* <CredentialOverlay.Content className="absolute top-12 right-0 bg-white shadow-lg rounded-lg p-4">
|
|
23
|
+
* <Passport.Root validation={validation}>
|
|
24
|
+
* ...
|
|
25
|
+
* </Passport.Root>
|
|
26
|
+
* </CredentialOverlay.Content>
|
|
27
|
+
* </CredentialOverlay.Root>
|
|
28
|
+
* </div>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const CredentialOverlay: {
|
|
32
|
+
Root: import("react").ForwardRefExoticComponent<import("./CredentialOverlayRoot").CredentialOverlayRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
33
|
+
Trigger: import("react").ForwardRefExoticComponent<import("./CredentialOverlayTrigger").CredentialOverlayTriggerProps & import("react").RefAttributes<HTMLElement>>;
|
|
34
|
+
Content: import("react").ForwardRefExoticComponent<import("./CredentialOverlayContent").CredentialOverlayContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
35
|
+
};
|
|
36
|
+
export { useCredentialBadgeContext, useCredentialOverlayContext, } from "./hooks";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface PassportActionsProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
3
|
+
/** Render function for custom layout */
|
|
4
|
+
children?: (actions: string[]) => ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Passport.Actions - Display actions from the manifest
|
|
8
|
+
*
|
|
9
|
+
* Renders actions using a render prop for full styling control.
|
|
10
|
+
* Returns null if there are no actions.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Passport.Actions className="mt-4">
|
|
15
|
+
* {(actions) => (
|
|
16
|
+
* <div className="flex gap-2">
|
|
17
|
+
* {actions.map((action) => (
|
|
18
|
+
* <span key={action} className="tag bg-gray-100 px-2 py-1 rounded">
|
|
19
|
+
* {action}
|
|
20
|
+
* </span>
|
|
21
|
+
* ))}
|
|
22
|
+
* </div>
|
|
23
|
+
* )}
|
|
24
|
+
* </Passport.Actions>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const PassportActions: import("react").ForwardRefExoticComponent<PassportActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface PassportCopyButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
3
|
+
/** Use child element instead of default button */
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
/** Custom element to render (only used with asChild) */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Passport.CopyButton - Copy validation JSON to clipboard
|
|
10
|
+
*
|
|
11
|
+
* Renders a button that copies the validation JSON to clipboard.
|
|
12
|
+
* Supports pending state from React 19's useActionState.
|
|
13
|
+
* Use asChild to provide your own button element.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* // Default button
|
|
18
|
+
* <Passport.CopyButton className="btn" />
|
|
19
|
+
*
|
|
20
|
+
* // Custom button with asChild
|
|
21
|
+
* <Passport.CopyButton asChild>
|
|
22
|
+
* <button className="my-button">
|
|
23
|
+
* Copy JSON
|
|
24
|
+
* </button>
|
|
25
|
+
* </Passport.CopyButton>
|
|
26
|
+
*
|
|
27
|
+
* // Access pending state in custom component
|
|
28
|
+
* function CustomCopyButton() {
|
|
29
|
+
* const { copyJson, copied, isPending } = usePassportContext();
|
|
30
|
+
* return (
|
|
31
|
+
* <button onClick={copyJson} disabled={isPending}>
|
|
32
|
+
* {isPending ? "Copying..." : copied ? "Copied!" : "Copy"}
|
|
33
|
+
* </button>
|
|
34
|
+
* );
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare const PassportCopyButton: import("react").ForwardRefExoticComponent<PassportCopyButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import { type PassportFieldNameType } from "../../../types";
|
|
3
|
+
export interface PassportFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
4
|
+
/** Field name to display */
|
|
5
|
+
name: PassportFieldNameType;
|
|
6
|
+
/** Custom label (overrides default) */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Render function for custom layout */
|
|
9
|
+
children?: (props: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}) => ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Passport.Field - Display a field from the passport data
|
|
16
|
+
*
|
|
17
|
+
* Automatically fills the value from context based on the field name.
|
|
18
|
+
* Use a render function for complete control over layout.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // Simple usage with default rendering
|
|
23
|
+
* <Passport.Field name="issuer" className="mb-2" />
|
|
24
|
+
*
|
|
25
|
+
* // Custom label
|
|
26
|
+
* <Passport.Field name="date" label="Signed on" />
|
|
27
|
+
*
|
|
28
|
+
* // Render function for custom layout
|
|
29
|
+
* <Passport.Field name="issuer">
|
|
30
|
+
* {({ label, value }) => (
|
|
31
|
+
* <div className="flex justify-between">
|
|
32
|
+
* <span className="font-bold">{label}</span>
|
|
33
|
+
* <span>{value}</span>
|
|
34
|
+
* </div>
|
|
35
|
+
* )}
|
|
36
|
+
* </Passport.Field>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const PassportField: import("react").ForwardRefExoticComponent<PassportFieldProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface PassportFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Children to render in the footer */
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Passport.Footer - Footer slot for the Passport
|
|
8
|
+
*
|
|
9
|
+
* A simple div wrapper for footer content. Style it yourself.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Passport.Footer className="mt-4 border-t pt-4 flex justify-end">
|
|
14
|
+
* <Passport.CopyButton asChild>
|
|
15
|
+
* <button className="btn-primary">Copy JSON</button>
|
|
16
|
+
* </Passport.CopyButton>
|
|
17
|
+
* </Passport.Footer>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const PassportFooter: import("react").ForwardRefExoticComponent<PassportFooterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface PassportHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Children to render in the header */
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Passport.Header - Header slot for the Passport
|
|
8
|
+
*
|
|
9
|
+
* A simple div wrapper for header content. Style it yourself.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Passport.Header className="flex items-center gap-2 mb-4">
|
|
14
|
+
* <Passport.Logo className="w-6 h-6" />
|
|
15
|
+
* <Passport.Title className="text-lg font-bold" />
|
|
16
|
+
* </Passport.Header>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const PassportHeader: import("react").ForwardRefExoticComponent<PassportHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { IdentityInfo } from "../../../types";
|
|
3
|
+
export interface PassportIdentitiesProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
4
|
+
/** Render function for custom layout */
|
|
5
|
+
children?: (identities: IdentityInfo[]) => ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Passport.Identities - Display verified identities from the manifest
|
|
9
|
+
*
|
|
10
|
+
* Renders identities using a render prop for full styling control.
|
|
11
|
+
* Returns null if there are no identities.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Passport.Identities className="mt-4">
|
|
16
|
+
* {(identities) => (
|
|
17
|
+
* <ul className="space-y-2">
|
|
18
|
+
* {identities.map((identity) => (
|
|
19
|
+
* <li key={identity.provider} className="flex items-center gap-2">
|
|
20
|
+
* {identity.provider === "LinkedIn" && <LinkedInIcon />}
|
|
21
|
+
* {identity.uri ? (
|
|
22
|
+
* <a href={identity.uri} target="_blank" rel="noopener noreferrer">
|
|
23
|
+
* {identity.username}
|
|
24
|
+
* </a>
|
|
25
|
+
* ) : (
|
|
26
|
+
* <span>{identity.username}</span>
|
|
27
|
+
* )}
|
|
28
|
+
* </li>
|
|
29
|
+
* ))}
|
|
30
|
+
* </ul>
|
|
31
|
+
* )}
|
|
32
|
+
* </Passport.Identities>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const PassportIdentities: import("react").ForwardRefExoticComponent<PassportIdentitiesProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface PassportLogoProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
3
|
+
/** Use child element instead of default logo */
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
/** Custom element to render (only used with asChild) */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Passport.Logo - Logo for the Passport
|
|
10
|
+
*
|
|
11
|
+
* Renders the Content Credentials logo by default.
|
|
12
|
+
* Use asChild to provide your own logo element.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Default logo
|
|
17
|
+
* <Passport.Logo className="w-6 h-6" />
|
|
18
|
+
*
|
|
19
|
+
* // Custom logo with asChild
|
|
20
|
+
* <Passport.Logo asChild>
|
|
21
|
+
* <img src="/my-logo.svg" alt="Logo" className="w-6 h-6" />
|
|
22
|
+
* </Passport.Logo>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const PassportLogo: import("react").ForwardRefExoticComponent<PassportLogoProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
3
|
+
export interface PassportRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Validation result from @limboai/node SDK */
|
|
5
|
+
validation: C2PAValidationResponse;
|
|
6
|
+
/** Children to render */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Passport.Root - Provider wrapper for the Passport compound component
|
|
11
|
+
*
|
|
12
|
+
* Provides context with processed validation data to all child components.
|
|
13
|
+
* Uses React 19's useTransition for non-blocking copy operations.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Passport.Root validation={validation} className="my-tooltip bg-white p-4 rounded">
|
|
18
|
+
* <Passport.Header />
|
|
19
|
+
* <Passport.Field name="issuer" />
|
|
20
|
+
* <Passport.Footer />
|
|
21
|
+
* </Passport.Root>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const PassportRoot: import("react").ForwardRefExoticComponent<PassportRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import type { SignerInfo } from "../../../types";
|
|
3
|
+
export interface PassportSignersProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
4
|
+
/** Render function for custom layout */
|
|
5
|
+
children?: (signers: SignerInfo[]) => ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Passport.Signers - Display previous signers in the manifest chain
|
|
9
|
+
*
|
|
10
|
+
* Renders signers using a render prop for full styling control.
|
|
11
|
+
* Returns null if there are no previous signers.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <Passport.Signers className="mt-4">
|
|
16
|
+
* {(signers) => (
|
|
17
|
+
* <ul className="space-y-1">
|
|
18
|
+
* {signers.map((signer) => (
|
|
19
|
+
* <li key={signer.id} className="text-sm text-gray-600">
|
|
20
|
+
* {signer.label}
|
|
21
|
+
* </li>
|
|
22
|
+
* ))}
|
|
23
|
+
* </ul>
|
|
24
|
+
* )}
|
|
25
|
+
* </Passport.Signers>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const PassportSigners: import("react").ForwardRefExoticComponent<PassportSignersProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface PassportTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
3
|
+
/** Use child element as the title element */
|
|
4
|
+
asChild?: boolean;
|
|
5
|
+
/** Children to render (if not provided, renders "Content Credentials") */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Passport.Title - Title for the Passport
|
|
10
|
+
*
|
|
11
|
+
* Renders a heading with the passport title. Defaults to "Content Credentials"
|
|
12
|
+
* if no children are provided.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Default title
|
|
17
|
+
* <Passport.Title className="text-lg font-bold" />
|
|
18
|
+
*
|
|
19
|
+
* // Custom title
|
|
20
|
+
* <Passport.Title className="text-lg font-bold">
|
|
21
|
+
* My Custom Title
|
|
22
|
+
* </Passport.Title>
|
|
23
|
+
*
|
|
24
|
+
* // With asChild
|
|
25
|
+
* <Passport.Title asChild>
|
|
26
|
+
* <h1 className="custom-heading">Content Credentials</h1>
|
|
27
|
+
* </Passport.Title>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const PassportTitle: import("react").ForwardRefExoticComponent<PassportTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PassportData } from "../../../../types";
|
|
2
|
+
export interface PassportContextValue extends PassportData {
|
|
3
|
+
/** Copy validation JSON to clipboard */
|
|
4
|
+
copyJson: () => Promise<boolean>;
|
|
5
|
+
/** Whether the JSON was recently copied */
|
|
6
|
+
copied: boolean;
|
|
7
|
+
/** Whether a copy action is in progress */
|
|
8
|
+
isPending: boolean;
|
|
9
|
+
/** Unique ID for the title element (for aria-labelledby) */
|
|
10
|
+
titleId: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const PassportContext: import("react").Context<PassportContextValue | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { PassportContextValue } from "./PassportContext";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type PassportContextValue } from "../context/PassportContext";
|
|
2
|
+
/**
|
|
3
|
+
* Access the Passport context
|
|
4
|
+
*
|
|
5
|
+
* Must be used within a Passport.Root component
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* function MyCustomField() {
|
|
10
|
+
* const { issuer, issuedDate, copied, isPending } = usePassportContext();
|
|
11
|
+
* return (
|
|
12
|
+
* <div>
|
|
13
|
+
* <p>{issuer} - {issuedDate}</p>
|
|
14
|
+
* {isPending && <span>Copying...</span>}
|
|
15
|
+
* </div>
|
|
16
|
+
* );
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function usePassportContext(): PassportContextValue;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import type { PassportData } from "../../../../types";
|
|
3
|
+
/**
|
|
4
|
+
* Hook to extract and process data from a C2PA validation response
|
|
5
|
+
*
|
|
6
|
+
* Extracts issuer, date, actions, identities, and signers from the validation
|
|
7
|
+
* response for easy consumption by Passport components.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const { issuer, issuedDate, actions, verifiedIdentities, previousSigners } =
|
|
12
|
+
* usePassportData(validation);
|
|
13
|
+
*
|
|
14
|
+
* return (
|
|
15
|
+
* <div>
|
|
16
|
+
* <p>Issued by: {issuer}</p>
|
|
17
|
+
* <p>Date: {issuedDate}</p>
|
|
18
|
+
* </div>
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function usePassportData(validation: C2PAValidationResponse): PassportData;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passport - Headless compound component for displaying C2PA content credentials
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import { Passport } from "@limboai/react";
|
|
7
|
+
*
|
|
8
|
+
* <Passport.Root validation={validation} className="my-tooltip">
|
|
9
|
+
* <Passport.Header className="flex items-center gap-2">
|
|
10
|
+
* <Passport.Logo className="w-6 h-6" />
|
|
11
|
+
* <Passport.Title className="text-lg font-bold" />
|
|
12
|
+
* </Passport.Header>
|
|
13
|
+
*
|
|
14
|
+
* <Passport.Field name="issuer" className="my-field" />
|
|
15
|
+
* <Passport.Field name="date" className="my-field" />
|
|
16
|
+
*
|
|
17
|
+
* <Passport.Actions className="mt-4">
|
|
18
|
+
* {(actions) => actions.map(a => <span key={a} className="tag">{a}</span>)}
|
|
19
|
+
* </Passport.Actions>
|
|
20
|
+
*
|
|
21
|
+
* <Passport.Identities>
|
|
22
|
+
* {(identities) => identities.map(id => <MyIdentityCard key={id.provider} {...id} />)}
|
|
23
|
+
* </Passport.Identities>
|
|
24
|
+
*
|
|
25
|
+
* <Passport.Signers>
|
|
26
|
+
* {(signers) => signers.map(s => <MySignerRow key={s.id} {...s} />)}
|
|
27
|
+
* </Passport.Signers>
|
|
28
|
+
*
|
|
29
|
+
* <Passport.Footer className="mt-4 border-t pt-4">
|
|
30
|
+
* <Passport.CopyButton asChild>
|
|
31
|
+
* <button className="btn-primary">Copy JSON</button>
|
|
32
|
+
* </Passport.CopyButton>
|
|
33
|
+
* </Passport.Footer>
|
|
34
|
+
* </Passport.Root>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const Passport: {
|
|
38
|
+
Root: import("react").ForwardRefExoticComponent<import("./PassportRoot").PassportRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
39
|
+
Header: import("react").ForwardRefExoticComponent<import("./PassportHeader").PassportHeaderProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
40
|
+
Title: import("react").ForwardRefExoticComponent<import("./PassportTitle").PassportTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
41
|
+
Logo: import("react").ForwardRefExoticComponent<import("./PassportLogo").PassportLogoProps & import("react").RefAttributes<HTMLElement>>;
|
|
42
|
+
Field: import("react").ForwardRefExoticComponent<import("./PassportField").PassportFieldProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
|
+
Actions: import("react").ForwardRefExoticComponent<import("./PassportActions").PassportActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
44
|
+
Identities: import("react").ForwardRefExoticComponent<import("./PassportIdentities").PassportIdentitiesProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
45
|
+
Signers: import("react").ForwardRefExoticComponent<import("./PassportSigners").PassportSignersProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
46
|
+
Footer: import("react").ForwardRefExoticComponent<import("./PassportFooter").PassportFooterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
47
|
+
CopyButton: import("react").ForwardRefExoticComponent<import("./PassportCopyButton").PassportCopyButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
48
|
+
};
|
|
49
|
+
export { usePassportContext, usePassportData } from "./hooks";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CSSProperties, FC } from "react";
|
|
2
|
+
import { type BadgePositionType, type ThemeType } from "./constants";
|
|
3
|
+
export interface LimboBadgeProps {
|
|
4
|
+
/** Position of the badge */
|
|
5
|
+
position?: BadgePositionType;
|
|
6
|
+
/** Theme for the badge */
|
|
7
|
+
theme?: ThemeType;
|
|
8
|
+
/** Click handler */
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
/** Mouse enter handler */
|
|
11
|
+
onMouseEnter?: () => void;
|
|
12
|
+
/** Mouse leave handler */
|
|
13
|
+
onMouseLeave?: () => void;
|
|
14
|
+
/** Additional inline styles */
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* LimboBadge - Pre-styled badge component with CRLogo
|
|
19
|
+
*
|
|
20
|
+
* A ready-to-use badge for displaying content credentials status.
|
|
21
|
+
*/
|
|
22
|
+
export declare const LimboBadge: FC<LimboBadgeProps>;
|