@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.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -0
  3. package/dist/FinancialStatementTable-BNUrdTU4.d.cts +249 -0
  4. package/dist/FinancialStatementTable-BNUrdTU4.d.ts +249 -0
  5. package/dist/NewsletterSignup-BPreFi5W.d.cts +37 -0
  6. package/dist/NewsletterSignup-BPreFi5W.d.ts +37 -0
  7. package/dist/TestimonialsSection-DtPu2OeR.d.ts +736 -0
  8. package/dist/TestimonialsSection-z-yotRfv.d.cts +736 -0
  9. package/dist/UnifiedTableControls-CG299y9h.d.ts +1233 -0
  10. package/dist/UnifiedTableControls-CIjRpNhy.d.cts +1233 -0
  11. package/dist/blog.d.cts +99 -0
  12. package/dist/blog.d.ts +99 -0
  13. package/dist/blog.js +292 -0
  14. package/dist/blog.mjs +279 -0
  15. package/dist/button-BHnoRUkF.d.cts +34 -0
  16. package/dist/button-BHnoRUkF.d.ts +34 -0
  17. package/dist/charts.d.cts +80 -0
  18. package/dist/charts.d.ts +80 -0
  19. package/dist/charts.js +19 -0
  20. package/dist/charts.mjs +2 -0
  21. package/dist/chunk-33JR5SYE.js +44 -0
  22. package/dist/chunk-3NDB4YPC.js +247 -0
  23. package/dist/chunk-5RW4PYZ6.js +1504 -0
  24. package/dist/chunk-5THF4YP6.mjs +155 -0
  25. package/dist/chunk-6BUBNZPG.mjs +164 -0
  26. package/dist/chunk-6DVWMJ3H.mjs +7029 -0
  27. package/dist/chunk-6TGV2DNP.js +120 -0
  28. package/dist/chunk-72JGQ7IJ.mjs +1498 -0
  29. package/dist/chunk-7DHKQODW.mjs +2932 -0
  30. package/dist/chunk-7IKHZKAC.js +160 -0
  31. package/dist/chunk-ADIDI7AJ.js +11 -0
  32. package/dist/chunk-BFWX5GJZ.mjs +940 -0
  33. package/dist/chunk-BMFQG6RA.mjs +5537 -0
  34. package/dist/chunk-C4UT5V3P.js +65 -0
  35. package/dist/chunk-CC4KUIKC.js +2004 -0
  36. package/dist/chunk-D3QXPL47.mjs +1814 -0
  37. package/dist/chunk-DQWHYBV2.js +36 -0
  38. package/dist/chunk-E42B4GSB.js +993 -0
  39. package/dist/chunk-ESZ7CBA2.js +1007 -0
  40. package/dist/chunk-EYJJQVV4.js +111 -0
  41. package/dist/chunk-FRRS2YZH.mjs +129 -0
  42. package/dist/chunk-G5TQWWQA.mjs +37 -0
  43. package/dist/chunk-GAIQJCAZ.js +5612 -0
  44. package/dist/chunk-GMBGWOCR.mjs +48 -0
  45. package/dist/chunk-GUSTCU2W.mjs +105 -0
  46. package/dist/chunk-HBLKVQIQ.mjs +23 -0
  47. package/dist/chunk-HMAMMC72.js +26 -0
  48. package/dist/chunk-IMKLN273.mjs +9 -0
  49. package/dist/chunk-J6OLBSZR.js +250 -0
  50. package/dist/chunk-JAE45W2T.js +28 -0
  51. package/dist/chunk-JORVSG52.js +606 -0
  52. package/dist/chunk-KB7UXIQZ.mjs +984 -0
  53. package/dist/chunk-KGGQ5NZV.js +186 -0
  54. package/dist/chunk-KHCC5UKW.mjs +22 -0
  55. package/dist/chunk-KRRIRS6A.mjs +1945 -0
  56. package/dist/chunk-LQCVRWVF.js +48 -0
  57. package/dist/chunk-MHZXUOGN.mjs +168 -0
  58. package/dist/chunk-MPZFPU4X.js +349 -0
  59. package/dist/chunk-MVYRNJA6.js +74 -0
  60. package/dist/chunk-N6AFNFZR.mjs +565 -0
  61. package/dist/chunk-OFQLWSUR.mjs +214 -0
  62. package/dist/chunk-OLAAXLXY.mjs +219 -0
  63. package/dist/chunk-OZZWDIOY.js +1859 -0
  64. package/dist/chunk-PZRI43EZ.js +111 -0
  65. package/dist/chunk-Q256HRYD.js +176 -0
  66. package/dist/chunk-Q52ZEL62.mjs +223 -0
  67. package/dist/chunk-R26Y7LGJ.js +142 -0
  68. package/dist/chunk-RBUYW6QQ.js +39 -0
  69. package/dist/chunk-RVEFPVZF.mjs +43 -0
  70. package/dist/chunk-SORWLKOK.js +96 -0
  71. package/dist/chunk-STEP6C4C.mjs +33 -0
  72. package/dist/chunk-T5R6HUDG.mjs +22 -0
  73. package/dist/chunk-T6ZBA6VJ.js +7109 -0
  74. package/dist/chunk-UM7WMXIU.js +2995 -0
  75. package/dist/chunk-VBD4Q5LL.mjs +117 -0
  76. package/dist/chunk-WOITB4JL.js +195 -0
  77. package/dist/chunk-YKZEKJMZ.mjs +71 -0
  78. package/dist/chunk-YL7RZRHM.mjs +103 -0
  79. package/dist/chunk-YSLD2HLP.mjs +346 -0
  80. package/dist/chunk-ZFLZA7UP.mjs +140 -0
  81. package/dist/chunk-ZKUIUE7W.mjs +26 -0
  82. package/dist/chunk-ZOA7B32D.js +248 -0
  83. package/dist/data-table.d.cts +46 -0
  84. package/dist/data-table.d.ts +46 -0
  85. package/dist/data-table.js +270 -0
  86. package/dist/data-table.mjs +13 -0
  87. package/dist/editor.d.cts +89 -0
  88. package/dist/editor.d.ts +89 -0
  89. package/dist/editor.js +10 -0
  90. package/dist/editor.mjs +1 -0
  91. package/dist/forms.d.cts +142 -0
  92. package/dist/forms.d.ts +142 -0
  93. package/dist/forms.js +24 -0
  94. package/dist/forms.mjs +11 -0
  95. package/dist/hooks-8ORd7T1A.d.cts +751 -0
  96. package/dist/hooks-B2jU1GVT.d.ts +751 -0
  97. package/dist/hooks.d.cts +6 -0
  98. package/dist/hooks.d.ts +6 -0
  99. package/dist/hooks.js +99 -0
  100. package/dist/hooks.mjs +10 -0
  101. package/dist/index.d.cts +3141 -0
  102. package/dist/index.d.ts +3141 -0
  103. package/dist/index.js +7332 -0
  104. package/dist/index.mjs +5876 -0
  105. package/dist/layouts-DPfDDF53.d.cts +1001 -0
  106. package/dist/layouts-DPfDDF53.d.ts +1001 -0
  107. package/dist/layouts.d.cts +4 -0
  108. package/dist/layouts.d.ts +4 -0
  109. package/dist/layouts.js +100 -0
  110. package/dist/layouts.mjs +11 -0
  111. package/dist/marketing-3d.d.cts +51 -0
  112. package/dist/marketing-3d.d.ts +51 -0
  113. package/dist/marketing-3d.js +553 -0
  114. package/dist/marketing-3d.mjs +526 -0
  115. package/dist/marketing.d.cts +583 -0
  116. package/dist/marketing.d.ts +583 -0
  117. package/dist/marketing.js +299 -0
  118. package/dist/marketing.mjs +10 -0
  119. package/dist/media.d.cts +29 -0
  120. package/dist/media.d.ts +29 -0
  121. package/dist/media.js +189 -0
  122. package/dist/media.mjs +182 -0
  123. package/dist/navigation.d.cts +591 -0
  124. package/dist/navigation.d.ts +591 -0
  125. package/dist/navigation.js +108 -0
  126. package/dist/navigation.mjs +15 -0
  127. package/dist/portal.d.cts +58 -0
  128. package/dist/portal.d.ts +58 -0
  129. package/dist/portal.js +403 -0
  130. package/dist/portal.mjs +395 -0
  131. package/dist/primitives.d.cts +508 -0
  132. package/dist/primitives.d.ts +508 -0
  133. package/dist/primitives.js +295 -0
  134. package/dist/primitives.mjs +14 -0
  135. package/dist/settings.d.cts +216 -0
  136. package/dist/settings.d.ts +216 -0
  137. package/dist/settings.js +34 -0
  138. package/dist/settings.mjs +9 -0
  139. package/dist/shared-Dqn36QHZ.d.cts +4 -0
  140. package/dist/shared-Dqn36QHZ.d.ts +4 -0
  141. package/dist/styles.css +1213 -0
  142. package/package.json +189 -0
  143. package/styles.css +1 -0
