@prismiq/react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +88 -0
  2. package/dist/CustomSQLEditor-BXB4rf1q.d.cts +1297 -0
  3. package/dist/CustomSQLEditor-DYeId0Gp.d.ts +1297 -0
  4. package/dist/DashboardDialog-B3vYC5Gs.d.ts +1106 -0
  5. package/dist/DashboardDialog-LHmrtNQU.d.cts +1106 -0
  6. package/dist/accessibility-2yy5yqRR.d.cts +145 -0
  7. package/dist/accessibility-2yy5yqRR.d.ts +145 -0
  8. package/dist/charts/index.cjs +110 -0
  9. package/dist/charts/index.cjs.map +1 -0
  10. package/dist/charts/index.d.cts +2 -0
  11. package/dist/charts/index.d.ts +2 -0
  12. package/dist/charts/index.js +5 -0
  13. package/dist/charts/index.js.map +1 -0
  14. package/dist/chunk-2H5WTH4K.js +2409 -0
  15. package/dist/chunk-2H5WTH4K.js.map +1 -0
  16. package/dist/chunk-4AVL6GQK.cjs +470 -0
  17. package/dist/chunk-4AVL6GQK.cjs.map +1 -0
  18. package/dist/chunk-EX74SI67.js +455 -0
  19. package/dist/chunk-EX74SI67.js.map +1 -0
  20. package/dist/chunk-FEABEF3J.cjs +7543 -0
  21. package/dist/chunk-FEABEF3J.cjs.map +1 -0
  22. package/dist/chunk-JTCBZDHY.js +126 -0
  23. package/dist/chunk-JTCBZDHY.js.map +1 -0
  24. package/dist/chunk-LMTG3LRC.cjs +326 -0
  25. package/dist/chunk-LMTG3LRC.cjs.map +1 -0
  26. package/dist/chunk-MDXGGZSW.cjs +273 -0
  27. package/dist/chunk-MDXGGZSW.cjs.map +1 -0
  28. package/dist/chunk-MOAEEF5P.js +7510 -0
  29. package/dist/chunk-MOAEEF5P.js.map +1 -0
  30. package/dist/chunk-NK7HKX2J.cjs +2459 -0
  31. package/dist/chunk-NK7HKX2J.cjs.map +1 -0
  32. package/dist/chunk-NY6TZLST.cjs +8781 -0
  33. package/dist/chunk-NY6TZLST.cjs.map +1 -0
  34. package/dist/chunk-T6STUE7E.js +321 -0
  35. package/dist/chunk-T6STUE7E.js.map +1 -0
  36. package/dist/chunk-TRW7DKLP.cjs +141 -0
  37. package/dist/chunk-TRW7DKLP.cjs.map +1 -0
  38. package/dist/chunk-UPYINBZU.js +8706 -0
  39. package/dist/chunk-UPYINBZU.js.map +1 -0
  40. package/dist/chunk-WWTT2OJ5.js +246 -0
  41. package/dist/chunk-WWTT2OJ5.js.map +1 -0
  42. package/dist/components/index.cjs +222 -0
  43. package/dist/components/index.cjs.map +1 -0
  44. package/dist/components/index.d.cts +207 -0
  45. package/dist/components/index.d.ts +207 -0
  46. package/dist/components/index.js +5 -0
  47. package/dist/components/index.js.map +1 -0
  48. package/dist/dashboard/index.cjs +140 -0
  49. package/dist/dashboard/index.cjs.map +1 -0
  50. package/dist/dashboard/index.d.cts +302 -0
  51. package/dist/dashboard/index.d.ts +302 -0
  52. package/dist/dashboard/index.js +7 -0
  53. package/dist/dashboard/index.js.map +1 -0
  54. package/dist/export/index.cjs +32 -0
  55. package/dist/export/index.cjs.map +1 -0
  56. package/dist/export/index.d.cts +197 -0
  57. package/dist/export/index.d.ts +197 -0
  58. package/dist/export/index.js +3 -0
  59. package/dist/export/index.js.map +1 -0
  60. package/dist/index-C-Qcuu4Y.d.cts +821 -0
  61. package/dist/index-rPc7ijt8.d.ts +821 -0
  62. package/dist/index.cjs +1486 -0
  63. package/dist/index.cjs.map +1 -0
  64. package/dist/index.d.cts +1435 -0
  65. package/dist/index.d.ts +1435 -0
  66. package/dist/index.js +926 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/ssr/index.cjs +64 -0
  69. package/dist/ssr/index.cjs.map +1 -0
  70. package/dist/ssr/index.d.cts +213 -0
  71. package/dist/ssr/index.d.ts +213 -0
  72. package/dist/ssr/index.js +3 -0
  73. package/dist/ssr/index.js.map +1 -0
  74. package/dist/types-WrCbOeAV.d.cts +569 -0
  75. package/dist/types-WrCbOeAV.d.ts +569 -0
  76. package/dist/utils/index.cjs +64 -0
  77. package/dist/utils/index.cjs.map +1 -0
  78. package/dist/utils/index.d.cts +112 -0
  79. package/dist/utils/index.d.ts +112 -0
  80. package/dist/utils/index.js +3 -0
  81. package/dist/utils/index.js.map +1 -0
  82. package/package.json +110 -0
