@caffeinebounce/ui 0.62.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +39 -0
- package/dist/FinancialStatementTable-BNUrdTU4.d.cts +249 -0
- package/dist/FinancialStatementTable-BNUrdTU4.d.ts +249 -0
- package/dist/NewsletterSignup-BPreFi5W.d.cts +37 -0
- package/dist/NewsletterSignup-BPreFi5W.d.ts +37 -0
- package/dist/TestimonialsSection-DtPu2OeR.d.ts +736 -0
- package/dist/TestimonialsSection-z-yotRfv.d.cts +736 -0
- package/dist/UnifiedTableControls-CG299y9h.d.ts +1233 -0
- package/dist/UnifiedTableControls-CIjRpNhy.d.cts +1233 -0
- package/dist/blog.d.cts +99 -0
- package/dist/blog.d.ts +99 -0
- package/dist/blog.js +292 -0
- package/dist/blog.mjs +279 -0
- package/dist/button-BHnoRUkF.d.cts +34 -0
- package/dist/button-BHnoRUkF.d.ts +34 -0
- package/dist/charts.d.cts +80 -0
- package/dist/charts.d.ts +80 -0
- package/dist/charts.js +19 -0
- package/dist/charts.mjs +2 -0
- package/dist/chunk-33JR5SYE.js +44 -0
- package/dist/chunk-3NDB4YPC.js +247 -0
- package/dist/chunk-5RW4PYZ6.js +1504 -0
- package/dist/chunk-5THF4YP6.mjs +155 -0
- package/dist/chunk-6BUBNZPG.mjs +164 -0
- package/dist/chunk-6DVWMJ3H.mjs +7029 -0
- package/dist/chunk-6TGV2DNP.js +120 -0
- package/dist/chunk-72JGQ7IJ.mjs +1498 -0
- package/dist/chunk-7DHKQODW.mjs +2932 -0
- package/dist/chunk-7IKHZKAC.js +160 -0
- package/dist/chunk-ADIDI7AJ.js +11 -0
- package/dist/chunk-BFWX5GJZ.mjs +940 -0
- package/dist/chunk-BMFQG6RA.mjs +5537 -0
- package/dist/chunk-C4UT5V3P.js +65 -0
- package/dist/chunk-CC4KUIKC.js +2004 -0
- package/dist/chunk-D3QXPL47.mjs +1814 -0
- package/dist/chunk-DQWHYBV2.js +36 -0
- package/dist/chunk-E42B4GSB.js +993 -0
- package/dist/chunk-ESZ7CBA2.js +1007 -0
- package/dist/chunk-EYJJQVV4.js +111 -0
- package/dist/chunk-FRRS2YZH.mjs +129 -0
- package/dist/chunk-G5TQWWQA.mjs +37 -0
- package/dist/chunk-GAIQJCAZ.js +5612 -0
- package/dist/chunk-GMBGWOCR.mjs +48 -0
- package/dist/chunk-GUSTCU2W.mjs +105 -0
- package/dist/chunk-HBLKVQIQ.mjs +23 -0
- package/dist/chunk-HMAMMC72.js +26 -0
- package/dist/chunk-IMKLN273.mjs +9 -0
- package/dist/chunk-J6OLBSZR.js +250 -0
- package/dist/chunk-JAE45W2T.js +28 -0
- package/dist/chunk-JORVSG52.js +606 -0
- package/dist/chunk-KB7UXIQZ.mjs +984 -0
- package/dist/chunk-KGGQ5NZV.js +186 -0
- package/dist/chunk-KHCC5UKW.mjs +22 -0
- package/dist/chunk-KRRIRS6A.mjs +1945 -0
- package/dist/chunk-LQCVRWVF.js +48 -0
- package/dist/chunk-MHZXUOGN.mjs +168 -0
- package/dist/chunk-MPZFPU4X.js +349 -0
- package/dist/chunk-MVYRNJA6.js +74 -0
- package/dist/chunk-N6AFNFZR.mjs +565 -0
- package/dist/chunk-OFQLWSUR.mjs +214 -0
- package/dist/chunk-OLAAXLXY.mjs +219 -0
- package/dist/chunk-OZZWDIOY.js +1859 -0
- package/dist/chunk-PZRI43EZ.js +111 -0
- package/dist/chunk-Q256HRYD.js +176 -0
- package/dist/chunk-Q52ZEL62.mjs +223 -0
- package/dist/chunk-R26Y7LGJ.js +142 -0
- package/dist/chunk-RBUYW6QQ.js +39 -0
- package/dist/chunk-RVEFPVZF.mjs +43 -0
- package/dist/chunk-SORWLKOK.js +96 -0
- package/dist/chunk-STEP6C4C.mjs +33 -0
- package/dist/chunk-T5R6HUDG.mjs +22 -0
- package/dist/chunk-T6ZBA6VJ.js +7109 -0
- package/dist/chunk-UM7WMXIU.js +2995 -0
- package/dist/chunk-VBD4Q5LL.mjs +117 -0
- package/dist/chunk-WOITB4JL.js +195 -0
- package/dist/chunk-YKZEKJMZ.mjs +71 -0
- package/dist/chunk-YL7RZRHM.mjs +103 -0
- package/dist/chunk-YSLD2HLP.mjs +346 -0
- package/dist/chunk-ZFLZA7UP.mjs +140 -0
- package/dist/chunk-ZKUIUE7W.mjs +26 -0
- package/dist/chunk-ZOA7B32D.js +248 -0
- package/dist/data-table.d.cts +46 -0
- package/dist/data-table.d.ts +46 -0
- package/dist/data-table.js +270 -0
- package/dist/data-table.mjs +13 -0
- package/dist/editor.d.cts +89 -0
- package/dist/editor.d.ts +89 -0
- package/dist/editor.js +10 -0
- package/dist/editor.mjs +1 -0
- package/dist/forms.d.cts +142 -0
- package/dist/forms.d.ts +142 -0
- package/dist/forms.js +24 -0
- package/dist/forms.mjs +11 -0
- package/dist/hooks-8ORd7T1A.d.cts +751 -0
- package/dist/hooks-B2jU1GVT.d.ts +751 -0
- package/dist/hooks.d.cts +6 -0
- package/dist/hooks.d.ts +6 -0
- package/dist/hooks.js +99 -0
- package/dist/hooks.mjs +10 -0
- package/dist/index.d.cts +3141 -0
- package/dist/index.d.ts +3141 -0
- package/dist/index.js +7332 -0
- package/dist/index.mjs +5876 -0
- package/dist/layouts-DPfDDF53.d.cts +1001 -0
- package/dist/layouts-DPfDDF53.d.ts +1001 -0
- package/dist/layouts.d.cts +4 -0
- package/dist/layouts.d.ts +4 -0
- package/dist/layouts.js +100 -0
- package/dist/layouts.mjs +11 -0
- package/dist/marketing-3d.d.cts +51 -0
- package/dist/marketing-3d.d.ts +51 -0
- package/dist/marketing-3d.js +553 -0
- package/dist/marketing-3d.mjs +526 -0
- package/dist/marketing.d.cts +583 -0
- package/dist/marketing.d.ts +583 -0
- package/dist/marketing.js +299 -0
- package/dist/marketing.mjs +10 -0
- package/dist/media.d.cts +29 -0
- package/dist/media.d.ts +29 -0
- package/dist/media.js +189 -0
- package/dist/media.mjs +182 -0
- package/dist/navigation.d.cts +591 -0
- package/dist/navigation.d.ts +591 -0
- package/dist/navigation.js +108 -0
- package/dist/navigation.mjs +15 -0
- package/dist/portal.d.cts +58 -0
- package/dist/portal.d.ts +58 -0
- package/dist/portal.js +403 -0
- package/dist/portal.mjs +395 -0
- package/dist/primitives.d.cts +508 -0
- package/dist/primitives.d.ts +508 -0
- package/dist/primitives.js +295 -0
- package/dist/primitives.mjs +14 -0
- package/dist/settings.d.cts +216 -0
- package/dist/settings.d.ts +216 -0
- package/dist/settings.js +34 -0
- package/dist/settings.mjs +9 -0
- package/dist/shared-Dqn36QHZ.d.cts +4 -0
- package/dist/shared-Dqn36QHZ.d.ts +4 -0
- package/dist/styles.css +1213 -0
- package/package.json +189 -0
- package/styles.css +1 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Editor } from 'grapesjs';
|
|
3
|
+
|
|
4
|
+
/** Project types supported by the Studio SDK */
|
|
5
|
+
type StudioProjectType = "web" | "email";
|
|
6
|
+
/** Theme options for the editor */
|
|
7
|
+
type StudioTheme = "light" | "dark";
|
|
8
|
+
/** Block category configuration */
|
|
9
|
+
interface StudioBlockCategory {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
order?: number;
|
|
13
|
+
open?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Custom block definition for the editor */
|
|
16
|
+
interface StudioBlock {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
category?: string;
|
|
20
|
+
content: string | {
|
|
21
|
+
type: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
media?: string;
|
|
25
|
+
attributes?: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
/** Props for the StudioEditor component */
|
|
28
|
+
interface StudioEditorProps {
|
|
29
|
+
/** Type of project - "web" for forms/pages, "email" for newsletters */
|
|
30
|
+
projectType?: StudioProjectType;
|
|
31
|
+
/** Initial HTML content to load in the editor (use for new content) */
|
|
32
|
+
initialContent?: string;
|
|
33
|
+
/** Initial project data to load (use for restoring saved projects) */
|
|
34
|
+
initialProject?: Record<string, unknown>;
|
|
35
|
+
/** Called when content changes */
|
|
36
|
+
onChange?: (html: string, css: string, json: unknown) => void;
|
|
37
|
+
/** Called when user explicitly saves */
|
|
38
|
+
onSave?: (data: {
|
|
39
|
+
html: string;
|
|
40
|
+
css: string;
|
|
41
|
+
json: unknown;
|
|
42
|
+
}) => void;
|
|
43
|
+
/** Editor theme - "light" or "dark". Defaults to "light" */
|
|
44
|
+
theme?: StudioTheme;
|
|
45
|
+
/** Custom blocks to add to the editor */
|
|
46
|
+
customBlocks?: StudioBlock[];
|
|
47
|
+
/** Custom block categories */
|
|
48
|
+
blockCategories?: StudioBlockCategory[];
|
|
49
|
+
/** Whether to show the pages panel (for multi-page projects) */
|
|
50
|
+
showPages?: boolean;
|
|
51
|
+
/** Whether to show the layers panel */
|
|
52
|
+
showLayers?: boolean;
|
|
53
|
+
/** Height of the editor container */
|
|
54
|
+
height?: string | number;
|
|
55
|
+
/** Additional CSS to inject into the canvas */
|
|
56
|
+
canvasStyles?: string;
|
|
57
|
+
/** License key - use "DEV_LICENSE_KEY" for localhost development */
|
|
58
|
+
licenseKey?: string;
|
|
59
|
+
/** Called when editor is ready */
|
|
60
|
+
onReady?: (editor: Editor) => void;
|
|
61
|
+
/** Custom storage configuration */
|
|
62
|
+
storage?: {
|
|
63
|
+
/** Storage type: "browser" for local, "self" for custom handlers, "cloud" for GrapesJS cloud, or false to disable */
|
|
64
|
+
type?: "browser" | "self" | "cloud" | false;
|
|
65
|
+
/** Autosave after this many changes (0 to disable) */
|
|
66
|
+
autosaveChanges?: number;
|
|
67
|
+
/** Autosave after this many milliseconds (0 to disable) */
|
|
68
|
+
autosaveIntervalMs?: number;
|
|
69
|
+
};
|
|
70
|
+
/** Unique key to identify this editor instance (used for storage isolation). Changing this forces a remount. */
|
|
71
|
+
editorKey?: string;
|
|
72
|
+
/** Start the editor in preview mode (hides panels, shows canvas only). Useful for read-only views. */
|
|
73
|
+
previewMode?: boolean;
|
|
74
|
+
/** Lock the editor in preview mode - prevents user from exiting preview. Used with previewMode. */
|
|
75
|
+
lockPreview?: boolean;
|
|
76
|
+
/** Initial device to select (e.g., "Desktop", "Mobile", "Tablet"). */
|
|
77
|
+
initialDevice?: string;
|
|
78
|
+
/** Called when user changes the device. Receives the device name. */
|
|
79
|
+
onDeviceChange?: (device: string) => void;
|
|
80
|
+
/** Enable verbose debug logging for editor initialization and canvas diagnostics. */
|
|
81
|
+
debug?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* StudioEditor component using GrapesJS Studio SDK.
|
|
85
|
+
* Production-ready visual editor with beautiful built-in UI.
|
|
86
|
+
*/
|
|
87
|
+
declare function StudioEditor({ projectType, initialContent, initialProject, onChange, onSave, theme, customBlocks, blockCategories: _blockCategories, showPages: _showPages, showLayers: _showLayers, height, canvasStyles, licenseKey, onReady, storage, editorKey, previewMode, lockPreview, initialDevice, onDeviceChange, debug, }: StudioEditorProps): react_jsx_runtime.JSX.Element;
|
|
88
|
+
|
|
89
|
+
export { type StudioBlock, type StudioBlockCategory, StudioEditor, type StudioEditorProps, type StudioProjectType, type StudioTheme };
|
package/dist/editor.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Editor } from 'grapesjs';
|
|
3
|
+
|
|
4
|
+
/** Project types supported by the Studio SDK */
|
|
5
|
+
type StudioProjectType = "web" | "email";
|
|
6
|
+
/** Theme options for the editor */
|
|
7
|
+
type StudioTheme = "light" | "dark";
|
|
8
|
+
/** Block category configuration */
|
|
9
|
+
interface StudioBlockCategory {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
order?: number;
|
|
13
|
+
open?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Custom block definition for the editor */
|
|
16
|
+
interface StudioBlock {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
category?: string;
|
|
20
|
+
content: string | {
|
|
21
|
+
type: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
media?: string;
|
|
25
|
+
attributes?: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
/** Props for the StudioEditor component */
|
|
28
|
+
interface StudioEditorProps {
|
|
29
|
+
/** Type of project - "web" for forms/pages, "email" for newsletters */
|
|
30
|
+
projectType?: StudioProjectType;
|
|
31
|
+
/** Initial HTML content to load in the editor (use for new content) */
|
|
32
|
+
initialContent?: string;
|
|
33
|
+
/** Initial project data to load (use for restoring saved projects) */
|
|
34
|
+
initialProject?: Record<string, unknown>;
|
|
35
|
+
/** Called when content changes */
|
|
36
|
+
onChange?: (html: string, css: string, json: unknown) => void;
|
|
37
|
+
/** Called when user explicitly saves */
|
|
38
|
+
onSave?: (data: {
|
|
39
|
+
html: string;
|
|
40
|
+
css: string;
|
|
41
|
+
json: unknown;
|
|
42
|
+
}) => void;
|
|
43
|
+
/** Editor theme - "light" or "dark". Defaults to "light" */
|
|
44
|
+
theme?: StudioTheme;
|
|
45
|
+
/** Custom blocks to add to the editor */
|
|
46
|
+
customBlocks?: StudioBlock[];
|
|
47
|
+
/** Custom block categories */
|
|
48
|
+
blockCategories?: StudioBlockCategory[];
|
|
49
|
+
/** Whether to show the pages panel (for multi-page projects) */
|
|
50
|
+
showPages?: boolean;
|
|
51
|
+
/** Whether to show the layers panel */
|
|
52
|
+
showLayers?: boolean;
|
|
53
|
+
/** Height of the editor container */
|
|
54
|
+
height?: string | number;
|
|
55
|
+
/** Additional CSS to inject into the canvas */
|
|
56
|
+
canvasStyles?: string;
|
|
57
|
+
/** License key - use "DEV_LICENSE_KEY" for localhost development */
|
|
58
|
+
licenseKey?: string;
|
|
59
|
+
/** Called when editor is ready */
|
|
60
|
+
onReady?: (editor: Editor) => void;
|
|
61
|
+
/** Custom storage configuration */
|
|
62
|
+
storage?: {
|
|
63
|
+
/** Storage type: "browser" for local, "self" for custom handlers, "cloud" for GrapesJS cloud, or false to disable */
|
|
64
|
+
type?: "browser" | "self" | "cloud" | false;
|
|
65
|
+
/** Autosave after this many changes (0 to disable) */
|
|
66
|
+
autosaveChanges?: number;
|
|
67
|
+
/** Autosave after this many milliseconds (0 to disable) */
|
|
68
|
+
autosaveIntervalMs?: number;
|
|
69
|
+
};
|
|
70
|
+
/** Unique key to identify this editor instance (used for storage isolation). Changing this forces a remount. */
|
|
71
|
+
editorKey?: string;
|
|
72
|
+
/** Start the editor in preview mode (hides panels, shows canvas only). Useful for read-only views. */
|
|
73
|
+
previewMode?: boolean;
|
|
74
|
+
/** Lock the editor in preview mode - prevents user from exiting preview. Used with previewMode. */
|
|
75
|
+
lockPreview?: boolean;
|
|
76
|
+
/** Initial device to select (e.g., "Desktop", "Mobile", "Tablet"). */
|
|
77
|
+
initialDevice?: string;
|
|
78
|
+
/** Called when user changes the device. Receives the device name. */
|
|
79
|
+
onDeviceChange?: (device: string) => void;
|
|
80
|
+
/** Enable verbose debug logging for editor initialization and canvas diagnostics. */
|
|
81
|
+
debug?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* StudioEditor component using GrapesJS Studio SDK.
|
|
85
|
+
* Production-ready visual editor with beautiful built-in UI.
|
|
86
|
+
*/
|
|
87
|
+
declare function StudioEditor({ projectType, initialContent, initialProject, onChange, onSave, theme, customBlocks, blockCategories: _blockCategories, showPages: _showPages, showLayers: _showLayers, height, canvasStyles, licenseKey, onReady, storage, editorKey, previewMode, lockPreview, initialDevice, onDeviceChange, debug, }: StudioEditorProps): react_jsx_runtime.JSX.Element;
|
|
88
|
+
|
|
89
|
+
export { type StudioBlock, type StudioBlockCategory, StudioEditor, type StudioEditorProps, type StudioProjectType, type StudioTheme };
|
package/dist/editor.js
ADDED
package/dist/editor.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StudioEditor } from './chunk-72JGQ7IJ.mjs';
|
package/dist/forms.d.cts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Step validation status for progress indicator styling
|
|
7
|
+
*/
|
|
8
|
+
type StepStatus = "not-started" | "in-progress" | "incomplete" | "complete" | "error";
|
|
9
|
+
/**
|
|
10
|
+
* A single step definition for the FormWizard
|
|
11
|
+
*/
|
|
12
|
+
interface FormWizardStep {
|
|
13
|
+
/** Unique identifier for the step */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Display label for the step */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Icon component from lucide-react */
|
|
18
|
+
icon: LucideIcon;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Style configuration returned for a step based on its status
|
|
22
|
+
*/
|
|
23
|
+
interface StepStatusStyles {
|
|
24
|
+
/** Border/background classes for the icon circle */
|
|
25
|
+
border: string;
|
|
26
|
+
/** Text color classes for the label */
|
|
27
|
+
text: string;
|
|
28
|
+
/** The icon element to render */
|
|
29
|
+
icon: ReactNode;
|
|
30
|
+
/** Optional tooltip message (for error/incomplete states) */
|
|
31
|
+
tooltip: string | null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Function type for computing step status
|
|
35
|
+
*/
|
|
36
|
+
type GetStepStatus = (stepIndex: number) => StepStatus;
|
|
37
|
+
/**
|
|
38
|
+
* Function type for computing step tooltip content
|
|
39
|
+
*/
|
|
40
|
+
type GetStepTooltip = (stepIndex: number, status: StepStatus) => string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Props for the FormWizard component
|
|
43
|
+
*/
|
|
44
|
+
interface FormWizardProps<T = unknown> {
|
|
45
|
+
/** Array of step definitions */
|
|
46
|
+
steps: FormWizardStep[];
|
|
47
|
+
/** Current active step index (0-based) */
|
|
48
|
+
currentStep: number;
|
|
49
|
+
/** Callback when step changes */
|
|
50
|
+
onStepChange: (stepIndex: number) => void;
|
|
51
|
+
/** Function to compute the status of each step */
|
|
52
|
+
getStepStatus: GetStepStatus;
|
|
53
|
+
/** Optional function to get tooltip content for a step */
|
|
54
|
+
getStepTooltip?: GetStepTooltip;
|
|
55
|
+
/** Enable keyboard navigation with Alt/Option+Arrow keys */
|
|
56
|
+
enableKeyboardNavigation?: boolean;
|
|
57
|
+
/** Scope keyboard navigation to elements with role="dialog" */
|
|
58
|
+
scopeToDialog?: boolean;
|
|
59
|
+
/** Callback when Escape is pressed (for cancel functionality) */
|
|
60
|
+
onCancel?: () => void;
|
|
61
|
+
/** Callback when Cmd/Ctrl+Enter is pressed (for submit functionality) */
|
|
62
|
+
onSubmit?: () => void;
|
|
63
|
+
/** Callback when Ctrl+Shift+R is pressed (for reset functionality) */
|
|
64
|
+
onReset?: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* CSS selector for the element to auto-focus when the wizard mounts.
|
|
67
|
+
* Useful for focusing the first input field in a dialog.
|
|
68
|
+
* @example 'input[name="name"]' or '[role="dialog"] input:first-of-type'
|
|
69
|
+
*/
|
|
70
|
+
autoFocusSelector?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Key to use for localStorage persistence.
|
|
73
|
+
* If provided, form data will be automatically saved to localStorage.
|
|
74
|
+
*/
|
|
75
|
+
persistKey?: string;
|
|
76
|
+
/** The form data to persist (required if persistKey is provided) */
|
|
77
|
+
formData?: T;
|
|
78
|
+
/** Callback when data is restored from storage */
|
|
79
|
+
onDataRestored?: (data: T) => void;
|
|
80
|
+
/** The step content to render */
|
|
81
|
+
children: ReactNode;
|
|
82
|
+
/** Additional class name for the container */
|
|
83
|
+
className?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* FormWizard provides a multi-step form interface with:
|
|
87
|
+
* - Step progress indicator with icons and animated connectors
|
|
88
|
+
* - Step validation status styling (not-started, in-progress, incomplete, complete, error)
|
|
89
|
+
* - Tooltips for steps with errors or incomplete status
|
|
90
|
+
* - Optional keyboard navigation (Alt/Option+Arrow keys)
|
|
91
|
+
*
|
|
92
|
+
* This component handles the step navigation and progress display,
|
|
93
|
+
* while the actual form fields and validation logic are provided by the parent.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* <FormWizard
|
|
98
|
+
* steps={[
|
|
99
|
+
* { id: "basic", label: "Basic Info", icon: Building2 },
|
|
100
|
+
* { id: "details", label: "Details", icon: FileText },
|
|
101
|
+
* ]}
|
|
102
|
+
* currentStep={currentStep}
|
|
103
|
+
* onStepChange={setCurrentStep}
|
|
104
|
+
* getStepStatus={(index) => stepStatuses[index]}
|
|
105
|
+
* getStepTooltip={(index, status) =>
|
|
106
|
+
* status === "error" ? "Missing required fields" : null
|
|
107
|
+
* }
|
|
108
|
+
* enableKeyboardNavigation
|
|
109
|
+
* onCancel={() => setDialogOpen(false)}
|
|
110
|
+
* onSubmit={handleFormSubmit}
|
|
111
|
+
* >
|
|
112
|
+
* {currentStep === 0 && <BasicInfoFields />}
|
|
113
|
+
* {currentStep === 1 && <DetailsFields />}
|
|
114
|
+
* </FormWizard>
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
declare function FormWizard<T = unknown>({ steps, currentStep, onStepChange, getStepStatus, getStepTooltip, enableKeyboardNavigation, scopeToDialog, onCancel, onSubmit, onReset, autoFocusSelector, persistKey, formData, onDataRestored, children, className, }: FormWizardProps<T>): react_jsx_runtime.JSX.Element;
|
|
118
|
+
/**
|
|
119
|
+
* Context for navigation controls - allows children to trigger navigation
|
|
120
|
+
*/
|
|
121
|
+
interface FormWizardNavigation {
|
|
122
|
+
/** Go to the next step */
|
|
123
|
+
goNext: () => void;
|
|
124
|
+
/** Go to the previous step */
|
|
125
|
+
goBack: () => void;
|
|
126
|
+
/** Go to a specific step */
|
|
127
|
+
goToStep: (index: number) => void;
|
|
128
|
+
/** Whether currently on the first step */
|
|
129
|
+
isFirstStep: boolean;
|
|
130
|
+
/** Whether currently on the last step */
|
|
131
|
+
isLastStep: boolean;
|
|
132
|
+
/** Current step index */
|
|
133
|
+
currentStep: number;
|
|
134
|
+
/** Total number of steps */
|
|
135
|
+
totalSteps: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Hook-compatible helper to create navigation handlers
|
|
139
|
+
*/
|
|
140
|
+
declare function useFormWizardNavigation(currentStep: number, totalSteps: number, onStepChange: (step: number) => void): FormWizardNavigation;
|
|
141
|
+
|
|
142
|
+
export { FormWizard, type FormWizardNavigation, type FormWizardProps, type FormWizardStep, type GetStepStatus, type GetStepTooltip, type StepStatus, type StepStatusStyles, useFormWizardNavigation };
|
package/dist/forms.d.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Step validation status for progress indicator styling
|
|
7
|
+
*/
|
|
8
|
+
type StepStatus = "not-started" | "in-progress" | "incomplete" | "complete" | "error";
|
|
9
|
+
/**
|
|
10
|
+
* A single step definition for the FormWizard
|
|
11
|
+
*/
|
|
12
|
+
interface FormWizardStep {
|
|
13
|
+
/** Unique identifier for the step */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Display label for the step */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Icon component from lucide-react */
|
|
18
|
+
icon: LucideIcon;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Style configuration returned for a step based on its status
|
|
22
|
+
*/
|
|
23
|
+
interface StepStatusStyles {
|
|
24
|
+
/** Border/background classes for the icon circle */
|
|
25
|
+
border: string;
|
|
26
|
+
/** Text color classes for the label */
|
|
27
|
+
text: string;
|
|
28
|
+
/** The icon element to render */
|
|
29
|
+
icon: ReactNode;
|
|
30
|
+
/** Optional tooltip message (for error/incomplete states) */
|
|
31
|
+
tooltip: string | null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Function type for computing step status
|
|
35
|
+
*/
|
|
36
|
+
type GetStepStatus = (stepIndex: number) => StepStatus;
|
|
37
|
+
/**
|
|
38
|
+
* Function type for computing step tooltip content
|
|
39
|
+
*/
|
|
40
|
+
type GetStepTooltip = (stepIndex: number, status: StepStatus) => string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Props for the FormWizard component
|
|
43
|
+
*/
|
|
44
|
+
interface FormWizardProps<T = unknown> {
|
|
45
|
+
/** Array of step definitions */
|
|
46
|
+
steps: FormWizardStep[];
|
|
47
|
+
/** Current active step index (0-based) */
|
|
48
|
+
currentStep: number;
|
|
49
|
+
/** Callback when step changes */
|
|
50
|
+
onStepChange: (stepIndex: number) => void;
|
|
51
|
+
/** Function to compute the status of each step */
|
|
52
|
+
getStepStatus: GetStepStatus;
|
|
53
|
+
/** Optional function to get tooltip content for a step */
|
|
54
|
+
getStepTooltip?: GetStepTooltip;
|
|
55
|
+
/** Enable keyboard navigation with Alt/Option+Arrow keys */
|
|
56
|
+
enableKeyboardNavigation?: boolean;
|
|
57
|
+
/** Scope keyboard navigation to elements with role="dialog" */
|
|
58
|
+
scopeToDialog?: boolean;
|
|
59
|
+
/** Callback when Escape is pressed (for cancel functionality) */
|
|
60
|
+
onCancel?: () => void;
|
|
61
|
+
/** Callback when Cmd/Ctrl+Enter is pressed (for submit functionality) */
|
|
62
|
+
onSubmit?: () => void;
|
|
63
|
+
/** Callback when Ctrl+Shift+R is pressed (for reset functionality) */
|
|
64
|
+
onReset?: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* CSS selector for the element to auto-focus when the wizard mounts.
|
|
67
|
+
* Useful for focusing the first input field in a dialog.
|
|
68
|
+
* @example 'input[name="name"]' or '[role="dialog"] input:first-of-type'
|
|
69
|
+
*/
|
|
70
|
+
autoFocusSelector?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Key to use for localStorage persistence.
|
|
73
|
+
* If provided, form data will be automatically saved to localStorage.
|
|
74
|
+
*/
|
|
75
|
+
persistKey?: string;
|
|
76
|
+
/** The form data to persist (required if persistKey is provided) */
|
|
77
|
+
formData?: T;
|
|
78
|
+
/** Callback when data is restored from storage */
|
|
79
|
+
onDataRestored?: (data: T) => void;
|
|
80
|
+
/** The step content to render */
|
|
81
|
+
children: ReactNode;
|
|
82
|
+
/** Additional class name for the container */
|
|
83
|
+
className?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* FormWizard provides a multi-step form interface with:
|
|
87
|
+
* - Step progress indicator with icons and animated connectors
|
|
88
|
+
* - Step validation status styling (not-started, in-progress, incomplete, complete, error)
|
|
89
|
+
* - Tooltips for steps with errors or incomplete status
|
|
90
|
+
* - Optional keyboard navigation (Alt/Option+Arrow keys)
|
|
91
|
+
*
|
|
92
|
+
* This component handles the step navigation and progress display,
|
|
93
|
+
* while the actual form fields and validation logic are provided by the parent.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* <FormWizard
|
|
98
|
+
* steps={[
|
|
99
|
+
* { id: "basic", label: "Basic Info", icon: Building2 },
|
|
100
|
+
* { id: "details", label: "Details", icon: FileText },
|
|
101
|
+
* ]}
|
|
102
|
+
* currentStep={currentStep}
|
|
103
|
+
* onStepChange={setCurrentStep}
|
|
104
|
+
* getStepStatus={(index) => stepStatuses[index]}
|
|
105
|
+
* getStepTooltip={(index, status) =>
|
|
106
|
+
* status === "error" ? "Missing required fields" : null
|
|
107
|
+
* }
|
|
108
|
+
* enableKeyboardNavigation
|
|
109
|
+
* onCancel={() => setDialogOpen(false)}
|
|
110
|
+
* onSubmit={handleFormSubmit}
|
|
111
|
+
* >
|
|
112
|
+
* {currentStep === 0 && <BasicInfoFields />}
|
|
113
|
+
* {currentStep === 1 && <DetailsFields />}
|
|
114
|
+
* </FormWizard>
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
declare function FormWizard<T = unknown>({ steps, currentStep, onStepChange, getStepStatus, getStepTooltip, enableKeyboardNavigation, scopeToDialog, onCancel, onSubmit, onReset, autoFocusSelector, persistKey, formData, onDataRestored, children, className, }: FormWizardProps<T>): react_jsx_runtime.JSX.Element;
|
|
118
|
+
/**
|
|
119
|
+
* Context for navigation controls - allows children to trigger navigation
|
|
120
|
+
*/
|
|
121
|
+
interface FormWizardNavigation {
|
|
122
|
+
/** Go to the next step */
|
|
123
|
+
goNext: () => void;
|
|
124
|
+
/** Go to the previous step */
|
|
125
|
+
goBack: () => void;
|
|
126
|
+
/** Go to a specific step */
|
|
127
|
+
goToStep: (index: number) => void;
|
|
128
|
+
/** Whether currently on the first step */
|
|
129
|
+
isFirstStep: boolean;
|
|
130
|
+
/** Whether currently on the last step */
|
|
131
|
+
isLastStep: boolean;
|
|
132
|
+
/** Current step index */
|
|
133
|
+
currentStep: number;
|
|
134
|
+
/** Total number of steps */
|
|
135
|
+
totalSteps: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Hook-compatible helper to create navigation handlers
|
|
139
|
+
*/
|
|
140
|
+
declare function useFormWizardNavigation(currentStep: number, totalSteps: number, onStepChange: (step: number) => void): FormWizardNavigation;
|
|
141
|
+
|
|
142
|
+
export { FormWizard, type FormWizardNavigation, type FormWizardProps, type FormWizardStep, type GetStepStatus, type GetStepTooltip, type StepStatus, type StepStatusStyles, useFormWizardNavigation };
|
package/dist/forms.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkMPZFPU4X_js = require('./chunk-MPZFPU4X.js');
|
|
4
|
+
require('./chunk-ESZ7CBA2.js');
|
|
5
|
+
require('./chunk-UM7WMXIU.js');
|
|
6
|
+
require('./chunk-WOITB4JL.js');
|
|
7
|
+
require('./chunk-RBUYW6QQ.js');
|
|
8
|
+
require('./chunk-6TGV2DNP.js');
|
|
9
|
+
require('./chunk-J6OLBSZR.js');
|
|
10
|
+
require('./chunk-SORWLKOK.js');
|
|
11
|
+
require('./chunk-DQWHYBV2.js');
|
|
12
|
+
require('./chunk-Q256HRYD.js');
|
|
13
|
+
require('./chunk-ADIDI7AJ.js');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Object.defineProperty(exports, "FormWizard", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkMPZFPU4X_js.FormWizard; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "useFormWizardNavigation", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkMPZFPU4X_js.useFormWizardNavigation; }
|
|
24
|
+
});
|
package/dist/forms.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { FormWizard, useFormWizardNavigation } from './chunk-YSLD2HLP.mjs';
|
|
2
|
+
import './chunk-KB7UXIQZ.mjs';
|
|
3
|
+
import './chunk-7DHKQODW.mjs';
|
|
4
|
+
import './chunk-6BUBNZPG.mjs';
|
|
5
|
+
import './chunk-G5TQWWQA.mjs';
|
|
6
|
+
import './chunk-VBD4Q5LL.mjs';
|
|
7
|
+
import './chunk-OFQLWSUR.mjs';
|
|
8
|
+
import './chunk-YKZEKJMZ.mjs';
|
|
9
|
+
import './chunk-STEP6C4C.mjs';
|
|
10
|
+
import './chunk-MHZXUOGN.mjs';
|
|
11
|
+
import './chunk-IMKLN273.mjs';
|