@analytix/dashboard 0.2.2 → 0.2.3

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.
@@ -13,6 +13,10 @@ export interface AnalyticsDashboardProps {
13
13
  defaultWidgets?: DashboardWidgetId[];
14
14
  /** PATCH endpoint to persist widget layout as site default. */
15
15
  settingsEndpoint?: string;
16
+ /** Called after widget layout is saved as site default. */
17
+ onWidgetsSaved?: () => void;
18
+ /** Called when saving widget layout fails. */
19
+ onWidgetsSaveError?: (message: string) => void;
16
20
  }
17
- export declare function AnalyticsDashboard({ siteId, summaryEndpoint, exportEndpoint, loadingFallback, defaultTheme, defaultWidgets, settingsEndpoint, }: AnalyticsDashboardProps): import("react").JSX.Element;
21
+ export declare function AnalyticsDashboard({ siteId, summaryEndpoint, exportEndpoint, loadingFallback, defaultTheme, defaultWidgets, settingsEndpoint, onWidgetsSaved, onWidgetsSaveError, }: AnalyticsDashboardProps): import("react").JSX.Element;
18
22
  export {};
@@ -47,7 +47,7 @@ function useResolvedTheme(mode) {
47
47
  }, [mode]);
48
48
  return resolved;
49
49
  }
