@photon-ai/pho-ui 2.12.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/chunks/IconChevronRight-CzoJnYNI.js +11 -0
  2. package/dist/chunks/IconChevronRight-CzoJnYNI.js.map +1 -0
  3. package/dist/chunks/badge-DlLJPLeZ.js +78 -0
  4. package/dist/chunks/badge-DlLJPLeZ.js.map +1 -0
  5. package/dist/chunks/bar-chart-BJfr3eyd.js +190 -0
  6. package/dist/chunks/bar-chart-BJfr3eyd.js.map +1 -0
  7. package/dist/chunks/{basic-page-CJwG4I83.js → basic-page-CdmVeL_Z.js} +433 -436
  8. package/dist/chunks/basic-page-CdmVeL_Z.js.map +1 -0
  9. package/dist/chunks/code-block-CdozzaHM.js +139 -0
  10. package/dist/chunks/code-block-CdozzaHM.js.map +1 -0
  11. package/dist/chunks/combobox-D4LiGJB2.js +136 -0
  12. package/dist/chunks/combobox-D4LiGJB2.js.map +1 -0
  13. package/dist/chunks/command-Ck8IAgV7.js +192 -0
  14. package/dist/chunks/command-Ck8IAgV7.js.map +1 -0
  15. package/dist/chunks/copy-button-B_B15mEi.js +56 -0
  16. package/dist/chunks/copy-button-B_B15mEi.js.map +1 -0
  17. package/dist/chunks/description-list-C-mwe4ki.js +59 -0
  18. package/dist/chunks/description-list-C-mwe4ki.js.map +1 -0
  19. package/dist/chunks/filter-bar-Cjjq38xo.js +259 -0
  20. package/dist/chunks/filter-bar-Cjjq38xo.js.map +1 -0
  21. package/dist/chunks/legend-C0mU7dqd.js +60 -0
  22. package/dist/chunks/legend-C0mU7dqd.js.map +1 -0
  23. package/dist/chunks/line-chart-CUR3AxrR.js +453 -0
  24. package/dist/chunks/line-chart-CUR3AxrR.js.map +1 -0
  25. package/dist/chunks/log-list-0AXnjFrk.js +244 -0
  26. package/dist/chunks/log-list-0AXnjFrk.js.map +1 -0
  27. package/dist/chunks/stat-hnNqjWVG.js +85 -0
  28. package/dist/chunks/stat-hnNqjWVG.js.map +1 -0
  29. package/dist/chunks/toggle-o84tawXy.js +33 -0
  30. package/dist/chunks/toggle-o84tawXy.js.map +1 -0
  31. package/dist/chunks/tooltip-BTF7GChl.js +32 -0
  32. package/dist/chunks/tooltip-BTF7GChl.js.map +1 -0
  33. package/dist/chunks/trace-CbH0IohX.js +314 -0
  34. package/dist/chunks/trace-CbH0IohX.js.map +1 -0
  35. package/dist/chunks/use-copy-D6JwKUll.js +25 -0
  36. package/dist/chunks/use-copy-D6JwKUll.js.map +1 -0
  37. package/dist/chunks/use-measure-CMVgLouO.js +616 -0
  38. package/dist/chunks/use-measure-CMVgLouO.js.map +1 -0
  39. package/dist/components/badge.js +5 -75
  40. package/dist/components/bar-chart.js +5 -0
  41. package/dist/components/chart.js +8 -0
  42. package/dist/components/code-block.js +6 -0
  43. package/dist/components/combobox.js +1 -1
  44. package/dist/components/command.js +3 -189
  45. package/dist/components/copy-button.js +6 -0
  46. package/dist/components/description-list.js +5 -0
  47. package/dist/components/filter-bar.js +8 -0
  48. package/dist/components/line-chart.js +5 -0
  49. package/dist/components/log-list.js +8 -0
  50. package/dist/components/phone-input.js +1 -1
  51. package/dist/components/stat.js +6 -0
  52. package/dist/components/toggle.js +3 -30
  53. package/dist/components/tooltip.js +2 -29
  54. package/dist/components/trace.js +9 -0
  55. package/dist/index.js +132 -93
  56. package/dist/primitives.js +2 -2
  57. package/dist/sections/basic-page.js +17 -17
  58. package/dist/src/components/accordion/index.d.ts +1 -1
  59. package/dist/src/components/bar-chart/bar-chart.d.ts +9 -0
  60. package/dist/src/components/bar-chart/index.d.ts +2 -0
  61. package/dist/src/components/chart/axes.d.ts +22 -0
  62. package/dist/src/components/chart/color.d.ts +10 -0
  63. package/dist/src/components/chart/format.d.ts +25 -0
  64. package/dist/src/components/chart/index.d.ts +8 -0
  65. package/dist/src/components/chart/legend.d.ts +26 -0
  66. package/dist/src/components/chart/scale.d.ts +34 -0
  67. package/dist/src/components/chart/shell.d.ts +42 -0
  68. package/dist/src/components/chart/tooltip.d.ts +30 -0
  69. package/dist/src/components/chart/types.d.ts +76 -0
  70. package/dist/src/components/chart/use-measure.d.ts +8 -0
  71. package/dist/src/components/code-block/code-block.d.ts +43 -0
  72. package/dist/src/components/code-block/index.d.ts +2 -0
  73. package/dist/src/components/code-block/tokenize-json.d.ts +12 -0
  74. package/dist/src/components/combobox/combobox.d.ts +30 -4
  75. package/dist/src/components/combobox/index.d.ts +1 -1
  76. package/dist/src/components/copy-button/copy-button.d.ts +49 -0
  77. package/dist/src/components/copy-button/index.d.ts +1 -0
  78. package/dist/src/components/description-list/description-list.d.ts +60 -0
  79. package/dist/src/components/description-list/index.d.ts +1 -0
  80. package/dist/src/components/filter-bar/filter-bar.d.ts +101 -0
  81. package/dist/src/components/filter-bar/index.d.ts +1 -0
  82. package/dist/src/components/line-chart/index.d.ts +2 -0
  83. package/dist/src/components/line-chart/line-chart.d.ts +11 -0
  84. package/dist/src/components/log-list/index.d.ts +1 -0
  85. package/dist/src/components/log-list/log-list.d.ts +136 -0
  86. package/dist/src/components/stat/index.d.ts +1 -0
  87. package/dist/src/components/stat/stat.d.ts +61 -0
  88. package/dist/src/components/toggle/toggle.d.ts +5 -1
  89. package/dist/src/components/trace/index.d.ts +2 -0
  90. package/dist/src/components/trace/layout.d.ts +48 -0
  91. package/dist/src/components/trace/trace.d.ts +53 -0
  92. package/dist/src/index.d.ts +10 -0
  93. package/dist/src/sections/basic-page/basic-page.d.ts +3 -3
  94. package/dist/src/utils/index.d.ts +1 -0
  95. package/dist/src/utils/use-copy.d.ts +14 -0
  96. package/dist/utils.js +6 -3
  97. package/package.json +47 -1
  98. package/src/styles/theme.css +81 -0
  99. package/dist/chunks/basic-page-CJwG4I83.js.map +0 -1
  100. package/dist/chunks/combobox-Dj5m_dDd.js +0 -117
  101. package/dist/chunks/combobox-Dj5m_dDd.js.map +0 -1
  102. package/dist/components/badge.js.map +0 -1
  103. package/dist/components/command.js.map +0 -1
  104. package/dist/components/toggle.js.map +0 -1
  105. package/dist/components/tooltip.js.map +0 -1
