@ramme-io/ui 4.2.9 → 5.0.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 (48) hide show
  1. package/README.md +3 -9
  2. package/bin/ramme-ui.mjs +364 -0
  3. package/dist/blocks/iot/DeviceCard.d.ts +5 -0
  4. package/dist/blocks/iot/DeviceCard.js +29 -28
  5. package/dist/component-registry.js +384 -409
  6. package/dist/components/ai/AIChatThread/AIChatThread.d.ts +10 -2
  7. package/dist/components/ai/AIChatThread/AIChatThread.js +106 -119
  8. package/dist/components/ai/cardState.d.ts +19 -0
  9. package/dist/components/data-display/DocumentScanView.d.ts +81 -0
  10. package/dist/components/data-display/DocumentScanView.js +79 -0
  11. package/dist/components/data-display/Gallery.d.ts +49 -0
  12. package/dist/components/data-display/Gallery.js +95 -0
  13. package/dist/components/theme/ThemeSynthesizer.d.ts +2 -0
  14. package/dist/components/theme/ThemeSynthesizer.js +16 -15
  15. package/dist/components/ui/icon-loader.d.ts +1 -1
  16. package/dist/contexts/ThemeContext.d.ts +3 -0
  17. package/dist/contexts/ThemeContext.js +32 -30
  18. package/dist/index.d.ts +4 -9
  19. package/dist/index.js +252 -265
  20. package/dist/wizardManifest.js +123 -166
  21. package/package.json +7 -3
  22. package/src/wizardManifest.ts +123 -166
  23. package/tailwind.preset.js +17 -0
  24. package/dist/blocks/engines/WatchlistEngine.d.ts +0 -37
  25. package/dist/blocks/engines/WatchlistEngine.js +0 -130
  26. package/dist/components/ai/ArchitectureReferenceCard/ArchitectureReferenceCard.d.ts +0 -28
  27. package/dist/components/ai/ArchitectureReferenceCard/ArchitectureReferenceCard.js +0 -71
  28. package/dist/components/ai/ArchitectureReferenceCard/index.d.ts +0 -2
  29. package/dist/components/ai/CompanyProfileCard/CompanyProfileCard.d.ts +0 -15
  30. package/dist/components/ai/CompanyProfileCard/CompanyProfileCard.js +0 -110
  31. package/dist/components/ai/CompanyProfileCard/index.d.ts +0 -1
  32. package/dist/components/ai/CounterpartyGraphCard/CounterpartyGraphCard.d.ts +0 -30
  33. package/dist/components/ai/CounterpartyGraphCard/CounterpartyGraphCard.js +0 -83
  34. package/dist/components/ai/CounterpartyGraphCard/index.d.ts +0 -2
  35. package/dist/components/ai/DivergenceMetricsCard/DivergenceMetricsCard.d.ts +0 -29
  36. package/dist/components/ai/DivergenceMetricsCard/DivergenceMetricsCard.js +0 -70
  37. package/dist/components/ai/DivergenceMetricsCard/index.d.ts +0 -2
  38. package/dist/components/ai/LiveQuoteCard/LiveQuoteCard.d.ts +0 -27
  39. package/dist/components/ai/LiveQuoteCard/LiveQuoteCard.js +0 -73
  40. package/dist/components/ai/LiveQuoteCard/index.d.ts +0 -2
  41. package/dist/components/ai/NewsSummaryCard/NewsSummaryCard.d.ts +0 -27
  42. package/dist/components/ai/NewsSummaryCard/NewsSummaryCard.js +0 -78
  43. package/dist/components/ai/NewsSummaryCard/index.d.ts +0 -2
  44. package/dist/components/ai/StockChart/StockChart.d.ts +0 -34
  45. package/dist/components/ai/StockChart/StockChart.js +0 -199
  46. package/dist/components/ai/StockChart/index.d.ts +0 -2
  47. package/dist/utils/apiBaseUrl.d.ts +0 -1
  48. package/dist/utils/apiBaseUrl.js +0 -10
