@photon-ai/pho-ui 1.4.0 → 2.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.
- package/dist/chunks/IconAlertCircleFilled-VxKU8TYK.js +11 -0
- package/dist/chunks/IconAlertCircleFilled-VxKU8TYK.js.map +1 -0
- package/dist/chunks/IconArrowUpRight-DGgKzQwV.js +14 -0
- package/dist/chunks/IconArrowUpRight-DGgKzQwV.js.map +1 -0
- package/dist/chunks/IconChevronLeft-CSWMKQ4C.js +11 -0
- package/dist/chunks/IconChevronLeft-CSWMKQ4C.js.map +1 -0
- package/dist/chunks/IconInfoCircle-L0zfhg7R.js +21 -0
- package/dist/chunks/IconInfoCircle-L0zfhg7R.js.map +1 -0
- package/dist/chunks/animated-height-DhNSac85.js +50 -0
- package/dist/chunks/animated-height-DhNSac85.js.map +1 -0
- package/dist/chunks/basic-page-D1zm81YS.js +481 -0
- package/dist/chunks/basic-page-D1zm81YS.js.map +1 -0
- package/dist/chunks/{close-button-B8gF5UNk.js → button-X5wsWvRa.js} +127 -147
- package/dist/chunks/button-X5wsWvRa.js.map +1 -0
- package/dist/chunks/close-button-xadxp0j8.js +29 -0
- package/dist/chunks/close-button-xadxp0j8.js.map +1 -0
- package/dist/chunks/combobox-rLdS6fl-.js +117 -0
- package/dist/chunks/combobox-rLdS6fl-.js.map +1 -0
- package/dist/chunks/dialog-Caze1vkf.js +252 -0
- package/dist/chunks/dialog-Caze1vkf.js.map +1 -0
- package/dist/chunks/error-DR6G2LmG.js +251 -0
- package/dist/chunks/error-DR6G2LmG.js.map +1 -0
- package/dist/chunks/{input-CxS7ndpb.js → input-D3XQcC4J.js} +29 -31
- package/dist/chunks/input-D3XQcC4J.js.map +1 -0
- package/dist/chunks/{menu-BSXds3Rt.js → menu-BC-9IP29.js} +39 -39
- package/dist/chunks/menu-BC-9IP29.js.map +1 -0
- package/dist/chunks/popover-EL1SE1kj.js +46 -0
- package/dist/chunks/popover-EL1SE1kj.js.map +1 -0
- package/dist/chunks/{sidebar-DGpEKxOn.js → sidebar-DDJC1MeD.js} +72 -64
- package/dist/chunks/sidebar-DDJC1MeD.js.map +1 -0
- package/dist/components/button.js +13 -12
- package/dist/components/combobox.js +2 -114
- package/dist/components/command.js +242 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/context-menu.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/error.js +13 -0
- package/dist/components/input.js +1 -1
- package/dist/components/menu.js +1 -1
- package/dist/components/notification.js +27 -39
- package/dist/components/notification.js.map +1 -1
- package/dist/components/phone-input.js +17001 -0
- package/dist/components/phone-input.js.map +1 -0
- package/dist/components/popover.js +2 -43
- package/dist/components/toast.js.map +1 -1
- package/dist/index.js +62 -50
- package/dist/primitives.js +1 -1
- package/dist/sections/basic-page.js +1 -1
- package/dist/sections/sidebar.js +1 -1
- package/dist/src/components/command/command.d.ts +114 -0
- package/dist/src/components/command/index.d.ts +1 -0
- package/dist/src/components/dialog/dialog.d.ts +89 -1
- package/dist/src/components/drawer/drawer.d.ts +2 -2
- package/dist/src/components/error/error.d.ts +56 -0
- package/dist/src/components/error/index.d.ts +2 -0
- package/dist/src/components/error/problem.d.ts +80 -0
- package/dist/src/components/notification/notification.d.ts +1 -1
- package/dist/src/components/phone-input/country-alpha3.d.ts +250 -0
- package/dist/src/components/phone-input/country-search.d.ts +8 -0
- package/dist/src/components/phone-input/index.d.ts +1 -0
- package/dist/src/components/phone-input/phone-input.d.ts +47 -0
- package/dist/src/components/toast/toast.d.ts +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/sections/basic-page/basic-page.d.ts +165 -45
- package/dist/src/sections/sidebar/sidebar.d.ts +8 -3
- package/dist/src/utils/animated-height.d.ts +13 -0
- package/package.json +16 -5
- package/src/styles/theme.css +27 -0
- package/dist/chunks/basic-page-4_GZOvRr.js +0 -255
- package/dist/chunks/basic-page-4_GZOvRr.js.map +0 -1
- package/dist/chunks/close-button-B8gF5UNk.js.map +0 -1
- package/dist/chunks/dialog-Ba0UUE5g.js +0 -155
- package/dist/chunks/dialog-Ba0UUE5g.js.map +0 -1
- package/dist/chunks/input-CxS7ndpb.js.map +0 -1
- package/dist/chunks/menu-BSXds3Rt.js.map +0 -1
- package/dist/chunks/sidebar-DGpEKxOn.js.map +0 -1
- package/dist/components/alert-dialog.js +0 -59
- package/dist/components/alert-dialog.js.map +0 -1
- package/dist/components/combobox.js.map +0 -1
- package/dist/components/popover.js.map +0 -1
- package/dist/src/components/alert-dialog/alert-dialog.d.ts +0 -41
- package/dist/src/components/alert-dialog/index.d.ts +0 -1
|
@@ -1,46 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "../chunks/
|
|
3
|
-
import "react";
|
|
4
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
5
|
-
import { Popover as t } from "@base-ui/react/popover";
|
|
6
|
-
var n = t.Root, s = t.Trigger, p = t.Portal, c = t.Close;
|
|
7
|
-
function m({ className: r, sideOffset: o = 8, ...i }) {
|
|
8
|
-
return /* @__PURE__ */ a(t.Positioner, {
|
|
9
|
-
sideOffset: o,
|
|
10
|
-
className: e("z-50", r),
|
|
11
|
-
...i
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
function l({ className: r, ...o }) {
|
|
15
|
-
return /* @__PURE__ */ a(t.Popup, {
|
|
16
|
-
className: e("bg-pho-primary text-pho-primary shadow-pho-lg ring-pho-secondary rounded-base max-w-[calc(100vw-2rem)] origin-[var(--transform-origin)] p-4 ring-1 transition-[transform,opacity] duration-150 ease-out outline-none ring-inset", "data-[starting-style]:scale-95 data-[starting-style]:opacity-0", "data-[ending-style]:scale-95 data-[ending-style]:opacity-0", r),
|
|
17
|
-
...o
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function u({ className: r, ...o }) {
|
|
21
|
-
return /* @__PURE__ */ a(t.Title, {
|
|
22
|
-
className: e("text-pho-primary text-base font-medium", r),
|
|
23
|
-
...o
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function g({ className: r, ...o }) {
|
|
27
|
-
return /* @__PURE__ */ a(t.Description, {
|
|
28
|
-
className: e("text-pho-description mt-1 text-base", r),
|
|
29
|
-
...o
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
var P = {
|
|
33
|
-
Root: n,
|
|
34
|
-
Trigger: s,
|
|
35
|
-
Portal: p,
|
|
36
|
-
Positioner: m,
|
|
37
|
-
Popup: l,
|
|
38
|
-
Title: u,
|
|
39
|
-
Description: g,
|
|
40
|
-
Close: c
|
|
41
|
-
};
|
|
2
|
+
import { t as e } from "../chunks/popover-EL1SE1kj.js";
|
|
42
3
|
export {
|
|
43
|
-
|
|
4
|
+
e as Popover
|
|
44
5
|
};
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","names":[],"sources":["../../src/components/toast/toast.tsx"],"sourcesContent":["import { type ComponentProps, type ElementType } from \"react\";\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { cn } from \"../../utils/cn\";\n\n/** Override Base UI's `string | (state) => string` className with plain string. */\ntype StyledProps<T extends ElementType> = Omit<\n ComponentProps<T>,\n \"className\"\n> & {\n className?: string;\n};\n\nconst Provider = BaseToast.Provider;\nconst Portal = BaseToast.Portal;\nconst Action = BaseToast.Action;\n\n/** Imperative toast API: `const toast = useToastManager(); toast.add({ title })`. */\nconst useToastManager = BaseToast.useToastManager;\nconst createToastManager = BaseToast.createToastManager;\n\nfunction Viewport({\n className,\n ...props\n}: StyledProps<typeof BaseToast.Viewport>) {\n return (\n <BaseToast.Viewport\n className={cn(\n \"fixed right-4 bottom-4 z-50 flex w-[22rem] max-w-[calc(100vw-2rem)] flex-col gap-2 outline-none\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Root({ className, ...props }: StyledProps<typeof BaseToast.Root>) {\n return (\n <BaseToast.Root\n className={cn(\n // Floating layer: keeps its elevation shadow, sits on the card surface\n // with the site hairline (ring-pho-secondary).\n \"bg-pho-primary text-pho-primary shadow-pho-lg ring-pho-secondary rounded-base relative w-full ring-1 select-none ring-inset\",\n \"[transform:translateX(var(--toast-swipe-movement-x,0px))] transition-[transform,opacity] duration-300 ease-out\",\n \"data-[starting-style]:translate-x-full data-[starting-style]:opacity-0\",\n \"data-[ending-style]:translate-x-full data-[ending-style]:opacity-0\",\n \"data-[swiping]:duration-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Content({\n className,\n ...props\n}: StyledProps<typeof BaseToast.Content>) {\n return (\n <BaseToast.Content\n className={cn(\"flex flex-col gap-1 p-4 pr-10\", className)}\n {...props}\n />\n );\n}\n\nfunction Title({ className, ...props }: StyledProps<typeof BaseToast.Title>) {\n return (\n <BaseToast.Title\n className={cn(\"text-pho-primary text-base font-medium\", className)}\n {...props}\n />\n );\n}\n\nfunction Description({\n className,\n ...props\n}: StyledProps<typeof BaseToast.Description>) {\n return (\n <BaseToast.Description\n className={cn(\"text-pho-description text-base\", className)}\n {...props}\n />\n );\n}\n\nfunction Close({ className, ...props }: StyledProps<typeof BaseToast.Close>) {\n return (\n <BaseToast.Close\n className={cn(\n \"text-pho-secondary hover:text-pho-secondary-hover hover:bg-pho-ghost-hover outline-pho-brand absolute top-2.5 right-2.5 flex size-6 cursor-pointer items-center justify-center rounded-sm transition focus-visible:outline-2 [&>svg]:size-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Toast built on Base UI `Toast` — a transient, non-blocking notification.\n * Wrap your app in `Toast.Provider`, render a `Toast.Portal` → `Viewport` that\n * maps `useToastManager().toasts` to `Toast.Root`s, then call\n * `useToastManager().add({ title, description })` to show one. Use a toast for\n * confirmation of a background action; for a choice the user must make, use\n * `
|
|
1
|
+
{"version":3,"file":"toast.js","names":[],"sources":["../../src/components/toast/toast.tsx"],"sourcesContent":["import { type ComponentProps, type ElementType } from \"react\";\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { cn } from \"../../utils/cn\";\n\n/** Override Base UI's `string | (state) => string` className with plain string. */\ntype StyledProps<T extends ElementType> = Omit<\n ComponentProps<T>,\n \"className\"\n> & {\n className?: string;\n};\n\nconst Provider = BaseToast.Provider;\nconst Portal = BaseToast.Portal;\nconst Action = BaseToast.Action;\n\n/** Imperative toast API: `const toast = useToastManager(); toast.add({ title })`. */\nconst useToastManager = BaseToast.useToastManager;\nconst createToastManager = BaseToast.createToastManager;\n\nfunction Viewport({\n className,\n ...props\n}: StyledProps<typeof BaseToast.Viewport>) {\n return (\n <BaseToast.Viewport\n className={cn(\n \"fixed right-4 bottom-4 z-50 flex w-[22rem] max-w-[calc(100vw-2rem)] flex-col gap-2 outline-none\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Root({ className, ...props }: StyledProps<typeof BaseToast.Root>) {\n return (\n <BaseToast.Root\n className={cn(\n // Floating layer: keeps its elevation shadow, sits on the card surface\n // with the site hairline (ring-pho-secondary).\n \"bg-pho-primary text-pho-primary shadow-pho-lg ring-pho-secondary rounded-base relative w-full ring-1 select-none ring-inset\",\n \"[transform:translateX(var(--toast-swipe-movement-x,0px))] transition-[transform,opacity] duration-300 ease-out\",\n \"data-[starting-style]:translate-x-full data-[starting-style]:opacity-0\",\n \"data-[ending-style]:translate-x-full data-[ending-style]:opacity-0\",\n \"data-[swiping]:duration-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Content({\n className,\n ...props\n}: StyledProps<typeof BaseToast.Content>) {\n return (\n <BaseToast.Content\n className={cn(\"flex flex-col gap-1 p-4 pr-10\", className)}\n {...props}\n />\n );\n}\n\nfunction Title({ className, ...props }: StyledProps<typeof BaseToast.Title>) {\n return (\n <BaseToast.Title\n className={cn(\"text-pho-primary text-base font-medium\", className)}\n {...props}\n />\n );\n}\n\nfunction Description({\n className,\n ...props\n}: StyledProps<typeof BaseToast.Description>) {\n return (\n <BaseToast.Description\n className={cn(\"text-pho-description text-base\", className)}\n {...props}\n />\n );\n}\n\nfunction Close({ className, ...props }: StyledProps<typeof BaseToast.Close>) {\n return (\n <BaseToast.Close\n className={cn(\n \"text-pho-secondary hover:text-pho-secondary-hover hover:bg-pho-ghost-hover outline-pho-brand absolute top-2.5 right-2.5 flex size-6 cursor-pointer items-center justify-center rounded-sm transition focus-visible:outline-2 [&>svg]:size-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Toast built on Base UI `Toast` — a transient, non-blocking notification.\n * Wrap your app in `Toast.Provider`, render a `Toast.Portal` → `Viewport` that\n * maps `useToastManager().toasts` to `Toast.Root`s, then call\n * `useToastManager().add({ title, description })` to show one. Use a toast for\n * confirmation of a background action; for a choice the user must make, use\n * `Dialog`.\n */\nexport const Toast = {\n Provider,\n Portal,\n Viewport,\n Root,\n Content,\n Title,\n Description,\n Close,\n Action,\n useToastManager,\n createToastManager,\n};\n"],"mappings":";;;;;AAYA,IAAM,IAAW,EAAU,UACrB,IAAS,EAAU,QACnB,IAAS,EAAU,QAGnB,IAAkB,EAAU,iBAC5B,IAAqB,EAAU;AAErC,SAAS,EAAS,EAChB,WAAA,GACA,GAAG,EAAA,GACsC;AACzC,SACE,gBAAA,EAAC,EAAU,UAAX;AAAA,IACE,WAAW,EACT,mGACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAEA,SAAS,EAAK,EAAE,WAAA,GAAW,GAAG,EAAA,GAA6C;AACzE,SACE,gBAAA,EAAC,EAAU,MAAX;AAAA,IACE,WAAW,EAGT,+HACA,kHACA,0EACA,sEACA,6BACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAEA,SAAS,EAAQ,EACf,WAAA,GACA,GAAG,EAAA,GACqC;AACxC,SACE,gBAAA,EAAC,EAAU,SAAX;AAAA,IACE,WAAW,EAAG,iCAAiC,CAAS;AAAA,IACxD,GAAI;AAAA,EACL,CAAA;AAEL;AAEA,SAAS,EAAM,EAAE,WAAA,GAAW,GAAG,EAAA,GAA8C;AAC3E,SACE,gBAAA,EAAC,EAAU,OAAX;AAAA,IACE,WAAW,EAAG,0CAA0C,CAAS;AAAA,IACjE,GAAI;AAAA,EACL,CAAA;AAEL;AAEA,SAAS,EAAY,EACnB,WAAA,GACA,GAAG,EAAA,GACyC;AAC5C,SACE,gBAAA,EAAC,EAAU,aAAX;AAAA,IACE,WAAW,EAAG,kCAAkC,CAAS;AAAA,IACzD,GAAI;AAAA,EACL,CAAA;AAEL;AAEA,SAAS,EAAM,EAAE,WAAA,GAAW,GAAG,EAAA,GAA8C;AAC3E,SACE,gBAAA,EAAC,EAAU,OAAX;AAAA,IACE,WAAW,EACT,+OACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAUA,IAAa,IAAQ;AAAA,EACnB,UAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,iBAAA;AAAA,EACA,oBAAA;AACF"}
|
package/dist/index.js
CHANGED
|
@@ -1,61 +1,73 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { t as s } from "./chunks/cn-DTiB6ek_.js";
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as I, r as
|
|
3
|
+
import { n as r, r as o, t as E } from "./chunks/link-provider-9TFNyDqO.js";
|
|
4
|
+
import { t as i } from "./chunks/resolve-variant-CcD8iG5l.js";
|
|
5
|
+
import { n as I, r as n, t as A } from "./chunks/use-press-pulse-8iorQPsh.js";
|
|
6
6
|
import "./utils.js";
|
|
7
|
-
import { a as
|
|
8
|
-
import { a as
|
|
9
|
-
import { a as F, i as
|
|
10
|
-
import { t as
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
7
|
+
import { a as e, c as R, d as p, i as B, l as C, n as O, o as P, r as f, s as u, t as D, u as N } from "./chunks/button-X5wsWvRa.js";
|
|
8
|
+
import { a as c, c as l, i as V, l as U, n as G, o as d, r as M, s as b, t as g } from "./chunks/error-DR6G2LmG.js";
|
|
9
|
+
import { a as F, i as W, n as h, o as Z, r as v, s as w, t as x } from "./chunks/basic-page-D1zm81YS.js";
|
|
10
|
+
import { a as z, c as Y, i as j, n as q, o as y, r as J, s as K, t as Q } from "./chunks/sidebar-DDJC1MeD.js";
|
|
11
|
+
import { t as $ } from "./chunks/input-D3XQcC4J.js";
|
|
12
|
+
import { t as sa } from "./chunks/close-button-xadxp0j8.js";
|
|
13
|
+
import { t as ra } from "./chunks/input-group-D6dlma8k.js";
|
|
14
|
+
import { n as Ea, t as _a } from "./chunks/card-9cGnv-VD.js";
|
|
15
|
+
import { n as Sa, t as Ia } from "./chunks/dialog-Caze1vkf.js";
|
|
16
|
+
import { i as Aa, n as Ta, r as ma, t as ea } from "./chunks/status-view-CcbctPqR.js";
|
|
17
|
+
import "./components/status-view.js";
|
|
15
18
|
export {
|
|
16
19
|
x as BASIC_PAGE_CALLOUT,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
h as BASIC_PAGE_CARD,
|
|
21
|
+
v as BASIC_PAGE_ITEM,
|
|
22
|
+
W as BASIC_PAGE_ITEM_PANEL,
|
|
20
23
|
F as BASIC_PAGE_ITEM_PANEL_DIVIDED,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
Z as BASIC_PAGE_ROW,
|
|
25
|
+
D as BUTTON_COLORS,
|
|
26
|
+
O as BUTTON_SHAPES,
|
|
27
|
+
f as BUTTON_SIZES,
|
|
25
28
|
B as BUTTON_VARIANTS,
|
|
26
29
|
w as BasicPage,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
e as Button,
|
|
31
|
+
P as ButtonLink,
|
|
32
|
+
_a as CARD_SURFACE,
|
|
33
|
+
A as CONTROL_PRESS_SCALE,
|
|
31
34
|
I as CONTROL_PRESS_SPRING,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
Ea as Card,
|
|
36
|
+
sa as CloseButton,
|
|
37
|
+
Ia as Dialog,
|
|
38
|
+
u as EFFECT_BUTTON_SIZES,
|
|
39
|
+
R as EffectButton,
|
|
40
|
+
C as EffectButtonLink,
|
|
41
|
+
g as Error,
|
|
42
|
+
G as ErrorView,
|
|
43
|
+
M as GENERIC_ERROR_TITLE,
|
|
44
|
+
$ as Input,
|
|
45
|
+
ra as InputGroup,
|
|
46
|
+
E as LinkProvider,
|
|
47
|
+
Q as SIDEBAR_HEADER_INSET,
|
|
48
|
+
q as SIDEBAR_ITEM,
|
|
49
|
+
J as SIDEBAR_ITEM_ACTIVE,
|
|
50
|
+
j as SIDEBAR_ITEM_INACTIVE,
|
|
51
|
+
z as SIDEBAR_ROOT,
|
|
52
|
+
y as SIDEBAR_ROOT_BASE,
|
|
53
|
+
K as SIDEBAR_ROOT_INSET,
|
|
54
|
+
ea as STATUS_VIEW,
|
|
55
|
+
Ta as STATUS_VIEW_COPY,
|
|
56
|
+
ma as STATUS_VIEW_SIZES,
|
|
57
|
+
Y as Sidebar,
|
|
58
|
+
Aa as StatusView,
|
|
59
|
+
N as buttonVariants,
|
|
60
|
+
V as capitalizeFirst,
|
|
54
61
|
s as cn,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
c as describeError,
|
|
63
|
+
p as effectButtonVariants,
|
|
64
|
+
d as httpReasonPhrase,
|
|
65
|
+
b as httpStatusExplanation,
|
|
66
|
+
l as isProblem,
|
|
67
|
+
o as isReactComponent,
|
|
68
|
+
U as parseProblem,
|
|
69
|
+
i as resolveVariant,
|
|
70
|
+
Sa as useDialogPending,
|
|
71
|
+
r as useLinkComponent,
|
|
72
|
+
n as usePressPulse
|
|
61
73
|
};
|
package/dist/primitives.js
CHANGED
|
@@ -43,6 +43,7 @@ import "./primitives/tooltip.js";
|
|
|
43
43
|
export * from "@base-ui/react/field";
|
|
44
44
|
export * from "@base-ui/react/separator";
|
|
45
45
|
export * from "@base-ui/react/dialog";
|
|
46
|
+
export * from "@base-ui/react/popover";
|
|
46
47
|
export * from "@base-ui/react/avatar";
|
|
47
48
|
export * from "@base-ui/react/accordion";
|
|
48
49
|
export * from "@base-ui/react/alert-dialog";
|
|
@@ -65,7 +66,6 @@ export * from "@base-ui/react/meter";
|
|
|
65
66
|
export * from "@base-ui/react/navigation-menu";
|
|
66
67
|
export * from "@base-ui/react/number-field";
|
|
67
68
|
export * from "@base-ui/react/otp-field";
|
|
68
|
-
export * from "@base-ui/react/popover";
|
|
69
69
|
export * from "@base-ui/react/preview-card";
|
|
70
70
|
export * from "@base-ui/react/progress";
|
|
71
71
|
export * from "@base-ui/react/radio";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as _, i as E, n as I, o as a, r as s, s as P, t as C } from "../chunks/basic-page-
|
|
2
|
+
import { a as _, i as E, n as I, o as a, r as s, s as P, t as C } from "../chunks/basic-page-D1zm81YS.js";
|
|
3
3
|
export {
|
|
4
4
|
C as BASIC_PAGE_CALLOUT,
|
|
5
5
|
I as BASIC_PAGE_CARD,
|
package/dist/sections/sidebar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as I, c as _, i as A, n as R, o as S, r as a, s, t as T } from "../chunks/sidebar-
|
|
2
|
+
import { a as I, c as _, i as A, n as R, o as S, r as a, s, t as T } from "../chunks/sidebar-DDJC1MeD.js";
|
|
3
3
|
export {
|
|
4
4
|
T as SIDEBAR_HEADER_INSET,
|
|
5
5
|
R as SIDEBAR_ITEM,
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { Command as CommandPrimitive, useCommandState } from 'cmdk';
|
|
3
|
+
import { Dialog as PhoDialog } from '../dialog';
|
|
4
|
+
declare function Root({ className, children, ...props }: ComponentProps<typeof CommandPrimitive>): import("react").JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* The input row — a bottom hairline separates it from the list. Position
|
|
7
|
+
* leading icons absolutely and pad the input (`pl-9`), mirroring
|
|
8
|
+
* `Autocomplete.InputGroup`.
|
|
9
|
+
*/
|
|
10
|
+
declare function InputGroup({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
11
|
+
declare function Input({ className, value, ref: consumerRef, ...props }: ComponentProps<typeof CommandPrimitive.Input>): import("react").JSX.Element;
|
|
12
|
+
declare function List({ className, children, ...props }: ComponentProps<typeof CommandPrimitive.List>): import("react").JSX.Element;
|
|
13
|
+
declare function Empty({ className, ...props }: ComponentProps<typeof CommandPrimitive.Empty>): import("react").JSX.Element;
|
|
14
|
+
declare function Group({ className, ...props }: ComponentProps<typeof CommandPrimitive.Group>): import("react").JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Row layout mode:
|
|
17
|
+
* - `item` / `subitem` / `subsubitem` — idle hierarchy (icon column + indent)
|
|
18
|
+
* - `result` — flat search hit (breadcrumb + trailing scope)
|
|
19
|
+
*/
|
|
20
|
+
export type CommandItemLevel = "item" | "subitem" | "subsubitem" | "result";
|
|
21
|
+
type ItemPrimitiveProps = ComponentProps<typeof CommandPrimitive.Item>;
|
|
22
|
+
export interface CommandItemProps extends Omit<ItemPrimitiveProps, "children" | "title"> {
|
|
23
|
+
/**
|
|
24
|
+
* Row depth / mode in the palette:
|
|
25
|
+
* - `item` — page / top destination (icon + title)
|
|
26
|
+
* - `subitem` — section under an item (label aligns with the item title)
|
|
27
|
+
* - `subsubitem` — row under a section (one step deeper)
|
|
28
|
+
* - `result` — flat search hit (`title` + `path` crumbs + `scope`)
|
|
29
|
+
*/
|
|
30
|
+
level?: CommandItemLevel;
|
|
31
|
+
/**
|
|
32
|
+
* Leading glyph. On idle `item` rows (and reserved for sub-levels). On
|
|
33
|
+
* `result` rows, pass the resolved icon (self → parent → grandparent).
|
|
34
|
+
*/
|
|
35
|
+
icon?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* When `level="result"`, force the icon column so labels align across the
|
|
38
|
+
* list even if this row's `icon` is empty. Set true when any sibling result
|
|
39
|
+
* has an icon; omit when the whole result set is icon-less.
|
|
40
|
+
*/
|
|
41
|
+
iconSlot?: boolean;
|
|
42
|
+
/** Primary label. Prefer this over free-form children for the shared layout. */
|
|
43
|
+
title?: ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Ancestors after `title` for `level="result"` — parent → page
|
|
46
|
+
* (e.g. `["Agent profile", "Settings"]` → `Name < Agent profile < Settings`).
|
|
47
|
+
*/
|
|
48
|
+
path?: ReactNode[];
|
|
49
|
+
/**
|
|
50
|
+
* Trailing scope for `level="result"` — `Project` vs `Personal`, not a nav group.
|
|
51
|
+
*/
|
|
52
|
+
scope?: ReactNode;
|
|
53
|
+
/** Shows a trailing external-link glyph (opens outside the app). */
|
|
54
|
+
external?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Free-form content. When `title` is set, rendered after the label stack.
|
|
57
|
+
* When `title` is omitted, becomes the row body (legacy / simple items).
|
|
58
|
+
*/
|
|
59
|
+
children?: ReactNode;
|
|
60
|
+
}
|
|
61
|
+
/** Leading icon column — `size-4`, secondary ink. */
|
|
62
|
+
declare function ItemIcon({ className, ...props }: ComponentProps<"span">): import("react").JSX.Element;
|
|
63
|
+
/** Primary label — medium + primary ink on `item` rows. */
|
|
64
|
+
declare function ItemTitle({ className, level, ...props }: ComponentProps<"span"> & {
|
|
65
|
+
level?: CommandItemLevel;
|
|
66
|
+
}): import("react").JSX.Element;
|
|
67
|
+
declare function Item({ className, level, icon, iconSlot, title, path, scope, external, children, value, ...props }: CommandItemProps): import("react").JSX.Element;
|
|
68
|
+
declare function Separator({ className, ...props }: ComponentProps<typeof CommandPrimitive.Separator>): import("react").JSX.Element;
|
|
69
|
+
declare function Loading({ className, ...props }: ComponentProps<typeof CommandPrimitive.Loading>): import("react").JSX.Element;
|
|
70
|
+
type DialogRootProps = ComponentProps<typeof PhoDialog.Root>;
|
|
71
|
+
interface CommandDialogProps extends ComponentProps<typeof CommandPrimitive> {
|
|
72
|
+
/** Controlled dialog state — pass straight through to `Dialog.Root`. */
|
|
73
|
+
open?: DialogRootProps["open"];
|
|
74
|
+
onOpenChange?: DialogRootProps["onOpenChange"];
|
|
75
|
+
/** Accessible name for the palette (dialog and command menu). */
|
|
76
|
+
label?: string;
|
|
77
|
+
/** Extra classes for the dialog panel (not the command root). */
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A command palette in a modal — Pho's `Dialog` overlay (Base UI) around a
|
|
82
|
+
* `Command.Root`, raised above center. We deliberately skip cmdk's own
|
|
83
|
+
* `Command.Dialog` (Radix) so overlays stay on one primitive stack.
|
|
84
|
+
*
|
|
85
|
+
* List height springs via `AnimatedHeight` (same feel as the Card shell on
|
|
86
|
+
* onboarding / invite) — the input row stays put while results resize.
|
|
87
|
+
*/
|
|
88
|
+
declare function Dialog({ open, onOpenChange, label, className, children, ...props }: CommandDialogProps): import("react").JSX.Element;
|
|
89
|
+
/**
|
|
90
|
+
* Command menu built on `cmdk` — a filterable list of actions driven from a
|
|
91
|
+
* single input, keyboard-first. Compose inline (`Command.Root`) or as a
|
|
92
|
+
* ⌘K-style modal palette (`Command.Dialog`, which owns the overlay). By
|
|
93
|
+
* default cmdk filters and ranks items for you; pass `shouldFilter={false}`
|
|
94
|
+
* to render your own result set (e.g. hierarchy-preserving navigation).
|
|
95
|
+
*
|
|
96
|
+
* Rows share one layout via `Command.Item` `level` — idle
|
|
97
|
+
* `item` → `subitem` → `subsubitem`, or flat `result` while searching.
|
|
98
|
+
*/
|
|
99
|
+
export declare const Command: {
|
|
100
|
+
Root: typeof Root;
|
|
101
|
+
InputGroup: typeof InputGroup;
|
|
102
|
+
Input: typeof Input;
|
|
103
|
+
List: typeof List;
|
|
104
|
+
Empty: typeof Empty;
|
|
105
|
+
Group: typeof Group;
|
|
106
|
+
Item: typeof Item;
|
|
107
|
+
ItemIcon: typeof ItemIcon;
|
|
108
|
+
ItemTitle: typeof ItemTitle;
|
|
109
|
+
Separator: typeof Separator;
|
|
110
|
+
Loading: typeof Loading;
|
|
111
|
+
Dialog: typeof Dialog;
|
|
112
|
+
};
|
|
113
|
+
/** Re-export of cmdk's state selector hook (search, value, filtered counts). */
|
|
114
|
+
export { useCommandState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Command, useCommandState, type CommandItemLevel, type CommandItemProps, } from './command';
|
|
@@ -40,6 +40,12 @@ declare function Popup({ className, ...props }: StyledProps<typeof BaseDialog.Po
|
|
|
40
40
|
declare function Title({ className, ...props }: StyledProps<typeof BaseDialog.Title>): import("react").JSX.Element;
|
|
41
41
|
declare function Description({ className, ...props }: StyledProps<typeof BaseDialog.Description>): import("react").JSX.Element;
|
|
42
42
|
interface ContentProps extends Omit<StyledProps<typeof BaseDialog.Popup>, "title"> {
|
|
43
|
+
/**
|
|
44
|
+
* Decorative icon above the title — typically a Tabler outline icon.
|
|
45
|
+
* Rendered aria-hidden in secondary ink at 32px (`[&>svg]:size-8`). Pass a
|
|
46
|
+
* styled node to override the ink; the size is owned by the slot.
|
|
47
|
+
*/
|
|
48
|
+
icon?: ReactNode;
|
|
43
49
|
/** Heading rendered in the panel header. */
|
|
44
50
|
title?: ReactNode;
|
|
45
51
|
/** Supporting text under the title. */
|
|
@@ -77,7 +83,85 @@ interface ContentProps extends Omit<StyledProps<typeof BaseDialog.Popup>, "title
|
|
|
77
83
|
* full control, compose the parts directly (`Dialog.Portal` /
|
|
78
84
|
* `Dialog.Backdrop` / `Dialog.Popup`).
|
|
79
85
|
*/
|
|
80
|
-
declare function Content({ title, description, consequences, warning, actions, showClose, children, className, ...props }: ContentProps): import("react").JSX.Element;
|
|
86
|
+
declare function Content({ icon, title, description, consequences, warning, actions, showClose, children, className, ...props }: ContentProps): import("react").JSX.Element;
|
|
87
|
+
/**
|
|
88
|
+
* Near-fullscreen popup — the viewport minus a breathing ring, floating over
|
|
89
|
+
* a backdrop (the page stays visible through the gap, so it dims like any
|
|
90
|
+
* floating layer). Still a card: border, elevation, rounded corners; the
|
|
91
|
+
* scale gesture stays but shrinks to 98% — at this size 95% reads like a jump.
|
|
92
|
+
*/
|
|
93
|
+
declare function InsetPopup({ className, ...props }: StyledProps<typeof BaseDialog.Popup>): import("react").JSX.Element;
|
|
94
|
+
interface InsetContentProps extends Omit<StyledProps<typeof BaseDialog.Popup>, "title"> {
|
|
95
|
+
/** Decorative icon above the title — same treatment as `Content`. */
|
|
96
|
+
icon?: ReactNode;
|
|
97
|
+
/** Heading rendered in the panel header. */
|
|
98
|
+
title?: ReactNode;
|
|
99
|
+
/** Supporting text under the title. */
|
|
100
|
+
description?: ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* Bottom action row. Iron rule as `Content`: when `actions` is set, the
|
|
103
|
+
* header close button is never shown — dismiss via the actions.
|
|
104
|
+
*/
|
|
105
|
+
actions?: ReactNode;
|
|
106
|
+
/**
|
|
107
|
+
* Header close control. Only applies when `actions` is absent.
|
|
108
|
+
* @default true
|
|
109
|
+
*/
|
|
110
|
+
showClose?: boolean;
|
|
111
|
+
children?: ReactNode;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Convenience near-fullscreen panel: header pinned on top, body filling and
|
|
115
|
+
* scrolling on its own, optional action row pinned at the bottom. Sits
|
|
116
|
+
* between `Content` (a focused card) and `FullscreenContent` (a page
|
|
117
|
+
* takeover): use it for roomy working surfaces — pickers, editors, previews —
|
|
118
|
+
* that still want the page peeking through an edge.
|
|
119
|
+
*/
|
|
120
|
+
declare function InsetContent({ icon, title, description, actions, showClose, children, className, ...props }: InsetContentProps): import("react").JSX.Element;
|
|
121
|
+
/**
|
|
122
|
+
* Full-viewport popup — a page-surface takeover instead of a floating card.
|
|
123
|
+
* No backdrop: the popup itself is the layer. Fade only; scale is a floating-
|
|
124
|
+
* card gesture and reads wrong at viewport size.
|
|
125
|
+
*/
|
|
126
|
+
declare function FullscreenPopup({ className, ...props }: StyledProps<typeof BaseDialog.Popup>): import("react").JSX.Element;
|
|
127
|
+
interface FullscreenContentProps extends Omit<StyledProps<typeof BaseDialog.Popup>, "title"> {
|
|
128
|
+
/**
|
|
129
|
+
* Decorative icon above the title — same chrome as `Content`, but 48px
|
|
130
|
+
* (`size-12`) for viewport-scale gates.
|
|
131
|
+
*/
|
|
132
|
+
icon?: ReactNode;
|
|
133
|
+
/** Heading of the takeover. */
|
|
134
|
+
title?: ReactNode;
|
|
135
|
+
/** Supporting text under the title. */
|
|
136
|
+
description?: ReactNode;
|
|
137
|
+
/**
|
|
138
|
+
* Action row under the body. Iron rule as `Content`: when `actions` is set,
|
|
139
|
+
* the corner close button is never shown — dismiss via the actions.
|
|
140
|
+
*/
|
|
141
|
+
actions?: ReactNode;
|
|
142
|
+
/**
|
|
143
|
+
* Corner close control. Only applies when `actions` is absent.
|
|
144
|
+
* @default true
|
|
145
|
+
*/
|
|
146
|
+
showClose?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Classes on the viewport-centering frame (the `min-h-full` flex host).
|
|
149
|
+
* Use to drop the default optical `pb-20` when the stack grows (e.g. a
|
|
150
|
+
* captcha) so true center stays put: `frameClassName="pb-6"`.
|
|
151
|
+
*/
|
|
152
|
+
frameClassName?: string;
|
|
153
|
+
children?: ReactNode;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Convenience full-screen panel: the whole viewport becomes the dialog, with
|
|
157
|
+
* a centered column at the standalone-flow width (28rem — the same measure as
|
|
158
|
+
* onboarding / invite cards). Column height follows its content through
|
|
159
|
+
* `AnimatedHeight` (same spring as the Card shell), so step swaps — phone →
|
|
160
|
+
* OTP → captcha — glide instead of jumping. Use for gates the visitor must
|
|
161
|
+
* deal with before the page behind makes sense (e.g. binding a phone number);
|
|
162
|
+
* prefer `Content` for everything conversational.
|
|
163
|
+
*/
|
|
164
|
+
declare function FullscreenContent({ icon, title, description, actions, showClose, frameClassName, children, className, ...props }: FullscreenContentProps): import("react").JSX.Element;
|
|
81
165
|
/**
|
|
82
166
|
* Modal dialog built on Base UI `Dialog`. Controlled or uncontrolled via
|
|
83
167
|
* `Dialog.Root` (`open` / `onOpenChange` / `defaultOpen`). `Dialog.Action`
|
|
@@ -90,10 +174,14 @@ export declare const Dialog: {
|
|
|
90
174
|
Portal: import('react').ForwardRefExoticComponent<Omit<import('@base-ui/react').AlertDialogPortalProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
91
175
|
Backdrop: typeof Backdrop;
|
|
92
176
|
Popup: typeof Popup;
|
|
177
|
+
InsetPopup: typeof InsetPopup;
|
|
178
|
+
FullscreenPopup: typeof FullscreenPopup;
|
|
93
179
|
Title: typeof Title;
|
|
94
180
|
Description: typeof Description;
|
|
95
181
|
Close: import('react').ForwardRefExoticComponent<Omit<import('@base-ui/react').AlertDialogCloseProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
96
182
|
Action: typeof Action;
|
|
97
183
|
Content: typeof Content;
|
|
184
|
+
InsetContent: typeof InsetContent;
|
|
185
|
+
FullscreenContent: typeof FullscreenContent;
|
|
98
186
|
};
|
|
99
187
|
export {};
|
|
@@ -13,8 +13,8 @@ declare function Description({ className, ...props }: StyledProps<typeof BaseDra
|
|
|
13
13
|
/**
|
|
14
14
|
* Drawer built on Base UI `Drawer` — a panel that slides in from the edge
|
|
15
15
|
* (here, the right) with swipe-to-dismiss. Use it for secondary tasks and
|
|
16
|
-
* navigation that should keep page context; for a
|
|
17
|
-
*
|
|
16
|
+
* navigation that should keep page context; for a decision or a centered modal
|
|
17
|
+
* use `Dialog`. Compose `Drawer.Portal`
|
|
18
18
|
* → `Backdrop` → `Viewport` → `Popup` → `Content`.
|
|
19
19
|
*/
|
|
20
20
|
export declare const Drawer: {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { StatusViewSize } from '../status-view/status-view';
|
|
3
|
+
interface ErrorBaseProps {
|
|
4
|
+
/** The caught value — a problem body, an `Error` wrapping one, or unknown. */
|
|
5
|
+
error?: unknown;
|
|
6
|
+
/** Override the derived message. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface ErrorProps extends ErrorBaseProps, Omit<ComponentProps<"div">, keyof ErrorBaseProps> {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Error — one line of red ink naming a server failure (4xx / 5xx), placed
|
|
13
|
+
* inline: under a form, in a card, beside the action that failed. Give it the
|
|
14
|
+
* caught value and it renders the problem's `detail` (falling back to `title`,
|
|
15
|
+
* then to a generic line), plus a docs link when the problem carries one.
|
|
16
|
+
* Renders nothing while `error` is nullish, so it can stay mounted.
|
|
17
|
+
*
|
|
18
|
+
* For a region or page that failed to load, use {@link ErrorView}.
|
|
19
|
+
*/
|
|
20
|
+
export declare function Error({ error, children, className, ...props }: ErrorProps): import("react").JSX.Element | null;
|
|
21
|
+
export declare namespace Error {
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
24
|
+
interface ErrorViewBaseProps {
|
|
25
|
+
/** The caught value — a problem body, an `Error` wrapping one, or unknown. */
|
|
26
|
+
error?: unknown;
|
|
27
|
+
/** Override the derived title. */
|
|
28
|
+
title?: ReactNode;
|
|
29
|
+
/** Override the derived description. */
|
|
30
|
+
description?: ReactNode;
|
|
31
|
+
/** Override the warning glyph. */
|
|
32
|
+
icon?: ReactNode;
|
|
33
|
+
/** Offer a retry — renders a "Try again" button. */
|
|
34
|
+
onRetry?: () => void;
|
|
35
|
+
/** Replace the built-in action row entirely. */
|
|
36
|
+
actions?: ReactNode;
|
|
37
|
+
/** Size variant — StatusView's axis. @default "base" */
|
|
38
|
+
size?: StatusViewSize;
|
|
39
|
+
}
|
|
40
|
+
export interface ErrorViewProps extends ErrorViewBaseProps, Omit<ComponentProps<"div">, keyof ErrorViewBaseProps | "children"> {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* ErrorView — the failed state of a region or page, built on StatusView:
|
|
44
|
+
* warning icon over the problem's `title`, its `detail` and remediation
|
|
45
|
+
* below, an action row (`onRetry` and the problem's docs link), and the
|
|
46
|
+
* request id as a footnote for support. Announces via `role="alert"`.
|
|
47
|
+
*
|
|
48
|
+
* Use `size="sm"` inside cards and panels, the default `base` for whole
|
|
49
|
+
* pages. Renders nothing while `error` is nullish (unless given a static
|
|
50
|
+
* `title`), so it can sit unconditionally next to a query.
|
|
51
|
+
*/
|
|
52
|
+
export declare function ErrorView({ error, title, description, icon, onRetry, actions, size, ...props }: ErrorViewProps): import("react").JSX.Element | null;
|
|
53
|
+
export declare namespace ErrorView {
|
|
54
|
+
var displayName: string;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side mirror of the `@photon-hq/error` response contract — the
|
|
3
|
+
* RFC 9457 Problem Details body every Photon service returns for 4xx / 5xx.
|
|
4
|
+
* Machine logic branches on `code`; `title` / `detail` / `remediation` are
|
|
5
|
+
* the human-readable copy, already reviewed server-side and safe to render.
|
|
6
|
+
*
|
|
7
|
+
* Fetch layers may also hand us a thin status-only shape when the response
|
|
8
|
+
* was not ok but the body was not a contract problem — `title` + `status`
|
|
9
|
+
* still count so the UI can disclose the HTTP code we already know.
|
|
10
|
+
*/
|
|
11
|
+
export interface ProblemRemediation {
|
|
12
|
+
/** What the user can do about it — a full sentence. */
|
|
13
|
+
action?: string;
|
|
14
|
+
/** Docs URL explaining the problem. */
|
|
15
|
+
documentation?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Problem {
|
|
18
|
+
/** Stable machine-readable key (`RATE_LIMITED`) — the field to branch on. */
|
|
19
|
+
code?: string;
|
|
20
|
+
/** Human summary of the problem type ("Too Many Requests"). */
|
|
21
|
+
title: string;
|
|
22
|
+
/** HTTP status (4xx / 5xx). */
|
|
23
|
+
status: number;
|
|
24
|
+
/** Problem type URI (`urn:photon:problem:*` or an https URL). */
|
|
25
|
+
type?: string;
|
|
26
|
+
/** Occurrence-specific human sentence. */
|
|
27
|
+
detail?: string;
|
|
28
|
+
/** Correlation id for support (`X-Request-ID`). */
|
|
29
|
+
requestId?: string;
|
|
30
|
+
remediation?: ProblemRemediation;
|
|
31
|
+
/** RFC 9457 extensions (`issues`, `actualVersion`, …). */
|
|
32
|
+
[extension: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
/** Structural check: `title` + a 4xx/5xx status. `code` is optional. */
|
|
35
|
+
export declare function isProblem(value: unknown): value is Problem;
|
|
36
|
+
/**
|
|
37
|
+
* Find the problem a caught value carries — the value itself, one typed onto
|
|
38
|
+
* an error as a `problem` field (dashboard's `ApiError` shape), or one
|
|
39
|
+
* wrapped in an `Error` `cause` chain (how fetch layers usually rethrow a
|
|
40
|
+
* parsed body). Returns `null` when there is none.
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseProblem(error: unknown): Problem | null;
|
|
43
|
+
export interface ErrorDescription {
|
|
44
|
+
/** Short name of the failure — the problem `title`, or a generic fallback. */
|
|
45
|
+
title: string;
|
|
46
|
+
/** Sentence(s) to show — `detail` and `remediation.action` joined. */
|
|
47
|
+
description?: string;
|
|
48
|
+
/** Docs URL from `remediation.documentation`. */
|
|
49
|
+
documentation?: string;
|
|
50
|
+
/** Correlation id for support. */
|
|
51
|
+
requestId?: string;
|
|
52
|
+
/** The matched problem, when the input carried one. */
|
|
53
|
+
problem?: Problem;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Anything that isn't a problem renders as this — raw `Error` messages are
|
|
57
|
+
* not contract copy and never shown (the same fail-closed stance as the
|
|
58
|
+
* server side of `@photon-hq/error`). Always a full sentence (trailing
|
|
59
|
+
* period).
|
|
60
|
+
*/
|
|
61
|
+
export declare const GENERIC_ERROR_TITLE = "Something went wrong.";
|
|
62
|
+
/** Reason phrase for a status — map first, then a non-generic `problem.title`. */
|
|
63
|
+
export declare function httpReasonPhrase(status: number, fallbackTitle?: string): string | undefined;
|
|
64
|
+
/** Human sentence for a bare HTTP status, when the body carried no copy. */
|
|
65
|
+
export declare function httpStatusExplanation(status: number): string;
|
|
66
|
+
/**
|
|
67
|
+
* Sentence-case the first character. Server `detail` / `title` sometimes
|
|
68
|
+
* arrive fully lowercase; UI copy always leads with a capital.
|
|
69
|
+
*/
|
|
70
|
+
export declare function capitalizeFirst(text: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Turn a caught value into displayable copy. `Error` and `ErrorView` call
|
|
73
|
+
* this internally; use it directly for other surfaces (a toast, a banner).
|
|
74
|
+
*
|
|
75
|
+
* Status-only failures (HTTP not ok, but no contract `code` / copy) still
|
|
76
|
+
* keep `problem` so the details panel can show the status. Title becomes the
|
|
77
|
+
* reason phrase (e.g. "Bad Gateway"); description is a short explanation —
|
|
78
|
+
* not just the numeric code.
|
|
79
|
+
*/
|
|
80
|
+
export declare function describeError(error: unknown): ErrorDescription;
|
|
@@ -65,7 +65,7 @@ export interface NotificationProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
65
65
|
* {@link Toast} — render it as the child of a `Toast.Root` whose own surface you
|
|
66
66
|
* neutralize (`className="bg-transparent p-0 shadow-none ring-0"`) so the
|
|
67
67
|
* manager owns motion and swipe while this card owns the look. For a choice the
|
|
68
|
-
* user must make, use `
|
|
68
|
+
* user must make, use `Dialog` instead.
|
|
69
69
|
*/
|
|
70
70
|
export declare function Notification({ color, title, description, confirmLabel, onConfirm, dismissLabel, onClose, icon, className, ref, ...props }: NotificationProps): import("react").JSX.Element;
|
|
71
71
|
export declare namespace Notification {
|