@photon-ai/pho-ui 1.2.0 → 1.3.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/basic-page-C50WUzYV.js +238 -0
- package/dist/chunks/basic-page-C50WUzYV.js.map +1 -0
- package/dist/chunks/card-9cGnv-VD.js.map +1 -1
- package/dist/chunks/{close-button-Bq9f-H15.js → close-button-B8gF5UNk.js} +3 -3
- package/dist/chunks/close-button-B8gF5UNk.js.map +1 -0
- package/dist/chunks/dialog-Ba0UUE5g.js +155 -0
- package/dist/chunks/dialog-Ba0UUE5g.js.map +1 -0
- package/dist/chunks/{sidebar-BCqq58hV.js → sidebar-DGpEKxOn.js} +3 -3
- package/dist/chunks/{sidebar-BCqq58hV.js.map → sidebar-DGpEKxOn.js.map} +1 -1
- package/dist/chunks/use-press-pulse-8iorQPsh.js +62 -0
- package/dist/chunks/use-press-pulse-8iorQPsh.js.map +1 -0
- package/dist/components/badge.js +46 -31
- package/dist/components/badge.js.map +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/index.js +36 -36
- package/dist/sections/basic-page.js +8 -0
- package/dist/sections/sidebar.js +1 -1
- package/dist/src/components/badge/badge.d.ts +34 -8
- package/dist/src/components/badge/index.d.ts +1 -1
- package/dist/src/components/card/card.d.ts +2 -2
- package/dist/src/components/dialog/dialog.d.ts +16 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/sections/basic-page/basic-page.d.ts +270 -0
- package/dist/src/sections/basic-page/index.d.ts +1 -0
- package/dist/src/sections/sidebar/sidebar.d.ts +1 -1
- package/dist/src/utils/use-press-pulse.d.ts +15 -11
- package/dist/utils.js +1 -1
- package/package.json +4 -4
- package/src/styles/theme.css +20 -0
- package/dist/chunks/close-button-Bq9f-H15.js.map +0 -1
- package/dist/chunks/dialog-DolPKFGS.js +0 -141
- package/dist/chunks/dialog-DolPKFGS.js.map +0 -1
- package/dist/chunks/settings-B0vhLoMi.js +0 -134
- package/dist/chunks/settings-B0vhLoMi.js.map +0 -1
- package/dist/chunks/use-press-pulse-CMwPTOR2.js +0 -44
- package/dist/chunks/use-press-pulse-CMwPTOR2.js.map +0 -1
- package/dist/sections/settings.js +0 -8
- package/dist/src/sections/settings/index.d.ts +0 -1
- package/dist/src/sections/settings/settings.d.ts +0 -170
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { t as g } from "./cn-DTiB6ek_.js";
|
|
3
|
-
import { o as T, t as j } from "./close-button-Bq9f-H15.js";
|
|
4
|
-
import { createContext as R, useCallback as z, useContext as x, useEffect as v, useMemo as A, useRef as m, useState as C } from "react";
|
|
5
|
-
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
|
6
|
-
import { Dialog as i } from "@base-ui/react/dialog";
|
|
7
|
-
var y = R(null);
|
|
8
|
-
function G() {
|
|
9
|
-
return x(y)?.pending ?? !1;
|
|
10
|
-
}
|
|
11
|
-
function E({ onOpenChange: e, actionsRef: n, ...s }) {
|
|
12
|
-
const [u, r] = C(!1), l = m(!1), a = m(null);
|
|
13
|
-
v(() => {
|
|
14
|
-
if (n)
|
|
15
|
-
return n.current = a.current, () => {
|
|
16
|
-
n.current = null;
|
|
17
|
-
};
|
|
18
|
-
}, [n]);
|
|
19
|
-
const o = z((c, p) => {
|
|
20
|
-
if (!c && l.current) {
|
|
21
|
-
p.cancel();
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
e?.(c, p);
|
|
25
|
-
}, [e]), d = A(() => ({
|
|
26
|
-
pending: u,
|
|
27
|
-
beginPending: () => {
|
|
28
|
-
l.current = !0, r(!0);
|
|
29
|
-
},
|
|
30
|
-
endPending: () => {
|
|
31
|
-
l.current = !1, r(!1);
|
|
32
|
-
},
|
|
33
|
-
close: () => a.current?.close()
|
|
34
|
-
}), [u]);
|
|
35
|
-
return /* @__PURE__ */ t(y.Provider, {
|
|
36
|
-
value: d,
|
|
37
|
-
children: /* @__PURE__ */ t(i.Root, {
|
|
38
|
-
actionsRef: a,
|
|
39
|
-
onOpenChange: o,
|
|
40
|
-
...s
|
|
41
|
-
})
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
var O = i.Trigger, N = i.Portal, P = i.Close;
|
|
45
|
-
function V(e) {
|
|
46
|
-
return e != null && typeof e.then == "function";
|
|
47
|
-
}
|
|
48
|
-
function H({ onClick: e, loading: n, disabled: s, ...u }) {
|
|
49
|
-
const r = x(y), [l, a] = C(!1), o = m(!0);
|
|
50
|
-
v(() => (o.current = !0, () => {
|
|
51
|
-
o.current = !1;
|
|
52
|
-
}), []);
|
|
53
|
-
function d(p) {
|
|
54
|
-
if (l || n) return;
|
|
55
|
-
const h = e?.(p);
|
|
56
|
-
if (!V(h)) {
|
|
57
|
-
r?.close();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
a(!0), r?.beginPending(), h.then(() => {
|
|
61
|
-
r?.endPending(), o.current && a(!1), r?.close();
|
|
62
|
-
}, (w) => {
|
|
63
|
-
r?.endPending(), o.current && a(!1), typeof process < "u" && process.env.NODE_ENV !== "production" && console.error("Dialog.Action: async onClick rejected —", w);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
const c = l || n;
|
|
67
|
-
return /* @__PURE__ */ t(T, {
|
|
68
|
-
...u,
|
|
69
|
-
disabled: s || c,
|
|
70
|
-
loading: c,
|
|
71
|
-
onClick: d
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function b({ className: e, ...n }) {
|
|
75
|
-
return /* @__PURE__ */ t(i.Backdrop, {
|
|
76
|
-
className: g("bg-pho-overlay fixed inset-0 z-50 transition-opacity duration-200 ease-out", "data-[ending-style]:opacity-0 data-[ending-style]:duration-150 data-[starting-style]:opacity-0", e),
|
|
77
|
-
...n
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
function B({ className: e, ...n }) {
|
|
81
|
-
return /* @__PURE__ */ t(i.Popup, {
|
|
82
|
-
className: g("border-pho-secondary bg-pho-primary shadow-pho-xl fixed top-1/2 left-1/2 z-50 w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-lg border outline-none", "transition-[opacity,scale] duration-200 ease-out", "data-[starting-style]:scale-95 data-[starting-style]:opacity-0", "data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:duration-150", e),
|
|
83
|
-
...n
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function D({ className: e, ...n }) {
|
|
87
|
-
return /* @__PURE__ */ t(i.Title, {
|
|
88
|
-
className: g("text-pho-primary font-display text-display-sm font-medium text-balance", e),
|
|
89
|
-
...n
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function k({ className: e, ...n }) {
|
|
93
|
-
return /* @__PURE__ */ t(i.Description, {
|
|
94
|
-
className: g("text-pho-description text-display-xs font-normal", e),
|
|
95
|
-
...n
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function M({ title: e, description: n, actions: s, showClose: u = !0, children: r, className: l, ...a }) {
|
|
99
|
-
const o = s == null && u, d = !!(e || n || o), c = r != null || s != null;
|
|
100
|
-
return /* @__PURE__ */ f(N, { children: [/* @__PURE__ */ t(b, {}), /* @__PURE__ */ f(B, {
|
|
101
|
-
className: l,
|
|
102
|
-
...a,
|
|
103
|
-
children: [d && /* @__PURE__ */ f("div", {
|
|
104
|
-
className: "flex flex-col gap-1 px-6 pt-6",
|
|
105
|
-
children: [(e || o) && /* @__PURE__ */ f("div", {
|
|
106
|
-
className: "relative",
|
|
107
|
-
children: [e ? /* @__PURE__ */ t(D, {
|
|
108
|
-
className: o ? "pr-12" : void 0,
|
|
109
|
-
children: e
|
|
110
|
-
}) : /* @__PURE__ */ t("div", {
|
|
111
|
-
className: "h-[1.625rem]",
|
|
112
|
-
"aria-hidden": "true"
|
|
113
|
-
}), o && /* @__PURE__ */ t(P, { render: /* @__PURE__ */ t(j, { className: "absolute top-1/2 right-0 z-10 -translate-y-1/2" }) })]
|
|
114
|
-
}), n && /* @__PURE__ */ t(k, { children: n })]
|
|
115
|
-
}), c && /* @__PURE__ */ f("div", {
|
|
116
|
-
className: "flex flex-col gap-5 px-6 py-5",
|
|
117
|
-
children: [r, s != null && /* @__PURE__ */ t("div", {
|
|
118
|
-
className: "flex justify-end gap-2",
|
|
119
|
-
children: s
|
|
120
|
-
})]
|
|
121
|
-
})]
|
|
122
|
-
})] });
|
|
123
|
-
}
|
|
124
|
-
var I = {
|
|
125
|
-
Root: E,
|
|
126
|
-
Trigger: O,
|
|
127
|
-
Portal: N,
|
|
128
|
-
Backdrop: b,
|
|
129
|
-
Popup: B,
|
|
130
|
-
Title: D,
|
|
131
|
-
Description: k,
|
|
132
|
-
Close: P,
|
|
133
|
-
Action: H,
|
|
134
|
-
Content: M
|
|
135
|
-
};
|
|
136
|
-
export {
|
|
137
|
-
G as n,
|
|
138
|
-
I as t
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
//# sourceMappingURL=dialog-DolPKFGS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-DolPKFGS.js","names":[],"sources":["../../src/components/dialog/dialog.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentProps,\n type ElementType,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from \"react\";\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { cn } from \"../../utils/cn\";\nimport { Button, type ButtonProps } from \"../button/button\";\nimport { CloseButton } from \"../button/close-button\";\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\n/* ========================== Async pending context ========================== */\n\n/** Imperative actions exposed by Base UI's `actionsRef`. */\ninterface RootActions {\n unmount: () => void;\n close: () => void;\n}\n\ninterface DialogPendingContextValue {\n /** True while a `Dialog.Action` promise is in flight. */\n pending: boolean;\n beginPending: () => void;\n endPending: () => void;\n /** Close the dialog imperatively (used by `Dialog.Action` on resolve). */\n close: () => void;\n}\n\nconst DialogPendingContext = createContext<DialogPendingContextValue | null>(\n null,\n);\n\n/**\n * Whether the surrounding dialog has a `Dialog.Action` promise in flight —\n * use it to disable secondary actions (Cancel etc.) while work is pending.\n * Returns `false` outside a `Dialog.Root`.\n */\nexport function useDialogPending(): boolean {\n return useContext(DialogPendingContext)?.pending ?? false;\n}\n\ntype RootProps = ComponentProps<typeof BaseDialog.Root>;\n\n/**\n * `Dialog.Root` with async awareness: while a `Dialog.Action` promise is\n * pending, every close request (outside press, Escape, `Dialog.Close`) is\n * cancelled so the dialog stays open until the work settles. Props pass\n * through to Base UI's `Dialog.Root` unchanged.\n */\nfunction Root({ onOpenChange, actionsRef, ...props }: RootProps) {\n const [pending, setPending] = useState(false);\n // Guard reads a ref so a resolve → close() in the same tick isn't blocked\n // by a not-yet-flushed state update.\n const pendingRef = useRef(false);\n const internalActionsRef = useRef<RootActions | null>(null);\n\n // Keep a caller-supplied actionsRef working alongside our internal one.\n useEffect(() => {\n if (!actionsRef) return;\n actionsRef.current = internalActionsRef.current;\n return () => {\n actionsRef.current = null;\n };\n }, [actionsRef]);\n\n const handleOpenChange = useCallback<NonNullable<RootProps[\"onOpenChange\"]>>(\n (open, eventDetails) => {\n if (!open && pendingRef.current) {\n eventDetails.cancel();\n return;\n }\n onOpenChange?.(open, eventDetails);\n },\n [onOpenChange],\n );\n\n const contextValue = useMemo<DialogPendingContextValue>(\n () => ({\n pending,\n beginPending: () => {\n pendingRef.current = true;\n setPending(true);\n },\n endPending: () => {\n pendingRef.current = false;\n setPending(false);\n },\n close: () => internalActionsRef.current?.close(),\n }),\n [pending],\n );\n\n return (\n <DialogPendingContext.Provider value={contextValue}>\n <BaseDialog.Root\n actionsRef={internalActionsRef}\n onOpenChange={handleOpenChange}\n {...props}\n />\n </DialogPendingContext.Provider>\n );\n}\n\nconst Trigger = BaseDialog.Trigger;\nconst Portal = BaseDialog.Portal;\nconst Close = BaseDialog.Close;\n\n/* ============================== Dialog.Action ============================== */\n\nexport interface DialogActionProps extends Omit<ButtonProps, \"onClick\"> {\n /**\n * Confirm handler. Return a promise to keep the dialog open while it runs:\n * the button shows `loading`, all dismissal is locked, and the dialog\n * closes when the promise resolves. On rejection the dialog stays open —\n * surface errors inside the handler. A non-promise return closes\n * immediately, like `Dialog.Close`.\n */\n onClick?: (\n event: ReactMouseEvent<HTMLButtonElement>,\n ) => void | Promise<unknown>;\n}\n\nfunction isThenable(value: unknown): value is Promise<unknown> {\n return (\n value != null && typeof (value as { then?: unknown }).then === \"function\"\n );\n}\n\n/**\n * The confirm button of an action row, with native promise support — a\n * `Button` that runs its (possibly async) `onClick` and closes the dialog\n * when the work settles successfully.\n */\nfunction Action({ onClick, loading, disabled, ...props }: DialogActionProps) {\n const pendingContext = useContext(DialogPendingContext);\n const [busy, setBusy] = useState(false);\n const mountedRef = useRef(true);\n\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n function handleClick(event: ReactMouseEvent<HTMLButtonElement>) {\n if (busy || loading) return;\n const result = onClick?.(event);\n if (!isThenable(result)) {\n pendingContext?.close();\n return;\n }\n setBusy(true);\n pendingContext?.beginPending();\n result.then(\n () => {\n pendingContext?.endPending();\n if (mountedRef.current) setBusy(false);\n pendingContext?.close();\n },\n (error: unknown) => {\n pendingContext?.endPending();\n if (mountedRef.current) setBusy(false);\n if (\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\"\n ) {\n console.error(\"Dialog.Action: async onClick rejected —\", error);\n }\n },\n );\n }\n\n const inert = busy || loading;\n return (\n <Button\n {...props}\n disabled={disabled || inert}\n loading={inert}\n onClick={handleClick}\n />\n );\n}\n\nfunction Backdrop({\n className,\n ...props\n}: StyledProps<typeof BaseDialog.Backdrop>) {\n return (\n <BaseDialog.Backdrop\n className={cn(\n \"bg-pho-overlay fixed inset-0 z-50 transition-opacity duration-200 ease-out\",\n \"data-[ending-style]:opacity-0 data-[ending-style]:duration-150 data-[starting-style]:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Popup({ className, ...props }: StyledProps<typeof BaseDialog.Popup>) {\n return (\n <BaseDialog.Popup\n className={cn(\n // Floating layer: bg-pho-primary + border-pho-secondary hairline, elevation kept.\n \"border-pho-secondary bg-pho-primary shadow-pho-xl fixed top-1/2 left-1/2 z-50 w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-lg border outline-none\",\n // Opacity + scale only — leave translate centering alone (no transition-all).\n \"transition-[opacity,scale] duration-200 ease-out\",\n \"data-[starting-style]:scale-95 data-[starting-style]:opacity-0\",\n \"data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:duration-150\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Title({ className, ...props }: StyledProps<typeof BaseDialog.Title>) {\n return (\n <BaseDialog.Title\n className={cn(\n \"text-pho-primary font-display text-display-sm font-medium text-balance\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Description({\n className,\n ...props\n}: StyledProps<typeof BaseDialog.Description>) {\n return (\n <BaseDialog.Description\n className={cn(\n \"text-pho-description text-display-xs font-normal\",\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface ContentProps extends Omit<\n StyledProps<typeof BaseDialog.Popup>,\n \"title\"\n> {\n /** Heading rendered in the panel header. */\n title?: ReactNode;\n /** Supporting text under the title. */\n description?: ReactNode;\n /**\n * Footer action row (Cancel / Confirm, etc.). Iron rule: when `actions` is\n * set, the header close button is never shown — dismiss via the actions.\n */\n actions?: ReactNode;\n /**\n * Header close control. Only applies when `actions` is absent.\n * @default true\n */\n showClose?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Convenience panel: renders the portal, backdrop, and styled popup with an\n * optional header (title/description + close) and optional action row. For\n * full control, compose the parts directly (`Dialog.Portal` /\n * `Dialog.Backdrop` / `Dialog.Popup`).\n */\nfunction Content({\n title,\n description,\n actions,\n showClose = true,\n children,\n className,\n ...props\n}: ContentProps) {\n // Iron rule: action dialogs dismiss via their actions — never a header X.\n const showCloseButton = actions == null && showClose;\n const hasHeader = Boolean(title || description || showCloseButton);\n const hasBody = children != null || actions != null;\n\n return (\n <Portal>\n <Backdrop />\n <Popup className={className} {...props}>\n {hasHeader && (\n <div className=\"flex flex-col gap-1 px-6 pt-6\">\n {(title || showCloseButton) && (\n // Title row height = title only. Close is out of flow, centered\n // on the row, and may paint outside it (no clip, no stretch).\n <div className=\"relative\">\n {title ? (\n <Title className={showCloseButton ? \"pr-12\" : undefined}>\n {title}\n </Title>\n ) : (\n <div className=\"h-[1.625rem]\" aria-hidden=\"true\" />\n )}\n {showCloseButton && (\n <Close\n render={\n <CloseButton className=\"absolute top-1/2 right-0 z-10 -translate-y-1/2\" />\n }\n />\n )}\n </div>\n )}\n {description && <Description>{description}</Description>}\n </div>\n )}\n {hasBody && (\n <div className=\"flex flex-col gap-5 px-6 py-5\">\n {children}\n {actions != null && (\n <div className=\"flex justify-end gap-2\">{actions}</div>\n )}\n </div>\n )}\n </Popup>\n </Portal>\n );\n}\n\n/**\n * Modal dialog built on Base UI `Dialog`. Controlled or uncontrolled via\n * `Dialog.Root` (`open` / `onOpenChange` / `defaultOpen`). `Dialog.Action`\n * adds native promise support: an async confirm keeps the dialog open and\n * undismissable until the work resolves.\n */\nexport const Dialog = {\n Root,\n Trigger,\n Portal,\n Backdrop,\n Popup,\n Title,\n Description,\n Close,\n Action,\n Content,\n};\n"],"mappings":";;;;;;AA2CA,IAAM,IAAuB,EAC3B,IACF;AAOA,SAAgB,IAA4B;AAC1C,SAAO,EAAW,CAAoB,GAAG,WAAW;AACtD;AAUA,SAAS,EAAK,EAAE,cAAA,GAAc,YAAA,GAAY,GAAG,EAAA,GAAoB;AAC/D,Q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AAQA,IAAa,IAAS;AAAA,EACpB,MAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AACF"}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { t as r } from "./cn-DTiB6ek_.js";
|
|
3
|
-
import "react";
|
|
4
|
-
import { jsx as a, jsxs as s } from "react/jsx-runtime";
|
|
5
|
-
var p = "divide-y divide-pho-secondary rounded-base border border-pho-secondary bg-pho-primary", c = "flex flex-col gap-3 rounded-base border border-pho-secondary bg-pho-page p-5", m = "flex min-h-[4.25rem] flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6";
|
|
6
|
-
function x({ className: e, ...t }) {
|
|
7
|
-
return /* @__PURE__ */ a("div", {
|
|
8
|
-
className: r("mx-auto w-full max-w-2xl py-12", e),
|
|
9
|
-
...t
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function u({ className: e, children: t, ...n }) {
|
|
13
|
-
return /* @__PURE__ */ a("h1", {
|
|
14
|
-
className: r("text-display-base text-pho-primary px-5 font-medium", e),
|
|
15
|
-
...n,
|
|
16
|
-
children: t
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function d({ className: e, ...t }) {
|
|
20
|
-
return /* @__PURE__ */ a("div", {
|
|
21
|
-
className: r("mt-6 flex flex-col gap-10", "*:flex *:flex-col *:gap-3", e),
|
|
22
|
-
...t
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function f({ className: e, ...t }) {
|
|
26
|
-
return /* @__PURE__ */ a("div", {
|
|
27
|
-
className: r("flex flex-col gap-0.5", e),
|
|
28
|
-
...t
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
function h({ className: e, children: t, ...n }) {
|
|
32
|
-
return /* @__PURE__ */ a("h2", {
|
|
33
|
-
className: r("text-display-xs text-pho-primary px-5 font-medium", e),
|
|
34
|
-
...n,
|
|
35
|
-
children: t
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function N({ className: e, ...t }) {
|
|
39
|
-
return /* @__PURE__ */ a("p", {
|
|
40
|
-
className: r("text-display-xs text-pho-description px-5 font-normal", e),
|
|
41
|
-
...t
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function y({ className: e, ...t }) {
|
|
45
|
-
return /* @__PURE__ */ a("div", {
|
|
46
|
-
className: r(p, e),
|
|
47
|
-
...t
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function b({ className: e, ...t }) {
|
|
51
|
-
return /* @__PURE__ */ a("div", {
|
|
52
|
-
className: r(c, e),
|
|
53
|
-
...t
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function v({ className: e, children: t, ...n }) {
|
|
57
|
-
return /* @__PURE__ */ a("h2", {
|
|
58
|
-
className: r("text-display-xs text-pho-primary font-medium", e),
|
|
59
|
-
...n,
|
|
60
|
-
children: t
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function g({ className: e, ...t }) {
|
|
64
|
-
return /* @__PURE__ */ a("p", {
|
|
65
|
-
className: r("text-display-xs text-pho-description font-normal", e),
|
|
66
|
-
...t
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function w({ label: e, description: t, htmlFor: n, className: o, children: i, ...l }) {
|
|
70
|
-
return /* @__PURE__ */ s("div", {
|
|
71
|
-
className: r(m, o),
|
|
72
|
-
...l,
|
|
73
|
-
children: [/* @__PURE__ */ s("div", {
|
|
74
|
-
className: "min-w-0",
|
|
75
|
-
children: [n ? /* @__PURE__ */ a("label", {
|
|
76
|
-
htmlFor: n,
|
|
77
|
-
className: "text-pho-primary block text-base font-normal",
|
|
78
|
-
children: e
|
|
79
|
-
}) : /* @__PURE__ */ a("p", {
|
|
80
|
-
className: "text-pho-primary text-base font-normal",
|
|
81
|
-
children: e
|
|
82
|
-
}), t ? /* @__PURE__ */ a("p", {
|
|
83
|
-
className: "text-pho-description mt-0.5 text-xs",
|
|
84
|
-
children: t
|
|
85
|
-
}) : null]
|
|
86
|
-
}), /* @__PURE__ */ a("div", {
|
|
87
|
-
className: "flex w-full min-w-0 items-center gap-2 sm:w-auto",
|
|
88
|
-
children: i
|
|
89
|
-
})]
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function T({ className: e, ...t }) {
|
|
93
|
-
return /* @__PURE__ */ a("p", {
|
|
94
|
-
className: r("text-pho-description truncate text-base", e),
|
|
95
|
-
...t
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function S({ className: e, ...t }) {
|
|
99
|
-
return /* @__PURE__ */ a("p", {
|
|
100
|
-
role: "alert",
|
|
101
|
-
className: r("text-pho-error px-5 pb-3 text-xs", e),
|
|
102
|
-
...t
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function C({ className: e, ...t }) {
|
|
106
|
-
return /* @__PURE__ */ a("div", {
|
|
107
|
-
className: r("flex items-center justify-between gap-6 px-5 py-4", e),
|
|
108
|
-
...t
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
var E = {
|
|
112
|
-
Page: x,
|
|
113
|
-
PageTitle: u,
|
|
114
|
-
Stack: d,
|
|
115
|
-
Header: f,
|
|
116
|
-
SectionTitle: h,
|
|
117
|
-
Description: N,
|
|
118
|
-
Card: y,
|
|
119
|
-
Callout: b,
|
|
120
|
-
CalloutTitle: v,
|
|
121
|
-
CalloutDescription: g,
|
|
122
|
-
Row: w,
|
|
123
|
-
Value: T,
|
|
124
|
-
Alert: S,
|
|
125
|
-
Footer: C
|
|
126
|
-
};
|
|
127
|
-
export {
|
|
128
|
-
E as i,
|
|
129
|
-
p as n,
|
|
130
|
-
m as r,
|
|
131
|
-
c as t
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
//# sourceMappingURL=settings-B0vhLoMi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings-B0vhLoMi.js","names":[],"sources":["../../src/sections/settings/settings.tsx"],"sourcesContent":["import { type ComponentProps, type ReactNode, type Ref } from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/**\n * Settings — Pho's settings-page section: a page title, section titles, and\n * bordered cards of label/control rows.\n *\n * Spacing: wrap the page in `Page` (`max-w-2xl`, vertical padding). `Stack`\n * separates blocks (`gap-10`). Inside a block, children share `gap-3`. Wrap a\n * section title + description in `Header` (`gap-0.5`) so that pair stays tight\n * — don't put them as loose siblings. Parts already carry `px-5`.\n */\n\n/* ------------------------------- class map ------------------------------- */\n\n/** Bordered card that stacks rows with hairline dividers. */\nexport const SETTINGS_CARD =\n \"divide-y divide-pho-secondary rounded-base border border-pho-secondary bg-pho-primary\";\n\n/**\n * Standalone callout surface — featured block (invite form, notice, etc.).\n * Don't wrap in `Card`; this is the outer chrome.\n */\nexport const SETTINGS_CALLOUT =\n \"flex flex-col gap-3 rounded-base border border-pho-secondary bg-pho-page p-5\";\n\n/**\n * One settings row — label (+ optional description) left, control right.\n * `min-h-[4.25rem]` (68px) keeps avatar/control rows from collapsing shorter\n * than a comfortable touch target.\n */\nexport const SETTINGS_ROW =\n \"flex min-h-[4.25rem] flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6\";\n\n/* --------------------------------- parts --------------------------------- */\n\n/**\n * Page chrome — centered column at the settings content width. Hosts\n * `PageTitle` + `Stack` (and any route-level siblings). Prefer this over\n * ad-hoc `max-w-*` wrappers in the app shell.\n */\nfunction Page({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div\n className={cn(\"mx-auto w-full max-w-2xl py-12\", className)}\n {...props}\n />\n );\n}\n\n/** Page title — largest heading on the surface. */\nfunction PageTitle({\n className,\n children,\n ...props\n}: ComponentProps<\"h1\"> & { ref?: Ref<HTMLHeadingElement> }) {\n return (\n <h1\n className={cn(\n \"text-display-base text-pho-primary px-5 font-medium\",\n className,\n )}\n {...props}\n >\n {children}\n </h1>\n );\n}\n\n/**\n * Vertical stack under the page title. Blocks (forms / sections) use `gap-10`;\n * each block lays out its children with `gap-3`.\n */\nfunction Stack({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div\n className={cn(\n \"mt-6 flex flex-col gap-10\",\n \"*:flex *:flex-col *:gap-3\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Title + optional description pair. Keeps that couple tight (`gap-0.5`) so\n * the block's `gap-3` only applies between this header and the card.\n */\nfunction Header({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return <div className={cn(\"flex flex-col gap-0.5\", className)} {...props} />;\n}\n\n/** Section heading — same padding as the page title, smaller type. */\nfunction SectionTitle({\n className,\n children,\n ...props\n}: ComponentProps<\"h2\"> & { ref?: Ref<HTMLHeadingElement> }) {\n return (\n <h2\n className={cn(\n \"text-display-xs text-pho-primary px-5 font-medium\",\n className,\n )}\n {...props}\n >\n {children}\n </h2>\n );\n}\n\n/**\n * Supporting copy under a section title. Same display step as the title;\n * color + normal weight keep it secondary. Always wrap with `Header`.\n */\nfunction Description({\n className,\n ...props\n}: ComponentProps<\"p\"> & { ref?: Ref<HTMLParagraphElement> }) {\n return (\n <p\n className={cn(\n \"text-display-xs text-pho-description px-5 font-normal\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Bordered card that stacks settings rows with hairline dividers. */\nfunction Card({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return <div className={cn(SETTINGS_CARD, className)} {...props} />;\n}\n\n/**\n * Standalone callout. Pair with `CalloutTitle` / `CalloutDescription` (and\n * optional actions) for a featured block — e.g. an invite form. Do not wrap\n * in `Card`; this is already the outer surface.\n */\nfunction Callout({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return <div className={cn(SETTINGS_CALLOUT, className)} {...props} />;\n}\n\n/** Callout heading — same type as `SectionTitle`. */\nfunction CalloutTitle({\n className,\n children,\n ...props\n}: ComponentProps<\"h2\"> & { ref?: Ref<HTMLHeadingElement> }) {\n return (\n <h2\n className={cn(\"text-display-xs text-pho-primary font-medium\", className)}\n {...props}\n >\n {children}\n </h2>\n );\n}\n\n/** Supporting copy under a callout title. */\nfunction CalloutDescription({\n className,\n ...props\n}: ComponentProps<\"p\"> & { ref?: Ref<HTMLParagraphElement> }) {\n return (\n <p\n className={cn(\n \"text-display-xs text-pho-description font-normal\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface SettingsRowProps extends Omit<ComponentProps<\"div\">, \"title\"> {\n /** Left-side field name. */\n label: string;\n /** Optional helper under the label. */\n description?: ReactNode;\n /** Associates the label with a control id. When omitted, the label is not a `<label>`. */\n htmlFor?: string;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * One settings row: label (+ optional description) left, control right.\n * Pass `htmlFor` when the row wraps a labelled input; omit it for display/\n * action rows (avatar, danger-zone delete).\n */\nfunction Row({\n label,\n description,\n htmlFor,\n className,\n children,\n ...props\n}: SettingsRowProps) {\n return (\n <div className={cn(SETTINGS_ROW, className)} {...props}>\n <div className=\"min-w-0\">\n {htmlFor ? (\n <label\n htmlFor={htmlFor}\n className=\"text-pho-primary block text-base font-normal\"\n >\n {label}\n </label>\n ) : (\n <p className=\"text-pho-primary text-base font-normal\">{label}</p>\n )}\n {description ? (\n <p className=\"text-pho-description mt-0.5 text-xs\">{description}</p>\n ) : null}\n </div>\n <div className=\"flex w-full min-w-0 items-center gap-2 sm:w-auto\">\n {children}\n </div>\n </div>\n );\n}\n\n/** Read-only value on the right side of a row (email, etc.). */\nfunction Value({\n className,\n ...props\n}: ComponentProps<\"p\"> & { ref?: Ref<HTMLParagraphElement> }) {\n return (\n <p\n className={cn(\"text-pho-description truncate text-base\", className)}\n {...props}\n />\n );\n}\n\n/**\n * Inline error under a row (still inside the card). Matches card horizontal\n * padding so hosts don't re-apply `px-5`.\n */\nfunction Alert({\n className,\n ...props\n}: ComponentProps<\"p\"> & { ref?: Ref<HTMLParagraphElement> }) {\n return (\n <p\n role=\"alert\"\n className={cn(\"text-pho-error px-5 pb-3 text-xs\", className)}\n {...props}\n />\n );\n}\n\n/**\n * Trailing bar inside a card — typically a save status + submit button that\n * appears after the form is dirty. Same horizontal/vertical padding as a row.\n */\nfunction Footer({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div\n className={cn(\n \"flex items-center justify-between gap-6 px-5 py-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/* -------------------------------- assembly ------------------------------- */\n\n/**\n * Settings page layout. One stack, one gap rhythm — only title scale differs:\n *\n * ```tsx\n * <Settings.Page>\n * <Settings.PageTitle>Profile</Settings.PageTitle>\n * <Settings.Stack>\n * <form>\n * <Settings.Card>\n * <Settings.Row label=\"Name\" htmlFor=\"first-name\">\n * <Input id=\"first-name\" size=\"sm\" />\n * </Settings.Row>\n * </Settings.Card>\n * </form>\n * <form>\n * <Settings.Header>\n * <Settings.SectionTitle>Agent profile</Settings.SectionTitle>\n * <Settings.Description>…</Settings.Description>\n * </Settings.Header>\n * <Settings.Card>…</Settings.Card>\n * </form>\n * <div>\n * <Settings.SectionTitle>Danger zone</Settings.SectionTitle>\n * <Settings.Card>\n * <Settings.Row label=\"Delete account\" description=\"…\">\n * <Button color=\"destructive\" size=\"sm\">Delete</Button>\n * </Settings.Row>\n * </Settings.Card>\n * </div>\n * <Settings.Callout>\n * <Settings.Header>\n * <Settings.CalloutTitle>Invitations</Settings.CalloutTitle>\n * <Settings.CalloutDescription>…</Settings.CalloutDescription>\n * </Settings.Header>\n * …invite form…\n * </Settings.Callout>\n * </Settings.Stack>\n * </Settings.Page>\n * ```\n */\nexport const Settings = {\n Page,\n PageTitle,\n Stack,\n Header,\n SectionTitle,\n Description,\n Card,\n Callout,\n CalloutTitle,\n CalloutDescription,\n Row,\n Value,\n Alert,\n Footer,\n};\n"],"mappings":";;;;AAgBA,IAAa,IACX,yFAMW,IACX,gFAOW,IACX;AASF,SAAS,EAAK,EACZ,WAAA,GACA,GAAG,EAAA,GACqD;AACxD,SACE,gBAAA,EAAC,OAAD;AAAA,IACE,WAAW,EAAG,kCAAkC,CAAS;AAAA,IACzD,GAAI;AAAA,EACL,CAAA;AAEL;AAGA,SAAS,EAAU,EACjB,WAAA,GACA,UAAA,GACA,GAAG,EAAA,GACwD;AAC3D,SACE,gBAAA,EAAC,MAAD;AAAA,IACE,WAAW,EACT,uDACA,CACF;AAAA,IACA,GAAI;AAAA,IAEH,UAAA;AAAA,EACC,CAAA;AAER;AAMA,SAAS,EAAM,EACb,WAAA,GACA,GAAG,EAAA,GACqD;AACxD,SACE,gBAAA,EAAC,OAAD;AAAA,IACE,WAAW,EACT,6BACA,6BACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAMA,SAAS,EAAO,EACd,WAAA,GACA,GAAG,EAAA,GACqD;AACxD,SAAO,gBAAA,EAAC,OAAD;AAAA,IAAK,WAAW,EAAG,yBAAyB,CAAS;AAAA,IAAG,GAAI;AAAA,EAAQ,CAAA;AAC7E;AAGA,SAAS,EAAa,EACpB,WAAA,GACA,UAAA,GACA,GAAG,EAAA,GACwD;AAC3D,SACE,gBAAA,EAAC,MAAD;AAAA,IACE,WAAW,EACT,qDACA,CACF;AAAA,IACA,GAAI;AAAA,IAEH,UAAA;AAAA,EACC,CAAA;AAER;AAMA,SAAS,EAAY,EACnB,WAAA,GACA,GAAG,EAAA,GACyD;AAC5D,SACE,gBAAA,EAAC,KAAD;AAAA,IACE,WAAW,EACT,yDACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAGA,SAAS,EAAK,EACZ,WAAA,GACA,GAAG,EAAA,GACqD;AACxD,SAAO,gBAAA,EAAC,OAAD;AAAA,IAAK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AA,GACyD;AAC5D,SACE,gBAAA,EAAC,KAAD;AAAA,IACE,WAAW,EAAG,2CAA2C,CAAS;AAAA,IAClE,GAAI;AAAA,EACL,CAAA;AAEL;AAMA,SAAS,EAAM,EACb,WAAA,GACA,GAAG,EAAA,GACyD;AAC5D,SACE,gBAAA,EAAC,KAAD;AAAA,IACE,MAAK;AAAA,IACL,WAAW,EAAG,oCAAoC,CAAS;AAAA,IAC3D,GAAI;AAAA,EACL,CAAA;AAEL;AAMA,SAAS,EAAO,EACd,WAAA,GACA,GAAG,EAAA,GACqD;AACxD,SACE,gBAAA,EAAC,OAAD;AAAA,IACE,WAAW,EACT,qDACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AA4CA,IAAa,IAAW;AAAA,EACtB,MAAA;AAAA,EACA,WAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,cAAA;AAAA,EACA,aAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,oBAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AACF"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useCallback as o, useRef as c } from "react";
|
|
3
|
-
import { useAnimationControls as u } from "motion/react";
|
|
4
|
-
var f = {
|
|
5
|
-
type: "spring",
|
|
6
|
-
stiffness: 700,
|
|
7
|
-
damping: 32,
|
|
8
|
-
mass: 0.06
|
|
9
|
-
}, p = 0.96;
|
|
10
|
-
function R(s) {
|
|
11
|
-
const a = s?.scale ?? 0.96, i = s?.disabled ?? !1, t = s?.transition ?? f, n = u(), e = c(!1), r = o(() => {
|
|
12
|
-
i || e.current || (e.current = !0, n.start({
|
|
13
|
-
scale: a,
|
|
14
|
-
transition: t
|
|
15
|
-
}).then(() => n.start({
|
|
16
|
-
scale: 1,
|
|
17
|
-
transition: t
|
|
18
|
-
})).finally(() => {
|
|
19
|
-
e.current = !1;
|
|
20
|
-
}));
|
|
21
|
-
}, [
|
|
22
|
-
n,
|
|
23
|
-
i,
|
|
24
|
-
a,
|
|
25
|
-
t
|
|
26
|
-
]);
|
|
27
|
-
return {
|
|
28
|
-
pulse: r,
|
|
29
|
-
motionProps: {
|
|
30
|
-
initial: !1,
|
|
31
|
-
animate: n,
|
|
32
|
-
onPointerDown: o((l) => {
|
|
33
|
-
l.button === 0 && r();
|
|
34
|
-
}, [r])
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
f as n,
|
|
40
|
-
R as r,
|
|
41
|
-
p as t
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=use-press-pulse-CMwPTOR2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-press-pulse-CMwPTOR2.js","names":[],"sources":["../../src/utils/use-press-pulse.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\nimport { useAnimationControls, type Transition } from \"motion/react\";\n\n/**\n * Press pulse for selection controls (Select trigger, Checkbox…) — the same\n * spring family as Button's effect press, with one deliberate difference:\n * Button compresses only while held (`whileTap`); these controls play ONE\n * FULL pulse (press in → spring back) from the moment of pointer-down, even\n * if the pointer lifts early — a discrete \"it took\" tick, kept shallow and\n * quick so it registers without drawing attention.\n */\nexport const CONTROL_PRESS_SPRING = {\n type: \"spring\",\n stiffness: 700,\n damping: 32,\n mass: 0.06,\n} as const;\n\n/** Default pulse depth — shallow; each control can tune its own. */\nexport const CONTROL_PRESS_SCALE = 0.96;\n\n/**\n * One-shot scale pulse driven by Motion controls. Spread `motionProps` onto a\n * `motion.*` element (via Base UI `render`): pointer-down (primary button)\n * plays press → rest in full; re-presses during the pulse are coalesced.\n */\nexport function usePressPulse(opts?: {\n scale?: number;\n disabled?: boolean;\n /** Spring override for both legs of the pulse. @default CONTROL_PRESS_SPRING */\n transition?: Transition;\n}) {\n const scale = opts?.scale ?? CONTROL_PRESS_SCALE;\n const disabled = opts?.disabled ?? false;\n const transition = opts?.transition ?? CONTROL_PRESS_SPRING;\n const controls = useAnimationControls();\n const running = useRef(false);\n\n const pulse = useCallback(() => {\n if (disabled || running.current) return;\n running.current = true;\n void controls\n .start({ scale, transition })\n .then(() => controls.start({ scale: 1, transition }))\n .finally(() => {\n running.current = false;\n });\n }, [controls, disabled, scale, transition]);\n\n const onPointerDown = useCallback(\n (event: { button: number }) => {\n if (event.button === 0) pulse();\n },\n [pulse],\n );\n\n return {\n pulse,\n motionProps: { initial: false as const, animate: controls, onPointerDown },\n };\n}\n"],"mappings":";;;AAWA,IAAa,IAAuB;AAAA,EAClC,MAAM;AAAA,EACN,WAAW;AAAA,EACX,SAAS;AAAA,EACT,MAAM;AACR,GAGa,IAAsB;AAOnC,SAAgB,EAAc,GAK3B;AACD,QAAM,IAAQ,GAAM,SAAA,MACd,IAAW,GAAM,YAAY,IAC7B,IAAa,GAAM,cAAc,GACjC,IAAW,EAAqB,GAChC,IAAU,EAAO,EAAK,GAEtB,IAAQ,EAAA,MAAkB;AAC9B,IAAI,KAAY,EAAQ,YACxB,EAAQ,UAAU,IAClB,EACG,MAAM;AAAA,MAAE,OAAA;AAAA,MAAO,YAAA;AAAA,IAAW,CAAC,EAC3B,KAAA,MAAW,EAAS,MAAM;AAAA,MAAE,OAAO;AAAA,MAAG,YAAA;AAAA,IAAW,CAAC,CAAC,EACnD,QAAA,MAAc;AACb,MAAA,EAAQ,UAAU;AAAA,IACpB,CAAC;AAAA,EACL,GAAG;AAAA,IAAC;AAAA,IAAU;AAAA,IAAU;AAAA,IAAO;AAAA,EAAU,CAAC;AAS1C,SAAO;AAAA,IACL,OAAA;AAAA,IACA,aAAa;AAAA,MAAE,SAAS;AAAA,MAAgB,SAAS;AAAA,MAAU,eATvC,EAAA,CACnB,MAA8B;AAC7B,QAAI,EAAM,WAAW,KAAG,EAAM;AAAA,MAChC,GACA,CAAC,CAAK,CAKqD;AAAA,IAAc;AAAA,EAC3E;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Settings, SETTINGS_CARD, SETTINGS_CALLOUT, SETTINGS_ROW, type SettingsRowProps, } from './settings';
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { ComponentProps, ReactNode, Ref } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Settings — Pho's settings-page section: a page title, section titles, and
|
|
4
|
-
* bordered cards of label/control rows.
|
|
5
|
-
*
|
|
6
|
-
* Spacing: wrap the page in `Page` (`max-w-2xl`, vertical padding). `Stack`
|
|
7
|
-
* separates blocks (`gap-10`). Inside a block, children share `gap-3`. Wrap a
|
|
8
|
-
* section title + description in `Header` (`gap-0.5`) so that pair stays tight
|
|
9
|
-
* — don't put them as loose siblings. Parts already carry `px-5`.
|
|
10
|
-
*/
|
|
11
|
-
/** Bordered card that stacks rows with hairline dividers. */
|
|
12
|
-
export declare const SETTINGS_CARD = "divide-y divide-pho-secondary rounded-base border border-pho-secondary bg-pho-primary";
|
|
13
|
-
/**
|
|
14
|
-
* Standalone callout surface — featured block (invite form, notice, etc.).
|
|
15
|
-
* Don't wrap in `Card`; this is the outer chrome.
|
|
16
|
-
*/
|
|
17
|
-
export declare const SETTINGS_CALLOUT = "flex flex-col gap-3 rounded-base border border-pho-secondary bg-pho-page p-5";
|
|
18
|
-
/**
|
|
19
|
-
* One settings row — label (+ optional description) left, control right.
|
|
20
|
-
* `min-h-[4.25rem]` (68px) keeps avatar/control rows from collapsing shorter
|
|
21
|
-
* than a comfortable touch target.
|
|
22
|
-
*/
|
|
23
|
-
export declare const SETTINGS_ROW = "flex min-h-[4.25rem] flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6";
|
|
24
|
-
/**
|
|
25
|
-
* Page chrome — centered column at the settings content width. Hosts
|
|
26
|
-
* `PageTitle` + `Stack` (and any route-level siblings). Prefer this over
|
|
27
|
-
* ad-hoc `max-w-*` wrappers in the app shell.
|
|
28
|
-
*/
|
|
29
|
-
declare function Page({ className, ...props }: ComponentProps<"div"> & {
|
|
30
|
-
ref?: Ref<HTMLDivElement>;
|
|
31
|
-
}): import("react").JSX.Element;
|
|
32
|
-
/** Page title — largest heading on the surface. */
|
|
33
|
-
declare function PageTitle({ className, children, ...props }: ComponentProps<"h1"> & {
|
|
34
|
-
ref?: Ref<HTMLHeadingElement>;
|
|
35
|
-
}): import("react").JSX.Element;
|
|
36
|
-
/**
|
|
37
|
-
* Vertical stack under the page title. Blocks (forms / sections) use `gap-10`;
|
|
38
|
-
* each block lays out its children with `gap-3`.
|
|
39
|
-
*/
|
|
40
|
-
declare function Stack({ className, ...props }: ComponentProps<"div"> & {
|
|
41
|
-
ref?: Ref<HTMLDivElement>;
|
|
42
|
-
}): import("react").JSX.Element;
|
|
43
|
-
/**
|
|
44
|
-
* Title + optional description pair. Keeps that couple tight (`gap-0.5`) so
|
|
45
|
-
* the block's `gap-3` only applies between this header and the card.
|
|
46
|
-
*/
|
|
47
|
-
declare function Header({ className, ...props }: ComponentProps<"div"> & {
|
|
48
|
-
ref?: Ref<HTMLDivElement>;
|
|
49
|
-
}): import("react").JSX.Element;
|
|
50
|
-
/** Section heading — same padding as the page title, smaller type. */
|
|
51
|
-
declare function SectionTitle({ className, children, ...props }: ComponentProps<"h2"> & {
|
|
52
|
-
ref?: Ref<HTMLHeadingElement>;
|
|
53
|
-
}): import("react").JSX.Element;
|
|
54
|
-
/**
|
|
55
|
-
* Supporting copy under a section title. Same display step as the title;
|
|
56
|
-
* color + normal weight keep it secondary. Always wrap with `Header`.
|
|
57
|
-
*/
|
|
58
|
-
declare function Description({ className, ...props }: ComponentProps<"p"> & {
|
|
59
|
-
ref?: Ref<HTMLParagraphElement>;
|
|
60
|
-
}): import("react").JSX.Element;
|
|
61
|
-
/** Bordered card that stacks settings rows with hairline dividers. */
|
|
62
|
-
declare function Card({ className, ...props }: ComponentProps<"div"> & {
|
|
63
|
-
ref?: Ref<HTMLDivElement>;
|
|
64
|
-
}): import("react").JSX.Element;
|
|
65
|
-
/**
|
|
66
|
-
* Standalone callout. Pair with `CalloutTitle` / `CalloutDescription` (and
|
|
67
|
-
* optional actions) for a featured block — e.g. an invite form. Do not wrap
|
|
68
|
-
* in `Card`; this is already the outer surface.
|
|
69
|
-
*/
|
|
70
|
-
declare function Callout({ className, ...props }: ComponentProps<"div"> & {
|
|
71
|
-
ref?: Ref<HTMLDivElement>;
|
|
72
|
-
}): import("react").JSX.Element;
|
|
73
|
-
/** Callout heading — same type as `SectionTitle`. */
|
|
74
|
-
declare function CalloutTitle({ className, children, ...props }: ComponentProps<"h2"> & {
|
|
75
|
-
ref?: Ref<HTMLHeadingElement>;
|
|
76
|
-
}): import("react").JSX.Element;
|
|
77
|
-
/** Supporting copy under a callout title. */
|
|
78
|
-
declare function CalloutDescription({ className, ...props }: ComponentProps<"p"> & {
|
|
79
|
-
ref?: Ref<HTMLParagraphElement>;
|
|
80
|
-
}): import("react").JSX.Element;
|
|
81
|
-
export interface SettingsRowProps extends Omit<ComponentProps<"div">, "title"> {
|
|
82
|
-
/** Left-side field name. */
|
|
83
|
-
label: string;
|
|
84
|
-
/** Optional helper under the label. */
|
|
85
|
-
description?: ReactNode;
|
|
86
|
-
/** Associates the label with a control id. When omitted, the label is not a `<label>`. */
|
|
87
|
-
htmlFor?: string;
|
|
88
|
-
ref?: Ref<HTMLDivElement>;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* One settings row: label (+ optional description) left, control right.
|
|
92
|
-
* Pass `htmlFor` when the row wraps a labelled input; omit it for display/
|
|
93
|
-
* action rows (avatar, danger-zone delete).
|
|
94
|
-
*/
|
|
95
|
-
declare function Row({ label, description, htmlFor, className, children, ...props }: SettingsRowProps): import("react").JSX.Element;
|
|
96
|
-
/** Read-only value on the right side of a row (email, etc.). */
|
|
97
|
-
declare function Value({ className, ...props }: ComponentProps<"p"> & {
|
|
98
|
-
ref?: Ref<HTMLParagraphElement>;
|
|
99
|
-
}): import("react").JSX.Element;
|
|
100
|
-
/**
|
|
101
|
-
* Inline error under a row (still inside the card). Matches card horizontal
|
|
102
|
-
* padding so hosts don't re-apply `px-5`.
|
|
103
|
-
*/
|
|
104
|
-
declare function Alert({ className, ...props }: ComponentProps<"p"> & {
|
|
105
|
-
ref?: Ref<HTMLParagraphElement>;
|
|
106
|
-
}): import("react").JSX.Element;
|
|
107
|
-
/**
|
|
108
|
-
* Trailing bar inside a card — typically a save status + submit button that
|
|
109
|
-
* appears after the form is dirty. Same horizontal/vertical padding as a row.
|
|
110
|
-
*/
|
|
111
|
-
declare function Footer({ className, ...props }: ComponentProps<"div"> & {
|
|
112
|
-
ref?: Ref<HTMLDivElement>;
|
|
113
|
-
}): import("react").JSX.Element;
|
|
114
|
-
/**
|
|
115
|
-
* Settings page layout. One stack, one gap rhythm — only title scale differs:
|
|
116
|
-
*
|
|
117
|
-
* ```tsx
|
|
118
|
-
* <Settings.Page>
|
|
119
|
-
* <Settings.PageTitle>Profile</Settings.PageTitle>
|
|
120
|
-
* <Settings.Stack>
|
|
121
|
-
* <form>
|
|
122
|
-
* <Settings.Card>
|
|
123
|
-
* <Settings.Row label="Name" htmlFor="first-name">
|
|
124
|
-
* <Input id="first-name" size="sm" />
|
|
125
|
-
* </Settings.Row>
|
|
126
|
-
* </Settings.Card>
|
|
127
|
-
* </form>
|
|
128
|
-
* <form>
|
|
129
|
-
* <Settings.Header>
|
|
130
|
-
* <Settings.SectionTitle>Agent profile</Settings.SectionTitle>
|
|
131
|
-
* <Settings.Description>…</Settings.Description>
|
|
132
|
-
* </Settings.Header>
|
|
133
|
-
* <Settings.Card>…</Settings.Card>
|
|
134
|
-
* </form>
|
|
135
|
-
* <div>
|
|
136
|
-
* <Settings.SectionTitle>Danger zone</Settings.SectionTitle>
|
|
137
|
-
* <Settings.Card>
|
|
138
|
-
* <Settings.Row label="Delete account" description="…">
|
|
139
|
-
* <Button color="destructive" size="sm">Delete</Button>
|
|
140
|
-
* </Settings.Row>
|
|
141
|
-
* </Settings.Card>
|
|
142
|
-
* </div>
|
|
143
|
-
* <Settings.Callout>
|
|
144
|
-
* <Settings.Header>
|
|
145
|
-
* <Settings.CalloutTitle>Invitations</Settings.CalloutTitle>
|
|
146
|
-
* <Settings.CalloutDescription>…</Settings.CalloutDescription>
|
|
147
|
-
* </Settings.Header>
|
|
148
|
-
* …invite form…
|
|
149
|
-
* </Settings.Callout>
|
|
150
|
-
* </Settings.Stack>
|
|
151
|
-
* </Settings.Page>
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
export declare const Settings: {
|
|
155
|
-
Page: typeof Page;
|
|
156
|
-
PageTitle: typeof PageTitle;
|
|
157
|
-
Stack: typeof Stack;
|
|
158
|
-
Header: typeof Header;
|
|
159
|
-
SectionTitle: typeof SectionTitle;
|
|
160
|
-
Description: typeof Description;
|
|
161
|
-
Card: typeof Card;
|
|
162
|
-
Callout: typeof Callout;
|
|
163
|
-
CalloutTitle: typeof CalloutTitle;
|
|
164
|
-
CalloutDescription: typeof CalloutDescription;
|
|
165
|
-
Row: typeof Row;
|
|
166
|
-
Value: typeof Value;
|
|
167
|
-
Alert: typeof Alert;
|
|
168
|
-
Footer: typeof Footer;
|
|
169
|
-
};
|
|
170
|
-
export {};
|