@xenide-io/the-old-ui-theme 0.5.2 → 0.5.4

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 (59) hide show
  1. package/README.md +47 -34
  2. package/dist/{index-Od4pIP4F.d.mts → Chip-C5hRFAhe.d.mts} +10 -606
  3. package/dist/{index-Od4pIP4F.d.ts → Chip-C5hRFAhe.d.ts} +10 -606
  4. package/dist/{chunk-G53YLHVE.mjs → chunk-E5ZBQYEX.mjs} +59 -9
  5. package/dist/{chunk-RZXHZWUB.mjs → chunk-SBBKXV35.mjs} +174 -222
  6. package/dist/index.d.mts +4 -80
  7. package/dist/index.d.ts +4 -80
  8. package/dist/index.js +562 -3746
  9. package/dist/index.mjs +3 -765
  10. package/dist/suite.d.mts +56 -25
  11. package/dist/suite.d.ts +56 -25
  12. package/dist/suite.js +248 -107
  13. package/dist/suite.mjs +217 -105
  14. package/dist/ui.d.mts +608 -2
  15. package/dist/ui.d.ts +608 -2
  16. package/dist/ui.js +232 -230
  17. package/dist/ui.mjs +2 -2
  18. package/package.json +2 -6
  19. package/scripts/install-theme-dev.sh +60 -0
  20. package/scripts/sync-posthog-icons.mjs +75 -0
  21. package/src/app/globals.css +1 -0
  22. package/src/components/ui/Chip.tsx +36 -18
  23. package/src/components/ui/CommandPalette.test.tsx +41 -0
  24. package/src/components/ui/CommandPalette.tsx +58 -9
  25. package/src/components/ui/DropdownMenu.tsx +50 -11
  26. package/src/components/ui/SegmentedControl.tsx +2 -1
  27. package/src/components/ui/SettingsLayout.tsx +19 -5
  28. package/src/components/ui/ThemeSwitcher.tsx +12 -3
  29. package/src/components/ui/interaction-primitives.test.tsx +52 -0
  30. package/src/styles/suite-skin.css +53 -1
  31. package/src/styles/themes.css +445 -1656
  32. package/src/suite/components/app-switcher.tsx +32 -25
  33. package/src/suite/components/command-palette-host.tsx +20 -8
  34. package/src/suite/components/suite-app-layout.tsx +31 -10
  35. package/src/suite/components/suite-bottom-nav.tsx +23 -18
  36. package/src/suite/components/suite-layout.test.tsx +44 -0
  37. package/src/suite/components/suite-layout.tsx +3 -3
  38. package/src/suite/components/suite-mobile-drawer.tsx +12 -0
  39. package/src/suite/components/suite-mobile-header.tsx +15 -9
  40. package/src/suite/components/suite-notification-bell.tsx +23 -11
  41. package/src/suite/components/suite-settings-mobile-nav.tsx +2 -0
  42. package/src/suite/components/suite-sidebar.tsx +54 -43
  43. package/src/suite/components/suite-user-menu.tsx +54 -26
  44. package/src/suite/components/today-page-frame.tsx +1 -1
  45. package/src/suite/icons/app-accents.ts +38 -43
  46. package/src/suite/icons/glyph-parts.tsx +16 -9
  47. package/src/suite/icons/glyphs.ts +130 -99
  48. package/src/suite/lib/apps.ts +1 -1
  49. package/src/suite/lib/injected.ts +12 -11
  50. package/src/suite/lib/use-sidebar-width.ts +23 -8
  51. package/src/components/charts/index.ts +0 -9
  52. package/src/components/charts/quill/BarChart.tsx +0 -85
  53. package/src/components/charts/quill/FunnelChart.tsx +0 -49
  54. package/src/components/charts/quill/InsightShell.tsx +0 -27
  55. package/src/components/charts/quill/MetricCard.tsx +0 -44
  56. package/src/components/charts/quill/PieChart.tsx +0 -81
  57. package/src/components/charts/quill/Sparkline.tsx +0 -57
  58. package/src/components/charts/quill/TimeSeriesLineChart.tsx +0 -62
  59. package/src/components/charts/quill/index.ts +0 -9