50
- export function AnalyticsDashboard({ siteId, summaryEndpoint, exportEndpoint, loadingFallback, defaultTheme = "system", defaultWidgets = DEFAULT_DASHBOARD_WIDGETS, settingsEndpoint, }) {
50
+ export function AnalyticsDashboard({ siteId, summaryEndpoint, exportEndpoint, loadingFallback, defaultTheme = "system", defaultWidgets = DEFAULT_DASHBOARD_WIDGETS, settingsEndpoint, onWidgetsSaved, onWidgetsSaveError, }) {
51
51
  const summaryUrl = summaryEndpoint ?? `/api/v1/sites/${siteId}/summary`;
52
52
  const exportUrl = exportEndpoint ?? `/api/v1/sites/${siteId}/export`;
53
53
  const [range, setRange] = useState("7d");
@@ -68,6 +68,7 @@ export function AnalyticsDashboard({ siteId, summaryEndpoint, exportEndpoint, lo
68
68
  const hasLoadedRef = useRef(false);
69
69
  const [showWidgetCustomize, setShowWidgetCustomize] = useState(false);
70
70
  const [savingDefaultWidgets, setSavingDefaultWidgets] = useState(false);
71
+ const [retryNonce, setRetryNonce] = useState(0);
71
72
  const { widgets, toggleWidget, resetToDefault, isVisible } = useDashboardWidgets(siteId, defaultWidgets);
72
73
  const filterParams = useMemo(() => {
73
74
  const params = new URLSearchParams({
@@ -119,7 +120,7 @@ export function AnalyticsDashboard({ siteId, summaryEndpoint, exportEndpoint, lo
119
120
  setRefreshing(true);
120
121
  }
121
122
  setError("");
122
- fetch(`${summaryUrl}?${filterParams.toString()}`)
123
+ fetch(`${summaryUrl}?${filterParams.toString()}`, { credentials: "same-origin" })
123
124
  .then(async (res) => {
124
125
  if (!res.ok) {
125
126
  const payload = await res.json().catch(() => ({}));
@@ -146,7 +147,7 @@ export function AnalyticsDashboard({ siteId, summaryEndpoint, exportEndpoint, lo
146
147
  return () => {
147
148
  cancelled = true;
148
149
  };
149
- }, [summaryUrl, filterParams]);
150
+ }, [summaryUrl, filterParams, retryNonce]);
150
151
  const chartData = useMemo(() => (summary?.buckets ?? []).map((bucket) => ({
151
152
  label: formatBucketLabel(bucket.bucket_start, granularity),
152
153
  views: bucket.page_views,
@@ -157,7 +158,10 @@ export function AnalyticsDashboard({ siteId, summaryEndpoint, exportEndpoint, lo
157
158
  return (_jsx("div", { className: `analytix-dash ${themeClass}`, children: loadingFallback ?? _jsx(AnalyticsDashboardSkeleton, {}) }));
158
159
  }
159
160
  if (error) {
160
- return (_jsx("div", { className: `analytix-dash ${themeClass}`, children: _jsx("p", { className: "error", children: error }) }));
161
+ return (_jsxs("div", { className: `analytix-dash ${themeClass}`, children: [_jsx("p", { className: "error", children: error }), _jsx("button", { type: "button", className: "btnSecondary", style: { marginTop: 12 }, onClick: () => {
162
+ setError("");
163
+ setRetryNonce((n) => n + 1);
164
+ }, children: "Retry" })] }));
161
165
  }
162
166
  if (!summary) {
163
167
  return (_jsx("div", { className: `analytix-dash ${themeClass}`, children: _jsx("p", { className: "emptyState", children: "No analytics data yet." }) }));
@@ -172,11 +176,21 @@ export function AnalyticsDashboard({ siteId, summaryEndpoint, exportEndpoint, lo
172
176
  return;
173
177
  setSavingDefaultWidgets(true);
174
178
  try {
175
- await fetch(settingsEndpoint, {
179
+ const res = await fetch(settingsEndpoint, {
176
180
  method: "PATCH",
177
181
  headers: { "Content-Type": "application/json" },
178
182
  body: JSON.stringify({ analytics_config: { dashboard_widgets: widgets } }),
179
183
  });
184
+ if (!res.ok) {
185
+ const payload = await res.json().catch(() => ({}));
186
+ const message = typeof payload.error === "string" ? payload.error : "Failed to save widget layout";
187
+ onWidgetsSaveError?.(message);
188
+ return;
189
+ }
190
+ onWidgetsSaved?.();
191
+ }
192
+ catch {
193
+ onWidgetsSaveError?.("Failed to save widget layout");
180
194
  }
181
195
  finally {
182
196
  setSavingDefaultWidgets(false);
@@ -187,12 +201,12 @@ export function AnalyticsDashboard({ siteId, summaryEndpoint, exportEndpoint, lo
187
201
  : "dark"), "aria-label": "Toggle theme", children: resolvedTheme === "dark" ? _jsx(Sun, { size: 16 }) : _jsx(Moon, { size: 16 }) }), _jsxs("a", { className: "btn", href: `${exportUrl}?${filterParams.toString()}`, children: [_jsx(Download, { size: 14 }), "Export CSV"] })] })] }), showWidgetCustomize ? (_jsx(WidgetCustomizePanel, { widgets: widgets, onToggle: toggleWidget, onReset: resetToDefault, onSaveDefault: settingsEndpoint ? saveDefaultWidgets : undefined, savingDefault: savingDefaultWidgets })) : null, _jsxs("div", { className: "filters", children: [_jsxs("div", { className: "filterGroup filterGroupWide", children: [_jsx("span", { className: "filterLabel", children: "Range" }), _jsxs("div", { className: "chips", children: [["24h", "7d", "30d", "90d"].map((key) => (_jsx("button", { type: "button", className: !useCustomRange && range === key ? "chipActive" : "chip", onClick: () => {
188
202
  setUseCustomRange(false);
189
203
  setRange(key);
190
- }, children: key }, key))), _jsx("button", { type: "button", className: useCustomRange ? "chipActive" : "chip", onClick: () => setUseCustomRange(true), children: "Custom" })] }), useCustomRange && (_jsxs("div", { className: "dateRangeRow", children: [_jsxs("label", { children: [_jsx("span", { className: "filterLabel", children: "From" }), _jsx("input", { type: "date", value: customFrom, max: customTo, onChange: (e) => setCustomFrom(e.target.value) })] }), _jsxs("label", { children: [_jsx("span", { className: "filterLabel", children: "To" }), _jsx("input", { type: "date", value: customTo, min: customFrom, max: toDateInputValue(new Date()), onChange: (e) => setCustomTo(e.target.value) })] })] }))] }), _jsxs("div", { className: "filterGroup", children: [_jsx("span", { className: "filterLabel", children: "Granularity" }), _jsx("div", { className: "chips", children: ["hour", "day"].map((key) => (_jsx("button", { type: "button", className: granularity === key ? "chipActive" : "chip", onClick: () => setGranularity(key), children: key }, key))) })] }), _jsxs("div", { className: "filterGroup", children: [_jsx("span", { className: "filterLabel", children: "Scope" }), _jsx("div", { className: "chips", children: ["all", "page", "blog"].map((key) => (_jsx("button", { type: "button", className: trafficScope === key ? "chipActive" : "chip", onClick: () => setTrafficScope(key), children: key }, key))) })] }), trafficScope === "page" && (_jsxs("div", { className: "filterGroup filterGroupWide textField", children: [_jsx("span", { className: "filterLabel", children: "Path" }), _jsx("input", { value: path, onChange: (e) => setPath(e.target.value), placeholder: "/pricing" }), path.trim() === "/blog" && (_jsxs("label", { className: "checkboxRow", children: [_jsx("input", { type: "checkbox", checked: includeBlogArticles, onChange: (e) => setIncludeBlogArticles(e.target.checked) }), "Include blog articles"] }))] })), trafficScope === "blog" && (_jsxs("div", { className: "filterGroup filterGroupWide textField", children: [_jsx("span", { className: "filterLabel", children: "Content ID (optional)" }), _jsx("input", { value: contentId, onChange: (e) => setContentId(e.target.value), placeholder: "Filter to a single article" })] }))] }), isVisible("metrics") ? (_jsxs("div", { className: "metrics", children: [_jsxs("div", { className: "metricCard", children: [_jsx(Eye, { size: 18 }), _jsx("span", { className: "metricValue", children: formatNumber(summary.total_page_views) }), _jsx("span", { className: "metricLabel", children: "Page views" }), _jsx(Delta, { current: summary.total_page_views, previous: prev?.total_page_views })] }), _jsxs("div", { className: "metricCard", children: [_jsx(Users, { size: 18 }), _jsx("span", { className: "metricValue", children: formatNumber(summary.unique_visitors) }), _jsx("span", { className: "metricLabel", children: "Unique visitors" }), _jsx(Delta, { current: summary.unique_visitors, previous: prev?.unique_visitors })] }), _jsxs("div", { className: "metricCard", children: [_jsx(Repeat, { size: 18 }), _jsx("span", { className: "metricValue", children: formatNumber(summary.total_sessions) }), _jsx("span", { className: "metricLabel", children: "Sessions" }), _jsx(Delta, { current: summary.total_sessions, previous: prev?.total_sessions })] }), _jsxs("div", { className: "metricCard", children: [_jsx(FileText, { size: 18 }), _jsx("span", { className: "metricValue", children: summary.pages_per_session.toFixed(2) }), _jsx("span", { className: "metricLabel", children: "Pages / session" })] }), _jsxs("div", { className: "metricCard", children: [_jsx(UserPlus, { size: 18 }), _jsx("span", { className: "metricValue", children: formatNumber(summary.new_visitors) }), _jsx("span", { className: "metricLabel", children: "New visitors" })] }), _jsxs("div", { className: "metricCard", children: [_jsx(UserCheck, { size: 18 }), _jsx("span", { className: "metricValue", children: formatNumber(summary.returning_visitors) }), _jsx("span", { className: "metricLabel", children: "Returning visitors" })] }), _jsxs("div", { className: "metricCard", children: [_jsx(MousePointerClick, { size: 18 }), _jsxs("span", { className: "metricValue", children: [summary.bounce_rate, "%"] }), _jsx("span", { className: "metricLabel", children: "Bounce rate" }), _jsx(Delta, { current: summary.bounce_rate, previous: prev?.bounce_rate })] }), _jsxs("div", { className: "metricCard", children: [_jsx(Clock, { size: 18 }), _jsxs("span", { className: "metricValue", children: [summary.avg_engagement_seconds, "s"] }), _jsx("span", { className: "metricLabel", children: "Avg engagement" }), _jsx(Delta, { current: summary.avg_engagement_seconds, previous: prev?.avg_engagement_seconds })] })] })) : null, isVisible("chart") ? (_jsxs("div", { className: "chartPanel", children: [_jsx("div", { className: "panelTitle", children: "Traffic over time" }), _jsx("div", { className: "chartContainer", children: _jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ComposedChart, { data: chartData, children: [_jsx(CartesianGrid, { strokeDasharray: "3 3", stroke: gridStroke }), _jsx(XAxis, { dataKey: "label", tick: { fontSize: 12, fill: "var(--ax-muted)" } }), _jsx(YAxis, { tick: { fontSize: 12, fill: "var(--ax-muted)" } }), _jsx(Tooltip, { contentStyle: {
204
+ }, children: key }, key))), _jsx("button", { type: "button", className: useCustomRange ? "chipActive" : "chip", onClick: () => setUseCustomRange(true), children: "Custom" })] }), useCustomRange && (_jsxs("div", { className: "dateRangeRow", children: [_jsxs("label", { children: [_jsx("span", { className: "filterLabel", children: "From" }), _jsx("input", { type: "date", value: customFrom, max: customTo, onChange: (e) => setCustomFrom(e.target.value) })] }), _jsxs("label", { children: [_jsx("span", { className: "filterLabel", children: "To" }), _jsx("input", { type: "date", value: customTo, min: customFrom, max: toDateInputValue(new Date()), onChange: (e) => setCustomTo(e.target.value) })] })] }))] }), _jsxs("div", { className: "filterGroup", children: [_jsx("span", { className: "filterLabel", children: "Granularity" }), _jsx("div", { className: "chips", children: ["hour", "day"].map((key) => (_jsx("button", { type: "button", className: granularity === key ? "chipActive" : "chip", onClick: () => setGranularity(key), children: key }, key))) })] }), _jsxs("div", { className: "filterGroup", children: [_jsx("span", { className: "filterLabel", children: "Scope" }), _jsx("div", { className: "chips", children: ["all", "page", "blog"].map((key) => (_jsx("button", { type: "button", className: trafficScope === key ? "chipActive" : "chip", onClick: () => setTrafficScope(key), children: key }, key))) })] }), trafficScope === "page" && (_jsxs("div", { className: "filterGroup filterGroupWide textField", children: [_jsx("span", { className: "filterLabel", children: "Path" }), _jsx("input", { value: path, onChange: (e) => setPath(e.target.value), placeholder: "/pricing" }), path.trim() === "/blog" && (_jsxs("label", { className: "checkboxRow", children: [_jsx("input", { type: "checkbox", checked: includeBlogArticles, onChange: (e) => setIncludeBlogArticles(e.target.checked) }), "Include blog articles"] }))] })), trafficScope === "blog" && (_jsxs("div", { className: "filterGroup filterGroupWide textField", children: [_jsx("span", { className: "filterLabel", children: "Content ID (optional)" }), _jsx("input", { value: contentId, onChange: (e) => setContentId(e.target.value), placeholder: "Filter to a single article" })] }))] }), isVisible("metrics") ? (_jsxs("div", { className: "metrics", children: [_jsxs("div", { className: "metricCard", children: [_jsx(Eye, { size: 18 }), _jsx("span", { className: "metricValue", children: formatNumber(summary.total_page_views) }), _jsx("span", { className: "metricLabel", children: "Page views" }), _jsx(Delta, { current: summary.total_page_views, previous: prev?.total_page_views })] }), _jsxs("div", { className: "metricCard", children: [_jsx(Users, { size: 18 }), _jsx("span", { className: "metricValue", children: formatNumber(summary.unique_visitors) }), _jsx("span", { className: "metricLabel", children: "Unique visitors" }), _jsx(Delta, { current: summary.unique_visitors, previous: prev?.unique_visitors })] }), _jsxs("div", { className: "metricCard", children: [_jsx(Repeat, { size: 18 }), _jsx("span", { className: "metricValue", children: formatNumber(summary.total_sessions) }), _jsx("span", { className: "metricLabel", children: "Sessions" }), _jsx(Delta, { current: summary.total_sessions, previous: prev?.total_sessions })] }), _jsxs("div", { className: "metricCard", children: [_jsx(FileText, { size: 18 }), _jsx("span", { className: "metricValue", children: summary.pages_per_session.toFixed(2) }), _jsx("span", { className: "metricLabel", children: "Pages / session" })] }), _jsxs("div", { className: "metricCard", children: [_jsx(UserPlus, { size: 18 }), _jsx("span", { className: "metricValue", children: formatNumber(summary.new_visitors) }), _jsx("span", { className: "metricLabel", children: "New visitors" })] }), _jsxs("div", { className: "metricCard", children: [_jsx(UserCheck, { size: 18 }), _jsx("span", { className: "metricValue", children: formatNumber(summary.returning_visitors) }), _jsx("span", { className: "metricLabel", children: "Returning visitors" })] }), _jsxs("div", { className: "metricCard", children: [_jsx(MousePointerClick, { size: 18 }), _jsxs("span", { className: "metricValue", children: [summary.bounce_rate, "%"] }), _jsx("span", { className: "metricLabel", children: "Bounce rate" }), _jsx(Delta, { current: summary.bounce_rate, previous: prev?.bounce_rate })] }), _jsxs("div", { className: "metricCard", children: [_jsx(Clock, { size: 18 }), _jsxs("span", { className: "metricValue", children: [summary.avg_engagement_seconds, "s"] }), _jsx("span", { className: "metricLabel", children: "Avg engagement" }), _jsx(Delta, { current: summary.avg_engagement_seconds, previous: prev?.avg_engagement_seconds })] })] })) : null, isVisible("chart") ? (_jsxs("div", { className: "chartPanel", children: [_jsx("div", { className: "panelTitle", children: "Traffic over time" }), _jsx("div", { className: "chartContainer", children: chartData.length === 0 ? (_jsx("p", { className: "emptyState", children: "No traffic recorded for this period." })) : (_jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ComposedChart, { data: chartData, children: [_jsx(CartesianGrid, { strokeDasharray: "3 3", stroke: gridStroke }), _jsx(XAxis, { dataKey: "label", tick: { fontSize: 12, fill: "var(--ax-muted)" } }), _jsx(YAxis, { tick: { fontSize: 12, fill: "var(--ax-muted)" } }), _jsx(Tooltip, { contentStyle: {
191
205
  background: "var(--ax-surface)",
192
206
  border: "1px solid var(--ax-border)",
193
207
  borderRadius: 10,
194
208
  color: "var(--ax-primary)",
195
- } }), _jsx(Area, { type: "monotone", dataKey: "views", fill: areaFill, stroke: areaStroke, name: "Page views" }), _jsx(Line, { type: "monotone", dataKey: "uniques", stroke: lineStroke, name: "Uniques" })] }) }) })] })) : null, isVisible("top_paths") || isVisible("top_content") ? (_jsxs("div", { className: "splitPanels", children: [isVisible("top_paths") ? (_jsx(BreakdownPanel, { title: "Top paths", emptyMessage: "No path data for this period.", rows: summary.top_paths.map((row) => ({
209
+ } }), _jsx(Area, { type: "monotone", dataKey: "views", fill: areaFill, stroke: areaStroke, name: "Page views" }), _jsx(Line, { type: "monotone", dataKey: "uniques", stroke: lineStroke, name: "Uniques" })] }) })) })] })) : null, isVisible("top_paths") || isVisible("top_content") ? (_jsxs("div", { className: "splitPanels", children: [isVisible("top_paths") ? (_jsx(BreakdownPanel, { title: "Top paths", emptyMessage: "No path data for this period.", rows: summary.top_paths.map((row) => ({
196
210
  key: row.path,
197
211
  label: row.path,
198
212
  value: `${formatNumber(row.views)} views · ${formatNumber(row.uniques)} uniques`,
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@analytix/dashboard",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Analytix embeddable analytics dashboard UI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "files": [
9
- "dist"
9
+ "dist",
10
+ "src/dashboard.css"
10
11
  ],
11
12
  "exports": {
12
13
  ".": {
@@ -14,7 +15,7 @@
14
15
  "import": "./dist/index.js",
15
16
  "default": "./dist/index.js"
16
17
  },
17
- "./styles.css": "./dist/dashboard.css"
18
+ "./styles.css": "./src/dashboard.css"
18
19
  },
19
20
  "publishConfig": {
20
21
  "access": "public",
@@ -35,7 +36,7 @@
35
36
  "lucide-react": ">=0.400"
36
37
  },
37
38
  "dependencies": {
38
- "@analytix/core": "^0.2.2"
39
+ "@analytix/core": "^0.3.0"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@types/react": "^19",
@@ -0,0 +1,401 @@
1
+ .analytix-dash {
2
+ --ax-primary: #0f172a;
3
+ --ax-muted: #64748b;
4
+ --ax-accent: #0052ff;
5
+ --ax-surface: rgba(255, 255, 255, 0.72);
6
+ --ax-surface-solid: #ffffff;
7
+ --ax-border: rgba(15, 23, 42, 0.08);
8
+ --ax-success: #047857;
9
+ --ax-success-bg: rgba(5, 150, 105, 0.08);
10
+ --ax-danger: #dc2626;
11
+ --ax-up: #059669;
12
+ --ax-down: #dc2626;
13
+ --ax-chart-grid: rgba(15, 23, 42, 0.08);
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: 24px;
17
+ width: 100%;
18
+ color: var(--ax-primary);
19
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
20
+ }
21
+
22
+ .analytix-dash.analytix-theme-dark {
23
+ --ax-primary: #e2e8f0;
24
+ --ax-muted: #94a3b8;
25
+ --ax-accent: #60a5fa;
26
+ --ax-surface: rgba(15, 23, 42, 0.72);
27
+ --ax-surface-solid: #0f172a;
28
+ --ax-border: rgba(148, 163, 184, 0.18);
29
+ --ax-success: #34d399;
30
+ --ax-success-bg: rgba(52, 211, 153, 0.12);
31
+ --ax-up: #34d399;
32
+ --ax-down: #f87171;
33
+ --ax-chart-grid: rgba(148, 163, 184, 0.15);
34
+ }
35
+
36
+ .analytix-dash.analytix-refreshing {
37
+ opacity: 0.72;
38
+ pointer-events: none;
39
+ transition: opacity 0.15s ease;
40
+ }
41
+
42
+ .analytix-dash .filters {
43
+ display: grid;
44
+ grid-template-columns: repeat(2, minmax(0, 1fr));
45
+ gap: 14px;
46
+ padding: 18px;
47
+ border: 1px solid var(--ax-border);
48
+ border-radius: 14px;
49
+ background: var(--ax-surface);
50
+ }
51
+
52
+ .analytix-dash .filterGroup {
53
+ display: flex;
54
+ flex-direction: column;
55
+ gap: 8px;
56
+ }
57
+
58
+ .analytix-dash .filterGroupWide {
59
+ grid-column: 1 / -1;
60
+ }
61
+
62
+ .analytix-dash .filterLabel {
63
+ font-size: 0.75rem;
64
+ font-weight: 600;
65
+ letter-spacing: 0.04em;
66
+ text-transform: uppercase;
67
+ color: var(--ax-muted);
68
+ }
69
+
70
+ .analytix-dash .chips {
71
+ display: flex;
72
+ flex-wrap: wrap;
73
+ gap: 6px;
74
+ }
75
+
76
+ .analytix-dash .chip,
77
+ .analytix-dash .chipActive {
78
+ padding: 7px 12px;
79
+ border-radius: 999px;
80
+ border: 1px solid var(--ax-border);
81
+ background: var(--ax-surface-solid);
82
+ font-size: 0.8125rem;
83
+ font-weight: 600;
84
+ cursor: pointer;
85
+ color: var(--ax-muted);
86
+ }
87
+
88
+ .analytix-dash .chipActive {
89
+ background: rgba(0, 82, 255, 0.08);
90
+ border-color: rgba(0, 82, 255, 0.18);
91
+ color: var(--ax-accent);
92
+ }
93
+
94
+ .analytix-dash.analytix-theme-dark .chipActive {
95
+ background: rgba(96, 165, 250, 0.14);
96
+ border-color: rgba(96, 165, 250, 0.28);
97
+ }
98
+
99
+ .analytix-dash .dateRangeRow {
100
+ display: flex;
101
+ flex-wrap: wrap;
102
+ gap: 12px;
103
+ margin-top: 4px;
104
+ }
105
+
106
+ .analytix-dash .dateRangeRow label {
107
+ display: flex;
108
+ flex-direction: column;
109
+ gap: 6px;
110
+ }
111
+
112
+ .analytix-dash .textField input,
113
+ .analytix-dash .dateRangeRow input,
114
+ .analytix-dash select {
115
+ font: inherit;
116
+ padding: 10px 12px;
117
+ border: 1px solid var(--ax-border);
118
+ border-radius: 10px;
119
+ background: var(--ax-surface-solid);
120
+ color: var(--ax-primary);
121
+ }
122
+
123
+ .analytix-dash .checkboxRow {
124
+ display: flex;
125
+ align-items: center;
126
+ gap: 8px;
127
+ font-size: 0.875rem;
128
+ color: var(--ax-muted);
129
+ }
130
+
131
+ .analytix-dash .metrics {
132
+ display: grid;
133
+ grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
134
+ gap: 14px;
135
+ }
136
+
137
+ .analytix-dash .metricCard {
138
+ display: flex;
139
+ flex-direction: column;
140
+ gap: 8px;
141
+ padding: 18px;
142
+ border-radius: 14px;
143
+ border: 1px solid var(--ax-border);
144
+ background: var(--ax-surface);
145
+ color: var(--ax-accent);
146
+ min-width: 0;
147
+ }
148
+
149
+ .analytix-dash .metricValue {
150
+ font-size: 1.5rem;
151
+ font-weight: 600;
152
+ color: var(--ax-primary);
153
+ line-height: 1.2;
154
+ }
155
+
156
+ .analytix-dash .metricLabel {
157
+ font-size: 0.8125rem;
158
+ color: var(--ax-muted);
159
+ }
160
+
161
+ .analytix-dash .metricDelta {
162
+ font-size: 0.75rem;
163
+ color: var(--ax-muted);
164
+ }
165
+
166
+ .analytix-dash .metricDeltaUp {
167
+ color: var(--ax-up);
168
+ }
169
+
170
+ .analytix-dash .metricDeltaDown {
171
+ color: var(--ax-down);
172
+ }
173
+
174
+ .analytix-dash .chartPanel {
175
+ padding: 18px;
176
+ border-radius: 14px;
177
+ border: 1px solid var(--ax-border);
178
+ background: var(--ax-surface);
179
+ min-width: 0;
180
+ }
181
+
182
+ .analytix-dash .chartContainer {
183
+ width: 100%;
184
+ height: 280px;
185
+ min-height: 280px;
186
+ }
187
+
188
+ .analytix-dash .panelTitle {
189
+ font-size: 0.875rem;
190
+ font-weight: 700;
191
+ text-transform: uppercase;
192
+ color: var(--ax-muted);
193
+ margin-bottom: 14px;
194
+ }
195
+
196
+ .analytix-dash .splitPanels {
197
+ display: grid;
198
+ grid-template-columns: repeat(2, minmax(0, 1fr));
199
+ gap: 14px;
200
+ }
201
+
202
+ .analytix-dash .list {
203
+ list-style: none;
204
+ margin: 0;
205
+ padding: 0;
206
+ display: flex;
207
+ flex-direction: column;
208
+ gap: 8px;
209
+ }
210
+
211
+ .analytix-dash .list li {
212
+ display: flex;
213
+ justify-content: space-between;
214
+ gap: 12px;
215
+ font-size: 0.875rem;
216
+ }
217
+
218
+ .analytix-dash .listLabel {
219
+ min-width: 0;
220
+ overflow: hidden;
221
+ text-overflow: ellipsis;
222
+ white-space: nowrap;
223
+ }
224
+
225
+ .analytix-dash .listValue {
226
+ flex-shrink: 0;
227
+ color: var(--ax-muted);
228
+ font-variant-numeric: tabular-nums;
229
+ }
230
+
231
+ .analytix-dash .emptyState {
232
+ margin: 0;
233
+ font-size: 0.875rem;
234
+ color: var(--ax-muted);
235
+ }
236
+
237
+ .analytix-dash .error {
238
+ color: var(--ax-danger);
239
+ }
240
+
241
+ .analytix-dash .toolbar {
242
+ display: flex;
243
+ gap: 12px;
244
+ flex-wrap: wrap;
245
+ align-items: center;
246
+ justify-content: space-between;
247
+ }
248
+
249
+ .analytix-dash .toolbarActions {
250
+ display: flex;
251
+ gap: 8px;
252
+ align-items: center;
253
+ }
254
+
255
+ .analytix-dash .btn {
256
+ display: inline-flex;
257
+ align-items: center;
258
+ gap: 6px;
259
+ padding: 8px 14px;
260
+ border-radius: 8px;
261
+ border: 1px solid var(--ax-border);
262
+ background: var(--ax-surface-solid);
263
+ cursor: pointer;
264
+ font-size: 0.875rem;
265
+ font-weight: 600;
266
+ color: var(--ax-primary);
267
+ text-decoration: none;
268
+ }
269
+
270
+ .analytix-dash .btnIcon {
271
+ padding: 8px 10px;
272
+ }
273
+
274
+ .analytix-dash .realtime {
275
+ padding: 10px 14px;
276
+ border-radius: 10px;
277
+ background: var(--ax-success-bg);
278
+ color: var(--ax-success);
279
+ font-size: 0.875rem;
280
+ font-weight: 600;
281
+ }
282
+
283
+ /* Skeleton */
284
+ .analytix-dash.analytix-skeleton .sk {
285
+ border-radius: 8px;
286
+ background: linear-gradient(
287
+ 90deg,
288
+ rgba(148, 163, 184, 0.12) 0%,
289
+ rgba(148, 163, 184, 0.22) 50%,
290
+ rgba(148, 163, 184, 0.12) 100%
291
+ );
292
+ background-size: 200% 100%;
293
+ animation: analytix-shimmer 1.4s ease-in-out infinite;
294
+ }
295
+
296
+ .analytix-dash.analytix-skeleton .skRow {
297
+ display: flex;
298
+ gap: 6px;
299
+ flex-wrap: wrap;
300
+ }
301
+
302
+ .analytix-dash.analytix-skeleton .skRealtime {
303
+ width: 260px;
304
+ height: 40px;
305
+ }
306
+
307
+ .analytix-dash.analytix-skeleton .skBtn {
308
+ width: 120px;
309
+ height: 36px;
310
+ }
311
+
312
+ .analytix-dash.analytix-skeleton .skLabel {
313
+ width: 72px;
314
+ height: 12px;
315
+ }
316
+
317
+ .analytix-dash.analytix-skeleton .skChip {
318
+ width: 48px;
319
+ height: 32px;
320
+ border-radius: 999px;
321
+ }
322
+
323
+ .analytix-dash.analytix-skeleton .skIcon {
324
+ width: 18px;
325
+ height: 18px;
326
+ }
327
+
328
+ .analytix-dash.analytix-skeleton .skMetricValue {
329
+ width: 72px;
330
+ height: 28px;
331
+ }
332
+
333
+ .analytix-dash.analytix-skeleton .skMetricLabel {
334
+ width: 96px;
335
+ height: 14px;
336
+ }
337
+
338
+ .analytix-dash.analytix-skeleton .skDelta {
339
+ width: 120px;
340
+ height: 12px;
341
+ }
342
+
343
+ .analytix-dash.analytix-skeleton .skPanelTitle {
344
+ width: 120px;
345
+ height: 14px;
346
+ margin-bottom: 14px;
347
+ }
348
+
349
+ .analytix-dash.analytix-skeleton .skChart {
350
+ width: 100%;
351
+ height: 280px;
352
+ border-radius: 12px;
353
+ }
354
+
355
+ .analytix-dash.analytix-skeleton .skList {
356
+ display: flex;
357
+ flex-direction: column;
358
+ gap: 8px;
359
+ }
360
+
361
+ .analytix-dash.analytix-skeleton .skListRow {
362
+ width: 100%;
363
+ height: 18px;
364
+ }
365
+
366
+ @keyframes analytix-shimmer {
367
+ 0% {
368
+ background-position: 200% 0;
369
+ }
370
+ 100% {
371
+ background-position: -200% 0;
372
+ }
373
+ }
374
+
375
+ @media (max-width: 900px) {
376
+ .analytix-dash .filters,
377
+ .analytix-dash .splitPanels {
378
+ grid-template-columns: 1fr;
379
+ }
380
+ }
381
+
382
+ .analytix-dash .widgetCustomize .widgetGrid {
383
+ display: grid;
384
+ grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
385
+ gap: 10px;
386
+ margin-bottom: 14px;
387
+ }
388
+
389
+ .analytix-dash .widgetToggle {
390
+ display: flex;
391
+ align-items: center;
392
+ gap: 8px;
393
+ font-size: 0.875rem;
394
+ color: var(--ax-muted);
395
+ }
396
+
397
+ .analytix-dash .widgetActions {
398
+ display: flex;
399
+ flex-wrap: wrap;
400
+ gap: 8px;
401
+ }