@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Doug Ebanks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # @caffeinebounce/ui
2
+
3
+ Shared React UI primitives, composed blocks, layouts, navigation, marketing,
4
+ settings, portal, media, and CSS exports.
5
+
6
+ ## Public Entrypoints
7
+
8
+ - `@caffeinebounce/ui` is the broad compatibility entrypoint.
9
+ - `@caffeinebounce/ui/primitives` is the lightweight primitive-only entrypoint.
10
+ - Feature subpaths include `./forms`, `./hooks`, `./layouts`, `./navigation`,
11
+ `./marketing`, `./marketing-3d`, `./settings`, `./portal`, `./blog`,
12
+ `./data-table`, `./charts`, `./editor`, `./media`, and `./styles.css`.
13
+
14
+ ## Belongs Here
15
+
16
+ - Reusable UI primitives, shared blocks, design-system components, common
17
+ interaction patterns, and CSS meant for multiple apps.
18
+
19
+ ## Does Not Belong Here
20
+
21
+ - App-specific page composition, business copy, route behavior, product-specific
22
+ data fetching, or one-off styling that should live in a consumer app.
23
+
24
+ ## Focused Commands
25
+
26
+ ```bash
27
+ corepack yarn turbo run lint typecheck test build --filter=@caffeinebounce/ui
28
+ corepack yarn size:ui
29
+ ```
30
+
31
+ ## Gotchas
32
+
33
+ - Prefer `@caffeinebounce/ui/primitives` for primitive-only consumers.
34
+ - Keep heavy surfaces behind explicit subpaths and watch bundle budgets with
35
+ `yarn size:ui`.
36
+ - Keep CSS exports explicit and preserve `sideEffects` metadata.
37
+ - Mark client components with `"use client"` at the leaf files that need it.
38
+ - Add a changeset for published behavior, source, manifest, CSS, or export
39
+ changes.
@@ -0,0 +1,249 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ type ComparisonMode = "none" | "previous" | "same-period-last-year" | "custom";
5
+ interface ComparisonSelectorProps {
6
+ /** Current comparison mode */
7
+ mode: ComparisonMode;
8
+ /** Number of comparison periods (for previous/same-period modes) */
9
+ periods: number;
10
+ /** Suggested default count for Previous Period (e.g. LTM => 12) */
11
+ defaultPreviousPeriods?: number;
12
+ /** Custom comparison date range (when mode = "custom") */
13
+ customStart?: string;
14
+ customEnd?: string;
15
+ /** Called when comparison settings change */
16
+ onChange: (params: {
17
+ mode: ComparisonMode;
18
+ periods: number;
19
+ customStart?: string;
20
+ customEnd?: string;
21
+ }) => void;
22
+ /** Optional className */
23
+ className?: string;
24
+ }
25
+ declare function ComparisonSelector({ mode, periods, defaultPreviousPeriods, customStart, customEnd, onChange, className, }: ComparisonSelectorProps): react_jsx_runtime.JSX.Element;
26
+
27
+ type PeriodGranularity = "month" | "quarter" | "year" | "ltm" | "ytd" | "custom";
28
+ interface PeriodSelectorChangeParams {
29
+ granularity: PeriodGranularity;
30
+ periodStart: string;
31
+ periodEnd: string;
32
+ timeUnit: "month" | "quarter" | "year";
33
+ allDates?: boolean;
34
+ }
35
+ interface PeriodSelectorProps {
36
+ /** Currently selected granularity */
37
+ granularity: PeriodGranularity;
38
+ /** The current period start date (ISO string YYYY-MM-DD) */
39
+ periodStart: string;
40
+ /** The current period end date (ISO string YYYY-MM-DD) */
41
+ periodEnd: string;
42
+ /** Enable integrated "All dates" mode in selector UI */
43
+ enableAllDates?: boolean;
44
+ /** Whether all-dates mode is active */
45
+ allDates?: boolean;
46
+ /** Fiscal year end month (1-12, default 12 = December = calendar year) */
47
+ fiscalYearEndMonth?: number;
48
+ /** Called when user changes granularity or navigates */
49
+ onChange: (params: PeriodSelectorChangeParams) => void;
50
+ /** Optional className */
51
+ className?: string;
52
+ }
53
+ declare function PeriodSelector({ granularity, periodStart, periodEnd, enableAllDates, allDates, fiscalYearEndMonth, onChange, className, }: PeriodSelectorProps): react_jsx_runtime.JSX.Element;
54
+
55
+ type FinancialStatementRowImportance = "normal" | "emphasis" | "key-summary";
56
+ type FinancialStatementKind = "income-statement" | "balance-sheet" | "cash-flow" | "working-capital";
57
+ type FinancialStatementRowImportanceResolver = (row: StatementRow) => FinancialStatementRowImportance;
58
+ interface RowImportanceLabelConfig {
59
+ emphasis: string[];
60
+ keySummary: string[];
61
+ }
62
+ declare function createFinancialStatementRowImportanceResolver(kind: FinancialStatementKind, overrides?: Partial<RowImportanceLabelConfig>): FinancialStatementRowImportanceResolver;
63
+ declare function getFinancialStatementRowImportanceClassName(importance: FinancialStatementRowImportance): string | undefined;
64
+
65
+ interface FinancialStatementEntry {
66
+ /** Period start date (YYYY-MM-DD) */
67
+ period_first_day: string;
68
+ /** Account identifier */
69
+ account_id: string;
70
+ /** Account display name */
71
+ account_name: string;
72
+ /** Optional secondary label shown below account name */
73
+ account_secondary_label?: string | null;
74
+ /** Account number (e.g. "4000") */
75
+ account_number: string | null;
76
+ /** High-level classification: "Revenue" | "Expense" | "Asset" | "Liability" | "Equity" */
77
+ account_class: string;
78
+ /** Account type (e.g. "Income", "Cost of Goods Sold", "Expense") */
79
+ account_type?: string;
80
+ /** Account sub-type */
81
+ account_sub_type?: string | null;
82
+ /** Whether this account is a child of another */
83
+ is_sub_account?: boolean;
84
+ /** Parent account number */
85
+ parent_account_number?: string | null;
86
+ /** Parent account name */
87
+ parent_account_name?: string | null;
88
+ /** Amount for this period */
89
+ amount: number;
90
+ }
91
+ type TimeUnit = "month" | "quarter" | "year";
92
+ interface FinancialStatementSection {
93
+ /** Section ID */
94
+ id: string;
95
+ /** Display label (e.g. "Revenue", "Expenses") */
96
+ label: string;
97
+ /** Which account_class values belong to this section */
98
+ accountClasses: string[];
99
+ /** Sign multiplier for totals (1 for revenue, -1 if you want to flip expenses) */
100
+ sign?: number;
101
+ /** Render entries directly (no section header or section total row) */
102
+ standalone?: boolean;
103
+ }
104
+ interface FinancialStatementTotal {
105
+ /** Display label (e.g. "Net Income", "Gross Profit") */
106
+ label: string;
107
+ /** Section IDs to sum. Prefix with "-" to subtract. e.g. ["section-revenue", "-section-expense"] */
108
+ formula: string[];
109
+ }
110
+ interface FinancialStatementConfig {
111
+ /** Sections to display (in order) */
112
+ sections: FinancialStatementSection[];
113
+ /** Computed total rows to display after sections */
114
+ totals: FinancialStatementTotal[];
115
+ }
116
+ /** Subtotal grouping rule — regex on account_number */
117
+ interface SubtotalRule {
118
+ /** Display label (e.g. "Program", "Opex") */
119
+ label: string;
120
+ /** Regex pattern matched against account_number */
121
+ pattern: string;
122
+ /** Display order (lower = first) */
123
+ order: number;
124
+ }
125
+ /** Subtotal rules settings (as stored in system_settings) */
126
+ interface SubtotalRulesConfig {
127
+ /** Whether subtotal grouping is enabled */
128
+ enabled: boolean;
129
+ /** Ordered list of regex rules */
130
+ rules: SubtotalRule[];
131
+ }
132
+ type PeriodColumnOrder = "oldest-first" | "newest-first";
133
+ interface FinancialStatementTableProps {
134
+ /** Raw data entries */
135
+ data: FinancialStatementEntry[];
136
+ /** Time unit for period columns */
137
+ timeUnit: TimeUnit;
138
+ /** Statement structure configuration */
139
+ config: FinancialStatementConfig;
140
+ /** Show account numbers in first column */
141
+ showAccountNumbers?: boolean;
142
+ /** Tree indent in px */
143
+ treeIndentPx?: number;
144
+ /** Subtotal grouping rules (regex on account_number) */
145
+ subtotalRules?: SubtotalRulesConfig;
146
+ /** Hide rows where all visible period amounts and total are zero */
147
+ hideZeroRows?: boolean;
148
+ /** Toolbar content rendered above the table (right-aligned) */
149
+ toolbar?: React.ReactNode;
150
+ /** Custom cell renderer for currency amounts — receives row data, period key (null for total), and value */
151
+ renderAmountCell?: (row: StatementRow, periodKey: string | null, value: number) => React.ReactNode;
152
+ /** Show section header + total rows even when no data exists for that section */
153
+ preserveEmptySections?: boolean;
154
+ /** Show rightmost Total column */
155
+ showSectionTotals?: boolean;
156
+ showRowTotals?: boolean;
157
+ /** Show a variance % column comparing current vs prior period (only when exactly 1 comparison period) */
158
+ showVariance?: boolean;
159
+ /** Number of current period columns (to split current vs comparison in variance calc) */
160
+ currentPeriodCount?: number;
161
+ /** Whether table is rendered in a mobile viewport */
162
+ isMobile?: boolean;
163
+ /** Whether compare mode is enabled in mobile mode */
164
+ mobileCompareEnabled?: boolean;
165
+ /** Optional explicit period order (first to last) for displayed columns */
166
+ periodOrder?: string[];
167
+ /** Global order for period columns when periodOrder is not explicitly provided */
168
+ periodColumnOrder?: PeriodColumnOrder;
169
+ /** Override period column header labels (key = period key, value = display label) */
170
+ periodLabels?: Record<string, string>;
171
+ /** Override the first column header label (default: "Account") */
172
+ accountColumnLabel?: string;
173
+ /** Extra menu items for the account column header dropdown */
174
+ accountColumnMenuItems?: React.ReactNode;
175
+ /** Additional class name */
176
+ className?: string;
177
+ /** Optional resolver for row-importance styling (normal, emphasis, key-summary) */
178
+ rowImportanceResolver?: FinancialStatementRowImportanceResolver;
179
+ }
180
+ type RowType = "section-header" | "account-group" | "account" | "section-total" | "grand-total" | "subtotal-group" | "subtotal-total";
181
+ interface StatementRow {
182
+ _type: RowType;
183
+ id: string;
184
+ name: string;
185
+ secondaryLabel?: string | null;
186
+ accountNumber: string | null;
187
+ accountType?: string;
188
+ accountSubType?: string | null;
189
+ periodAmounts: Record<string, number>;
190
+ total: number;
191
+ children: StatementRow[];
192
+ /** Depth hint for styling (0 = section header/total, 1+ = accounts) */
193
+ depth: number;
194
+ /** Independent raw sum from source data (for reconciliation on total rows) */
195
+ _rawPeriodAmounts?: Record<string, number>;
196
+ _rawTotal?: number;
197
+ }
198
+ declare function resolvePeriodColumns(periods: string[], timeUnit: TimeUnit, periodOrder?: string[], periodColumnOrder?: PeriodColumnOrder): string[];
199
+ interface DesktopSizingInput {
200
+ periods: string[];
201
+ rows: StatementRow[];
202
+ showRowTotals: boolean;
203
+ showVariance: boolean;
204
+ }
205
+ interface DesktopSizingResult {
206
+ accountSize: number;
207
+ accountMinSize: number;
208
+ dataSize: number;
209
+ dataMinSize: number;
210
+ totalSize: number;
211
+ }
212
+ declare function calculateDesktopFinancialColumnSizing({ periods, rows, showRowTotals, showVariance, }: DesktopSizingInput): DesktopSizingResult;
213
+ declare function buildFinancialStatementData(data: FinancialStatementEntry[], config: FinancialStatementConfig, timeUnit: TimeUnit, subtotalRules?: SubtotalRulesConfig, options?: {
214
+ preserveEmptySections?: boolean;
215
+ }): {
216
+ rows: StatementRow[];
217
+ periods: string[];
218
+ };
219
+ /**
220
+ * Reusable financial statement table component.
221
+ *
222
+ * Renders a tree-structured DataTable with:
223
+ * - Sections (Revenue, Expenses) as expandable headers
224
+ * - Parent/child account tree with subtotals at each level
225
+ * - Section totals (Total Revenue, Total Expenses)
226
+ * - Computed grand totals (Net Income, Gross Profit)
227
+ * - Accounting-format currency (brackets for negatives, red)
228
+ */
229
+ declare function FinancialStatementTable({ data, timeUnit, config, showAccountNumbers, treeIndentPx, subtotalRules, hideZeroRows, preserveEmptySections, showRowTotals, showVariance, currentPeriodCount, toolbar, renderAmountCell, isMobile, mobileCompareEnabled, periodOrder, periodColumnOrder, periodLabels, accountColumnLabel, accountColumnMenuItems, className, rowImportanceResolver, }: FinancialStatementTableProps): react_jsx_runtime.JSX.Element;
230
+ interface FlatExportRow {
231
+ type: string;
232
+ account: string;
233
+ accountNumber: string;
234
+ [period: string]: string | number;
235
+ }
236
+ /**
237
+ * Flatten the financial statement tree into export-ready rows.
238
+ * Includes indentation hints in the account name.
239
+ */
240
+ declare function flattenStatementForExport(data: FinancialStatementEntry[], config: FinancialStatementConfig, timeUnit: TimeUnit, subtotalRules?: SubtotalRulesConfig, hideZeroRows?: boolean): {
241
+ rows: FlatExportRow[];
242
+ periodKeys: string[];
243
+ };
244
+ /** Standard income statement (P&L) configuration */
245
+ declare const INCOME_STATEMENT_CONFIG: FinancialStatementConfig;
246
+ /** Balance sheet configuration */
247
+ declare const BALANCE_SHEET_CONFIG: FinancialStatementConfig;
248
+
249
+ export { BALANCE_SHEET_CONFIG as B, type ComparisonMode as C, type FinancialStatementConfig as F, INCOME_STATEMENT_CONFIG as I, type PeriodColumnOrder as P, type StatementRow as S, type TimeUnit as T, ComparisonSelector as a, type ComparisonSelectorProps as b, type FinancialStatementEntry as c, type FinancialStatementKind as d, type FinancialStatementRowImportance as e, type FinancialStatementRowImportanceResolver as f, type FinancialStatementSection as g, FinancialStatementTable as h, type FinancialStatementTableProps as i, type FinancialStatementTotal as j, type FlatExportRow as k, type PeriodGranularity as l, PeriodSelector as m, type PeriodSelectorChangeParams as n, type PeriodSelectorProps as o, type SubtotalRule as p, type SubtotalRulesConfig as q, buildFinancialStatementData as r, calculateDesktopFinancialColumnSizing as s, createFinancialStatementRowImportanceResolver as t, flattenStatementForExport as u, getFinancialStatementRowImportanceClassName as v, resolvePeriodColumns as w };
@@ -0,0 +1,249 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+
4
+ type ComparisonMode = "none" | "previous" | "same-period-last-year" | "custom";
5
+ interface ComparisonSelectorProps {
6
+ /** Current comparison mode */
7
+ mode: ComparisonMode;
8
+ /** Number of comparison periods (for previous/same-period modes) */
9
+ periods: number;
10
+ /** Suggested default count for Previous Period (e.g. LTM => 12) */
11
+ defaultPreviousPeriods?: number;
12
+ /** Custom comparison date range (when mode = "custom") */
13
+ customStart?: string;
14
+ customEnd?: string;
15
+ /** Called when comparison settings change */
16
+ onChange: (params: {
17
+ mode: ComparisonMode;
18
+ periods: number;
19
+ customStart?: string;
20
+ customEnd?: string;
21
+ }) => void;
22
+ /** Optional className */
23
+ className?: string;
24
+ }
25
+ declare function ComparisonSelector({ mode, periods, defaultPreviousPeriods, customStart, customEnd, onChange, className, }: ComparisonSelectorProps): react_jsx_runtime.JSX.Element;
26
+
27
+ type PeriodGranularity = "month" | "quarter" | "year" | "ltm" | "ytd" | "custom";
28
+ interface PeriodSelectorChangeParams {
29
+ granularity: PeriodGranularity;
30
+ periodStart: string;
31
+ periodEnd: string;
32
+ timeUnit: "month" | "quarter" | "year";
33
+ allDates?: boolean;
34
+ }
35
+ interface PeriodSelectorProps {
36
+ /** Currently selected granularity */
37
+ granularity: PeriodGranularity;
38
+ /** The current period start date (ISO string YYYY-MM-DD) */
39
+ periodStart: string;
40
+ /** The current period end date (ISO string YYYY-MM-DD) */
41
+ periodEnd: string;
42
+ /** Enable integrated "All dates" mode in selector UI */
43
+ enableAllDates?: boolean;
44
+ /** Whether all-dates mode is active */
45
+ allDates?: boolean;
46
+ /** Fiscal year end month (1-12, default 12 = December = calendar year) */
47
+ fiscalYearEndMonth?: number;
48
+ /** Called when user changes granularity or navigates */
49
+ onChange: (params: PeriodSelectorChangeParams) => void;
50
+ /** Optional className */
51
+ className?: string;
52
+ }
53
+ declare function PeriodSelector({ granularity, periodStart, periodEnd, enableAllDates, allDates, fiscalYearEndMonth, onChange, className, }: PeriodSelectorProps): react_jsx_runtime.JSX.Element;
54
+
55
+ type FinancialStatementRowImportance = "normal" | "emphasis" | "key-summary";
56
+ type FinancialStatementKind = "income-statement" | "balance-sheet" | "cash-flow" | "working-capital";
57
+ type FinancialStatementRowImportanceResolver = (row: StatementRow) => FinancialStatementRowImportance;
58
+ interface RowImportanceLabelConfig {
59
+ emphasis: string[];
60
+ keySummary: string[];
61
+ }
62
+ declare function createFinancialStatementRowImportanceResolver(kind: FinancialStatementKind, overrides?: Partial<RowImportanceLabelConfig>): FinancialStatementRowImportanceResolver;
63
+ declare function getFinancialStatementRowImportanceClassName(importance: FinancialStatementRowImportance): string | undefined;
64
+
65
+ interface FinancialStatementEntry {
66
+ /** Period start date (YYYY-MM-DD) */
67
+ period_first_day: string;
68
+ /** Account identifier */
69
+ account_id: string;
70
+ /** Account display name */
71
+ account_name: string;
72
+ /** Optional secondary label shown below account name */
73
+ account_secondary_label?: string | null;
74
+ /** Account number (e.g. "4000") */
75
+ account_number: string | null;
76
+ /** High-level classification: "Revenue" | "Expense" | "Asset" | "Liability" | "Equity" */
77
+ account_class: string;
78
+ /** Account type (e.g. "Income", "Cost of Goods Sold", "Expense") */
79
+ account_type?: string;
80
+ /** Account sub-type */
81
+ account_sub_type?: string | null;
82
+ /** Whether this account is a child of another */
83
+ is_sub_account?: boolean;
84
+ /** Parent account number */
85
+ parent_account_number?: string | null;
86
+ /** Parent account name */
87
+ parent_account_name?: string | null;
88
+ /** Amount for this period */
89
+ amount: number;
90
+ }
91
+ type TimeUnit = "month" | "quarter" | "year";
92
+ interface FinancialStatementSection {
93
+ /** Section ID */
94
+ id: string;
95
+ /** Display label (e.g. "Revenue", "Expenses") */
96
+ label: string;
97
+ /** Which account_class values belong to this section */
98
+ accountClasses: string[];
99
+ /** Sign multiplier for totals (1 for revenue, -1 if you want to flip expenses) */
100
+ sign?: number;
101
+ /** Render entries directly (no section header or section total row) */
102
+ standalone?: boolean;
103
+ }
104
+ interface FinancialStatementTotal {
105
+ /** Display label (e.g. "Net Income", "Gross Profit") */
106
+ label: string;
107
+ /** Section IDs to sum. Prefix with "-" to subtract. e.g. ["section-revenue", "-section-expense"] */
108
+ formula: string[];
109
+ }
110
+ interface FinancialStatementConfig {
111
+ /** Sections to display (in order) */
112
+ sections: FinancialStatementSection[];
113
+ /** Computed total rows to display after sections */
114
+ totals: FinancialStatementTotal[];
115
+ }
116
+ /** Subtotal grouping rule — regex on account_number */
117
+ interface SubtotalRule {
118
+ /** Display label (e.g. "Program", "Opex") */
119
+ label: string;
120
+ /** Regex pattern matched against account_number */
121
+ pattern: string;
122
+ /** Display order (lower = first) */
123
+ order: number;
124
+ }
125
+ /** Subtotal rules settings (as stored in system_settings) */
126
+ interface SubtotalRulesConfig {
127
+ /** Whether subtotal grouping is enabled */
128
+ enabled: boolean;
129
+ /** Ordered list of regex rules */
130
+ rules: SubtotalRule[];
131
+ }
132
+ type PeriodColumnOrder = "oldest-first" | "newest-first";
133
+ interface FinancialStatementTableProps {
134
+ /** Raw data entries */
135
+ data: FinancialStatementEntry[];
136
+ /** Time unit for period columns */
137
+ timeUnit: TimeUnit;
138
+ /** Statement structure configuration */
139
+ config: FinancialStatementConfig;
140
+ /** Show account numbers in first column */
141
+ showAccountNumbers?: boolean;
142
+ /** Tree indent in px */
143
+ treeIndentPx?: number;
144
+ /** Subtotal grouping rules (regex on account_number) */
145
+ subtotalRules?: SubtotalRulesConfig;
146
+ /** Hide rows where all visible period amounts and total are zero */
147
+ hideZeroRows?: boolean;
148
+ /** Toolbar content rendered above the table (right-aligned) */
149
+ toolbar?: React.ReactNode;
150
+ /** Custom cell renderer for currency amounts — receives row data, period key (null for total), and value */
151
+ renderAmountCell?: (row: StatementRow, periodKey: string | null, value: number) => React.ReactNode;
152
+ /** Show section header + total rows even when no data exists for that section */
153
+ preserveEmptySections?: boolean;
154
+ /** Show rightmost Total column */
155
+ showSectionTotals?: boolean;
156
+ showRowTotals?: boolean;
157
+ /** Show a variance % column comparing current vs prior period (only when exactly 1 comparison period) */
158
+ showVariance?: boolean;
159
+ /** Number of current period columns (to split current vs comparison in variance calc) */
160
+ currentPeriodCount?: number;
161
+ /** Whether table is rendered in a mobile viewport */
162
+ isMobile?: boolean;
163
+ /** Whether compare mode is enabled in mobile mode */
164
+ mobileCompareEnabled?: boolean;
165
+ /** Optional explicit period order (first to last) for displayed columns */
166
+ periodOrder?: string[];
167
+ /** Global order for period columns when periodOrder is not explicitly provided */
168
+ periodColumnOrder?: PeriodColumnOrder;
169
+ /** Override period column header labels (key = period key, value = display label) */
170
+ periodLabels?: Record<string, string>;
171
+ /** Override the first column header label (default: "Account") */
172
+ accountColumnLabel?: string;
173
+ /** Extra menu items for the account column header dropdown */
174
+ accountColumnMenuItems?: React.ReactNode;
175
+ /** Additional class name */
176
+ className?: string;
177
+ /** Optional resolver for row-importance styling (normal, emphasis, key-summary) */
178
+ rowImportanceResolver?: FinancialStatementRowImportanceResolver;
179
+ }
180
+ type RowType = "section-header" | "account-group" | "account" | "section-total" | "grand-total" | "subtotal-group" | "subtotal-total";
181
+ interface StatementRow {
182
+ _type: RowType;
183
+ id: string;
184
+ name: string;
185
+ secondaryLabel?: string | null;
186
+ accountNumber: string | null;
187
+ accountType?: string;
188
+ accountSubType?: string | null;
189
+ periodAmounts: Record<string, number>;
190
+ total: number;
191
+ children: StatementRow[];
192
+ /** Depth hint for styling (0 = section header/total, 1+ = accounts) */
193
+ depth: number;
194
+ /** Independent raw sum from source data (for reconciliation on total rows) */
195
+ _rawPeriodAmounts?: Record<string, number>;
196
+ _rawTotal?: number;
197
+ }
198
+ declare function resolvePeriodColumns(periods: string[], timeUnit: TimeUnit, periodOrder?: string[], periodColumnOrder?: PeriodColumnOrder): string[];
199
+ interface DesktopSizingInput {
200
+ periods: string[];
201
+ rows: StatementRow[];
202
+ showRowTotals: boolean;
203
+ showVariance: boolean;
204
+ }
205
+ interface DesktopSizingResult {
206
+ accountSize: number;
207
+ accountMinSize: number;
208
+ dataSize: number;
209
+ dataMinSize: number;
210
+ totalSize: number;
211
+ }
212
+ declare function calculateDesktopFinancialColumnSizing({ periods, rows, showRowTotals, showVariance, }: DesktopSizingInput): DesktopSizingResult;
213
+ declare function buildFinancialStatementData(data: FinancialStatementEntry[], config: FinancialStatementConfig, timeUnit: TimeUnit, subtotalRules?: SubtotalRulesConfig, options?: {
214
+ preserveEmptySections?: boolean;
215
+ }): {
216
+ rows: StatementRow[];
217
+ periods: string[];
218
+ };
219
+ /**
220
+ * Reusable financial statement table component.
221
+ *
222
+ * Renders a tree-structured DataTable with:
223
+ * - Sections (Revenue, Expenses) as expandable headers
224
+ * - Parent/child account tree with subtotals at each level
225
+ * - Section totals (Total Revenue, Total Expenses)
226
+ * - Computed grand totals (Net Income, Gross Profit)
227
+ * - Accounting-format currency (brackets for negatives, red)
228
+ */
229
+ declare function FinancialStatementTable({ data, timeUnit, config, showAccountNumbers, treeIndentPx, subtotalRules, hideZeroRows, preserveEmptySections, showRowTotals, showVariance, currentPeriodCount, toolbar, renderAmountCell, isMobile, mobileCompareEnabled, periodOrder, periodColumnOrder, periodLabels, accountColumnLabel, accountColumnMenuItems, className, rowImportanceResolver, }: FinancialStatementTableProps): react_jsx_runtime.JSX.Element;
230
+ interface FlatExportRow {
231
+ type: string;
232
+ account: string;
233
+ accountNumber: string;
234
+ [period: string]: string | number;
235
+ }
236
+ /**
237
+ * Flatten the financial statement tree into export-ready rows.
238
+ * Includes indentation hints in the account name.
239
+ */
240
+ declare function flattenStatementForExport(data: FinancialStatementEntry[], config: FinancialStatementConfig, timeUnit: TimeUnit, subtotalRules?: SubtotalRulesConfig, hideZeroRows?: boolean): {
241
+ rows: FlatExportRow[];
242
+ periodKeys: string[];
243
+ };
244
+ /** Standard income statement (P&L) configuration */
245
+ declare const INCOME_STATEMENT_CONFIG: FinancialStatementConfig;
246
+ /** Balance sheet configuration */
247
+ declare const BALANCE_SHEET_CONFIG: FinancialStatementConfig;
248
+
249
+ export { BALANCE_SHEET_CONFIG as B, type ComparisonMode as C, type FinancialStatementConfig as F, INCOME_STATEMENT_CONFIG as I, type PeriodColumnOrder as P, type StatementRow as S, type TimeUnit as T, ComparisonSelector as a, type ComparisonSelectorProps as b, type FinancialStatementEntry as c, type FinancialStatementKind as d, type FinancialStatementRowImportance as e, type FinancialStatementRowImportanceResolver as f, type FinancialStatementSection as g, FinancialStatementTable as h, type FinancialStatementTableProps as i, type FinancialStatementTotal as j, type FlatExportRow as k, type PeriodGranularity as l, PeriodSelector as m, type PeriodSelectorChangeParams as n, type PeriodSelectorProps as o, type SubtotalRule as p, type SubtotalRulesConfig as q, buildFinancialStatementData as r, calculateDesktopFinancialColumnSizing as s, createFinancialStatementRowImportanceResolver as t, flattenStatementForExport as u, getFinancialStatementRowImportanceClassName as v, resolvePeriodColumns as w };
@@ -0,0 +1,37 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface NewsletterSignupProps {
4
+ /** Additional className */
5
+ className?: string;
6
+ /** API endpoint that accepts a JSON POST body with an email address. */
7
+ endpoint?: string;
8
+ /** Optional source value included in the POST body for attribution. */
9
+ source?: string;
10
+ /** Email input placeholder. */
11
+ placeholder?: string;
12
+ /** Accessible label for the email input. */
13
+ inputLabel?: string;
14
+ /** Submit button text. */
15
+ buttonLabel?: string;
16
+ /** Submit button text while the request is in flight. */
17
+ submittingLabel?: string;
18
+ /** Success state title. */
19
+ successTitle?: string;
20
+ /** Success state supporting copy. */
21
+ successDescription?: string;
22
+ /** Fallback error copy used when the API does not provide one. */
23
+ errorMessage?: string;
24
+ /** Extra classes for the email input. */
25
+ inputClassName?: string;
26
+ /** Extra classes for the submit button. */
27
+ buttonClassName?: string;
28
+ /** Extra classes for the success state wrapper. */
29
+ successClassName?: string;
30
+ }
31
+ /**
32
+ * NewsletterSignup - Newsletter signup form for marketing page
33
+ * Errors are displayed via toasts for better UX
34
+ */
35
+ declare function NewsletterSignup({ className, endpoint, source, placeholder, inputLabel, buttonLabel, submittingLabel, successTitle, successDescription, errorMessage, inputClassName, buttonClassName, successClassName, }: NewsletterSignupProps): react_jsx_runtime.JSX.Element;
36
+
37
+ export { NewsletterSignup as N, type NewsletterSignupProps as a };
@@ -0,0 +1,37 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface NewsletterSignupProps {
4
+ /** Additional className */
5
+ className?: string;
6
+ /** API endpoint that accepts a JSON POST body with an email address. */
7
+ endpoint?: string;
8
+ /** Optional source value included in the POST body for attribution. */
9
+ source?: string;
10
+ /** Email input placeholder. */
11
+ placeholder?: string;
12
+ /** Accessible label for the email input. */
13
+ inputLabel?: string;
14
+ /** Submit button text. */
15
+ buttonLabel?: string;
16
+ /** Submit button text while the request is in flight. */
17
+ submittingLabel?: string;
18
+ /** Success state title. */
19
+ successTitle?: string;
20
+ /** Success state supporting copy. */
21
+ successDescription?: string;
22
+ /** Fallback error copy used when the API does not provide one. */
23
+ errorMessage?: string;
24
+ /** Extra classes for the email input. */
25
+ inputClassName?: string;
26
+ /** Extra classes for the submit button. */
27
+ buttonClassName?: string;
28
+ /** Extra classes for the success state wrapper. */
29
+ successClassName?: string;
30
+ }
31
+ /**
32
+ * NewsletterSignup - Newsletter signup form for marketing page
33
+ * Errors are displayed via toasts for better UX
34
+ */
35
+ declare function NewsletterSignup({ className, endpoint, source, placeholder, inputLabel, buttonLabel, submittingLabel, successTitle, successDescription, errorMessage, inputClassName, buttonClassName, successClassName, }: NewsletterSignupProps): react_jsx_runtime.JSX.Element;
36
+
37
+ export { NewsletterSignup as N, type NewsletterSignupProps as a };