@fanfare-io/fanfare-sdk-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/LICENSE +202 -0
- package/README.md +58 -0
- package/dist/components/auth/access-code-input.d.ts +24 -0
- package/dist/components/auth/auth-form.d.ts +39 -0
- package/dist/components/auth/auth-input.d.ts +28 -0
- package/dist/components/auth/email-input.d.ts +21 -0
- package/dist/components/auth/index.d.ts +19 -0
- package/dist/components/auth/otp-input.d.ts +32 -0
- package/dist/components/auth/phone-input.d.ts +22 -0
- package/dist/components/compositions/access-code-form.d.ts +29 -0
- package/dist/components/compositions/challenge-gate.d.ts +23 -0
- package/dist/components/compositions/ended-module.d.ts +26 -0
- package/dist/components/compositions/error-view.d.ts +58 -0
- package/dist/components/compositions/granted-panel.d.ts +35 -0
- package/dist/components/compositions/index.d.ts +15 -0
- package/dist/components/compositions/journey-gate.d.ts +48 -0
- package/dist/components/compositions/outcome-panel.d.ts +11 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/journey/experience-journey-controller.d.ts +14 -0
- package/dist/components/journey/experience-journey-skeleton.d.ts +21 -0
- package/dist/components/module/alert-panel.d.ts +13 -0
- package/dist/components/module/index.d.ts +19 -0
- package/dist/components/module/info-panel.d.ts +9 -0
- package/dist/components/module/outcome-reason.d.ts +27 -0
- package/dist/components/module/panel-heading.d.ts +34 -0
- package/dist/components/module/panel-layout.d.ts +28 -0
- package/dist/components/primitives/badge.d.ts +18 -0
- package/dist/components/primitives/button.d.ts +23 -0
- package/dist/components/primitives/card.d.ts +20 -0
- package/dist/components/primitives/countdown.d.ts +42 -0
- package/dist/components/primitives/fade-presence.d.ts +28 -0
- package/dist/components/primitives/fanfare-logo.d.ts +12 -0
- package/dist/components/primitives/index.d.ts +30 -0
- package/dist/components/primitives/input.d.ts +46 -0
- package/dist/components/primitives/progress.d.ts +16 -0
- package/dist/components/primitives/skeleton.d.ts +9 -0
- package/dist/components/primitives/spinner.d.ts +10 -0
- package/dist/components/primitives/transition.d.ts +34 -0
- package/dist/components/shadow-dom-preview.d.ts +43 -0
- package/dist/components/widgets/appointment/appointment-booking-details.d.ts +18 -0
- package/dist/components/widgets/appointment/appointment-checked-in-view.d.ts +12 -0
- package/dist/components/widgets/appointment/appointment-day-tabs.d.ts +21 -0
- package/dist/components/widgets/appointment/appointment-slot-grid.d.ts +12 -0
- package/dist/components/widgets/appointment/appointment-slot-item.d.ts +12 -0
- package/dist/components/widgets/appointment/appointment-slot-picker.d.ts +16 -0
- package/dist/components/widgets/auction/auction-actions.d.ts +38 -0
- package/dist/components/widgets/auction/auction-bid-display.d.ts +35 -0
- package/dist/components/widgets/auction/index.d.ts +7 -0
- package/dist/components/widgets/draw/draw-actions.d.ts +40 -0
- package/dist/components/widgets/draw/index.d.ts +6 -0
- package/dist/components/widgets/experience-widget.d.ts +141 -0
- package/dist/components/widgets/index.d.ts +11 -0
- package/dist/components/widgets/internal/appointment-module.d.ts +28 -0
- package/dist/components/widgets/internal/auction-module.d.ts +33 -0
- package/dist/components/widgets/internal/draw-module.d.ts +43 -0
- package/dist/components/widgets/internal/index.d.ts +15 -0
- package/dist/components/widgets/internal/loading-view.d.ts +17 -0
- package/dist/components/widgets/internal/queue-module.d.ts +27 -0
- package/dist/components/widgets/internal/start-view.d.ts +25 -0
- package/dist/components/widgets/internal/timed-release-module.d.ts +27 -0
- package/dist/components/widgets/internal/upcoming-module.d.ts +29 -0
- package/dist/components/widgets/internal/waitlist-view.d.ts +18 -0
- package/dist/components/widgets/queue/index.d.ts +6 -0
- package/dist/components/widgets/queue/queue-actions.d.ts +36 -0
- package/dist/components/widgets/timed-release/index.d.ts +6 -0
- package/dist/components/widgets/timed-release/timed-release-actions.d.ts +38 -0
- package/dist/components/widgets/waitlist/index.d.ts +6 -0
- package/dist/components/widgets/waitlist/waitlist-actions.d.ts +40 -0
- package/dist/context.d.ts +5 -0
- package/dist/hooks/use-appointment-slots.d.ts +13 -0
- package/dist/hooks/use-auth.d.ts +22 -0
- package/dist/hooks/use-experience-journey.d.ts +20 -0
- package/dist/hooks/use-fanfare.d.ts +11 -0
- package/dist/hooks/use-journey-snapshot.d.ts +8 -0
- package/dist/hooks/use-nanostore.d.ts +6 -0
- package/dist/i18n/i18n-context.d.ts +73 -0
- package/dist/i18n/i18n-provider.d.ts +67 -0
- package/dist/i18n/index.d.ts +13 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +4918 -0
- package/dist/internal-sdk.d.ts +2 -0
- package/dist/lib/animations.d.ts +94 -0
- package/dist/lib/appointment-format.d.ts +35 -0
- package/dist/lib/confetti.d.ts +17 -0
- package/dist/lib/currency.d.ts +9 -0
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/phone-formatter-lite.d.ts +26 -0
- package/dist/lib/use-grant-celebration.d.ts +12 -0
- package/dist/lib/utils.d.ts +13 -0
- package/dist/provider.d.ts +99 -0
- package/dist/styles/base.css +2254 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/styles/theme.css +143 -0
- package/dist/theme/index.d.ts +16 -0
- package/dist/theme/theme-context.d.ts +20 -0
- package/dist/theme/theme-provider.d.ts +20 -0
- package/dist/theme/theme-utils.d.ts +18 -0
- package/dist/theme/theme.types.d.ts +47 -0
- package/dist/theme/use-theme.d.ts +44 -0
- package/docs/SLOTS.md +89 -0
- package/docs/STYLING.md +61 -0
- package/package.json +145 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AuthInputMode } from '../auth/auth-input';
|
|
2
|
+
/**
|
|
3
|
+
* JourneyGate Component
|
|
4
|
+
*
|
|
5
|
+
* Handles auth and access code requirements before allowing journey progression.
|
|
6
|
+
* Renders appropriate form based on journey stage.
|
|
7
|
+
* Uses theme CSS variables for consistent styling.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
export type JourneyGateStage = "auth" | "access_code" | "loading" | "none";
|
|
11
|
+
export interface JourneyGateProps {
|
|
12
|
+
/** Current gate stage */
|
|
13
|
+
stage: JourneyGateStage;
|
|
14
|
+
/** Callback when credential is submitted (for auth) */
|
|
15
|
+
onAuthSubmit?: (credential: string, type: AuthInputMode) => Promise<void>;
|
|
16
|
+
/** Callback when OTP is verified (for auth) */
|
|
17
|
+
onAuthVerify?: (otp: string) => Promise<void>;
|
|
18
|
+
/** Callback when auth is skipped */
|
|
19
|
+
onAuthSkip?: () => void;
|
|
20
|
+
/** Callback when auth completes successfully */
|
|
21
|
+
onAuthSuccess?: () => void;
|
|
22
|
+
/** Callback when access code is submitted */
|
|
23
|
+
onAccessCodeSubmit?: (code: string) => Promise<void>;
|
|
24
|
+
/** Callback when access code is skipped */
|
|
25
|
+
onAccessCodeSkip?: () => void;
|
|
26
|
+
/** Whether auth can be skipped */
|
|
27
|
+
allowAuthSkip?: boolean;
|
|
28
|
+
/** Whether access code can be skipped */
|
|
29
|
+
allowAccessCodeSkip?: boolean;
|
|
30
|
+
/** Auth form title */
|
|
31
|
+
authTitle?: string;
|
|
32
|
+
/** Auth form description */
|
|
33
|
+
authDescription?: string;
|
|
34
|
+
/** Access code form title */
|
|
35
|
+
accessCodeTitle?: string;
|
|
36
|
+
/** Access code form description */
|
|
37
|
+
accessCodeDescription?: string;
|
|
38
|
+
/** When the upcoming sequence opens — drives the countdown shown above the form. */
|
|
39
|
+
startsAt?: Date;
|
|
40
|
+
/** Additional class name */
|
|
41
|
+
className?: string;
|
|
42
|
+
/** Children to render when stage is "none" */
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
}
|
|
45
|
+
export declare function JourneyGate({ stage, onAuthSubmit, onAuthVerify, onAuthSkip, onAuthSuccess, onAccessCodeSubmit, onAccessCodeSkip, allowAuthSkip, allowAccessCodeSkip, authTitle, authDescription, accessCodeTitle, accessCodeDescription, startsAt, className, children, }: JourneyGateProps): import("react/jsx-runtime").JSX.Element | null;
|
|
46
|
+
export declare namespace JourneyGate {
|
|
47
|
+
var displayName: string;
|
|
48
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OutcomeReason } from '../module';
|
|
2
|
+
export interface OutcomePanelProps {
|
|
3
|
+
outcomeReason: OutcomeReason;
|
|
4
|
+
onReenter?: () => Promise<void>;
|
|
5
|
+
isReentering?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function OutcomePanel({ outcomeReason, onReenter, isReentering, className }: OutcomePanelProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare namespace OutcomePanel {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fanfare SDK React Components
|
|
3
|
+
*
|
|
4
|
+
* Component hierarchy:
|
|
5
|
+
* - Primitives: Atomic building blocks (Button, Input, Card, etc.)
|
|
6
|
+
* - Auth: Authentication inputs (EmailInput, OTPInput, AuthForm, etc.)
|
|
7
|
+
* - Compositions: Reusable sections (JourneyGate, EndedModule, etc.)
|
|
8
|
+
* - Widgets: Complete experiences (ExperienceWidget, etc.)
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
export * from './auth';
|
|
13
|
+
export * from './compositions';
|
|
14
|
+
export * from './primitives';
|
|
15
|
+
export * from './widgets';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { UseExperienceJourneyResult } from '../../hooks/use-experience-journey';
|
|
3
|
+
export interface ExperienceJourneyControllerProps {
|
|
4
|
+
experienceId: string;
|
|
5
|
+
autoStart?: boolean;
|
|
6
|
+
children: (journey: UseExperienceJourneyResult) => ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Thin wrapper around useExperienceJourney that exposes the journey state
|
|
10
|
+
* and actions via a render prop. This component does not render any UI
|
|
11
|
+
* itself; it is intended as a building block for higher-level journey
|
|
12
|
+
* components and stories.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ExperienceJourneyController({ experienceId, autoStart, children }: ExperienceJourneyControllerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JourneyView } from '@fanfare-io/fanfare-sdk-core/experiences';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface ExperienceJourneySkeletonProps {
|
|
4
|
+
experienceId: string;
|
|
5
|
+
autoStart?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Optional render prop for custom header content; receives the current view.
|
|
8
|
+
*/
|
|
9
|
+
renderHeader?: (view: JourneyView | null) => ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Minimal, unstyled skeleton component that wires the ExperienceJourney
|
|
13
|
+
* state machine into a very basic control surface. Intended for use as
|
|
14
|
+
* scaffolding when building higher-level, styled components.
|
|
15
|
+
*
|
|
16
|
+
* It:
|
|
17
|
+
* - Shows the current status, journeyStage, and sequence phase.
|
|
18
|
+
* - Surfaces view-derived actions and snapshot details for inspection.
|
|
19
|
+
* - Provides buttons for common journey actions when they are available.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ExperienceJourneySkeleton({ experienceId, autoStart, renderHeader }: ExperienceJourneySkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const containerVariants: (props?: ({
|
|
4
|
+
tone?: "success" | "danger" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
export interface AlertPanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">, Omit<VariantProps<typeof containerVariants>, "tone"> {
|
|
7
|
+
tone?: "danger" | "success";
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
title?: React.ReactNode;
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const AlertPanel: React.ForwardRefExoticComponent<AlertPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module Kit
|
|
3
|
+
*
|
|
4
|
+
* Shared composition primitives for in-experience panel bodies.
|
|
5
|
+
* Distribution modules and other panels compose PanelLayout + slots +
|
|
6
|
+
* Badge + Countdown + Button + optional InfoPanel.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export { PanelBody, PanelFooter, PanelLayout } from './panel-layout';
|
|
11
|
+
export type { PanelBodyProps, PanelFooterProps, PanelLayoutProps } from './panel-layout';
|
|
12
|
+
export { PanelHeading } from './panel-heading';
|
|
13
|
+
export type { PanelHeadingProps, PanelHeadingVariant } from './panel-heading';
|
|
14
|
+
export { InfoPanel } from './info-panel';
|
|
15
|
+
export type { InfoPanelProps } from './info-panel';
|
|
16
|
+
export { AlertPanel } from './alert-panel';
|
|
17
|
+
export type { AlertPanelProps } from './alert-panel';
|
|
18
|
+
export { normalizeOutcomeReason } from './outcome-reason';
|
|
19
|
+
export type { OutcomeReason } from './outcome-reason';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const infoPanelVariants: (props?: ({
|
|
4
|
+
styleVariant?: "default" | "rounded" | "retro" | "clean" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
export interface InfoPanelProps extends React.HTMLAttributes<HTMLDivElement>, Omit<VariantProps<typeof infoPanelVariants>, "styleVariant"> {
|
|
7
|
+
}
|
|
8
|
+
export declare const InfoPanel: React.ForwardRefExoticComponent<InfoPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outcome-reason taxonomy (UI-facing)
|
|
3
|
+
*
|
|
4
|
+
* Distribution modules render an outcome state when a user can't proceed —
|
|
5
|
+
* because the admission grant expired, they weren't selected, the window
|
|
6
|
+
* closed, etc. This union is the *module-facing* taxonomy, narrower than
|
|
7
|
+
* the freeform strings the journey machine emits.
|
|
8
|
+
*
|
|
9
|
+
* `normalizeOutcomeReason` maps every known machine code (and any
|
|
10
|
+
* already-normalized UI value) to a member of the union. Unknown values
|
|
11
|
+
* fall back to `"ended"`.
|
|
12
|
+
*
|
|
13
|
+
* journey machine code -> UI outcome reason
|
|
14
|
+
* ----------------------------------------------
|
|
15
|
+
* expired -> expired
|
|
16
|
+
* queue_denied -> not_selected
|
|
17
|
+
* draw_denied -> not_selected
|
|
18
|
+
* timed_release_denied -> sold_out
|
|
19
|
+
* already_completed -> ended
|
|
20
|
+
* closed -> ended
|
|
21
|
+
* unknown / other -> ended
|
|
22
|
+
*
|
|
23
|
+
* Static story lanes pass UI values directly (e.g. `"outbid"`); those
|
|
24
|
+
* pass through unchanged.
|
|
25
|
+
*/
|
|
26
|
+
export type OutcomeReason = "expired" | "not_selected" | "sold_out" | "outbid" | "reserve_not_met" | "ended";
|
|
27
|
+
export declare function normalizeOutcomeReason(reason: string | undefined): OutcomeReason;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PanelHeading
|
|
3
|
+
*
|
|
4
|
+
* Opinionated header for in-experience panels. Renders an optional status
|
|
5
|
+
* badge, title, and description in a consistent vertical stack. Self-renders
|
|
6
|
+
* with `data-slot="panel-header"` so PanelLayout treats it as the header
|
|
7
|
+
* without callers needing to wrap it.
|
|
8
|
+
*
|
|
9
|
+
* <PanelLayout>
|
|
10
|
+
* <PanelHeading
|
|
11
|
+
* variant="success"
|
|
12
|
+
* label="In Queue"
|
|
13
|
+
* title="You're in line"
|
|
14
|
+
* description="We'll let you know when it's your turn."
|
|
15
|
+
* />
|
|
16
|
+
* <PanelBody>...</PanelBody>
|
|
17
|
+
* </PanelLayout>
|
|
18
|
+
*
|
|
19
|
+
* `variant` drives the badge color/intent. The set is intentionally smaller
|
|
20
|
+
* than Badge's full union — callers express intent (success/danger/etc.)
|
|
21
|
+
* rather than picking a one-off accent.
|
|
22
|
+
*
|
|
23
|
+
* For headers that need more than this primitive offers, render
|
|
24
|
+
* `<div data-slot="panel-header" />` with custom markup.
|
|
25
|
+
*/
|
|
26
|
+
import * as React from "react";
|
|
27
|
+
export type PanelHeadingVariant = "default" | "secondary" | "success" | "warning" | "danger" | "outline";
|
|
28
|
+
export interface PanelHeadingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
29
|
+
variant?: PanelHeadingVariant;
|
|
30
|
+
label?: React.ReactNode;
|
|
31
|
+
title?: React.ReactNode;
|
|
32
|
+
description?: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export declare const PanelHeading: React.ForwardRefExoticComponent<PanelHeadingProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CardProps } from '../primitives/card';
|
|
2
|
+
/**
|
|
3
|
+
* PanelLayout + slots
|
|
4
|
+
*
|
|
5
|
+
* Shared layout primitive for every in-experience panel. PanelLayout owns
|
|
6
|
+
* the Card chrome AND the inter-slot spacing — it wraps the heading + body
|
|
7
|
+
* slots in a padded stack with a consistent gap, so individual slots don't
|
|
8
|
+
* have to ship their own padding.
|
|
9
|
+
*
|
|
10
|
+
* <PanelLayout>
|
|
11
|
+
* <PanelHeading variant="..." label="..." title="..." />
|
|
12
|
+
* <PanelBody>... main content ...</PanelBody>
|
|
13
|
+
* <PanelFooter /> // optional — defaults to "Powered by Fanfare"
|
|
14
|
+
* </PanelLayout>
|
|
15
|
+
*
|
|
16
|
+
* PanelFooter is rendered outside the padded stack (own row with border-t).
|
|
17
|
+
* If no PanelFooter is passed, the default branded footer is auto-appended.
|
|
18
|
+
*
|
|
19
|
+
* For panels that need a fully custom header instead of PanelHeading, render
|
|
20
|
+
* `<div data-slot="panel-header" />` with the desired markup.
|
|
21
|
+
*/
|
|
22
|
+
import * as React from "react";
|
|
23
|
+
export type PanelBodyProps = React.HTMLAttributes<HTMLDivElement>;
|
|
24
|
+
export declare const PanelBody: React.ForwardRefExoticComponent<PanelBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
export type PanelFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
26
|
+
export declare const PanelFooter: React.ForwardRefExoticComponent<PanelFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export type PanelLayoutProps = CardProps;
|
|
28
|
+
export declare const PanelLayout: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "secondary" | "success" | "warning" | "danger" | "outline" | null | undefined;
|
|
5
|
+
solid?: boolean | null | undefined;
|
|
6
|
+
styleVariant?: "default" | "rounded" | "retro" | "clean" | null | undefined;
|
|
7
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
+
export interface BadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "color">, Omit<VariantProps<typeof badgeVariants>, "solid" | "styleVariant"> {
|
|
9
|
+
/**
|
|
10
|
+
* Whether to use a solid filled background.
|
|
11
|
+
* - `true`: Filled background with contrasting foreground color
|
|
12
|
+
* - `false`: Transparent background with text color and colored dot indicator
|
|
13
|
+
* - `undefined` (default): Automatically determined by theme variant
|
|
14
|
+
*/
|
|
15
|
+
solidBackground?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
18
|
+
export { badgeVariants };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "primary" | "secondary" | "outline" | "ghost" | "destructive" | null | undefined;
|
|
5
|
+
size?: "sm" | "md" | "lg" | "xs" | "icon" | null | undefined;
|
|
6
|
+
styleVariant?: "default" | "rounded" | "retro" | "clean" | null | undefined;
|
|
7
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
+
export interface ButtonStatus {
|
|
9
|
+
success: () => void;
|
|
10
|
+
failure: () => void;
|
|
11
|
+
}
|
|
12
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, Omit<VariantProps<typeof buttonVariants>, "styleVariant"> {
|
|
13
|
+
/** Show loading spinner and disable button */
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
/** Render as child element (for composition) */
|
|
16
|
+
asChild?: boolean;
|
|
17
|
+
/** Imperative handle for showing transient success/failure status */
|
|
18
|
+
statusRef?: React.Ref<ButtonStatus>;
|
|
19
|
+
/** Optional class for the inner content wrapper */
|
|
20
|
+
contentClassName?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
export { buttonVariants };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const cardVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "outlined" | "elevated" | null | undefined;
|
|
5
|
+
styleVariant?: "default" | "rounded" | "retro" | "clean" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
export interface CardProps extends React.HTMLAttributes<HTMLDivElement>, Omit<VariantProps<typeof cardVariants>, "styleVariant"> {
|
|
8
|
+
}
|
|
9
|
+
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export { cardVariants };
|
|
11
|
+
export type CardHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
12
|
+
export declare const CardHeader: React.ForwardRefExoticComponent<CardHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
|
|
14
|
+
export declare const CardTitle: React.ForwardRefExoticComponent<CardTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
15
|
+
export type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
16
|
+
export declare const CardDescription: React.ForwardRefExoticComponent<CardDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
17
|
+
export type CardContentProps = React.HTMLAttributes<HTMLDivElement>;
|
|
18
|
+
export declare const CardContent: React.ForwardRefExoticComponent<CardContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export type CardFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
20
|
+
export declare const CardFooter: React.ForwardRefExoticComponent<CardFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Countdown Component
|
|
3
|
+
*
|
|
4
|
+
* Displays time remaining until a target date.
|
|
5
|
+
* Automatically updates every second.
|
|
6
|
+
*
|
|
7
|
+
* Two layouts:
|
|
8
|
+
* - "swiss" (default): Prominent display with animated digits and labels above
|
|
9
|
+
* - "compact": Simple text-based countdown that inherits parent styling
|
|
10
|
+
*/
|
|
11
|
+
export type CountdownSize = "default" | "hero";
|
|
12
|
+
export type CountdownTone = "calm" | "warning" | "critical";
|
|
13
|
+
export interface CountdownProps {
|
|
14
|
+
/** Target date/time to count down to */
|
|
15
|
+
targetDate: Date | string | number;
|
|
16
|
+
/** Callback when countdown reaches zero */
|
|
17
|
+
onComplete?: () => void;
|
|
18
|
+
/** Label to show when expired */
|
|
19
|
+
expiredLabel?: string;
|
|
20
|
+
/** Additional CSS classes */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Show days in countdown */
|
|
23
|
+
showDays?: boolean;
|
|
24
|
+
/** Show hours in countdown */
|
|
25
|
+
showHours?: boolean;
|
|
26
|
+
/** Show minutes in countdown */
|
|
27
|
+
showMinutes?: boolean;
|
|
28
|
+
/** Show seconds in countdown */
|
|
29
|
+
showSeconds?: boolean;
|
|
30
|
+
/** Layout: "swiss" for prominent animated display, "compact" for simple text */
|
|
31
|
+
layout?: "swiss" | "compact";
|
|
32
|
+
/** Size: "default" (compact display) or "hero" (52px monospace, urgency-driver). */
|
|
33
|
+
size?: CountdownSize;
|
|
34
|
+
/**
|
|
35
|
+
* Presentational urgency tone. Caller derives from phase + time-remaining and passes it.
|
|
36
|
+
* - calm: foreground color (default)
|
|
37
|
+
* - warning: warning token color
|
|
38
|
+
* - critical: danger token color (in retro, also flips the unit container bg)
|
|
39
|
+
*/
|
|
40
|
+
tone?: CountdownTone;
|
|
41
|
+
}
|
|
42
|
+
export declare function Countdown({ targetDate, onComplete, expiredLabel, className, showDays, showHours, showMinutes, showSeconds, layout, size, tone, }: CountdownProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FadePresence
|
|
3
|
+
*
|
|
4
|
+
* Fade in/out for an element whose mount/unmount is gated by a boolean.
|
|
5
|
+
* Use this for conditional content that should animate when it appears or
|
|
6
|
+
* disappears (alerts, hint rows, optional callouts). For content that swaps
|
|
7
|
+
* between values, use `<Transition transitionKey={...}>` instead.
|
|
8
|
+
*
|
|
9
|
+
* <FadePresence show={!!error}>
|
|
10
|
+
* <AlertPanel tone="danger" title={error} />
|
|
11
|
+
* </FadePresence>
|
|
12
|
+
*/
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
export interface FadePresenceProps {
|
|
15
|
+
/** When true, the children mount and fade in. When false, they fade out and unmount. */
|
|
16
|
+
show: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Distinguishes this presence from siblings if multiple FadePresences share a
|
|
19
|
+
* parent and you need framer to treat them independently.
|
|
20
|
+
*/
|
|
21
|
+
presenceKey?: string;
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function FadePresence({ show, presenceKey, children, className }: FadePresenceProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare namespace FadePresence {
|
|
27
|
+
var displayName: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FanfareLogo Component
|
|
3
|
+
*
|
|
4
|
+
* The Fanfare wordmark logo with gradient styling.
|
|
5
|
+
* Used for branding in auth forms, footers, etc.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
export interface FanfareLogoProps extends React.SVGAttributes<SVGSVGElement> {
|
|
9
|
+
/** Additional class name */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const FanfareLogo: React.ForwardRefExoticComponent<FanfareLogoProps & React.RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Primitive Components
|
|
3
|
+
*
|
|
4
|
+
* Atomic, reusable building blocks that form the foundation of all widgets.
|
|
5
|
+
* These components use theme CSS variables and accept className for customization.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export { Badge } from './badge';
|
|
10
|
+
export type { BadgeProps } from './badge';
|
|
11
|
+
export { Button } from './button';
|
|
12
|
+
export type { ButtonProps } from './button';
|
|
13
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './card';
|
|
14
|
+
export type { CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardProps, CardTitleProps, } from './card';
|
|
15
|
+
export { Countdown } from './countdown';
|
|
16
|
+
export type { CountdownProps } from './countdown';
|
|
17
|
+
export { FanfareLogo } from './fanfare-logo';
|
|
18
|
+
export type { FanfareLogoProps } from './fanfare-logo';
|
|
19
|
+
export { Input } from './input';
|
|
20
|
+
export type { InputProps } from './input';
|
|
21
|
+
export { Progress } from './progress';
|
|
22
|
+
export type { ProgressProps } from './progress';
|
|
23
|
+
export { Skeleton } from './skeleton';
|
|
24
|
+
export type { SkeletonProps } from './skeleton';
|
|
25
|
+
export { Spinner } from './spinner';
|
|
26
|
+
export type { SpinnerProps } from './spinner';
|
|
27
|
+
export { Transition } from './transition';
|
|
28
|
+
export type { TransitionMode, TransitionProps } from './transition';
|
|
29
|
+
export { FadePresence } from './fade-presence';
|
|
30
|
+
export type { FadePresenceProps } from './fade-presence';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input Component
|
|
3
|
+
*
|
|
4
|
+
* Text input with error state support, optional inline/floating label,
|
|
5
|
+
* and inline error display.
|
|
6
|
+
*
|
|
7
|
+
* The input automatically adapts to the current theme variant:
|
|
8
|
+
* - default/rounded variants: Uses inline label and error by default
|
|
9
|
+
* - retro/clean variants: Uses external label and error by default
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Default behavior - adapts to theme variant
|
|
13
|
+
* <Input label="Email" error={errors.email} />
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Force inline label regardless of variant
|
|
17
|
+
* <Input label="Email" inlineLabel={true} />
|
|
18
|
+
*/
|
|
19
|
+
import * as React from "react";
|
|
20
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
21
|
+
/** Label text for the input */
|
|
22
|
+
label?: string;
|
|
23
|
+
/** Error message to display */
|
|
24
|
+
error?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Visual error state without inline text. Use when the message is rendered
|
|
27
|
+
* elsewhere (e.g. an AlertPanel under the input) but the field should still
|
|
28
|
+
* show its red border / invalid styling.
|
|
29
|
+
*/
|
|
30
|
+
hasError?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to use inline (floating) label style.
|
|
33
|
+
* - `true`: Floating label that moves up when focused/filled
|
|
34
|
+
* - `false`: External label above the input
|
|
35
|
+
* - `undefined` (default): Automatically determined by theme variant
|
|
36
|
+
*/
|
|
37
|
+
inlineLabel?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether to display error inline (inside the input).
|
|
40
|
+
* - `true`: Error appears inside the input (top-right)
|
|
41
|
+
* - `false`: Error appears below the input
|
|
42
|
+
* - `undefined` (default): Automatically determined by theme variant
|
|
43
|
+
*/
|
|
44
|
+
inlineError?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress Component
|
|
3
|
+
*
|
|
4
|
+
* Visual progress indicator bar.
|
|
5
|
+
* Uses theme CSS variables for consistent styling.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
export interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/** Current progress value (0-100) */
|
|
10
|
+
value?: number;
|
|
11
|
+
/** Maximum value */
|
|
12
|
+
max?: number;
|
|
13
|
+
/** Show percentage text */
|
|
14
|
+
showLabel?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skeleton Component
|
|
3
|
+
*
|
|
4
|
+
* Loading placeholder with shimmer animation.
|
|
5
|
+
* Uses theme CSS variables for consistent styling.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
export type SkeletonProps = React.HTMLAttributes<HTMLDivElement>;
|
|
9
|
+
export declare const Skeleton: React.ForwardRefExoticComponent<SkeletonProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const spinnerVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
5
|
+
styleVariant?: "default" | "rounded" | "retro" | "clean" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
export interface SpinnerProps extends React.SVGAttributes<SVGSVGElement>, Omit<VariantProps<typeof spinnerVariants>, "styleVariant"> {
|
|
8
|
+
}
|
|
9
|
+
export declare const Spinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<SVGSVGElement>>;
|
|
10
|
+
export { spinnerVariants };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transition Component
|
|
3
|
+
*
|
|
4
|
+
* A reusable wrapper for animating content changes with enter/exit animations.
|
|
5
|
+
* Adapts animation style based on the current theme variant.
|
|
6
|
+
* Supports layout animations for smooth height transitions.
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
export type TransitionMode = "fade" | "slide" | "scale" | "none";
|
|
10
|
+
export interface TransitionProps {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/** Key to trigger re-animation when content changes */
|
|
13
|
+
transitionKey: string | number;
|
|
14
|
+
/** Override variant-specific animation mode */
|
|
15
|
+
mode?: TransitionMode;
|
|
16
|
+
/** Enable layout animations for height changes */
|
|
17
|
+
layout?: boolean;
|
|
18
|
+
/** Additional class name */
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Transition wrapper that animates content enter/exit with variant-specific styles.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Transition transitionKey={step}>
|
|
27
|
+
* {step === "credential" ? <AuthInput /> : <OTPInput />}
|
|
28
|
+
* </Transition>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function Transition({ children, transitionKey, mode, layout, className }: TransitionProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare namespace Transition {
|
|
33
|
+
var displayName: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BrandTheme } from '@fanfare-io/fanfare-sdk-core/theme';
|
|
2
|
+
import { Locale, PartialTranslationMessages, TranslationMessageKey } from '@fanfare-io/fanfare-sdk-i18n';
|
|
3
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
4
|
+
import { WidgetVariant } from '../theme/theme.types';
|
|
5
|
+
export interface ShadowDOMPreviewProps {
|
|
6
|
+
/** Child components to render inside the shadow DOM */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Theme configuration to apply */
|
|
9
|
+
theme?: BrandTheme | null;
|
|
10
|
+
/** Widget variant (layout/density) */
|
|
11
|
+
variant?: WidgetVariant;
|
|
12
|
+
/** Locale for translations */
|
|
13
|
+
locale?: Locale;
|
|
14
|
+
/** Custom translations to apply */
|
|
15
|
+
translations?: PartialTranslationMessages<TranslationMessageKey>;
|
|
16
|
+
/** Additional CSS class for the host element */
|
|
17
|
+
className?: string;
|
|
18
|
+
/** Additional inline styles for the host element */
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Renders children inside an isolated Shadow DOM with SDK styles.
|
|
23
|
+
*
|
|
24
|
+
* This component creates a Shadow DOM boundary that:
|
|
25
|
+
* - Prevents admin/host styles from leaking into the preview
|
|
26
|
+
* - Prevents SDK styles from leaking out to the host page
|
|
27
|
+
* - Injects SDK Tailwind CSS (with `ff:` prefix) into the shadow root
|
|
28
|
+
* - Re-establishes i18n and theme context inside the shadow boundary
|
|
29
|
+
*
|
|
30
|
+
* Use this when previewing SDK components in environments that have
|
|
31
|
+
* different Tailwind configurations (like the admin dashboard).
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <ShadowDOMPreview theme={{ primary: "#7c3aed" }}>
|
|
36
|
+
* <UpcomingModule title="Coming Soon" description="Stay tuned!" />
|
|
37
|
+
* </ShadowDOMPreview>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function ShadowDOMPreview({ children, theme, variant, locale, translations, className, style, }: ShadowDOMPreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare namespace ShadowDOMPreview {
|
|
42
|
+
var displayName: string;
|
|
43
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AppointmentDisplayState } from '@fanfare-io/fanfare-sdk-core/internals';
|
|
2
|
+
export interface AppointmentBookingDetailsProps {
|
|
3
|
+
booking: NonNullable<AppointmentDisplayState["booking"]>;
|
|
4
|
+
/** Appointment timezone — used to format date/time in the appointment's local zone, not the viewer's. */
|
|
5
|
+
timezone?: string;
|
|
6
|
+
/** When true, hides reschedule/cancel actions — used for completed appointments. */
|
|
7
|
+
readOnly?: boolean;
|
|
8
|
+
onCancel(): Promise<void>;
|
|
9
|
+
onStartReschedule(): void;
|
|
10
|
+
onAddToCalendar?(): void;
|
|
11
|
+
onJoinCall?(): void;
|
|
12
|
+
isCancelling: boolean;
|
|
13
|
+
cancelError?: string | null;
|
|
14
|
+
}
|
|
15
|
+
export declare function AppointmentBookingDetails({ booking, timezone, readOnly, onCancel, onStartReschedule, onAddToCalendar, onJoinCall, isCancelling, cancelError, }: AppointmentBookingDetailsProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare namespace AppointmentBookingDetails {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AppointmentDisplayState } from '@fanfare-io/fanfare-sdk-core/internals';
|
|
2
|
+
export interface AppointmentCheckedInViewProps {
|
|
3
|
+
booking: NonNullable<AppointmentDisplayState["booking"]>;
|
|
4
|
+
/** Appointment timezone — used to format the start time in the appointment's local zone. */
|
|
5
|
+
timezone?: string;
|
|
6
|
+
onJoinCall?(): void;
|
|
7
|
+
onShowPass?(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function AppointmentCheckedInView({ booking, timezone, onJoinCall, onShowPass }: AppointmentCheckedInViewProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare namespace AppointmentCheckedInView {
|
|
11
|
+
var displayName: string;
|
|
12
|
+
}
|