@@ -1,110 +0,0 @@
1
- import { jsx as r, jsxs as t, Fragment as f } from "react/jsx-runtime";
2
- import { apiBaseUrl as w } from "../../../utils/apiBaseUrl.js";
3
- import { useState as n, useEffect as v } from "react";
4
- import { Icon as a } from "../../ui/Icon.js";
5
- const _ = ({ ticker: i }) => {
6
- const [e, x] = n(null), [u, l] = n(!0), [m, p] = n(null), [o, h] = n(!1);
7
- if (v(() => {
8
- (async () => {
9
- try {
10
- l(!0), p(null);
11
- const d = w(), c = await fetch(`${d}/companies/${i.toUpperCase()}/profile`);
12
- if (!c.ok)
13
- throw new Error(`Failed to fetch profile: ${c.statusText}`);
14
- const N = await c.json();
15
- x(N);
16
- } catch (d) {
17
- p(d instanceof Error ? d.message : "Failed to fetch company profile");
18
- } finally {
19
- l(!1);
20
- }
21
- })();
22
- }, [i]), u)
23
- return /* @__PURE__ */ r("div", { className: "w-full min-w-[320px] max-w-2xl rounded-lg border border-border bg-card p-4 animate-pulse", children: /* @__PURE__ */ t("div", { className: "space-y-3", children: [
24
- /* @__PURE__ */ r("div", { className: "h-5 w-32 bg-muted rounded" }),
25
- /* @__PURE__ */ r("div", { className: "h-4 w-48 bg-muted rounded" }),
26
- /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-3", children: [
27
- /* @__PURE__ */ r("div", { className: "h-16 bg-muted rounded" }),
28
- /* @__PURE__ */ r("div", { className: "h-16 bg-muted rounded" })
29
- ] }),
30
- /* @__PURE__ */ r("div", { className: "h-20 bg-muted rounded" })
31
- ] }) });
32
- if (m || !e)
33
- return /* @__PURE__ */ r("div", { className: "w-full min-w-[320px] max-w-2xl rounded-lg border border-destructive/40 bg-destructive/5 p-4", children: /* @__PURE__ */ t("div", { className: "flex items-start gap-2", children: [
34
- /* @__PURE__ */ r(a, { name: "alert-triangle", className: "h-4 w-4 text-destructive flex-shrink-0 mt-0.5" }),
35
- /* @__PURE__ */ t("div", { className: "min-w-0", children: [
36
- /* @__PURE__ */ r("p", { className: "text-sm font-medium text-destructive", children: "Profile unavailable" }),
37
- /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground mt-1", children: m || `Unable to load profile for ${i}` })
38
- ] })
39
- ] }) });
40
- const g = (s) => s >= 1e12 ? `$${(s / 1e12).toFixed(2)}T` : s >= 1e9 ? `$${(s / 1e9).toFixed(2)}B` : s >= 1e6 ? `$${(s / 1e6).toFixed(1)}M` : `$${s.toLocaleString()}`, b = e.description && e.description.length > 200 ? e.description.slice(0, 200) + "..." : e.description;
41
- return /* @__PURE__ */ t("div", { className: "w-full min-w-[320px] max-w-2xl rounded-lg border border-border bg-card p-4 space-y-3", children: [
42
- /* @__PURE__ */ t("div", { className: "flex items-start justify-between gap-2", children: [
43
- /* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: [
44
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2 mb-1", children: [
45
- /* @__PURE__ */ r("h3", { className: "text-base font-bold font-mono text-foreground", children: e.ticker }),
46
- e.source === "cache_stale" && e.warning && /* @__PURE__ */ t("span", { className: "text-xs text-amber-500 flex items-center gap-1", children: [
47
- /* @__PURE__ */ r(a, { name: "alert-circle", className: "h-3 w-3" }),
48
- "Stale"
49
- ] })
50
- ] }),
51
- /* @__PURE__ */ r("p", { className: "text-sm font-semibold text-foreground/90", children: e.company_name })
52
- ] }),
53
- /* @__PURE__ */ r(a, { name: "building", className: "h-5 w-5 text-muted-foreground flex-shrink-0" })
54
- ] }),
55
- (e.sector || e.industry) && /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: [
56
- e.sector && /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1 rounded-md bg-primary/10 px-2 py-1 text-xs font-medium text-primary ring-1 ring-primary/20", children: [
57
- /* @__PURE__ */ r(a, { name: "bar-chart-2", className: "h-3 w-3" }),
58
- e.sector
59
- ] }),
60
- e.industry && /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs font-medium text-muted-foreground", children: [
61
- /* @__PURE__ */ r(a, { name: "briefcase", className: "h-3 w-3" }),
62
- e.industry
63
- ] })
64
- ] }),
65
- (e.market_cap || e.pe_ratio) && /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-3", children: [
66
- e.market_cap && /* @__PURE__ */ t("div", { className: "rounded-md border border-border bg-muted/30 p-3 space-y-1", children: [
67
- /* @__PURE__ */ r("p", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Market Cap" }),
68
- /* @__PURE__ */ r("p", { className: "text-lg font-bold font-mono text-foreground", children: g(e.market_cap) })
69
- ] }),
70
- e.pe_ratio && /* @__PURE__ */ t("div", { className: "rounded-md border border-border bg-muted/30 p-3 space-y-1", children: [
71
- /* @__PURE__ */ r("p", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "P/E Ratio" }),
72
- /* @__PURE__ */ t("p", { className: "text-lg font-bold font-mono text-foreground", children: [
73
- e.pe_ratio.toFixed(2),
74
- "x"
75
- ] })
76
- ] })
77
- ] }),
78
- e.description && /* @__PURE__ */ t("div", { className: "space-y-2", children: [
79
- /* @__PURE__ */ t("p", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground flex items-center gap-1", children: [
80
- /* @__PURE__ */ r(a, { name: "file-text", className: "h-3 w-3" }),
81
- "Company Overview"
82
- ] }),
83
- /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground leading-relaxed", children: o ? e.description : b }),
84
- e.description.length > 200 && /* @__PURE__ */ r(
85
- "button",
86
- {
87
- onClick: () => h(!o),
88
- className: "text-xs text-primary hover:underline flex items-center gap-1",
89
- children: o ? /* @__PURE__ */ t(f, { children: [
90
- /* @__PURE__ */ r(a, { name: "chevron-up", className: "h-3 w-3" }),
91
- "Show less"
92
- ] }) : /* @__PURE__ */ t(f, { children: [
93
- /* @__PURE__ */ r(a, { name: "chevron-down", className: "h-3 w-3" }),
94
- "Read more"
95
- ] })
96
- }
97
- )
98
- ] }),
99
- /* @__PURE__ */ t("div", { className: "pt-2 border-t border-border/50 flex items-center justify-between text-xs text-muted-foreground", children: [
100
- /* @__PURE__ */ t("span", { className: "flex items-center gap-1", children: [
101
- /* @__PURE__ */ r(a, { name: "database", className: "h-3 w-3" }),
102
- e.source === "cache" ? "Cached" : e.source === "yfinance" ? "Live" : "Cached (stale)"
103
- ] }),
104
- /* @__PURE__ */ r("span", { children: new Date(e.updated_at).toLocaleDateString() })
105
- ] })
106
- ] });
107
- };
108
- export {
109
- _ as CompanyProfileCard
110
- };
@@ -1 +0,0 @@
1
- export { CompanyProfileCard } from './CompanyProfileCard';
@@ -1,30 +0,0 @@
1
- /**
2
- * @file CounterpartyGraphCard.tsx
3
- * @package @ramme-io/ui
4
- * @description AI-generated counterparty relationship card
5
- *
6
- * ARCHITECTURAL ROLE:
7
- * Renders Fleet-Brain-Deep's inferred counterparty graph inside AI chat
8
- * bubbles. Fetches from the Ramme Data Factory API's
9
- * /fleet/counterparties/{ticker} endpoint. Follows the same self-fetching
10
- * pattern as LiveQuoteCard — no product-layer data plumbing required.
11
- */
12
- import React from 'react';
13
- interface CounterpartyGraphParams {
14
- ticker: string;
15
- hops?: number;
16
- }
17
- export interface CounterpartyGraphCardProps {
18
- /** Parameters from the LLM tool call */
19
- params: CounterpartyGraphParams;
20
- }
21
- /**
22
- * @wizard
23
- * @name CounterpartyGraphCard
24
- * @description AI-generated counterparty relationship card showing suppliers, customers, partners, and competitors inferred from alternative signals
25
- * @tags ai, counterparty, graph, relationships, generative-ui
26
- * @category ai
27
- * @id counterparty-graph-card
28
- */
29
- export declare const CounterpartyGraphCard: React.FC<CounterpartyGraphCardProps>;
30
- export {};
@@ -1,83 +0,0 @@
1
- import { jsxs as r, jsx as s } from "react/jsx-runtime";
2
- import { apiBaseUrl as y } from "../../../utils/apiBaseUrl.js";
3
- import { useState as c, useEffect as w } from "react";
4
- import { Card as N, CardHeader as b, CardTitle as C, CardContent as _ } from "../../layout/Card.js";
5
- import { Icon as l } from "../../ui/Icon.js";
6
- const v = {
7
- supplies_to: "Supplies to",
8
- purchases_from: "Purchases from",
9
- partners_with: "Partners with",
10
- competes_with: "Competes with",
11
- regulated_by: "Regulated by",
12
- invests_in: "Invests in",
13
- acquires: "Acquires",
14
- same_as: "Also known as"
15
- }, B = ({ params: f }) => {
16
- const { ticker: n, hops: p } = f, [a, x] = c(null), [d, m] = c(!0), [o, u] = c(null);
17
- w(() => {
18
- (async () => {
19
- try {
20
- m(!0), u(null);
21
- const e = y(), h = await fetch(
22
- `${e}/fleet/counterparties/${n.toUpperCase()}?hops=${p ?? 1}`
23
- );
24
- if (!h.ok)
25
- throw new Error(`No counterparty data available for ${n.toUpperCase()}`);
26
- x(await h.json());
27
- } catch (e) {
28
- u(e instanceof Error ? e.message : "Failed to fetch counterparty graph");
29
- } finally {
30
- m(!1);
31
- }
32
- })();
33
- }, [n, p]);
34
- const g = new Map(((a == null ? void 0 : a.nodes) ?? []).map((t) => [t.id, t])), i = (a == null ? void 0 : a.edges) ?? [];
35
- return /* @__PURE__ */ r(N, { className: "w-full min-w-[280px] max-w-md shadow-lg border-primary/20", children: [
36
- /* @__PURE__ */ s(b, { className: "pb-3", children: /* @__PURE__ */ r(C, { className: "text-sm font-medium text-muted-foreground flex items-center gap-2", children: [
37
- /* @__PURE__ */ s(l, { name: "share-2", size: 14 }),
38
- "Counterparty Network — ",
39
- n.toUpperCase()
40
- ] }) }),
41
- /* @__PURE__ */ r(_, { className: "pt-0", children: [
42
- d && /* @__PURE__ */ s("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ s(l, { name: "loader", size: 24, className: "animate-spin text-muted-foreground" }) }),
43
- o && /* @__PURE__ */ r("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [
44
- /* @__PURE__ */ s(l, { name: "alert-circle", size: 14, className: "mt-px shrink-0" }),
45
- /* @__PURE__ */ s("span", { children: o })
46
- ] }),
47
- !d && !o && i.length === 0 && /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground py-2", children: [
48
- "No counterparty relationships inferred yet for ",
49
- n.toUpperCase(),
50
- "."
51
- ] }),
52
- i.length > 0 && /* @__PURE__ */ s("div", { className: "space-y-1.5 max-h-72 overflow-y-auto", children: i.map((t) => {
53
- const e = g.get(t.target_id);
54
- return e ? /* @__PURE__ */ r(
55
- "div",
56
- {
57
- className: "flex items-center justify-between gap-2 rounded-md border border-border/60 bg-muted/20 px-2.5 py-1.5",
58
- children: [
59
- /* @__PURE__ */ r("div", { className: "min-w-0", children: [
60
- /* @__PURE__ */ r("span", { className: "text-xs font-semibold text-foreground truncate block", children: [
61
- e.public_name ?? e.name,
62
- e.ticker && e.resolution === "public" && /* @__PURE__ */ s("span", { className: "ml-1.5 font-mono text-primary", children: e.ticker.toUpperCase() })
63
- ] }),
64
- /* @__PURE__ */ r("span", { className: "text-[10px] font-mono text-muted-foreground uppercase tracking-wide", children: [
65
- v[t.edge_type] ?? t.edge_type,
66
- t.hop === 2 && /* @__PURE__ */ s("span", { className: "ml-1.5 opacity-70", children: "· 2nd degree" })
67
- ] })
68
- ] }),
69
- /* @__PURE__ */ r("span", { className: "text-[10px] font-mono text-muted-foreground shrink-0", children: [
70
- Math.round(t.weight * 100),
71
- "%"
72
- ] })
73
- ]
74
- },
75
- t.id
76
- ) : null;
77
- }) })
78
- ] })
79
- ] });
80
- };
81
- export {
82
- B as CounterpartyGraphCard
83
- };
@@ -1,2 +0,0 @@
1
- export { CounterpartyGraphCard } from './CounterpartyGraphCard';
2
- export type { CounterpartyGraphCardProps } from './CounterpartyGraphCard';
@@ -1,29 +0,0 @@
1
- /**
2
- * @file DivergenceMetricsCard.tsx
3
- * @package @ramme-io/ui
4
- * @description AI-generated operational/customer divergence card
5
- *
6
- * ARCHITECTURAL ROLE:
7
- * Renders Fleet-Brain-Deep's divergence scoring (signed delta between
8
- * expected/baseline and observed performance) inside AI chat bubbles.
9
- * Fetches from the Ramme Data Factory API's /fleet/divergence/{ticker}
10
- * endpoint. Follows the same self-fetching pattern as LiveQuoteCard.
11
- */
12
- import React from 'react';
13
- interface DivergenceMetricsParams {
14
- ticker: string;
15
- }
16
- export interface DivergenceMetricsCardProps {
17
- /** Parameters from the LLM tool call */
18
- params: DivergenceMetricsParams;
19
- }
20
- /**
21
- * @wizard
22
- * @name DivergenceMetricsCard
23
- * @description AI-generated card showing operational and customer divergence scores — a signed delta between expected and observed performance
24
- * @tags ai, divergence, metrics, generative-ui
25
- * @category ai
26
- * @id divergence-metrics-card
27
- */
28
- export declare const DivergenceMetricsCard: React.FC<DivergenceMetricsCardProps>;
29
- export {};
@@ -1,70 +0,0 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- import { apiBaseUrl as h } from "../../../utils/apiBaseUrl.js";
3
- import { useState as c, useEffect as v } from "react";
4
- import { Card as N, CardHeader as b, CardTitle as y, CardContent as C } from "../../layout/Card.js";
5
- import { Icon as d } from "../../ui/Icon.js";
6
- const w = {
7
- operations: "Operations",
8
- customer: "Customer",
9
- operational: "Operations",
10
- ux: "Customer"
11
- }, k = ({ params: u }) => {
12
- const { ticker: a } = u, [x, g] = c(null), [l, m] = c(!0), [o, p] = c(null);
13
- v(() => {
14
- (async () => {
15
- try {
16
- m(!0), p(null);
17
- const r = h(), n = await fetch(`${r}/fleet/divergence/${a.toUpperCase()}`);
18
- if (!n.ok)
19
- throw new Error(`No divergence data available for ${a.toUpperCase()}`);
20
- g(await n.json());
21
- } catch (r) {
22
- p(r instanceof Error ? r.message : "Failed to fetch divergence metrics");
23
- } finally {
24
- m(!1);
25
- }
26
- })();
27
- }, [a]);
28
- const i = /* @__PURE__ */ new Map();
29
- return (x ?? []).forEach((e) => {
30
- i.has(e.metric) || i.set(e.metric, e);
31
- }), /* @__PURE__ */ s(N, { className: "w-full min-w-[280px] max-w-md shadow-lg border-primary/20", children: [
32
- /* @__PURE__ */ t(b, { className: "pb-3", children: /* @__PURE__ */ s(y, { className: "text-sm font-medium text-muted-foreground flex items-center gap-2", children: [
33
- /* @__PURE__ */ t(d, { name: "activity", size: 14 }),
34
- "Signal Impact — ",
35
- a.toUpperCase()
36
- ] }) }),
37
- /* @__PURE__ */ s(C, { className: "pt-0", children: [
38
- l && /* @__PURE__ */ t("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ t(d, { name: "loader", size: 24, className: "animate-spin text-muted-foreground" }) }),
39
- o && /* @__PURE__ */ s("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [
40
- /* @__PURE__ */ t(d, { name: "alert-circle", size: 14, className: "mt-px shrink-0" }),
41
- /* @__PURE__ */ t("span", { children: o })
42
- ] }),
43
- !l && !o && i.size === 0 && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground py-2", children: [
44
- "No divergence readings yet for ",
45
- a.toUpperCase(),
46
- "."
47
- ] }),
48
- i.size > 0 && /* @__PURE__ */ t("div", { className: "space-y-2", children: Array.from(i.values()).map((e) => {
49
- var f;
50
- const r = e.score > 0, n = e.score === 0;
51
- return /* @__PURE__ */ s("div", { className: "rounded-md border border-border/60 bg-muted/20 p-2.5 space-y-1", children: [
52
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
53
- /* @__PURE__ */ t("span", { className: "text-xs font-semibold uppercase tracking-wide text-foreground", children: w[e.metric] }),
54
- /* @__PURE__ */ t(
55
- "span",
56
- {
57
- className: `text-xs font-mono font-semibold ${n ? "text-muted-foreground" : r ? "text-green-500" : "text-red-500"}`,
58
- children: n ? "—" : `${r ? "+" : ""}${e.score.toFixed(0)}`
59
- }
60
- )
61
- ] }),
62
- ((f = e.contributing_signals[0]) == null ? void 0 : f.reason) && /* @__PURE__ */ t("p", { className: "text-[10px] text-muted-foreground leading-relaxed", children: e.contributing_signals[0].reason })
63
- ] }, e.metric);
64
- }) })
65
- ] })
66
- ] });
67
- };
68
- export {
69
- k as DivergenceMetricsCard
70
- };
@@ -1,2 +0,0 @@
1
- export { DivergenceMetricsCard } from './DivergenceMetricsCard';
2
- export type { DivergenceMetricsCardProps } from './DivergenceMetricsCard';
@@ -1,27 +0,0 @@
1
- /**
2
- * @file LiveQuoteCard.tsx
3
- * @package @ramme-io/ui
4
- * @description AI-generated live stock quote component
5
- *
6
- * ARCHITECTURAL ROLE:
7
- * Renders real-time stock price and change percentage inside AI chat bubbles.
8
- * Fetches data from the Ramme Data Factory API's live_quotes table.
9
- */
10
- import React from 'react';
11
- interface LiveQuoteParams {
12
- ticker: string;
13
- }
14
- export interface LiveQuoteCardProps {
15
- /** Parameters from the LLM tool call */
16
- params: LiveQuoteParams;
17
- }
18
- /**
19
- * @wizard
20
- * @name LiveQuoteCard
21
- * @description AI-generated live stock quote card with real-time price data
22
- * @tags ai, stocks, quote, real-time, generative-ui
23
- * @category ai
24
- * @id live-quote-card
25
- */
26
- export declare const LiveQuoteCard: React.FC<LiveQuoteCardProps>;
27
- export {};
@@ -1,73 +0,0 @@
1
- import { jsxs as e, jsx as t } from "react/jsx-runtime";
2
- import { apiBaseUrl as g } from "../../../utils/apiBaseUrl.js";
3
- import { useState as c, useEffect as h } from "react";
4
- import { Card as N, CardHeader as b, CardTitle as v, CardContent as y } from "../../layout/Card.js";
5
- import { Icon as i } from "../../ui/Icon.js";
6
- const E = ({ params: u }) => {
7
- const { ticker: s } = u, [r, x] = c(null), [d, m] = c(!0), [o, l] = c(null);
8
- h(() => {
9
- (async () => {
10
- try {
11
- m(!0), l(null);
12
- const n = g(), p = await fetch(`${n}/companies/${s.toUpperCase()}/hydrate-quote`);
13
- if (!p.ok)
14
- throw new Error(`No quote data available for ${s.toUpperCase()}`);
15
- const f = await p.json();
16
- x(f);
17
- } catch (n) {
18
- l(n instanceof Error ? n.message : "Failed to fetch quote");
19
- } finally {
20
- m(!1);
21
- }
22
- })();
23
- }, [s]);
24
- const a = r && r.change_percent >= 0;
25
- return /* @__PURE__ */ e(N, { className: "w-full min-w-[280px] max-w-md shadow-lg border-primary/20", children: [
26
- /* @__PURE__ */ t(b, { className: "pb-3", children: /* @__PURE__ */ e(v, { className: "text-sm font-medium text-muted-foreground flex items-center gap-2", children: [
27
- /* @__PURE__ */ t(i, { name: "trending-up", size: 14 }),
28
- "Live Quote"
29
- ] }) }),
30
- /* @__PURE__ */ e(y, { className: "pt-0", children: [
31
- d && /* @__PURE__ */ t("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ t(i, { name: "loader", size: 24, className: "animate-spin text-muted-foreground" }) }),
32
- o && /* @__PURE__ */ e("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [
33
- /* @__PURE__ */ t(i, { name: "alert-circle", size: 14, className: "mt-px shrink-0" }),
34
- /* @__PURE__ */ t("span", { children: o })
35
- ] }),
36
- r && !d && !o && /* @__PURE__ */ e("div", { className: "space-y-3", children: [
37
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ t("span", { className: "px-2.5 py-1 rounded-md bg-primary/10 border border-primary/20 font-mono text-sm font-semibold text-primary", children: r.ticker }) }),
38
- /* @__PURE__ */ e("div", { className: "space-y-1", children: [
39
- /* @__PURE__ */ e("div", { className: "flex items-baseline gap-2", children: [
40
- /* @__PURE__ */ e("span", { className: "text-3xl font-bold font-mono text-foreground", children: [
41
- "$",
42
- r.price.toLocaleString("en-US", {
43
- minimumFractionDigits: 2,
44
- maximumFractionDigits: 2
45
- })
46
- ] }),
47
- /* @__PURE__ */ e("span", { className: `text-lg font-semibold ${a ? "text-green-500" : "text-red-500"}`, children: [
48
- a ? "+" : "",
49
- r.change_percent.toFixed(2),
50
- "%"
51
- ] })
52
- ] }),
53
- /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground font-mono", children: [
54
- "Updated: ",
55
- new Date(r.timestamp).toLocaleString("en-US", {
56
- month: "short",
57
- day: "numeric",
58
- hour: "2-digit",
59
- minute: "2-digit"
60
- })
61
- ] })
62
- ] }),
63
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2 pt-2 border-t border-border/40", children: /* @__PURE__ */ e("div", { className: `flex items-center gap-1.5 text-xs font-medium ${a ? "text-green-500" : "text-red-500"}`, children: [
64
- /* @__PURE__ */ t(i, { name: a ? "trending-up" : "trending-down", size: 14 }),
65
- /* @__PURE__ */ t("span", { children: a ? "Gaining" : "Declining" })
66
- ] }) })
67
- ] })
68
- ] })
69
- ] });
70
- };
71
- export {
72
- E as LiveQuoteCard
73
- };
@@ -1,2 +0,0 @@
1
- export { LiveQuoteCard } from './LiveQuoteCard';
2
- export type { LiveQuoteCardProps } from './LiveQuoteCard';
@@ -1,27 +0,0 @@
1
- /**
2
- * @file NewsSummaryCard.tsx
3
- * @package @ramme-io/ui
4
- * @description AI-generated news summary component
5
- *
6
- * ARCHITECTURAL ROLE:
7
- * Renders recent news headlines and sentiment scores inside AI chat bubbles.
8
- * Fetches data from the Ramme Data Factory API's signals table.
9
- */
10
- import React from 'react';
11
- interface NewsSummaryParams {
12
- ticker: string;
13
- }
14
- export interface NewsSummaryCardProps {
15
- /** Parameters from the LLM tool call */
16
- params: NewsSummaryParams;
17
- }
18
- /**
19
- * @wizard
20
- * @name NewsSummaryCard
21
- * @description AI-generated news summary card with recent headlines
22
- * @tags ai, news, sentiment, generative-ui
23
- * @category ai
24
- * @id news-summary-card
25
- */
26
- export declare const NewsSummaryCard: React.FC<NewsSummaryCardProps>;
27
- export {};
@@ -1,78 +0,0 @@
1
- import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
- import { apiBaseUrl as h } from "../../../utils/apiBaseUrl.js";
3
- import { useState as l, useEffect as g } from "react";
4
- import { Card as N, CardHeader as b, CardTitle as w, CardContent as y } from "../../layout/Card.js";
5
- import { Icon as a } from "../../ui/Icon.js";
6
- const _ = ({ params: f }) => {
7
- const { ticker: s } = f, [c, x] = l([]), [i, d] = l(!0), [n, m] = l(null);
8
- return g(() => {
9
- (async () => {
10
- try {
11
- d(!0), m(null);
12
- const o = h(), p = await fetch(`${o}/companies/${s.toUpperCase()}/news?limit=5`);
13
- if (!p.ok)
14
- throw new Error(`No news available for ${s.toUpperCase()}`);
15
- const u = await p.json();
16
- x(u);
17
- } catch (o) {
18
- m(o instanceof Error ? o.message : "Failed to fetch news");
19
- } finally {
20
- d(!1);
21
- }
22
- })();
23
- }, [s]), /* @__PURE__ */ t(N, { className: "w-full min-w-[320px] max-w-2xl shadow-lg border-primary/20", children: [
24
- /* @__PURE__ */ e(b, { className: "pb-3", children: /* @__PURE__ */ t(w, { className: "text-sm font-medium text-muted-foreground flex items-center gap-2", children: [
25
- /* @__PURE__ */ e(a, { name: "newspaper", size: 14 }),
26
- "Recent News · ",
27
- s.toUpperCase()
28
- ] }) }),
29
- /* @__PURE__ */ t(y, { className: "pt-0", children: [
30
- i && /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ e(a, { name: "loader", size: 24, className: "animate-spin text-muted-foreground" }) }),
31
- n && /* @__PURE__ */ t("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [
32
- /* @__PURE__ */ e(a, { name: "alert-circle", size: 14, className: "mt-px shrink-0" }),
33
- /* @__PURE__ */ e("span", { children: n })
34
- ] }),
35
- c.length === 0 && !i && !n && /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center py-8 gap-2 text-muted-foreground", children: [
36
- /* @__PURE__ */ e(a, { name: "inbox", size: 24, opacity: 0.5 }),
37
- /* @__PURE__ */ e("p", { className: "text-sm", children: "No recent news available" })
38
- ] }),
39
- c.length > 0 && !i && !n && /* @__PURE__ */ e("div", { className: "space-y-3", children: c.map((r) => /* @__PURE__ */ e(
40
- "div",
41
- {
42
- className: "border-b border-border/50 pb-3 last:border-0 last:pb-0",
43
- children: /* @__PURE__ */ t("div", { className: "flex items-start justify-between gap-2", children: [
44
- /* @__PURE__ */ t("div", { className: "flex-1 min-w-0", children: [
45
- r.url ? /* @__PURE__ */ e(
46
- "a",
47
- {
48
- href: r.url,
49
- target: "_blank",
50
- rel: "noopener noreferrer",
51
- className: "text-sm font-medium text-foreground hover:text-primary transition-colors line-clamp-2 block",
52
- children: r.description
53
- }
54
- ) : /* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground line-clamp-2", children: r.description }),
55
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2 mt-1.5", children: [
56
- /* @__PURE__ */ e("span", { className: "text-[10px] font-mono text-muted-foreground", children: new Date(r.created_at).toLocaleDateString("en-US", {
57
- month: "short",
58
- day: "numeric",
59
- year: "numeric"
60
- }) }),
61
- /* @__PURE__ */ t("span", { className: `text-[10px] font-medium px-1.5 py-0.5 rounded ${r.impact_score >= 7 ? "bg-red-500/10 text-red-400 ring-1 ring-red-500/20" : r.impact_score >= 5 ? "bg-amber-500/10 text-amber-400 ring-1 ring-amber-500/20" : "bg-muted/50 text-muted-foreground"}`, children: [
62
- "Impact: ",
63
- r.impact_score,
64
- "/10"
65
- ] })
66
- ] })
67
- ] }),
68
- r.url && /* @__PURE__ */ e(a, { name: "external-link", size: 12, className: "text-muted-foreground/50 flex-shrink-0 mt-0.5" })
69
- ] })
70
- },
71
- r.id
72
- )) })
73
- ] })
74
- ] });
75
- };
76
- export {
77
- _ as NewsSummaryCard
78
- };
@@ -1,2 +0,0 @@
1
- export { NewsSummaryCard } from './NewsSummaryCard';
2
- export type { NewsSummaryCardProps } from './NewsSummaryCard';
@@ -1,34 +0,0 @@
1
- /**
2
- * @file StockChart.tsx
3
- * @package @ramme-io/ui
4
- * @description AI-generated financial chart component
5
- *
6
- * ARCHITECTURAL ROLE:
7
- * Renders an interactive Bloomberg-style financial chart inside AI chat bubbles.
8
- * Uses recharts directly (ComposedChart) to display price and volume data.
9
- * Generates realistic mock stock data for testing before real market data integration.
10
- */
11
- import React from 'react';
12
- interface StockChartParams {
13
- ticker: string;
14
- timeRange: '1D' | '1W' | '1M' | '1Y';
15
- metrics: string[];
16
- }
17
- export interface StockChartProps {
18
- /** Parameters from the LLM tool call */
19
- params: StockChartParams;
20
- /** Optional title override (defaults to auto-generated from params) */
21
- title?: string;
22
- /** Optional data override (for testing or real market data) */
23
- data?: Array<Record<string, any>>;
24
- }
25
- /**
26
- * @wizard
27
- * @name StockChart
28
- * @description AI-generated financial chart component with Bloomberg-style theming
29
- * @tags ai, charts, finance, stocks, generative-ui
30
- * @category ai
31
- * @id stock-chart
32
- */
33
- export declare const StockChart: React.FC<StockChartProps>;
34
- export {};