@@ -0,0 +1,197 @@
1
+ import { Q as QueryResult } from '../types-WrCbOeAV.cjs';
2
+
3
+ /**
4
+ * Types for export functionality.
5
+ */
6
+
7
+ /**
8
+ * Options for CSV export.
9
+ */
10
+ interface ExportOptions {
11
+ /** Custom filename (without extension) */
12
+ filename?: string;
13
+ /** Subset of columns to export (defaults to all) */
14
+ columns?: string[];
15
+ /** Custom column header names */
16
+ headers?: Record<string, string>;
17
+ /** Date format string (default: ISO) */
18
+ dateFormat?: string;
19
+ /** Number format options */
20
+ numberFormat?: Intl.NumberFormatOptions;
21
+ }
22
+ /**
23
+ * Options for Excel export.
24
+ */
25
+ interface ExcelExportOptions extends ExportOptions {
26
+ /** Sheet name (default: "Sheet1") */
27
+ sheetName?: string;
28
+ /** Column width overrides */
29
+ columnWidths?: Record<string, number>;
30
+ /** Freeze the header row */
31
+ freezeHeader?: boolean;
32
+ /** Header cell style */
33
+ headerStyle?: ExcelCellStyle;
34
+ /** Data cell style */
35
+ dataStyle?: ExcelCellStyle;
36
+ }
37
+ /**
38
+ * Excel cell style options.
39
+ */
40
+ interface ExcelCellStyle {
41
+ /** Bold text */
42
+ bold?: boolean;
43
+ /** Background color (hex) */
44
+ fill?: string;
45
+ /** Text alignment */
46
+ align?: 'left' | 'center' | 'right';
47
+ }
48
+ /**
49
+ * Data that can be exported (QueryResult or array of objects).
50
+ */
51
+ type ExportData = QueryResult | Record<string, unknown>[];
52
+
53
+ /**
54
+ * CSV export functionality.
55
+ */
56
+
57
+ /**
58
+ * Generate CSV content from data.
59
+ *
60
+ * @param data - Array of row objects
61
+ * @param columns - Column names
62
+ * @param headers - Custom header names
63
+ * @param options - Export options
64
+ * @returns CSV string
65
+ */
66
+ declare function generateCSV(data: Record<string, unknown>[], columns: string[], headers?: Record<string, string>, options?: ExportOptions): string;
67
+ /**
68
+ * Trigger a file download in the browser.
69
+ *
70
+ * @param content - File content
71
+ * @param filename - File name with extension
72
+ * @param mimeType - MIME type
73
+ */
74
+ declare function downloadFile(content: string, filename: string, mimeType: string): void;
75
+ /**
76
+ * Export data to CSV and trigger download.
77
+ *
78
+ * @param data - QueryResult or array of objects
79
+ * @param options - Export options
80
+ *
81
+ * @example
82
+ * ```tsx
83
+ * // Export query result
84
+ * exportToCSV(queryResult, { filename: 'sales-report' });
85
+ *
86
+ * // Export with custom columns
87
+ * exportToCSV(data, {
88
+ * columns: ['id', 'name', 'value'],
89
+ * headers: { id: 'ID', name: 'Name', value: 'Value' }
90
+ * });
91
+ * ```
92
+ */
93
+ declare function exportToCSV(data: ExportData, options?: ExportOptions): void;
94
+
95
+ /**
96
+ * Excel export functionality.
97
+ *
98
+ * Uses the xlsx library (SheetJS) for Excel file generation.
99
+ */
100
+
101
+ /**
102
+ * Export data to Excel and trigger download.
103
+ *
104
+ * @param data - QueryResult or array of objects
105
+ * @param options - Export options
106
+ *
107
+ * @example
108
+ * ```tsx
109
+ * // Basic export
110
+ * exportToExcel(queryResult, { filename: 'sales-report' });
111
+ *
112
+ * // With styling
113
+ * exportToExcel(data, {
114
+ * filename: 'report',
115
+ * sheetName: 'Sales Data',
116
+ * freezeHeader: true,
117
+ * headerStyle: { bold: true, fill: '#e3f2fd', align: 'center' }
118
+ * });
119
+ * ```
120
+ */
121
+ declare function exportToExcel(data: ExportData, options?: ExcelExportOptions): void;
122
+ /**
123
+ * Export multiple sheets to a single Excel file.
124
+ *
125
+ * @param sheets - Object mapping sheet names to data
126
+ * @param filename - Output filename
127
+ *
128
+ * @example
129
+ * ```tsx
130
+ * exportMultipleSheets({
131
+ * 'Sales': salesData,
132
+ * 'Customers': customerData,
133
+ * 'Products': productData,
134
+ * }, 'full-report');
135
+ * ```
136
+ */
137
+ declare function exportMultipleSheets(sheets: Record<string, ExportData>, filename: string): void;
138
+
139
+ /**
140
+ * Options for the useExport hook.
141
+ */
142
+ interface UseExportOptions {
143
+ /** Data to export */
144
+ data: QueryResult | null;
145
+ /** Default filename for exports */
146
+ filename?: string;
147
+ /** Columns to export (defaults to all) */
148
+ columns?: string[];
149
+ /** Custom column headers */
150
+ headers?: Record<string, string>;
151
+ }
152
+ /**
153
+ * Result of the useExport hook.
154
+ */
155
+ interface UseExportResult {
156
+ /** Export to CSV file */
157
+ exportCSV: () => void;
158
+ /** Export to Excel file */
159
+ exportExcel: (options?: ExcelExportOptions) => void;
160
+ /** Whether an export is in progress */
161
+ isExporting: boolean;
162
+ /** Whether export is possible (data is available) */
163
+ canExport: boolean;
164
+ }
165
+ /**
166
+ * Hook for exporting query data to CSV or Excel.
167
+ *
168
+ * @param options - Export options
169
+ * @returns Export functions and state
170
+ *
171
+ * @example
172
+ * ```tsx
173
+ * function DataTable({ data }) {
174
+ * const { exportCSV, exportExcel, canExport, isExporting } = useExport({
175
+ * data,
176
+ * filename: 'sales-report',
177
+ * columns: ['id', 'name', 'amount'],
178
+ * headers: { id: 'ID', name: 'Name', amount: 'Amount' }
179
+ * });
180
+ *
181
+ * return (
182
+ * <div>
183
+ * <button onClick={exportCSV} disabled={!canExport || isExporting}>
184
+ * Export CSV
185
+ * </button>
186
+ * <button onClick={() => exportExcel()} disabled={!canExport || isExporting}>
187
+ * Export Excel
188
+ * </button>
189
+ * {isExporting && <span>Exporting...</span>}
190
+ * </div>
191
+ * );
192
+ * }
193
+ * ```
194
+ */
195
+ declare function useExport(options: UseExportOptions): UseExportResult;
196
+
197
+ export { type ExcelCellStyle, type ExcelExportOptions, type ExportData, type ExportOptions, type UseExportOptions, type UseExportResult, downloadFile, exportMultipleSheets, exportToCSV, exportToExcel, generateCSV, useExport };
@@ -0,0 +1,197 @@
1
+ import { Q as QueryResult } from '../types-WrCbOeAV.js';
2
+
3
+ /**
4
+ * Types for export functionality.
5
+ */
6
+
7
+ /**
8
+ * Options for CSV export.
9
+ */
10
+ interface ExportOptions {
11
+ /** Custom filename (without extension) */
12
+ filename?: string;
13
+ /** Subset of columns to export (defaults to all) */
14
+ columns?: string[];
15
+ /** Custom column header names */
16
+ headers?: Record<string, string>;
17
+ /** Date format string (default: ISO) */
18
+ dateFormat?: string;
19
+ /** Number format options */
20
+ numberFormat?: Intl.NumberFormatOptions;
21
+ }
22
+ /**
23
+ * Options for Excel export.
24
+ */
25
+ interface ExcelExportOptions extends ExportOptions {
26
+ /** Sheet name (default: "Sheet1") */
27
+ sheetName?: string;
28
+ /** Column width overrides */
29
+ columnWidths?: Record<string, number>;
30
+ /** Freeze the header row */
31
+ freezeHeader?: boolean;
32
+ /** Header cell style */
33
+ headerStyle?: ExcelCellStyle;
34
+ /** Data cell style */
35
+ dataStyle?: ExcelCellStyle;
36
+ }
37
+ /**
38
+ * Excel cell style options.
39
+ */
40
+ interface ExcelCellStyle {
41
+ /** Bold text */
42
+ bold?: boolean;
43
+ /** Background color (hex) */
44
+ fill?: string;
45
+ /** Text alignment */
46
+ align?: 'left' | 'center' | 'right';
47
+ }
48
+ /**
49
+ * Data that can be exported (QueryResult or array of objects).
50
+ */
51
+ type ExportData = QueryResult | Record<string, unknown>[];
52
+
53
+ /**
54
+ * CSV export functionality.
55
+ */
56
+
57
+ /**
58
+ * Generate CSV content from data.
59
+ *
60
+ * @param data - Array of row objects
61
+ * @param columns - Column names
62
+ * @param headers - Custom header names
63
+ * @param options - Export options
64
+ * @returns CSV string
65
+ */
66
+ declare function generateCSV(data: Record<string, unknown>[], columns: string[], headers?: Record<string, string>, options?: ExportOptions): string;
67
+ /**
68
+ * Trigger a file download in the browser.
69
+ *
70
+ * @param content - File content
71
+ * @param filename - File name with extension
72
+ * @param mimeType - MIME type
73
+ */
74
+ declare function downloadFile(content: string, filename: string, mimeType: string): void;
75
+ /**
76
+ * Export data to CSV and trigger download.
77
+ *
78
+ * @param data - QueryResult or array of objects
79
+ * @param options - Export options
80
+ *
81
+ * @example
82
+ * ```tsx
83
+ * // Export query result
84
+ * exportToCSV(queryResult, { filename: 'sales-report' });
85
+ *
86
+ * // Export with custom columns
87
+ * exportToCSV(data, {
88
+ * columns: ['id', 'name', 'value'],
89
+ * headers: { id: 'ID', name: 'Name', value: 'Value' }
90
+ * });
91
+ * ```
92
+ */
93
+ declare function exportToCSV(data: ExportData, options?: ExportOptions): void;
94
+
95
+ /**
96
+ * Excel export functionality.
97
+ *
98
+ * Uses the xlsx library (SheetJS) for Excel file generation.
99
+ */
100
+
101
+ /**
102
+ * Export data to Excel and trigger download.
103
+ *
104
+ * @param data - QueryResult or array of objects
105
+ * @param options - Export options
106
+ *
107
+ * @example
108
+ * ```tsx
109
+ * // Basic export
110
+ * exportToExcel(queryResult, { filename: 'sales-report' });
111
+ *
112
+ * // With styling
113
+ * exportToExcel(data, {
114
+ * filename: 'report',
115
+ * sheetName: 'Sales Data',
116
+ * freezeHeader: true,
117
+ * headerStyle: { bold: true, fill: '#e3f2fd', align: 'center' }
118
+ * });
119
+ * ```
120
+ */
121
+ declare function exportToExcel(data: ExportData, options?: ExcelExportOptions): void;
122
+ /**
123
+ * Export multiple sheets to a single Excel file.
124
+ *
125
+ * @param sheets - Object mapping sheet names to data
126
+ * @param filename - Output filename
127
+ *
128
+ * @example
129
+ * ```tsx
130
+ * exportMultipleSheets({
131
+ * 'Sales': salesData,
132
+ * 'Customers': customerData,
133
+ * 'Products': productData,
134
+ * }, 'full-report');
135
+ * ```
136
+ */
137
+ declare function exportMultipleSheets(sheets: Record<string, ExportData>, filename: string): void;
138
+
139
+ /**
140
+ * Options for the useExport hook.
141
+ */
142
+ interface UseExportOptions {
143
+ /** Data to export */
144
+ data: QueryResult | null;
145
+ /** Default filename for exports */
146
+ filename?: string;
147
+ /** Columns to export (defaults to all) */
148
+ columns?: string[];
149
+ /** Custom column headers */
150
+ headers?: Record<string, string>;
151
+ }
152
+ /**
153
+ * Result of the useExport hook.
154
+ */
155
+ interface UseExportResult {
156
+ /** Export to CSV file */
157
+ exportCSV: () => void;
158
+ /** Export to Excel file */
159
+ exportExcel: (options?: ExcelExportOptions) => void;
160
+ /** Whether an export is in progress */
161
+ isExporting: boolean;
162
+ /** Whether export is possible (data is available) */
163
+ canExport: boolean;
164
+ }
165
+ /**
166
+ * Hook for exporting query data to CSV or Excel.
167
+ *
168
+ * @param options - Export options
169
+ * @returns Export functions and state
170
+ *
171
+ * @example
172
+ * ```tsx
173
+ * function DataTable({ data }) {
174
+ * const { exportCSV, exportExcel, canExport, isExporting } = useExport({
175
+ * data,
176
+ * filename: 'sales-report',
177
+ * columns: ['id', 'name', 'amount'],
178
+ * headers: { id: 'ID', name: 'Name', amount: 'Amount' }
179
+ * });
180
+ *
181
+ * return (
182
+ * <div>
183
+ * <button onClick={exportCSV} disabled={!canExport || isExporting}>
184
+ * Export CSV
185
+ * </button>
186
+ * <button onClick={() => exportExcel()} disabled={!canExport || isExporting}>
187
+ * Export Excel
188
+ * </button>
189
+ * {isExporting && <span>Exporting...</span>}
190
+ * </div>
191
+ * );
192
+ * }
193
+ * ```
194
+ */
195
+ declare function useExport(options: UseExportOptions): UseExportResult;
196
+
197
+ export { type ExcelCellStyle, type ExcelExportOptions, type ExportData, type ExportOptions, type UseExportOptions, type UseExportResult, downloadFile, exportMultipleSheets, exportToCSV, exportToExcel, generateCSV, useExport };
@@ -0,0 +1,3 @@
1
+ export { downloadFile, exportMultipleSheets, exportToCSV, exportToExcel, generateCSV, useExport } from '../chunk-WWTT2OJ5.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}