package/dist/index.mjs CHANGED
@@ -2,45 +2,26 @@
2
2
  import {
3
3
  Accordion,
4
4
  Alert,
5
- AlertDialog,
6
- AppLayout,
7
5
  AuthCard,
8
6
  AuthDivider,
9
7
  AuthLayout,
10
- Autocomplete,
11
8
  Avatar,
12
9
  AvatarGroup,
13
10
  Badge,
14
- Banner,
15
- Breadcrumbs,
16
11
  Button,
17
- ButtonGroup,
18
12
  Calendar,
19
13
  Caption,
20
14
  Card,
21
- ChatBubble,
22
15
  Checkbox,
23
16
  Chip,
24
- CodeBlock,
25
- Collapsible,
26
- CollapsibleSection,
27
- Combobox,
28
17
  CommandPalette,
29
- ComponentDocs,
30
- ContextMenu,
31
18
  DEFAULT_THEME_ID,
32
- DataTable,
33
- DatePicker,
34
- Dialog,
35
19
  Display,
36
- Divider,
37
20
  Dot,
38
- Drawer,
39
21
  EmptyState,
40
22
  FileUpload,
41
23
  FilterBar,
42
24
  FilterChips,
43
- FilterControls,
44
25
  FilterMenu,
45
26
  FormField,
46
27
  H1,
@@ -48,75 +29,40 @@ import {
48
29
  H3,
49
30
  H4,
50
31
  H5,
51
- HoverCard,
52
- Indicator,
53
32
  Input,
54
- InputGroup,
55
- Kbd,
56
33
  Label,
57
34
  Lead,
58
- Lettermark,
59
35
  Link,
60
36
  Loader,
61
- LoadingBar,
62
37
  LoadingState,
63
- Menubar,
64
- Metric,
65
38
  Modal,
66
39
  Mono,
67
- NumberField,
68
40
  Overline,
69
41
  P,
70
- Pagination,
71
42
  Panel,
72
- Popover,
73
43
  Progress,
74
- ProgressCircle,
75
44
  Radio,
76
- Range,
77
- Rating,
78
- Resizable,
79
- Row,
80
- ScrollArea,
81
- SearchGroup,
82
45
  SearchInput,
83
46
  SegmentedControl,
84
47
  Select,
85
48
  SettingsLayout,
86
49
  SettingsNav,
87
- ShowcaseWrapper,
88
- Sidebar,
89
50
  Skeleton,
90
51
  Small,
91
- Snack,
92
52
  SortMenu,
93
53
  Spinner,
94
- Splotch,
95
54
  Stat,
96
- Stepper,
97
55
  THEMES,
98
56
  THEME_GROUPS,
99
57
  THEME_INIT_SCRIPT,
100
58
  Table,
101
- Tabs,
102
- Tag,
103
- Terminal,
104
59
  Textarea,
105
- ThemeDomSync,
106
- ThemeManager,
107
- ThemeSwitcher,
108
- Timeline,
109
- Toast,
110
- ToastStack,
111
60
  Toggle,
112
- ToggleButton,
113
- ToggleGroup,
114
- Widget,
115
61
  getTheme,
116
62
  isThemeId,
117
63
  persistTheme,
118
64
  readStoredTheme
119
- } from "./chunk-RZXHZWUB.mjs";
65
+ } from "./chunk-SBBKXV35.mjs";
120
66
  import {
121
67
  ButtonChrome,
122
68
  CANONICAL_ICONS,
@@ -208,698 +154,31 @@ import {
208
154
  PH_ICON_ALIASES,
209
155
  Tooltip,
210
156
  TooltipProvider,
211
- cn,
212
157
  createIconBase,
213
158
  createIconBasePath
214
- } from "./chunk-G53YLHVE.mjs";
215
- import {
216
- __spreadProps,
217
- __spreadValues
218
- } from "./chunk-FWCSY2DS.mjs";
219
-
220
- // src/components/charts/quill/TimeSeriesLineChart.tsx
221
- import { useMemo as useMemo2 } from "react";
222
-
223
- // src/lib/hog-charts-lite/CanvasTrendLineChart.tsx
224
- import { scaleLinear, scalePoint } from "d3-scale";
225
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
226
- import { jsx, jsxs } from "react/jsx-runtime";
227
- var HOG_LITE_DEFAULT_MARGINS = { top: 16, right: 16, bottom: 32, left: 48 };
228
- function resolveDisplayedSeries(series, palette) {
229
- const visible = series.filter((s) => {
230
- var _a;
231
- return !((_a = s.visibility) == null ? void 0 : _a.excluded);
232
- });
233
- return visible.map((s, visibleIndex) => {
234
- const hasExplicit = s.color != null && String(s.color).trim() !== "";
235
- const resolvedColor = hasExplicit ? String(s.color).trim() : palette[visibleIndex % palette.length];
236
- return __spreadProps(__spreadValues({}, s), { resolvedColor });
237
- });
238
- }
239
- function yDomainForSeries(resolved) {
240
- let ymin = Number.POSITIVE_INFINITY;
241
- let ymax = Number.NEGATIVE_INFINITY;
242
- for (const s of resolved) {
243
- for (const v of s.data) {
244
- if (typeof v === "number" && Number.isFinite(v)) {
245
- ymin = Math.min(ymin, v);
246
- ymax = Math.max(ymax, v);
247
- }
248
- }
249
- }
250
- if (!Number.isFinite(ymin) || !Number.isFinite(ymax)) {
251
- return [0, 1];
252
- }
253
- ymin = Math.min(0, ymin);
254
- if (ymax < 0) {
255
- ymax = 0;
256
- }
257
- if (ymax === ymin) {
258
- ymax = ymin + 1;
259
- }
260
- return [ymin, ymax];
261
- }
262
- function drawHighlightPoint(ctx, x, y, color, backgroundColor, radius = 4) {
263
- ctx.fillStyle = backgroundColor;
264
- ctx.beginPath();
265
- ctx.arc(x, y, radius + 2, 0, Math.PI * 2);
266
- ctx.fill();
267
- ctx.fillStyle = color;
268
- ctx.beginPath();
269
- ctx.arc(x, y, radius, 0, Math.PI * 2);
270
- ctx.fill();
271
- }
272
- function CanvasTrendLineChart({
273
- labels,
274
- series,
275
- theme,
276
- showGrid = true,
277
- showCrosshair = true,
278
- className = ""
279
- }) {
280
- const containerRef = useRef(null);
281
- const canvasRef = useRef(null);
282
- const [size, setSize] = useState({ width: 0, height: 0 });
283
- const [hoverIndex, setHoverIndex] = useState(null);
284
- useEffect(() => {
285
- const el = containerRef.current;
286
- if (!el) {
287
- return;
288
- }
289
- const update = () => {
290
- setSize({ width: el.clientWidth, height: el.clientHeight });
291
- };
292
- update();
293
- const ro = new ResizeObserver(update);
294
- ro.observe(el);
295
- return () => ro.disconnect();
296
- }, []);
297
- const resolved = useMemo(() => resolveDisplayedSeries(series, theme.colors), [series, theme.colors]);
298
- const draw = useCallback(() => {
299
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
300
- const canvas = canvasRef.current;
301
- const container = containerRef.current;
302
- if (!canvas || !container) {
303
- return;
304
- }
305
- const { width: cssW, height: cssH } = size;
306
- if (cssW < 20 || cssH < 20) {
307
- return;
308
- }
309
- const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
310
- canvas.width = Math.floor(cssW * dpr);
311
- canvas.height = Math.floor(cssH * dpr);
312
- canvas.style.width = `${cssW}px`;
313
- canvas.style.height = `${cssH}px`;
314
- const ctx = canvas.getContext("2d");
315
- if (!ctx) {
316
- return;
317
- }
318
- ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
319
- const m = HOG_LITE_DEFAULT_MARGINS;
320
- const plotLeft = m.left;
321
- const plotTop = m.top;
322
- const plotWidth = cssW - m.left - m.right;
323
- const plotHeight = cssH - m.top - m.bottom;
324
- if (plotWidth <= 4 || plotHeight <= 4) {
325
- return;
326
- }
327
- const bg = (_a = theme.backgroundColor) != null ? _a : "#ffffff";
328
- ctx.fillStyle = bg;
329
- ctx.fillRect(0, 0, cssW, cssH);
330
- const labelList = [...labels];
331
- const xScale = scalePoint().domain(labelList).range([plotLeft, plotLeft + plotWidth]).padding(0.5);
332
- const [y0, y1] = yDomainForSeries(resolved);
333
- const yScale = scaleLinear().domain([y0, y1]).nice().range([plotTop + plotHeight, plotTop]);
334
- const axisColor = (_b = theme.axisColor) != null ? _b : "#666";
335
- const gridColor = (_c = theme.gridColor) != null ? _c : "rgba(0,0,0,0.08)";
336
- if (showGrid) {
337
- const ticks = yScale.ticks(6);
338
- ctx.strokeStyle = gridColor;
339
- ctx.lineWidth = 1;
340
- ctx.setLineDash([]);
341
- for (const t of ticks) {
342
- const y = Math.round(yScale(t)) + 0.5;
343
- ctx.beginPath();
344
- ctx.moveTo(plotLeft, y);
345
- ctx.lineTo(plotLeft + plotWidth, y);
346
- ctx.stroke();
347
- }
348
- }
349
- const xAt = (i) => {
350
- const label = labels[i];
351
- return label !== void 0 ? xScale(label) : void 0;
352
- };
353
- for (const s of resolved) {
354
- if (s.overlay || !s.fill) {
355
- continue;
356
- }
357
- const opacity = (_d = s.fill.opacity) != null ? _d : 0.45;
358
- const baseline = yScale(0);
359
- ctx.save();
360
- ctx.globalAlpha = opacity;
361
- ctx.fillStyle = s.resolvedColor;
362
- ctx.beginPath();
363
- let started = false;
364
- for (let i = 0; i < labels.length; i++) {
365
- const x = xAt(i);
366
- const v = s.data[i];
367
- if (x == null || typeof v !== "number" || !Number.isFinite(v)) {
368
- started = false;
369
- continue;
370
- }
371
- const y = yScale(v);
372
- if (!started) {
373
- ctx.moveTo(x, y);
374
- started = true;
375
- } else {
376
- ctx.lineTo(x, y);
377
- }
378
- }
379
- for (let i = labels.length - 1; i >= 0; i--) {
380
- const x = xAt(i);
381
- if (x == null) {
382
- continue;
383
- }
384
- ctx.lineTo(x, baseline);
385
- }
386
- ctx.closePath();
387
- ctx.fill();
388
- ctx.restore();
389
- }
390
- for (const s of resolved) {
391
- if ((_e = s.visibility) == null ? void 0 : _e.excluded) {
392
- continue;
393
- }
394
- const pattern = (_g = (_f = s.stroke) == null ? void 0 : _f.pattern) != null ? _g : [];
395
- ctx.strokeStyle = s.resolvedColor;
396
- ctx.lineWidth = 2;
397
- ctx.lineJoin = "round";
398
- ctx.lineCap = "round";
399
- ctx.setLineDash(pattern);
400
- ctx.beginPath();
401
- let started = false;
402
- for (let i = 0; i < labels.length; i++) {
403
- const x = xAt(i);
404
- const v = s.data[i];
405
- if (x == null || typeof v !== "number" || !Number.isFinite(v)) {
406
- started = false;
407
- continue;
408
- }
409
- const y = yScale(v);
410
- if (!started) {
411
- ctx.moveTo(x, y);
412
- started = true;
413
- } else {
414
- ctx.lineTo(x, y);
415
- }
416
- }
417
- ctx.stroke();
418
- ctx.setLineDash([]);
419
- }
420
- ctx.fillStyle = axisColor;
421
- const bodyFamily = typeof document !== "undefined" ? window.getComputedStyle(document.body).fontFamily.trim() : "ui-sans-serif, system-ui, sans-serif";
422
- ctx.font = `11px ${bodyFamily || "ui-sans-serif, system-ui, sans-serif"}`;
423
- ctx.textAlign = "right";
424
- ctx.textBaseline = "middle";
425
- const yTicks = yScale.ticks(6);
426
- for (const t of yTicks) {
427
- const y = yScale(t);
428
- ctx.fillText(String(Number.isInteger(t) ? t : Number(t.toFixed(2))), plotLeft - 8, y);
429
- }
430
- ctx.textAlign = "center";
431
- ctx.textBaseline = "top";
432
- const step = Math.max(1, Math.ceil(labels.length / 8));
433
- for (let i = 0; i < labels.length; i += step) {
434
- const x = xAt(i);
435
- if (x == null) {
436
- continue;
437
- }
438
- const text = labels[i];
439
- if (text === void 0) {
440
- continue;
441
- }
442
- ctx.fillText(text.length > 8 ? `${text.slice(0, 7)}\u2026` : text, x, plotTop + plotHeight + 8);
443
- }
444
- const hi = hoverIndex;
445
- if (hi != null && hi >= 0 && hi < labels.length && showCrosshair) {
446
- const cx = xAt(hi);
447
- if (cx != null) {
448
- const cross = (_h = theme.crosshairColor) != null ? _h : gridColor;
449
- ctx.strokeStyle = cross;
450
- ctx.lineWidth = 1;
451
- ctx.setLineDash([4, 4]);
452
- ctx.beginPath();
453
- ctx.moveTo(cx, plotTop);
454
- ctx.lineTo(cx, plotTop + plotHeight);
455
- ctx.stroke();
456
- ctx.setLineDash([]);
457
- for (const s of resolved) {
458
- if (s.overlay || ((_i = s.visibility) == null ? void 0 : _i.excluded)) {
459
- continue;
460
- }
461
- const v = s.data[hi];
462
- if (typeof v !== "number" || !Number.isFinite(v)) {
463
- continue;
464
- }
465
- const y = yScale(v);
466
- drawHighlightPoint(ctx, cx, y, s.resolvedColor, bg, 4);
467
- }
468
- }
469
- }
470
- }, [hoverIndex, labels, resolved, showCrosshair, showGrid, size.height, size.width, theme]);
471
- useEffect(() => {
472
- draw();
473
- }, [draw]);
474
- const onMouseMove = (event) => {
475
- const canvas = canvasRef.current;
476
- if (!canvas) {
477
- return;
478
- }
479
- const mx = event.nativeEvent.offsetX;
480
- const m = HOG_LITE_DEFAULT_MARGINS;
481
- const plotLeft = m.left;
482
- const plotWidth = size.width - m.left - m.right;
483
- if (plotWidth <= 4) {
484
- return;
485
- }
486
- const labelList = [...labels];
487
- const xScale = scalePoint().domain(labelList).range([plotLeft, plotLeft + plotWidth]).padding(0.5);
488
- let best = 0;
489
- let bestDist = Number.POSITIVE_INFINITY;
490
- labels.forEach((lab, i) => {
491
- const xi = xScale(lab);
492
- if (xi == null) {
493
- return;
494
- }
495
- const d = Math.abs(mx - xi);
496
- if (d < bestDist) {
497
- bestDist = d;
498
- best = i;
499
- }
500
- });
501
- setHoverIndex(best);
502
- };
503
- const onMouseLeave = () => {
504
- setHoverIndex(null);
505
- };
506
- const tooltipRows = useMemo(() => {
507
- if (hoverIndex == null) {
508
- return null;
509
- }
510
- const label = labels[hoverIndex];
511
- if (label === void 0) {
512
- return null;
513
- }
514
- return resolved.filter((s) => {
515
- var _a;
516
- return !s.overlay && !((_a = s.visibility) == null ? void 0 : _a.excluded);
517
- }).map((s) => ({
518
- label: s.label,
519
- color: s.resolvedColor,
520
- value: s.data[hoverIndex]
521
- })).filter((row) => typeof row.value === "number" && Number.isFinite(row.value));
522
- }, [hoverIndex, labels, resolved]);
523
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `relative w-full ${className}`.trim(), children: [
524
- /* @__PURE__ */ jsx(
525
- "canvas",
526
- {
527
- ref: canvasRef,
528
- className: "block w-full cursor-crosshair rounded-[2px]",
529
- "aria-label": "Trend line chart canvas",
530
- onMouseMove,
531
- onMouseLeave
532
- }
533
- ),
534
- tooltipRows != null && tooltipRows.length > 0 && hoverIndex != null ? /* @__PURE__ */ jsxs(
535
- "div",
536
- {
537
- className: "pointer-events-none absolute z-20 max-w-xs rounded-[var(--ph-radius-app)] border border-ph-border-strong bg-ph-surface px-3 py-2 text-xs shadow-ph-md",
538
- style: {
539
- left: 12,
540
- top: 8
541
- },
542
- children: [
543
- /* @__PURE__ */ jsx("div", { className: "font-semibold text-ph-ink", children: labels[hoverIndex] }),
544
- /* @__PURE__ */ jsx("ul", { className: "mt-1 space-y-0.5 text-ph-mutedtext", children: tooltipRows.map((row) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2", children: [
545
- /* @__PURE__ */ jsx("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: row.color } }),
546
- /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: row.label }),
547
- /* @__PURE__ */ jsx("span", { className: "ml-auto tabular-nums text-ph-ink", children: row.value })
548
- ] }, row.label)) })
549
- ]
550
- }
551
- ) : null
552
- ] });
553
- }
554
-
555
- // src/lib/chart/use-ph-chart-tokens.ts
556
- import { useEffect as useEffect2, useState as useState2 } from "react";
557
- var DEFAULT_TOKENS = {
558
- series: ["#1d4aff", "#621da6", "#42827e", "#ce0e74", "#f14f58", "#529a0a", "#fe729e"],
559
- muted: "hsl(220 9% 90%)",
560
- surface: "#ffffff",
561
- textMuted: "hsl(220 9% 46%)",
562
- grid: "hsl(220 13% 91%)",
563
- borderStrong: "hsl(220 13% 80%)"
564
- };
565
- function readTokens() {
566
- if (typeof document === "undefined") return DEFAULT_TOKENS;
567
- const style = getComputedStyle(document.documentElement);
568
- const read = (key, fallback) => style.getPropertyValue(key).trim() || fallback;
569
- return {
570
- series: [
571
- read("--ph-data-1", DEFAULT_TOKENS.series[0]),
572
- read("--ph-data-2", DEFAULT_TOKENS.series[1]),
573
- read("--ph-data-3", DEFAULT_TOKENS.series[2]),
574
- read("--ph-data-4", DEFAULT_TOKENS.series[3]),
575
- read("--ph-data-5", DEFAULT_TOKENS.series[4]),
576
- read("--ph-data-6", DEFAULT_TOKENS.series[5]),
577
- read("--ph-data-7", DEFAULT_TOKENS.series[6])
578
- ],
579
- muted: read("--ph-muted", DEFAULT_TOKENS.muted),
580
- surface: read("--ph-surface", DEFAULT_TOKENS.surface),
581
- textMuted: read("--ph-mutedtext", DEFAULT_TOKENS.textMuted),
582
- grid: read("--ph-border", DEFAULT_TOKENS.grid),
583
- borderStrong: read("--ph-border-strong", DEFAULT_TOKENS.borderStrong)
584
- };
585
- }
586
- function useChartTokens() {
587
- const [tokens, setTokens] = useState2(DEFAULT_TOKENS);
588
- useEffect2(() => {
589
- setTokens(readTokens());
590
- }, []);
591
- return tokens;
592
- }
593
-
594
- // src/lib/hog-charts-lite/build-theme.ts
595
- function buildHogChartTheme(tokens) {
596
- return {
597
- colors: tokens.series.slice(),
598
- backgroundColor: tokens.surface,
599
- axisColor: tokens.textMuted,
600
- gridColor: tokens.grid,
601
- crosshairColor: tokens.borderStrong
602
- };
603
- }
604
-
605
- // src/components/charts/quill/TimeSeriesLineChart.tsx
606
- import { jsx as jsx2 } from "react/jsx-runtime";
607
- function TimeSeriesLineChart({
608
- series,
609
- labels,
610
- className,
611
- showGrid = true,
612
- showCrosshair = true,
613
- height = 280
614
- }) {
615
- const tokens = useChartTokens();
616
- const theme = useMemo2(() => buildHogChartTheme(tokens), [tokens]);
617
- const resolved = useMemo2(
618
- () => series.map((s, i) => {
619
- var _a;
620
- return {
621
- key: s.key,
622
- label: s.label,
623
- data: s.data,
624
- color: (_a = s.color) != null ? _a : tokens.series[i % tokens.series.length]
625
- };
626
- }),
627
- [series, tokens.series]
628
- );
629
- return /* @__PURE__ */ jsx2(
630
- "div",
631
- {
632
- className: cn("relative w-full", className),
633
- style: { height, minHeight: 220 },
634
- children: /* @__PURE__ */ jsx2(
635
- CanvasTrendLineChart,
636
- {
637
- labels,
638
- series: resolved,
639
- theme,
640
- showGrid,
641
- showCrosshair,
642
- className: "h-full min-h-[220px]"
643
- }
644
- )
645
- }
646
- );
647
- }
648
-
649
- // src/components/charts/quill/BarChart.tsx
650
- import { useMemo as useMemo3 } from "react";
651
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
652
- function BarChart({ series, labels, className, height = 280 }) {
653
- const tokens = useChartTokens();
654
- const groupCount = labels.length;
655
- const barCount = series.length;
656
- const { maxVal, chartData } = useMemo3(() => {
657
- let mx = 0;
658
- const flat = series.flatMap((s) => s.data);
659
- for (const v of flat) if (v > mx) mx = v;
660
- return {
661
- maxVal: mx || 1,
662
- chartData: series.map((s, i) => {
663
- var _a;
664
- return {
665
- label: s.label,
666
- color: (_a = s.color) != null ? _a : tokens.series[i % tokens.series.length],
667
- values: s.data
668
- };
669
- })
670
- };
671
- }, [series, tokens.series]);
672
- const padding = { top: 16, right: 8, bottom: 24, left: 8 };
673
- const innerW = 400 - padding.left - padding.right;
674
- const innerH = height - padding.top - padding.bottom;
675
- const groupW = innerW / groupCount;
676
- const barW = Math.max(4, groupW * 0.7 / barCount);
677
- const gap = groupW * 0.15;
678
- return /* @__PURE__ */ jsx3("div", { className: cn("relative w-full", className), style: { height }, children: /* @__PURE__ */ jsxs2("svg", { viewBox: `0 0 400 ${height}`, className: "h-full w-full", preserveAspectRatio: "xMidYMid meet", suppressHydrationWarning: true, children: [
679
- chartData.map(
680
- (bar, bi) => bar.values.map((v, li) => {
681
- const x = padding.left + li * groupW + gap / 2 + bi * barW;
682
- const barH = v / maxVal * (innerH - 4);
683
- const y = padding.top + innerH - barH;
684
- return /* @__PURE__ */ jsx3(
685
- "rect",
686
- {
687
- x,
688
- y,
689
- width: barW,
690
- height: barH,
691
- fill: bar.color,
692
- rx: 2,
693
- children: /* @__PURE__ */ jsx3("title", { children: `${bar.label}: ${v}` })
694
- },
695
- `${bi}-${li}`
696
- );
697
- })
698
- ),
699
- labels.map((l, i) => /* @__PURE__ */ jsx3(
700
- "text",
701
- {
702
- x: padding.left + i * groupW + groupW / 2,
703
- y: height - 4,
704
- textAnchor: "middle",
705
- className: "fill-ph-mutedtext",
706
- fontSize: "10",
707
- children: l
708
- },
709
- l
710
- ))
711
- ] }) });
712
- }
713
-
714
- // src/components/charts/quill/PieChart.tsx
715
- import { useMemo as useMemo4 } from "react";
716
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
717
- function PieChart({ slices, className, size = 200 }) {
718
- const tokens = useChartTokens();
719
- const { total, segments } = useMemo4(() => {
720
- const t = slices.reduce((s, sl) => s + Math.max(0, sl.value), 0);
721
- let cum = 0;
722
- const segs = slices.map((sl, i) => {
723
- var _a;
724
- const start = cum;
725
- const val = Math.max(0, sl.value);
726
- cum += val;
727
- return __spreadProps(__spreadValues({}, sl), {
728
- color: (_a = sl.color) != null ? _a : tokens.series[i % tokens.series.length],
729
- startAngle: start / t * 360,
730
- endAngle: cum / t * 360,
731
- pct: t > 0 ? val / t * 100 : 0
732
- });
733
- });
734
- return { total: t, segments: segs };
735
- }, [slices, tokens.series]);
736
- const cx = size / 2;
737
- const cy = size / 2;
738
- const r = size * 0.38;
739
- const ir = r * 0.6;
740
- const polarToCart = (angleDeg, radius) => {
741
- const rad = (angleDeg - 90) * Math.PI / 180;
742
- return { x: cx + radius * Math.cos(rad), y: cy + radius * Math.sin(rad) };
743
- };
744
- const describeArc = (start, end) => {
745
- if (end - start >= 359.9) {
746
- const p1 = polarToCart(start, r);
747
- const p2 = polarToCart(start + 179.9, r);
748
- const p3 = polarToCart(start + 359.9, r);
749
- return `M${p1.x},${p1.y} A${r},${r} 0 0,1 ${p2.x},${p2.y} A${r},${r} 0 0,1 ${p3.x},${p3.y} Z`;
750
- }
751
- const s = polarToCart(start, r);
752
- const e = polarToCart(end, r);
753
- const si = polarToCart(start, ir);
754
- const ei = polarToCart(end, ir);
755
- const large = end - start > 180 ? 1 : 0;
756
- return `M${s.x},${s.y} A${r},${r} 0 ${large},1 ${e.x},${e.y} L${ei.x},${ei.y} A${ir},${ir} 0 ${large},0 ${si.x},${si.y} Z`;
757
- };
758
- return /* @__PURE__ */ jsxs3("div", { className: cn("relative", className), style: { width: size, height: size }, children: [
759
- /* @__PURE__ */ jsxs3("svg", { viewBox: `0 0 ${size} ${size}`, className: "h-full w-full", suppressHydrationWarning: true, children: [
760
- segments.map((s) => /* @__PURE__ */ jsx4("path", { d: describeArc(s.startAngle, s.endAngle), fill: s.color, children: /* @__PURE__ */ jsx4("title", { children: `${s.label}: ${s.pct.toFixed(1)}%` }) }, s.key)),
761
- /* @__PURE__ */ jsx4("circle", { cx, cy, r: ir, fill: "var(--ph-surface)" })
762
- ] }),
763
- /* @__PURE__ */ jsx4("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ jsx4("span", { className: "text-lg font-bold text-ph-ink tabular-nums", children: slices.length }) })
764
- ] });
765
- }
766
-
767
- // src/components/charts/quill/Sparkline.tsx
768
- import { useMemo as useMemo5 } from "react";
769
- import { jsx as jsx5 } from "react/jsx-runtime";
770
- function Sparkline({
771
- data,
772
- color,
773
- className,
774
- width = 80,
775
- height = 32,
776
- strokeWidth = 2
777
- }) {
778
- const tokens = useChartTokens();
779
- const resolvedColor = color != null ? color : tokens.series[0];
780
- const path = useMemo5(() => {
781
- if (data.length < 2) return "";
782
- const min = Math.min(...data);
783
- const max = Math.max(...data);
784
- const range = max - min || 1;
785
- const xStep = width / (data.length - 1);
786
- return data.map((v, i) => {
787
- const x = i * xStep;
788
- const y = height - (v - min) / range * (height - 4) - 2;
789
- return `${i === 0 ? "M" : "L"}${x},${y}`;
790
- }).join(" ");
791
- }, [data, width, height]);
792
- if (data.length < 2) return null;
793
- return /* @__PURE__ */ jsx5(
794
- "svg",
795
- {
796
- className: cn("shrink-0", className),
797
- width,
798
- height,
799
- viewBox: `0 0 ${width} ${height}`,
800
- "aria-hidden": true,
801
- suppressHydrationWarning: true,
802
- children: /* @__PURE__ */ jsx5("path", { d: path, fill: "none", stroke: resolvedColor, strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })
803
- }
804
- );
805
- }
806
-
807
- // src/components/charts/quill/MetricCard.tsx
808
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
809
- function MetricCard({
810
- value,
811
- label,
812
- change,
813
- sparklineData,
814
- icon,
815
- className
816
- }) {
817
- var _a;
818
- return /* @__PURE__ */ jsxs4("div", { className: cn("ph-metric", className), children: [
819
- /* @__PURE__ */ jsxs4("div", { className: "ph-metric__header", children: [
820
- icon && /* @__PURE__ */ jsx6("span", { className: "ph-metric__icon", children: icon }),
821
- /* @__PURE__ */ jsx6("span", { className: "ph-metric__label", children: label }),
822
- change && /* @__PURE__ */ jsxs4(Badge, { variant: ((_a = change.positive) != null ? _a : change.value >= 0) ? "success" : "danger", children: [
823
- change.value >= 0 ? "+" : "",
824
- change.value,
825
- "%"
826
- ] })
827
- ] }),
828
- /* @__PURE__ */ jsx6("div", { className: "ph-metric__value", children: value }),
829
- sparklineData && sparklineData.length > 0 && /* @__PURE__ */ jsx6("div", { className: "mt-2", children: /* @__PURE__ */ jsx6(Sparkline, { data: sparklineData }) })
830
- ] });
831
- }
832
-
833
- // src/components/charts/quill/FunnelChart.tsx
834
- import { useMemo as useMemo6 } from "react";
835
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
836
- function FunnelChart({ steps, className }) {
837
- const tokens = useChartTokens();
838
- const maxCount = useMemo6(() => Math.max(...steps.map((s) => s.count)), [steps]);
839
- return /* @__PURE__ */ jsx7("div", { className: cn("space-y-2", className), suppressHydrationWarning: true, children: steps.map((step, i) => {
840
- const pct = step.count / maxCount * 100;
841
- const prev = i > 0 ? steps[i - 1].count : step.count;
842
- const dropoff = prev > 0 ? (prev - step.count) / prev * 100 : 0;
843
- return /* @__PURE__ */ jsxs5("div", { className: "space-y-1", children: [
844
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between text-sm", children: [
845
- /* @__PURE__ */ jsx7("span", { className: "font-medium text-ph-ink", children: step.label }),
846
- /* @__PURE__ */ jsx7("span", { className: "tabular-nums text-ph-subtle", children: step.count.toLocaleString() })
847
- ] }),
848
- /* @__PURE__ */ jsx7("div", { className: "relative h-8 overflow-hidden rounded-md", style: { background: tokens.muted }, children: /* @__PURE__ */ jsx7(
849
- "div",
850
- {
851
- className: "h-full rounded-md transition-all duration-500",
852
- style: { width: `${pct}%`, background: i === 0 ? tokens.series[0] : tokens.series[i % tokens.series.length] }
853
- }
854
- ) }),
855
- i > 0 && dropoff > 0 && /* @__PURE__ */ jsxs5("p", { className: "text-xs text-ph-danger", children: [
856
- "-",
857
- dropoff.toFixed(1),
858
- "% dropoff"
859
- ] })
860
- ] }, step.label);
861
- }) });
862
- }
159
+ } from "./chunk-E5ZBQYEX.mjs";
160
+ import "./chunk-FWCSY2DS.mjs";
863
161
  export {
864
162
  Accordion,
865
163
  Alert,
866
- AlertDialog,
867
- AppLayout,
868
164
  AuthCard,
869
165
  AuthDivider,
870
166
  AuthLayout,
871
- Autocomplete,
872
167
  Avatar,
873
168
  AvatarGroup,
874
169
  Badge,
875
- Banner,
876
- BarChart,
877
- Breadcrumbs,
878
170
  Button,
879
171
  ButtonChrome,
880
- ButtonGroup,
881
172
  CANONICAL_ICONS,
882
173
  Calendar,
883
174
  Caption,
884
175
  Card,
885
- ChatBubble,
886
176
  Checkbox,
887
177
  Chip,
888
- CodeBlock,
889
- Collapsible,
890
- CollapsibleSection,
891
- Combobox,
892
178
  CommandPalette,
893
- ComponentDocs,
894
- ContextMenu,
895
179
  DEFAULT_THEME_ID,
896
- DataTable,
897
- DatePicker,
898
- Dialog,
899
180
  Display,
900
- Divider,
901
181
  Dot,
902
- Drawer,
903
182
  DropdownButton,
904
183
  DropdownItem,
905
184
  DropdownMenu,
@@ -909,16 +188,13 @@ export {
909
188
  FileUpload,
910
189
  FilterBar,
911
190
  FilterChips,
912
- FilterControls,
913
191
  FilterMenu,
914
192
  FormField,
915
- FunnelChart,
916
193
  H1,
917
194
  H2,
918
195
  H3,
919
196
  H4,
920
197
  H5,
921
- HoverCard,
922
198
  IconBase as Icon,
923
199
  IconActivity,
924
200
  IconAreaChart,
@@ -998,78 +274,40 @@ export {
998
274
  IconUpload,
999
275
  IconVolume,
1000
276
  IconVolumeOff,
1001
- Indicator,
1002
277
  Input,
1003
- InputGroup,
1004
- Kbd,
1005
278
  Label,
1006
279
  Lead,
1007
- Lettermark,
1008
280
  Link,
1009
281
  Loader,
1010
- LoadingBar,
1011
282
  LoadingState,
1012
- Menubar,
1013
- Metric,
1014
- MetricCard,
1015
283
  Modal,
1016
284
  Mono,
1017
- NumberField,
1018
285
  OLD_UI_ICONS,
1019
286
  Overline,
1020
287
  P,
1021
288
  PH_ICONS,
1022
289
  PH_ICON_ALIASES,
1023
- Pagination,
1024
290
  Panel,
1025
- PieChart,
1026
- Popover,
1027
291
  Progress,
1028
- ProgressCircle,
1029
292
  Radio,
1030
- Range,
1031
- Rating,
1032
- Resizable,
1033
- Row,
1034
- ScrollArea,
1035
- SearchGroup,
1036
293
  SearchInput,
1037
294
  SegmentedControl,
1038
295
  Select,
1039
296
  SettingsLayout,
1040
297
  SettingsNav,
1041
- ShowcaseWrapper,
1042
- Sidebar,
1043
298
  Skeleton,
1044
299
  Small,
1045
- Snack,
1046
300
  SortMenu,
1047
- Sparkline,
1048
301
  Spinner,
1049
- Splotch,
1050
302
  Stat,
1051
- Stepper,
1052
303
  THEMES,
1053
304
  THEME_GROUPS,
1054
305
  THEME_INIT_SCRIPT,
1055
306
  Table,
1056
- Tabs,
1057
- Tag,
1058
- Terminal,
1059
307
  Textarea,
1060
- ThemeDomSync,
1061
- ThemeManager,
1062
- ThemeSwitcher,
1063
- TimeSeriesLineChart,
1064
- Timeline,
1065
- Toast,
1066
- ToastStack,
1067
308
  Toggle,
1068
- ToggleButton,
1069
- ToggleGroup,
1070
309
  Tooltip,
1071
310
  TooltipProvider,
1072
- Widget,
1073
311
  createIconBase,
1074
312
  createIconBasePath,
1075
313
  getTheme,