@photon-ai/pho-ui 4.18.6 → 4.20.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.
@@ -1,49 +1,49 @@
1
1
  "use client";
2
- import { t as r } from "./cn-CPbhpG1q.js";
2
+ import { t as e } from "./cn-CPbhpG1q.js";
3
3
  import "react";
4
- import { jsx as e } from "react/jsx-runtime";
4
+ import { jsx as r } from "react/jsx-runtime";
5
5
  var i = "border-pho-secondary bg-pho-primary overflow-hidden rounded-lg border";
6
6
  function n({ className: t, ...a }) {
7
- return /* @__PURE__ */ e("div", {
8
- className: r(i, "flex flex-col gap-4 pt-5 pb-4", "has-[>[data-stat-group]:first-child]:pt-0 has-[>[data-stat]:first-child]:pt-0", "has-[>[data-stat-group]:last-child]:pb-0 has-[>[data-stat]:last-child]:pb-0", "has-[>:first-child:has([data-chart])]:pt-0", t),
7
+ return /* @__PURE__ */ r("div", {
8
+ className: e(i, "flex flex-col gap-4 pt-5 pb-4", "has-[>[data-stat-group]:first-child]:pt-0 has-[>[data-stat]:first-child]:pt-0", "has-[>[data-stat-group]:last-child]:pb-0 has-[>[data-stat]:last-child]:pb-0", "has-[>:first-child:has([data-chart])]:pt-0", t),
9
9
  ...a
10
10
  });
11
11
  }
12
12
  function o({ className: t, ...a }) {
13
- return /* @__PURE__ */ e("div", {
14
- className: r("grid grid-cols-[minmax(0,1fr)_minmax(0,auto)] items-baseline gap-x-4 gap-y-0 px-5", t),
13
+ return /* @__PURE__ */ r("div", {
14
+ className: e("grid grid-cols-[minmax(0,1fr)_minmax(0,auto)] items-baseline gap-x-4 gap-y-0 px-5", t),
15
15
  ...a
16
16
  });
17
17
  }
18
18
  function d({ className: t, children: a, ...s }) {
19
- return /* @__PURE__ */ e("h3", {
20
- className: r("text-display-xs text-pho-primary min-w-0 font-medium", t),
19
+ return /* @__PURE__ */ r("h3", {
20
+ className: e("font-heading text-display-xs text-pho-primary min-w-0 font-medium", t),
21
21
  ...s,
22
22
  children: a
23
23
  });
24
24
  }
25
25
  function p({ className: t, ...a }) {
26
- return /* @__PURE__ */ e("div", {
26
+ return /* @__PURE__ */ r("div", {
27
27
  "data-card-value": "",
28
- className: r("text-display-sm text-pho-primary min-w-0 justify-self-end truncate font-medium tabular-nums", t),
28
+ className: e("font-heading text-display-sm text-pho-primary min-w-0 justify-self-end truncate font-medium tabular-nums", t),
29
29
  ...a
30
30
  });
31
31
  }
32
32
  function l({ className: t, ...a }) {
33
- return /* @__PURE__ */ e("p", {
34
- className: r("text-pho-description text-display-xs col-span-2 font-normal", t),
33
+ return /* @__PURE__ */ r("p", {
34
+ className: e("text-pho-description text-display-xs col-span-2 font-normal", t),
35
35
  ...a
36
36
  });
37
37
  }
38
38
  function c({ className: t, ...a }) {
39
- return /* @__PURE__ */ e("div", {
40
- className: r("px-5", t),
39
+ return /* @__PURE__ */ r("div", {
40
+ className: e("px-5", t),
41
41
  ...a
42
42
  });
43
43
  }
44
44
  function m({ className: t, ...a }) {
45
- return /* @__PURE__ */ e("div", {
46
- className: r("flex items-center gap-2 px-5", t),
45
+ return /* @__PURE__ */ r("div", {
46
+ className: e("flex items-center gap-2 px-5", t),
47
47
  ...a
48
48
  });
49
49
  }
@@ -61,4 +61,4 @@ export {
61
61
  i as t
62
62
  };
63
63
 
64
- //# sourceMappingURL=card-zyRAihYE.js.map
64
+ //# sourceMappingURL=card-Bg2V2B0x.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-Bg2V2B0x.js","names":["cn","jsx","CARD_SURFACE","Root","className","props","Header","Title","children","Value","Description","Content","Footer","Card"],"sources":["../../src/components/card/card.tsx"],"sourcesContent":["import { type ComponentProps, type Ref } from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/**\n * Design notes:\n * - A card is a flat bordered panel on the page surface — hairline border,\n * primary background, no shadow. Elevation shadows stay on floating layers\n * (menus, dialogs); see the same rule on Input and Select.\n * - Radius sits at the `lg` stop (16px) like Dialog — a standalone content\n * panel reads bigger than a control, so it takes the panel radius rather\n * than the control default (`base`). `overflow-hidden` clips with it:\n * a flush `Stat.Group` (opaque tiles, `pt-0`) would otherwise paint\n * square over the curve. The same clip is what makes an edge-to-edge\n * image or table follow the panel, the way `BasicPage.Card` already does.\n * - Vertical rhythm: `pt-5` / `pb-4`, `gap-4` between parts. Parts carry\n * `px-5`, so a child without padding (an image, a table, a `Separator`)\n * runs edge-to-edge on its own. A `Stat` / `Stat.Group` already pads\n * its tiles — when it is the first or last child the matching inset\n * drops so the row sits flush on the card edge. A chart as the first\n * child drops the top inset the same way; the plot keeps its own\n * bottom band.\n * - No size or color axes. A card is chrome, not a signal — content sets the\n * tone. Sizing belongs to the layout that places the card.\n */\n\n/** Surface chrome — exported for hosts that need the look on another element. */\nexport const CARD_SURFACE =\n \"border-pho-secondary bg-pho-primary overflow-hidden rounded-lg border\";\n\n/** The panel: bordered surface, vertical rhythm between parts. */\nfunction Root({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div\n className={cn(\n CARD_SURFACE,\n \"flex flex-col gap-4 pt-5 pb-4\",\n // Stat tiles pad themselves; a chart's plot already insets.\n \"has-[>[data-stat-group]:first-child]:pt-0 has-[>[data-stat]:first-child]:pt-0\",\n \"has-[>[data-stat-group]:last-child]:pb-0 has-[>[data-stat]:last-child]:pb-0\",\n \"has-[>:first-child:has([data-chart])]:pt-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Title row + optional description. The title and a trailing `Value`\n * share the first line; the description sits on the next with no row\n * gap — title and subtitle read as one block.\n */\nfunction Header({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div\n className={cn(\n \"grid grid-cols-[minmax(0,1fr)_minmax(0,auto)] items-baseline gap-x-4 gap-y-0 px-5\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Card heading — an `<h3>` so it nests under page (`h1`) and section (`h2`)\n * headings without skipping levels.\n */\nfunction Title({\n className,\n children,\n ...props\n}: ComponentProps<\"h3\"> & { ref?: Ref<HTMLHeadingElement> }) {\n return (\n <h3\n className={cn(\n \"font-heading text-display-xs text-pho-primary min-w-0 font-medium\",\n className,\n )}\n {...props}\n >\n {children}\n </h3>\n );\n}\n\n/**\n * A count or figure at the end of the title row. One display step above\n * the title, primary ink — the number is the loud thing on the line.\n */\nfunction Value({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div\n data-card-value=\"\"\n className={cn(\n \"font-heading text-display-sm text-pho-primary min-w-0 justify-self-end truncate font-medium tabular-nums\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Supporting copy under the title — Dialog's description: same step, description ink. */\nfunction Description({\n className,\n ...props\n}: ComponentProps<\"p\"> & { ref?: Ref<HTMLParagraphElement> }) {\n return (\n <p\n className={cn(\n \"text-pho-description text-display-xs col-span-2 font-normal\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** The card body. Carries the horizontal padding; bring your own layout. */\nfunction Content({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return <div className={cn(\"px-5\", className)} {...props} />;\n}\n\n/**\n * Trailing row — actions, a status line. Unopinionated about justification;\n * add `justify-end` for a dialog-style action bar.\n */\nfunction Footer({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div className={cn(\"flex items-center gap-2 px-5\", className)} {...props} />\n );\n}\n\n/**\n * Card — a bordered content panel: header (title + description), body,\n * optional footer. It's static chrome with no interactivity of its own.\n * For a label/control list use `BasicPage.Card`; for a featured\n * block on the page surface use `BasicPage.Callout`.\n *\n * ```tsx\n * <Card.Root>\n * <Card.Header>\n * <Card.Title>Usage</Card.Title>\n * <Card.Value>1.2k</Card.Value>\n * <Card.Description>Since Aug 1.</Card.Description>\n * </Card.Header>\n * <Card.Content>…</Card.Content>\n * <Card.Footer className=\"justify-end\">\n * <Button size=\"sm\">Upgrade</Button>\n * </Card.Footer>\n * </Card.Root>\n * ```\n */\nexport const Card = {\n Root,\n Header,\n Title,\n Value,\n Description,\n Content,\n Footer,\n};\n"],"mappings":";;;;AA0BA,IAAaE,IACX;AAGF,SAASC,EAAK,EACZ,WAAAC,GACA,GAAGC,EAAA,GACqD;AACxD,SACE,gBAAAJ,EAAC,OAAD;AAAA,IACE,WAAWD,EACTE,GACA,iCAEA,iFACA,+EACA,8CACAE,CACF;AAAA,IACA,GAAIC;AAAA,EACL,CAAA;AAEL;AAOA,SAASC,EAAO,EACd,WAAAF,GACA,GAAGC,EAAA,GACqD;AACxD,SACE,gBAAAJ,EAAC,OAAD;AAAA,IACE,WAAWD,EACT,qFACAI,CACF;AAAA,IACA,GAAIC;AAAA,EACL,CAAA;AAEL;AAMA,SAASE,EAAM,EACb,WAAAH,GACA,UAAAI,GACA,GAAGH,EAAA,GACwD;AAC3D,SACE,gBAAAJ,EAAC,MAAD;AAAA,IACE,WAAWD,EACT,qEACAI,CACF;AAAA,IACA,GAAIC;AAAA,IAEH,UAAAG;AAAA,EACC,CAAA;AAER;AAMA,SAASC,EAAM,EACb,WAAAL,GACA,GAAGC,EAAA,GACqD;AACxD,SACE,gBAAAJ,EAAC,OAAD;AAAA,IACE,mBAAgB;AAAA,IAChB,WAAWD,EACT,4GACAI,CACF;AAAA,IACA,GAAIC;AAAA,EACL,CAAA;AAEL;AAGA,SAASK,EAAY,EACnB,WAAAN,GACA,GAAGC,EAAA,GACyD;AAC5D,SACE,gBAAAJ,EAAC,KAAD;AAAA,IACE,WAAWD,EACT,+DACAI,CACF;AAAA,IACA,GAAIC;AAAA,EACL,CAAA;AAEL;AAGA,SAASM,EAAQ,EACf,WAAAP,GACA,GAAGC,EAAA,GACqD;AACxD,SAAO,gBAAAJ,EAAC,OAAD;AAAA,IAAK,WAAWD,EAAG,QAAQI,CAAS;AAAA,IAAG,GAAIC;AAAA,EAAQ,CAAA;AAC5D;AAMA,SAASO,EAAO,EACd,WAAAR,GACA,GAAGC,EAAA,GACqD;AACxD,SACE,gBAAAJ,EAAC,OAAD;AAAA,IAAK,WAAWD,EAAG,gCAAgCI,CAAS;AAAA,IAAG,GAAIC;AAAA,EAAQ,CAAA;AAE/E;AAsBA,IAAaQ,IAAO;AAAA,EAClB,MAAAV;AAAA,EACA,QAAAG;AAAA,EACA,OAAAC;AAAA,EACA,OAAAE;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AACF"}
@@ -1,14 +1,15 @@
1
1
  "use client";
2
- import { t as h } from "./cn-CPbhpG1q.js";
3
- import { a as x, o as R } from "./button-CLfWdqm-.js";
2
+ import { t as p } from "./cn-CPbhpG1q.js";
3
+ import { a as E, o as R } from "./button-CLfWdqm-.js";
4
4
  import { t as C } from "./createReactComponent-yKZn9MIX.js";
5
5
  import { t as S } from "./IconInfoCircle-CTAynhe8.js";
6
6
  import { t as g } from "./IconAlertCircleFilled-D6mUlVaE.js";
7
+ import { t as A } from "./IconAlertTriangleFilled-QV-gsVQW.js";
7
8
  import { t as l } from "./popover-B0NBrYV5.js";
8
9
  import { i as _ } from "./status-view-I_Y6eEyX.js";
9
- import { useEffect as A, useRef as P, useState as L } from "react";
10
- import { Fragment as c, jsx as n, jsxs as s } from "react/jsx-runtime";
11
- var k = [
10
+ import { useEffect as P, useRef as L, useState as k } from "react";
11
+ import { Fragment as c, jsx as r, jsxs as s } from "react/jsx-runtime";
12
+ var z = [
12
13
  ["path", {
13
14
  d: "M12 9v4",
14
15
  key: "svg-0"
@@ -21,23 +22,23 @@ var k = [
21
22
  d: "M12 16h.01",
22
23
  key: "svg-2"
23
24
  }]
24
- ], z = C("outline", "alert-triangle", "AlertTriangle", k);
25
- function m(t) {
25
+ ], D = C("outline", "alert-triangle", "AlertTriangle", z);
26
+ function f(t) {
26
27
  if (typeof t != "object" || t === null) return !1;
27
28
  const e = t;
28
29
  return typeof e.title == "string" && typeof e.status == "number" && Number.isInteger(e.status) && e.status >= 400 && e.status <= 599 && (e.code === void 0 || typeof e.code == "string");
29
30
  }
30
- function D(t) {
31
+ function F(t) {
31
32
  let e = t;
32
- for (let r = 0; r < 8 && typeof e == "object" && e !== null; r++) {
33
- if (m(e)) return e;
33
+ for (let n = 0; n < 8 && typeof e == "object" && e !== null; n++) {
34
+ if (f(e)) return e;
34
35
  const i = e.problem;
35
- if (m(i)) return i;
36
+ if (f(i)) return i;
36
37
  e = e.cause;
37
38
  }
38
39
  return null;
39
40
  }
40
- var $ = "Something went wrong.", f = {
41
+ var $ = "Something went wrong.", h = {
41
42
  400: "Bad Request",
42
43
  401: "Unauthorized",
43
44
  403: "Forbidden",
@@ -76,29 +77,29 @@ function B(t) {
76
77
  return typeof t.code == "string" && t.code !== "";
77
78
  }
78
79
  function v(t, e) {
79
- if (f[t]) return f[t];
80
+ if (h[t]) return h[t];
80
81
  if (e && e !== "Something went wrong." && e !== "Request failed") return e.replace(/\.$/, "");
81
82
  }
82
- function F(t) {
83
+ function U(t) {
83
84
  return j[t] ?? "The request failed with an unexpected status.";
84
85
  }
85
86
  function u(t) {
86
87
  if (!t) return t;
87
- const e = t.charAt(0), r = e.toUpperCase();
88
- return e === r ? t : r + t.slice(1);
88
+ const e = t.charAt(0), n = e.toUpperCase();
89
+ return e === n ? t : n + t.slice(1);
89
90
  }
90
91
  function y(t) {
91
- const e = D(t);
92
+ const e = F(t);
92
93
  if (e == null) return { title: $ };
93
- const r = [e.detail, e.remediation?.action].filter((i) => typeof i == "string" && i !== "").join(" ") || void 0;
94
- return !B(e) && r == null ? {
94
+ const n = [e.detail, e.remediation?.action].filter((i) => typeof i == "string" && i !== "").join(" ") || void 0;
95
+ return !B(e) && n == null ? {
95
96
  title: u(v(e.status, e.title) ?? "Something went wrong."),
96
- description: F(e.status),
97
+ description: U(e.status),
97
98
  requestId: e.requestId,
98
99
  problem: e
99
100
  } : {
100
101
  title: u(e.title || "Something went wrong."),
101
- description: r ? u(r) : void 0,
102
+ description: n ? u(n) : void 0,
102
103
  documentation: e.remediation?.documentation,
103
104
  requestId: e.requestId,
104
105
  problem: e
@@ -107,23 +108,23 @@ function y(t) {
107
108
  function d(t) {
108
109
  return typeof t == "string" ? u(t) : t;
109
110
  }
110
- var T = "Learn more", U = "Try again";
111
- function M({ error: t, children: e, className: r, ...i }) {
111
+ var T = "Learn more", M = "Try again";
112
+ function O({ error: t, children: e, className: n, ...i }) {
112
113
  if (t == null && e == null) return null;
113
114
  const o = y(t);
114
115
  return /* @__PURE__ */ s("div", {
115
116
  role: "alert",
116
- className: h("text-pho-error flex min-w-0 items-start gap-1.5 text-base", r),
117
+ className: p("text-pho-error flex min-w-0 items-start gap-1.5 text-base", n),
117
118
  ...i,
118
- children: [/* @__PURE__ */ n("span", {
119
+ children: [/* @__PURE__ */ r("span", {
119
120
  "aria-hidden": !0,
120
121
  className: "flex h-[1lh] shrink-0 items-center",
121
- children: /* @__PURE__ */ n(g, { className: "size-4" })
122
+ children: /* @__PURE__ */ r(g, { className: "size-4" })
122
123
  }), /* @__PURE__ */ s("span", {
123
124
  className: "min-w-0",
124
125
  children: [
125
126
  d(e ?? o.description ?? o.title),
126
- o.documentation != null && /* @__PURE__ */ s(c, { children: [" ", /* @__PURE__ */ n("a", {
127
+ o.documentation != null && /* @__PURE__ */ s(c, { children: [" ", /* @__PURE__ */ r("a", {
127
128
  href: o.documentation,
128
129
  target: "_blank",
129
130
  rel: "noreferrer",
@@ -131,15 +132,31 @@ function M({ error: t, children: e, className: r, ...i }) {
131
132
  children: T
132
133
  })] }),
133
134
  " ",
134
- /* @__PURE__ */ n(O, { copy: o })
135
+ /* @__PURE__ */ r(H, { copy: o })
135
136
  ]
136
137
  })]
137
138
  });
138
139
  }
139
- M.displayName = "Error";
140
- function O({ copy: t }) {
141
- const { problem: e, requestId: r } = t;
142
- if (e == null && r == null) return null;
140
+ O.displayName = "Error";
141
+ function G({ children: t, className: e, ...n }) {
142
+ const i = t != null && t !== !1 && t !== "";
143
+ return /* @__PURE__ */ r("output", {
144
+ className: i ? p("text-pho-warning flex min-w-0 items-start gap-1.5 text-base", e) : "sr-only",
145
+ ...n,
146
+ children: i && /* @__PURE__ */ s(c, { children: [/* @__PURE__ */ r("span", {
147
+ "aria-hidden": !0,
148
+ className: "flex h-[1lh] shrink-0 items-center",
149
+ children: /* @__PURE__ */ r(A, { className: "size-4" })
150
+ }), /* @__PURE__ */ r("span", {
151
+ className: "min-w-0",
152
+ children: d(t)
153
+ })] })
154
+ });
155
+ }
156
+ G.displayName = "Warning";
157
+ function H({ copy: t }) {
158
+ const { problem: e, requestId: n } = t;
159
+ if (e == null && n == null) return null;
143
160
  let i = null;
144
161
  if (e != null)
145
162
  if (e.code) i = `${e.status} ${e.code}`;
@@ -147,33 +164,33 @@ function O({ copy: t }) {
147
164
  const o = v(e.status, e.title);
148
165
  i = o ? `${e.status} ${o}` : String(e.status);
149
166
  }
150
- return /* @__PURE__ */ s(l.Root, { children: [/* @__PURE__ */ n(l.Trigger, {
167
+ return /* @__PURE__ */ s(l.Root, { children: [/* @__PURE__ */ r(l.Trigger, {
151
168
  openOnHover: !0,
152
169
  delay: 150,
153
170
  "aria-label": "Error details",
154
171
  className: "outline-pho-brand inline-flex size-4 shrink-0 translate-y-[3px] cursor-help items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-2",
155
- children: /* @__PURE__ */ n(S, { className: "size-3.5" })
156
- }), /* @__PURE__ */ n(l.Portal, { children: /* @__PURE__ */ n(l.Positioner, {
172
+ children: /* @__PURE__ */ r(S, { className: "size-3.5" })
173
+ }), /* @__PURE__ */ r(l.Portal, { children: /* @__PURE__ */ r(l.Positioner, {
157
174
  align: "start",
158
175
  children: /* @__PURE__ */ s(l.Popup, {
159
176
  className: "text-pho-error",
160
177
  children: [
161
178
  /* @__PURE__ */ s(l.Title, {
162
179
  className: "text-pho-error flex items-start gap-1.5",
163
- children: [/* @__PURE__ */ n("span", {
180
+ children: [/* @__PURE__ */ r("span", {
164
181
  "aria-hidden": !0,
165
182
  className: "flex h-[1lh] shrink-0 items-center",
166
- children: /* @__PURE__ */ n(g, { className: "size-4" })
183
+ children: /* @__PURE__ */ r(g, { className: "size-4" })
167
184
  }), t.title]
168
185
  }),
169
- t.description != null && /* @__PURE__ */ n(l.Description, {
186
+ t.description != null && /* @__PURE__ */ r(l.Description, {
170
187
  className: "text-pho-error",
171
188
  children: t.description
172
189
  }),
173
- (i != null || r != null) && /* @__PURE__ */ s("div", {
190
+ (i != null || n != null) && /* @__PURE__ */ s("div", {
174
191
  className: "text-pho-error mt-1 font-mono text-[10px] leading-snug",
175
- children: [i != null && /* @__PURE__ */ n("p", { children: i }), r != null && /* @__PURE__ */ n(b, {
176
- requestId: r,
192
+ children: [i != null && /* @__PURE__ */ r("p", { children: i }), n != null && /* @__PURE__ */ r(b, {
193
+ requestId: n,
177
194
  className: "mt-0"
178
195
  })]
179
196
  })
@@ -182,18 +199,18 @@ function O({ copy: t }) {
182
199
  }) })] });
183
200
  }
184
201
  function b({ requestId: t, className: e }) {
185
- const [r, i] = L(!1), o = P(null);
186
- return A(() => () => {
202
+ const [n, i] = k(!1), o = L(null);
203
+ return P(() => () => {
187
204
  o.current && clearTimeout(o.current);
188
205
  }, []), /* @__PURE__ */ s("span", {
189
- className: h("mt-1 block font-mono text-[10px] leading-snug", e),
206
+ className: p("mt-1 block font-mono text-[10px] leading-snug", e),
190
207
  children: [
191
208
  "Request ID:",
192
209
  " ",
193
- /* @__PURE__ */ n("button", {
210
+ /* @__PURE__ */ r("button", {
194
211
  type: "button",
195
212
  className: "outline-pho-brand inline cursor-pointer underline-offset-2 select-all hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:-outline-offset-1",
196
- "aria-label": r ? "Request ID copied" : `Copy request ID ${t}`,
213
+ "aria-label": n ? "Request ID copied" : `Copy request ID ${t}`,
197
214
  onClick: async () => {
198
215
  try {
199
216
  await navigator.clipboard.writeText(t);
@@ -204,21 +221,21 @@ function b({ requestId: t, className: e }) {
204
221
  },
205
222
  children: t
206
223
  }),
207
- /* @__PURE__ */ n("output", {
224
+ /* @__PURE__ */ r("output", {
208
225
  className: "sr-only",
209
226
  "aria-live": "polite",
210
- children: r ? "Copied" : ""
227
+ children: n ? "Copied" : ""
211
228
  })
212
229
  ]
213
230
  });
214
231
  }
215
- function G({ error: t, title: e, description: r, icon: i, onRetry: o, actions: N, size: w = "base", ...q }) {
232
+ function V({ error: t, title: e, description: n, icon: i, onRetry: o, actions: N, size: w = "base", ...x }) {
216
233
  if (t == null && e == null) return null;
217
- const a = y(t), p = d(r ?? a.description), I = p != null || a.requestId != null ? /* @__PURE__ */ s(c, { children: [p, a.requestId != null && /* @__PURE__ */ n(b, { requestId: a.requestId })] }) : void 0, E = N ?? (o != null || a.documentation != null ? /* @__PURE__ */ s(c, { children: [o != null && /* @__PURE__ */ n(x, {
234
+ const a = y(t), m = d(n ?? a.description), q = m != null || a.requestId != null ? /* @__PURE__ */ s(c, { children: [m, a.requestId != null && /* @__PURE__ */ r(b, { requestId: a.requestId })] }) : void 0, I = N ?? (o != null || a.documentation != null ? /* @__PURE__ */ s(c, { children: [o != null && /* @__PURE__ */ r(E, {
218
235
  size: "sm",
219
236
  onClick: o,
220
- children: U
221
- }), a.documentation != null && /* @__PURE__ */ n(R, {
237
+ children: M
238
+ }), a.documentation != null && /* @__PURE__ */ r(R, {
222
239
  size: "sm",
223
240
  variant: "outlined",
224
241
  href: a.documentation,
@@ -226,27 +243,28 @@ function G({ error: t, title: e, description: r, icon: i, onRetry: o, actions: N
226
243
  rel: "noreferrer",
227
244
  children: T
228
245
  })] }) : void 0);
229
- return /* @__PURE__ */ n(_, {
246
+ return /* @__PURE__ */ r(_, {
230
247
  role: "alert",
231
248
  size: w,
232
- icon: i ?? /* @__PURE__ */ n(z, {}),
249
+ icon: i ?? /* @__PURE__ */ r(D, {}),
233
250
  title: d(e ?? a.title),
234
- description: I,
235
- actions: E,
236
- ...q
251
+ description: q,
252
+ actions: I,
253
+ ...x
237
254
  });
238
255
  }
239
- G.displayName = "ErrorView";
256
+ V.displayName = "ErrorView";
240
257
  export {
241
- y as a,
242
- m as c,
243
- u as i,
244
- D as l,
245
- G as n,
246
- v as o,
247
- $ as r,
248
- F as s,
249
- M as t
258
+ u as a,
259
+ U as c,
260
+ $ as i,
261
+ f as l,
262
+ V as n,
263
+ y as o,
264
+ G as r,
265
+ v as s,
266
+ O as t,
267
+ F as u
250
268
  };
251
269
 
252
- //# sourceMappingURL=error-yAVi4cBu.js.map
270
+ //# sourceMappingURL=error-BObcQClz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-BObcQClz.js","names":["_Fragment","cn","Button","ButtonLink","createReactComponent","IconInfoCircle","IconAlertCircleFilled","IconAlertTriangleFilled","Popover","StatusView","useEffect","useRef","useState","Fragment$1","jsx","jsxs","__iconNode","IconAlertTriangle","isProblem","value","v","parseProblem","error","current","depth","carried","GENERIC_ERROR_TITLE","HTTP_REASON_PHRASE","HTTP_STATUS_EXPLANATION","hasContractCode","problem","httpReasonPhrase","status","fallbackTitle","httpStatusExplanation","capitalizeFirst","text","first","upper","describeError","description","part","displayCopy","DOC_LINK_LABEL","RETRY_LABEL","Error","children","className","props","copy","ErrorDetails","Warning","shown","requestId","statusLine","reason","RequestId","copied","setCopied","copiedTimer","ErrorView","title","icon","onRetry","actions","size","resolvedDescription","body","resolvedActions"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.mjs","../../src/components/error/problem.ts","../../src/components/error/error.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M12 9v4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M12 16h.01\", \"key\": \"svg-2\" }]];\nconst IconAlertTriangle = createReactComponent(\"outline\", \"alert-triangle\", \"AlertTriangle\", __iconNode);\n\nexport { __iconNode, IconAlertTriangle as default };\n","/**\n * Client-side mirror of the `@photon-hq/error` response contract — the\n * RFC 9457 Problem Details body every Photon service returns for 4xx / 5xx.\n * Machine logic branches on `code`; `title` / `detail` / `remediation` are\n * the human-readable copy, already reviewed server-side and safe to render.\n *\n * Fetch layers may also hand us a thin status-only shape when the response\n * was not ok but the body was not a contract problem — `title` + `status`\n * still count so the UI can disclose the HTTP code we already know.\n */\n\nexport interface ProblemRemediation {\n /** What the user can do about it — a full sentence. */\n action?: string;\n /** Docs URL explaining the problem. */\n documentation?: string;\n}\n\nexport interface Problem {\n /** Stable machine-readable key (`RATE_LIMITED`) — the field to branch on. */\n code?: string;\n /** Human summary of the problem type (\"Too Many Requests\"). */\n title: string;\n /** HTTP status (4xx / 5xx). */\n status: number;\n /** Problem type URI (`urn:photon:problem:*` or an https URL). */\n type?: string;\n /** Occurrence-specific human sentence. */\n detail?: string;\n /** Correlation id for support (`X-Request-ID`). */\n requestId?: string;\n remediation?: ProblemRemediation;\n /** RFC 9457 extensions (`issues`, `actualVersion`, …). */\n [extension: string]: unknown;\n}\n\n/** Structural check: `title` + a 4xx/5xx status. `code` is optional. */\nexport function isProblem(value: unknown): value is Problem {\n if (typeof value !== \"object\" || value === null) return false;\n const v = value as Record<string, unknown>;\n return (\n typeof v.title === \"string\" &&\n typeof v.status === \"number\" &&\n Number.isInteger(v.status) &&\n v.status >= 400 &&\n v.status <= 599 &&\n (v.code === undefined || typeof v.code === \"string\")\n );\n}\n\n/**\n * Find the problem a caught value carries — the value itself, one typed onto\n * an error as a `problem` field (dashboard's `ApiError` shape), or one\n * wrapped in an `Error` `cause` chain (how fetch layers usually rethrow a\n * parsed body). Returns `null` when there is none.\n */\nexport function parseProblem(error: unknown): Problem | null {\n let current: unknown = error;\n for (\n let depth = 0;\n depth < 8 && typeof current === \"object\" && current !== null;\n depth++\n ) {\n if (isProblem(current)) return current;\n const carried = (current as { problem?: unknown }).problem;\n if (isProblem(carried)) return carried;\n current = (current as { cause?: unknown }).cause;\n }\n return null;\n}\n\nexport interface ErrorDescription {\n /** Short name of the failure — the problem `title`, or a generic fallback. */\n title: string;\n /** Sentence(s) to show — `detail` and `remediation.action` joined. */\n description?: string;\n /** Docs URL from `remediation.documentation`. */\n documentation?: string;\n /** Correlation id for support. */\n requestId?: string;\n /** The matched problem, when the input carried one. */\n problem?: Problem;\n}\n\n/**\n * Anything that isn't a problem renders as this — raw `Error` messages are\n * not contract copy and never shown (the same fail-closed stance as the\n * server side of `@photon-hq/error`). Always a full sentence (trailing\n * period).\n */\nexport const GENERIC_ERROR_TITLE = \"Something went wrong.\";\n\n/** Standard reason phrases for statuses we commonly surface without a body. */\nconst HTTP_REASON_PHRASE: Record<number, string> = {\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 408: \"Request Timeout\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 413: \"Payload Too Large\",\n 415: \"Unsupported Media Type\",\n 422: \"Unprocessable Entity\",\n 429: \"Too Many Requests\",\n 500: \"Internal Server Error\",\n 501: \"Not Implemented\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n 504: \"Gateway Timeout\",\n};\n\n/** One-sentence explanations when the server gave a status but no problem copy. */\nconst HTTP_STATUS_EXPLANATION: Record<number, string> = {\n 400: \"The request was malformed or incomplete.\",\n 401: \"You need to sign in again.\",\n 403: \"You don't have permission to do that.\",\n 404: \"The requested resource was not found.\",\n 408: \"The request timed out before the server responded.\",\n 409: \"The request conflicts with the current state.\",\n 410: \"That resource is no longer available.\",\n 413: \"The request was too large for the server to accept.\",\n 415: \"That media type isn't supported.\",\n 422: \"The request was understood but couldn't be processed.\",\n 429: \"Request rate limit exceeded. Wait a moment before trying again.\",\n 500: \"The server hit an unexpected error.\",\n 501: \"The server doesn't support that operation.\",\n 502: \"The gateway got an invalid response from an upstream server.\",\n 503: \"The service is temporarily unavailable.\",\n 504: \"The gateway timed out waiting for an upstream server.\",\n};\n\nfunction hasContractCode(problem: Problem): boolean {\n return typeof problem.code === \"string\" && problem.code !== \"\";\n}\n\n/** Reason phrase for a status — map first, then a non-generic `problem.title`. */\nexport function httpReasonPhrase(\n status: number,\n fallbackTitle?: string,\n): string | undefined {\n if (HTTP_REASON_PHRASE[status]) return HTTP_REASON_PHRASE[status];\n if (\n fallbackTitle &&\n fallbackTitle !== GENERIC_ERROR_TITLE &&\n fallbackTitle !== \"Request failed\"\n ) {\n return fallbackTitle.replace(/\\.$/, \"\");\n }\n return undefined;\n}\n\n/** Human sentence for a bare HTTP status, when the body carried no copy. */\nexport function httpStatusExplanation(status: number): string {\n return (\n HTTP_STATUS_EXPLANATION[status] ??\n \"The request failed with an unexpected status.\"\n );\n}\n\n/**\n * Sentence-case the first character. Server `detail` / `title` sometimes\n * arrive fully lowercase; UI copy always leads with a capital.\n */\nexport function capitalizeFirst(text: string): string {\n if (!text) return text;\n const first = text.charAt(0);\n const upper = first.toUpperCase();\n if (first === upper) return text;\n return upper + text.slice(1);\n}\n\n/**\n * Turn a caught value into displayable copy. `Error` and `ErrorView` call\n * this internally; use it directly for other surfaces (a toast, a banner).\n *\n * Status-only failures (HTTP not ok, but no contract `code` / copy) still\n * keep `problem` so the details panel can show the status. Title becomes the\n * reason phrase (e.g. \"Bad Gateway\"); description is a short explanation —\n * not just the numeric code.\n */\nexport function describeError(error: unknown): ErrorDescription {\n const problem = parseProblem(error);\n if (problem == null) return { title: GENERIC_ERROR_TITLE };\n\n const description =\n [problem.detail, problem.remediation?.action]\n .filter((part): part is string => typeof part === \"string\" && part !== \"\")\n .join(\" \") || undefined;\n\n if (!hasContractCode(problem) && description == null) {\n const reason = httpReasonPhrase(problem.status, problem.title);\n return {\n title: capitalizeFirst(reason ?? GENERIC_ERROR_TITLE),\n description: httpStatusExplanation(problem.status),\n requestId: problem.requestId,\n problem,\n };\n }\n\n return {\n title: capitalizeFirst(problem.title || GENERIC_ERROR_TITLE),\n description: description ? capitalizeFirst(description) : undefined,\n documentation: problem.remediation?.documentation,\n requestId: problem.requestId,\n problem,\n };\n}\n","import {\n useEffect,\n useRef,\n useState,\n type ComponentProps,\n type ReactNode,\n} from \"react\";\nimport {\n IconAlertCircleFilled,\n IconAlertTriangle,\n IconAlertTriangleFilled,\n IconInfoCircle,\n} from \"@tabler/icons-react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button, ButtonLink } from \"../button/button\";\nimport { Popover } from \"../popover/popover\";\nimport { StatusView, type StatusViewSize } from \"../status-view/status-view\";\nimport {\n capitalizeFirst,\n describeError,\n httpReasonPhrase,\n type ErrorDescription,\n} from \"./problem\";\n\n/** Capitalize string copy; leave custom ReactNode overrides alone. */\nfunction displayCopy(value: ReactNode): ReactNode {\n return typeof value === \"string\" ? capitalizeFirst(value) : value;\n}\n\n/**\n * Design notes:\n * - ONE input: `error` is the caught value, whatever it is — a Problem\n * Details body from `@photon-hq/error`, an `Error` carrying one as\n * `cause`, or something unknown. The component derives its copy via\n * `describeError`; unknowns fall back to a generic line rather than\n * leaking raw messages.\n * - TWO presentations, one per altitude: `Error` is the inline line for\n * forms, cards, and action rows; `ErrorView` is the region / page state\n * built on StatusView (same `sm` / `base` size axis).\n * - Both render `null` when there is nothing to show, so they can sit\n * unconditionally in JSX (`<Error error={mutation.error} />`).\n * - `Warning` is the inline line's second state: the same row in warning\n * ink, for something the user may go ahead with but should look at\n * twice. It never blocks, so it takes its copy and nothing else.\n * - Client-side *validation* is not this component's job — that belongs to\n * `Field.Error`, wired to control validity.\n */\n\nconst DOC_LINK_LABEL = \"Learn more\";\nconst RETRY_LABEL = \"Try again\";\n\ninterface ErrorBaseProps {\n /** The caught value — a problem body, an `Error` wrapping one, or unknown. */\n error?: unknown;\n /** Override the derived message. */\n children?: ReactNode;\n}\n\nexport interface ErrorProps\n extends ErrorBaseProps, Omit<ComponentProps<\"div\">, keyof ErrorBaseProps> {}\n\n/**\n * Error — one line of red ink naming a server failure (4xx / 5xx), placed\n * inline: under a form, in a card, beside the action that failed. Give it the\n * caught value and it renders the problem's `detail` (falling back to `title`,\n * then to a generic line), plus a docs link when the problem carries one.\n * Renders nothing while `error` is nullish, so it can stay mounted.\n *\n * For a region or page that failed to load, use {@link ErrorView}.\n */\nexport function Error({ error, children, className, ...props }: ErrorProps) {\n if (error == null && children == null) return null;\n const copy = describeError(error);\n return (\n <div\n role=\"alert\"\n className={cn(\n \"text-pho-error flex min-w-0 items-start gap-1.5 text-base\",\n className,\n )}\n {...props}\n >\n <span aria-hidden className=\"flex h-[1lh] shrink-0 items-center\">\n <IconAlertCircleFilled className=\"size-4\" />\n </span>\n <span className=\"min-w-0\">\n {displayCopy(children ?? copy.description ?? copy.title)}\n {copy.documentation != null && (\n <>\n {\" \"}\n <a\n href={copy.documentation}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"font-medium underline underline-offset-2\"\n >\n {DOC_LINK_LABEL}\n </a>\n </>\n )}\n {/* Trailing whitespace collapses when the details render null. */}{\" \"}\n <ErrorDetails copy={copy} />\n </span>\n </div>\n );\n}\n\nError.displayName = \"Error\";\n\nexport interface WarningProps extends Omit<\n ComponentProps<\"output\">,\n \"children\"\n> {\n /** What to look at twice. Shows nothing while nullish. */\n children?: ReactNode;\n}\n\n/**\n * Warning — the inline `Error` line in warning ink, a triangle in place of\n * the circle: something the user can go ahead with but may not mean (an\n * address outside the team, a value that differs from the usual one). Same\n * row, glyph seat and type as `Error`, so the two can take turns in one\n * place. It doesn't stop anything, so it announces politely (an `output`,\n * role `status`) and carries no details disclosure.\n *\n * A polite region is announced when its content changes, not when it is\n * inserted, so the `output` stays mounted while the copy is nullish:\n * empty and `sr-only`, the way pho-ui's other live regions sit, it keeps\n * its role and, out of flow, adds no gap to a stack.\n */\nexport function Warning({ children, className, ...props }: WarningProps) {\n // `{cond && copy}` leaves false behind: no copy either.\n const shown = children != null && children !== false && children !== \"\";\n return (\n <output\n className={\n shown\n ? cn(\n \"text-pho-warning flex min-w-0 items-start gap-1.5 text-base\",\n className,\n )\n : \"sr-only\"\n }\n {...props}\n >\n {shown && (\n <>\n <span aria-hidden className=\"flex h-[1lh] shrink-0 items-center\">\n <IconAlertTriangleFilled className=\"size-4\" />\n </span>\n <span className=\"min-w-0\">{displayCopy(children)}</span>\n </>\n )}\n </output>\n );\n}\n\nWarning.displayName = \"Warning\";\n\n/**\n * Hover / focus disclosure on the inline line — the request's fuller story:\n * problem `title` (with the same alert icon + `text-pho-error` ink as the\n * inline line), the untruncated description, then `status` + `code` and the\n * copyable request id grouped below for a support handoff. Renders only when\n * the caught value actually carried a problem (or at least a request id); a\n * generic unknown has nothing more to disclose. Built on `Popover` rather\n * than `Tooltip` because the panel holds an interactive control (the copy\n * button) — `openOnHover` keeps the tooltip-like gesture.\n */\nfunction ErrorDetails({ copy }: { copy: ErrorDescription }) {\n const { problem, requestId } = copy;\n if (problem == null && requestId == null) return null;\n\n // Contract problems show `status CODE`; status-only shows `status Reason`.\n let statusLine: string | null = null;\n if (problem != null) {\n if (problem.code) {\n statusLine = `${problem.status} ${problem.code}`;\n } else {\n const reason = httpReasonPhrase(problem.status, problem.title);\n statusLine = reason\n ? `${problem.status} ${reason}`\n : String(problem.status);\n }\n }\n\n return (\n <Popover.Root>\n <Popover.Trigger\n openOnHover\n delay={150}\n aria-label=\"Error details\"\n className=\"outline-pho-brand inline-flex size-4 shrink-0 translate-y-[3px] cursor-help items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-2\"\n >\n <IconInfoCircle className=\"size-3.5\" />\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner align=\"start\">\n <Popover.Popup className=\"text-pho-error\">\n <Popover.Title className=\"text-pho-error flex items-start gap-1.5\">\n <span aria-hidden className=\"flex h-[1lh] shrink-0 items-center\">\n <IconAlertCircleFilled className=\"size-4\" />\n </span>\n {copy.title}\n </Popover.Title>\n {copy.description != null && (\n <Popover.Description className=\"text-pho-error\">\n {copy.description}\n </Popover.Description>\n )}\n {(statusLine != null || requestId != null) && (\n <div className=\"text-pho-error mt-1 font-mono text-[10px] leading-snug\">\n {statusLine != null && <p>{statusLine}</p>}\n {requestId != null && (\n <RequestId requestId={requestId} className=\"mt-0\" />\n )}\n </div>\n )}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n}\n\n/** Request-id footnote — click copies the id for support handoff. */\nfunction RequestId({\n requestId,\n className,\n}: {\n requestId: string;\n className?: string;\n}) {\n const [copied, setCopied] = useState(false);\n const copiedTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(\n () => () => {\n if (copiedTimer.current) clearTimeout(copiedTimer.current);\n },\n [],\n );\n\n return (\n <span\n className={cn(\"mt-1 block font-mono text-[10px] leading-snug\", className)}\n >\n Request ID:{\" \"}\n <button\n type=\"button\"\n className=\"outline-pho-brand inline cursor-pointer underline-offset-2 select-all hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:-outline-offset-1\"\n aria-label={\n copied ? \"Request ID copied\" : `Copy request ID ${requestId}`\n }\n onClick={async () => {\n try {\n await navigator.clipboard.writeText(requestId);\n } catch {\n return;\n }\n setCopied(true);\n if (copiedTimer.current) clearTimeout(copiedTimer.current);\n copiedTimer.current = setTimeout(() => setCopied(false), 1500);\n }}\n >\n {requestId}\n </button>\n <output className=\"sr-only\" aria-live=\"polite\">\n {copied ? \"Copied\" : \"\"}\n </output>\n </span>\n );\n}\n\ninterface ErrorViewBaseProps {\n /** The caught value — a problem body, an `Error` wrapping one, or unknown. */\n error?: unknown;\n /** Override the derived title. */\n title?: ReactNode;\n /** Override the derived description. */\n description?: ReactNode;\n /** Override the warning glyph. */\n icon?: ReactNode;\n /** Offer a retry — renders a \"Try again\" button. */\n onRetry?: () => void;\n /** Replace the built-in action row entirely. */\n actions?: ReactNode;\n /** Size variant — StatusView's axis. @default \"base\" */\n size?: StatusViewSize;\n}\n\nexport interface ErrorViewProps\n extends\n ErrorViewBaseProps,\n Omit<ComponentProps<\"div\">, keyof ErrorViewBaseProps | \"children\"> {}\n\n/**\n * ErrorView — the failed state of a region or page, built on StatusView:\n * warning icon over the problem's `title`, its `detail` and remediation\n * below, an action row (`onRetry` and the problem's docs link), and the\n * request id as a footnote for support. Announces via `role=\"alert\"`.\n *\n * Use `size=\"sm\"` inside cards and panels, the default `base` for whole\n * pages. Renders nothing while `error` is nullish (unless given a static\n * `title`), so it can sit unconditionally next to a query.\n */\nexport function ErrorView({\n error,\n title,\n description,\n icon,\n onRetry,\n actions,\n size = \"base\",\n ...props\n}: ErrorViewProps) {\n if (error == null && title == null) return null;\n const copy = describeError(error);\n\n const resolvedDescription = displayCopy(description ?? copy.description);\n const body =\n resolvedDescription != null || copy.requestId != null ? (\n <>\n {resolvedDescription}\n {copy.requestId != null && <RequestId requestId={copy.requestId} />}\n </>\n ) : undefined;\n\n const resolvedActions =\n actions ??\n (onRetry != null || copy.documentation != null ? (\n <>\n {onRetry != null && (\n <Button size=\"sm\" onClick={onRetry}>\n {RETRY_LABEL}\n </Button>\n )}\n {copy.documentation != null && (\n <ButtonLink\n size=\"sm\"\n variant=\"outlined\"\n href={copy.documentation}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {DOC_LINK_LABEL}\n </ButtonLink>\n )}\n </>\n ) : undefined);\n\n return (\n <StatusView\n role=\"alert\"\n size={size}\n icon={icon ?? <IconAlertTriangle />}\n title={displayCopy(title ?? copy.title)}\n description={body}\n actions={resolvedActions}\n {...props}\n />\n );\n}\n\nErrorView.displayName = \"ErrorView\";\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;AASA,IAAMgB,IAAa;AAAA,EAAC,CA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,MAAK;AAAA,IAAK,SAAS6D;AAAA,IACxB,UAAAnB;AAAA,EACK,CAAA,GAETK,EAAK,iBAAiB,QACrB,gBAAAnC,EAACX,GAAD;AAAA,IACE,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAM8C,EAAK;AAAA,IACX,QAAO;AAAA,IACP,KAAI;AAAA,IAEH,UAAAN;AAAA,EACS,CAAA,CAEd,EAAA,CAAA,IACA;AAEN,SACE,gBAAA7B,EAACL,GAAD;AAAA,IACE,MAAK;AAAA,IACC,MAAAwD;AAAA,IACN,MAAMH,KAAQ,gBAAAhD,EAACG,GAAD,CAAoB,CAAA;AAAA,IAClC,OAAOyB,EAAYmB,KAASZ,EAAK,KAAK;AAAA,IACtC,aAAakB;AAAA,IACb,SAASC;AAAA,IACT,GAAIpB;AAAA,EACL,CAAA;AAEL;AAEAY,EAAU,cAAc"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { t as c } from "./cn-CPbhpG1q.js";
3
3
  import { t as p } from "./createReactComponent-yKZn9MIX.js";
4
- import { r as h } from "./badge-CVViIYj_.js";
4
+ import { r as x } from "./badge-CVViIYj_.js";
5
5
  import "react";
6
6
  import { jsx as a, jsxs as i } from "react/jsx-runtime";
7
7
  var y = [["path", {
@@ -31,19 +31,19 @@ function _(t) {
31
31
  function k(t, e) {
32
32
  return t === "flat" || e === "none" ? "muted" : t === e ? "success" : "error";
33
33
  }
34
- function m({ label: t, value: e, delta: r, deltaDirection: o, deltaGood: d = "up", note: s, className: f, ...x }) {
35
- const n = r == null ? null : o ?? _(r), g = typeof r == "number" ? `${v.format(r).replace("-", "−")}%` : r, l = n === "up" ? b : n === "down" ? w : null;
34
+ function m({ label: t, value: e, delta: r, deltaDirection: o, deltaGood: d = "up", note: s, className: f, ...g }) {
35
+ const n = r == null ? null : o ?? _(r), h = typeof r == "number" ? `${v.format(r).replace("-", "−")}%` : r, l = n === "up" ? b : n === "down" ? w : null;
36
36
  return /* @__PURE__ */ i("div", {
37
37
  "data-stat": "",
38
38
  className: c("flex min-w-0 flex-col gap-1 px-5 py-4", f),
39
- ...x,
39
+ ...g,
40
40
  children: [
41
41
  /* @__PURE__ */ i("div", {
42
42
  className: "flex items-start justify-between gap-3",
43
43
  children: [/* @__PURE__ */ a("span", {
44
44
  className: "text-pho-secondary min-w-0 truncate text-base",
45
45
  children: t
46
- }), r != null && n != null && /* @__PURE__ */ i(h, {
46
+ }), r != null && n != null && /* @__PURE__ */ i(x, {
47
47
  size: "sm",
48
48
  contrast: "low",
49
49
  color: k(n, d),
@@ -52,11 +52,11 @@ function m({ label: t, value: e, delta: r, deltaDirection: o, deltaGood: d = "up
52
52
  children: [l && /* @__PURE__ */ a(l, {
53
53
  "aria-hidden": !0,
54
54
  className: "size-3"
55
- }), g]
55
+ }), h]
56
56
  })]
57
57
  }),
58
58
  /* @__PURE__ */ a("span", {
59
- className: "text-display-md text-pho-primary min-w-0 truncate font-medium",
59
+ className: "font-heading text-display-md text-pho-primary min-w-0 truncate font-medium",
60
60
  children: e
61
61
  }),
62
62
  s != null && /* @__PURE__ */ a("span", {
@@ -82,4 +82,4 @@ export {
82
82
  m as t
83
83
  };
84
84
 
85
- //# sourceMappingURL=stat-BXBfMQ9Q.js.map
85
+ //# sourceMappingURL=stat-VxA1SvS_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stat-BXBfMQ9Q.js","names":["__iconNode","cn","createReactComponent","Badge","jsx","jsxs","__iconNode$1","IconTrendingDown","__iconNode","IconTrendingUp","percent","directionOf","delta","trimmed","first","body","deltaColor","direction","good","Stat","label","value","deltaDirection","deltaGood","note","className","props","text","Arrow","StatGroup","variant"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconTrendingDown.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconTrendingUp.mjs","../../src/components/stat/stat.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M3 7l6 6l4 -4l8 8\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M21 10l0 7l-7 0\", \"key\": \"svg-1\" }]];\nconst IconTrendingDown = createReactComponent(\"outline\", \"trending-down\", \"TrendingDown\", __iconNode);\n\nexport { __iconNode, IconTrendingDown as default };\n","/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M3 17l6 -6l4 4l8 -8\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M14 7l7 0l0 7\", \"key\": \"svg-1\" }]];\nconst IconTrendingUp = createReactComponent(\"outline\", \"trending-up\", \"TrendingUp\", __iconNode);\n\nexport { __iconNode, IconTrendingUp as default };\n","import { type ComponentProps, type ReactNode } from \"react\";\nimport { IconTrendingDown, IconTrendingUp } from \"@tabler/icons-react\";\nimport { Badge, type BadgeColor } from \"../badge\";\nimport { cn } from \"../../utils/cn\";\n\n/**\n * Stat — a figure with its name: a label, a value, and, when it\n * matters, how the value moved and against what.\n *\n * Design notes:\n * - The value is the loud element: display size, medium weight, the\n * font's proportional figures (tabular digits make a big `121` look\n * loose). Label and note stay in the UI inks; nothing else competes.\n * - The delta is a low-contrast `Badge` beside the label, with an arrow so\n * the direction never rides on colour alone. Its ink says whether the\n * move is good news: `deltaGood` names the good direction, because a\n * drop in bounce rate is green and a drop in visitors is red.\n * - A tile has no chrome of its own. Alone, it sits in whatever card holds\n * it; in a `Stat.Group` the tiles share one frame and hairlines.\n */\n\nexport type StatDirection = \"up\" | \"down\" | \"flat\";\n\nexport interface StatProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n /** What the figure counts — \"Visitors\", \"Active chats\". */\n label: ReactNode;\n /** The figure, already formatted — \"20.8K\", \"8m 32s\", \"1:1\". */\n value: ReactNode;\n /**\n * How the value moved: a number is a percentage change and renders\n * signed with one decimal (\"−42.0%\"); a string renders as written and\n * its sign sets the direction.\n */\n delta?: number | string;\n /** The delta's direction, when the string can't say. Derived otherwise. */\n deltaDirection?: StatDirection;\n /**\n * Which direction is good news: `up` (visitors, revenue), `down` (bounce\n * rate, latency), `none` when a move is just information. @default \"up\"\n */\n deltaGood?: \"up\" | \"down\" | \"none\";\n /** What the delta is against — \"vs. 36.2K prior\". */\n note?: ReactNode;\n}\n\nconst percent = new Intl.NumberFormat(\"en-US\", {\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n signDisplay: \"exceptZero\",\n});\n\n/**\n * A leading sign — ASCII or the true minus — sets a string delta's direction.\n * A signed zero (\"+0%\", \"−0.0%\") is still flat: a caller's formatter may\n * sign every value, and zero has not moved.\n */\nfunction directionOf(delta: number | string): StatDirection {\n if (typeof delta === \"number\") {\n return delta > 0 ? \"up\" : delta < 0 ? \"down\" : \"flat\";\n }\n const trimmed = delta.trim();\n const first = trimmed.charAt(0);\n const signed = first === \"+\" || first === \"-\" || first === \"−\";\n if (!signed) return \"flat\";\n const body = trimmed.slice(1).trim();\n if (Number.parseFloat(body) === 0 && !/[1-9]/.test(body)) return \"flat\";\n return first === \"+\" ? \"up\" : \"down\";\n}\n\nfunction deltaColor(\n direction: StatDirection,\n good: NonNullable<StatProps[\"deltaGood\"]>,\n): BadgeColor {\n if (direction === \"flat\" || good === \"none\") return \"muted\";\n return direction === good ? \"success\" : \"error\";\n}\n\nexport function Stat({\n label,\n value,\n delta,\n deltaDirection,\n deltaGood = \"up\",\n note,\n className,\n ...props\n}: StatProps) {\n const direction =\n delta == null ? null : (deltaDirection ?? directionOf(delta));\n const text =\n typeof delta === \"number\"\n ? // The true minus, so the sign reads at badge size.\n `${percent.format(delta).replace(\"-\", \"−\")}%`\n : delta;\n const Arrow =\n direction === \"up\"\n ? IconTrendingUp\n : direction === \"down\"\n ? IconTrendingDown\n : null;\n return (\n <div\n data-stat=\"\"\n className={cn(\"flex min-w-0 flex-col gap-1 px-5 py-4\", className)}\n {...props}\n >\n <div className=\"flex items-start justify-between gap-3\">\n <span className=\"text-pho-secondary min-w-0 truncate text-base\">\n {label}\n </span>\n {delta != null && direction != null && (\n <Badge\n size=\"sm\"\n contrast=\"low\"\n color={deltaColor(direction, deltaGood)}\n className=\"shrink-0 tabular-nums\"\n data-direction={direction}\n >\n {Arrow && <Arrow aria-hidden className=\"size-3\" />}\n {text}\n </Badge>\n )}\n </div>\n <span className=\"text-display-md text-pho-primary min-w-0 truncate font-medium\">\n {value}\n </span>\n {note != null && (\n <span className=\"text-pho-description truncate text-xs\">{note}</span>\n )}\n </div>\n );\n}\n\nStat.displayName = \"Stat\";\n\nexport interface StatGroupProps extends ComponentProps<\"div\"> {\n /**\n * `card` frames the row as a card of its own; `plain` keeps only the\n * hairlines between tiles, for a row inside a card or under a chart.\n * @default \"card\"\n */\n variant?: \"card\" | \"plain\";\n}\n\n/**\n * A row of tiles that reads as one card: hairlines between tiles, and\n * between rows once the tiles wrap on a narrow width. Each tile takes an\n * equal share of its row, never narrower than 12rem; a tile that wraps\n * alone stretches across its line, so the frame never shows a hole.\n */\nexport function StatGroup({\n variant = \"card\",\n className,\n ...props\n}: StatGroupProps) {\n return (\n <div\n // A row of figures is a group, not a form's fieldset: the role, and\n // the caller's `aria-label`, name it for assistive tech.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n data-stat-group=\"\"\n className={cn(\n // The hairlines are the gap: the frame's secondary shows through\n // 1px between tiles, so wrapping rows get a rule too. Flex, not\n // grid: a grid's empty cells on the last row would show through.\n \"bg-pho-secondary [&>*]:bg-pho-primary flex flex-wrap gap-px [&>*]:min-w-0 [&>*]:flex-[1_1_12rem]\",\n variant === \"card\" &&\n \"border-pho-secondary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IACL,mBAAgB;AAAA,IAChB,WAAWH,EAIT,oGACA6B,MAAY,UACV,4DACFL,CACF;AAAA,IACA,GAAIC;AAAA,EACL,CAAA;AAEL;AAEAG,EAAU,cAAc;AACxBV,EAAK,QAAQU"}
1
+ {"version":3,"file":"stat-VxA1SvS_.js","names":["__iconNode","cn","createReactComponent","Badge","jsx","jsxs","__iconNode$1","IconTrendingDown","__iconNode","IconTrendingUp","percent","directionOf","delta","trimmed","first","body","deltaColor","direction","good","Stat","label","value","deltaDirection","deltaGood","note","className","props","text","Arrow","StatGroup","variant"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconTrendingDown.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconTrendingUp.mjs","../../src/components/stat/stat.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M3 7l6 6l4 -4l8 8\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M21 10l0 7l-7 0\", \"key\": \"svg-1\" }]];\nconst IconTrendingDown = createReactComponent(\"outline\", \"trending-down\", \"TrendingDown\", __iconNode);\n\nexport { __iconNode, IconTrendingDown as default };\n","/**\n * @license @tabler/icons-react v3.49.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M3 17l6 -6l4 4l8 -8\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M14 7l7 0l0 7\", \"key\": \"svg-1\" }]];\nconst IconTrendingUp = createReactComponent(\"outline\", \"trending-up\", \"TrendingUp\", __iconNode);\n\nexport { __iconNode, IconTrendingUp as default };\n","import { type ComponentProps, type ReactNode } from \"react\";\nimport { IconTrendingDown, IconTrendingUp } from \"@tabler/icons-react\";\nimport { Badge, type BadgeColor } from \"../badge\";\nimport { cn } from \"../../utils/cn\";\n\n/**\n * Stat — a figure with its name: a label, a value, and, when it\n * matters, how the value moved and against what.\n *\n * Design notes:\n * - The value is the loud element: display size, medium weight, the\n * font's proportional figures (tabular digits make a big `121` look\n * loose). Label and note stay in the UI inks; nothing else competes.\n * - The delta is a low-contrast `Badge` beside the label, with an arrow so\n * the direction never rides on colour alone. Its ink says whether the\n * move is good news: `deltaGood` names the good direction, because a\n * drop in bounce rate is green and a drop in visitors is red.\n * - A tile has no chrome of its own. Alone, it sits in whatever card holds\n * it; in a `Stat.Group` the tiles share one frame and hairlines.\n */\n\nexport type StatDirection = \"up\" | \"down\" | \"flat\";\n\nexport interface StatProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n /** What the figure counts — \"Visitors\", \"Active chats\". */\n label: ReactNode;\n /** The figure, already formatted — \"20.8K\", \"8m 32s\", \"1:1\". */\n value: ReactNode;\n /**\n * How the value moved: a number is a percentage change and renders\n * signed with one decimal (\"−42.0%\"); a string renders as written and\n * its sign sets the direction.\n */\n delta?: number | string;\n /** The delta's direction, when the string can't say. Derived otherwise. */\n deltaDirection?: StatDirection;\n /**\n * Which direction is good news: `up` (visitors, revenue), `down` (bounce\n * rate, latency), `none` when a move is just information. @default \"up\"\n */\n deltaGood?: \"up\" | \"down\" | \"none\";\n /** What the delta is against — \"vs. 36.2K prior\". */\n note?: ReactNode;\n}\n\nconst percent = new Intl.NumberFormat(\"en-US\", {\n minimumFractionDigits: 1,\n maximumFractionDigits: 1,\n signDisplay: \"exceptZero\",\n});\n\n/**\n * A leading sign — ASCII or the true minus — sets a string delta's direction.\n * A signed zero (\"+0%\", \"−0.0%\") is still flat: a caller's formatter may\n * sign every value, and zero has not moved.\n */\nfunction directionOf(delta: number | string): StatDirection {\n if (typeof delta === \"number\") {\n return delta > 0 ? \"up\" : delta < 0 ? \"down\" : \"flat\";\n }\n const trimmed = delta.trim();\n const first = trimmed.charAt(0);\n const signed = first === \"+\" || first === \"-\" || first === \"−\";\n if (!signed) return \"flat\";\n const body = trimmed.slice(1).trim();\n if (Number.parseFloat(body) === 0 && !/[1-9]/.test(body)) return \"flat\";\n return first === \"+\" ? \"up\" : \"down\";\n}\n\nfunction deltaColor(\n direction: StatDirection,\n good: NonNullable<StatProps[\"deltaGood\"]>,\n): BadgeColor {\n if (direction === \"flat\" || good === \"none\") return \"muted\";\n return direction === good ? \"success\" : \"error\";\n}\n\nexport function Stat({\n label,\n value,\n delta,\n deltaDirection,\n deltaGood = \"up\",\n note,\n className,\n ...props\n}: StatProps) {\n const direction =\n delta == null ? null : (deltaDirection ?? directionOf(delta));\n const text =\n typeof delta === \"number\"\n ? // The true minus, so the sign reads at badge size.\n `${percent.format(delta).replace(\"-\", \"−\")}%`\n : delta;\n const Arrow =\n direction === \"up\"\n ? IconTrendingUp\n : direction === \"down\"\n ? IconTrendingDown\n : null;\n return (\n <div\n data-stat=\"\"\n className={cn(\"flex min-w-0 flex-col gap-1 px-5 py-4\", className)}\n {...props}\n >\n <div className=\"flex items-start justify-between gap-3\">\n <span className=\"text-pho-secondary min-w-0 truncate text-base\">\n {label}\n </span>\n {delta != null && direction != null && (\n <Badge\n size=\"sm\"\n contrast=\"low\"\n color={deltaColor(direction, deltaGood)}\n className=\"shrink-0 tabular-nums\"\n data-direction={direction}\n >\n {Arrow && <Arrow aria-hidden className=\"size-3\" />}\n {text}\n </Badge>\n )}\n </div>\n <span className=\"font-heading text-display-md text-pho-primary min-w-0 truncate font-medium\">\n {value}\n </span>\n {note != null && (\n <span className=\"text-pho-description truncate text-xs\">{note}</span>\n )}\n </div>\n );\n}\n\nStat.displayName = \"Stat\";\n\nexport interface StatGroupProps extends ComponentProps<\"div\"> {\n /**\n * `card` frames the row as a card of its own; `plain` keeps only the\n * hairlines between tiles, for a row inside a card or under a chart.\n * @default \"card\"\n */\n variant?: \"card\" | \"plain\";\n}\n\n/**\n * A row of tiles that reads as one card: hairlines between tiles, and\n * between rows once the tiles wrap on a narrow width. Each tile takes an\n * equal share of its row, never narrower than 12rem; a tile that wraps\n * alone stretches across its line, so the frame never shows a hole.\n */\nexport function StatGroup({\n variant = \"card\",\n className,\n ...props\n}: StatGroupProps) {\n return (\n <div\n // A row of figures is a group, not a form's fieldset: the role, and\n // the caller's `aria-label`, name it for assistive tech.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n data-stat-group=\"\"\n className={cn(\n // The hairlines are the gap: the frame's secondary shows through\n // 1px between tiles, so wrapping rows get a rule too. Flex, not\n // grid: a grid's empty cells on the last row would show through.\n \"bg-pho-secondary [&>*]:bg-pho-primary flex flex-wrap gap-px [&>*]:min-w-0 [&>*]:flex-[1_1_12rem]\",\n variant === \"card\" &&\n \"border-pho-secondary rounded-base overflow-hidden border\",\n className,\n )}\n {...props}\n />\n );\n}\n\nStatGroup.displayName = \"Stat.Group\";\nStat.Group = StatGroup;\n"],"ignoreList":[0,1],"mappings":";;;;;;AASA,IAAMA,IAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAqB,KAAO;AAAQ,CAAC,GAAG,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAmB,KAAO;AAAQ,CAAC,CAAC,GAC1HO,IAAmBL,EAAqB,WAAW,iBAAiB,gBAAgBF,CAAU,GCD9FQ,IAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAuB,KAAO;AAAQ,CAAC,GAAG,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAiB,KAAO;AAAQ,CAAC,CAAC,GAC1HC,IAAiBP,EAAqB,WAAW,eAAe,cAAcM,CAAU,GCmCxFE,IAAU,IAAI,KAAK,aAAa,SAAS;AAAA,EAC7C,uBAAuB;AAAA,EACvB,uBAAuB;AAAA,EACvB,aAAa;AACf,CAAC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