@@ -0,0 +1,751 @@
1
+ import { l as PeriodGranularity, C as ComparisonMode, T as TimeUnit, c as FinancialStatementEntry, F as FinancialStatementConfig, q as SubtotalRulesConfig } from './FinancialStatementTable-BNUrdTU4.cjs';
2
+ import * as React from 'react';
3
+ import { StepStatus } from './forms.cjs';
4
+
5
+ /**
6
+ * Represents an error captured during the session
7
+ */
8
+ interface SessionError {
9
+ message: string;
10
+ stack?: string;
11
+ timestamp: string;
12
+ type: "error" | "unhandledrejection";
13
+ }
14
+ /**
15
+ * Options for configuring the useSessionErrors hook
16
+ */
17
+ interface UseSessionErrorsOptions {
18
+ /** Maximum number of errors to store (default: 20) */
19
+ maxErrors?: number;
20
+ /** Session storage key for storing errors (default: "session_errors") */
21
+ storageKey?: string;
22
+ }
23
+ /**
24
+ * Hook that captures console errors and unhandled promise rejections
25
+ * during the session. Stores the last N errors in sessionStorage.
26
+ *
27
+ * Uses a singleton pattern to ensure only one set of global listeners
28
+ * is active, regardless of how many components use this hook.
29
+ *
30
+ * @param options Configuration options for error tracking
31
+ * @returns Object with methods to get and clear session errors
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * function FeedbackDialog() {
36
+ * const { getErrors, clearErrors } = useSessionErrors({
37
+ * maxErrors: 10,
38
+ * storageKey: "my_app_errors",
39
+ * });
40
+ *
41
+ * const handleSubmit = async () => {
42
+ * const errors = getErrors();
43
+ * await submitFeedback({ sessionErrors: errors });
44
+ * clearErrors();
45
+ * };
46
+ * }
47
+ * ```
48
+ */
49
+ declare function useSessionErrors(options?: UseSessionErrorsOptions): {
50
+ getErrors: () => SessionError[];
51
+ clearErrors: () => void;
52
+ };
53
+
54
+ interface DateRange {
55
+ start: string;
56
+ end: string;
57
+ }
58
+ declare function getDefaultLtmRange(): DateRange;
59
+ interface UseFinancialStatementStateOptions {
60
+ initialGranularity?: PeriodGranularity;
61
+ initialComparisonMode?: ComparisonMode;
62
+ initialComparisonPeriods?: number;
63
+ }
64
+ declare function useFinancialStatementState({ initialGranularity, initialComparisonMode, initialComparisonPeriods, }?: UseFinancialStatementStateOptions): {
65
+ granularity: PeriodGranularity;
66
+ periodStart: string;
67
+ periodEnd: string;
68
+ timeUnit: TimeUnit;
69
+ selectedClass: string;
70
+ selectedDepartment: string;
71
+ comparisonMode: ComparisonMode;
72
+ comparisonPeriods: number;
73
+ comparisonCustomStart: string | undefined;
74
+ comparisonCustomEnd: string | undefined;
75
+ mobileFiltersOpen: boolean;
76
+ hideZeroRows: boolean;
77
+ showRowTotals: boolean;
78
+ priorRange: {
79
+ start: string;
80
+ end: string;
81
+ };
82
+ comparisonRanges: DateRange[];
83
+ periodChipLabel: string;
84
+ comparisonChipLabel: string;
85
+ activeFilterCount: number;
86
+ formatPeriodLabel: (periodKey?: string) => string;
87
+ setSelectedClass: React.Dispatch<React.SetStateAction<string>>;
88
+ setSelectedDepartment: React.Dispatch<React.SetStateAction<string>>;
89
+ setMobileFiltersOpen: React.Dispatch<React.SetStateAction<boolean>>;
90
+ setHideZeroRows: React.Dispatch<React.SetStateAction<boolean>>;
91
+ setShowRowTotals: React.Dispatch<React.SetStateAction<boolean>>;
92
+ handlePeriodChange: (params: {
93
+ granularity: PeriodGranularity;
94
+ periodStart: string;
95
+ periodEnd: string;
96
+ timeUnit: "month" | "quarter" | "year";
97
+ }) => void;
98
+ handleComparisonChange: (params: {
99
+ mode: ComparisonMode;
100
+ periods: number;
101
+ customStart?: string;
102
+ customEnd?: string;
103
+ }) => void;
104
+ resetFilters: () => void;
105
+ };
106
+
107
+ interface ComparisonHookParams {
108
+ periodStart: string;
109
+ periodEnd: string;
110
+ classId?: string;
111
+ departmentId?: string;
112
+ enabled?: boolean;
113
+ keepPrevious?: boolean;
114
+ }
115
+ interface ComparisonHookResult<TRow, TClass = {
116
+ id: string;
117
+ name: string;
118
+ }, TDepartment = {
119
+ id: string;
120
+ name: string;
121
+ }> {
122
+ data?: {
123
+ data: TRow[];
124
+ classes?: TClass[];
125
+ departments?: TDepartment[];
126
+ };
127
+ isLoading: boolean;
128
+ }
129
+ interface UseComparisonDataParams<TRow, TClass = {
130
+ id: string;
131
+ name: string;
132
+ }, TDepartment = {
133
+ id: string;
134
+ name: string;
135
+ }> {
136
+ useDataHook: (params: ComparisonHookParams) => ComparisonHookResult<TRow, TClass, TDepartment>;
137
+ currentParams: {
138
+ periodStart: string;
139
+ periodEnd: string;
140
+ classId?: string;
141
+ departmentId?: string;
142
+ };
143
+ comparisonRanges: DateRange[];
144
+ comparisonMode: ComparisonMode;
145
+ comparisonPeriods: number;
146
+ toEntries: (rows: TRow[]) => FinancialStatementEntry[];
147
+ getPeriodKey: (row: TRow) => string;
148
+ }
149
+ declare function useComparisonData<TRow, TClass = {
150
+ id: string;
151
+ name: string;
152
+ }, TDepartment = {
153
+ id: string;
154
+ name: string;
155
+ }>({ useDataHook, currentParams, comparisonRanges, comparisonMode, comparisonPeriods, toEntries, getPeriodKey, }: UseComparisonDataParams<TRow, TClass, TDepartment>): {
156
+ response: {
157
+ data: TRow[];
158
+ classes?: TClass[] | undefined;
159
+ departments?: TDepartment[] | undefined;
160
+ } | undefined;
161
+ isLoading: boolean;
162
+ rawData: TRow[];
163
+ entries: FinancialStatementEntry[];
164
+ currentPeriodCount: number;
165
+ currentPeriodKeys: string[];
166
+ totalVisiblePeriodCount: number;
167
+ showVariance: boolean;
168
+ classes: TClass[];
169
+ departments: TDepartment[];
170
+ };
171
+
172
+ interface UseCopyToClipboardProps {
173
+ timeout?: number;
174
+ }
175
+ declare function useCopyToClipboard({ timeout, }?: UseCopyToClipboardProps): {
176
+ isCopied: boolean;
177
+ copiedId: string | null;
178
+ copyToClipboard: (value: string, id?: string) => void;
179
+ };
180
+
181
+ /**
182
+ * Hook that debounces a value by the specified delay.
183
+ * Useful for search inputs, API calls, etc.
184
+ *
185
+ * @param value - The value to debounce
186
+ * @param delay - The delay in milliseconds (default: 500ms)
187
+ * @returns The debounced value
188
+ *
189
+ * @example
190
+ * ```tsx
191
+ * const [search, setSearch] = useState("");
192
+ * const debouncedSearch = useDebounce(search, 300);
193
+ *
194
+ * useEffect(() => {
195
+ * // API call with debouncedSearch
196
+ * }, [debouncedSearch]);
197
+ * ```
198
+ */
199
+ declare function useDebounce<T>(value: T, delay?: number): T;
200
+
201
+ /**
202
+ * Keyboard shortcut definition
203
+ */
204
+ interface KeyboardShortcutDefinition {
205
+ /** Key to press (case-sensitive for letters) */
206
+ key: string;
207
+ /** Require Ctrl/Cmd key */
208
+ ctrl?: boolean;
209
+ /** Require Shift key */
210
+ shift?: boolean;
211
+ /** Require Alt/Option key */
212
+ alt?: boolean;
213
+ /** Require Meta/Cmd key (Mac) */
214
+ meta?: boolean;
215
+ /** Whether the shortcut is currently enabled */
216
+ enabled?: boolean;
217
+ }
218
+ /**
219
+ * Options for the useKeyboardShortcut hook
220
+ */
221
+ interface UseKeyboardShortcutOptions {
222
+ /** Whether the shortcut is enabled (default: true) */
223
+ enabled?: boolean;
224
+ /** Target element to attach listener to (default: document) */
225
+ target?: HTMLElement | Document | null;
226
+ /** Event phase to use (default: false for bubble phase) */
227
+ capture?: boolean;
228
+ /** Prevent default browser behavior when shortcut is triggered */
229
+ preventDefault?: boolean;
230
+ /** Stop event propagation when shortcut is triggered */
231
+ stopPropagation?: boolean;
232
+ }
233
+ /**
234
+ * Check if a keyboard event matches a shortcut definition.
235
+ * Uses boolean logic: `shortcut.ctrl ? event.ctrlKey : !event.ctrlKey`
236
+ *
237
+ * @param event - The keyboard event
238
+ * @param shortcut - The shortcut definition to match against
239
+ * @returns Whether the event matches the shortcut
240
+ */
241
+ declare function matchesShortcut(event: KeyboardEvent, shortcut: KeyboardShortcutDefinition): boolean;
242
+ /**
243
+ * Hook for handling keyboard shortcuts with SSR safety.
244
+ * Automatically manages event listeners and cleanup.
245
+ *
246
+ * @param shortcut - The keyboard shortcut definition
247
+ * @param callback - Function to call when shortcut is triggered
248
+ * @param options - Additional options for the shortcut
249
+ *
250
+ * @example
251
+ * ```tsx
252
+ * // Simple shortcut
253
+ * useKeyboardShortcut(
254
+ * { key: "k", ctrl: true },
255
+ * () => setSearchOpen(true)
256
+ * );
257
+ *
258
+ * // With options
259
+ * useKeyboardShortcut(
260
+ * { key: "Escape" },
261
+ * () => setModalOpen(false),
262
+ * { preventDefault: true, enabled: modalOpen }
263
+ * );
264
+ *
265
+ * // Multiple modifier keys
266
+ * useKeyboardShortcut(
267
+ * { key: "L", ctrl: true, shift: true },
268
+ * () => toggleTheme()
269
+ * );
270
+ * ```
271
+ */
272
+ declare function useKeyboardShortcut(shortcut: KeyboardShortcutDefinition, callback: (event: KeyboardEvent) => void, options?: UseKeyboardShortcutOptions): void;
273
+ /**
274
+ * Format a shortcut for display (e.g., "Ctrl+Shift+L" or "⌘K").
275
+ * Uses platform-specific symbols when available.
276
+ *
277
+ * @param shortcut - The shortcut to format
278
+ * @param usePlatformSymbols - Whether to use platform symbols (⌘, ⌥, ⇧, ⌃) on Mac
279
+ * @returns Formatted shortcut string
280
+ *
281
+ * @example
282
+ * ```tsx
283
+ * formatShortcut({ key: "K", ctrl: true }) // "Ctrl+K"
284
+ * formatShortcut({ key: "K", meta: true }, true) // "⌘K" on Mac
285
+ * formatShortcut({ key: "L", ctrl: true, shift: true }) // "Ctrl+Shift+L"
286
+ * ```
287
+ */
288
+ declare function formatShortcut(shortcut: KeyboardShortcutDefinition, usePlatformSymbols?: boolean): string;
289
+
290
+ /**
291
+ * Hook for reading and writing to localStorage with SSR safety.
292
+ * Automatically syncs across tabs via the storage event.
293
+ *
294
+ * @param key - The localStorage key (pass null to disable)
295
+ * @param initialValue - The initial value if nothing is stored
296
+ * @returns A tuple of [storedValue, setValue, removeValue, isLoaded]
297
+ *
298
+ * **Breaking Change (v0.16+):** Return type changed from 3-tuple to 4-tuple.
299
+ * The `isLoaded` boolean is now the 4th element, indicating when localStorage
300
+ * has been read and state is hydrated. This is important for SSR compatibility.
301
+ *
302
+ * @example
303
+ * ```tsx
304
+ * // Destructure the 4-tuple
305
+ * const [theme, setTheme, removeTheme, isLoaded] = useLocalStorage("theme", "light");
306
+ *
307
+ * // Only render when loaded (SSR safe)
308
+ * if (!isLoaded) return <Skeleton />;
309
+ * ```
310
+ */
311
+ declare function useLocalStorage<T>(key: string | null | undefined, initialValue: T): [T, (value: T | ((val: T) => T)) => void, () => void, boolean];
312
+
313
+ /**
314
+ * Hook that tracks whether a media query matches.
315
+ * Useful for responsive designs and conditional rendering.
316
+ *
317
+ * @param query - The media query string (e.g., "(min-width: 768px)")
318
+ * @returns Whether the media query matches
319
+ *
320
+ * @example
321
+ * ```tsx
322
+ * const isMobile = useMediaQuery("(max-width: 767px)");
323
+ * const isTablet = useMediaQuery("(min-width: 768px) and (max-width: 1023px)");
324
+ * const isDesktop = useMediaQuery("(min-width: 1024px)");
325
+ * const prefersDark = useMediaQuery("(prefers-color-scheme: dark)");
326
+ * ```
327
+ */
328
+ declare function useMediaQuery(query: string): boolean;
329
+ /**
330
+ * Preset breakpoints matching common Tailwind CSS defaults.
331
+ */
332
+ declare const breakpoints: {
333
+ readonly sm: "(min-width: 640px)";
334
+ readonly md: "(min-width: 768px)";
335
+ readonly lg: "(min-width: 1024px)";
336
+ readonly xl: "(min-width: 1280px)";
337
+ readonly "2xl": "(min-width: 1536px)";
338
+ };
339
+ /**
340
+ * Hook that returns boolean flags for common responsive breakpoints.
341
+ *
342
+ * @example
343
+ * ```tsx
344
+ * const { isMobile, isTablet, isDesktop } = useBreakpoints();
345
+ * ```
346
+ */
347
+ declare function useBreakpoints(): {
348
+ /** Below 640px */
349
+ isMobile: boolean;
350
+ /** 640px - 767px */
351
+ isSm: boolean;
352
+ /** 768px - 1023px */
353
+ isTablet: boolean;
354
+ /** 768px+ */
355
+ isMd: boolean;
356
+ /** 1024px+ */
357
+ isDesktop: boolean;
358
+ /** 1024px - 1279px */
359
+ isLg: boolean;
360
+ /** 1280px+ */
361
+ isXl: boolean;
362
+ /** 1536px+ */
363
+ is2xl: boolean;
364
+ };
365
+
366
+ type ScrollDirection = "up" | "down" | null;
367
+ interface UseScrollDirectionOptions {
368
+ /** Minimum scroll delta before direction changes (prevents jitter) */
369
+ threshold?: number;
370
+ /** Scroll position below which navbar is always visible */
371
+ topThreshold?: number;
372
+ }
373
+ /**
374
+ * Hook that tracks scroll direction for implementing hide-on-scroll-down patterns.
375
+ *
376
+ * @example
377
+ * ```tsx
378
+ * const { direction, isAtTop } = useScrollDirection({ threshold: 10 });
379
+ * const visible = direction === "up" || isAtTop;
380
+ * ```
381
+ */
382
+ declare function useScrollDirection({ threshold, topThreshold, }?: UseScrollDirectionOptions): {
383
+ direction: ScrollDirection;
384
+ isAtTop: boolean;
385
+ };
386
+
387
+ interface UseStatementExportParams {
388
+ entries: FinancialStatementEntry[];
389
+ config: FinancialStatementConfig;
390
+ timeUnit: TimeUnit;
391
+ subtotalRules?: SubtotalRulesConfig;
392
+ hideZeroRows: boolean;
393
+ periodStart: string;
394
+ periodEnd: string;
395
+ filenamePrefix: string;
396
+ worksheetName: string;
397
+ }
398
+ declare function useStatementExport({ entries, config, timeUnit, subtotalRules, hideZeroRows, periodStart, periodEnd, filenamePrefix, worksheetName, }: UseStatementExportParams): (format: "csv" | "excel") => void;
399
+
400
+ interface UseStatementMobileModeParams<TEntry extends {
401
+ period_first_day: string;
402
+ }> {
403
+ isMobile: boolean;
404
+ entries: TEntry[];
405
+ currentPeriodKeys: string[];
406
+ comparisonMode: string;
407
+ }
408
+ interface UseStatementMobileModeReturn<TEntry> {
409
+ activePeriodIndex: number;
410
+ setActivePeriodIndex: (updater: number | ((prev: number) => number)) => void;
411
+ compareEnabled: boolean;
412
+ setCompareEnabled: (enabled: boolean) => void;
413
+ mobileEntries: TEntry[];
414
+ periodLabel: string;
415
+ compareLabel?: string;
416
+ hasPrev: boolean;
417
+ hasNext: boolean;
418
+ hasComparisonCandidate: boolean;
419
+ activePeriod?: string;
420
+ }
421
+ declare function useStatementMobileMode<TEntry extends {
422
+ period_first_day: string;
423
+ }>({ isMobile, entries, currentPeriodKeys, comparisonMode, }: UseStatementMobileModeParams<TEntry>): UseStatementMobileModeReturn<TEntry>;
424
+
425
+ /**
426
+ * Toast options compatible with shadcn/ui toast pattern
427
+ */
428
+ interface ToastOptions {
429
+ title?: string;
430
+ description?: string;
431
+ variant?: "default" | "destructive";
432
+ duration?: number;
433
+ }
434
+ /**
435
+ * Toast function that wraps sonner's API with shadcn/ui-compatible interface
436
+ */
437
+ declare function toast(options: ToastOptions): string | number;
438
+ /**
439
+ * Hook providing shadcn/ui-compatible toast interface using sonner.
440
+ *
441
+ * @example
442
+ * ```tsx
443
+ * const { toast } = useToast();
444
+ *
445
+ * toast({
446
+ * title: "Success",
447
+ * description: "Your changes have been saved.",
448
+ * });
449
+ *
450
+ * toast({
451
+ * title: "Error",
452
+ * description: "Something went wrong.",
453
+ * variant: "destructive",
454
+ * });
455
+ * ```
456
+ */
457
+ declare function useToast(): {
458
+ toast: typeof toast;
459
+ };
460
+
461
+ type FormFieldKey<TValues extends Record<string, unknown>> = Extract<keyof TValues, string>;
462
+ /**
463
+ * Generic form interface for data restoration helper.
464
+ * Compatible with TanStack Form's useForm return type.
465
+ * Uses generic function signatures to accept TanStack Form's complex type structure.
466
+ */
467
+ interface FormWithSetFieldValue<TValues extends Record<string, unknown>> {
468
+ setFieldValue: <TField extends FormFieldKey<TValues>>(field: TField, value: TValues[TField]) => void;
469
+ validateField: (field: FormFieldKey<TValues>, trigger: "change" | "blur") => void;
470
+ }
471
+ /**
472
+ * Creates a data restoration handler for multi-step wizard forms.
473
+ *
474
+ * This utility handles the complex pattern of restoring persisted data
475
+ * to a TanStack Form, which requires special timing due to unmounted fields.
476
+ *
477
+ * @param form - The form instance with setFieldValue and validateField methods
478
+ * @param onComplete - Optional callback after restoration is complete
479
+ * @returns A handler function to pass to FormWizard's onDataRestored prop
480
+ *
481
+ * @example
482
+ * ```tsx
483
+ * const form = useForm({ ... });
484
+ * const handleDataRestored = createDataRestorationHandler(form, () => {
485
+ * console.log("Data restored!");
486
+ * });
487
+ *
488
+ * <FormWizard onDataRestored={handleDataRestored}>
489
+ * ...
490
+ * </FormWizard>
491
+ * ```
492
+ */
493
+ declare function createDataRestorationHandler<TValues extends Record<string, unknown>>(form: FormWithSetFieldValue<TValues>, defaultValues: TValues, onComplete?: () => void): (data: Partial<TValues>) => void;
494
+ /**
495
+ * Extracts human-readable error messages from a Zod validation result.
496
+ *
497
+ * @param zodResult - The result from calling `zodSchema.safeParse(values)`
498
+ * @param fieldFilter - Optional array of field names to filter errors by
499
+ * @returns Array of formatted error messages
500
+ *
501
+ * @example
502
+ * ```tsx
503
+ * const result = stepSchema.safeParse(values);
504
+ * const errors = extractZodErrors(result);
505
+ * // ["Company Name is required", "Email must be valid"]
506
+ *
507
+ * // Or filter by specific fields:
508
+ * const errors = extractZodErrors(result, ["name", "email"]);
509
+ * ```
510
+ */
511
+ declare function extractZodErrors(zodResult: {
512
+ success: boolean;
513
+ error?: {
514
+ issues: Array<{
515
+ path: (string | number)[];
516
+ message: string;
517
+ }>;
518
+ };
519
+ }, fieldFilter?: string[]): string[];
520
+ /**
521
+ * Configuration for a wizard form step
522
+ */
523
+ interface WizardStep {
524
+ /** Unique identifier for the step */
525
+ id: string;
526
+ /** Display label for the step */
527
+ label: string;
528
+ /** Fields that belong to this step (for validation) */
529
+ fields: string[];
530
+ /** Whether this step is optional (affects validation display) */
531
+ optional?: boolean;
532
+ }
533
+ /**
534
+ * Generic interface for form field metadata (compatible with TanStack Form)
535
+ */
536
+ interface FieldMeta {
537
+ errors?: string[];
538
+ }
539
+ /**
540
+ * Generic form interface for wizard utilities.
541
+ * Compatible with TanStack Form's useForm return type.
542
+ * Uses generic function signatures to accept TanStack Form's complex type structure.
543
+ */
544
+ interface WizardFormInstance<_TValues extends Record<string, unknown>> {
545
+ setFieldValue: (field: FormFieldKey<_TValues>, value: _TValues[FormFieldKey<_TValues>]) => void;
546
+ validateField: (field: FormFieldKey<_TValues>, trigger: "change" | "blur") => void;
547
+ validateAllFields: (trigger: "change" | "blur") => void;
548
+ reset: () => void;
549
+ handleSubmit: () => void | Promise<void>;
550
+ }
551
+ /**
552
+ * Creates a stepHasFieldErrors checker function from form field metadata.
553
+ *
554
+ * This utility checks if any fields in a step have validation errors
555
+ * based on the form's fieldMeta state.
556
+ *
557
+ * @param steps - Array of step configurations with field mappings
558
+ * @param formFieldMeta - Form's field metadata (from useStore)
559
+ * @returns A function that checks if a step has field errors
560
+ *
561
+ * @example
562
+ * ```tsx
563
+ * const formFieldMeta = useStore(form.store, (state) => state.fieldMeta);
564
+ * const stepHasFieldErrors = createStepHasFieldErrors(steps, formFieldMeta);
565
+ *
566
+ * // Use in useWizardForm
567
+ * const wizard = useWizardForm({ steps, stepHasFieldErrors, ... }, values);
568
+ * ```
569
+ */
570
+ declare function createStepHasFieldErrors<TFieldMeta extends Record<string, FieldMeta | undefined>>(steps: WizardStep[], formFieldMeta: TFieldMeta): (stepIndex: number) => boolean;
571
+ /**
572
+ * Creates a form reset handler that resets both form state and wizard state.
573
+ *
574
+ * This utility provides a consistent pattern for resetting multi-step forms:
575
+ * 1. Resets TanStack Form state (clears errors and dirty state)
576
+ * 2. Resets all fields to default values
577
+ * 3. Resets wizard navigation state
578
+ *
579
+ * @param form - The form instance
580
+ * @param defaultValues - Default values to reset fields to
581
+ * @param resetWizardState - Function to reset wizard state
582
+ * @param clearSubmitError - Optional function to clear submit error state
583
+ * @returns A handler function to reset the entire form
584
+ *
585
+ * @example
586
+ * ```tsx
587
+ * const handleReset = createFormResetHandler(
588
+ * form,
589
+ * defaultValues,
590
+ * wizard.resetWizardState,
591
+ * () => setSubmitError(null)
592
+ * );
593
+ * ```
594
+ */
595
+ declare function createFormResetHandler<TValues extends Record<string, unknown>>(form: WizardFormInstance<TValues>, defaultValues: TValues, resetWizardState: () => void, clearSubmitError?: () => void): () => void;
596
+ /**
597
+ * Options for the form submit handler
598
+ */
599
+ interface FormSubmitHandlerOptions {
600
+ /** Function to validate a specific step */
601
+ validateStep: (stepIndex: number) => boolean;
602
+ /** Total number of steps */
603
+ totalSteps: number;
604
+ /** Error logger instance (from @caffeinebounce/logger) */
605
+ errorLogger?: {
606
+ logError: (error: Error, context: Record<string, unknown>) => void;
607
+ };
608
+ /** Component name for error logging */
609
+ componentName: string;
610
+ /** Current step statuses for logging */
611
+ getStepStatuses?: () => unknown[];
612
+ /** Function to show a toast notification for validation errors */
613
+ showValidationToast?: (message: string) => void;
614
+ }
615
+ /**
616
+ * Creates a form submission handler with validation and error handling.
617
+ *
618
+ * This utility provides a consistent pattern for form submission:
619
+ * 1. Marks the wizard as submitted (triggers error display)
620
+ * 2. Validates all form fields
621
+ * 3. Checks if all steps are valid
622
+ * 4. If invalid, shows toast error and logs
623
+ * 5. If valid, submits the form
624
+ *
625
+ * @param form - The form instance
626
+ * @param markAsSubmitted - Function to mark wizard as submitted
627
+ * @param options - Configuration options (including showValidationToast for error display)
628
+ * @returns A handler function for form submission
629
+ *
630
+ * @example
631
+ * ```tsx
632
+ * const handleSubmit = createFormSubmitHandler(
633
+ * form,
634
+ * wizard.markAsSubmitted,
635
+ * {
636
+ * validateStep,
637
+ * totalSteps: sections.length,
638
+ * errorLogger,
639
+ * componentName: "CompanyForm",
640
+ * getStepStatuses: () => wizard.stepStatuses,
641
+ * showValidationToast: (msg) => toast.error(msg),
642
+ * }
643
+ * );
644
+ * ```
645
+ */
646
+ declare function createFormSubmitHandler<TValues extends Record<string, unknown>>(form: WizardFormInstance<TValues>, markAsSubmitted: () => void, options: FormSubmitHandlerOptions): () => void | Promise<void>;
647
+ /**
648
+ * Options for the useWizardForm hook
649
+ */
650
+ interface UseWizardFormOptions<TValues> {
651
+ /** Array of step definitions */
652
+ steps: WizardStep[];
653
+ /** Function to validate a step by index, returns true if valid */
654
+ validateStep: (stepIndex: number, values: TValues) => boolean;
655
+ /** Function to get validation errors with actual error messages for a step */
656
+ getStepErrors?: (stepIndex: number, values: TValues) => string[];
657
+ /** Function to check if a step has field-level errors (from form library) */
658
+ stepHasFieldErrors?: (stepIndex: number) => boolean;
659
+ /** Initial step index (default: 0) */
660
+ initialStep?: number;
661
+ }
662
+ /**
663
+ * Return type for useWizardForm hook
664
+ */
665
+ interface UseWizardFormReturn {
666
+ /** Current step index (0-based) */
667
+ currentStep: number;
668
+ /** Total number of steps */
669
+ totalSteps: number;
670
+ /** Whether the current step is the first */
671
+ isFirstStep: boolean;
672
+ /** Whether the current step is the last */
673
+ isLastStep: boolean;
674
+ /** The highest step index the user has navigated to */
675
+ highestStepReached: number;
676
+ /** Set of step indices where errors should be shown */
677
+ stepsWithErrorsShown: Set<number>;
678
+ /** Whether the user has attempted final form submission */
679
+ hasAttemptedFinalSubmit: boolean;
680
+ /** Array of step statuses for progress indicator */
681
+ stepStatuses: StepStatus[];
682
+ /** Whether any steps have incomplete or error status */
683
+ hasIncompleteOrErrorSteps: boolean;
684
+ /** Whether the current step is valid (passes validation) */
685
+ isCurrentStepValid: boolean;
686
+ /** Go to the next step (marks current step as having errors shown) */
687
+ handleNext: () => void;
688
+ /** Go to the previous step */
689
+ handleBack: () => void;
690
+ /** Go to a specific step by index */
691
+ handleStepClick: (stepIndex: number) => void;
692
+ /** Mark form as submitted (shows all errors, validates all steps) */
693
+ markAsSubmitted: () => void;
694
+ /** Reset all navigation and validation state */
695
+ resetWizardState: () => void;
696
+ /** Check if errors should be shown for a specific step */
697
+ shouldShowErrorsForStep: (stepIndex: number) => boolean;
698
+ /** Get step status for a specific step */
699
+ getStepStatus: (stepIndex: number) => StepStatus;
700
+ /** Get tooltip content for a step (error messages) */
701
+ getStepTooltip: (stepIndex: number, status: StepStatus) => string | null;
702
+ /** Get field names for a specific step */
703
+ getStepFields: (stepIndex: number) => string[];
704
+ }
705
+ /**
706
+ * Hook for managing multi-step wizard form state and navigation.
707
+ *
708
+ * This hook provides:
709
+ * - Step navigation with tracking of visited steps
710
+ * - Step validation status calculation
711
+ * - Error display management (only show errors for visited steps)
712
+ * - Submit state tracking
713
+ *
714
+ * @example
715
+ * ```tsx
716
+ * const wizard = useWizardForm({
717
+ * steps: [
718
+ * { id: "basic", label: "Basic Info", fields: ["name", "email"] },
719
+ * { id: "details", label: "Details", fields: ["description"] },
720
+ * ],
721
+ * validateStep: (stepIndex, values) => {
722
+ * if (stepIndex === 0) return !!values.name && !!values.email;
723
+ * return true;
724
+ * },
725
+ * getStepErrors: (stepIndex, values) => {
726
+ * const errors = [];
727
+ * if (stepIndex === 0) {
728
+ * if (!values.name) errors.push("Name is required");
729
+ * if (!values.email) errors.push("Email is required");
730
+ * }
731
+ * return errors;
732
+ * },
733
+ * }, formValues);
734
+ *
735
+ * // Use in FormWizard
736
+ * <FormWizard
737
+ * steps={steps}
738
+ * currentStep={wizard.currentStep}
739
+ * onStepChange={wizard.handleStepClick}
740
+ * getStepStatus={wizard.getStepStatus}
741
+ * getStepTooltip={wizard.getStepTooltip}
742
+ * >
743
+ * {children}
744
+ * </FormWizard>
745
+ * ```
746
+ */
747
+ declare function useWizardForm<TValues>(options: UseWizardFormOptions<TValues>,
748
+ /** Current form values - pass this to trigger re-renders on value changes */
749
+ currentValues: TValues): UseWizardFormReturn;
750
+
751
+ export { useSessionErrors as A, useStatementExport as B, useStatementMobileMode as C, useToast as D, useWizardForm as E, type FieldMeta as F, type KeyboardShortcutDefinition as K, type ScrollDirection as S, type ToastOptions as T, type UseKeyboardShortcutOptions as U, type WizardFormInstance as W, type FormSubmitHandlerOptions as a, type FormWithSetFieldValue as b, type SessionError as c, type UseScrollDirectionOptions as d, type UseSessionErrorsOptions as e, type UseWizardFormOptions as f, type UseWizardFormReturn as g, type WizardStep as h, breakpoints as i, createDataRestorationHandler as j, createFormResetHandler as k, createFormSubmitHandler as l, createStepHasFieldErrors as m, extractZodErrors as n, formatShortcut as o, getDefaultLtmRange as p, matchesShortcut as q, useComparisonData as r, useCopyToClipboard as s, useDebounce as t, useBreakpoints as u, useFinancialStatementState as v, useKeyboardShortcut as w, useLocalStorage as x, useMediaQuery as y, useScrollDirection as z };