@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,66 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import { type CSSProperties, type ImgHTMLAttributes } from "react";
|
|
3
|
+
import type { InteractionModeType, PassportVariantType, ValidationStatusType } from "../../types";
|
|
4
|
+
import { type BadgePositionType, type ThemeType } from "./constants";
|
|
5
|
+
export interface LimboImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "onError"> {
|
|
6
|
+
/** Validation result from @limboai/node SDK (null if not validated yet) */
|
|
7
|
+
validation?: C2PAValidationResponse | null;
|
|
8
|
+
/** Current validation status */
|
|
9
|
+
validationStatus?: ValidationStatusType;
|
|
10
|
+
/** Native img onError handler */
|
|
11
|
+
onError?: ImgHTMLAttributes<HTMLImageElement>["onError"];
|
|
12
|
+
/** Position of the badge (default: 'top-right') */
|
|
13
|
+
badgePosition?: BadgePositionType;
|
|
14
|
+
/** Color theme (default: 'light') */
|
|
15
|
+
theme?: ThemeType;
|
|
16
|
+
/** Passport variant - basic shows issuer/date, full shows all fields (default: 'basic') */
|
|
17
|
+
passportVariant?: PassportVariantType;
|
|
18
|
+
/** Interaction mode - click or hover to show passport (default: 'click') */
|
|
19
|
+
interactionMode?: InteractionModeType;
|
|
20
|
+
/** Whether to show the date field in passport (default: true) */
|
|
21
|
+
showDate?: boolean;
|
|
22
|
+
/** Delay in ms before hiding the tooltip (default: 300ms) */
|
|
23
|
+
hideDelay?: number;
|
|
24
|
+
/** Whether to enable automatic HEIC conversion (default: true) */
|
|
25
|
+
enableHeicConversion?: boolean;
|
|
26
|
+
/** Additional inline styles for the wrapper div */
|
|
27
|
+
wrapperStyle?: CSSProperties;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* LimboImage - Pre-styled image component with default badge and passport
|
|
31
|
+
*
|
|
32
|
+
* A ready-to-use image component that displays content credentials with
|
|
33
|
+
* a pre-configured badge and passport tooltip.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Basic usage with click interaction
|
|
38
|
+
* <LimboImage
|
|
39
|
+
* src="/photo.jpg"
|
|
40
|
+
* alt="Photo"
|
|
41
|
+
* validation={validation}
|
|
42
|
+
* validationStatus="success"
|
|
43
|
+
* />
|
|
44
|
+
*
|
|
45
|
+
* // With hover interaction and dark theme
|
|
46
|
+
* <LimboImage
|
|
47
|
+
* src="/photo.jpg"
|
|
48
|
+
* alt="Photo"
|
|
49
|
+
* validation={validation}
|
|
50
|
+
* validationStatus="success"
|
|
51
|
+
* interactionMode="hover"
|
|
52
|
+
* theme="dark"
|
|
53
|
+
* badgePosition="bottomRight"
|
|
54
|
+
* />
|
|
55
|
+
*
|
|
56
|
+
* // Full passport variant
|
|
57
|
+
* <LimboImage
|
|
58
|
+
* src="/photo.jpg"
|
|
59
|
+
* alt="Photo"
|
|
60
|
+
* validation={validation}
|
|
61
|
+
* validationStatus="success"
|
|
62
|
+
* passportVariant="full"
|
|
63
|
+
* />
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare const LimboImage: import("react").ForwardRefExoticComponent<LimboImageProps & import("react").RefAttributes<HTMLImageElement>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import type { CSSProperties, FC } from "react";
|
|
3
|
+
import type { PassportVariantType } from "../../types";
|
|
4
|
+
import { type BadgePositionType, type ThemeType } from "./constants";
|
|
5
|
+
export interface LimboPassportProps {
|
|
6
|
+
/** Validation result from @limboai/node SDK */
|
|
7
|
+
validation: C2PAValidationResponse;
|
|
8
|
+
/** Whether the passport is visible */
|
|
9
|
+
isVisible: boolean;
|
|
10
|
+
/** Theme for the passport */
|
|
11
|
+
theme?: ThemeType;
|
|
12
|
+
/** Position (determines tooltip placement) */
|
|
13
|
+
position?: BadgePositionType;
|
|
14
|
+
/** Passport variant - basic shows issuer/date, full shows all fields */
|
|
15
|
+
variant?: PassportVariantType;
|
|
16
|
+
/** Whether to show the date field */
|
|
17
|
+
showDate?: boolean;
|
|
18
|
+
/** Mouse enter handler */
|
|
19
|
+
onMouseEnter?: () => void;
|
|
20
|
+
/** Close handler */
|
|
21
|
+
onClose?: () => void;
|
|
22
|
+
/** Additional inline styles for the container */
|
|
23
|
+
style?: CSSProperties;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* LimboPassport - Pre-styled passport tooltip component
|
|
27
|
+
*
|
|
28
|
+
* Renders a passport with configurable variant (basic or full).
|
|
29
|
+
*/
|
|
30
|
+
export declare const LimboPassport: FC<LimboPassportProps>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import { type CSSProperties, type VideoHTMLAttributes } from "react";
|
|
3
|
+
import type { InteractionModeType, PassportVariantType, ValidationStatusType } from "../../types";
|
|
4
|
+
import { type BadgePositionType, type ThemeType } from "./constants";
|
|
5
|
+
export interface LimboVideoProps extends Omit<VideoHTMLAttributes<HTMLVideoElement>, "onError"> {
|
|
6
|
+
/** Validation result from @limboai/node SDK (null if not validated yet) */
|
|
7
|
+
validation?: C2PAValidationResponse | null;
|
|
8
|
+
/** Current validation status */
|
|
9
|
+
validationStatus?: ValidationStatusType;
|
|
10
|
+
/** Native video onError handler */
|
|
11
|
+
onError?: VideoHTMLAttributes<HTMLVideoElement>["onError"];
|
|
12
|
+
/** Position of the badge (default: 'top-right') */
|
|
13
|
+
badgePosition?: BadgePositionType;
|
|
14
|
+
/** Color theme (default: 'light') */
|
|
15
|
+
theme?: ThemeType;
|
|
16
|
+
/** Passport variant - basic shows issuer/date, full shows all fields (default: 'basic') */
|
|
17
|
+
passportVariant?: PassportVariantType;
|
|
18
|
+
/** Interaction mode - click or hover to show passport (default: 'click') */
|
|
19
|
+
interactionMode?: InteractionModeType;
|
|
20
|
+
/** Whether to show the date field in passport (default: true) */
|
|
21
|
+
showDate?: boolean;
|
|
22
|
+
/** Delay in ms before hiding the tooltip (default: 300ms) */
|
|
23
|
+
hideDelay?: number;
|
|
24
|
+
/** Additional inline styles for the wrapper div */
|
|
25
|
+
wrapperStyle?: CSSProperties;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* LimboVideo - Pre-styled video component with default badge and passport
|
|
29
|
+
*
|
|
30
|
+
* A ready-to-use video component that displays content credentials with
|
|
31
|
+
* a pre-configured badge and passport tooltip.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // Basic usage with click interaction
|
|
36
|
+
* <LimboVideo
|
|
37
|
+
* src="/video.mp4"
|
|
38
|
+
* controls
|
|
39
|
+
* validation={validation}
|
|
40
|
+
* validationStatus="success"
|
|
41
|
+
* />
|
|
42
|
+
*
|
|
43
|
+
* // With hover interaction and dark theme
|
|
44
|
+
* <LimboVideo
|
|
45
|
+
* src="/video.mp4"
|
|
46
|
+
* controls
|
|
47
|
+
* validation={validation}
|
|
48
|
+
* validationStatus="success"
|
|
49
|
+
* interactionMode="hover"
|
|
50
|
+
* theme="dark"
|
|
51
|
+
* badgePosition="bottomRight"
|
|
52
|
+
* />
|
|
53
|
+
*
|
|
54
|
+
* // Full passport variant
|
|
55
|
+
* <LimboVideo
|
|
56
|
+
* src="/video.mp4"
|
|
57
|
+
* controls
|
|
58
|
+
* validation={validation}
|
|
59
|
+
* validationStatus="success"
|
|
60
|
+
* passportVariant="full"
|
|
61
|
+
* />
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare const LimboVideo: import("react").ForwardRefExoticComponent<LimboVideoProps & import("react").RefAttributes<HTMLVideoElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
export declare const BadgePosition: {
|
|
3
|
+
readonly TopRight: "top-right";
|
|
4
|
+
readonly TopLeft: "top-left";
|
|
5
|
+
readonly BottomRight: "bottom-right";
|
|
6
|
+
readonly BottomLeft: "bottom-left";
|
|
7
|
+
};
|
|
8
|
+
export type BadgePositionType = (typeof BadgePosition)[keyof typeof BadgePosition];
|
|
9
|
+
export declare const PassportVariant: {
|
|
10
|
+
readonly Basic: "basic";
|
|
11
|
+
readonly Full: "full";
|
|
12
|
+
};
|
|
13
|
+
export type PassportVariantType = (typeof PassportVariant)[keyof typeof PassportVariant];
|
|
14
|
+
export declare const Theme: {
|
|
15
|
+
readonly Light: "light";
|
|
16
|
+
readonly Dark: "dark";
|
|
17
|
+
};
|
|
18
|
+
export type ThemeType = (typeof Theme)[keyof typeof Theme];
|
|
19
|
+
export declare const wrapperStyle: CSSProperties;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { BadgePositionType, PassportVariantType, ThemeType, } from "./constants";
|
|
2
|
+
export { BadgePosition, PassportVariant, Theme } from "./constants";
|
|
3
|
+
export type { LimboBadgeProps } from "./LimboBadge";
|
|
4
|
+
export { LimboBadge } from "./LimboBadge";
|
|
5
|
+
export type { LimboImageProps } from "./LimboImage";
|
|
6
|
+
export { LimboImage } from "./LimboImage";
|
|
7
|
+
export type { LimboPassportProps } from "./LimboPassport";
|
|
8
|
+
export { LimboPassport } from "./LimboPassport";
|
|
9
|
+
export type { LimboVideoProps } from "./LimboVideo";
|
|
10
|
+
export { LimboVideo } from "./LimboVideo";
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import { type CSSProperties, type ImgHTMLAttributes, type ReactNode } from "react";
|
|
3
|
+
import type { RenderBadgeProps, RenderTooltipProps, ValidationStatusType } from "../../types";
|
|
4
|
+
export interface MediaImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, "onError"> {
|
|
5
|
+
/** Validation result from @limboai/node SDK (null if not validated yet) */
|
|
6
|
+
validation?: C2PAValidationResponse | null;
|
|
7
|
+
/** Current validation status */
|
|
8
|
+
validationStatus?: ValidationStatusType;
|
|
9
|
+
/** Native img onError handler */
|
|
10
|
+
onError?: ImgHTMLAttributes<HTMLImageElement>["onError"];
|
|
11
|
+
/** CSS class for the wrapper div (required for positioning badge/tooltip) */
|
|
12
|
+
wrapperClassName?: string;
|
|
13
|
+
/** Inline styles for the wrapper div */
|
|
14
|
+
wrapperStyle?: CSSProperties;
|
|
15
|
+
/** Custom badge render function */
|
|
16
|
+
renderBadge?: (props: RenderBadgeProps) => ReactNode;
|
|
17
|
+
/** Custom tooltip render function */
|
|
18
|
+
renderTooltip?: (props: RenderTooltipProps) => ReactNode;
|
|
19
|
+
/** Delay in ms before hiding the tooltip (default: 300ms) */
|
|
20
|
+
hideDelay?: number;
|
|
21
|
+
/** Whether to enable automatic HEIC conversion (default: true) */
|
|
22
|
+
enableHeicConversion?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* MediaImage - Headless image component with built-in credential overlay support
|
|
26
|
+
*
|
|
27
|
+
* A minimal image component that handles HEIC to JPEG conversion and provides
|
|
28
|
+
* built-in support for displaying credential badges and tooltips via render props.
|
|
29
|
+
*
|
|
30
|
+
* This component is headless - it applies no styles. Users must provide
|
|
31
|
+
* all styling through className, style props, or render functions.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // Basic usage - just the image with HEIC support
|
|
36
|
+
* <MediaImage src="/photo.heic" alt="Photo" className="w-full h-auto" />
|
|
37
|
+
*
|
|
38
|
+
* // With built-in overlay (using render props)
|
|
39
|
+
* <MediaImage
|
|
40
|
+
* src="/photo.jpg"
|
|
41
|
+
* alt="Photo"
|
|
42
|
+
* validation={validation}
|
|
43
|
+
* validationStatus="success"
|
|
44
|
+
* wrapperClassName="relative inline-block"
|
|
45
|
+
* className="w-80 h-60 object-cover rounded-lg"
|
|
46
|
+
* renderBadge={({ status, hasCredentials, toggle }) => (
|
|
47
|
+
* <button
|
|
48
|
+
* onClick={toggle}
|
|
49
|
+
* className="absolute top-2 right-2 bg-green-500 rounded-full p-2"
|
|
50
|
+
* >
|
|
51
|
+
* <CRLogo size={16} />
|
|
52
|
+
* </button>
|
|
53
|
+
* )}
|
|
54
|
+
* renderTooltip={({ validation, isVisible, onClose }) =>
|
|
55
|
+
* isVisible && (
|
|
56
|
+
* <div className="absolute top-14 right-0 bg-white shadow-lg rounded-lg p-4">
|
|
57
|
+
* <Passport.Root validation={validation}>
|
|
58
|
+
* <Passport.Header>...</Passport.Header>
|
|
59
|
+
* <Passport.Field name="issuer" />
|
|
60
|
+
* <Passport.Footer>
|
|
61
|
+
* <Passport.CopyButton />
|
|
62
|
+
* </Passport.Footer>
|
|
63
|
+
* </Passport.Root>
|
|
64
|
+
* </div>
|
|
65
|
+
* )
|
|
66
|
+
* }
|
|
67
|
+
* />
|
|
68
|
+
*
|
|
69
|
+
* // With compound components (external overlay)
|
|
70
|
+
* <div className="relative">
|
|
71
|
+
* <MediaImage src="/photo.jpg" alt="Photo" className="w-full" />
|
|
72
|
+
* <CredentialOverlay.Root validation={validation} status="success">
|
|
73
|
+
* <CredentialOverlay.Trigger className="absolute top-2 right-2">
|
|
74
|
+
* <CredentialBadge.Root status="success" hasCredentials={true}>
|
|
75
|
+
* <CredentialBadge.Verified>
|
|
76
|
+
* <button className="bg-green-500 p-2 rounded-full">OK</button>
|
|
77
|
+
* </CredentialBadge.Verified>
|
|
78
|
+
* </CredentialBadge.Root>
|
|
79
|
+
* </CredentialOverlay.Trigger>
|
|
80
|
+
* <CredentialOverlay.Content className="absolute top-12 right-0">
|
|
81
|
+
* <Passport.Root validation={validation}>...</Passport.Root>
|
|
82
|
+
* </CredentialOverlay.Content>
|
|
83
|
+
* </CredentialOverlay.Root>
|
|
84
|
+
* </div>
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare const MediaImage: import("react").ForwardRefExoticComponent<MediaImageProps & import("react").RefAttributes<HTMLImageElement>>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import { type CSSProperties, type ReactNode, type VideoHTMLAttributes } from "react";
|
|
3
|
+
import type { RenderBadgeProps, RenderTooltipProps, ValidationStatusType } from "../../types";
|
|
4
|
+
export interface MediaVideoProps extends Omit<VideoHTMLAttributes<HTMLVideoElement>, "onError"> {
|
|
5
|
+
/** Validation result from @limboai/node SDK (null if not validated yet) */
|
|
6
|
+
validation?: C2PAValidationResponse | null;
|
|
7
|
+
/** Current validation status */
|
|
8
|
+
validationStatus?: ValidationStatusType;
|
|
9
|
+
/** Native video onError handler */
|
|
10
|
+
onError?: VideoHTMLAttributes<HTMLVideoElement>["onError"];
|
|
11
|
+
/** CSS class for the wrapper div (required for positioning badge/tooltip) */
|
|
12
|
+
wrapperClassName?: string;
|
|
13
|
+
/** Inline styles for the wrapper div */
|
|
14
|
+
wrapperStyle?: CSSProperties;
|
|
15
|
+
/** Custom badge render function */
|
|
16
|
+
renderBadge?: (props: RenderBadgeProps) => ReactNode;
|
|
17
|
+
/** Custom tooltip render function */
|
|
18
|
+
renderTooltip?: (props: RenderTooltipProps) => ReactNode;
|
|
19
|
+
/** Delay in ms before hiding the tooltip (default: 300ms) */
|
|
20
|
+
hideDelay?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* MediaVideo - Headless video component with built-in credential overlay support
|
|
24
|
+
*
|
|
25
|
+
* A minimal video component for use with C2PA credentials. Provides built-in
|
|
26
|
+
* support for displaying credential badges and tooltips via render props.
|
|
27
|
+
*
|
|
28
|
+
* This component is headless - it applies no styles. Users must provide
|
|
29
|
+
* all styling through className, style props, or render functions.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Basic usage - just the video
|
|
34
|
+
* <MediaVideo src="/video.mp4" controls className="w-full h-auto" />
|
|
35
|
+
*
|
|
36
|
+
* // With built-in overlay (using render props)
|
|
37
|
+
* <MediaVideo
|
|
38
|
+
* src="/video.mp4"
|
|
39
|
+
* controls
|
|
40
|
+
* validation={validation}
|
|
41
|
+
* validationStatus="success"
|
|
42
|
+
* wrapperClassName="relative inline-block"
|
|
43
|
+
* className="w-80 h-60 object-cover rounded-lg"
|
|
44
|
+
* renderBadge={({ status, hasCredentials, toggle }) => (
|
|
45
|
+
* <button
|
|
46
|
+
* onClick={toggle}
|
|
47
|
+
* className="absolute top-2 right-2 bg-green-500 rounded-full p-2"
|
|
48
|
+
* >
|
|
49
|
+
* <CRLogo size={16} />
|
|
50
|
+
* </button>
|
|
51
|
+
* )}
|
|
52
|
+
* renderTooltip={({ validation, isVisible, onClose }) =>
|
|
53
|
+
* isVisible && (
|
|
54
|
+
* <div className="absolute top-14 right-0 bg-white shadow-lg rounded-lg p-4">
|
|
55
|
+
* <Passport.Root validation={validation}>
|
|
56
|
+
* <Passport.Header>...</Passport.Header>
|
|
57
|
+
* <Passport.Field name="issuer" />
|
|
58
|
+
* <Passport.Footer>
|
|
59
|
+
* <Passport.CopyButton />
|
|
60
|
+
* </Passport.Footer>
|
|
61
|
+
* </Passport.Root>
|
|
62
|
+
* </div>
|
|
63
|
+
* )
|
|
64
|
+
* }
|
|
65
|
+
* />
|
|
66
|
+
*
|
|
67
|
+
* // With compound components (external overlay)
|
|
68
|
+
* <div className="relative">
|
|
69
|
+
* <MediaVideo src="/video.mp4" controls className="w-full" />
|
|
70
|
+
* <CredentialOverlay.Root validation={validation} status="success">
|
|
71
|
+
* <CredentialOverlay.Trigger className="absolute top-2 right-2">
|
|
72
|
+
* <CredentialBadge.Root status="success" hasCredentials={true}>
|
|
73
|
+
* <CredentialBadge.Verified>
|
|
74
|
+
* <button className="bg-green-500 p-2 rounded-full">OK</button>
|
|
75
|
+
* </CredentialBadge.Verified>
|
|
76
|
+
* </CredentialBadge.Root>
|
|
77
|
+
* </CredentialOverlay.Trigger>
|
|
78
|
+
* <CredentialOverlay.Content className="absolute top-12 right-0">
|
|
79
|
+
* <Passport.Root validation={validation}>...</Passport.Root>
|
|
80
|
+
* </CredentialOverlay.Content>
|
|
81
|
+
* </CredentialOverlay.Root>
|
|
82
|
+
* </div>
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare const MediaVideo: import("react").ForwardRefExoticComponent<MediaVideoProps & import("react").RefAttributes<HTMLVideoElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import type { ValidationStatusType } from "../../../types";
|
|
3
|
+
export interface MediaContextValue {
|
|
4
|
+
/** Validation result from @limboai/node SDK (null if not validated yet) */
|
|
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 currently visible */
|
|
11
|
+
isVisible: boolean;
|
|
12
|
+
/** Show the tooltip */
|
|
13
|
+
show: () => void;
|
|
14
|
+
/** Hide the tooltip (with delay) */
|
|
15
|
+
hide: () => void;
|
|
16
|
+
/** Toggle tooltip visibility */
|
|
17
|
+
toggle: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const MediaContext: import("react").Context<MediaContextValue | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { MediaContextValue } from "./MediaContext";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface UseHeicConversionOptions {
|
|
2
|
+
src: string | undefined;
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
quality?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface UseHeicConversionReturn {
|
|
7
|
+
displaySrc: string | undefined;
|
|
8
|
+
isConverting: boolean;
|
|
9
|
+
error: string | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Hook for automatic HEIC to JPEG conversion
|
|
13
|
+
*
|
|
14
|
+
* Uses AbortController for proper cleanup and race condition handling.
|
|
15
|
+
* Automatically revokes blob URLs on cleanup.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { displaySrc, isConverting, error } = useHeicConversion({
|
|
20
|
+
* src: imageUrl,
|
|
21
|
+
* enabled: true,
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* return (
|
|
25
|
+
* <img
|
|
26
|
+
* src={displaySrc}
|
|
27
|
+
* data-converting={isConverting || undefined}
|
|
28
|
+
* />
|
|
29
|
+
* );
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function useHeicConversion({ src, enabled, }: UseHeicConversionOptions): UseHeicConversionReturn;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type MediaContextValue } from "../context/MediaContext";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to access Media context
|
|
4
|
+
*
|
|
5
|
+
* Use this hook inside MediaImage/MediaVideo render props to access
|
|
6
|
+
* the media context including validation data and overlay visibility state.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const { validation, status, isVisible, toggle } = useMediaContext();
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function useMediaContext(): MediaContextValue;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { C2PAValidationResponse } from "@limboai/node";
|
|
2
|
+
import type { RenderBadgeProps, RenderTooltipProps, ValidationStatusType } from "../../../types";
|
|
3
|
+
import type { MediaContextValue } from "../context";
|
|
4
|
+
export interface UseMediaOverlayOptions {
|
|
5
|
+
/** Validation result from @limboai/node SDK (null if not validated yet) */
|
|
6
|
+
validation: C2PAValidationResponse | null;
|
|
7
|
+
/** Current validation status */
|
|
8
|
+
validationStatus: ValidationStatusType;
|
|
9
|
+
/** Delay in ms before hiding the tooltip (default: 300ms) */
|
|
10
|
+
hideDelay?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface UseMediaOverlayReturn {
|
|
13
|
+
/** Whether the content has credentials */
|
|
14
|
+
hasCredentials: boolean;
|
|
15
|
+
/** Context value for MediaContext.Provider */
|
|
16
|
+
contextValue: MediaContextValue;
|
|
17
|
+
/** Props for the renderBadge callback */
|
|
18
|
+
badgeProps: RenderBadgeProps;
|
|
19
|
+
/** Props for the renderTooltip callback (null if no validation) */
|
|
20
|
+
tooltipProps: RenderTooltipProps | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Shared hook for overlay state management in media components
|
|
24
|
+
*
|
|
25
|
+
* Extracts common logic used by both MediaImage and MediaVideo components
|
|
26
|
+
* for managing tooltip visibility and building render props.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const { hasCredentials, contextValue, badgeProps, tooltipProps } = useMediaOverlay({
|
|
31
|
+
* validation,
|
|
32
|
+
* validationStatus,
|
|
33
|
+
* hideDelay: 300,
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function useMediaOverlay({ validation, validationStatus, hideDelay, }: UseMediaOverlayOptions): UseMediaOverlayReturn;
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@limboai/react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Limbo AI React Components - Headless components for C2PA content credential display",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"scripts": {
|
|
21
|
+
"dev": "storybook dev -p 6006",
|
|
22
|
+
"build": "yarn dlx rolldown -c && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
23
|
+
"build:storybook": "storybook build",
|
|
24
|
+
"typecheck": "tsc --noEmit"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@limboai/node": ">=0.1.0",
|
|
28
|
+
"react": ">=18.0.0",
|
|
29
|
+
"react-dom": ">=18.0.0"
|
|
30
|
+
},
|
|
31
|
+
"peerDependenciesMeta": {
|
|
32
|
+
"@limboai/node": {
|
|
33
|
+
"optional": true
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"heic2any": "^0.0.4"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@limboai/node": "workspace:*",
|
|
41
|
+
"@storybook/react": "10.2.1",
|
|
42
|
+
"@storybook/react-vite": "10.2.1",
|
|
43
|
+
"@types/react": "^19.2.10",
|
|
44
|
+
"@types/react-dom": "^19.2.3",
|
|
45
|
+
"react": "^19.2.4",
|
|
46
|
+
"react-dom": "^19.2.4",
|
|
47
|
+
"storybook": "10.2.1",
|
|
48
|
+
"tsc-alias": "^1.8.16",
|
|
49
|
+
"tslib": "^2.8.1",
|
|
50
|
+
"typescript": "~5.9.3",
|
|
51
|
+
"vite": "^7.3.1"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=20"
|
|
55
|
+
},
|
|
56
|
+
"keywords": [
|
|
57
|
+
"react",
|
|
58
|
+
"c2pa",
|
|
59
|
+
"content-credentials",
|
|
60
|
+
"image-validation",
|
|
61
|
+
"limbo",
|
|
62
|
+
"ai",
|
|
63
|
+
"headless",
|
|
64
|
+
"ssr"
|
|
65
|
+
],
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "https://github.com/limboai/limbo-components"
|
|
69
|
+
},
|
|
70
|
+
"license": "MIT"
|
|
71
|
+
}
|