@@ -0,0 +1,53 @@
1
+ import { ComponentProps, ReactNode, Ref } from 'react';
2
+ import { TraceSpan } from './layout';
3
+ export interface TraceRootProps extends Omit<ComponentProps<"div">, "children" | "onSelect" | "title"> {
4
+ spans: readonly TraceSpan[];
5
+ /** The span whose details are open — it keeps the wash. */
6
+ selectedId?: string | null;
7
+ /** Rows select on click when given. */
8
+ onSelect?: (id: string) => void;
9
+ /** Spans folded at first (uncontrolled). */
10
+ defaultCollapsed?: readonly string[];
11
+ /** Spans folded (controlled). */
12
+ collapsed?: readonly string[];
13
+ onCollapsedChange?: (ids: string[]) => void;
14
+ /** A title row above the axis — "Waterfall". Omit for none. */
15
+ title?: ReactNode;
16
+ ref?: Ref<HTMLDivElement>;
17
+ }
18
+ declare function Root({ spans, selectedId, onSelect, defaultCollapsed, collapsed: collapsedProp, onCollapsedChange, title, className, ...props }: TraceRootProps): import("react").JSX.Element;
19
+ export type TraceLogLevel = "debug" | "info" | "warn" | "error";
20
+ export interface TraceLog {
21
+ id?: string;
22
+ /** When, in ms after the trace's start. */
23
+ offsetMs: number;
24
+ level?: TraceLogLevel;
25
+ message: string;
26
+ /** The span it was written in, when known — its name shows after. */
27
+ spanId?: string;
28
+ }
29
+ export interface TraceLogsProps extends Omit<ComponentProps<"section">, "children" | "title"> {
30
+ logs?: readonly TraceLog[] | null;
31
+ /** The spans, to name the one each line was written in. */
32
+ spans?: readonly TraceSpan[];
33
+ /** @default "Logs" */
34
+ title?: ReactNode;
35
+ ref?: Ref<HTMLElement>;
36
+ }
37
+ /**
38
+ * The log lines that belong to the trace, each at its offset from the
39
+ * start, in the mono face. Renders nothing when there are none — a
40
+ * trace with no logs shows no empty block.
41
+ */
42
+ declare function Logs({ logs, spans, title, className, ...props }: TraceLogsProps): import("react").JSX.Element | null;
43
+ /**
44
+ * ```tsx
45
+ * <Trace.Root spans={spans} selectedId={id} onSelect={setId} title="Waterfall" />
46
+ * <Trace.Logs logs={logs} spans={spans} />
47
+ * ```
48
+ */
49
+ export declare const Trace: {
50
+ Root: typeof Root;
51
+ Logs: typeof Logs;
52
+ };
53
+ export {};
@@ -16,3 +16,13 @@ export * from './components/status-view';
16
16
  export * from './components/error';
