@smallwebco/tinypivot-react 1.0.74 → 1.0.80

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/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _smallwebco_tinypivot_core from '@smallwebco/tinypivot-core';
2
- import { AIAnalystConfig, AIDataLoadedEvent, AIConversationUpdateEvent, AIQueryExecutedEvent, AIErrorEvent, ColumnStats, NumericRange, DateRange, NumberFormat, DateFormat, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, AIConversation, AITableSchema, AIDataSource, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
2
+ import { AIAnalystConfig, ResolvedTheme, AIDataLoadedEvent, AIConversationUpdateEvent, AIQueryExecutedEvent, AIErrorEvent, ColumnStats, NumericRange, DateRange, NumberFormat, DateFormat, Theme, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, AIConversation, AITableSchema, AIDataSource, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
3
3
  export { AIAnalystConfig, AIColumnSchema, AIConversation, AIConversationUpdateEvent, AIDataLoadedEvent, AIDataSource, AIErrorEvent, AIMessage, AIMessageMetadata, AIQueryExecutedEvent, AITableSchema, AggregationFunction, CellClickEvent, ColumnStats, CopyEvent, DataGridProps, ExportEvent, ExportOptions, FieldStats, FilterEvent, GridOptions, LicenseInfo, LicenseType, PaginationOptions, PivotCell, PivotConfig as PivotConfigType, PivotField, PivotResult, PivotTableProps, PivotValueField, RowSelectionChangeEvent, SelectionBounds, SelectionChangeEvent, SortEvent, formatCellValue, getAggregationLabel, getColumnUniqueValues } from '@smallwebco/tinypivot-core';
4
4
  import * as react from 'react';
5
5
  import react__default from 'react';
@@ -15,7 +15,7 @@ import { SortingState, ColumnFiltersState, VisibilityState } from '@tanstack/rea
15
15
 
16
16
  interface AIAnalystProps {
17
17
  config: AIAnalystConfig;
18
- theme?: 'light' | 'dark';
18
+ theme?: ResolvedTheme;
19
19
  onDataLoaded?: (payload: AIDataLoadedEvent) => void;
20
20
  onConversationUpdate?: (payload: AIConversationUpdateEvent) => void;
21
21
  onQueryExecuted?: (payload: AIQueryExecutedEvent) => void;
@@ -68,7 +68,7 @@ interface DataGridProps {
68
68
  pageSize?: number;
69
69
  enableColumnResize?: boolean;
70
70
  enableClipboard?: boolean;
71
- theme?: 'light' | 'dark' | 'auto';
71
+ theme?: Theme;
72
72
  stripedRows?: boolean;
73
73
  exportFilename?: string;
74
74
  enableVerticalResize?: boolean;
@@ -135,8 +135,9 @@ interface PivotConfigProps {
135
135
  onAddCalculatedField?: (field: CalculatedField) => void;
136
136
  onRemoveCalculatedField?: (id: string) => void;
137
137
  onUpdateCalculatedField?: (field: CalculatedField) => void;
138
+ theme?: string;
138
139
  }
139
- declare function PivotConfig({ availableFields, rowFields, columnFields, valueFields, showRowTotals, calculatedFields, onShowRowTotalsChange, onShowColumnTotalsChange, onClearConfig, onAutoSuggest, onDragStart, onDragEnd, onUpdateAggregation, onRemoveRowField, onRemoveColumnField, onRemoveValueField, onAddRowField, onAddColumnField, onAddCalculatedField, onRemoveCalculatedField, onUpdateCalculatedField, }: PivotConfigProps): react_jsx_runtime.JSX.Element;
140
+ declare function PivotConfig({ availableFields, rowFields, columnFields, valueFields, showRowTotals, calculatedFields, onShowRowTotalsChange, onShowColumnTotalsChange, onClearConfig, onAutoSuggest, onDragStart, onDragEnd, onUpdateAggregation, onRemoveRowField, onRemoveColumnField, onRemoveValueField, onAddRowField, onAddColumnField, onAddCalculatedField, onRemoveCalculatedField, onUpdateCalculatedField, theme, }: PivotConfigProps): react_jsx_runtime.JSX.Element;
140
141
 
141
142
  interface ActiveFilter {
142
143
  column: string;
@@ -166,8 +167,9 @@ interface PivotSkeletonProps {
166
167
  onUpdateAggregation: (field: string, oldAgg: AggregationFunction, newAgg: AggregationFunction) => void;
167
168
  onReorderRowFields: (fields: string[]) => void;
168
169
  onReorderColumnFields: (fields: string[]) => void;
170
+ theme?: string;
169
171
  }
170
- declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
172
+ declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, theme, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
171
173
 
172
174
  interface UseAIAnalystOptions {
173
175
  config: AIAnalystConfig;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _smallwebco_tinypivot_core from '@smallwebco/tinypivot-core';
2
- import { AIAnalystConfig, AIDataLoadedEvent, AIConversationUpdateEvent, AIQueryExecutedEvent, AIErrorEvent, ColumnStats, NumericRange, DateRange, NumberFormat, DateFormat, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, AIConversation, AITableSchema, AIDataSource, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
2
+ import { AIAnalystConfig, ResolvedTheme, AIDataLoadedEvent, AIConversationUpdateEvent, AIQueryExecutedEvent, AIErrorEvent, ColumnStats, NumericRange, DateRange, NumberFormat, DateFormat, Theme, FieldStats, PivotValueField, CalculatedField, AggregationFunction, PivotResult, AIConversation, AITableSchema, AIDataSource, PivotExportData, ExportOptions, SelectionBounds, PaginationOptions, LicenseInfo } from '@smallwebco/tinypivot-core';
3
3
  export { AIAnalystConfig, AIColumnSchema, AIConversation, AIConversationUpdateEvent, AIDataLoadedEvent, AIDataSource, AIErrorEvent, AIMessage, AIMessageMetadata, AIQueryExecutedEvent, AITableSchema, AggregationFunction, CellClickEvent, ColumnStats, CopyEvent, DataGridProps, ExportEvent, ExportOptions, FieldStats, FilterEvent, GridOptions, LicenseInfo, LicenseType, PaginationOptions, PivotCell, PivotConfig as PivotConfigType, PivotField, PivotResult, PivotTableProps, PivotValueField, RowSelectionChangeEvent, SelectionBounds, SelectionChangeEvent, SortEvent, formatCellValue, getAggregationLabel, getColumnUniqueValues } from '@smallwebco/tinypivot-core';
4
4
  import * as react from 'react';
5
5
  import react__default from 'react';
@@ -15,7 +15,7 @@ import { SortingState, ColumnFiltersState, VisibilityState } from '@tanstack/rea
15
15
 
16
16
  interface AIAnalystProps {
17
17
  config: AIAnalystConfig;
18
- theme?: 'light' | 'dark';
18
+ theme?: ResolvedTheme;
19
19
  onDataLoaded?: (payload: AIDataLoadedEvent) => void;
20
20
  onConversationUpdate?: (payload: AIConversationUpdateEvent) => void;
21
21
  onQueryExecuted?: (payload: AIQueryExecutedEvent) => void;
@@ -68,7 +68,7 @@ interface DataGridProps {
68
68
  pageSize?: number;
69
69
  enableColumnResize?: boolean;
70
70
  enableClipboard?: boolean;
71
- theme?: 'light' | 'dark' | 'auto';
71
+ theme?: Theme;
72
72
  stripedRows?: boolean;
73
73
  exportFilename?: string;
74
74
  enableVerticalResize?: boolean;
@@ -135,8 +135,9 @@ interface PivotConfigProps {
135
135
  onAddCalculatedField?: (field: CalculatedField) => void;
136
136
  onRemoveCalculatedField?: (id: string) => void;
137
137
  onUpdateCalculatedField?: (field: CalculatedField) => void;
138
+ theme?: string;
138
139
  }
139
- declare function PivotConfig({ availableFields, rowFields, columnFields, valueFields, showRowTotals, calculatedFields, onShowRowTotalsChange, onShowColumnTotalsChange, onClearConfig, onAutoSuggest, onDragStart, onDragEnd, onUpdateAggregation, onRemoveRowField, onRemoveColumnField, onRemoveValueField, onAddRowField, onAddColumnField, onAddCalculatedField, onRemoveCalculatedField, onUpdateCalculatedField, }: PivotConfigProps): react_jsx_runtime.JSX.Element;
140
+ declare function PivotConfig({ availableFields, rowFields, columnFields, valueFields, showRowTotals, calculatedFields, onShowRowTotalsChange, onShowColumnTotalsChange, onClearConfig, onAutoSuggest, onDragStart, onDragEnd, onUpdateAggregation, onRemoveRowField, onRemoveColumnField, onRemoveValueField, onAddRowField, onAddColumnField, onAddCalculatedField, onRemoveCalculatedField, onUpdateCalculatedField, theme, }: PivotConfigProps): react_jsx_runtime.JSX.Element;
140
141
 
141
142
  interface ActiveFilter {
142
143
  column: string;
@@ -166,8 +167,9 @@ interface PivotSkeletonProps {
166
167
  onUpdateAggregation: (field: string, oldAgg: AggregationFunction, newAgg: AggregationFunction) => void;
167
168
  onReorderRowFields: (fields: string[]) => void;
168
169
  onReorderColumnFields: (fields: string[]) => void;
170
+ theme?: string;
169
171
  }
170
- declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
172
+ declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, theme, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
171
173
 
172
174
  interface UseAIAnalystOptions {
173
175
  config: AIAnalystConfig;
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  getDefaultDemoResponse,
15
15
  getDemoSchema,
16
16
  getInitialDemoData,
17
+ getLatestConversationData,
17
18
  getMessagesForAPI,
18
19
  setConversationDataSource,
19
20
  validateSQLSafety
@@ -55,14 +56,22 @@ function useAIAnalyst(options) {
55
56
  }
56
57
  }
57
58
  }, [storageKey]);
58
- const [conversation, setConversation] = useState(() => loadFromStorage());
59
+ const initialConversationRef = useRef(null);
60
+ if (!initialConversationRef.current) {
61
+ initialConversationRef.current = loadFromStorage();
62
+ }
63
+ const [conversation, setConversation] = useState(initialConversationRef.current);
59
64
  const [schemas, setSchemas] = useState(/* @__PURE__ */ new Map());
60
65
  const [allSchemas, setAllSchemas] = useState([]);
61
66
  const [isLoading, setIsLoading] = useState(false);
62
67
  const [error, setError] = useState(null);
63
- const [lastLoadedData, setLastLoadedData] = useState(null);
68
+ const [lastLoadedData, setLastLoadedData] = useState(
69
+ () => getLatestConversationData(initialConversationRef.current)
70
+ );
64
71
  const [discoveredDataSources, setDiscoveredDataSources] = useState([]);
65
72
  const [isLoadingTables, setIsLoadingTables] = useState(false);
73
+ const dataSourceLoadPromisesRef = useRef(/* @__PURE__ */ new Map());
74
+ const hydratedPersistedSelectionRef = useRef(false);
66
75
  const effectiveDataSources = useMemo(() => {
67
76
  if (config.dataSources && config.dataSources.length > 0) {
68
77
  return config.dataSources;
@@ -207,6 +216,59 @@ function useAIAnalyst(options) {
207
216
  console.warn("Failed to fetch sample data:", err);
208
217
  }
209
218
  }, [onDataLoaded]);
219
+ const loadDataSourceState = useCallback(async (dataSource) => {
220
+ const currentConfig = configRef.current;
221
+ if (currentConfig.dataSourceLoader) {
222
+ const { data, schema } = await currentConfig.dataSourceLoader(dataSource.id);
223
+ if (schema) {
224
+ setSchemas((prev) => new Map(prev).set(dataSource.id, schema));
225
+ }
226
+ if (data && data.length > 0) {
227
+ setLastLoadedData(data);
228
+ onDataLoaded?.({
229
+ data,
230
+ query: `SELECT * FROM ${dataSource.table} LIMIT 100`,
231
+ dataSourceId: dataSource.id,
232
+ rowCount: data.length
233
+ });
234
+ }
235
+ return;
236
+ }
237
+ if (currentConfig.demoMode) {
238
+ const demoSchema = getDemoSchema(dataSource.id);
239
+ if (demoSchema) {
240
+ setSchemas((prev) => new Map(prev).set(dataSource.id, demoSchema));
241
+ }
242
+ const initialData = getInitialDemoData(dataSource.id);
243
+ if (initialData) {
244
+ setLastLoadedData(initialData);
245
+ onDataLoaded?.({
246
+ data: initialData,
247
+ query: `SELECT * FROM ${dataSource.table} LIMIT 10`,
248
+ dataSourceId: dataSource.id,
249
+ rowCount: initialData.length
250
+ });
251
+ }
252
+ return;
253
+ }
254
+ if (currentConfig.endpoint) {
255
+ await fetchSchema(dataSource);
256
+ await fetchSampleData(dataSource);
257
+ }
258
+ }, [fetchSchema, fetchSampleData, onDataLoaded]);
259
+ const ensureDataSourceState = useCallback(async (dataSource) => {
260
+ const existingLoad = dataSourceLoadPromisesRef.current.get(dataSource.id);
261
+ if (existingLoad) {
262
+ return existingLoad;
263
+ }
264
+ const loadPromise = loadDataSourceState(dataSource).catch((err) => {
265
+ console.warn("Failed to load data source:", err);
266
+ }).finally(() => {
267
+ dataSourceLoadPromisesRef.current.delete(dataSource.id);
268
+ });
269
+ dataSourceLoadPromisesRef.current.set(dataSource.id, loadPromise);
270
+ return loadPromise;
271
+ }, [loadDataSourceState]);
210
272
  const selectDataSource = useCallback(async (dataSourceId) => {
211
273
  const dataSource = effectiveDataSources.find((ds) => ds.id === dataSourceId);
212
274
  if (!dataSource) {
@@ -226,44 +288,30 @@ What would you like to know about this data?`
226
288
  onConversationUpdate?.({ conversation: withMessage });
227
289
  return withMessage;
228
290
  });
229
- if (configRef.current.dataSourceLoader) {
230
- try {
231
- const { data, schema } = await configRef.current.dataSourceLoader(dataSourceId);
232
- if (schema) {
233
- setSchemas((prev) => new Map(prev).set(dataSourceId, schema));
234
- }
235
- if (data && data.length > 0) {
236
- setLastLoadedData(data);
237
- onDataLoaded?.({
238
- data,
239
- query: `SELECT * FROM ${dataSource.table} LIMIT 100`,
240
- dataSourceId,
241
- rowCount: data.length
242
- });
243
- }
244
- } catch (err) {
245
- console.warn("Failed to load data source:", err);
246
- }
247
- } else if (configRef.current.demoMode) {
248
- const demoSchema = getDemoSchema(dataSourceId);
249
- if (demoSchema) {
250
- setSchemas((prev) => new Map(prev).set(dataSourceId, demoSchema));
251
- }
252
- const initialData = getInitialDemoData(dataSourceId);
253
- if (initialData) {
254
- setLastLoadedData(initialData);
255
- onDataLoaded?.({
256
- data: initialData,
257
- query: `SELECT * FROM ${dataSource.table} LIMIT 10`,
258
- dataSourceId,
259
- rowCount: initialData.length
260
- });
261
- }
262
- } else if (configRef.current.endpoint) {
263
- await fetchSchema(dataSource);
264
- await fetchSampleData(dataSource);
291
+ await ensureDataSourceState(dataSource);
292
+ }, [effectiveDataSources, ensureDataSourceState, onConversationUpdate]);
293
+ useEffect(() => {
294
+ if (hydratedPersistedSelectionRef.current) {
295
+ return;
296
+ }
297
+ const initialConversation = initialConversationRef.current;
298
+ const initialDataSourceId = initialConversation?.dataSourceId;
299
+ if (!initialDataSourceId) {
300
+ hydratedPersistedSelectionRef.current = true;
301
+ return;
302
+ }
303
+ const dataSource = effectiveDataSources.find((ds) => ds.id === initialDataSourceId);
304
+ if (!dataSource) {
305
+ return;
306
+ }
307
+ const hasPersistedPreviewData = !!getLatestConversationData(initialConversation);
308
+ const hasSchema = schemas.has(initialDataSourceId);
309
+ const hasPreviewData = !!lastLoadedData?.length || hasPersistedPreviewData;
310
+ hydratedPersistedSelectionRef.current = true;
311
+ if (!hasSchema || !hasPreviewData) {
312
+ void ensureDataSourceState(dataSource);
265
313
  }
266
- }, [effectiveDataSources, fetchSchema, fetchSampleData, onConversationUpdate, onDataLoaded]);
314
+ }, [effectiveDataSources, ensureDataSourceState, lastLoadedData, schemas]);
267
315
  const callAIEndpoint = useCallback(async (userInput, currentConversation, currentSchemas, currentDataSources, currentAllSchemas) => {
268
316
  if (!configRef.current.endpoint) {
269
317
  throw new Error("No endpoint configured. Set `endpoint` in AI analyst config.");
@@ -666,6 +714,7 @@ What would you like to know about this data?`
666
714
  return null;
667
715
  }, [conversation.dataSourceId, effectiveDataSources, onError]);
668
716
  const clearConversation = useCallback(() => {
717
+ hydratedPersistedSelectionRef.current = true;
669
718
  const newConv = createConversation(configRef.current.sessionId);
670
719
  setConversation(newConv);
671
720
  setError(null);
@@ -676,7 +725,9 @@ What would you like to know about this data?`
676
725
  return { ...conversation };
677
726
  }, [conversation]);
678
727
  const importConversation = useCallback((conv) => {
728
+ hydratedPersistedSelectionRef.current = true;
679
729
  setConversation(conv);
730
+ setLastLoadedData(getLatestConversationData(conv));
680
731
  onConversationUpdate?.({ conversation: conv });
681
732
  }, [onConversationUpdate]);
682
733
  return {
@@ -738,6 +789,7 @@ var AIAnalyst = forwardRef(({
738
789
  onQueryExecuted,
739
790
  onError
740
791
  });
792
+ const isDarkTheme = theme === "dark" || typeof theme === "string" && theme.endsWith("-dark");
741
793
  useImperativeHandle(ref, () => ({
742
794
  loadFullData,
743
795
  selectedDataSource
@@ -899,7 +951,7 @@ var AIAnalyst = forwardRef(({
899
951
  return !!message.metadata?.data && message.metadata.data.length > 0;
900
952
  };
901
953
  if (!selectedDataSource) {
902
- return /* @__PURE__ */ jsx("div", { className: `vpg-ai-analyst ${theme === "dark" ? "vpg-theme-dark" : ""}`, children: /* @__PURE__ */ jsx("div", { className: "vpg-ai-picker-fullscreen", children: /* @__PURE__ */ jsxs("div", { className: "vpg-ai-picker-content", children: [
954
+ return /* @__PURE__ */ jsx("div", { className: `vpg-ai-analyst ${isDarkTheme ? "vpg-theme-dark" : ""}`, children: /* @__PURE__ */ jsx("div", { className: "vpg-ai-picker-fullscreen", children: /* @__PURE__ */ jsxs("div", { className: "vpg-ai-picker-content", children: [
903
955
  /* @__PURE__ */ jsxs("div", { className: "vpg-ai-picker-header", children: [
904
956
  /* @__PURE__ */ jsx("div", { className: "vpg-ai-icon-lg", children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
905
957
  /* @__PURE__ */ jsx("path", { d: "M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z" }),
@@ -971,7 +1023,7 @@ var AIAnalyst = forwardRef(({
971
1023
  ] })
972
1024
  ] }) }) });
973
1025
  }
974
- return /* @__PURE__ */ jsx("div", { className: `vpg-ai-analyst ${theme === "dark" ? "vpg-theme-dark" : ""}`, children: /* @__PURE__ */ jsxs("div", { className: "vpg-ai-split-layout", children: [
1026
+ return /* @__PURE__ */ jsx("div", { className: `vpg-ai-analyst ${isDarkTheme ? "vpg-theme-dark" : ""}`, children: /* @__PURE__ */ jsxs("div", { className: "vpg-ai-split-layout", children: [
975
1027
  /* @__PURE__ */ jsxs("div", { className: "vpg-ai-chat-panel", children: [
976
1028
  /* @__PURE__ */ jsxs("div", { className: "vpg-ai-chat-header", children: [
977
1029
  /* @__PURE__ */ jsx(
@@ -1713,7 +1765,7 @@ function ChartBuilder({
1713
1765
  return val.toFixed(dec);
1714
1766
  }, []);
1715
1767
  const chartOptions = useMemo4(() => {
1716
- const isDark = theme === "dark";
1768
+ const isDark = theme === "dark" || typeof theme === "string" && theme.endsWith("-dark");
1717
1769
  const config = chartConfig;
1718
1770
  const options = config.options || {};
1719
1771
  const baseOptions = {
@@ -3835,7 +3887,8 @@ function PivotConfig({
3835
3887
  onAddColumnField,
3836
3888
  onAddCalculatedField,
3837
3889
  onRemoveCalculatedField,
3838
- onUpdateCalculatedField
3890
+ onUpdateCalculatedField,
3891
+ theme
3839
3892
  }) {
3840
3893
  const [fieldSearch, setFieldSearch] = useState12("");
3841
3894
  const [showCalcModal, setShowCalcModal] = useState12(false);
@@ -3961,7 +4014,7 @@ function PivotConfig({
3961
4014
  setShowCalcModal(false);
3962
4015
  setEditingCalcField(null);
3963
4016
  }, []);
3964
- return /* @__PURE__ */ jsxs7("div", { className: "vpg-pivot-config", children: [
4017
+ return /* @__PURE__ */ jsxs7("div", { className: `vpg-pivot-config ${theme ? `vpg-theme-${theme}` : ""}`, children: [
3965
4018
  /* @__PURE__ */ jsxs7("div", { className: "vpg-config-header", children: [
3966
4019
  /* @__PURE__ */ jsxs7("h3", { className: "vpg-config-title", children: [
3967
4020
  /* @__PURE__ */ jsx7("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx7(
@@ -4229,7 +4282,8 @@ function PivotSkeleton({
4229
4282
  onAddValueField,
4230
4283
  onRemoveValueField,
4231
4284
  onReorderRowFields,
4232
- onReorderColumnFields
4285
+ onReorderColumnFields,
4286
+ theme
4233
4287
  }) {
4234
4288
  const { showWatermark, canUsePivot, isDemo } = useLicense();
4235
4289
  const getValueFieldDisplayName = useCallback13((field) => {
@@ -4595,7 +4649,7 @@ function PivotSkeleton({
4595
4649
  return /* @__PURE__ */ jsxs8(
4596
4650
  "div",
4597
4651
  {
4598
- className: `vpg-pivot-skeleton vpg-font-${currentFontSize} ${draggingField ? "vpg-is-dragging" : ""}`,
4652
+ className: `vpg-pivot-skeleton vpg-font-${currentFontSize} ${theme ? `vpg-theme-${theme}` : ""} ${draggingField ? "vpg-is-dragging" : ""}`,
4599
4653
  children: [
4600
4654
  showCopyToast && /* @__PURE__ */ jsxs8("div", { className: "vpg-toast", children: [
4601
4655
  /* @__PURE__ */ jsx8("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx8("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
@@ -4716,9 +4770,8 @@ function PivotSkeleton({
4716
4770
  d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
4717
4771
  }
4718
4772
  ) }),
4719
- /* @__PURE__ */ jsx8("h3", { children: "Pro Feature" }),
4720
- /* @__PURE__ */ jsx8("p", { children: "Pivot Table functionality requires a Pro license." }),
4721
- /* @__PURE__ */ jsx8("a", { href: "https://tiny-pivot.com/#pricing", target: "_blank", rel: "noopener noreferrer", className: "vpg-pro-link", children: "Get Pro License \u2192" })
4773
+ /* @__PURE__ */ jsx8("h3", { children: "Pivot Unavailable" }),
4774
+ /* @__PURE__ */ jsx8("p", { children: "Pivot mode could not be enabled in this session. Try reloading the page." })
4722
4775
  ] }) }) : /* @__PURE__ */ jsxs8(Fragment5, { children: [
4723
4776
  /* @__PURE__ */ jsxs8("div", { className: "vpg-config-bar", children: [
4724
4777
  /* @__PURE__ */ jsxs8(
@@ -6147,7 +6200,8 @@ function DataGrid({
6147
6200
  onRemoveValueField: removeValueField,
6148
6201
  onAddCalculatedField: addCalculatedField,
6149
6202
  onRemoveCalculatedField: removeCalculatedField,
6150
- onUpdateCalculatedField: addCalculatedField
6203
+ onUpdateCalculatedField: addCalculatedField,
6204
+ theme: currentTheme
6151
6205
  }
6152
6206
  ) }),
6153
6207
  /* @__PURE__ */ jsx9("div", { className: `vpg-pivot-main ${!showPivotConfig ? "vpg-full-width" : ""}`, children: /* @__PURE__ */ jsx9(
@@ -6172,7 +6226,8 @@ function DataGrid({
6172
6226
  onRemoveValueField: removeValueField,
6173
6227
  onUpdateAggregation: updateValueFieldAggregation,
6174
6228
  onReorderRowFields: setRowFields,
6175
- onReorderColumnFields: setColumnFields
6229
+ onReorderColumnFields: setColumnFields,
6230
+ theme: currentTheme
6176
6231
  }
6177
6232
  ) })
6178
6233
  ] }),