@fayz-ai/ui 0.10.2 → 0.11.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.
- package/dist/analytics/AnalyticsCard.d.ts.map +1 -1
- package/dist/analytics/AnalyticsControls.d.ts.map +1 -1
- package/dist/analytics/batch.d.ts +19 -0
- package/dist/analytics/batch.d.ts.map +1 -0
- package/dist/analytics/context.d.ts.map +1 -1
- package/dist/analytics/index.d.ts +2 -0
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/{chunk-I6CPKAOD.js → chunk-7BMXN7MP.js} +215 -99
- package/dist/chunk-7BMXN7MP.js.map +1 -0
- package/dist/{chunk-6V5MGYXH.js → chunk-JGJNRNQW.js} +142 -31
- package/dist/chunk-JGJNRNQW.js.map +1 -0
- package/dist/{chunk-H63TOSQ7.js → chunk-QSHA2Q27.js} +475 -134
- package/dist/chunk-QSHA2Q27.js.map +1 -0
- package/dist/{chunk-SEIY2F5F.js → chunk-XRDCYOND.js} +231 -41
- package/dist/chunk-XRDCYOND.js.map +1 -0
- package/dist/chunk-ZBQ772DU.js +17 -0
- package/dist/chunk-ZBQ772DU.js.map +1 -0
- package/dist/dashboard/ChartWidget.d.ts.map +1 -1
- package/dist/dashboard/KpiCard.d.ts.map +1 -1
- package/dist/dashboard/SidebarOnboarding.d.ts +16 -11
- package/dist/dashboard/SidebarOnboarding.d.ts.map +1 -1
- package/dist/dashboard/Sparkline.d.ts +13 -0
- package/dist/dashboard/Sparkline.d.ts.map +1 -0
- package/dist/dashboard/index.d.ts +1 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +234 -115
- package/dist/index.js.map +1 -1
- package/dist/layout/AppShell.d.ts +4 -1
- package/dist/layout/AppShell.d.ts.map +1 -1
- package/dist/layout/AppShellSkeleton.d.ts +23 -0
- package/dist/layout/AppShellSkeleton.d.ts.map +1 -0
- package/dist/layout/ModulePage.d.ts +5 -1
- package/dist/layout/ModulePage.d.ts.map +1 -1
- package/dist/layout/Sidebar.d.ts +19 -1
- package/dist/layout/Sidebar.d.ts.map +1 -1
- package/dist/layout/Topbar.d.ts +4 -1
- package/dist/layout/Topbar.d.ts.map +1 -1
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +2 -1
- package/dist/layout/page-trail.d.ts +23 -0
- package/dist/layout/page-trail.d.ts.map +1 -0
- package/dist/layout/rail-flyout.d.ts +39 -0
- package/dist/layout/rail-flyout.d.ts.map +1 -0
- package/dist/primitives/bulk-action-bar.d.ts +30 -0
- package/dist/primitives/bulk-action-bar.d.ts.map +1 -0
- package/dist/primitives/checkbox.d.ts +5 -0
- package/dist/primitives/checkbox.d.ts.map +1 -1
- package/dist/primitives/data-table.d.ts +11 -1
- package/dist/primitives/data-table.d.ts.map +1 -1
- package/dist/primitives/dropdown.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +4 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +2 -2
- package/dist/primitives/list-chrome.d.ts +20 -0
- package/dist/primitives/list-chrome.d.ts.map +1 -0
- package/dist/primitives/modal.d.ts.map +1 -1
- package/dist/primitives/phone-field.d.ts +19 -0
- package/dist/primitives/phone-field.d.ts.map +1 -0
- package/dist/primitives/search-select.d.ts +6 -1
- package/dist/primitives/search-select.d.ts.map +1 -1
- package/dist/primitives/thumbnail.d.ts +19 -0
- package/dist/primitives/thumbnail.d.ts.map +1 -0
- package/dist/styles.css +111 -1
- package/package.json +2 -2
- package/dist/chunk-6V5MGYXH.js.map +0 -1
- package/dist/chunk-H63TOSQ7.js.map +0 -1
- package/dist/chunk-I6CPKAOD.js.map +0 -1
- package/dist/chunk-SEIY2F5F.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsCard.d.ts","sourceRoot":"","sources":["../../src/analytics/AnalyticsCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,gBAAgB,EAAkC,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"AnalyticsCard.d.ts","sourceRoot":"","sources":["../../src/analytics/AnalyticsCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,gBAAgB,EAAkC,MAAM,eAAe,CAAA;AAyBrF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,gBAAgB,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AA0ID,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,kBAAkB,qBA4I9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsControls.d.ts","sourceRoot":"","sources":["../../src/analytics/AnalyticsControls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,kBAAkB,EAAyB,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"AnalyticsControls.d.ts","sourceRoot":"","sources":["../../src/analytics/AnalyticsControls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,kBAAkB,EAAyB,MAAM,eAAe,CAAA;AAqJ9E,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAC9B;AAED,wBAAgB,qBAAqB,CAAC,EAAE,OAAO,EAAE,EAAE,0BAA0B,4BAyG5E;AA2ED,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAA;IAC9B,sEAAsE;IACtE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,sDAAsD;IACtD,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,OAAY,EAAE,WAAkB,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,sBAAsB,qBAoEjH"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AnalyticsProvider } from '@fayz-ai/core';
|
|
2
|
+
/**
|
|
3
|
+
* How long a queued query waits for its neighbours before going out.
|
|
4
|
+
*
|
|
5
|
+
* Long enough to catch every card of one render, short enough that nobody
|
|
6
|
+
* perceives it — the request it joins takes two orders of magnitude longer.
|
|
7
|
+
*/
|
|
8
|
+
export declare const BATCH_WINDOW_MS = 16;
|
|
9
|
+
export interface BatchingProviderOptions {
|
|
10
|
+
/** Coalescing window. Exposed for tests; production uses the default. */
|
|
11
|
+
windowMs?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Part of every de-duplication key. The surface bumps it on ↻ so a refresh
|
|
14
|
+
* is not served the in-flight promise it is trying to replace.
|
|
15
|
+
*/
|
|
16
|
+
refreshToken?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function createBatchingProvider(provider: AnalyticsProvider, options?: BatchingProviderOptions): AnalyticsProvider;
|
|
19
|
+
//# sourceMappingURL=batch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../src/analytics/batch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACQ,iBAAiB,EACpC,MAAM,eAAe,CAAA;AAsBtB;;;;;GAKG;AACH,eAAO,MAAM,eAAe,KAAK,CAAA;AASjC,MAAM,WAAW,uBAAuB;IACtC,yEAAyE;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,GAAE,uBAA4B,GACpC,iBAAiB,CA2EnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/analytics/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EACV,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EACzE,gBAAgB,EAAE,kBAAkB,EACrC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAkD,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAA;AACnG,OAAO,EAAkE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/analytics/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EACV,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EACzE,gBAAgB,EAAE,kBAAkB,EACrC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAkD,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAA;AACnG,OAAO,EAAkE,KAAK,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAYjH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,KAAK,EAAE,mBAAmB,CAAA;IAC1B,MAAM,EAAE,oBAAoB,CAAA;IAC5B,SAAS,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAA;IACjD,YAAY,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAA;IACjD,UAAU,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK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B,CAAC,EACvC,QAAQ,EAAE,QAAQ,EAAE,aAA8B,EAAE,cAAkC,EACtF,eAAoB,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,GACtD,EAAE,6BAA6B,qBAoF/B;AAMD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAA;IAC9B,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,kEAAkE;IAClE,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;IAC9C,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,0DAA0D;IAC1D,aAAa,EAAE,OAAO,CAAA;IACtB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAgBD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,gBAAgB,EACtB,OAAO,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5E,sBAAsB,CA2ExB"}
|
|
@@ -6,6 +6,8 @@ export { AnalyticsGrid, collectFilters } from './AnalyticsGrid';
|
|
|
6
6
|
export type { AnalyticsGridProps } from './AnalyticsGrid';
|
|
7
7
|
export { AnalyticsControls, AnalyticsFilterPicker } from './AnalyticsControls';
|
|
8
8
|
export type { AnalyticsControlsProps, AnalyticsFilterPickerProps } from './AnalyticsControls';
|
|
9
|
+
export { createBatchingProvider, BATCH_WINDOW_MS } from './batch';
|
|
10
|
+
export type { BatchingProviderOptions } from './batch';
|
|
9
11
|
export { resolveRangePreset, comparisonRange, autoGrain, rangeLengthDays, toDayString, parseDay, } from './range';
|
|
10
12
|
export type { AnalyticsRangePreset } from './range';
|
|
11
13
|
export { num, resolveRatios, resolveRowRatios, deltaPercent, trendOf, errorMessage, isEngineMissing, formatAnalyticsValue, formatCompact, formatDuration, formatBucket, toBreakdown, toChartData, toSpark, vizMeasures, vizCategory, } from './derive';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analytics/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACxH,YAAY,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC9E,YAAY,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAC7F,OAAO,EACL,kBAAkB,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,GACvF,MAAM,SAAS,CAAA;AAChB,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AACnD,OAAO,EACL,GAAG,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAC1F,oBAAoB,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EACjE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,GAC5D,MAAM,UAAU,CAAA;AACjB,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analytics/index.ts"],"names":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ownItem, Card, CardHeader, CardTitle, CardDescription, CardContent, DataTable, Skeleton } from './chunk-
|
|
1
|
+
import { SegmentedControl, Dropdown, DropdownTrigger, DropdownContent, DropdownLabel, DropdownSeparator, DropdownCheckboxItem, DropdownItem, Card, CardHeader, CardTitle, CardDescription, CardContent, DataTable, Skeleton } from './chunk-JGJNRNQW.js';
|
|
2
|
+
import { useLayoutStore } from './chunk-ZBQ772DU.js';
|
|
2
3
|
import { cn, Button } from './chunk-OKZ6WQB3.js';
|
|
3
4
|
import { getLucideIcon } from './chunk-22EVFMS3.js';
|
|
4
5
|
import * as React from 'react';
|
|
5
|
-
import { SlidersHorizontal, RotateCcw, Check, Circle,
|
|
6
|
+
import { SlidersHorizontal, RotateCcw, Check, Circle, ArrowRight, TrendingUp, TrendingDown, EyeOff } from 'lucide-react';
|
|
6
7
|
import { hashRouterAdapter, useTranslation, usePluginRuntime, getDashboardWidgets, resolvePluginComponent } from '@fayz-ai/core';
|
|
7
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
9
|
|
|
@@ -168,8 +169,8 @@ function HoverHide({ id, onHide, children }) {
|
|
|
168
169
|
}
|
|
169
170
|
function toGridItems(laidOut, onHide) {
|
|
170
171
|
return laidOut.map(({ def, span }) => {
|
|
171
|
-
const
|
|
172
|
-
const node =
|
|
172
|
+
const Component2 = resolvePluginComponent(def);
|
|
173
|
+
const node = Component2 ? /* @__PURE__ */ jsx(Component2, { ...def.props ?? {} }) : null;
|
|
173
174
|
return { id: def.id, span, node: /* @__PURE__ */ jsx(HoverHide, { id: def.id, onHide, children: node }) };
|
|
174
175
|
});
|
|
175
176
|
}
|
|
@@ -272,6 +273,46 @@ function renderIcon(icon, className = "h-4 w-4") {
|
|
|
272
273
|
}
|
|
273
274
|
return React.createElement(icon, { className });
|
|
274
275
|
}
|
|
276
|
+
function Sparkline({
|
|
277
|
+
data,
|
|
278
|
+
color,
|
|
279
|
+
width = 96,
|
|
280
|
+
height = 32,
|
|
281
|
+
padding = 3,
|
|
282
|
+
className = "h-8 w-24 shrink-0 overflow-visible"
|
|
283
|
+
}) {
|
|
284
|
+
const gid = React.useId();
|
|
285
|
+
if (!data || data.length < 2) return null;
|
|
286
|
+
const min = Math.min(...data);
|
|
287
|
+
const max = Math.max(...data);
|
|
288
|
+
const span = max - min || 1;
|
|
289
|
+
const step = (width - padding * 2) / (data.length - 1);
|
|
290
|
+
const pts = data.map((d, i) => [
|
|
291
|
+
padding + i * step,
|
|
292
|
+
padding + (height - padding * 2) * (1 - (d - min) / span)
|
|
293
|
+
]);
|
|
294
|
+
const line = pts.map(([x, y], i) => `${i === 0 ? "M" : "L"}${x.toFixed(1)},${y.toFixed(1)}`).join(" ");
|
|
295
|
+
const area = `${line} L${pts[pts.length - 1][0].toFixed(1)},${height} L${pts[0][0].toFixed(1)},${height} Z`;
|
|
296
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: `0 0 ${width} ${height}`, className, preserveAspectRatio: "none", "aria-hidden": true, children: [
|
|
297
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gid, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
298
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.22" }),
|
|
299
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0" })
|
|
300
|
+
] }) }),
|
|
301
|
+
/* @__PURE__ */ jsx("path", { d: area, fill: `url(#${gid})` }),
|
|
302
|
+
/* @__PURE__ */ jsx(
|
|
303
|
+
"path",
|
|
304
|
+
{
|
|
305
|
+
d: line,
|
|
306
|
+
fill: "none",
|
|
307
|
+
stroke: color,
|
|
308
|
+
strokeWidth: "1.5",
|
|
309
|
+
strokeLinecap: "round",
|
|
310
|
+
strokeLinejoin: "round",
|
|
311
|
+
vectorEffect: "non-scaling-stroke"
|
|
312
|
+
}
|
|
313
|
+
)
|
|
314
|
+
] });
|
|
315
|
+
}
|
|
275
316
|
function formatKpiValue(value, format, currency) {
|
|
276
317
|
const locale = currency?.locale ?? "pt-BR";
|
|
277
318
|
switch (format) {
|
|
@@ -307,30 +348,6 @@ function trendColor(trend, invert) {
|
|
|
307
348
|
const good = invert ? trend === "down" : trend === "up";
|
|
308
349
|
return good ? "#10b981" : "#f43f5e";
|
|
309
350
|
}
|
|
310
|
-
function Sparkline({ data, color }) {
|
|
311
|
-
const gid = React.useId();
|
|
312
|
-
if (!data || data.length < 2) return null;
|
|
313
|
-
const W = 96, H = 32, P = 3;
|
|
314
|
-
const min = Math.min(...data);
|
|
315
|
-
const max = Math.max(...data);
|
|
316
|
-
const span = max - min || 1;
|
|
317
|
-
const step = (W - P * 2) / (data.length - 1);
|
|
318
|
-
const pts = data.map((d, i) => {
|
|
319
|
-
const x = P + i * step;
|
|
320
|
-
const y = P + (H - P * 2) * (1 - (d - min) / span);
|
|
321
|
-
return [x, y];
|
|
322
|
-
});
|
|
323
|
-
const line = pts.map(([x, y], i) => `${i === 0 ? "M" : "L"}${x.toFixed(1)},${y.toFixed(1)}`).join(" ");
|
|
324
|
-
const area = `${line} L${pts[pts.length - 1][0].toFixed(1)},${H} L${pts[0][0].toFixed(1)},${H} Z`;
|
|
325
|
-
return /* @__PURE__ */ jsxs("svg", { viewBox: `0 0 ${W} ${H}`, className: "h-8 w-24 shrink-0 overflow-visible", preserveAspectRatio: "none", "aria-hidden": true, children: [
|
|
326
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gid, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
327
|
-
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.22" }),
|
|
328
|
-
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0" })
|
|
329
|
-
] }) }),
|
|
330
|
-
/* @__PURE__ */ jsx("path", { d: area, fill: `url(#${gid})` }),
|
|
331
|
-
/* @__PURE__ */ jsx("path", { d: line, fill: "none", stroke: color, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" })
|
|
332
|
-
] });
|
|
333
|
-
}
|
|
334
351
|
function Gauge({ value, goal, color, children }) {
|
|
335
352
|
const pct = goal > 0 ? Math.min(1, Math.max(0, value / goal)) : 0;
|
|
336
353
|
const R = 40, CX = 50, CY = 46, SW = 9;
|
|
@@ -441,6 +458,26 @@ function KpiCard(props) {
|
|
|
441
458
|
);
|
|
442
459
|
}
|
|
443
460
|
var ChartWidgetInner = React.lazy(() => import('./ChartWidgetInner-GDE5PBTR.js'));
|
|
461
|
+
var ChartBoundary = class extends React.Component {
|
|
462
|
+
constructor() {
|
|
463
|
+
super(...arguments);
|
|
464
|
+
this.state = { error: null };
|
|
465
|
+
}
|
|
466
|
+
static getDerivedStateFromError(error) {
|
|
467
|
+
return { error };
|
|
468
|
+
}
|
|
469
|
+
render() {
|
|
470
|
+
if (!this.state.error) return this.props.children;
|
|
471
|
+
return /* @__PURE__ */ jsx(
|
|
472
|
+
"div",
|
|
473
|
+
{
|
|
474
|
+
className: "flex items-center justify-center px-3 text-center text-xs text-muted-foreground",
|
|
475
|
+
style: { height: this.props.height },
|
|
476
|
+
children: this.state.error.message || "Chart failed to render"
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
444
481
|
function ChartWidget({
|
|
445
482
|
type,
|
|
446
483
|
data,
|
|
@@ -460,7 +497,7 @@ function ChartWidget({
|
|
|
460
497
|
] }) : /* @__PURE__ */ jsx("span", {}),
|
|
461
498
|
headerAction
|
|
462
499
|
] }),
|
|
463
|
-
/* @__PURE__ */ jsx(CardContent, { className: "p-4 pt-2", children: /* @__PURE__ */ jsx(React.Suspense, { fallback: /* @__PURE__ */ jsx("div", { style: { height } }), children: /* @__PURE__ */ jsx(ChartWidgetInner, { type, data, series, categoryKey, height }) }) })
|
|
500
|
+
/* @__PURE__ */ jsx(CardContent, { className: "p-4 pt-2", children: /* @__PURE__ */ jsx(ChartBoundary, { height, children: /* @__PURE__ */ jsx(React.Suspense, { fallback: /* @__PURE__ */ jsx("div", { style: { height } }), children: /* @__PURE__ */ jsx(ChartWidgetInner, { type, data, series, categoryKey, height }) }) }) })
|
|
464
501
|
] });
|
|
465
502
|
}
|
|
466
503
|
function TableWidget({
|
|
@@ -602,89 +639,168 @@ function OnboardingWidget({
|
|
|
602
639
|
] });
|
|
603
640
|
}
|
|
604
641
|
var COUNT_LABEL = (done, total) => `${done} de ${total}`;
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
return window.localStorage.getItem(storageKey) === "1";
|
|
609
|
-
} catch {
|
|
610
|
-
return false;
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
const set = React.useCallback((next) => {
|
|
614
|
-
setCollapsed(next);
|
|
615
|
-
try {
|
|
616
|
-
window.localStorage.setItem(storageKey, next ? "1" : "0");
|
|
617
|
-
} catch {
|
|
618
|
-
}
|
|
619
|
-
}, [storageKey]);
|
|
620
|
-
return [collapsed, set];
|
|
621
|
-
}
|
|
642
|
+
var RING_SIZE = 30;
|
|
643
|
+
var RING_RADIUS = 12;
|
|
644
|
+
var RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS;
|
|
622
645
|
function SidebarOnboarding({
|
|
623
646
|
title = "Primeiros passos",
|
|
624
647
|
steps,
|
|
625
648
|
onNavigate,
|
|
626
649
|
hideWhenComplete = true,
|
|
627
|
-
storageKey = "fayz.sidebar-onboarding.collapsed",
|
|
628
650
|
className
|
|
629
651
|
}) {
|
|
630
652
|
const { completed, resolved, doneCount, allDone, nextStep, run } = useOnboardingProgress(steps, onNavigate);
|
|
631
|
-
const
|
|
653
|
+
const railCollapsed = useLayoutStore((s) => s.sidebarCollapsed);
|
|
654
|
+
const [open, setOpen] = React.useState(false);
|
|
655
|
+
const closeTimer = React.useRef(null);
|
|
656
|
+
const cancelClose = () => {
|
|
657
|
+
if (closeTimer.current) {
|
|
658
|
+
clearTimeout(closeTimer.current);
|
|
659
|
+
closeTimer.current = null;
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
const show = () => {
|
|
663
|
+
cancelClose();
|
|
664
|
+
setOpen(true);
|
|
665
|
+
};
|
|
666
|
+
const hide = () => {
|
|
667
|
+
cancelClose();
|
|
668
|
+
closeTimer.current = setTimeout(() => setOpen(false), 140);
|
|
669
|
+
};
|
|
670
|
+
React.useEffect(() => () => cancelClose(), []);
|
|
632
671
|
if (!resolved) {
|
|
633
|
-
return /* @__PURE__ */
|
|
634
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "h-3
|
|
635
|
-
/* @__PURE__ */ jsx(Skeleton, { className: "mt-2
|
|
672
|
+
return railCollapsed ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-1", "aria-busy": "true", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-8 rounded-full bg-sidebar-accent" }) }) : /* @__PURE__ */ jsxs("div", { className: cn("px-1 py-1.5", className), "aria-busy": "true", children: [
|
|
673
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-24 bg-sidebar-accent" }),
|
|
674
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "mt-2 h-1 w-full rounded-full bg-sidebar-accent" })
|
|
636
675
|
] });
|
|
637
676
|
}
|
|
638
677
|
if (allDone && hideWhenComplete) return null;
|
|
639
678
|
const pct = steps.length ? doneCount / steps.length * 100 : 0;
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
/* @__PURE__ */ jsx(
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
"button",
|
|
661
|
-
{
|
|
662
|
-
type: "button",
|
|
663
|
-
disabled: isDone || !step.action,
|
|
664
|
-
onClick: () => run(step.action),
|
|
665
|
-
className: cn(
|
|
666
|
-
"group flex w-full items-center gap-2 rounded-md px-1 py-1.5 text-left transition-colors",
|
|
667
|
-
!isDone && step.action && "hover:bg-muted/60",
|
|
668
|
-
isDone && "cursor-default"
|
|
679
|
+
const trigger = railCollapsed ? /* @__PURE__ */ jsx(
|
|
680
|
+
"button",
|
|
681
|
+
{
|
|
682
|
+
type: "button",
|
|
683
|
+
onClick: () => open ? hide() : show(),
|
|
684
|
+
title: `${title} \u2014 ${COUNT_LABEL(doneCount, steps.length)}`,
|
|
685
|
+
"aria-label": `${title} \u2014 ${COUNT_LABEL(doneCount, steps.length)}`,
|
|
686
|
+
className: "flex w-full items-center justify-center rounded-button p-1 text-sidebar-foreground/80 transition-colors hover:bg-sidebar-accent/60",
|
|
687
|
+
children: /* @__PURE__ */ jsxs("span", { className: "relative flex items-center justify-center", children: [
|
|
688
|
+
/* @__PURE__ */ jsxs("svg", { width: RING_SIZE, height: RING_SIZE, viewBox: `0 0 ${RING_SIZE} ${RING_SIZE}`, className: "-rotate-90", children: [
|
|
689
|
+
/* @__PURE__ */ jsx(
|
|
690
|
+
"circle",
|
|
691
|
+
{
|
|
692
|
+
cx: RING_SIZE / 2,
|
|
693
|
+
cy: RING_SIZE / 2,
|
|
694
|
+
r: RING_RADIUS,
|
|
695
|
+
fill: "none",
|
|
696
|
+
strokeWidth: "2.5",
|
|
697
|
+
className: "stroke-sidebar-border"
|
|
698
|
+
}
|
|
669
699
|
),
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
"
|
|
700
|
+
/* @__PURE__ */ jsx(
|
|
701
|
+
"circle",
|
|
702
|
+
{
|
|
703
|
+
cx: RING_SIZE / 2,
|
|
704
|
+
cy: RING_SIZE / 2,
|
|
705
|
+
r: RING_RADIUS,
|
|
706
|
+
fill: "none",
|
|
707
|
+
strokeWidth: "2.5",
|
|
708
|
+
strokeLinecap: "round",
|
|
709
|
+
strokeDasharray: RING_CIRCUMFERENCE,
|
|
710
|
+
strokeDashoffset: RING_CIRCUMFERENCE * (1 - pct / 100),
|
|
711
|
+
className: "stroke-current text-sidebar-foreground transition-[stroke-dashoffset] duration-300"
|
|
712
|
+
}
|
|
713
|
+
)
|
|
714
|
+
] }),
|
|
715
|
+
/* @__PURE__ */ jsxs("span", { className: "absolute text-[9px] font-semibold tabular-nums text-sidebar-foreground", children: [
|
|
716
|
+
doneCount,
|
|
717
|
+
"/",
|
|
718
|
+
steps.length
|
|
719
|
+
] })
|
|
720
|
+
] })
|
|
721
|
+
}
|
|
722
|
+
) : /* @__PURE__ */ jsxs(
|
|
723
|
+
"button",
|
|
724
|
+
{
|
|
725
|
+
type: "button",
|
|
726
|
+
onClick: () => open ? hide() : show(),
|
|
727
|
+
"aria-expanded": open,
|
|
728
|
+
className: cn(
|
|
729
|
+
"w-full rounded-button px-1.5 py-1.5 text-left transition-colors hover:bg-sidebar-accent/50",
|
|
730
|
+
className
|
|
731
|
+
),
|
|
732
|
+
children: [
|
|
733
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
734
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-[12px] font-medium text-sidebar-foreground/90", children: title }),
|
|
735
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-[11px] tabular-nums text-sidebar-muted", children: COUNT_LABEL(doneCount, steps.length) })
|
|
736
|
+
] }),
|
|
737
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1.5 block h-1 overflow-hidden rounded-full bg-sidebar-accent", children: /* @__PURE__ */ jsx(
|
|
738
|
+
"span",
|
|
739
|
+
{
|
|
740
|
+
className: "block h-full rounded-full bg-sidebar-foreground/70 transition-all",
|
|
741
|
+
style: { width: `${pct}%` }
|
|
742
|
+
}
|
|
743
|
+
) })
|
|
744
|
+
]
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative", onMouseEnter: show, onMouseLeave: hide, children: [
|
|
748
|
+
trigger,
|
|
749
|
+
/* @__PURE__ */ jsx(
|
|
750
|
+
"div",
|
|
751
|
+
{
|
|
752
|
+
onMouseEnter: cancelClose,
|
|
753
|
+
onMouseLeave: hide,
|
|
754
|
+
"aria-hidden": !open,
|
|
755
|
+
className: cn(
|
|
756
|
+
"absolute bottom-0 left-full z-50 ml-2 hidden w-64 md:block",
|
|
757
|
+
"motion-safe:transition-opacity motion-safe:duration-150",
|
|
758
|
+
open ? "opacity-100" : "pointer-events-none opacity-0"
|
|
759
|
+
),
|
|
760
|
+
children: /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-sidebar-border bg-sidebar p-2 text-sidebar-foreground shadow-xl shadow-black/25", children: [
|
|
761
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1 pb-1.5", children: [
|
|
762
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-[12.5px] font-semibold", children: title }),
|
|
763
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-[11px] tabular-nums text-sidebar-muted", children: COUNT_LABEL(doneCount, steps.length) })
|
|
764
|
+
] }),
|
|
765
|
+
/* @__PURE__ */ jsx("div", { className: "mx-1 h-1 overflow-hidden rounded-full bg-sidebar-accent", children: /* @__PURE__ */ jsx("div", { className: "h-full rounded-full bg-sidebar-foreground/70 transition-all", style: { width: `${pct}%` } }) }),
|
|
766
|
+
/* @__PURE__ */ jsx("ul", { className: "mt-1.5 space-y-0.5", children: steps.map((step) => {
|
|
767
|
+
const isDone = completed[step.id];
|
|
768
|
+
const isNext = !isDone && step.id === nextStep?.id;
|
|
769
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
770
|
+
"button",
|
|
678
771
|
{
|
|
679
|
-
"
|
|
680
|
-
|
|
681
|
-
|
|
772
|
+
type: "button",
|
|
773
|
+
disabled: isDone || !step.action,
|
|
774
|
+
onClick: () => {
|
|
775
|
+
setOpen(false);
|
|
776
|
+
run(step.action);
|
|
777
|
+
},
|
|
778
|
+
className: cn(
|
|
779
|
+
"group flex w-full items-center gap-2 rounded-md px-1.5 py-1.5 text-left transition-colors",
|
|
780
|
+
!isDone && step.action && "hover:bg-sidebar-accent/60",
|
|
781
|
+
isDone && "cursor-default"
|
|
782
|
+
),
|
|
783
|
+
children: [
|
|
784
|
+
isDone ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 shrink-0 rounded-full bg-sidebar-accent p-[1px] text-sidebar-muted" }) : /* @__PURE__ */ jsx(Circle, { className: "h-3.5 w-3.5 shrink-0 text-sidebar-muted" }),
|
|
785
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
786
|
+
"min-w-0 flex-1 text-[12.5px] leading-snug",
|
|
787
|
+
isDone ? "text-sidebar-muted line-through" : "text-sidebar-foreground"
|
|
788
|
+
), children: step.title }),
|
|
789
|
+
isNext && step.action && /* @__PURE__ */ jsx(
|
|
790
|
+
"span",
|
|
791
|
+
{
|
|
792
|
+
"aria-hidden": true,
|
|
793
|
+
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-md border border-sidebar-border text-sidebar-muted opacity-0 transition-opacity group-hover:opacity-100",
|
|
794
|
+
children: /* @__PURE__ */ jsx(ArrowRight, { className: "h-3 w-3" })
|
|
795
|
+
}
|
|
796
|
+
)
|
|
797
|
+
]
|
|
682
798
|
}
|
|
683
|
-
)
|
|
684
|
-
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
|
|
799
|
+
) }, step.id);
|
|
800
|
+
}) })
|
|
801
|
+
] })
|
|
802
|
+
}
|
|
803
|
+
)
|
|
688
804
|
] });
|
|
689
805
|
}
|
|
690
806
|
|
|
@@ -713,6 +829,6 @@ var defineTableWidget = (input) => build("table", 4, input);
|
|
|
713
829
|
var defineOnboardingWidget = (input) => build("onboarding", 2, input);
|
|
714
830
|
var defineCustomWidget = (input) => build("custom", 2, input);
|
|
715
831
|
|
|
716
|
-
export { ChartWidget, DEFAULT_RANGE_OPTIONS, DashboardCanvas, DashboardCustomizeMenu, DashboardGrid, DashboardNavigateProvider, DashboardRangeControl, DashboardRangeProvider, GoldCard, KpiCard, OnboardingWidget, SidebarOnboarding, TableWidget, WidgetGrid, defineChartWidget, defineCustomWidget, defineKpiWidget, defineOnboardingWidget, defineTableWidget, formatKpiValue, renderIcon, resolveDashboardLayout, useDashboardNavigate, useDashboardPreferences, useDashboardRange, useOnboardingProgress };
|
|
717
|
-
//# sourceMappingURL=chunk-
|
|
718
|
-
//# sourceMappingURL=chunk-
|
|
832
|
+
export { ChartWidget, DEFAULT_RANGE_OPTIONS, DashboardCanvas, DashboardCustomizeMenu, DashboardGrid, DashboardNavigateProvider, DashboardRangeControl, DashboardRangeProvider, GoldCard, KpiCard, OnboardingWidget, SidebarOnboarding, Sparkline, TableWidget, WidgetGrid, defineChartWidget, defineCustomWidget, defineKpiWidget, defineOnboardingWidget, defineTableWidget, formatKpiValue, renderIcon, resolveDashboardLayout, useDashboardNavigate, useDashboardPreferences, useDashboardRange, useOnboardingProgress };
|
|
833
|
+
//# sourceMappingURL=chunk-7BMXN7MP.js.map
|
|
834
|
+
//# sourceMappingURL=chunk-7BMXN7MP.js.map
|