17
17
  export * from './sections/sidebar';
18
18
  export * from './sections/basic-page';
19
+ export * from './components/chart';
20
+ export * from './components/stat';
21
+ export * from './components/bar-chart';
22
+ export * from './components/line-chart';
23
+ export * from './components/copy-button';
24
+ export * from './components/filter-bar';
25
+ export * from './components/log-list';
26
+ export * from './components/description-list';
27
+ export * from './components/code-block';
28
+ export * from './components/trace';
@@ -236,9 +236,9 @@ declare function Header({ enter, className, ...props }: BasicPageHeaderProps): i
236
236
  /**
237
237
  * An action at the header row's end — a small button (or two) seated in
238
238
  * the `Header` grid the way `Search` is: top-right of the block, its top
239
- * edge on the title row, flush with the card edge below. Put it inside
240
- * `Header` after the text; with a `Search` present it stands to the
241
- * search's right.
239
+ * edge on the header's top, flush with the card edge below; text shorter
240
+ * than it centers against it. Put it inside `Header` after the text; with
241
+ * a `Search` present it stands to the search's right.
242
242
  */
243
243
  declare function HeaderAction({ className, ...props }: ComponentProps<"div"> & {
244
244
  ref?: Ref<HTMLDivElement>;
@@ -3,3 +3,4 @@ export { isReactComponent } from './is-react-component';
3
3
  export { resolveVariant, type VariantDef, type VariantMap, } from './resolve-variant';
4
4
  export { LinkProvider, useLinkComponent, type LinkComponent, } from './link-provider';
5
5
  export { usePressPulse, CONTROL_PRESS_SCALE, CONTROL_PRESS_SPRING, } from './use-press-pulse';
6
+ export { useCopy, COPY_FEEDBACK_MS } from './use-copy';
@@ -0,0 +1,14 @@
1
+ /** How long a copy control reads "Copied" before it settles back. */
2
+ export declare const COPY_FEEDBACK_MS = 1500;
3
+ /**
4
+ * Copy text to the clipboard and remember, briefly, that it happened —
5
+ * the state behind every copy affordance in Pho (the id in a log row,
6
+ * the value in a description list, a code panel's button). `copy`
7
+ * resolves to whether the write landed; `copied` holds for
8
+ * `COPY_FEEDBACK_MS` so the control can swap its glyph and its live
9
+ * region can announce. SSR-safe: the clipboard is only touched on call.
10
+ */
11
+ export declare function useCopy(resetMs?: number): {
12
+ copied: boolean;
13
+ copy: (text: string) => Promise<boolean>;
14
+ };
package/dist/utils.js CHANGED
@@ -3,14 +3,17 @@ import { t as r } from "./chunks/cn-ChIgwEl3.js";
3
3
  import { t } from "./chunks/is-react-component-DSnjtBmo.js";
4
4
  import { t as m } from "./chunks/resolve-variant-CcD8iG5l.js";
5
5
  import { n as i, t as n } from "./chunks/link-provider-DXzDQ08N.js";
6
- import { n as P, r as R, t as S } from "./chunks/use-press-pulse-IbNstUT0.js";
6
+ import { n as C, r as P, t as S } from "./chunks/use-press-pulse-IbNstUT0.js";
7
+ import { n as R, t as _ } from "./chunks/use-copy-D6JwKUll.js";
7
8
  export {
8
9
  S as CONTROL_PRESS_SCALE,
9
- P as CONTROL_PRESS_SPRING,
10
+ C as CONTROL_PRESS_SPRING,
11
+ _ as COPY_FEEDBACK_MS,
10
12
  n as LinkProvider,
11
13
  r as cn,
12
14
  t as isReactComponent,
13
15
  m as resolveVariant,
16
+ R as useCopy,
14
17
  i as useLinkComponent,
15
- R as usePressPulse
18
+ P as usePressPulse
16
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@photon-ai/pho-ui",
3
- "version": "2.12.0",
3
+ "version": "2.14.0",
4
4
  "description": "Pho Design System — Photon's React component library, built on Base UI",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -407,6 +407,46 @@
407
407
  "./primitives/tooltip": {
408
408
  "types": "./dist/src/primitives/tooltip.d.ts",
409
409
  "import": "./dist/primitives/tooltip.js"
410
+ },
411
+ "./components/chart": {
412
+ "types": "./dist/src/components/chart/index.d.ts",
413
+ "import": "./dist/components/chart.js"
414
+ },
415
+ "./components/stat": {
416
+ "types": "./dist/src/components/stat/index.d.ts",
417
+ "import": "./dist/components/stat.js"
418
+ },
419
+ "./components/bar-chart": {
420
+ "types": "./dist/src/components/bar-chart/index.d.ts",
421
+ "import": "./dist/components/bar-chart.js"
422
+ },
423
+ "./components/line-chart": {
424
+ "types": "./dist/src/components/line-chart/index.d.ts",
425
+ "import": "./dist/components/line-chart.js"
426
+ },
427
+ "./components/copy-button": {
428
+ "types": "./dist/src/components/copy-button/index.d.ts",
429
+ "import": "./dist/components/copy-button.js"
430
+ },
431
+ "./components/filter-bar": {
432
+ "types": "./dist/src/components/filter-bar/index.d.ts",
433
+ "import": "./dist/components/filter-bar.js"
434
+ },
435
+ "./components/log-list": {
436
+ "types": "./dist/src/components/log-list/index.d.ts",
437
+ "import": "./dist/components/log-list.js"
438
+ },
439
+ "./components/description-list": {
440
+ "types": "./dist/src/components/description-list/index.d.ts",
441
+ "import": "./dist/components/description-list.js"
442
+ },
443
+ "./components/code-block": {
444
+ "types": "./dist/src/components/code-block/index.d.ts",
445
+ "import": "./dist/components/code-block.js"
446
+ },
447
+ "./components/trace": {
448
+ "types": "./dist/src/components/trace/index.d.ts",
449
+ "import": "./dist/components/trace.js"
410
450
  }
411
451
  },
412
452
  "peerDependencies": {
@@ -420,6 +460,9 @@
420
460
  "@testing-library/jest-dom": "^7.0.1",
421
461
  "@testing-library/react": "^16.3.2",
422
462
  "@testing-library/user-event": "^14.6.5",
463
+ "@types/d3-array": "3.2.2",
464
+ "@types/d3-shape": "3.2.0",
465
+ "@types/d3-time": "3.0.4",
423
466
  "@types/node": "^26.2.0",
424
467
  "@types/react": "^19.2.18",
425
468
  "@types/react-dom": "^19.2.4",
@@ -442,6 +485,9 @@
442
485
  "clsx": "^2.1.1",
443
486
  "cmdk": "^1.1.1",
444
487
  "country-flag-icons": "^1.6.20",
488
+ "d3-array": "3.2.4",
489
+ "d3-shape": "3.2.0",
490
+ "d3-time": "3.1.0",
445
491
  "libphonenumber-js": "^1.13.11",
446
492
  "motion": "^13.1.0",
447
493
  "tailwind-merge": "^3.6.0"
@@ -436,4 +436,85 @@
436
436
  opacity: 0.45;
437
437
  }
438
438
  }
439
+
440
+ /* ============================== Charts ============================== */
441
+ /* charts — series colours for BarChart / LineChart. An ORDERED set:
442
+ assign slot 1, 2, 3… in series order and never cycle past 6 (fold the
443
+ tail into "Other"). Validated with the dataviz six checks in both modes
444
+ against the card (#111) and page (#000 / #fff) surfaces: lightness band,
445
+ chroma floor, adjacent-pair CVD ΔE ≥ 8, normal-vision ΔE ≥ 15, 3:1 on
446
+ the surface. Slots 1–2 are the site's sky and orange (orange stepped
447
+ from L 0.70 to 0.66 so a bar clears 3:1 on white); 3–6 are purple,
448
+ olive, magenta, indigo. Dark values are the same hues re-stepped into
449
+ the dark band (L 0.48–0.67), not a flip. */
450
+ --color-pho-chart-1: light-dark(
451
+ oklch(0.6 0.101 239.2),
452
+ oklch(0.66 0.11 239.2)
453
+ );
454
+ --color-pho-chart-2: oklch(0.66 0.15 57.8);
455
+ --color-pho-chart-3: light-dark(oklch(0.62 0.2 307.5), oklch(0.66 0.2 307.5));
456
+ --color-pho-chart-4: oklch(0.66 0.14 106);
457
+ --color-pho-chart-5: light-dark(oklch(0.62 0.2 350), oklch(0.65 0.2 350));
458
+ --color-pho-chart-6: oklch(0.639 0.146 269.6);
459
+ /* Status series — successful vs failed. The state text inks, so a failed
460
+ segment is the same red as a Failed badge. Reserved: a series wears
461
+ these only when it MEANS good / bad, never as "series 4". */
462
+ --color-pho-chart-success: light-dark(
463
+ oklch(0.549 0.136 149.3),
464
+ oklch(0.735 0.162 150.5)
465
+ );
466
+ --color-pho-chart-error: light-dark(
467
+ oklch(0.565 0.212 20.2),
468
+ oklch(0.696 0.198 14.9)
469
+ );
470
+ /* The monochrome series — a one-series chart on the site's black/white. */
471
+ --color-pho-chart-ink: light-dark(oklch(0 0 0 / 0.8), oklch(1 0 0 / 0.8));
472
+ /* Chart furniture: gridlines one step off the surface, the crosshair and
473
+ baseline a touch stronger. Hairlines, solid, recessive. */
474
+ --color-pho-chart-grid: light-dark(oklch(0 0 0 / 0.06), oklch(1 0 0 / 0.08));
475
+ --color-pho-chart-crosshair: light-dark(
476
+ oklch(0 0 0 / 0.2),
477
+ oklch(1 0 0 / 0.25)
478
+ );
479
+
480
+ /* ==================== Animation: chart mount ==================== */
481
+ /* A chart surfaces once on mount — opacity only, nothing moves. The
482
+ global reduced-motion guard in pho.css collapses it. */
483
+ --animate-pho-chart-in: pho-chart-in 300ms ease-out both;
484
+
485
+ @keyframes pho-chart-in {
486
+ from {
487
+ opacity: 0;
488
+ }
489
+ }
490
+
491
+ /* ============================ Code (logs) ============================ */
492
+ /* logs: the read-only code panel (CodeBlock) and its JSON tokens. The
493
+ surface is a well one step off the card: the page gray in light, a
494
+ step below the card in dark. Syntax inks come from the accent set
495
+ above, darkened for white and lifted (and softened) for dark so a
496
+ body reads at the mono size in both. `--color-*` so text-, bg-, and
497
+ border- utilities all exist. */
498
+ --color-pho-code-bg: light-dark(oklch(0.985 0 0), oklch(0.13 0 0));
499
+ --color-pho-code-fg: light-dark(oklch(0 0 0 / 0.85), oklch(1 0 0 / 0.85));
500
+ --color-pho-code-key: light-dark(
501
+ oklch(0.499 0.142 263.2),
502
+ oklch(0.74 0.11 263.2)
503
+ );
504
+ --color-pho-code-string: light-dark(
505
+ oklch(0.52 0.13 149.2),
506
+ oklch(0.78 0.13 149.2)
507
+ );
508
+ --color-pho-code-number: light-dark(
509
+ oklch(0.58 0.15 57.8),
510
+ oklch(0.8 0.13 71.4)
511
+ );
512
+ --color-pho-code-keyword: light-dark(
513
+ oklch(0.55 0.19 307.5),
514
+ oklch(0.78 0.15 307.5)
515
+ );
516
+ --color-pho-code-punctuation: light-dark(
517
+ oklch(0 0 0 / 0.55),
518
+ oklch(1 0 0 / 0.55)
519
+ );
439
520
  }