@hanzo/ui 8.0.11 → 8.0.13
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/backends/gui/index.d.ts +2 -0
- package/dist/backends/shadcn/aspect-ratio.d.ts +4 -0
- package/dist/backends/shadcn/avatar.d.ts +6 -0
- package/dist/backends/shadcn/badge.d.ts +9 -0
- package/dist/backends/shadcn/button.d.ts +19 -0
- package/dist/backends/shadcn/card.d.ts +9 -0
- package/dist/backends/shadcn/checkbox.d.ts +9 -0
- package/dist/backends/shadcn/collapsible.d.ts +5 -0
- package/dist/backends/shadcn/command.d.ts +80 -0
- package/dist/backends/shadcn/dialog.d.ts +15 -0
- package/dist/backends/shadcn/dropdown-menu.d.ts +34 -0
- package/dist/backends/shadcn/index.d.ts +23 -0
- package/dist/backends/shadcn/input.d.ts +11 -0
- package/dist/backends/shadcn/label.d.ts +4 -0
- package/dist/backends/shadcn/popover.d.ts +7 -0
- package/dist/backends/shadcn/progress.d.ts +4 -0
- package/dist/backends/shadcn/scroll-area.d.ts +5 -0
- package/dist/backends/shadcn/select.d.ts +13 -0
- package/dist/backends/shadcn/separator.d.ts +4 -0
- package/dist/backends/shadcn/slider.d.ts +4 -0
- package/dist/backends/shadcn/switch.d.ts +4 -0
- package/dist/backends/shadcn/tabs.d.ts +7 -0
- package/dist/backends/shadcn/textarea.d.ts +4 -0
- package/dist/backends/shadcn/toaster.d.ts +10 -0
- package/dist/backends/shadcn/tooltip.d.ts +7 -0
- package/dist/backends/shadcn/utils.d.ts +8 -0
- package/dist/components.d.ts +1 -0
- package/dist/core/cn.d.ts +11 -0
- package/dist/core/fonts.d.ts +26 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/tokens.d.ts +16 -0
- package/dist/gitops.cjs +3 -3
- package/dist/gitops.d.ts +1 -1
- package/dist/gitops.js +1 -1
- package/dist/index.cjs +1138 -291
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1017 -3
- package/dist/index.js.map +1 -1
- package/dist/models/ModelSelector.d.ts +23 -0
- package/dist/models/catalog.d.ts +53 -0
- package/dist/models/index.d.ts +5 -0
- package/dist/models/types.d.ts +39 -0
- package/dist/primitives/AspectRatio.d.ts +1 -0
- package/dist/primitives/Avatar.d.ts +1 -0
- package/dist/primitives/AvatarFallback.d.ts +1 -0
- package/dist/primitives/AvatarImage.d.ts +1 -0
- package/dist/primitives/Badge.d.ts +1 -0
- package/dist/primitives/Button.d.ts +1 -0
- package/dist/primitives/Card.d.ts +1 -0
- package/dist/primitives/CardAction.d.ts +1 -0
- package/dist/primitives/CardContent.d.ts +1 -0
- package/dist/primitives/CardDescription.d.ts +1 -0
- package/dist/primitives/CardFooter.d.ts +1 -0
- package/dist/primitives/CardHeader.d.ts +1 -0
- package/dist/primitives/CardTitle.d.ts +1 -0
- package/dist/primitives/Checkbox.d.ts +1 -0
- package/dist/primitives/Collapsible.d.ts +1 -0
- package/dist/primitives/CollapsibleContent.d.ts +1 -0
- package/dist/primitives/CollapsibleTrigger.d.ts +1 -0
- package/dist/primitives/Command.d.ts +1 -0
- package/dist/primitives/CommandDialog.d.ts +1 -0
- package/dist/primitives/CommandEmpty.d.ts +1 -0
- package/dist/primitives/CommandGroup.d.ts +1 -0
- package/dist/primitives/CommandInput.d.ts +1 -0
- package/dist/primitives/CommandItem.d.ts +1 -0
- package/dist/primitives/CommandList.d.ts +1 -0
- package/dist/primitives/CommandSeparator.d.ts +1 -0
- package/dist/primitives/CommandShortcut.d.ts +1 -0
- package/dist/primitives/Dialog.d.ts +1 -0
- package/dist/primitives/DialogClose.d.ts +1 -0
- package/dist/primitives/DialogContent.d.ts +1 -0
- package/dist/primitives/DialogDescription.d.ts +1 -0
- package/dist/primitives/DialogFooter.d.ts +1 -0
- package/dist/primitives/DialogHeader.d.ts +1 -0
- package/dist/primitives/DialogOverlay.d.ts +1 -0
- package/dist/primitives/DialogPortal.d.ts +1 -0
- package/dist/primitives/DialogTitle.d.ts +1 -0
- package/dist/primitives/DialogTrigger.d.ts +1 -0
- package/dist/primitives/DropdownMenu.d.ts +1 -0
- package/dist/primitives/DropdownMenuCheckboxItem.d.ts +1 -0
- package/dist/primitives/DropdownMenuContent.d.ts +1 -0
- package/dist/primitives/DropdownMenuGroup.d.ts +1 -0
- package/dist/primitives/DropdownMenuItem.d.ts +1 -0
- package/dist/primitives/DropdownMenuLabel.d.ts +1 -0
- package/dist/primitives/DropdownMenuPortal.d.ts +1 -0
- package/dist/primitives/DropdownMenuRadioGroup.d.ts +1 -0
- package/dist/primitives/DropdownMenuRadioItem.d.ts +1 -0
- package/dist/primitives/DropdownMenuSeparator.d.ts +1 -0
- package/dist/primitives/DropdownMenuShortcut.d.ts +1 -0
- package/dist/primitives/DropdownMenuSub.d.ts +1 -0
- package/dist/primitives/DropdownMenuSubContent.d.ts +1 -0
- package/dist/primitives/DropdownMenuSubTrigger.d.ts +1 -0
- package/dist/primitives/DropdownMenuTrigger.d.ts +1 -0
- package/dist/primitives/Input.d.ts +1 -0
- package/dist/primitives/Label.d.ts +1 -0
- package/dist/primitives/Popover.d.ts +1 -0
- package/dist/primitives/PopoverAnchor.d.ts +1 -0
- package/dist/primitives/PopoverContent.d.ts +1 -0
- package/dist/primitives/PopoverTrigger.d.ts +1 -0
- package/dist/primitives/Progress.d.ts +1 -0
- package/dist/primitives/ScrollArea.d.ts +1 -0
- package/dist/primitives/ScrollBar.d.ts +1 -0
- package/dist/primitives/Select.d.ts +1 -0
- package/dist/primitives/SelectContent.d.ts +1 -0
- package/dist/primitives/SelectGroup.d.ts +1 -0
- package/dist/primitives/SelectItem.d.ts +1 -0
- package/dist/primitives/SelectLabel.d.ts +1 -0
- package/dist/primitives/SelectScrollDownButton.d.ts +1 -0
- package/dist/primitives/SelectScrollUpButton.d.ts +1 -0
- package/dist/primitives/SelectSeparator.d.ts +1 -0
- package/dist/primitives/SelectTrigger.d.ts +1 -0
- package/dist/primitives/SelectValue.d.ts +1 -0
- package/dist/primitives/Separator.d.ts +1 -0
- package/dist/primitives/Slider.d.ts +1 -0
- package/dist/primitives/Switch.d.ts +1 -0
- package/dist/primitives/Tabs.d.ts +1 -0
- package/dist/primitives/TabsContent.d.ts +1 -0
- package/dist/primitives/TabsList.d.ts +1 -0
- package/dist/primitives/TabsTrigger.d.ts +1 -0
- package/dist/primitives/Textarea.d.ts +1 -0
- package/dist/primitives/Toaster.d.ts +1 -0
- package/dist/primitives/Tooltip.d.ts +1 -0
- package/dist/primitives/TooltipContent.d.ts +1 -0
- package/dist/primitives/TooltipProvider.d.ts +1 -0
- package/dist/primitives/TooltipTrigger.d.ts +1 -0
- package/dist/primitives/badgeVariants.d.ts +1 -0
- package/dist/primitives/buttonVariants.d.ts +1 -0
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/toast.d.ts +1 -0
- package/dist/product/AnimatedLogo.d.ts +47 -0
- package/dist/product/BackendState.d.ts +42 -0
- package/dist/product/Charts.d.ts +4 -0
- package/dist/product/CommerceResource.d.ts +32 -0
- package/dist/product/ConfirmDelete.d.ts +8 -0
- package/dist/product/DataTable.d.ts +30 -2
- package/dist/product/Field.d.ts +7 -2
- package/dist/product/Filters.d.ts +29 -0
- package/dist/product/PrimaryButton.d.ts +5 -0
- package/dist/product/SiteFooter.d.ts +28 -0
- package/dist/product/SiteNav.d.ts +60 -0
- package/dist/product/accent.d.ts +33 -0
- package/dist/product/animatedLogo.logic.d.ts +52 -0
- package/dist/product/brand.d.ts +45 -0
- package/dist/product/host.d.ts +21 -0
- package/dist/product/index.cjs +3516 -265
- package/dist/product/index.cjs.map +1 -1
- package/dist/product/index.d.ts +11 -0
- package/dist/product/index.js +3402 -1
- package/dist/product/index.js.map +1 -1
- package/dist/product/social/CampaignCard.d.ts +13 -0
- package/dist/product/social/ChannelBadge.d.ts +14 -0
- package/dist/product/social/PostAgenda.d.ts +5 -0
- package/dist/product/social/PostCard.d.ts +6 -0
- package/dist/product/social/PostComposer.d.ts +24 -0
- package/dist/product/social/ProviderReadinessList.d.ts +4 -0
- package/dist/product/social/SocialResource.d.ts +7 -0
- package/dist/product/social/SocialSummaryBar.d.ts +4 -0
- package/dist/product/social/ViewToggle.d.ts +5 -0
- package/dist/product/social/api.d.ts +128 -0
- package/dist/product/social/format.d.ts +16 -0
- package/dist/product/social/index.d.ts +11 -0
- package/dist/product/surfaces.data.d.ts +1 -0
- package/dist/styles/hanzo-motion.css +52 -0
- package/package.json +90 -15
- package/dist/chunk-M2ILMK44.cjs +0 -2104
- package/dist/chunk-M2ILMK44.cjs.map +0 -1
- package/dist/chunk-YSURJUOA.js +0 -2035
- package/dist/chunk-YSURJUOA.js.map +0 -1
package/dist/product/index.cjs
CHANGED
|
@@ -1,275 +1,3406 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var chunkM2ILMK44_cjs = require('../chunk-M2ILMK44.cjs');
|
|
5
4
|
var chunkYBXVUV7P_cjs = require('../chunk-YBXVUV7P.cjs');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var gui = require('@hanzo/gui');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var lucideIcons2 = require('@hanzogui/lucide-icons-2');
|
|
9
|
+
var products = require('@hanzo/products');
|
|
10
|
+
var react$1 = require('@hanzo/logo/react');
|
|
11
|
+
var reactDom = require('react-dom');
|
|
6
12
|
|
|
13
|
+
var CHART_PALETTE = [
|
|
14
|
+
"#7c5cff",
|
|
15
|
+
"#23c562",
|
|
16
|
+
"#ff9f45",
|
|
17
|
+
"#3aa0ff",
|
|
18
|
+
"#ff5d8f",
|
|
19
|
+
"#16c0c8",
|
|
20
|
+
"#c084fc",
|
|
21
|
+
"#f4c245"
|
|
22
|
+
];
|
|
23
|
+
var CHART_OTHER = "#64748b";
|
|
24
|
+
var ACCENT = CHART_PALETTE[0];
|
|
25
|
+
var GRID = "rgba(148,163,184,0.16)";
|
|
26
|
+
var AXIS = "rgba(148,163,184,0.85)";
|
|
27
|
+
var tone = (theme, key, fallback) => {
|
|
28
|
+
const v = theme[key];
|
|
29
|
+
const got = v?.get?.();
|
|
30
|
+
return typeof got === "string" ? got : fallback;
|
|
31
|
+
};
|
|
32
|
+
var rampOpacity = (i, n) => n <= 1 ? 0.9 : 0.95 - i / (n - 1) * 0.62;
|
|
33
|
+
function useContainerWidth() {
|
|
34
|
+
const ref = react.useRef(null);
|
|
35
|
+
const [w, setW] = react.useState(0);
|
|
36
|
+
react.useEffect(() => {
|
|
37
|
+
const el = ref.current;
|
|
38
|
+
if (!el) return;
|
|
39
|
+
const measure = () => setW(el.clientWidth);
|
|
40
|
+
measure();
|
|
41
|
+
const ro = new ResizeObserver(measure);
|
|
42
|
+
ro.observe(el);
|
|
43
|
+
return () => ro.disconnect();
|
|
44
|
+
}, []);
|
|
45
|
+
return { ref, w };
|
|
46
|
+
}
|
|
47
|
+
function Sparkline({
|
|
48
|
+
values,
|
|
49
|
+
width = 120,
|
|
50
|
+
height = 36,
|
|
51
|
+
color
|
|
52
|
+
}) {
|
|
53
|
+
const theme = gui.useTheme();
|
|
54
|
+
const clean = (values ?? []).filter((v) => Number.isFinite(v));
|
|
55
|
+
if (clean.length < 2) return null;
|
|
56
|
+
const stroke = color ?? tone(theme, "color11", "currentColor");
|
|
57
|
+
const max = Math.max(...clean);
|
|
58
|
+
const min = Math.min(...clean);
|
|
59
|
+
const span = max - min || 1;
|
|
60
|
+
const n = clean.length;
|
|
61
|
+
const px = (i) => i / (n - 1) * (width - 2) + 1;
|
|
62
|
+
const py = (v) => height - 2 - (v - min) / span * (height - 4);
|
|
63
|
+
const line = clean.map((v, i) => `${i === 0 ? "M" : "L"}${px(i).toFixed(1)},${py(v).toFixed(1)}`).join(" ");
|
|
64
|
+
const area = `${line} L${(width - 1).toFixed(1)},${height} L1,${height} Z`;
|
|
65
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width, height, "aria-hidden": true, style: { display: "block" }, children: [
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: area, fill: stroke, fillOpacity: 0.12 }),
|
|
67
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: line, fill: "none", stroke, strokeWidth: 1.5, strokeLinejoin: "round", strokeLinecap: "round" })
|
|
68
|
+
] });
|
|
69
|
+
}
|
|
70
|
+
function Tooltip({ x, height, label, value }) {
|
|
71
|
+
const left = Math.max(0, x - 60);
|
|
72
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
style: {
|
|
76
|
+
position: "absolute",
|
|
77
|
+
left,
|
|
78
|
+
top: 0,
|
|
79
|
+
height,
|
|
80
|
+
pointerEvents: "none",
|
|
81
|
+
display: "flex",
|
|
82
|
+
alignItems: "flex-start"
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
style: {
|
|
88
|
+
background: "rgba(15,17,21,0.94)",
|
|
89
|
+
border: "1px solid rgba(148,163,184,0.25)",
|
|
90
|
+
borderRadius: 8,
|
|
91
|
+
padding: "6px 9px",
|
|
92
|
+
fontSize: 11,
|
|
93
|
+
lineHeight: 1.35,
|
|
94
|
+
color: "#e2e8f0",
|
|
95
|
+
whiteSpace: "nowrap",
|
|
96
|
+
boxShadow: "0 4px 16px rgba(0,0,0,0.4)"
|
|
97
|
+
},
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: AXIS }, children: label }),
|
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 700 }, children: value })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function nearestIndex(clientX, rect, padL, innerW, n) {
|
|
108
|
+
if (n <= 1) return 0;
|
|
109
|
+
const mx = clientX - rect.left - padL;
|
|
110
|
+
const i = Math.round(mx / (innerW || 1) * (n - 1));
|
|
111
|
+
return Math.max(0, Math.min(n - 1, i));
|
|
112
|
+
}
|
|
113
|
+
function axisTicks(data) {
|
|
114
|
+
const n = data.length;
|
|
115
|
+
if (n === 0) return [];
|
|
116
|
+
if (n === 1) return [{ i: 0, label: data[0].label, anchor: "middle" }];
|
|
117
|
+
const mid = Math.floor((n - 1) / 2);
|
|
118
|
+
const out = [
|
|
119
|
+
{ i: 0, label: data[0].label, anchor: "start" },
|
|
120
|
+
{ i: n - 1, label: data[n - 1].label, anchor: "end" }
|
|
121
|
+
];
|
|
122
|
+
if (n >= 5) out.splice(1, 0, { i: mid, label: data[mid].label, anchor: "middle" });
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
function LineChart({
|
|
126
|
+
data,
|
|
127
|
+
height = 210,
|
|
128
|
+
color = ACCENT,
|
|
129
|
+
formatValue = (v) => String(v)
|
|
130
|
+
}) {
|
|
131
|
+
const { ref, w } = useContainerWidth();
|
|
132
|
+
const [hover, setHover] = react.useState(null);
|
|
133
|
+
const padL = 10;
|
|
134
|
+
const padR = 10;
|
|
135
|
+
const padT = 12;
|
|
136
|
+
const padB = 24;
|
|
137
|
+
const n = data.length;
|
|
138
|
+
const innerW = Math.max(1, w - padL - padR);
|
|
139
|
+
const innerH = Math.max(1, height - padT - padB);
|
|
140
|
+
const max = Math.max(...data.map((d) => d.value), 1);
|
|
141
|
+
const x = (i) => padL + (n <= 1 ? innerW / 2 : i / (n - 1) * innerW);
|
|
142
|
+
const y = (v) => padT + innerH - v / max * innerH;
|
|
143
|
+
const line = data.map((d, i) => `${i === 0 ? "M" : "L"}${x(i).toFixed(1)},${y(d.value).toFixed(1)}`).join(" ");
|
|
144
|
+
const area = n >= 2 ? `${line} L${x(n - 1).toFixed(1)},${(padT + innerH).toFixed(1)} L${x(0).toFixed(1)},${(padT + innerH).toFixed(1)} Z` : "";
|
|
145
|
+
const ticks = axisTicks(data);
|
|
146
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, style: { position: "relative", width: "100%" }, children: [
|
|
147
|
+
w > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
148
|
+
"svg",
|
|
149
|
+
{
|
|
150
|
+
width: w,
|
|
151
|
+
height,
|
|
152
|
+
style: { display: "block" },
|
|
153
|
+
onMouseMove: (e) => setHover(nearestIndex(e.clientX, e.currentTarget.getBoundingClientRect(), padL, innerW, n)),
|
|
154
|
+
onMouseLeave: () => setHover(null),
|
|
155
|
+
children: [
|
|
156
|
+
[0, 0.5, 1].map((g) => /* @__PURE__ */ jsxRuntime.jsx("line", { x1: padL, x2: w - padR, y1: padT + innerH * g, y2: padT + innerH * g, stroke: GRID, strokeWidth: 1 }, g)),
|
|
157
|
+
area ? /* @__PURE__ */ jsxRuntime.jsx("path", { d: area, fill: color, fillOpacity: 0.1 }) : null,
|
|
158
|
+
n >= 2 ? /* @__PURE__ */ jsxRuntime.jsx("path", { d: line, fill: "none", stroke: color, strokeWidth: 2, strokeLinejoin: "round", strokeLinecap: "round" }) : null,
|
|
159
|
+
hover != null && data[hover] ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
160
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: x(hover), x2: x(hover), y1: padT, y2: padT + innerH, stroke: AXIS, strokeWidth: 1, strokeDasharray: "3 3" }),
|
|
161
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: x(hover), cy: y(data[hover].value), r: 4, fill: color, stroke: "#0f1115", strokeWidth: 2 })
|
|
162
|
+
] }) : null,
|
|
163
|
+
ticks.map((t) => /* @__PURE__ */ jsxRuntime.jsx("text", { x: x(t.i), y: height - 7, fontSize: 10, fill: AXIS, textAnchor: t.anchor, children: t.label }, t.i))
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
) : null,
|
|
167
|
+
hover != null && data[hover] ? /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { x: x(hover), height, label: data[hover].label, value: formatValue(data[hover].value) }) : null
|
|
168
|
+
] });
|
|
169
|
+
}
|
|
170
|
+
function BarChart({
|
|
171
|
+
data,
|
|
172
|
+
height = 210,
|
|
173
|
+
color = ACCENT,
|
|
174
|
+
formatValue = (v) => String(v)
|
|
175
|
+
}) {
|
|
176
|
+
const { ref, w } = useContainerWidth();
|
|
177
|
+
const [hover, setHover] = react.useState(null);
|
|
178
|
+
const padL = 10;
|
|
179
|
+
const padR = 10;
|
|
180
|
+
const padT = 12;
|
|
181
|
+
const padB = 24;
|
|
182
|
+
const n = data.length;
|
|
183
|
+
const innerW = Math.max(1, w - padL - padR);
|
|
184
|
+
const innerH = Math.max(1, height - padT - padB);
|
|
185
|
+
const max = Math.max(...data.map((d) => d.value), 1);
|
|
186
|
+
const slot = innerW / Math.max(1, n);
|
|
187
|
+
const barW = Math.max(1, Math.min(slot * 0.62, 36));
|
|
188
|
+
const cx = (i) => padL + slot * i + slot / 2;
|
|
189
|
+
const ticks = axisTicks(data);
|
|
190
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, style: { position: "relative", width: "100%" }, children: [
|
|
191
|
+
w > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
192
|
+
"svg",
|
|
193
|
+
{
|
|
194
|
+
width: w,
|
|
195
|
+
height,
|
|
196
|
+
style: { display: "block" },
|
|
197
|
+
onMouseMove: (e) => {
|
|
198
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
199
|
+
const i = Math.floor((e.clientX - rect.left - padL) / (slot || 1));
|
|
200
|
+
setHover(Math.max(0, Math.min(n - 1, i)));
|
|
201
|
+
},
|
|
202
|
+
onMouseLeave: () => setHover(null),
|
|
203
|
+
children: [
|
|
204
|
+
[0, 0.5, 1].map((g) => /* @__PURE__ */ jsxRuntime.jsx("line", { x1: padL, x2: w - padR, y1: padT + innerH * g, y2: padT + innerH * g, stroke: GRID, strokeWidth: 1 }, g)),
|
|
205
|
+
data.map((d, i) => {
|
|
206
|
+
const h = d.value / max * innerH;
|
|
207
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
208
|
+
"rect",
|
|
209
|
+
{
|
|
210
|
+
x: cx(i) - barW / 2,
|
|
211
|
+
y: padT + innerH - h,
|
|
212
|
+
width: barW,
|
|
213
|
+
height: Math.max(0, h),
|
|
214
|
+
rx: Math.min(3, barW / 2),
|
|
215
|
+
fill: color,
|
|
216
|
+
fillOpacity: hover === i ? 1 : 0.78
|
|
217
|
+
},
|
|
218
|
+
i
|
|
219
|
+
);
|
|
220
|
+
}),
|
|
221
|
+
ticks.map((t) => /* @__PURE__ */ jsxRuntime.jsx("text", { x: cx(t.i), y: height - 7, fontSize: 10, fill: AXIS, textAnchor: "middle", children: t.label }, t.i))
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
) : null,
|
|
225
|
+
hover != null && data[hover] ? /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { x: cx(hover), height, label: data[hover].label, value: formatValue(data[hover].value) }) : null
|
|
226
|
+
] });
|
|
227
|
+
}
|
|
228
|
+
function Donut({
|
|
229
|
+
slices,
|
|
230
|
+
size = 160,
|
|
231
|
+
thickness = 22,
|
|
232
|
+
center,
|
|
233
|
+
legend = false
|
|
234
|
+
}) {
|
|
235
|
+
const theme = gui.useTheme();
|
|
236
|
+
const fg = tone(theme, "color12", "currentColor");
|
|
237
|
+
const positive = slices.filter((s) => s.value > 0);
|
|
238
|
+
const total = positive.reduce((sum, s) => sum + s.value, 0);
|
|
239
|
+
const r = size / 2;
|
|
240
|
+
const rInner = r - thickness;
|
|
241
|
+
const mid = (r + rInner) / 2;
|
|
242
|
+
if (total <= 0) {
|
|
243
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { items: "center", justify: "center", height: size, children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$6", color: "$color10", children: "\u2014" }) });
|
|
244
|
+
}
|
|
245
|
+
const ring = /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", width: size, height: size }, children: [
|
|
246
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, style: { display: "block" }, children: positive.length === 1 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
247
|
+
"circle",
|
|
248
|
+
{
|
|
249
|
+
cx: r,
|
|
250
|
+
cy: r,
|
|
251
|
+
r: mid,
|
|
252
|
+
fill: "none",
|
|
253
|
+
stroke: positive[0].color ?? fg,
|
|
254
|
+
strokeOpacity: positive[0].color ? 1 : 0.9,
|
|
255
|
+
strokeWidth: thickness
|
|
256
|
+
}
|
|
257
|
+
) : renderArcs(positive, total, r, rInner, fg) }),
|
|
258
|
+
center ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
259
|
+
"div",
|
|
260
|
+
{
|
|
261
|
+
style: {
|
|
262
|
+
position: "absolute",
|
|
263
|
+
inset: 0,
|
|
264
|
+
display: "flex",
|
|
265
|
+
flexDirection: "column",
|
|
266
|
+
alignItems: "center",
|
|
267
|
+
justifyContent: "center",
|
|
268
|
+
textAlign: "center",
|
|
269
|
+
pointerEvents: "none"
|
|
270
|
+
},
|
|
271
|
+
children: center
|
|
272
|
+
}
|
|
273
|
+
) : null
|
|
274
|
+
] });
|
|
275
|
+
if (!legend) return ring;
|
|
276
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$4", items: "center", flexWrap: "wrap", children: [
|
|
277
|
+
ring,
|
|
278
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: "$1.5", flex: 1, minW: 150, children: positive.map((s, i) => /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2", items: "center", children: [
|
|
279
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
280
|
+
"div",
|
|
281
|
+
{
|
|
282
|
+
style: {
|
|
283
|
+
width: 10,
|
|
284
|
+
height: 10,
|
|
285
|
+
borderRadius: 2,
|
|
286
|
+
backgroundColor: s.color ?? AXIS,
|
|
287
|
+
opacity: s.color ? 1 : rampOpacity(i, positive.length)
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color11", flex: 1, numberOfLines: 1, children: s.label }),
|
|
292
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: "$2", color: "$color12", fontWeight: "600", children: [
|
|
293
|
+
Math.round(s.value / total * 100),
|
|
294
|
+
"%"
|
|
295
|
+
] })
|
|
296
|
+
] }, s.label)) })
|
|
297
|
+
] });
|
|
298
|
+
}
|
|
299
|
+
function renderArcs(slices, total, rOuter, rInner, fg) {
|
|
300
|
+
let a0 = -Math.PI / 2;
|
|
301
|
+
const paths = [];
|
|
302
|
+
slices.forEach((s, idx) => {
|
|
303
|
+
const frac = Math.max(0, s.value) / total;
|
|
304
|
+
if (frac <= 0) return;
|
|
305
|
+
const a1 = a0 + frac * Math.PI * 2;
|
|
306
|
+
paths.push(
|
|
307
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
308
|
+
"path",
|
|
309
|
+
{
|
|
310
|
+
d: annularArc(rOuter, rOuter, rOuter, rInner, a0, Math.min(a1, a0 + Math.PI * 1.9999)),
|
|
311
|
+
fill: s.color ?? fg,
|
|
312
|
+
fillOpacity: s.color ? 1 : rampOpacity(idx, slices.length)
|
|
313
|
+
},
|
|
314
|
+
s.label || idx
|
|
315
|
+
)
|
|
316
|
+
);
|
|
317
|
+
a0 = a1;
|
|
318
|
+
});
|
|
319
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: paths });
|
|
320
|
+
}
|
|
321
|
+
function polar(cx, cy, rad, a) {
|
|
322
|
+
return [cx + rad * Math.cos(a), cy + rad * Math.sin(a)];
|
|
323
|
+
}
|
|
324
|
+
function annularArc(cx, cy, rOuter, rInner, a0, a1) {
|
|
325
|
+
const large = a1 - a0 > Math.PI ? 1 : 0;
|
|
326
|
+
const [x0, y0] = polar(cx, cy, rOuter, a0);
|
|
327
|
+
const [x1, y1] = polar(cx, cy, rOuter, a1);
|
|
328
|
+
const [x2, y2] = polar(cx, cy, rInner, a1);
|
|
329
|
+
const [x3, y3] = polar(cx, cy, rInner, a0);
|
|
330
|
+
return `M${x0},${y0} A${rOuter},${rOuter} 0 ${large} 1 ${x1},${y1} L${x2},${y2} A${rInner},${rInner} 0 ${large} 0 ${x3},${y3} Z`;
|
|
331
|
+
}
|
|
332
|
+
function BarRows({ bars }) {
|
|
333
|
+
const max = Math.max(0, ...bars.map((b) => b.value));
|
|
334
|
+
if (max <= 0) {
|
|
335
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color10", children: "\u2014" });
|
|
336
|
+
}
|
|
337
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: "$2.5", children: bars.map((b) => /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$3", items: "center", children: [
|
|
338
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { width: 64, fontSize: "$2", color: "$color11", text: "right", children: b.label }),
|
|
339
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { flex: 1, height: 10, bg: "$color3", rounded: "$2", overflow: "hidden", children: /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { height: 10, width: `${Math.max(2, b.value / max * 100)}%`, bg: "$color9", rounded: "$2" }) }),
|
|
340
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { width: 56, fontSize: "$2", color: "$color12", fontWeight: "600", children: b.value.toLocaleString() })
|
|
341
|
+
] }, b.label)) });
|
|
342
|
+
}
|
|
343
|
+
var SERIES = ["#6ea8fe", "#7ee787", "#f0a868", "#c792ea", "#56d4c4", "#e879a6", "#d6c15a", "#8b9bb4"];
|
|
344
|
+
var colorForIndex = (i) => SERIES[i % SERIES.length];
|
|
345
|
+
var TRACK = "rgba(128,128,128,0.18)";
|
|
346
|
+
function utilColor(pct) {
|
|
347
|
+
if (pct >= 90) return "#e5534b";
|
|
348
|
+
if (pct >= 70) return "#f0a868";
|
|
349
|
+
return "#7ee787";
|
|
350
|
+
}
|
|
351
|
+
function Sparkline2({
|
|
352
|
+
points,
|
|
353
|
+
width = 104,
|
|
354
|
+
height = 30,
|
|
355
|
+
color = SERIES[0]
|
|
356
|
+
}) {
|
|
357
|
+
if (!points || points.length < 2) return null;
|
|
358
|
+
const min = Math.min(...points);
|
|
359
|
+
const max = Math.max(...points);
|
|
360
|
+
const span = max - min || 1;
|
|
361
|
+
const stepX = width / (points.length - 1);
|
|
362
|
+
const y = (v) => height - 2 - (v - min) / span * (height - 4);
|
|
363
|
+
const d = points.map((p, i) => `${i === 0 ? "M" : "L"}${(i * stepX).toFixed(1)},${y(p).toFixed(1)}`).join(" ");
|
|
364
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width, height, viewBox: `0 0 ${width} ${height}`, role: "img", "aria-label": "trend", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d, fill: "none", stroke: color, strokeWidth: 1.5, strokeLinejoin: "round", strokeLinecap: "round" }) });
|
|
365
|
+
}
|
|
366
|
+
function MiniBars({
|
|
367
|
+
bars,
|
|
368
|
+
width = 320,
|
|
369
|
+
height = 96,
|
|
370
|
+
color = SERIES[0]
|
|
371
|
+
}) {
|
|
372
|
+
if (!bars.length) return null;
|
|
373
|
+
const max = Math.max(...bars.map((b) => b.value), 1);
|
|
374
|
+
const gap = 4;
|
|
375
|
+
const bw = (width - gap * (bars.length - 1)) / bars.length;
|
|
376
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "100%", height, viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "none", role: "img", "aria-label": "bars", children: bars.map((b, i) => {
|
|
377
|
+
const h = Math.max(1, b.value / max * (height - 2));
|
|
378
|
+
return /* @__PURE__ */ jsxRuntime.jsx("rect", { x: i * (bw + gap), y: height - h, width: bw, height: h, rx: 2, fill: color, opacity: 0.85, children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: `${b.label}: ${b.value}` }) }, b.label + i);
|
|
379
|
+
}) });
|
|
380
|
+
}
|
|
381
|
+
function UtilBar({ value, width = 120, color }) {
|
|
382
|
+
const v = Math.max(0, Math.min(100, value));
|
|
383
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width, height: 8, viewBox: `0 0 ${width} 8`, role: "img", "aria-label": `${Math.round(v)}%`, children: [
|
|
384
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 1, width, height: 6, rx: 3, fill: TRACK }),
|
|
385
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: 0, y: 1, width: v / 100 * width, height: 6, rx: 3, fill: color ?? utilColor(v) })
|
|
386
|
+
] });
|
|
387
|
+
}
|
|
388
|
+
function LegendDot({ color, label, value }) {
|
|
389
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", justify: "space-between", children: [
|
|
390
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", children: [
|
|
391
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { width: 10, height: 10, rounded: "$1", bg: color }),
|
|
392
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color11", children: label })
|
|
393
|
+
] }),
|
|
394
|
+
value != null ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color12", fontWeight: "500", className: "hz-mono", children: value }) : null
|
|
395
|
+
] });
|
|
396
|
+
}
|
|
397
|
+
function MetricCard({
|
|
398
|
+
icon,
|
|
399
|
+
label,
|
|
400
|
+
value,
|
|
401
|
+
caption,
|
|
402
|
+
spark,
|
|
403
|
+
sparkColor,
|
|
404
|
+
delta
|
|
405
|
+
}) {
|
|
406
|
+
const up = delta ? delta.pct >= 0 : false;
|
|
407
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.Card, { p: "$3.5", gap: "$2", borderWidth: 1, borderColor: "$borderColor", flex: 1, minW: 172, children: [
|
|
408
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", justify: "space-between", children: [
|
|
409
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", children: [
|
|
410
|
+
icon,
|
|
411
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color11", fontWeight: "500", children: label })
|
|
412
|
+
] }),
|
|
413
|
+
delta ? /* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: "$1", color: up ? "#7ee787" : "#e5534b", children: [
|
|
414
|
+
up ? "\u25B2" : "\u25BC",
|
|
415
|
+
" ",
|
|
416
|
+
Math.abs(delta.pct),
|
|
417
|
+
"%"
|
|
418
|
+
] }) : null
|
|
419
|
+
] }),
|
|
420
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "flex-end", justify: "space-between", gap: "$2", children: [
|
|
421
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$8", fontWeight: "500", color: "$color12", numberOfLines: 1, className: "hz-mono", children: value }),
|
|
422
|
+
spark && spark.length >= 2 ? /* @__PURE__ */ jsxRuntime.jsx(Sparkline2, { points: spark, color: sparkColor ?? SERIES[0] }) : null
|
|
423
|
+
] }),
|
|
424
|
+
caption ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", color: "$color10", numberOfLines: 1, children: caption }) : null
|
|
425
|
+
] });
|
|
426
|
+
}
|
|
427
|
+
function HintButton({
|
|
428
|
+
icon,
|
|
429
|
+
iconAfter,
|
|
430
|
+
children,
|
|
431
|
+
onPress,
|
|
432
|
+
disabled,
|
|
433
|
+
hint,
|
|
434
|
+
theme
|
|
435
|
+
}) {
|
|
436
|
+
const btn = /* @__PURE__ */ jsxRuntime.jsx(
|
|
437
|
+
gui.Button,
|
|
438
|
+
{
|
|
439
|
+
size: "$2",
|
|
440
|
+
theme,
|
|
441
|
+
icon,
|
|
442
|
+
iconAfter,
|
|
443
|
+
disabled,
|
|
444
|
+
onPress: disabled ? void 0 : onPress,
|
|
445
|
+
children
|
|
446
|
+
}
|
|
447
|
+
);
|
|
448
|
+
if (!hint) return btn;
|
|
449
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { title: hint, style: { display: "inline-flex" }, children: btn });
|
|
450
|
+
}
|
|
451
|
+
function Panel({
|
|
452
|
+
title,
|
|
453
|
+
right,
|
|
454
|
+
children,
|
|
455
|
+
minW = 280,
|
|
456
|
+
grow = true
|
|
457
|
+
}) {
|
|
458
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.Card, { p: "$4", gap: "$3", borderWidth: 1, borderColor: "$borderColor", flex: grow ? 1 : void 0, minW, width: grow ? void 0 : "100%", children: [
|
|
459
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", justify: "space-between", gap: "$2", children: [
|
|
460
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$4", fontWeight: "500", color: "$color12", children: title }),
|
|
461
|
+
right
|
|
462
|
+
] }),
|
|
463
|
+
children
|
|
464
|
+
] });
|
|
465
|
+
}
|
|
466
|
+
function Donut2({
|
|
467
|
+
segments,
|
|
468
|
+
size = 160,
|
|
469
|
+
thickness = 18,
|
|
470
|
+
centerValue,
|
|
471
|
+
centerLabel,
|
|
472
|
+
trackColor = "#2a2d2e",
|
|
473
|
+
valueColor = "#ecedee",
|
|
474
|
+
labelColor = "#9ba1a6"
|
|
475
|
+
}) {
|
|
476
|
+
const total = segments.reduce((n, s) => n + Math.max(0, s.value), 0);
|
|
477
|
+
if (total <= 0) return null;
|
|
478
|
+
const r = (size - thickness) / 2;
|
|
479
|
+
const cx = size / 2;
|
|
480
|
+
const cy = size / 2;
|
|
481
|
+
const circ = 2 * Math.PI * r;
|
|
482
|
+
let offset = 0;
|
|
483
|
+
const arcs = segments.filter((s) => s.value > 0).map((s) => {
|
|
484
|
+
const frac = s.value / total;
|
|
485
|
+
const dash = frac * circ;
|
|
486
|
+
const node = /* @__PURE__ */ jsxRuntime.jsx(
|
|
487
|
+
"circle",
|
|
488
|
+
{
|
|
489
|
+
cx,
|
|
490
|
+
cy,
|
|
491
|
+
r,
|
|
492
|
+
fill: "none",
|
|
493
|
+
stroke: s.color,
|
|
494
|
+
strokeWidth: thickness,
|
|
495
|
+
strokeDasharray: `${dash} ${circ - dash}`,
|
|
496
|
+
strokeDashoffset: -offset
|
|
497
|
+
},
|
|
498
|
+
s.label
|
|
499
|
+
);
|
|
500
|
+
offset += dash;
|
|
501
|
+
return node;
|
|
502
|
+
});
|
|
503
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, role: "img", "aria-label": "Donut chart", children: [
|
|
504
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r, fill: "none", stroke: trackColor, strokeWidth: thickness }),
|
|
505
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { transform: `rotate(-90 ${cx} ${cy})`, children: arcs }),
|
|
506
|
+
centerValue ? /* @__PURE__ */ jsxRuntime.jsx("text", { x: cx, y: cy - 2, textAnchor: "middle", fontSize: size * 0.2, fontWeight: "800", fill: valueColor, children: centerValue }) : null,
|
|
507
|
+
centerLabel ? /* @__PURE__ */ jsxRuntime.jsx("text", { x: cx, y: cy + size * 0.13, textAnchor: "middle", fontSize: size * 0.08, fill: labelColor, children: centerLabel }) : null
|
|
508
|
+
] });
|
|
509
|
+
}
|
|
7
510
|
|
|
511
|
+
// src/product/combobox/filter.ts
|
|
512
|
+
var hay = (o) => `${o.value} ${o.label ?? ""} ${o.hint ?? ""}`.toLowerCase();
|
|
513
|
+
function filterOptions(options, query) {
|
|
514
|
+
const q = query.trim().toLowerCase();
|
|
515
|
+
if (!q) return options;
|
|
516
|
+
return options.filter((o) => hay(o).includes(q));
|
|
517
|
+
}
|
|
518
|
+
function isKnownOption(options, value) {
|
|
519
|
+
return options.some((o) => o.value === value);
|
|
520
|
+
}
|
|
521
|
+
var ITEM_MIN_HEIGHT = 30;
|
|
522
|
+
var ITEM_RADIUS = 7;
|
|
523
|
+
var ITEM_PX = 8;
|
|
524
|
+
var ITEM_GAP = 8;
|
|
525
|
+
var ICON_SLOT = 16;
|
|
526
|
+
var PANEL_RADIUS = 12;
|
|
527
|
+
var PANEL_PAD = 4;
|
|
528
|
+
var PANEL_GAP = 2;
|
|
529
|
+
var SEP_MARGIN = 4;
|
|
530
|
+
var FONT_LABEL = 13;
|
|
531
|
+
var FONT_MUTED = 11;
|
|
532
|
+
var FONT_SHORTCUT = 12;
|
|
533
|
+
var ACCENT2 = "var(--hanzo-accent, #8b5cf6)";
|
|
534
|
+
var ACCENT_SOFT = "var(--hanzo-accent-soft, rgba(139,92,246,0.16))";
|
|
535
|
+
var DANGER = "var(--hanzo-danger, #ef4444)";
|
|
536
|
+
function MenuPanel({
|
|
537
|
+
children,
|
|
538
|
+
minWidth = 200,
|
|
539
|
+
maxHeight = 360,
|
|
540
|
+
onKeyDown,
|
|
541
|
+
panelRef,
|
|
542
|
+
...rest
|
|
543
|
+
}) {
|
|
544
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
545
|
+
gui.YStack,
|
|
546
|
+
{
|
|
547
|
+
ref: panelRef,
|
|
548
|
+
role: "menu",
|
|
549
|
+
bg: "$color2",
|
|
550
|
+
borderColor: "$borderColor",
|
|
551
|
+
borderWidth: 1,
|
|
552
|
+
rounded: PANEL_RADIUS,
|
|
553
|
+
p: PANEL_PAD,
|
|
554
|
+
gap: PANEL_GAP,
|
|
555
|
+
minW: minWidth,
|
|
556
|
+
maxH: maxHeight,
|
|
557
|
+
overflow: "scroll",
|
|
558
|
+
shadowColor: "rgba(0,0,0,0.45)",
|
|
559
|
+
shadowRadius: 20,
|
|
560
|
+
shadowOffset: { width: 0, height: 10 },
|
|
561
|
+
onKeyDown,
|
|
562
|
+
...rest,
|
|
563
|
+
children
|
|
564
|
+
}
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
function MenuItemView({
|
|
568
|
+
icon,
|
|
569
|
+
label,
|
|
570
|
+
description,
|
|
571
|
+
shortcut,
|
|
572
|
+
selected = false,
|
|
573
|
+
disabled = false,
|
|
574
|
+
destructive = false,
|
|
575
|
+
hasSubmenu = false,
|
|
576
|
+
onSelect
|
|
577
|
+
}) {
|
|
578
|
+
const press = () => {
|
|
579
|
+
if (!disabled) onSelect();
|
|
580
|
+
};
|
|
581
|
+
const onKeyDown = (e) => {
|
|
582
|
+
if (disabled) return;
|
|
583
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
584
|
+
e.preventDefault();
|
|
585
|
+
onSelect();
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
const labelColor = destructive ? DANGER : "$color12";
|
|
589
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
590
|
+
gui.XStack,
|
|
591
|
+
{
|
|
592
|
+
role: "menuitem",
|
|
593
|
+
tabIndex: disabled ? -1 : 0,
|
|
594
|
+
"aria-disabled": disabled || void 0,
|
|
595
|
+
items: "center",
|
|
596
|
+
gap: ITEM_GAP,
|
|
597
|
+
px: ITEM_PX,
|
|
598
|
+
minH: ITEM_MIN_HEIGHT,
|
|
599
|
+
rounded: ITEM_RADIUS,
|
|
600
|
+
cursor: disabled ? "default" : "pointer",
|
|
601
|
+
opacity: disabled ? 0.4 : 1,
|
|
602
|
+
select: "none",
|
|
603
|
+
style: { outline: "none" },
|
|
604
|
+
hoverStyle: disabled ? {} : { bg: ACCENT_SOFT },
|
|
605
|
+
pressStyle: disabled ? {} : { bg: ACCENT_SOFT },
|
|
606
|
+
focusStyle: disabled ? {} : { bg: ACCENT_SOFT },
|
|
607
|
+
onPress: press,
|
|
608
|
+
onKeyDown,
|
|
609
|
+
children: [
|
|
610
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { width: ICON_SLOT, height: ICON_SLOT, items: "center", justify: "center", shrink: 0, children: icon ? /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { items: "center", justify: "center", opacity: destructive ? 1 : 0.9, style: destructive ? { color: DANGER } : void 0, children: icon }) : null }),
|
|
611
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { flex: 1, minW: 0, children: [
|
|
612
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: FONT_LABEL, lineHeight: 18, color: labelColor, numberOfLines: 1, children: label }),
|
|
613
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: FONT_MUTED, lineHeight: 14, color: "$color11", numberOfLines: 1, children: description }) : null
|
|
614
|
+
] }),
|
|
615
|
+
shortcut ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: FONT_SHORTCUT, color: "$color11", shrink: 0, children: shortcut }) : null,
|
|
616
|
+
selected ? /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Check, { size: 14, color: ACCENT2 }) : null,
|
|
617
|
+
hasSubmenu ? /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.ChevronRight, { size: 14, color: "var(--hanzo-muted, currentColor)", opacity: 0.6 }) : null
|
|
618
|
+
]
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
function MenuSeparatorView() {
|
|
623
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { height: 1, bg: "$borderColor", my: SEP_MARGIN, mx: SEP_MARGIN, role: "separator" });
|
|
624
|
+
}
|
|
625
|
+
function MenuLabelView({ children }) {
|
|
626
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
627
|
+
gui.Text,
|
|
628
|
+
{
|
|
629
|
+
fontSize: FONT_MUTED,
|
|
630
|
+
color: "$color11",
|
|
631
|
+
px: ITEM_PX,
|
|
632
|
+
py: SEP_MARGIN,
|
|
633
|
+
textTransform: "uppercase",
|
|
634
|
+
letterSpacing: 0.4,
|
|
635
|
+
select: "none",
|
|
636
|
+
children
|
|
637
|
+
}
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
function renderMenuItems(items, close) {
|
|
641
|
+
return items.map((it, i) => {
|
|
642
|
+
if (it.type === "separator") return /* @__PURE__ */ jsxRuntime.jsx(MenuSeparatorView, {}, it.key ?? `sep-${i}`);
|
|
643
|
+
if (it.type === "label") return /* @__PURE__ */ jsxRuntime.jsx(MenuLabelView, { children: it.label }, it.key ?? `lbl-${i}`);
|
|
644
|
+
const { key, onSelect, closeOnSelect = true, ...rest } = it;
|
|
645
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
646
|
+
MenuItemView,
|
|
647
|
+
{
|
|
648
|
+
...rest,
|
|
649
|
+
onSelect: () => {
|
|
650
|
+
onSelect();
|
|
651
|
+
if (closeOnSelect) close?.();
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
key
|
|
655
|
+
);
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
function PortalTheme({ name, children }) {
|
|
659
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Theme, { name, children });
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// src/product/menu/roving.ts
|
|
663
|
+
function menuKeyDown(e, onClose) {
|
|
664
|
+
if (e.key === "Escape") {
|
|
665
|
+
onClose?.();
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp" && e.key !== "Home" && e.key !== "End") return;
|
|
669
|
+
if (typeof document === "undefined") return;
|
|
670
|
+
const panel = e.currentTarget;
|
|
671
|
+
const items = Array.from(
|
|
672
|
+
panel.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')
|
|
673
|
+
);
|
|
674
|
+
if (items.length === 0) return;
|
|
675
|
+
e.preventDefault();
|
|
676
|
+
const active = document.activeElement;
|
|
677
|
+
const current2 = active ? items.indexOf(active) : -1;
|
|
678
|
+
let next;
|
|
679
|
+
if (e.key === "Home") next = 0;
|
|
680
|
+
else if (e.key === "End") next = items.length - 1;
|
|
681
|
+
else if (e.key === "ArrowDown") next = current2 < 0 ? 0 : (current2 + 1) % items.length;
|
|
682
|
+
else next = current2 <= 0 ? items.length - 1 : current2 - 1;
|
|
683
|
+
items[next]?.focus();
|
|
684
|
+
}
|
|
685
|
+
var EDGE = 8;
|
|
686
|
+
function FloatingMenu({
|
|
687
|
+
open,
|
|
688
|
+
onClose,
|
|
689
|
+
anchorRect,
|
|
690
|
+
anchorEl,
|
|
691
|
+
gap = 4,
|
|
692
|
+
minWidth = 200,
|
|
693
|
+
maxHeight,
|
|
694
|
+
autoFocus = true,
|
|
695
|
+
children
|
|
696
|
+
}) {
|
|
697
|
+
const themeName = gui.useThemeName();
|
|
698
|
+
const panelRef = react.useRef(null);
|
|
699
|
+
const [pos, setPos] = react.useState(null);
|
|
700
|
+
const setPanel = react.useCallback((n) => {
|
|
701
|
+
panelRef.current = n;
|
|
702
|
+
}, []);
|
|
703
|
+
const place = react.useCallback(() => {
|
|
704
|
+
if (typeof window === "undefined") return;
|
|
705
|
+
const a = anchorRect();
|
|
706
|
+
if (!a) return;
|
|
707
|
+
const node = panelRef.current;
|
|
708
|
+
const w = node?.offsetWidth || minWidth;
|
|
709
|
+
const h = node?.offsetHeight || 0;
|
|
710
|
+
let left = a.left;
|
|
711
|
+
let top = a.bottom + gap;
|
|
712
|
+
if (left + w > window.innerWidth - EDGE) left = Math.max(EDGE, window.innerWidth - w - EDGE);
|
|
713
|
+
if (h && top + h > window.innerHeight - EDGE) {
|
|
714
|
+
const above = a.top - gap - h;
|
|
715
|
+
top = above >= EDGE ? above : Math.max(EDGE, window.innerHeight - h - EDGE);
|
|
716
|
+
}
|
|
717
|
+
setPos({ left, top });
|
|
718
|
+
}, [anchorRect, gap, minWidth]);
|
|
719
|
+
react.useLayoutEffect(() => {
|
|
720
|
+
if (!open) {
|
|
721
|
+
setPos(null);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
place();
|
|
725
|
+
if (autoFocus) panelRef.current?.focus?.();
|
|
726
|
+
}, [open, place, autoFocus]);
|
|
727
|
+
react.useEffect(() => {
|
|
728
|
+
if (!open || typeof document === "undefined") return;
|
|
729
|
+
const onPointerDown = (e) => {
|
|
730
|
+
const t = e.target;
|
|
731
|
+
if (panelRef.current?.contains(t)) return;
|
|
732
|
+
const anchor = anchorEl?.();
|
|
733
|
+
if (anchor && anchor.contains(t)) return;
|
|
734
|
+
onClose();
|
|
735
|
+
};
|
|
736
|
+
const onKey = (e) => {
|
|
737
|
+
if (e.key === "Escape") onClose();
|
|
738
|
+
};
|
|
739
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
740
|
+
document.addEventListener("keydown", onKey, true);
|
|
741
|
+
window.addEventListener("scroll", onClose, true);
|
|
742
|
+
window.addEventListener("resize", onClose);
|
|
743
|
+
window.addEventListener("blur", onClose);
|
|
744
|
+
return () => {
|
|
745
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
746
|
+
document.removeEventListener("keydown", onKey, true);
|
|
747
|
+
window.removeEventListener("scroll", onClose, true);
|
|
748
|
+
window.removeEventListener("resize", onClose);
|
|
749
|
+
window.removeEventListener("blur", onClose);
|
|
750
|
+
};
|
|
751
|
+
}, [open, onClose, anchorEl]);
|
|
752
|
+
if (!open) return null;
|
|
753
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(PortalTheme, { name: themeName, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
754
|
+
MenuPanel,
|
|
755
|
+
{
|
|
756
|
+
panelRef: setPanel,
|
|
757
|
+
minWidth,
|
|
758
|
+
maxHeight,
|
|
759
|
+
tabIndex: -1,
|
|
760
|
+
onKeyDown: (e) => menuKeyDown(e, onClose),
|
|
761
|
+
style: {
|
|
762
|
+
position: "fixed",
|
|
763
|
+
left: pos?.left ?? 0,
|
|
764
|
+
top: pos?.top ?? 0,
|
|
765
|
+
zIndex: 1e5,
|
|
766
|
+
visibility: pos ? "visible" : "hidden"
|
|
767
|
+
},
|
|
768
|
+
children
|
|
769
|
+
}
|
|
770
|
+
) }) });
|
|
771
|
+
}
|
|
772
|
+
function ComboBox({
|
|
773
|
+
value,
|
|
774
|
+
onChange,
|
|
775
|
+
options,
|
|
776
|
+
loading = false,
|
|
777
|
+
error = null,
|
|
778
|
+
onRetry,
|
|
779
|
+
placeholder,
|
|
780
|
+
disabled,
|
|
781
|
+
emptyText = "No matches \u2014 press to use what you typed.",
|
|
782
|
+
minWidth = 240
|
|
783
|
+
}) {
|
|
784
|
+
const [open, setOpen] = react.useState(false);
|
|
785
|
+
const rowRef = react.useRef(null);
|
|
786
|
+
const anchorRect = react.useCallback(() => rowRef.current?.getBoundingClientRect() ?? null, []);
|
|
787
|
+
const anchorEl = react.useCallback(() => rowRef.current, []);
|
|
788
|
+
const filtered = react.useMemo(() => filterOptions(options, value), [options, value]);
|
|
789
|
+
const pick = (v) => {
|
|
790
|
+
onChange(v);
|
|
791
|
+
setOpen(false);
|
|
792
|
+
};
|
|
793
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
794
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { ref: rowRef, items: "center", gap: "$2", minW: minWidth, children: [
|
|
795
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
796
|
+
gui.Input,
|
|
797
|
+
{
|
|
798
|
+
flex: 1,
|
|
799
|
+
value,
|
|
800
|
+
onChangeText: (v) => {
|
|
801
|
+
onChange(v);
|
|
802
|
+
if (!open) setOpen(true);
|
|
803
|
+
},
|
|
804
|
+
onFocus: () => setOpen(true),
|
|
805
|
+
disabled,
|
|
806
|
+
placeholder,
|
|
807
|
+
autoCapitalize: "none"
|
|
808
|
+
}
|
|
809
|
+
),
|
|
810
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
811
|
+
gui.Button,
|
|
812
|
+
{
|
|
813
|
+
size: "$2",
|
|
814
|
+
chromeless: true,
|
|
815
|
+
disabled,
|
|
816
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.ChevronDown, { size: 16, opacity: 0.7 }),
|
|
817
|
+
onPress: () => setOpen((o) => !o),
|
|
818
|
+
"aria-label": "Show options"
|
|
819
|
+
}
|
|
820
|
+
)
|
|
821
|
+
] }),
|
|
822
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
823
|
+
FloatingMenu,
|
|
824
|
+
{
|
|
825
|
+
open,
|
|
826
|
+
onClose: () => setOpen(false),
|
|
827
|
+
anchorRect,
|
|
828
|
+
anchorEl,
|
|
829
|
+
autoFocus: false,
|
|
830
|
+
minWidth,
|
|
831
|
+
maxHeight: 300,
|
|
832
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", px: "$2", py: "$2", children: [
|
|
833
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Spinner, { size: "small", color: "$color11" }),
|
|
834
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color10", children: "Loading options\u2026" })
|
|
835
|
+
] }) : error ? /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", px: "$2", py: "$2", children: [
|
|
836
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color10", flex: 1, numberOfLines: 2, children: error }),
|
|
837
|
+
onRetry ? /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$1", chromeless: true, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.RefreshCw, { size: 12 }), onPress: onRetry, "aria-label": "Retry" }) : null
|
|
838
|
+
] }) : filtered.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color10", px: "$2", py: "$2", children: emptyText }) : filtered.map((o) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
839
|
+
MenuItemView,
|
|
840
|
+
{
|
|
841
|
+
label: o.label ?? o.value,
|
|
842
|
+
description: o.hint,
|
|
843
|
+
selected: o.value === value,
|
|
844
|
+
onSelect: () => pick(o.value)
|
|
845
|
+
},
|
|
846
|
+
o.value
|
|
847
|
+
))
|
|
848
|
+
}
|
|
849
|
+
)
|
|
850
|
+
] });
|
|
851
|
+
}
|
|
852
|
+
var ORDER = ["ai", "console", "app", "chat", "bot", "team", "billing"];
|
|
853
|
+
var SURFACES = ORDER.map((id) => {
|
|
854
|
+
const s = products.surfaceById(id);
|
|
855
|
+
return { id, label: s.label, href: s.href, hint: s.domain };
|
|
856
|
+
});
|
|
857
|
+
function otherSurfaces(current2) {
|
|
858
|
+
return current2 ? SURFACES.filter((s) => s.id !== current2) : SURFACES;
|
|
859
|
+
}
|
|
860
|
+
function HanzoMark({ size = 22, color = "currentColor" }) {
|
|
861
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
862
|
+
"svg",
|
|
863
|
+
{
|
|
864
|
+
width: size,
|
|
865
|
+
height: size,
|
|
866
|
+
viewBox: "0 0 67 67",
|
|
867
|
+
role: "img",
|
|
868
|
+
"aria-label": "Hanzo",
|
|
869
|
+
fill: color,
|
|
870
|
+
style: { display: "block", flexShrink: 0 },
|
|
871
|
+
children: [
|
|
872
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M22.21 67V44.6369H0V67H22.21Z" }),
|
|
873
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { opacity: 0.55, d: "M0 44.6369L22.21 46.8285V44.6369H0Z" }),
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z" }),
|
|
875
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M22.21 0H0V22.3184H22.21V0Z" }),
|
|
876
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M66.7198 0H44.5098V22.3184H66.7198V0Z" }),
|
|
877
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { opacity: 0.55, d: "M66.6753 22.3185L44.5098 20.0822V22.3185H66.6753Z" }),
|
|
878
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M66.7198 67V44.6369H44.5098V67H66.7198Z" })
|
|
879
|
+
]
|
|
880
|
+
}
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
function BrandMark({
|
|
884
|
+
size = 20,
|
|
885
|
+
wordmark = "Hanzo",
|
|
886
|
+
animated = true
|
|
887
|
+
}) {
|
|
888
|
+
if (!animated) return /* @__PURE__ */ jsxRuntime.jsx(HanzoMark, { size });
|
|
889
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react$1.HanzoLogo, { animated: true, size, wordmark });
|
|
890
|
+
}
|
|
891
|
+
var SURFACE_ICON = {
|
|
892
|
+
ai: lucideIcons2.Sparkles,
|
|
893
|
+
console: lucideIcons2.LayoutGrid,
|
|
894
|
+
app: lucideIcons2.AppWindow,
|
|
895
|
+
chat: lucideIcons2.MessageCircle,
|
|
896
|
+
bot: lucideIcons2.Bot,
|
|
897
|
+
team: lucideIcons2.Users,
|
|
898
|
+
billing: lucideIcons2.CreditCard
|
|
899
|
+
};
|
|
900
|
+
var openHref = (href) => {
|
|
901
|
+
if (typeof window !== "undefined") window.open(href, "_blank", "noopener");
|
|
902
|
+
};
|
|
903
|
+
function MenuRow({ icon, label, onPress }) {
|
|
904
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { onPress, cursor: "pointer", items: "center", gap: "$2.5", px: "$2", py: "$2", rounded: "$3", hoverStyle: { bg: "$color5" }, children: [
|
|
905
|
+
icon,
|
|
906
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color12", children: label })
|
|
907
|
+
] });
|
|
908
|
+
}
|
|
909
|
+
function AppHeader({
|
|
910
|
+
brand,
|
|
911
|
+
wordmark = "Hanzo",
|
|
912
|
+
onBrand,
|
|
913
|
+
org,
|
|
914
|
+
children,
|
|
915
|
+
current: current2,
|
|
916
|
+
surfaces,
|
|
917
|
+
open,
|
|
918
|
+
user,
|
|
919
|
+
menu,
|
|
920
|
+
theme,
|
|
921
|
+
onProfile,
|
|
922
|
+
onTeam,
|
|
923
|
+
onBilling,
|
|
924
|
+
onSignOut
|
|
925
|
+
}) {
|
|
926
|
+
const [appsOpen, setAppsOpen] = react.useState(false);
|
|
927
|
+
const [menuOpen, setMenuOpen] = react.useState(false);
|
|
928
|
+
const items = surfaces ?? otherSurfaces(current2);
|
|
929
|
+
const launch = (s) => {
|
|
930
|
+
setAppsOpen(false);
|
|
931
|
+
if (open) open(s);
|
|
932
|
+
else openHref(s.href);
|
|
933
|
+
};
|
|
934
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", px: "$3", height: 52, borderBottomWidth: 1, borderColor: "$borderColor", bg: "$background", children: [
|
|
935
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { items: "center", cursor: onBrand ? "pointer" : void 0, onPress: onBrand, children: brand ?? /* @__PURE__ */ jsxRuntime.jsx(BrandMark, { wordmark }) }),
|
|
936
|
+
org ? /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { items: "center", minW: 0, children: org }) : null,
|
|
937
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { flex: 1, items: "center", minW: 0, children }),
|
|
938
|
+
items.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(gui.Popover, { open: appsOpen, onOpenChange: setAppsOpen, placement: "bottom-end", children: [
|
|
939
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$2", chromeless: true, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Grip, { size: 16 }), "aria-label": "Apps" }) }),
|
|
940
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Popover.Content, { bordered: true, elevate: true, p: "$2", width: 230, bg: "$color2", borderColor: "$borderColor", children: /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: "$1", children: items.map((s) => {
|
|
941
|
+
const Icon = SURFACE_ICON[s.id];
|
|
942
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { onPress: () => launch(s), cursor: "pointer", items: "center", gap: "$2.5", px: "$2", py: "$2", rounded: "$3", hoverStyle: { bg: "$color5" }, children: [
|
|
943
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 16 }),
|
|
944
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { flex: 1, fontSize: "$2", fontWeight: "600", color: "$color12", children: s.label }),
|
|
945
|
+
s.hint ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", color: "$color10", children: s.hint }) : null
|
|
946
|
+
] }, s.id);
|
|
947
|
+
}) }) })
|
|
948
|
+
] }) : null,
|
|
949
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.Popover, { open: menuOpen, onOpenChange: setMenuOpen, placement: "bottom-end", children: [
|
|
950
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$2", chromeless: true, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.UserRound, { size: 16 }), "aria-label": "Account", children: user ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color12", numberOfLines: 1, maxW: 140, children: user }) : null }) }),
|
|
951
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Popover.Content, { bordered: true, elevate: true, p: "$2", width: 220, bg: "$color2", borderColor: "$borderColor", children: menu ?? /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$1", children: [
|
|
952
|
+
onProfile ? /* @__PURE__ */ jsxRuntime.jsx(MenuRow, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.UserRound, { size: 15 }), label: "Profile", onPress: () => (setMenuOpen(false), onProfile()) }) : null,
|
|
953
|
+
theme !== null ? /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2.5", px: "$2", py: "$1", rounded: "$3", children: [
|
|
954
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { flex: 1, fontSize: "$2", color: "$color12", children: "Theme" }),
|
|
955
|
+
theme ?? /* @__PURE__ */ jsxRuntime.jsx(chunkYBXVUV7P_cjs.ThemeToggle, {})
|
|
956
|
+
] }) : null,
|
|
957
|
+
onTeam ? /* @__PURE__ */ jsxRuntime.jsx(MenuRow, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Settings2, { size: 15 }), label: "Team settings", onPress: () => (setMenuOpen(false), onTeam()) }) : null,
|
|
958
|
+
onBilling ? /* @__PURE__ */ jsxRuntime.jsx(MenuRow, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.CreditCard, { size: 15 }), label: "Billing", onPress: () => (setMenuOpen(false), onBilling()) }) : null,
|
|
959
|
+
onSignOut ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
960
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Separator, { borderColor: "$borderColor", my: "$1" }),
|
|
961
|
+
/* @__PURE__ */ jsxRuntime.jsx(MenuRow, { icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.LogOut, { size: 15 }), label: "Sign out", onPress: () => (setMenuOpen(false), onSignOut()) })
|
|
962
|
+
] }) : null
|
|
963
|
+
] }) })
|
|
964
|
+
] })
|
|
965
|
+
] });
|
|
966
|
+
}
|
|
967
|
+
function monogram(name) {
|
|
968
|
+
const words = name.trim().split(/[\s._/-]+/).filter(Boolean);
|
|
969
|
+
const letters = words.slice(0, 2).map((w) => w[0] ?? "").join("");
|
|
970
|
+
return (letters || name.trim().slice(0, 2)).toUpperCase();
|
|
971
|
+
}
|
|
972
|
+
function OrgMark({ org, size = 22, maxW }) {
|
|
973
|
+
if (org.logo) {
|
|
974
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
975
|
+
"img",
|
|
976
|
+
{
|
|
977
|
+
src: org.logo,
|
|
978
|
+
alt: "",
|
|
979
|
+
style: {
|
|
980
|
+
height: size,
|
|
981
|
+
width: maxW ? "auto" : size,
|
|
982
|
+
maxWidth: maxW ?? size,
|
|
983
|
+
objectFit: "contain",
|
|
984
|
+
display: "block",
|
|
985
|
+
borderRadius: 6,
|
|
986
|
+
flexShrink: 0
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
992
|
+
gui.YStack,
|
|
993
|
+
{
|
|
994
|
+
width: size,
|
|
995
|
+
height: size,
|
|
996
|
+
rounded: "$3",
|
|
997
|
+
bg: "$color4",
|
|
998
|
+
items: "center",
|
|
999
|
+
justify: "center",
|
|
1000
|
+
style: { flexShrink: 0 },
|
|
1001
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: Math.round(size * 0.4), fontWeight: "800", color: "$color12", children: monogram(org.displayName || org.name) })
|
|
1002
|
+
}
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// src/product/scope.ts
|
|
1007
|
+
function browserStorage() {
|
|
1008
|
+
if (typeof window === "undefined") return null;
|
|
1009
|
+
try {
|
|
1010
|
+
return window.localStorage;
|
|
1011
|
+
} catch {
|
|
1012
|
+
return null;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
function orgScope(config) {
|
|
1016
|
+
const key = config.key ?? "hanzo.org";
|
|
1017
|
+
const selectedKey = `${key}.selected`;
|
|
1018
|
+
const store = () => config.storage ?? browserStorage();
|
|
1019
|
+
const read = (k) => {
|
|
1020
|
+
try {
|
|
1021
|
+
return store()?.getItem(k) ?? null;
|
|
1022
|
+
} catch {
|
|
1023
|
+
return null;
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
const write = (k, v) => {
|
|
1027
|
+
try {
|
|
1028
|
+
if (v === null) store()?.removeItem(k);
|
|
1029
|
+
else store()?.setItem(k, v);
|
|
1030
|
+
} catch {
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
const goHome = () => {
|
|
1034
|
+
if (config.navigate) return config.navigate("/");
|
|
1035
|
+
if (typeof window !== "undefined") window.location.assign("/");
|
|
1036
|
+
};
|
|
1037
|
+
const doReload = () => {
|
|
1038
|
+
if (config.reload) return config.reload();
|
|
1039
|
+
if (typeof window !== "undefined") window.location.reload();
|
|
1040
|
+
};
|
|
1041
|
+
const scope = {
|
|
1042
|
+
currentOrg: () => read(key) || config.brandOrg,
|
|
1043
|
+
setCurrentOrg: (org) => write(key, !org || org === config.brandOrg ? null : org),
|
|
1044
|
+
isScopedAway: () => scope.currentOrg() !== config.brandOrg,
|
|
1045
|
+
hasSelectedOrg: () => read(selectedKey) === "1",
|
|
1046
|
+
enterOrg: (org) => {
|
|
1047
|
+
if (!org) return;
|
|
1048
|
+
scope.setCurrentOrg(org);
|
|
1049
|
+
write(selectedKey, "1");
|
|
1050
|
+
goHome();
|
|
1051
|
+
},
|
|
1052
|
+
leaveOrg: () => {
|
|
1053
|
+
write(selectedKey, null);
|
|
1054
|
+
scope.setCurrentOrg(config.brandOrg);
|
|
1055
|
+
goHome();
|
|
1056
|
+
},
|
|
1057
|
+
switchOrg: (org) => {
|
|
1058
|
+
if (!org || org === scope.currentOrg()) return;
|
|
1059
|
+
scope.setCurrentOrg(org);
|
|
1060
|
+
write(selectedKey, "1");
|
|
1061
|
+
doReload();
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
return scope;
|
|
1065
|
+
}
|
|
1066
|
+
function filterOrgs(orgs, query) {
|
|
1067
|
+
const q = query.trim().toLowerCase();
|
|
1068
|
+
if (!q) return orgs;
|
|
1069
|
+
return orgs.filter(
|
|
1070
|
+
(o) => o.name.toLowerCase().includes(q) || (o.displayName ?? "").toLowerCase().includes(q)
|
|
1071
|
+
);
|
|
1072
|
+
}
|
|
1073
|
+
var titleCase = (s) => s ? s[0].toUpperCase() + s.slice(1) : s;
|
|
1074
|
+
function OrgSwitcher({ scope, orgs, pageSize = 20, current: given, create, picker = false }) {
|
|
1075
|
+
const currentId = scope.currentOrg();
|
|
1076
|
+
const [open, setOpen] = react.useState(false);
|
|
1077
|
+
const [query, setQuery] = react.useState("");
|
|
1078
|
+
const [debounced, setDebounced] = react.useState("");
|
|
1079
|
+
const [rows2, setRows] = react.useState([]);
|
|
1080
|
+
const [loading, setLoading] = react.useState(false);
|
|
1081
|
+
const [loadingMore, setLoadingMore] = react.useState(false);
|
|
1082
|
+
const [hasMore, setHasMore] = react.useState(false);
|
|
1083
|
+
const [creating, setCreating] = react.useState(false);
|
|
1084
|
+
const [newName, setNewName] = react.useState("");
|
|
1085
|
+
const [busy, setBusy] = react.useState(false);
|
|
1086
|
+
const [err, setErr] = react.useState(null);
|
|
1087
|
+
const pageRef = react.useRef(0);
|
|
1088
|
+
const reqRef = react.useRef(0);
|
|
1089
|
+
react.useEffect(() => {
|
|
1090
|
+
const id = setTimeout(() => setDebounced(query.trim()), 250);
|
|
1091
|
+
return () => clearTimeout(id);
|
|
1092
|
+
}, [query]);
|
|
1093
|
+
const fetchPage = react.useCallback(
|
|
1094
|
+
async (page, q, append) => {
|
|
1095
|
+
if (!orgs) return;
|
|
1096
|
+
const token = ++reqRef.current;
|
|
1097
|
+
append ? setLoadingMore(true) : setLoading(true);
|
|
1098
|
+
try {
|
|
1099
|
+
const incoming = await orgs(page, q);
|
|
1100
|
+
if (token !== reqRef.current) return;
|
|
1101
|
+
pageRef.current = page;
|
|
1102
|
+
setRows((prev) => {
|
|
1103
|
+
const merged = append ? [...prev] : [];
|
|
1104
|
+
const seen = new Set(merged.map((o) => o.name));
|
|
1105
|
+
for (const o of incoming) if (!seen.has(o.name)) merged.push(o);
|
|
1106
|
+
return merged;
|
|
1107
|
+
});
|
|
1108
|
+
setHasMore(incoming.length >= pageSize);
|
|
1109
|
+
} catch {
|
|
1110
|
+
if (token !== reqRef.current) return;
|
|
1111
|
+
if (!append) setRows([]);
|
|
1112
|
+
setHasMore(false);
|
|
1113
|
+
} finally {
|
|
1114
|
+
if (token === reqRef.current) {
|
|
1115
|
+
setLoading(false);
|
|
1116
|
+
setLoadingMore(false);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
[orgs, pageSize]
|
|
1121
|
+
);
|
|
1122
|
+
react.useEffect(() => {
|
|
1123
|
+
if (!open || !orgs) return;
|
|
1124
|
+
void fetchPage(0, debounced, false);
|
|
1125
|
+
}, [open, debounced, fetchPage, orgs]);
|
|
1126
|
+
const loadMore = react.useCallback(() => {
|
|
1127
|
+
if (loading || loadingMore || !hasMore) return;
|
|
1128
|
+
void fetchPage(pageRef.current + 1, debounced, true);
|
|
1129
|
+
}, [loading, loadingMore, hasMore, debounced, fetchPage]);
|
|
1130
|
+
const visible = react.useMemo(() => {
|
|
1131
|
+
if (orgs) return filterOrgs(rows2, query);
|
|
1132
|
+
return [{ name: currentId, displayName: titleCase(currentId) }];
|
|
1133
|
+
}, [orgs, rows2, query, currentId]);
|
|
1134
|
+
const current2 = react.useMemo(() => {
|
|
1135
|
+
if (given && given.name === currentId) return given;
|
|
1136
|
+
return rows2.find((o) => o.name === currentId) ?? { name: currentId, displayName: titleCase(currentId) };
|
|
1137
|
+
}, [given, rows2, currentId]);
|
|
1138
|
+
const currentLabel = current2.displayName || titleCase(current2.name);
|
|
1139
|
+
const select = react.useCallback(
|
|
1140
|
+
(org) => {
|
|
1141
|
+
setOpen(false);
|
|
1142
|
+
scope.switchOrg(org);
|
|
1143
|
+
},
|
|
1144
|
+
[scope]
|
|
1145
|
+
);
|
|
1146
|
+
const submitCreate = async () => {
|
|
1147
|
+
const name = newName.trim();
|
|
1148
|
+
if (!name || !create) return;
|
|
1149
|
+
setBusy(true);
|
|
1150
|
+
setErr(null);
|
|
1151
|
+
try {
|
|
1152
|
+
const org = await create(name);
|
|
1153
|
+
scope.switchOrg(org);
|
|
1154
|
+
} catch (e) {
|
|
1155
|
+
setErr(e instanceof Error ? e.message : "Could not create the organization.");
|
|
1156
|
+
setBusy(false);
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.Popover, { open, onOpenChange: setOpen, placement: "bottom-start", children: [
|
|
1160
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { chromeless: true, height: 44, px: "$2", justify: "flex-start", "aria-label": `${currentLabel} \xB7 switch organization`, children: /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2.5", flex: 1, minW: 0, children: [
|
|
1161
|
+
/* @__PURE__ */ jsxRuntime.jsx(OrgMark, { org: current2, size: 30 }),
|
|
1162
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { flex: 1, minW: 0, fontSize: "$4", fontWeight: "800", color: "$color12", numberOfLines: 1, children: currentLabel }),
|
|
1163
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.ChevronsUpDown, { size: 15, color: "$color9" })
|
|
1164
|
+
] }) }) }),
|
|
1165
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Popover.Content, { bordered: true, elevate: true, p: "$2", width: 300, bg: "$color2", borderColor: "$borderColor", children: creating ? /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$2", children: [
|
|
1166
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color12", fontWeight: "700", children: "Create organization" }),
|
|
1167
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1168
|
+
gui.Input,
|
|
1169
|
+
{
|
|
1170
|
+
size: "$3",
|
|
1171
|
+
placeholder: "Organization name",
|
|
1172
|
+
value: newName,
|
|
1173
|
+
onChangeText: setNewName,
|
|
1174
|
+
autoCapitalize: "words",
|
|
1175
|
+
onSubmitEditing: () => void submitCreate()
|
|
1176
|
+
}
|
|
1177
|
+
),
|
|
1178
|
+
err ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", color: "$red10", children: err }) : null,
|
|
1179
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2", justify: "flex-end", children: [
|
|
1180
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$2", chromeless: true, onPress: () => setCreating(false), disabled: busy, children: "Cancel" }),
|
|
1181
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1182
|
+
gui.Button,
|
|
1183
|
+
{
|
|
1184
|
+
size: "$2",
|
|
1185
|
+
onPress: () => void submitCreate(),
|
|
1186
|
+
disabled: busy || !newName.trim(),
|
|
1187
|
+
icon: busy ? /* @__PURE__ */ jsxRuntime.jsx(gui.Spinner, { size: "small" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Plus, { size: 14 }),
|
|
1188
|
+
children: "Create"
|
|
1189
|
+
}
|
|
1190
|
+
)
|
|
1191
|
+
] })
|
|
1192
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$1", children: [
|
|
1193
|
+
orgs ? /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", px: "$2", py: "$1", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [
|
|
1194
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Search, { size: 13, opacity: 0.6 }),
|
|
1195
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1196
|
+
gui.Input,
|
|
1197
|
+
{
|
|
1198
|
+
flex: 1,
|
|
1199
|
+
size: "$2",
|
|
1200
|
+
borderWidth: 0,
|
|
1201
|
+
bg: "transparent",
|
|
1202
|
+
placeholder: "Find organization\u2026",
|
|
1203
|
+
value: query,
|
|
1204
|
+
onChangeText: setQuery,
|
|
1205
|
+
autoCapitalize: "none",
|
|
1206
|
+
autoCorrect: false
|
|
1207
|
+
}
|
|
1208
|
+
)
|
|
1209
|
+
] }) : null,
|
|
1210
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1211
|
+
"div",
|
|
1212
|
+
{
|
|
1213
|
+
style: { maxHeight: 300, overflowY: "auto", display: "flex", flexDirection: "column" },
|
|
1214
|
+
onScroll: (e) => {
|
|
1215
|
+
const el = e.currentTarget;
|
|
1216
|
+
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48) loadMore();
|
|
1217
|
+
},
|
|
1218
|
+
children: [
|
|
1219
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", px: "$2", py: "$3", children: [
|
|
1220
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Spinner, { size: "small", color: "$color11" }),
|
|
1221
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color10", children: "Loading organizations\u2026" })
|
|
1222
|
+
] }) : visible.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { px: "$2", py: "$2", fontSize: "$2", color: "$color10", children: query.trim() ? `No organizations match \u201C${query.trim()}\u201D.` : "No organizations yet." }) : visible.map((org) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1223
|
+
gui.XStack,
|
|
1224
|
+
{
|
|
1225
|
+
onPress: () => select(org.name),
|
|
1226
|
+
cursor: "pointer",
|
|
1227
|
+
items: "center",
|
|
1228
|
+
gap: "$2.5",
|
|
1229
|
+
px: "$2",
|
|
1230
|
+
py: "$2",
|
|
1231
|
+
rounded: "$3",
|
|
1232
|
+
bg: org.name === currentId ? "$color4" : "transparent",
|
|
1233
|
+
hoverStyle: { bg: "$color5" },
|
|
1234
|
+
children: [
|
|
1235
|
+
/* @__PURE__ */ jsxRuntime.jsx(OrgMark, { org }),
|
|
1236
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { flex: 1, fontSize: "$2", color: "$color12", numberOfLines: 1, children: org.displayName || org.name }),
|
|
1237
|
+
org.name === currentId ? /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Check, { size: 15 }) : null
|
|
1238
|
+
]
|
|
1239
|
+
},
|
|
1240
|
+
org.name
|
|
1241
|
+
)),
|
|
1242
|
+
loadingMore ? /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", px: "$2", py: "$2", children: [
|
|
1243
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Spinner, { size: "small", color: "$color11" }),
|
|
1244
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", color: "$color10", children: "Loading more\u2026" })
|
|
1245
|
+
] }) : hasMore ? /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { onPress: loadMore, cursor: "pointer", items: "center", justify: "center", px: "$2", py: "$1.5", rounded: "$3", hoverStyle: { bg: "$color4" }, children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", color: "$color11", fontWeight: "600", children: "Load more" }) }) : null
|
|
1246
|
+
]
|
|
1247
|
+
}
|
|
1248
|
+
),
|
|
1249
|
+
create ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1250
|
+
gui.XStack,
|
|
1251
|
+
{
|
|
1252
|
+
onPress: () => {
|
|
1253
|
+
setCreating(true);
|
|
1254
|
+
setErr(null);
|
|
1255
|
+
},
|
|
1256
|
+
cursor: "pointer",
|
|
1257
|
+
items: "center",
|
|
1258
|
+
gap: "$2.5",
|
|
1259
|
+
px: "$2",
|
|
1260
|
+
py: "$2",
|
|
1261
|
+
mt: "$1",
|
|
1262
|
+
rounded: "$3",
|
|
1263
|
+
borderTopWidth: 1,
|
|
1264
|
+
borderColor: "$borderColor",
|
|
1265
|
+
hoverStyle: { bg: "$color5" },
|
|
1266
|
+
children: [
|
|
1267
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { width: 22, height: 22, rounded: "$3", bg: "$color3", items: "center", justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Plus, { size: 14 }) }),
|
|
1268
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color12", children: "Create organization" })
|
|
1269
|
+
]
|
|
1270
|
+
}
|
|
1271
|
+
) : null,
|
|
1272
|
+
picker ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1273
|
+
gui.XStack,
|
|
1274
|
+
{
|
|
1275
|
+
onPress: () => {
|
|
1276
|
+
setOpen(false);
|
|
1277
|
+
scope.leaveOrg();
|
|
1278
|
+
},
|
|
1279
|
+
cursor: "pointer",
|
|
1280
|
+
items: "center",
|
|
1281
|
+
gap: "$2.5",
|
|
1282
|
+
px: "$2",
|
|
1283
|
+
py: "$2",
|
|
1284
|
+
rounded: "$3",
|
|
1285
|
+
hoverStyle: { bg: "$color5" },
|
|
1286
|
+
children: [
|
|
1287
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { width: 22, height: 22, rounded: "$3", bg: "$color3", items: "center", justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.LayoutGrid, { size: 14 }) }),
|
|
1288
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color12", children: "All organizations" })
|
|
1289
|
+
]
|
|
1290
|
+
}
|
|
1291
|
+
) : null
|
|
1292
|
+
] }) })
|
|
1293
|
+
] });
|
|
1294
|
+
}
|
|
1295
|
+
function DropdownMenu({
|
|
1296
|
+
trigger,
|
|
1297
|
+
items,
|
|
1298
|
+
open,
|
|
1299
|
+
defaultOpen = false,
|
|
1300
|
+
onOpenChange,
|
|
1301
|
+
minWidth = 200,
|
|
1302
|
+
maxHeight
|
|
1303
|
+
}) {
|
|
1304
|
+
const [isOpen, setOpen] = gui.useControllableState({
|
|
1305
|
+
prop: open,
|
|
1306
|
+
defaultProp: defaultOpen,
|
|
1307
|
+
onChange: onOpenChange
|
|
1308
|
+
});
|
|
1309
|
+
const anchorRef = react.useRef(null);
|
|
1310
|
+
const anchorRect = react.useCallback(() => anchorRef.current?.getBoundingClientRect() ?? null, []);
|
|
1311
|
+
const anchorEl = react.useCallback(() => anchorRef.current, []);
|
|
1312
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1313
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { ref: anchorRef, self: "flex-start", cursor: "pointer", onPress: () => setOpen(!isOpen), children: trigger }),
|
|
1314
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1315
|
+
FloatingMenu,
|
|
1316
|
+
{
|
|
1317
|
+
open: isOpen,
|
|
1318
|
+
onClose: () => setOpen(false),
|
|
1319
|
+
anchorRect,
|
|
1320
|
+
anchorEl,
|
|
1321
|
+
minWidth,
|
|
1322
|
+
maxHeight,
|
|
1323
|
+
children: renderMenuItems(items, () => setOpen(false))
|
|
1324
|
+
}
|
|
1325
|
+
)
|
|
1326
|
+
] });
|
|
1327
|
+
}
|
|
1328
|
+
function ContextMenu({ children, items, disabled, minWidth = 200, maxHeight }) {
|
|
1329
|
+
const [state, setState] = react.useState({ open: false, x: 0, y: 0 });
|
|
1330
|
+
const close = react.useCallback(() => setState((s) => s.open ? { ...s, open: false } : s), []);
|
|
1331
|
+
const anchorRect = react.useCallback(
|
|
1332
|
+
() => ({ left: state.x, top: state.y, right: state.x, bottom: state.y, width: 0, height: 0 }),
|
|
1333
|
+
[state.x, state.y]
|
|
1334
|
+
);
|
|
1335
|
+
const childOnContextMenu = children.props.onContextMenu;
|
|
1336
|
+
const target = react.cloneElement(children, {
|
|
1337
|
+
onContextMenu: (e) => {
|
|
1338
|
+
childOnContextMenu?.(e);
|
|
1339
|
+
if (disabled) return;
|
|
1340
|
+
e.preventDefault();
|
|
1341
|
+
e.stopPropagation();
|
|
1342
|
+
setState({ open: true, x: e.clientX, y: e.clientY });
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1346
|
+
target,
|
|
1347
|
+
/* @__PURE__ */ jsxRuntime.jsx(FloatingMenu, { open: state.open, onClose: close, anchorRect, gap: 0, minWidth, maxHeight, children: renderMenuItems(items, close) })
|
|
1348
|
+
] });
|
|
1349
|
+
}
|
|
1350
|
+
var isExternal = (href) => /^https?:\/\//.test(href);
|
|
1351
|
+
var defaultLink = ({ href, children, onNavigate }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1352
|
+
"a",
|
|
1353
|
+
{
|
|
1354
|
+
href,
|
|
1355
|
+
onClick: onNavigate,
|
|
1356
|
+
...isExternal(href) ? { target: "_blank", rel: "noopener noreferrer" } : null,
|
|
1357
|
+
style: { textDecoration: "none", color: "inherit", display: "block" },
|
|
1358
|
+
children
|
|
1359
|
+
}
|
|
1360
|
+
);
|
|
1361
|
+
function ProductCell({ product, link, icon, close }) {
|
|
1362
|
+
const glyph = icon?.(product.id);
|
|
1363
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { minW: 200, flex: 1, flexBasis: 200, children: link({
|
|
1364
|
+
href: product.url,
|
|
1365
|
+
onNavigate: close,
|
|
1366
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2.5", items: "flex-start", p: "$2.5", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: "$color4" }, children: [
|
|
1367
|
+
glyph ? /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { pt: "$0.5", children: glyph }) : null,
|
|
1368
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { minW: 0, gap: "$0.5", children: [
|
|
1369
|
+
product.verb ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 11, color: "$color10", textTransform: "uppercase", letterSpacing: 0.4, children: product.verb }) : null,
|
|
1370
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color12", children: product.name }),
|
|
1371
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, color: "$color10", lineHeight: 16, children: product.job })
|
|
1372
|
+
] })
|
|
1373
|
+
] })
|
|
1374
|
+
}) });
|
|
1375
|
+
}
|
|
1376
|
+
function Column({ title, links, link, icon, close }) {
|
|
1377
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { minW: 160, flex: 1, gap: "$1", children: [
|
|
1378
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 11, color: "$color10", textTransform: "uppercase", letterSpacing: 0.5, px: "$2", pb: "$1", children: title }),
|
|
1379
|
+
links.map((l) => /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { px: "$2", py: "$1", rounded: "$3", hoverStyle: { bg: "$color4" }, gap: "$2", items: "center", children: [
|
|
1380
|
+
icon?.(l.id) ?? null,
|
|
1381
|
+
link({
|
|
1382
|
+
href: l.href,
|
|
1383
|
+
onNavigate: close,
|
|
1384
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color11", children: l.label })
|
|
1385
|
+
})
|
|
1386
|
+
] }, l.id))
|
|
1387
|
+
] });
|
|
1388
|
+
}
|
|
1389
|
+
function Launcher({ menu, link, icon, close }) {
|
|
1390
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1391
|
+
gui.YStack,
|
|
1392
|
+
{
|
|
1393
|
+
position: "absolute",
|
|
1394
|
+
t: 52,
|
|
1395
|
+
l: 0,
|
|
1396
|
+
r: 0,
|
|
1397
|
+
z: 50,
|
|
1398
|
+
bg: "$background",
|
|
1399
|
+
borderBottomWidth: 1,
|
|
1400
|
+
borderColor: "$borderColor",
|
|
1401
|
+
px: "$4",
|
|
1402
|
+
py: "$4",
|
|
1403
|
+
gap: "$3",
|
|
1404
|
+
maxH: "80vh",
|
|
1405
|
+
overflow: "scroll",
|
|
1406
|
+
children: [
|
|
1407
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$3", flexWrap: "wrap", children: [
|
|
1408
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color11", children: menu.eyebrow }),
|
|
1409
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { ml: "auto", children: link({
|
|
1410
|
+
href: menu.allProducts.href,
|
|
1411
|
+
onNavigate: close,
|
|
1412
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: "$2", color: "$color12", children: [
|
|
1413
|
+
menu.allProducts.label,
|
|
1414
|
+
" \u2192"
|
|
1415
|
+
] })
|
|
1416
|
+
}) })
|
|
1417
|
+
] }),
|
|
1418
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { gap: "$2.5", flexWrap: "wrap", children: menu.products.map((p) => /* @__PURE__ */ jsxRuntime.jsx(ProductCell, { product: p, link, icon, close }, p.id)) }),
|
|
1419
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Separator, {}),
|
|
1420
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$4", flexWrap: "wrap", items: "flex-start", children: [
|
|
1421
|
+
/* @__PURE__ */ jsxRuntime.jsx(Column, { title: "Platform", links: menu.utilities, link, icon, close }),
|
|
1422
|
+
/* @__PURE__ */ jsxRuntime.jsx(Column, { title: "Install", links: menu.installs, link, icon, close })
|
|
1423
|
+
] })
|
|
1424
|
+
]
|
|
1425
|
+
}
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1428
|
+
function Cta({ action, link }) {
|
|
1429
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { bg: "$color12", px: "$3", py: "$1.5", rounded: "$3", hoverStyle: { opacity: 0.9 }, children: link({
|
|
1430
|
+
href: action.href,
|
|
1431
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$background", children: action.label })
|
|
1432
|
+
}) });
|
|
1433
|
+
}
|
|
1434
|
+
function MobilePanel({ header, menu, link, icon, close }) {
|
|
1435
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1436
|
+
gui.YStack,
|
|
1437
|
+
{
|
|
1438
|
+
position: "absolute",
|
|
1439
|
+
t: 52,
|
|
1440
|
+
l: 0,
|
|
1441
|
+
r: 0,
|
|
1442
|
+
z: 50,
|
|
1443
|
+
bg: "$background",
|
|
1444
|
+
borderBottomWidth: 1,
|
|
1445
|
+
borderColor: "$borderColor",
|
|
1446
|
+
px: "$3",
|
|
1447
|
+
py: "$3",
|
|
1448
|
+
gap: "$3",
|
|
1449
|
+
maxH: "80vh",
|
|
1450
|
+
overflow: "scroll",
|
|
1451
|
+
children: [
|
|
1452
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: "$1", children: header.localNav.map((l) => /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { px: "$2", py: "$1.5", rounded: "$3", hoverStyle: { bg: "$color4" }, children: link({
|
|
1453
|
+
href: l.href,
|
|
1454
|
+
onNavigate: close,
|
|
1455
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color12", children: l.label })
|
|
1456
|
+
}) }, l.id)) }),
|
|
1457
|
+
menu ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1458
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Separator, {}),
|
|
1459
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: "$1", children: menu.products.map((p) => /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { px: "$2", py: "$1.5", rounded: "$3", hoverStyle: { bg: "$color4" }, gap: "$2", items: "center", children: [
|
|
1460
|
+
icon?.(p.id) ?? null,
|
|
1461
|
+
link({
|
|
1462
|
+
href: p.url,
|
|
1463
|
+
onNavigate: close,
|
|
1464
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color12", children: p.name })
|
|
1465
|
+
})
|
|
1466
|
+
] }, p.id)) }),
|
|
1467
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Separator, {}),
|
|
1468
|
+
/* @__PURE__ */ jsxRuntime.jsx(Column, { title: "Platform", links: menu.utilities, link, icon, close }),
|
|
1469
|
+
/* @__PURE__ */ jsxRuntime.jsx(Column, { title: "Install", links: menu.installs, link, icon, close })
|
|
1470
|
+
] }) : null
|
|
1471
|
+
]
|
|
1472
|
+
}
|
|
1473
|
+
);
|
|
1474
|
+
}
|
|
1475
|
+
function SiteNav({ header, menu, brand, actions, link = defaultLink, icon, active, meetLabel = "Meet Hanzo" }) {
|
|
1476
|
+
const [launcher, setLauncher] = react.useState(false);
|
|
1477
|
+
const [mobile, setMobile] = react.useState(false);
|
|
1478
|
+
const root = react.useRef(null);
|
|
1479
|
+
react.useEffect(() => {
|
|
1480
|
+
if (!launcher && !mobile) return;
|
|
1481
|
+
const dismiss = () => {
|
|
1482
|
+
setLauncher(false);
|
|
1483
|
+
setMobile(false);
|
|
1484
|
+
};
|
|
1485
|
+
const onKey = (e) => {
|
|
1486
|
+
if (e.key === "Escape") dismiss();
|
|
1487
|
+
};
|
|
1488
|
+
const onDown = (e) => {
|
|
1489
|
+
if (root.current && !root.current.contains(e.target)) dismiss();
|
|
1490
|
+
};
|
|
1491
|
+
document.addEventListener("keydown", onKey);
|
|
1492
|
+
document.addEventListener("mousedown", onDown);
|
|
1493
|
+
return () => {
|
|
1494
|
+
document.removeEventListener("keydown", onKey);
|
|
1495
|
+
document.removeEventListener("mousedown", onDown);
|
|
1496
|
+
};
|
|
1497
|
+
}, [launcher, mobile]);
|
|
1498
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { ref: root, position: "relative", bg: "$background", children: [
|
|
1499
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$1", px: "$3", height: 52, borderBottomWidth: 1, borderColor: "$borderColor", children: [
|
|
1500
|
+
brand ? /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { items: "center", pr: "$2", children: brand }) : null,
|
|
1501
|
+
menu ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1502
|
+
gui.XStack,
|
|
1503
|
+
{
|
|
1504
|
+
cursor: "pointer",
|
|
1505
|
+
px: "$2.5",
|
|
1506
|
+
py: "$1.5",
|
|
1507
|
+
rounded: "$3",
|
|
1508
|
+
bg: launcher ? "$color4" : "transparent",
|
|
1509
|
+
hoverStyle: { bg: "$color4" },
|
|
1510
|
+
onPress: () => setLauncher(!launcher),
|
|
1511
|
+
accessibilityRole: "button",
|
|
1512
|
+
"aria-expanded": launcher,
|
|
1513
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color12", children: meetLabel })
|
|
1514
|
+
}
|
|
1515
|
+
) : null,
|
|
1516
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { items: "center", gap: "$0.5", flex: 1, minW: 0, $sm: { display: "none" }, children: header.localNav.map((l) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1517
|
+
gui.XStack,
|
|
1518
|
+
{
|
|
1519
|
+
px: "$2.5",
|
|
1520
|
+
py: "$1.5",
|
|
1521
|
+
rounded: "$3",
|
|
1522
|
+
hoverStyle: { bg: "$color4" },
|
|
1523
|
+
onMouseEnter: () => launcher && setLauncher(false),
|
|
1524
|
+
children: link({
|
|
1525
|
+
href: l.href,
|
|
1526
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: active === l.id ? "$color12" : "$color11", children: l.label })
|
|
1527
|
+
})
|
|
1528
|
+
},
|
|
1529
|
+
l.id
|
|
1530
|
+
)) }),
|
|
1531
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", ml: "auto", children: [
|
|
1532
|
+
actions,
|
|
1533
|
+
/* @__PURE__ */ jsxRuntime.jsx(Cta, { action: header.action, link }),
|
|
1534
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1535
|
+
gui.XStack,
|
|
1536
|
+
{
|
|
1537
|
+
display: "none",
|
|
1538
|
+
$sm: { display: "flex" },
|
|
1539
|
+
cursor: "pointer",
|
|
1540
|
+
px: "$2",
|
|
1541
|
+
py: "$1.5",
|
|
1542
|
+
rounded: "$3",
|
|
1543
|
+
hoverStyle: { bg: "$color4" },
|
|
1544
|
+
onPress: () => setMobile(!mobile),
|
|
1545
|
+
accessibilityRole: "button",
|
|
1546
|
+
"aria-label": mobile ? "Close menu" : "Open menu",
|
|
1547
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color12", children: mobile ? "Close" : "Menu" })
|
|
1548
|
+
}
|
|
1549
|
+
)
|
|
1550
|
+
] })
|
|
1551
|
+
] }),
|
|
1552
|
+
launcher && menu ? /* @__PURE__ */ jsxRuntime.jsx(Launcher, { menu, link, icon, close: () => setLauncher(false) }) : null,
|
|
1553
|
+
mobile ? /* @__PURE__ */ jsxRuntime.jsx(MobilePanel, { header, menu, link, icon, close: () => setMobile(false) }) : null
|
|
1554
|
+
] });
|
|
1555
|
+
}
|
|
1556
|
+
var isExternal2 = (href) => /^https?:\/\//.test(href);
|
|
1557
|
+
var defaultLink2 = ({ href, children }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1558
|
+
"a",
|
|
1559
|
+
{
|
|
1560
|
+
href,
|
|
1561
|
+
...isExternal2(href) ? { target: "_blank", rel: "noopener noreferrer" } : null,
|
|
1562
|
+
style: { textDecoration: "none", color: "inherit" },
|
|
1563
|
+
children
|
|
1564
|
+
}
|
|
1565
|
+
);
|
|
1566
|
+
function SiteFooter({ footer, brand, tagline, meta, link = defaultLink2 }) {
|
|
1567
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { borderTopWidth: 1, borderColor: "$borderColor", bg: "$background", px: "$4", py: "$5", gap: "$4", children: [
|
|
1568
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$5", flexWrap: "wrap", items: "flex-start", children: [
|
|
1569
|
+
brand || tagline ? /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$2", minW: 200, flex: 1, children: [
|
|
1570
|
+
brand,
|
|
1571
|
+
tagline ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, color: "$color10", lineHeight: 18, maxW: 280, children: tagline }) : null
|
|
1572
|
+
] }) : null,
|
|
1573
|
+
footer.columns.map((column) => /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$1.5", minW: 140, children: [
|
|
1574
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 11, color: "$color10", textTransform: "uppercase", letterSpacing: 0.5, pb: "$1", children: column.title }),
|
|
1575
|
+
column.links.map((l) => /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { hoverStyle: { opacity: 0.7 }, children: link({
|
|
1576
|
+
href: l.href,
|
|
1577
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color11", children: l.label })
|
|
1578
|
+
}) }, l.id))
|
|
1579
|
+
] }, column.id))
|
|
1580
|
+
] }),
|
|
1581
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Separator, {}),
|
|
1582
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$3", flexWrap: "wrap", children: [
|
|
1583
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, color: "$color10", children: footer.legal.copyright }),
|
|
1584
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { items: "center", gap: "$3", flexWrap: "wrap", children: footer.legal.links.map((l) => /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { hoverStyle: { opacity: 0.7 }, children: link({
|
|
1585
|
+
href: l.href,
|
|
1586
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: 12, color: "$color10", children: l.label })
|
|
1587
|
+
}) }, l.id)) }),
|
|
1588
|
+
meta ? /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { ml: "auto", items: "center", gap: "$3", children: meta }) : null
|
|
1589
|
+
] })
|
|
1590
|
+
] });
|
|
1591
|
+
}
|
|
1592
|
+
var HostCtx = react.createContext({});
|
|
1593
|
+
var HostProvider = ({ actions, children }) => /* @__PURE__ */ jsxRuntime.jsx(HostCtx.Provider, { value: actions, children });
|
|
1594
|
+
var useHost = () => react.useContext(HostCtx);
|
|
1595
|
+
function classifyBackend(e) {
|
|
1596
|
+
const status = typeof e?.status === "number" ? e.status : 0;
|
|
1597
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
1598
|
+
if (status === 503) return { kind: "not-initialized", message };
|
|
1599
|
+
if (status === 404 || status === 405) return { kind: "unavailable", message };
|
|
1600
|
+
if (status === 501) return { kind: "not-implemented", message };
|
|
1601
|
+
if (status === 402) return { kind: "billing", message };
|
|
1602
|
+
if (status === 401) return { kind: "signin", message };
|
|
1603
|
+
if (status === 403) return { kind: "access", message };
|
|
1604
|
+
return { kind: "error", message };
|
|
1605
|
+
}
|
|
1606
|
+
function classifyRead(e) {
|
|
1607
|
+
const s = classifyBackend(e);
|
|
1608
|
+
return s.kind === "billing" ? null : s;
|
|
1609
|
+
}
|
|
1610
|
+
var TITLES = {
|
|
1611
|
+
"not-initialized": "Backend not initialized",
|
|
1612
|
+
unavailable: "Not available on this deployment yet",
|
|
1613
|
+
"not-implemented": "Not yet available",
|
|
1614
|
+
access: "Not enabled for your account",
|
|
1615
|
+
signin: "Your session expired",
|
|
1616
|
+
billing: "Add credits to continue",
|
|
1617
|
+
error: "Could not reach the backend"
|
|
1618
|
+
};
|
|
1619
|
+
var BODIES = {
|
|
1620
|
+
"not-initialized": "The /v1 route is mounted but its runtime (or the console API key it proxies to) is not configured on this deployment yet. Real data appears here once it is \u2014 no placeholder data is shown.",
|
|
1621
|
+
unavailable: "This endpoint is not mounted at the gateway on this host yet. The view lights up automatically once the route is live.",
|
|
1622
|
+
// 501 — a real, planned capability whose body ships in a later phase.
|
|
1623
|
+
"not-implemented": "This capability is planned but not wired yet. The backend answers honestly rather than pretending it worked \u2014 nothing here is fabricated, and the view lights up automatically once it ships.",
|
|
1624
|
+
// 403 for a SIGNED-IN user — never "sign in".
|
|
1625
|
+
access: "You're signed in, but this isn't enabled for your organization on this deployment, or it's an admin-only surface. It appears here automatically once your account has access \u2014 nothing is fabricated.",
|
|
1626
|
+
// 401 — the session itself lapsed; re-auth returns to this exact page.
|
|
1627
|
+
signin: "Your session has expired or isn\u2019t recognized here. Sign in again to continue where you left off.",
|
|
1628
|
+
// Empty → the card shows the backend's own message (the honest "Insufficient
|
|
1629
|
+
// balance. Please add credits…" from the gateway billing gate).
|
|
1630
|
+
billing: "",
|
|
1631
|
+
error: ""
|
|
1632
|
+
};
|
|
1633
|
+
function BackendStateCard({
|
|
1634
|
+
state,
|
|
1635
|
+
onRetry,
|
|
1636
|
+
hint
|
|
1637
|
+
}) {
|
|
1638
|
+
const { signIn, addCredits } = useHost();
|
|
1639
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.Card, { borderWidth: 1, borderColor: "$borderColor", p: "$4", gap: "$2", maxWidth: 640, children: [
|
|
1640
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2", items: "center", children: [
|
|
1641
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.TriangleAlert, { size: 16 }),
|
|
1642
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$4", fontWeight: "700", children: TITLES[state.kind] })
|
|
1643
|
+
] }),
|
|
1644
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color11", children: BODIES[state.kind] || state.message }),
|
|
1645
|
+
hint ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color10", children: hint }) : null,
|
|
1646
|
+
state.kind === "signin" && signIn ? /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$2", theme: "light", self: "flex-start", onPress: signIn, children: "Sign in again" }) : state.kind === "billing" && addCredits ? (
|
|
1647
|
+
// 402 — the org has no funded balance. Offer a top-up CTA (and keep Retry so
|
|
1648
|
+
// a returning, funded caller can reload in place).
|
|
1649
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2", items: "center", flexWrap: "wrap", children: [
|
|
1650
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$2", theme: "light", self: "flex-start", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.CreditCard, { size: 14 }), onPress: addCredits, children: "Add credits" }),
|
|
1651
|
+
onRetry ? /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$2", self: "flex-start", onPress: onRetry, children: "Retry" }) : null
|
|
1652
|
+
] })
|
|
1653
|
+
) : onRetry ? /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$2", self: "flex-start", onPress: onRetry, children: "Retry" }) : null
|
|
1654
|
+
] });
|
|
1655
|
+
}
|
|
1656
|
+
function PageHeader({
|
|
1657
|
+
title,
|
|
1658
|
+
subtitle,
|
|
1659
|
+
actions
|
|
1660
|
+
}) {
|
|
1661
|
+
return (
|
|
1662
|
+
// flexWrap lets the actions drop below the title on narrow screens; flex={1}
|
|
1663
|
+
// minW={0} lets the title column shrink so a long subtitle WRAPS instead of
|
|
1664
|
+
// running off the viewport (a flex child defaults to min-width:auto = content
|
|
1665
|
+
// width, which would overflow on mobile).
|
|
1666
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { justify: "space-between", items: "flex-start", gap: "$3", flexWrap: "wrap", children: [
|
|
1667
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$1", flex: 1, minW: 200, children: [
|
|
1668
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$7", fontWeight: "500", letterSpacing: -0.4, children: title }),
|
|
1669
|
+
subtitle ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color11", children: subtitle }) : null
|
|
1670
|
+
] }),
|
|
1671
|
+
actions ? /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { gap: "$2", items: "center", flexWrap: "wrap", width: "100%", $md: { width: "auto", justify: "flex-end" }, children: actions }) : null
|
|
1672
|
+
] })
|
|
1673
|
+
);
|
|
1674
|
+
}
|
|
1675
|
+
function SkeletonRows({ columns, count = 6 }) {
|
|
1676
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { children: Array.from({ length: count }).map((_, r) => /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { py: "$2.5", px: "$3", gap: "$3", borderTopWidth: 1, borderColor: "$borderColor", items: "center", children: columns.map((c, i) => /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { width: c.width, flex: c.width ? void 0 : 1, minW: c.width ? void 0 : FLEX_MIN_COL_W, items: c.align === "right" ? "flex-end" : "flex-start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1677
|
+
"div",
|
|
1678
|
+
{
|
|
1679
|
+
className: "hz-skeleton",
|
|
1680
|
+
style: { height: 12, borderRadius: 6, width: `${[62, 40, 54, 34, 48][(i + r) % 5]}%` },
|
|
1681
|
+
"aria-hidden": true
|
|
1682
|
+
}
|
|
1683
|
+
) }, c.key)) }, r)) });
|
|
1684
|
+
}
|
|
1685
|
+
function DataTable({
|
|
1686
|
+
columns,
|
|
1687
|
+
rows: rows2,
|
|
1688
|
+
loading,
|
|
1689
|
+
empty = "Nothing here yet.",
|
|
1690
|
+
rowKey,
|
|
1691
|
+
onRowPress,
|
|
1692
|
+
isRowExpanded,
|
|
1693
|
+
renderExpanded,
|
|
1694
|
+
sort,
|
|
1695
|
+
onSortChange
|
|
1696
|
+
}) {
|
|
1697
|
+
const minTableW = columns.reduce((sum, c) => sum + (c.width ?? FLEX_MIN_COL_W), 0) + (columns.length + 1) * 12;
|
|
1698
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", overflow: "hidden", children: [
|
|
1699
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { style: { overflowX: "auto", overflowY: "visible" }, children: /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { minW: minTableW, children: [
|
|
1700
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { bg: "$color1", py: "$2.5", px: "$3", gap: "$3", borderBottomWidth: 1, borderColor: "$borderColor", role: "row", children: columns.map((c) => {
|
|
1701
|
+
const sortable = c.sortable === true && !!onSortChange;
|
|
1702
|
+
const active = sortable && sort?.key === c.key;
|
|
1703
|
+
const Caret = !sortable ? null : !active ? lucideIcons2.ChevronsUpDown : sort?.dir === "asc" ? lucideIcons2.ChevronUp : lucideIcons2.ChevronDown;
|
|
1704
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1705
|
+
gui.XStack,
|
|
1706
|
+
{
|
|
1707
|
+
width: c.width,
|
|
1708
|
+
flex: c.width ? void 0 : 1,
|
|
1709
|
+
minW: c.width ? void 0 : FLEX_MIN_COL_W,
|
|
1710
|
+
items: "center",
|
|
1711
|
+
gap: "$1",
|
|
1712
|
+
justify: c.align === "right" ? "flex-end" : "flex-start",
|
|
1713
|
+
role: "columnheader",
|
|
1714
|
+
"aria-sort": sortable ? active ? sort?.dir === "asc" ? "ascending" : "descending" : "none" : void 0,
|
|
1715
|
+
"aria-label": sortable ? `Sort by ${c.header}` : void 0,
|
|
1716
|
+
cursor: sortable ? "pointer" : void 0,
|
|
1717
|
+
hoverStyle: sortable ? { opacity: 0.75 } : void 0,
|
|
1718
|
+
onPress: sortable ? () => onSortChange?.(c.key) : void 0,
|
|
1719
|
+
children: [
|
|
1720
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1721
|
+
gui.Text,
|
|
1722
|
+
{
|
|
1723
|
+
fontSize: "$1",
|
|
1724
|
+
fontWeight: "500",
|
|
1725
|
+
color: active ? "$color12" : "$color10",
|
|
1726
|
+
text: c.align === "right" ? "right" : "left",
|
|
1727
|
+
className: c.mono ? "hz-tnum" : void 0,
|
|
1728
|
+
children: c.header
|
|
1729
|
+
}
|
|
1730
|
+
),
|
|
1731
|
+
Caret ? /* @__PURE__ */ jsxRuntime.jsx(Caret, { size: 12, color: active ? "$color12" : "$color9" }) : null
|
|
1732
|
+
]
|
|
1733
|
+
},
|
|
1734
|
+
c.key
|
|
1735
|
+
);
|
|
1736
|
+
}) }),
|
|
1737
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx(SkeletonRows, { columns }) : rows2.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { children: rows2.map((row) => {
|
|
1738
|
+
const expanded = (isRowExpanded?.(row) ?? false) && !!renderExpanded;
|
|
1739
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { children: [
|
|
1740
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1741
|
+
gui.XStack,
|
|
1742
|
+
{
|
|
1743
|
+
className: "hz-row",
|
|
1744
|
+
py: "$2.5",
|
|
1745
|
+
px: "$3",
|
|
1746
|
+
gap: "$3",
|
|
1747
|
+
borderTopWidth: 1,
|
|
1748
|
+
borderColor: "$borderColor",
|
|
1749
|
+
items: "center",
|
|
1750
|
+
bg: expanded ? "$color2" : void 0,
|
|
1751
|
+
hoverStyle: onRowPress ? { bg: "$color2" } : void 0,
|
|
1752
|
+
cursor: onRowPress ? "pointer" : void 0,
|
|
1753
|
+
onPress: onRowPress ? () => onRowPress(row) : void 0,
|
|
1754
|
+
children: columns.map((c) => {
|
|
1755
|
+
const cell = c.render ? c.render(row) : String(row[c.key] ?? "");
|
|
1756
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1757
|
+
gui.YStack,
|
|
1758
|
+
{
|
|
1759
|
+
width: c.width,
|
|
1760
|
+
flex: c.width ? void 0 : 1,
|
|
1761
|
+
minW: c.width ? void 0 : FLEX_MIN_COL_W,
|
|
1762
|
+
justify: "center",
|
|
1763
|
+
items: c.align === "right" ? "flex-end" : "flex-start",
|
|
1764
|
+
children: typeof cell === "string" || typeof cell === "number" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1765
|
+
gui.Text,
|
|
1766
|
+
{
|
|
1767
|
+
fontSize: "$3",
|
|
1768
|
+
numberOfLines: 1,
|
|
1769
|
+
color: "$color12",
|
|
1770
|
+
text: c.align === "right" ? "right" : "left",
|
|
1771
|
+
className: c.mono ? "hz-mono" : void 0,
|
|
1772
|
+
children: cell
|
|
1773
|
+
}
|
|
1774
|
+
) : cell
|
|
1775
|
+
},
|
|
1776
|
+
c.key
|
|
1777
|
+
);
|
|
1778
|
+
})
|
|
1779
|
+
}
|
|
1780
|
+
),
|
|
1781
|
+
expanded && renderExpanded ? /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { borderTopWidth: 1, borderColor: "$borderColor", bg: "$color1", children: renderExpanded(row) }) : null
|
|
1782
|
+
] }, rowKey(row));
|
|
1783
|
+
}) }) : null
|
|
1784
|
+
] }) }),
|
|
1785
|
+
!loading && rows2.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { py: "$8", px: "$4", items: "center", gap: "$1", borderTopWidth: 1, borderColor: "$borderColor", children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { color: "$color10", fontSize: "$3", text: "center", children: empty }) }) : null
|
|
1786
|
+
] });
|
|
1787
|
+
}
|
|
1788
|
+
var FLEX_MIN_COL_W = 120;
|
|
1789
|
+
function CommerceResource({
|
|
1790
|
+
title,
|
|
1791
|
+
subtitle,
|
|
1792
|
+
load,
|
|
1793
|
+
columns,
|
|
1794
|
+
rowKey,
|
|
1795
|
+
empty,
|
|
1796
|
+
hint,
|
|
1797
|
+
actions
|
|
1798
|
+
}) {
|
|
1799
|
+
const [state, setState] = react.useState({ phase: "loading" });
|
|
1800
|
+
const loadRef = react.useRef(load);
|
|
1801
|
+
loadRef.current = load;
|
|
1802
|
+
const reload = react.useCallback(() => {
|
|
1803
|
+
setState({ phase: "loading" });
|
|
1804
|
+
loadRef.current().then((r) => setState({ phase: "ready", data: r.rows })).catch((e) => setState({ phase: "error", error: classifyBackend(e) }));
|
|
1805
|
+
}, []);
|
|
1806
|
+
react.useEffect(() => {
|
|
1807
|
+
reload();
|
|
1808
|
+
}, [reload]);
|
|
1809
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1810
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1811
|
+
PageHeader,
|
|
1812
|
+
{
|
|
1813
|
+
title,
|
|
1814
|
+
subtitle,
|
|
1815
|
+
actions: /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2", children: [
|
|
1816
|
+
actions?.(reload),
|
|
1817
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$2", icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.RefreshCw, { size: 15 }), onPress: reload, children: "Refresh" })
|
|
1818
|
+
] })
|
|
1819
|
+
}
|
|
1820
|
+
),
|
|
1821
|
+
state.phase === "error" ? /* @__PURE__ */ jsxRuntime.jsx(BackendStateCard, { state: state.error, onRetry: reload, hint }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1822
|
+
DataTable,
|
|
1823
|
+
{
|
|
1824
|
+
columns,
|
|
1825
|
+
rows: state.phase === "ready" ? state.data : [],
|
|
1826
|
+
loading: state.phase === "loading",
|
|
1827
|
+
rowKey,
|
|
1828
|
+
empty
|
|
1829
|
+
}
|
|
1830
|
+
)
|
|
1831
|
+
] });
|
|
1832
|
+
}
|
|
1833
|
+
function ConfirmDelete({
|
|
1834
|
+
message,
|
|
1835
|
+
confirmLabel,
|
|
1836
|
+
run,
|
|
1837
|
+
onDone
|
|
1838
|
+
}) {
|
|
1839
|
+
const [busy, setBusy] = react.useState(false);
|
|
1840
|
+
const [err, setErr] = react.useState(null);
|
|
1841
|
+
const go = async () => {
|
|
1842
|
+
setBusy(true);
|
|
1843
|
+
setErr(null);
|
|
1844
|
+
try {
|
|
1845
|
+
await run();
|
|
1846
|
+
onDone();
|
|
1847
|
+
} catch (e) {
|
|
1848
|
+
setErr(classifyBackend(e).message || "Failed to delete.");
|
|
1849
|
+
setBusy(false);
|
|
1850
|
+
}
|
|
1851
|
+
};
|
|
1852
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$3", children: [
|
|
1853
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color11", children: message }),
|
|
1854
|
+
err ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$red10", children: err }) : null,
|
|
1855
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2", flexWrap: "wrap", children: [
|
|
1856
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1857
|
+
gui.Button,
|
|
1858
|
+
{
|
|
1859
|
+
onPress: go,
|
|
1860
|
+
disabled: busy,
|
|
1861
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Trash2, { size: 15 }),
|
|
1862
|
+
style: { backgroundColor: "#dc2626", borderColor: "#dc2626", color: "#fff" },
|
|
1863
|
+
children: busy ? "Deleting\u2026" : confirmLabel
|
|
1864
|
+
}
|
|
1865
|
+
),
|
|
1866
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Button, { chromeless: true, onPress: () => onDone(), disabled: busy, children: "Cancel" })
|
|
1867
|
+
] })
|
|
1868
|
+
] });
|
|
1869
|
+
}
|
|
1870
|
+
function Segmented({
|
|
1871
|
+
options,
|
|
1872
|
+
value,
|
|
1873
|
+
onChange,
|
|
1874
|
+
size = "$2"
|
|
1875
|
+
}) {
|
|
1876
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { gap: "$1", flexWrap: "wrap", items: "center", children: options.map((o) => {
|
|
1877
|
+
const active = o.value === value;
|
|
1878
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1879
|
+
gui.Button,
|
|
1880
|
+
{
|
|
1881
|
+
size,
|
|
1882
|
+
bg: active ? "$color5" : "transparent",
|
|
1883
|
+
borderWidth: 1,
|
|
1884
|
+
borderColor: active ? "$color7" : "$borderColor",
|
|
1885
|
+
"aria-pressed": active,
|
|
1886
|
+
onPress: () => onChange(o.value),
|
|
1887
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", fontWeight: active ? "700" : "500", color: active ? "$color12" : "$color11", children: o.label })
|
|
1888
|
+
},
|
|
1889
|
+
o.value
|
|
1890
|
+
);
|
|
1891
|
+
}) });
|
|
1892
|
+
}
|
|
1893
|
+
function SearchInput({ value, onChange, placeholder }) {
|
|
1894
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { flex: 1, minW: 180, items: "center", gap: "$2", px: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$color1", children: [
|
|
1895
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Search, { size: 15, color: "$color10" }),
|
|
1896
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Input, { flex: 1, value, onChangeText: onChange, placeholder, borderWidth: 0, bg: "transparent", px: "$0", fontSize: "$3" })
|
|
1897
|
+
] });
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
// src/product/brand.ts
|
|
1901
|
+
var HANZO_MARK_CONTENT = '<path d="M22.21 67V44.6369H0V67H22.21Z"/><path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z"/><path d="M22.21 0H0V22.3184H22.21V0Z"/><path d="M66.7198 0H44.5098V22.3184H66.7198V0Z"/><path d="M66.7198 67V44.6369H44.5098V67H66.7198Z"/>';
|
|
1902
|
+
var HANZO = {
|
|
1903
|
+
id: "hanzo",
|
|
1904
|
+
name: "Hanzo",
|
|
1905
|
+
viewBox: "0 0 67 67",
|
|
1906
|
+
content: HANZO_MARK_CONTENT,
|
|
1907
|
+
href: "https://hanzo.ai"
|
|
1908
|
+
};
|
|
1909
|
+
var LUX = {
|
|
1910
|
+
id: "lux",
|
|
1911
|
+
name: "Lux",
|
|
1912
|
+
viewBox: "0 0 100 100",
|
|
1913
|
+
content: '<path d="M50 85 L15 25 L85 25 Z"/>',
|
|
1914
|
+
href: "https://lux.network"
|
|
1915
|
+
};
|
|
1916
|
+
var ZOO = {
|
|
1917
|
+
id: "zoo",
|
|
1918
|
+
name: "Zoo",
|
|
1919
|
+
viewBox: "0 0 1024 1024",
|
|
1920
|
+
fullColor: true,
|
|
1921
|
+
content: '<defs><clipPath id="zooClip"><circle cx="512" cy="511" r="270"/></clipPath><clipPath id="zooGClip"><circle cx="513" cy="369" r="234"/></clipPath><clipPath id="zooRClip"><circle cx="365" cy="595" r="234"/></clipPath></defs><g clip-path="url(#zooClip)"><circle cx="513" cy="369" r="234" fill="#00A652"/><circle cx="365" cy="595" r="234" fill="#ED1C24"/><circle cx="643" cy="595" r="234" fill="#2E3192"/><g clip-path="url(#zooGClip)"><circle cx="365" cy="595" r="234" fill="#FCF006"/><circle cx="643" cy="595" r="234" fill="#01ACF1"/></g><g clip-path="url(#zooRClip)"><circle cx="643" cy="595" r="234" fill="#EA018E"/></g><g clip-path="url(#zooGClip)"><g clip-path="url(#zooRClip)"><circle cx="643" cy="595" r="234" fill="#FFFFFF"/></g></g></g>',
|
|
1922
|
+
href: "https://zoo.ngo"
|
|
1923
|
+
};
|
|
1924
|
+
var PARS = {
|
|
1925
|
+
id: "pars",
|
|
1926
|
+
name: "Pars",
|
|
1927
|
+
viewBox: "-120 -120 240 240",
|
|
1928
|
+
content: '<path d="M0,-100 L30,-60 L100,-40 L60,0 L100,40 L30,60 L0,100 L-30,60 L-100,40 L-60,0 L-100,-40 L-30,-60 Z" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="round"/><path d="M0,-70 L22,-42 L70,-28 L42,0 L70,28 L22,42 L0,70 L-22,42 L-70,28 L-42,0 L-70,-28 L-22,-42 Z" fill="currentColor" fill-opacity="0.15" stroke="currentColor" stroke-width="3" stroke-linejoin="round"/><circle r="55" fill="none" stroke="currentColor" stroke-width="1.5" opacity="0.4"/><circle r="35" fill="none" stroke="currentColor" stroke-width="1.5" opacity="0.4"/><circle r="8" fill="currentColor"/>',
|
|
1929
|
+
href: "https://pars.network"
|
|
1930
|
+
};
|
|
1931
|
+
var BRANDS = { hanzo: HANZO, lux: LUX, zoo: ZOO, pars: PARS };
|
|
1932
|
+
function resolveBrand(id) {
|
|
1933
|
+
return id && BRANDS[id] || HANZO;
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
// src/product/animatedLogo.logic.ts
|
|
1937
|
+
var HOUSE_EASE = "cubic-bezier(0.16, 1, 0.3, 1)";
|
|
1938
|
+
var DEFAULT_DURATION_MS = 360;
|
|
1939
|
+
var DEFAULT_INTRO_MS = 1500;
|
|
1940
|
+
var DEFAULT_GAP = 8;
|
|
1941
|
+
function wordmarkText(name, surface) {
|
|
1942
|
+
const s = surface?.trim();
|
|
1943
|
+
return s ? `${name} ${s}` : name;
|
|
1944
|
+
}
|
|
1945
|
+
function isExpanded(s) {
|
|
1946
|
+
return s.hovered || s.focused || s.introShowing;
|
|
1947
|
+
}
|
|
1948
|
+
function wordmarkStyle(i) {
|
|
1949
|
+
return {
|
|
1950
|
+
width: i.expanded ? i.naturalWidth ?? "auto" : 0,
|
|
1951
|
+
opacity: i.expanded ? 1 : 0,
|
|
1952
|
+
marginLeft: i.expanded ? i.gap : 0,
|
|
1953
|
+
transition: i.reduce ? "none" : `width ${i.durationMs}ms ${i.easing}, opacity ${i.durationMs}ms ${i.easing}, margin-left ${i.durationMs}ms ${i.easing}`
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
function usePrefersReducedMotion() {
|
|
1957
|
+
const [reduce, setReduce] = react.useState(false);
|
|
1958
|
+
react.useEffect(() => {
|
|
1959
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
1960
|
+
const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
1961
|
+
const sync = () => setReduce(mq.matches);
|
|
1962
|
+
sync();
|
|
1963
|
+
mq.addEventListener("change", sync);
|
|
1964
|
+
return () => mq.removeEventListener("change", sync);
|
|
1965
|
+
}, []);
|
|
1966
|
+
return reduce;
|
|
1967
|
+
}
|
|
1968
|
+
function AnimatedLogo({
|
|
1969
|
+
surface,
|
|
1970
|
+
brand = HANZO,
|
|
1971
|
+
size = 22,
|
|
1972
|
+
gap = DEFAULT_GAP,
|
|
1973
|
+
introMs = DEFAULT_INTRO_MS,
|
|
1974
|
+
durationMs = DEFAULT_DURATION_MS,
|
|
1975
|
+
easing = HOUSE_EASE,
|
|
1976
|
+
href,
|
|
1977
|
+
onClick,
|
|
1978
|
+
component,
|
|
1979
|
+
className,
|
|
1980
|
+
style,
|
|
1981
|
+
"aria-label": ariaLabel
|
|
1982
|
+
}) {
|
|
1983
|
+
const reduce = usePrefersReducedMotion();
|
|
1984
|
+
const label = ariaLabel ?? wordmarkText(brand.name, surface);
|
|
1985
|
+
const [hovered, setHovered] = react.useState(false);
|
|
1986
|
+
const [focused, setFocused] = react.useState(false);
|
|
1987
|
+
const [introShowing, setIntroShowing] = react.useState(introMs > 0);
|
|
1988
|
+
const [naturalWidth, setNaturalWidth] = react.useState(void 0);
|
|
1989
|
+
const wordRef = react.useRef(null);
|
|
1990
|
+
react.useEffect(() => {
|
|
1991
|
+
if (introMs <= 0) return;
|
|
1992
|
+
if (reduce) {
|
|
1993
|
+
setIntroShowing(false);
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
const t = setTimeout(() => setIntroShowing(false), introMs);
|
|
1997
|
+
return () => clearTimeout(t);
|
|
1998
|
+
}, [introMs, reduce]);
|
|
1999
|
+
react.useLayoutEffect(() => {
|
|
2000
|
+
const el = wordRef.current;
|
|
2001
|
+
if (!el) return;
|
|
2002
|
+
const measure = () => setNaturalWidth(el.scrollWidth);
|
|
2003
|
+
measure();
|
|
2004
|
+
const fonts = typeof document !== "undefined" && document.fonts || null;
|
|
2005
|
+
if (fonts?.ready) fonts.ready.then(measure).catch(() => {
|
|
2006
|
+
});
|
|
2007
|
+
}, [brand.name, surface]);
|
|
2008
|
+
const expanded = isExpanded({ hovered, focused, introShowing });
|
|
2009
|
+
const ws = wordmarkStyle({ expanded, naturalWidth, gap, durationMs, easing, reduce });
|
|
2010
|
+
const Root = component ?? "a";
|
|
2011
|
+
const isAnchor = Root === "a";
|
|
2012
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2013
|
+
Root,
|
|
2014
|
+
{
|
|
2015
|
+
...isAnchor ? { href: href ?? brand.href ?? "/" } : { href: href ?? brand.href },
|
|
2016
|
+
onClick,
|
|
2017
|
+
"aria-label": label,
|
|
2018
|
+
title: label,
|
|
2019
|
+
className,
|
|
2020
|
+
onMouseEnter: () => setHovered(true),
|
|
2021
|
+
onMouseLeave: () => setHovered(false),
|
|
2022
|
+
onFocus: () => setFocused(true),
|
|
2023
|
+
onBlur: () => setFocused(false),
|
|
2024
|
+
style: {
|
|
2025
|
+
display: "inline-flex",
|
|
2026
|
+
alignItems: "center",
|
|
2027
|
+
textDecoration: "none",
|
|
2028
|
+
color: "inherit",
|
|
2029
|
+
cursor: "pointer",
|
|
2030
|
+
...style
|
|
2031
|
+
},
|
|
2032
|
+
children: [
|
|
2033
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2034
|
+
"svg",
|
|
2035
|
+
{
|
|
2036
|
+
width: size,
|
|
2037
|
+
height: size,
|
|
2038
|
+
viewBox: brand.viewBox,
|
|
2039
|
+
"aria-hidden": "true",
|
|
2040
|
+
focusable: "false",
|
|
2041
|
+
fill: brand.fullColor ? void 0 : "currentColor",
|
|
2042
|
+
style: { display: "block", flexShrink: 0 },
|
|
2043
|
+
dangerouslySetInnerHTML: { __html: brand.content }
|
|
2044
|
+
}
|
|
2045
|
+
),
|
|
2046
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2047
|
+
"span",
|
|
2048
|
+
{
|
|
2049
|
+
ref: wordRef,
|
|
2050
|
+
"aria-hidden": "true",
|
|
2051
|
+
style: {
|
|
2052
|
+
display: "inline-block",
|
|
2053
|
+
overflow: "hidden",
|
|
2054
|
+
whiteSpace: "nowrap",
|
|
2055
|
+
fontWeight: 600,
|
|
2056
|
+
fontSize: 15,
|
|
2057
|
+
letterSpacing: "-0.01em",
|
|
2058
|
+
lineHeight: 1,
|
|
2059
|
+
width: ws.width,
|
|
2060
|
+
opacity: ws.opacity,
|
|
2061
|
+
marginLeft: ws.marginLeft,
|
|
2062
|
+
transition: ws.transition
|
|
2063
|
+
},
|
|
2064
|
+
children: label
|
|
2065
|
+
}
|
|
2066
|
+
)
|
|
2067
|
+
]
|
|
2068
|
+
}
|
|
2069
|
+
);
|
|
2070
|
+
}
|
|
2071
|
+
function isHexColor(v) {
|
|
2072
|
+
return typeof v === "string" && /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(v.trim());
|
|
2073
|
+
}
|
|
2074
|
+
function resolveAccent(theme) {
|
|
2075
|
+
if (!theme || !theme.isEnabled) return null;
|
|
2076
|
+
const hex = (theme.colorPrimary ?? "").trim();
|
|
2077
|
+
return isHexColor(hex) ? hex : null;
|
|
2078
|
+
}
|
|
2079
|
+
function expandHex(hex) {
|
|
2080
|
+
const h = hex.trim().toLowerCase();
|
|
2081
|
+
if (h.length === 4) return `#${h[1]}${h[1]}${h[2]}${h[2]}${h[3]}${h[3]}`;
|
|
2082
|
+
return h;
|
|
2083
|
+
}
|
|
2084
|
+
function contrastText(hex) {
|
|
2085
|
+
if (!isHexColor(hex)) return "#ffffff";
|
|
2086
|
+
const h = expandHex(hex);
|
|
2087
|
+
const r = parseInt(h.slice(1, 3), 16) / 255;
|
|
2088
|
+
const g = parseInt(h.slice(3, 5), 16) / 255;
|
|
2089
|
+
const b = parseInt(h.slice(5, 7), 16) / 255;
|
|
2090
|
+
const lin = (c) => c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
2091
|
+
const luminance = 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
|
|
2092
|
+
return luminance > 0.5 ? "#000000" : "#ffffff";
|
|
2093
|
+
}
|
|
2094
|
+
function accentFor(theme) {
|
|
2095
|
+
const hex = resolveAccent(theme);
|
|
2096
|
+
return { accent: hex, contrast: hex ? contrastText(hex) : "#ffffff" };
|
|
2097
|
+
}
|
|
2098
|
+
var DEFAULT = { accent: null, contrast: "#ffffff" };
|
|
2099
|
+
var current = DEFAULT;
|
|
2100
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
2101
|
+
function setOrgAccent(theme) {
|
|
2102
|
+
const next = accentFor(theme);
|
|
2103
|
+
if (next.accent === current.accent) return;
|
|
2104
|
+
current = next.accent ? next : DEFAULT;
|
|
2105
|
+
for (const l of listeners) l();
|
|
2106
|
+
}
|
|
2107
|
+
function subscribe(cb) {
|
|
2108
|
+
listeners.add(cb);
|
|
2109
|
+
return () => {
|
|
2110
|
+
listeners.delete(cb);
|
|
2111
|
+
};
|
|
2112
|
+
}
|
|
2113
|
+
function useAccent() {
|
|
2114
|
+
return react.useSyncExternalStore(
|
|
2115
|
+
subscribe,
|
|
2116
|
+
() => current,
|
|
2117
|
+
() => DEFAULT
|
|
2118
|
+
);
|
|
2119
|
+
}
|
|
2120
|
+
function PrimaryButton(props) {
|
|
2121
|
+
const { accent, contrast } = useAccent();
|
|
2122
|
+
if (accent) {
|
|
2123
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { style: { backgroundColor: accent, color: contrast, borderColor: accent }, ...props });
|
|
2124
|
+
}
|
|
2125
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { theme: "light", ...props });
|
|
2126
|
+
}
|
|
2127
|
+
function openHref2(href) {
|
|
2128
|
+
if (typeof window !== "undefined") window.open(href, "_blank", "noopener");
|
|
2129
|
+
}
|
|
2130
|
+
function EmptyState({
|
|
2131
|
+
icon: Icon,
|
|
2132
|
+
title,
|
|
2133
|
+
description,
|
|
2134
|
+
bullets,
|
|
2135
|
+
primary,
|
|
2136
|
+
secondary
|
|
2137
|
+
}) {
|
|
2138
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2139
|
+
gui.Card,
|
|
2140
|
+
{
|
|
2141
|
+
borderWidth: 1,
|
|
2142
|
+
borderColor: "$borderColor",
|
|
2143
|
+
borderStyle: "dashed",
|
|
2144
|
+
p: "$6",
|
|
2145
|
+
gap: "$4",
|
|
2146
|
+
items: "center",
|
|
2147
|
+
maxWidth: 640,
|
|
2148
|
+
self: "center",
|
|
2149
|
+
width: "100%",
|
|
2150
|
+
children: [
|
|
2151
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2152
|
+
gui.YStack,
|
|
2153
|
+
{
|
|
2154
|
+
width: 48,
|
|
2155
|
+
height: 48,
|
|
2156
|
+
items: "center",
|
|
2157
|
+
justify: "center",
|
|
2158
|
+
rounded: "$4",
|
|
2159
|
+
bg: "$color3",
|
|
2160
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 24 })
|
|
2161
|
+
}
|
|
2162
|
+
),
|
|
2163
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$2", items: "center", maxW: 480, children: [
|
|
2164
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$6", fontWeight: "500", text: "center", letterSpacing: -0.3, children: title }),
|
|
2165
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color11", text: "center", children: description })
|
|
2166
|
+
] }),
|
|
2167
|
+
bullets && bullets.length ? /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: "$2", self: "stretch", maxW: 420, mx: "auto", children: bullets.map((b) => /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2", items: "flex-start", children: [
|
|
2168
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { pt: "$1", children: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Check, { size: 14, color: "$color10" }) }),
|
|
2169
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color11", flex: 1, children: b })
|
|
2170
|
+
] }, b)) }) : null,
|
|
2171
|
+
primary || secondary ? /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2", items: "center", flexWrap: "wrap", justify: "center", children: [
|
|
2172
|
+
primary ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2173
|
+
PrimaryButton,
|
|
2174
|
+
{
|
|
2175
|
+
icon: primary.icon,
|
|
2176
|
+
iconAfter: primary.href ? /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.ExternalLink, { size: 15 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.ArrowRight, { size: 15 }),
|
|
2177
|
+
onPress: () => primary.href ? openHref2(primary.href) : primary.onPress?.(),
|
|
2178
|
+
children: primary.label
|
|
2179
|
+
}
|
|
2180
|
+
) : null,
|
|
2181
|
+
secondary ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2182
|
+
gui.Button,
|
|
2183
|
+
{
|
|
2184
|
+
chromeless: true,
|
|
2185
|
+
icon: secondary.icon,
|
|
2186
|
+
iconAfter: secondary.href ? /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.ExternalLink, { size: 14 }) : void 0,
|
|
2187
|
+
onPress: () => secondary.href ? openHref2(secondary.href) : secondary.onPress?.(),
|
|
2188
|
+
children: secondary.label
|
|
2189
|
+
}
|
|
2190
|
+
) : null
|
|
2191
|
+
] }) : null
|
|
2192
|
+
]
|
|
2193
|
+
}
|
|
2194
|
+
);
|
|
2195
|
+
}
|
|
2196
|
+
function FadeIn({
|
|
2197
|
+
children,
|
|
2198
|
+
index = 0,
|
|
2199
|
+
step = 50,
|
|
2200
|
+
delayMs,
|
|
2201
|
+
style
|
|
2202
|
+
}) {
|
|
2203
|
+
const delay = delayMs ?? index * step;
|
|
2204
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "hz-fade-up", style: { animationDelay: `${delay}ms`, ...style }, children });
|
|
2205
|
+
}
|
|
2206
|
+
function FieldRow({ label, children }) {
|
|
2207
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$3", items: "flex-start", flexWrap: "wrap", children: [
|
|
2208
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Label, { width: "100%", pt: "$2", color: "$color11", fontSize: "$3", $md: { width: 180 }, children: label }),
|
|
2209
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { flex: 1, minW: 0, $md: { minW: 240 }, children })
|
|
2210
|
+
] });
|
|
2211
|
+
}
|
|
2212
|
+
function FieldText({
|
|
2213
|
+
value,
|
|
2214
|
+
onChange,
|
|
2215
|
+
disabled,
|
|
2216
|
+
secure,
|
|
2217
|
+
placeholder
|
|
2218
|
+
}) {
|
|
2219
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2220
|
+
gui.Input,
|
|
2221
|
+
{
|
|
2222
|
+
value,
|
|
2223
|
+
onChangeText: onChange,
|
|
2224
|
+
disabled,
|
|
2225
|
+
secureTextEntry: secure,
|
|
2226
|
+
placeholder,
|
|
2227
|
+
autoCapitalize: "none"
|
|
2228
|
+
}
|
|
2229
|
+
);
|
|
2230
|
+
}
|
|
2231
|
+
function FieldTextArea({
|
|
2232
|
+
value,
|
|
2233
|
+
onChange,
|
|
2234
|
+
disabled,
|
|
2235
|
+
rows: rows2 = 6
|
|
2236
|
+
}) {
|
|
2237
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.TextArea, { value, onChangeText: onChange, disabled, numberOfLines: rows2 });
|
|
2238
|
+
}
|
|
2239
|
+
function FieldSwitch({
|
|
2240
|
+
checked,
|
|
2241
|
+
onChange,
|
|
2242
|
+
disabled
|
|
2243
|
+
}) {
|
|
2244
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Switch, { checked, onCheckedChange: onChange, disabled, size: "$3", children: /* @__PURE__ */ jsxRuntime.jsx(gui.Switch.Thumb, {}) });
|
|
2245
|
+
}
|
|
2246
|
+
var CHEVRON = `data:image/svg+xml,${encodeURIComponent(
|
|
2247
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#9a9a9a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>'
|
|
2248
|
+
)}`;
|
|
2249
|
+
function selectStyle(disabled) {
|
|
2250
|
+
return {
|
|
2251
|
+
width: "100%",
|
|
2252
|
+
boxSizing: "border-box",
|
|
2253
|
+
appearance: "none",
|
|
2254
|
+
WebkitAppearance: "none",
|
|
2255
|
+
MozAppearance: "none",
|
|
2256
|
+
background: `var(--background) url("${CHEVRON}") no-repeat right 10px center`,
|
|
2257
|
+
color: "var(--color12)",
|
|
2258
|
+
border: "1px solid var(--borderColor)",
|
|
2259
|
+
borderRadius: 9,
|
|
2260
|
+
padding: "9px 34px 9px 12px",
|
|
2261
|
+
fontSize: 14,
|
|
2262
|
+
lineHeight: "20px",
|
|
2263
|
+
fontFamily: "inherit",
|
|
2264
|
+
height: 40,
|
|
2265
|
+
outline: "none",
|
|
2266
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
2267
|
+
opacity: disabled ? 0.5 : 1
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
var OPTION_STYLE = { background: "var(--color2)", color: "var(--color12)" };
|
|
2271
|
+
function FieldSelect({
|
|
2272
|
+
value,
|
|
2273
|
+
options,
|
|
2274
|
+
onChange,
|
|
2275
|
+
disabled,
|
|
2276
|
+
placeholder = "Select\u2026"
|
|
2277
|
+
}) {
|
|
2278
|
+
const showPlaceholder = value === "" || !options.includes(value);
|
|
2279
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2280
|
+
"select",
|
|
2281
|
+
{
|
|
2282
|
+
value: showPlaceholder ? "" : value,
|
|
2283
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
|
2284
|
+
disabled,
|
|
2285
|
+
"aria-label": placeholder,
|
|
2286
|
+
style: selectStyle(disabled),
|
|
2287
|
+
children: [
|
|
2288
|
+
showPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, style: OPTION_STYLE, children: placeholder }) : null,
|
|
2289
|
+
options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, style: OPTION_STYLE, children: opt }, opt))
|
|
2290
|
+
]
|
|
2291
|
+
}
|
|
2292
|
+
);
|
|
2293
|
+
}
|
|
2294
|
+
function FieldSlider({
|
|
2295
|
+
value,
|
|
2296
|
+
min,
|
|
2297
|
+
max,
|
|
2298
|
+
step,
|
|
2299
|
+
onChange,
|
|
2300
|
+
disabled
|
|
2301
|
+
}) {
|
|
2302
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$3", items: "center", children: [
|
|
2303
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { width: 56, fontSize: "$3", color: "$color11", children: value }),
|
|
2304
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2305
|
+
gui.Slider,
|
|
2306
|
+
{
|
|
2307
|
+
flex: 1,
|
|
2308
|
+
min,
|
|
2309
|
+
max,
|
|
2310
|
+
step,
|
|
2311
|
+
value: [value],
|
|
2312
|
+
onValueChange: (v) => onChange(v[0] ?? min),
|
|
2313
|
+
disabled,
|
|
2314
|
+
children: [
|
|
2315
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Slider.Track, { children: /* @__PURE__ */ jsxRuntime.jsx(gui.Slider.TrackActive, {}) }),
|
|
2316
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Slider.Thumb, { index: 0, circular: true })
|
|
2317
|
+
]
|
|
2318
|
+
}
|
|
2319
|
+
)
|
|
2320
|
+
] });
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
// src/product/color.ts
|
|
2324
|
+
var asColor = (hex) => hex;
|
|
2325
|
+
function ProductIcon({
|
|
2326
|
+
icon: Icon,
|
|
2327
|
+
color,
|
|
2328
|
+
size = 24
|
|
2329
|
+
}) {
|
|
2330
|
+
const radius = Math.round(size * 0.28);
|
|
2331
|
+
const glyph = Math.round(size * 0.58);
|
|
2332
|
+
const tinted = typeof color === "string" && color.trim() !== "";
|
|
2333
|
+
if (tinted) {
|
|
2334
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2335
|
+
gui.XStack,
|
|
2336
|
+
{
|
|
2337
|
+
width: size,
|
|
2338
|
+
height: size,
|
|
2339
|
+
items: "center",
|
|
2340
|
+
justify: "center",
|
|
2341
|
+
rounded: radius,
|
|
2342
|
+
style: { backgroundColor: color },
|
|
2343
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: glyph, color: asColor("#ffffff") })
|
|
2344
|
+
}
|
|
2345
|
+
);
|
|
2346
|
+
}
|
|
2347
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { width: size, height: size, items: "center", justify: "center", rounded: radius, bg: "$color12", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: glyph, color: "$color1" }) });
|
|
2348
|
+
}
|
|
2349
|
+
var KNOWN = {
|
|
2350
|
+
openrouter: lucideIcons2.Globe,
|
|
2351
|
+
nvidia: lucideIcons2.Cpu
|
|
2352
|
+
};
|
|
2353
|
+
var isFirstParty = (provider) => {
|
|
2354
|
+
const p = provider.trim().toLowerCase();
|
|
2355
|
+
return p === "hanzo" || p === "zen";
|
|
2356
|
+
};
|
|
2357
|
+
function EnsoMark({ size, color }) {
|
|
2358
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 100 100", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M66.22 83.26 A37 37 0 1 1 85.57 60.20", fill: "none", stroke: color, strokeWidth: 11, strokeLinecap: "round" }) });
|
|
2359
|
+
}
|
|
2360
|
+
var HANZO_PATHS = [
|
|
2361
|
+
"M22.21 67V44.6369H0V67H22.21Z",
|
|
2362
|
+
"M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z",
|
|
2363
|
+
"M22.21 0H0V22.3184H22.21V0Z",
|
|
2364
|
+
"M66.7198 0H44.5098V22.3184H66.7198V0Z",
|
|
2365
|
+
"M66.7198 67V44.6369H44.5098V67H66.7198Z"
|
|
2366
|
+
];
|
|
2367
|
+
function HanzoHMark({ size, color }) {
|
|
2368
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 67 67", "aria-hidden": "true", children: HANZO_PATHS.map((d) => /* @__PURE__ */ jsxRuntime.jsx("path", { d, fill: color }, d)) });
|
|
2369
|
+
}
|
|
2370
|
+
function providerInitials(provider) {
|
|
2371
|
+
const name = provider.trim();
|
|
2372
|
+
if (!name) return "\u2022";
|
|
2373
|
+
const words = name.split(/[\s/_-]+/).filter(Boolean);
|
|
2374
|
+
if (words.length >= 2) return (words[0][0] + words[1][0]).toUpperCase();
|
|
2375
|
+
return name.slice(0, 2).toUpperCase();
|
|
2376
|
+
}
|
|
2377
|
+
function ProviderLogo({ provider, size = 24 }) {
|
|
2378
|
+
const theme = gui.useTheme();
|
|
2379
|
+
const radius = Math.round(size * 0.28);
|
|
2380
|
+
const iconSize = Math.round(size * 0.56);
|
|
2381
|
+
if (isFirstParty(provider)) {
|
|
2382
|
+
const fg = theme.color1?.get() ?? "#000000";
|
|
2383
|
+
const markSize = Math.round(size * 0.66);
|
|
2384
|
+
const isZen = provider.trim().toLowerCase() === "zen";
|
|
2385
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { width: size, height: size, items: "center", justify: "center", rounded: radius, bg: "$color12", children: isZen ? /* @__PURE__ */ jsxRuntime.jsx(EnsoMark, { size: markSize, color: fg }) : /* @__PURE__ */ jsxRuntime.jsx(HanzoHMark, { size: Math.round(size * 0.56), color: fg }) });
|
|
2386
|
+
}
|
|
2387
|
+
const Known = KNOWN[provider.trim().toLowerCase()];
|
|
2388
|
+
if (Known) {
|
|
2389
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2390
|
+
gui.XStack,
|
|
2391
|
+
{
|
|
2392
|
+
width: size,
|
|
2393
|
+
height: size,
|
|
2394
|
+
items: "center",
|
|
2395
|
+
justify: "center",
|
|
2396
|
+
rounded: radius,
|
|
2397
|
+
bg: "$color3",
|
|
2398
|
+
borderWidth: 1,
|
|
2399
|
+
borderColor: "$borderColor",
|
|
2400
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Known, { size: iconSize, color: "$color11" })
|
|
2401
|
+
}
|
|
2402
|
+
);
|
|
2403
|
+
}
|
|
2404
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2405
|
+
gui.XStack,
|
|
2406
|
+
{
|
|
2407
|
+
width: size,
|
|
2408
|
+
height: size,
|
|
2409
|
+
items: "center",
|
|
2410
|
+
justify: "center",
|
|
2411
|
+
rounded: radius,
|
|
2412
|
+
bg: "$color3",
|
|
2413
|
+
borderWidth: 1,
|
|
2414
|
+
borderColor: "$borderColor",
|
|
2415
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: Math.round(size * 0.4), fontWeight: "800", color: "$color11", children: providerInitials(provider) })
|
|
2416
|
+
}
|
|
2417
|
+
);
|
|
2418
|
+
}
|
|
2419
|
+
function GenericLogo({ size = 24 }) {
|
|
2420
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { width: size, height: size, items: "center", justify: "center", rounded: Math.round(size * 0.28), bg: "$color3", borderWidth: 1, borderColor: "$borderColor", children: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Server, { size: Math.round(size * 0.56), color: "$color11" }) });
|
|
2421
|
+
}
|
|
2422
|
+
function targetIndex(from, dy, rowH, count) {
|
|
2423
|
+
if (rowH <= 0 || count <= 0) return from;
|
|
2424
|
+
const raw = from + Math.round(dy / rowH);
|
|
2425
|
+
return Math.max(0, Math.min(raw, count - 1));
|
|
2426
|
+
}
|
|
2427
|
+
function rowShift(i, from, to, dy, rowH) {
|
|
2428
|
+
if (i === from) return dy;
|
|
2429
|
+
if (from < to && i > from && i <= to) return -rowH;
|
|
2430
|
+
if (from > to && i < from && i >= to) return rowH;
|
|
2431
|
+
return 0;
|
|
2432
|
+
}
|
|
2433
|
+
function Reorder({
|
|
2434
|
+
items,
|
|
2435
|
+
keyOf,
|
|
2436
|
+
rowHeight = 44,
|
|
2437
|
+
onReorder,
|
|
2438
|
+
renderItem
|
|
2439
|
+
}) {
|
|
2440
|
+
const [drag, setDrag] = react.useState(null);
|
|
2441
|
+
const startRef = react.useRef(null);
|
|
2442
|
+
const to = drag ? targetIndex(drag.from, drag.dy, rowHeight, items.length) : -1;
|
|
2443
|
+
const begin = react.useCallback(
|
|
2444
|
+
(index) => (e) => {
|
|
2445
|
+
const startY = e.clientY ?? e.nativeEvent?.clientY ?? 0;
|
|
2446
|
+
startRef.current = { from: index, startY };
|
|
2447
|
+
setDrag({ from: index, dy: 0 });
|
|
2448
|
+
const move = (ev) => {
|
|
2449
|
+
if (!startRef.current) return;
|
|
2450
|
+
setDrag({ from: startRef.current.from, dy: ev.clientY - startRef.current.startY });
|
|
2451
|
+
};
|
|
2452
|
+
const end = () => {
|
|
2453
|
+
const s = startRef.current;
|
|
2454
|
+
window.removeEventListener("pointermove", move);
|
|
2455
|
+
window.removeEventListener("pointerup", end);
|
|
2456
|
+
window.removeEventListener("pointercancel", end);
|
|
2457
|
+
startRef.current = null;
|
|
2458
|
+
setDrag((d) => {
|
|
2459
|
+
if (s && d) {
|
|
2460
|
+
const t = targetIndex(s.from, d.dy, rowHeight, items.length);
|
|
2461
|
+
if (t !== s.from) onReorder(s.from, t);
|
|
2462
|
+
}
|
|
2463
|
+
return null;
|
|
2464
|
+
});
|
|
2465
|
+
};
|
|
2466
|
+
window.addEventListener("pointermove", move);
|
|
2467
|
+
window.addEventListener("pointerup", end);
|
|
2468
|
+
window.addEventListener("pointercancel", end);
|
|
2469
|
+
},
|
|
2470
|
+
[items.length, rowHeight, onReorder]
|
|
2471
|
+
);
|
|
2472
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { children: items.map((item, i) => {
|
|
2473
|
+
const dragging = drag?.from === i;
|
|
2474
|
+
const shift = drag && to >= 0 ? rowShift(i, drag.from, to, drag.dy, rowHeight) : 0;
|
|
2475
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2476
|
+
gui.YStack,
|
|
2477
|
+
{
|
|
2478
|
+
height: rowHeight,
|
|
2479
|
+
justify: "center",
|
|
2480
|
+
className: "hz-drag-item",
|
|
2481
|
+
style: {
|
|
2482
|
+
transform: `translateY(${shift}px)`,
|
|
2483
|
+
zIndex: dragging ? 2 : 1,
|
|
2484
|
+
...dragging ? { transition: "none", boxShadow: "0 8px 24px rgba(0,0,0,0.28)" } : null
|
|
2485
|
+
},
|
|
2486
|
+
children: renderItem(item, { onPointerDown: begin(i) }, dragging)
|
|
2487
|
+
},
|
|
2488
|
+
keyOf(item)
|
|
2489
|
+
);
|
|
2490
|
+
}) });
|
|
2491
|
+
}
|
|
2492
|
+
function SelectMenu({
|
|
2493
|
+
options,
|
|
2494
|
+
value,
|
|
2495
|
+
onChange,
|
|
2496
|
+
allLabel = "All",
|
|
2497
|
+
icon,
|
|
2498
|
+
minWidth = 130
|
|
2499
|
+
}) {
|
|
2500
|
+
const active = value === null ? null : options.find((o) => o.key === value) ?? null;
|
|
2501
|
+
const triggerLabel = active ? active.label : allLabel;
|
|
2502
|
+
const items = [
|
|
2503
|
+
{ key: "__all__", label: allLabel, selected: value === null, onSelect: () => onChange(null) },
|
|
2504
|
+
...options.map((o) => ({ key: o.key, label: o.label, selected: value === o.key, onSelect: () => onChange(o.key) }))
|
|
2505
|
+
];
|
|
2506
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2507
|
+
DropdownMenu,
|
|
2508
|
+
{
|
|
2509
|
+
minWidth: Math.max(minWidth, 160),
|
|
2510
|
+
trigger: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2511
|
+
gui.Button,
|
|
2512
|
+
{
|
|
2513
|
+
size: "$2",
|
|
2514
|
+
minW: minWidth,
|
|
2515
|
+
justify: "space-between",
|
|
2516
|
+
borderWidth: 1,
|
|
2517
|
+
borderColor: "$borderColor",
|
|
2518
|
+
bg: value !== null ? "$color5" : "transparent",
|
|
2519
|
+
icon,
|
|
2520
|
+
iconAfter: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.ChevronDown, { size: 14, opacity: 0.6 }),
|
|
2521
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color12", numberOfLines: 1, flex: 1, children: triggerLabel })
|
|
2522
|
+
}
|
|
2523
|
+
),
|
|
2524
|
+
items
|
|
2525
|
+
}
|
|
2526
|
+
);
|
|
2527
|
+
}
|
|
2528
|
+
var LG = 1024;
|
|
2529
|
+
var lockCount = 0;
|
|
2530
|
+
var savedOverflow = "";
|
|
2531
|
+
function lockScroll() {
|
|
2532
|
+
if (typeof document === "undefined") return;
|
|
2533
|
+
if (lockCount === 0) {
|
|
2534
|
+
savedOverflow = document.body.style.overflow;
|
|
2535
|
+
document.body.style.overflow = "hidden";
|
|
2536
|
+
}
|
|
2537
|
+
lockCount++;
|
|
2538
|
+
}
|
|
2539
|
+
function unlockScroll() {
|
|
2540
|
+
if (typeof document === "undefined") return;
|
|
2541
|
+
lockCount = Math.max(0, lockCount - 1);
|
|
2542
|
+
if (lockCount === 0) document.body.style.overflow = savedOverflow;
|
|
2543
|
+
}
|
|
2544
|
+
function SlideOver({
|
|
2545
|
+
open,
|
|
2546
|
+
onClose,
|
|
2547
|
+
side = "right",
|
|
2548
|
+
size = 420,
|
|
2549
|
+
title,
|
|
2550
|
+
icon: Icon,
|
|
2551
|
+
iconColor,
|
|
2552
|
+
headerRight,
|
|
2553
|
+
ariaLabel,
|
|
2554
|
+
zIndex = 1e3,
|
|
2555
|
+
children
|
|
2556
|
+
}) {
|
|
2557
|
+
const panelRef = react.useRef(null);
|
|
2558
|
+
const openerRef = react.useRef(null);
|
|
2559
|
+
react.useEffect(() => {
|
|
2560
|
+
if (!open) return;
|
|
2561
|
+
openerRef.current = typeof document !== "undefined" ? document.activeElement : null;
|
|
2562
|
+
lockScroll();
|
|
2563
|
+
const t = window.setTimeout(() => {
|
|
2564
|
+
const el = panelRef.current;
|
|
2565
|
+
if (el && typeof el.focus === "function") el.focus();
|
|
2566
|
+
}, 0);
|
|
2567
|
+
return () => {
|
|
2568
|
+
window.clearTimeout(t);
|
|
2569
|
+
unlockScroll();
|
|
2570
|
+
const opener = openerRef.current;
|
|
2571
|
+
if (opener && opener instanceof HTMLElement && typeof opener.focus === "function") opener.focus();
|
|
2572
|
+
};
|
|
2573
|
+
}, [open]);
|
|
2574
|
+
react.useEffect(() => {
|
|
2575
|
+
if (!open) return;
|
|
2576
|
+
const onKey = (e) => {
|
|
2577
|
+
if (e.key === "Escape") {
|
|
2578
|
+
e.stopPropagation();
|
|
2579
|
+
onClose();
|
|
2580
|
+
}
|
|
2581
|
+
};
|
|
2582
|
+
window.addEventListener("keydown", onKey);
|
|
2583
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
2584
|
+
}, [open, onClose]);
|
|
2585
|
+
const offscreen = side === "right" ? "translateX(100%)" : "translateX(-100%)";
|
|
2586
|
+
const edge = side === "right" ? { r: 0 } : { l: 0 };
|
|
2587
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2588
|
+
gui.YStack,
|
|
2589
|
+
{
|
|
2590
|
+
overflow: "hidden",
|
|
2591
|
+
pointerEvents: open ? "auto" : "none",
|
|
2592
|
+
"aria-hidden": !open,
|
|
2593
|
+
style: { position: "fixed", inset: 0, zIndex },
|
|
2594
|
+
children: [
|
|
2595
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2596
|
+
gui.YStack,
|
|
2597
|
+
{
|
|
2598
|
+
position: "absolute",
|
|
2599
|
+
t: 0,
|
|
2600
|
+
l: 0,
|
|
2601
|
+
r: 0,
|
|
2602
|
+
b: 0,
|
|
2603
|
+
bg: "rgba(0,0,0,0.55)",
|
|
2604
|
+
className: "hz-fade",
|
|
2605
|
+
style: { opacity: open ? 1 : 0 },
|
|
2606
|
+
onPress: onClose
|
|
2607
|
+
}
|
|
2608
|
+
),
|
|
2609
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2610
|
+
gui.YStack,
|
|
2611
|
+
{
|
|
2612
|
+
ref: panelRef,
|
|
2613
|
+
tabIndex: -1,
|
|
2614
|
+
role: "dialog",
|
|
2615
|
+
"aria-modal": open ? true : void 0,
|
|
2616
|
+
"aria-label": typeof title === "string" ? title : ariaLabel,
|
|
2617
|
+
position: "absolute",
|
|
2618
|
+
t: 0,
|
|
2619
|
+
b: 0,
|
|
2620
|
+
...edge,
|
|
2621
|
+
width: "100%",
|
|
2622
|
+
$lg: { width: size, maxW: "100vw" },
|
|
2623
|
+
bg: "$color1",
|
|
2624
|
+
borderLeftWidth: side === "right" ? 1 : 0,
|
|
2625
|
+
borderRightWidth: side === "left" ? 1 : 0,
|
|
2626
|
+
borderColor: "$borderColor",
|
|
2627
|
+
className: "hz-slide hz-elevation-4",
|
|
2628
|
+
style: {
|
|
2629
|
+
transform: open ? "translateX(0)" : offscreen,
|
|
2630
|
+
height: "100dvh",
|
|
2631
|
+
paddingTop: "env(safe-area-inset-top)",
|
|
2632
|
+
paddingBottom: "env(safe-area-inset-bottom)"
|
|
2633
|
+
},
|
|
2634
|
+
children: title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2635
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2636
|
+
gui.XStack,
|
|
2637
|
+
{
|
|
2638
|
+
items: "center",
|
|
2639
|
+
gap: "$2.5",
|
|
2640
|
+
px: "$4",
|
|
2641
|
+
height: 56,
|
|
2642
|
+
borderBottomWidth: 1,
|
|
2643
|
+
borderColor: "$borderColor",
|
|
2644
|
+
children: [
|
|
2645
|
+
Icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 18, color: iconColor ? asColor(iconColor) : void 0 }) : null,
|
|
2646
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { flex: 1, fontSize: "$5", fontWeight: "700", color: "$color12", numberOfLines: 1, children: title }),
|
|
2647
|
+
headerRight,
|
|
2648
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Button, { chromeless: true, width: 44, height: 44, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.X, { size: 18 }), onPress: onClose, "aria-label": "Close" })
|
|
2649
|
+
]
|
|
2650
|
+
}
|
|
2651
|
+
),
|
|
2652
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.ScrollView, { flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { flex: 1, p: "$4", gap: "$3", children }) })
|
|
2653
|
+
] }) : (
|
|
2654
|
+
// Bare mode — the caller owns the full panel layout (e.g. the nav drawer
|
|
2655
|
+
// renders its own header + scroll + footer).
|
|
2656
|
+
children
|
|
2657
|
+
)
|
|
2658
|
+
}
|
|
2659
|
+
)
|
|
2660
|
+
]
|
|
2661
|
+
}
|
|
2662
|
+
);
|
|
2663
|
+
}
|
|
2664
|
+
var toneOf = (status) => {
|
|
2665
|
+
const s = status.toLowerCase();
|
|
2666
|
+
if (s === "green") return "green";
|
|
2667
|
+
if (s === "yellow") return "yellow";
|
|
2668
|
+
if (s === "red") return "red";
|
|
2669
|
+
if (["ready", "active", "running", "available", "ok", "live", "succeeded", "connected", "synced", "imported"].includes(s)) return "green";
|
|
2670
|
+
if (["creating", "provisioning", "pending", "updating", "attaching", "building", "deploying", "queued", "importing"].includes(s))
|
|
2671
|
+
return "yellow";
|
|
2672
|
+
if (["error", "failed", "degraded", "down", "canceled", "conflict"].includes(s)) return "red";
|
|
2673
|
+
return "neutral";
|
|
2674
|
+
};
|
|
2675
|
+
var TONE_BG = {
|
|
2676
|
+
green: "$color5",
|
|
2677
|
+
yellow: "$color4",
|
|
2678
|
+
red: "$color4",
|
|
2679
|
+
neutral: "$color3"
|
|
2680
|
+
};
|
|
2681
|
+
var TONE_FG = {
|
|
2682
|
+
green: "$color12",
|
|
2683
|
+
yellow: "$color12",
|
|
2684
|
+
red: "$color12",
|
|
2685
|
+
neutral: "$color11"
|
|
2686
|
+
};
|
|
2687
|
+
function StatusTag({ status }) {
|
|
2688
|
+
const tone2 = toneOf(status ?? "");
|
|
2689
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", px: "$2", py: "$1", rounded: "$2", bg: TONE_BG[tone2], color: TONE_FG[tone2], children: status || "unknown" });
|
|
2690
|
+
}
|
|
2691
|
+
var ToastContext = react.createContext(null);
|
|
2692
|
+
var ACCENT3 = {
|
|
2693
|
+
success: "$green10",
|
|
2694
|
+
error: "$red10",
|
|
2695
|
+
info: "$color11"
|
|
2696
|
+
};
|
|
2697
|
+
var ICON = {
|
|
2698
|
+
success: lucideIcons2.CircleCheck,
|
|
2699
|
+
error: lucideIcons2.CircleX,
|
|
2700
|
+
info: lucideIcons2.Info
|
|
2701
|
+
};
|
|
2702
|
+
function ToastCard({ t, onClose }) {
|
|
2703
|
+
const Icon = ICON[t.kind];
|
|
2704
|
+
const accent = ACCENT3[t.kind];
|
|
2705
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2706
|
+
gui.Card,
|
|
2707
|
+
{
|
|
2708
|
+
width: 360,
|
|
2709
|
+
maxWidth: "90%",
|
|
2710
|
+
p: "$3",
|
|
2711
|
+
gap: "$2",
|
|
2712
|
+
bg: "$color2",
|
|
2713
|
+
borderWidth: 1,
|
|
2714
|
+
borderColor: "$borderColor",
|
|
2715
|
+
borderLeftWidth: 3,
|
|
2716
|
+
borderLeftColor: accent,
|
|
2717
|
+
rounded: "$4",
|
|
2718
|
+
elevation: "$2",
|
|
2719
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2.5", items: "flex-start", children: [
|
|
2720
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { pt: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 18, color: accent }) }),
|
|
2721
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { flex: 1, gap: "$1", children: [
|
|
2722
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", fontWeight: "700", color: "$color12", children: t.title }),
|
|
2723
|
+
t.description ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color11", children: t.description }) : null
|
|
2724
|
+
] }),
|
|
2725
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$1", chromeless: true, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.X, { size: 14 }), onPress: onClose, "aria-label": "Dismiss" })
|
|
2726
|
+
] })
|
|
2727
|
+
}
|
|
2728
|
+
);
|
|
2729
|
+
}
|
|
2730
|
+
function ToastViewport({ toasts, dismiss }) {
|
|
2731
|
+
const [mounted, setMounted] = react.useState(false);
|
|
2732
|
+
react.useEffect(() => setMounted(true), []);
|
|
2733
|
+
if (!mounted || typeof document === "undefined") return null;
|
|
2734
|
+
return reactDom.createPortal(
|
|
2735
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "fixed", top: 16, right: 16, zIndex: 1e5, pointerEvents: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: "$2", items: "flex-end", children: toasts.map((t) => /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { pointerEvents: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(ToastCard, { t, onClose: () => dismiss(t.id) }) }, t.id)) }) }),
|
|
2736
|
+
document.body
|
|
2737
|
+
);
|
|
2738
|
+
}
|
|
2739
|
+
function ToastProvider({ children }) {
|
|
2740
|
+
const [toasts, setToasts] = react.useState([]);
|
|
2741
|
+
const timers = react.useRef(/* @__PURE__ */ new Map());
|
|
2742
|
+
const seq = react.useRef(0);
|
|
2743
|
+
const dismiss = react.useCallback((id) => {
|
|
2744
|
+
setToasts((ts) => ts.filter((t) => t.id !== id));
|
|
2745
|
+
const timer = timers.current.get(id);
|
|
2746
|
+
if (timer) {
|
|
2747
|
+
clearTimeout(timer);
|
|
2748
|
+
timers.current.delete(id);
|
|
2749
|
+
}
|
|
2750
|
+
}, []);
|
|
2751
|
+
const toast = react.useCallback(
|
|
2752
|
+
(input) => {
|
|
2753
|
+
const id = ++seq.current;
|
|
2754
|
+
const kind = input.kind ?? "info";
|
|
2755
|
+
const durationMs = input.durationMs ?? (kind === "error" ? 6e3 : 3500);
|
|
2756
|
+
setToasts((ts) => [...ts, { id, kind, title: input.title, description: input.description, durationMs }]);
|
|
2757
|
+
if (durationMs > 0) {
|
|
2758
|
+
timers.current.set(
|
|
2759
|
+
id,
|
|
2760
|
+
setTimeout(() => dismiss(id), durationMs)
|
|
2761
|
+
);
|
|
2762
|
+
}
|
|
2763
|
+
},
|
|
2764
|
+
[dismiss]
|
|
2765
|
+
);
|
|
2766
|
+
react.useEffect(() => {
|
|
2767
|
+
const map = timers.current;
|
|
2768
|
+
return () => map.forEach((t) => clearTimeout(t));
|
|
2769
|
+
}, []);
|
|
2770
|
+
const api = {
|
|
2771
|
+
toast,
|
|
2772
|
+
success: (title, description) => toast({ title, description, kind: "success" }),
|
|
2773
|
+
error: (title, description) => toast({ title, description, kind: "error" }),
|
|
2774
|
+
info: (title, description) => toast({ title, description, kind: "info" }),
|
|
2775
|
+
dismiss
|
|
2776
|
+
};
|
|
2777
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value: api, children: [
|
|
2778
|
+
children,
|
|
2779
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToastViewport, { toasts, dismiss })
|
|
2780
|
+
] });
|
|
2781
|
+
}
|
|
2782
|
+
function useToast() {
|
|
2783
|
+
const ctx = react.useContext(ToastContext);
|
|
2784
|
+
if (!ctx) throw new Error("useToast must be used within <ToastProvider>");
|
|
2785
|
+
return ctx;
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
// src/product/social/api.ts
|
|
2789
|
+
var enc = encodeURIComponent;
|
|
2790
|
+
var str = (v) => typeof v === "string" ? v : v == null ? "" : String(v);
|
|
2791
|
+
var num = (v) => {
|
|
2792
|
+
if (typeof v === "number" && Number.isFinite(v)) return v;
|
|
2793
|
+
if (typeof v === "string" && v.trim() !== "" && Number.isFinite(Number(v))) return Number(v);
|
|
2794
|
+
return 0;
|
|
2795
|
+
};
|
|
2796
|
+
var strs = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
|
|
2797
|
+
var asRecord = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
2798
|
+
var rows = (payload) => {
|
|
2799
|
+
if (Array.isArray(payload)) return payload.filter((x) => x && typeof x === "object");
|
|
2800
|
+
if (payload && typeof payload === "object") {
|
|
2801
|
+
for (const k of ["data", "items", "rows"]) {
|
|
2802
|
+
const v = payload[k];
|
|
2803
|
+
if (Array.isArray(v)) return v.filter((x) => x && typeof x === "object");
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
return [];
|
|
2807
|
+
};
|
|
2808
|
+
var PROVIDERS = ["x", "facebook", "instagram", "linkedin", "tiktok", "youtube", "threads"];
|
|
2809
|
+
var ACCOUNT_STATUSES = ["connected", "disconnected", "error"];
|
|
2810
|
+
var POST_STATUSES = ["draft", "scheduled", "published", "failed"];
|
|
2811
|
+
function normalizeAccount(raw) {
|
|
2812
|
+
const r = asRecord(raw);
|
|
2813
|
+
return {
|
|
2814
|
+
id: str(r.id),
|
|
2815
|
+
provider: str(r.provider) || "x",
|
|
2816
|
+
handle: str(r.handle),
|
|
2817
|
+
status: str(r.status) || "connected",
|
|
2818
|
+
createdAt: num(r.createdAt),
|
|
2819
|
+
updatedAt: num(r.updatedAt)
|
|
2820
|
+
};
|
|
2821
|
+
}
|
|
2822
|
+
function normalizePost(raw) {
|
|
2823
|
+
const r = asRecord(raw);
|
|
2824
|
+
return {
|
|
2825
|
+
id: str(r.id),
|
|
2826
|
+
content: str(r.content),
|
|
2827
|
+
channel: str(r.channel) || "x",
|
|
2828
|
+
status: str(r.status) || "draft",
|
|
2829
|
+
scheduleAt: num(r.scheduleAt),
|
|
2830
|
+
media: strs(r.media),
|
|
2831
|
+
accountId: str(r.accountId) || void 0,
|
|
2832
|
+
externalId: str(r.externalId) || void 0,
|
|
2833
|
+
error: str(r.error) || void 0,
|
|
2834
|
+
createdAt: num(r.createdAt),
|
|
2835
|
+
updatedAt: num(r.updatedAt)
|
|
2836
|
+
};
|
|
2837
|
+
}
|
|
2838
|
+
function normalizeSummary(raw) {
|
|
2839
|
+
const r = asRecord(raw);
|
|
2840
|
+
return { posts: num(r.posts), scheduled: num(r.scheduled), published: num(r.published), accounts: num(r.accounts) };
|
|
2841
|
+
}
|
|
2842
|
+
function normalizeProviderCapability(raw) {
|
|
2843
|
+
const r = asRecord(raw);
|
|
2844
|
+
return {
|
|
2845
|
+
provider: str(r.provider),
|
|
2846
|
+
credentialsConfigured: Boolean(r.credentialsConfigured),
|
|
2847
|
+
missingCredentials: strs(r.missingCredentials)
|
|
2848
|
+
};
|
|
2849
|
+
}
|
|
2850
|
+
var normalizeAccounts = (p) => rows(p).map(normalizeAccount).filter((a) => a.id);
|
|
2851
|
+
var normalizePosts = (p) => rows(p).map(normalizePost).filter((x) => x.id);
|
|
2852
|
+
var normalizeProviders = (p) => rows(p).map(normalizeProviderCapability).filter((c) => c.provider);
|
|
2853
|
+
function createSocialApi(rest) {
|
|
2854
|
+
return {
|
|
2855
|
+
summary: () => rest.get("summary").then(normalizeSummary),
|
|
2856
|
+
/** Publish-readiness per network (+ the exact missing OAuth-app credentials). */
|
|
2857
|
+
providers: () => rest.get("providers").then(normalizeProviders),
|
|
2858
|
+
accounts: {
|
|
2859
|
+
list: (provider) => rest.get(`accounts${provider ? `?provider=${enc(provider)}` : ""}`).then(normalizeAccounts),
|
|
2860
|
+
get: (id) => rest.get(`accounts/${enc(id)}`).then(normalizeAccount),
|
|
2861
|
+
create: (body) => rest.post("accounts", body).then(normalizeAccount),
|
|
2862
|
+
update: (id, body) => rest.put(`accounts/${enc(id)}`, body).then(normalizeAccount),
|
|
2863
|
+
remove: (id) => rest.del(`accounts/${enc(id)}`)
|
|
2864
|
+
},
|
|
2865
|
+
posts: {
|
|
2866
|
+
list: (status) => rest.get(`posts${status ? `?status=${enc(status)}` : ""}`).then(normalizePosts),
|
|
2867
|
+
get: (id) => rest.get(`posts/${enc(id)}`).then(normalizePost),
|
|
2868
|
+
create: (body) => rest.post("posts", body).then(normalizePost),
|
|
2869
|
+
update: (id, body) => rest.put(`posts/${enc(id)}`, body).then(normalizePost),
|
|
2870
|
+
remove: (id) => rest.del(`posts/${enc(id)}`),
|
|
2871
|
+
/** Publish a post NOW to its channel's connected accounts. */
|
|
2872
|
+
publish: (id) => rest.post(`posts/${enc(id)}/publish`).then(normalizePost)
|
|
2873
|
+
}
|
|
2874
|
+
};
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2877
|
+
// src/product/social/format.ts
|
|
2878
|
+
function formatPostTime(unix) {
|
|
2879
|
+
if (!unix) return "\u2014";
|
|
2880
|
+
return new Date(unix * 1e3).toLocaleString(void 0, {
|
|
2881
|
+
month: "short",
|
|
2882
|
+
day: "numeric",
|
|
2883
|
+
hour: "2-digit",
|
|
2884
|
+
minute: "2-digit"
|
|
2885
|
+
});
|
|
2886
|
+
}
|
|
2887
|
+
function postDayBucket(unix) {
|
|
2888
|
+
const d = new Date(unix * 1e3);
|
|
2889
|
+
const key = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
2890
|
+
const label = d.toLocaleDateString(void 0, { weekday: "short", month: "short", day: "numeric" });
|
|
2891
|
+
return { key, label };
|
|
2892
|
+
}
|
|
2893
|
+
function postPreview(s) {
|
|
2894
|
+
const t = s.trim();
|
|
2895
|
+
return t.length > 72 ? `${t.slice(0, 72)}\u2026` : t || "\u2014";
|
|
2896
|
+
}
|
|
2897
|
+
function parsePostTime(dt) {
|
|
2898
|
+
const ms = Date.parse(dt.trim());
|
|
2899
|
+
return Number.isFinite(ms) && ms > 0 ? Math.floor(ms / 1e3) : 0;
|
|
2900
|
+
}
|
|
2901
|
+
function PostAgenda({ posts, onOpen }) {
|
|
2902
|
+
const days = react.useMemo(() => {
|
|
2903
|
+
const timed = posts.filter((p) => (p.scheduleAt ?? 0) > 0).sort((a, b) => (a.scheduleAt ?? 0) - (b.scheduleAt ?? 0));
|
|
2904
|
+
const groups = [];
|
|
2905
|
+
const index = /* @__PURE__ */ new Map();
|
|
2906
|
+
for (const p of timed) {
|
|
2907
|
+
const { key, label } = postDayBucket(p.scheduleAt ?? 0);
|
|
2908
|
+
let i = index.get(key);
|
|
2909
|
+
if (i === void 0) {
|
|
2910
|
+
i = groups.length;
|
|
2911
|
+
index.set(key, i);
|
|
2912
|
+
groups.push({ label, items: [] });
|
|
2913
|
+
}
|
|
2914
|
+
groups[i].items.push(p);
|
|
2915
|
+
}
|
|
2916
|
+
return groups;
|
|
2917
|
+
}, [posts]);
|
|
2918
|
+
if (days.length === 0) {
|
|
2919
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2920
|
+
EmptyState,
|
|
2921
|
+
{
|
|
2922
|
+
icon: lucideIcons2.Calendar,
|
|
2923
|
+
title: "Nothing on the calendar",
|
|
2924
|
+
description: "Scheduled and timed posts appear here, grouped by day. Compose a post and pick Schedule to plan ahead."
|
|
2925
|
+
}
|
|
2926
|
+
);
|
|
2927
|
+
}
|
|
2928
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: "$4", children: days.map((d) => /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$2", children: [
|
|
2929
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", fontWeight: "500", color: "$color11", children: d.label }),
|
|
2930
|
+
d.items.map((p) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2931
|
+
gui.XStack,
|
|
2932
|
+
{
|
|
2933
|
+
items: "center",
|
|
2934
|
+
justify: "space-between",
|
|
2935
|
+
gap: "$3",
|
|
2936
|
+
borderWidth: 1,
|
|
2937
|
+
borderColor: "$borderColor",
|
|
2938
|
+
rounded: "$4",
|
|
2939
|
+
px: "$4",
|
|
2940
|
+
py: "$3",
|
|
2941
|
+
cursor: "pointer",
|
|
2942
|
+
hoverStyle: { bg: "$color2" },
|
|
2943
|
+
onPress: () => onOpen(p),
|
|
2944
|
+
children: [
|
|
2945
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$1", flex: 1, children: [
|
|
2946
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", children: postPreview(p.content) }),
|
|
2947
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$2", items: "center", children: [
|
|
2948
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", color: "$color10", children: p.channel }),
|
|
2949
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: "$1", color: "$color10", children: [
|
|
2950
|
+
"\xB7 ",
|
|
2951
|
+
formatPostTime(p.scheduleAt ?? 0)
|
|
2952
|
+
] })
|
|
2953
|
+
] })
|
|
2954
|
+
] }),
|
|
2955
|
+
/* @__PURE__ */ jsxRuntime.jsx(StatusTag, { status: p.status })
|
|
2956
|
+
]
|
|
2957
|
+
},
|
|
2958
|
+
p.id
|
|
2959
|
+
))
|
|
2960
|
+
] }, d.label)) });
|
|
2961
|
+
}
|
|
2962
|
+
var COMPOSE_MODES = ["draft", "schedule", "now"];
|
|
2963
|
+
var COMPOSE_LABEL = {
|
|
2964
|
+
draft: "Save draft",
|
|
2965
|
+
schedule: "Schedule",
|
|
2966
|
+
now: "Publish now"
|
|
2967
|
+
};
|
|
2968
|
+
function PostComposer({
|
|
2969
|
+
channels,
|
|
2970
|
+
providers,
|
|
2971
|
+
onSubmit
|
|
2972
|
+
}) {
|
|
2973
|
+
const [content, setContent] = react.useState("");
|
|
2974
|
+
const [channel, setChannel] = react.useState(channels[0] ?? "x");
|
|
2975
|
+
const [mode, setMode] = react.useState("draft");
|
|
2976
|
+
const [scheduleAt, setScheduleAt] = react.useState("");
|
|
2977
|
+
const [saving, setSaving] = react.useState(false);
|
|
2978
|
+
const [error, setError] = react.useState(null);
|
|
2979
|
+
const cap = providers.find((p) => p.provider === channel);
|
|
2980
|
+
const unconfigured = (mode === "now" || mode === "schedule") && !!cap && !cap.credentialsConfigured;
|
|
2981
|
+
const submit = async () => {
|
|
2982
|
+
if (!content.trim()) {
|
|
2983
|
+
setError("Content is required.");
|
|
2984
|
+
return;
|
|
2985
|
+
}
|
|
2986
|
+
let status = "draft";
|
|
2987
|
+
let at = 0;
|
|
2988
|
+
if (mode === "schedule") {
|
|
2989
|
+
at = parsePostTime(scheduleAt);
|
|
2990
|
+
if (at <= Math.floor(Date.now() / 1e3)) {
|
|
2991
|
+
setError("Pick a future date and time to schedule.");
|
|
2992
|
+
return;
|
|
2993
|
+
}
|
|
2994
|
+
status = "scheduled";
|
|
2995
|
+
} else if (mode === "now") {
|
|
2996
|
+
status = "scheduled";
|
|
2997
|
+
}
|
|
2998
|
+
setSaving(true);
|
|
2999
|
+
setError(null);
|
|
3000
|
+
const message = await onSubmit({ content: content.trim(), channel, status, scheduleAt: at }, mode);
|
|
3001
|
+
if (message) {
|
|
3002
|
+
setError(message);
|
|
3003
|
+
setSaving(false);
|
|
3004
|
+
}
|
|
3005
|
+
};
|
|
3006
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$3", p: "$4", children: [
|
|
3007
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Content", children: /* @__PURE__ */ jsxRuntime.jsx(FieldTextArea, { value: content, onChange: setContent, disabled: saving }) }),
|
|
3008
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Channel", children: /* @__PURE__ */ jsxRuntime.jsx(FieldSelect, { value: channel, options: channels, onChange: setChannel, disabled: saving }) }),
|
|
3009
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "When", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3010
|
+
FieldSelect,
|
|
3011
|
+
{
|
|
3012
|
+
value: mode,
|
|
3013
|
+
options: [...COMPOSE_MODES],
|
|
3014
|
+
onChange: (v) => setMode(v),
|
|
3015
|
+
disabled: saving
|
|
3016
|
+
}
|
|
3017
|
+
) }),
|
|
3018
|
+
mode === "schedule" ? /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Schedule at", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3019
|
+
FieldText,
|
|
3020
|
+
{
|
|
3021
|
+
value: scheduleAt,
|
|
3022
|
+
onChange: setScheduleAt,
|
|
3023
|
+
placeholder: "2026-07-15 09:00",
|
|
3024
|
+
disabled: saving
|
|
3025
|
+
}
|
|
3026
|
+
) }) : null,
|
|
3027
|
+
unconfigured ? /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "flex-start", gap: "$2", children: [
|
|
3028
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.AlertTriangle, { size: 14, color: "var(--yellow10)" }),
|
|
3029
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: "$1", color: "$color10", children: [
|
|
3030
|
+
channel,
|
|
3031
|
+
" isn\u2019t configured to publish yet \u2014 needs ",
|
|
3032
|
+
cap?.missingCredentials.join(", "),
|
|
3033
|
+
". The post is saved and marked failed on publish until credentials are supplied."
|
|
3034
|
+
] })
|
|
3035
|
+
] }) : null,
|
|
3036
|
+
error ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$red10", children: error }) : null,
|
|
3037
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onPress: submit, disabled: saving, children: saving ? "Working\u2026" : COMPOSE_LABEL[mode] })
|
|
3038
|
+
] });
|
|
3039
|
+
}
|
|
3040
|
+
function ProviderReadinessList({ providers }) {
|
|
3041
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$2", children: [
|
|
3042
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color10", children: "Network publish-readiness" }),
|
|
3043
|
+
providers.map((p) => /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", justify: "space-between", gap: "$3", py: "$1", children: [
|
|
3044
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", children: [
|
|
3045
|
+
p.credentialsConfigured ? /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.CheckCircle2, { size: 14, color: "var(--green10)" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.AlertTriangle, { size: 14, color: "var(--yellow10)" }),
|
|
3046
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", children: p.provider })
|
|
3047
|
+
] }),
|
|
3048
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", color: "$color10", children: p.credentialsConfigured ? "Ready" : `needs ${p.missingCredentials.join(", ")}` })
|
|
3049
|
+
] }, p.provider))
|
|
3050
|
+
] });
|
|
3051
|
+
}
|
|
3052
|
+
function SocialSummaryBar({ summary }) {
|
|
3053
|
+
const cells = [
|
|
3054
|
+
{ label: "Posts", value: summary.posts },
|
|
3055
|
+
{ label: "Scheduled", value: summary.scheduled },
|
|
3056
|
+
{ label: "Published", value: summary.published },
|
|
3057
|
+
{ label: "Accounts", value: summary.accounts }
|
|
3058
|
+
];
|
|
3059
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { gap: "$3", flexWrap: "wrap", children: cells.map((c) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3060
|
+
gui.YStack,
|
|
3061
|
+
{
|
|
3062
|
+
gap: "$1",
|
|
3063
|
+
borderWidth: 1,
|
|
3064
|
+
borderColor: "$borderColor",
|
|
3065
|
+
rounded: "$4",
|
|
3066
|
+
px: "$4",
|
|
3067
|
+
py: "$3",
|
|
3068
|
+
minW: 140,
|
|
3069
|
+
children: [
|
|
3070
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", color: "$color10", children: c.label }),
|
|
3071
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$6", fontWeight: "500", className: "hz-tnum", children: c.value })
|
|
3072
|
+
]
|
|
3073
|
+
},
|
|
3074
|
+
c.label
|
|
3075
|
+
)) });
|
|
3076
|
+
}
|
|
3077
|
+
var OPTIONS = [
|
|
3078
|
+
{ id: "list", label: "List", icon: lucideIcons2.List },
|
|
3079
|
+
{ id: "calendar", label: "Calendar", icon: lucideIcons2.Calendar }
|
|
3080
|
+
];
|
|
3081
|
+
function ViewToggle({
|
|
3082
|
+
view,
|
|
3083
|
+
onChange
|
|
3084
|
+
}) {
|
|
3085
|
+
return /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", overflow: "hidden", children: OPTIONS.map((o) => {
|
|
3086
|
+
const Icon = o.icon;
|
|
3087
|
+
const active = view === o.id;
|
|
3088
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3089
|
+
gui.XStack,
|
|
3090
|
+
{
|
|
3091
|
+
items: "center",
|
|
3092
|
+
gap: "$2",
|
|
3093
|
+
px: "$3",
|
|
3094
|
+
py: "$2",
|
|
3095
|
+
cursor: "pointer",
|
|
3096
|
+
bg: active ? "$color4" : "transparent",
|
|
3097
|
+
hoverStyle: { bg: active ? "$color4" : "$color2" },
|
|
3098
|
+
onPress: () => onChange(o.id),
|
|
3099
|
+
children: [
|
|
3100
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 14 }),
|
|
3101
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", fontWeight: active ? "500" : "400", children: o.label })
|
|
3102
|
+
]
|
|
3103
|
+
},
|
|
3104
|
+
o.id
|
|
3105
|
+
);
|
|
3106
|
+
}) });
|
|
3107
|
+
}
|
|
3108
|
+
var POST_COLUMNS = [
|
|
3109
|
+
{ key: "content", header: "Post", render: (p) => postPreview(p.content) },
|
|
3110
|
+
{ key: "channel", header: "Channel", render: (p) => p.channel || "\u2014" },
|
|
3111
|
+
{ key: "status", header: "Status", render: (p) => /* @__PURE__ */ jsxRuntime.jsx(StatusTag, { status: p.status }) },
|
|
3112
|
+
{ key: "scheduleAt", header: "Scheduled", render: (p) => formatPostTime(p.scheduleAt) }
|
|
3113
|
+
];
|
|
3114
|
+
var ACCOUNT_COLUMNS = [
|
|
3115
|
+
{ key: "handle", header: "Account", render: (a) => a.handle || "\u2014" },
|
|
3116
|
+
{ key: "provider", header: "Network", render: (a) => a.provider || "\u2014" },
|
|
3117
|
+
{ key: "status", header: "Status", render: (a) => /* @__PURE__ */ jsxRuntime.jsx(StatusTag, { status: a.status }) }
|
|
3118
|
+
];
|
|
3119
|
+
function PostDetail({ api, post, onChanged }) {
|
|
3120
|
+
const [publishing, setPublishing] = react.useState(false);
|
|
3121
|
+
const [error, setError] = react.useState(null);
|
|
3122
|
+
const canPublish = post.status === "draft" || post.status === "scheduled" || post.status === "failed";
|
|
3123
|
+
const publish = async () => {
|
|
3124
|
+
setPublishing(true);
|
|
3125
|
+
setError(null);
|
|
3126
|
+
try {
|
|
3127
|
+
await api.posts.publish(post.id);
|
|
3128
|
+
onChanged();
|
|
3129
|
+
} catch (e) {
|
|
3130
|
+
setError(classifyBackend(e).message || "Publish failed.");
|
|
3131
|
+
} finally {
|
|
3132
|
+
setPublishing(false);
|
|
3133
|
+
}
|
|
3134
|
+
};
|
|
3135
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$3", p: "$4", children: [
|
|
3136
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Content", children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", children: post.content || "\u2014" }) }),
|
|
3137
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Channel", children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", children: post.channel }) }),
|
|
3138
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Status", children: /* @__PURE__ */ jsxRuntime.jsx(StatusTag, { status: post.status }) }),
|
|
3139
|
+
post.scheduleAt > 0 ? /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Scheduled", children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", children: formatPostTime(post.scheduleAt) }) }) : null,
|
|
3140
|
+
post.media.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Media", children: /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { gap: "$1", children: post.media.map((m) => /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color11", children: m }, m)) }) }) : null,
|
|
3141
|
+
post.externalId ? /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "External id", children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", className: "hz-tnum", children: post.externalId }) }) : null,
|
|
3142
|
+
post.error ? /* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Last error", children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$red10", children: post.error }) }) : null,
|
|
3143
|
+
error ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$red10", children: error }) : null,
|
|
3144
|
+
canPublish ? /* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onPress: publish, disabled: publishing, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Send, { size: 16 }), children: publishing ? "Publishing\u2026" : "Publish now" }) : null
|
|
3145
|
+
] });
|
|
3146
|
+
}
|
|
3147
|
+
function ConnectAccount({
|
|
3148
|
+
api,
|
|
3149
|
+
providers,
|
|
3150
|
+
onCreated
|
|
3151
|
+
}) {
|
|
3152
|
+
const [provider, setProvider] = react.useState("x");
|
|
3153
|
+
const [handle, setHandle] = react.useState("");
|
|
3154
|
+
const [saving, setSaving] = react.useState(false);
|
|
3155
|
+
const [error, setError] = react.useState(null);
|
|
3156
|
+
const submit = async () => {
|
|
3157
|
+
setSaving(true);
|
|
3158
|
+
setError(null);
|
|
3159
|
+
try {
|
|
3160
|
+
await api.accounts.create({ provider, handle: handle.trim(), status: "connected" });
|
|
3161
|
+
onCreated();
|
|
3162
|
+
} catch (e) {
|
|
3163
|
+
setError(classifyBackend(e).message || "Failed to connect account.");
|
|
3164
|
+
} finally {
|
|
3165
|
+
setSaving(false);
|
|
3166
|
+
}
|
|
3167
|
+
};
|
|
3168
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$4", p: "$4", children: [
|
|
3169
|
+
/* @__PURE__ */ jsxRuntime.jsx(ProviderReadinessList, { providers }),
|
|
3170
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$3", children: [
|
|
3171
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Network", children: /* @__PURE__ */ jsxRuntime.jsx(FieldSelect, { value: provider, options: [...PROVIDERS], onChange: setProvider, disabled: saving }) }),
|
|
3172
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRow, { label: "Handle", children: /* @__PURE__ */ jsxRuntime.jsx(FieldText, { value: handle, onChange: setHandle, placeholder: "@hanzo", disabled: saving }) }),
|
|
3173
|
+
error ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$red10", children: error }) : null,
|
|
3174
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onPress: submit, disabled: saving, children: saving ? "Connecting\u2026" : "Connect account" })
|
|
3175
|
+
] })
|
|
3176
|
+
] });
|
|
3177
|
+
}
|
|
3178
|
+
function SocialResource({
|
|
3179
|
+
api,
|
|
3180
|
+
title = "Publish",
|
|
3181
|
+
subtitle = "Compose, schedule and publish your content across networks \u2014 per org, over the native /v1/social engine."
|
|
3182
|
+
}) {
|
|
3183
|
+
const [state, setState] = react.useState({ phase: "loading" });
|
|
3184
|
+
const [view, setView] = react.useState("list");
|
|
3185
|
+
const [composing, setComposing] = react.useState(false);
|
|
3186
|
+
const [connecting, setConnecting] = react.useState(false);
|
|
3187
|
+
const [openPost, setOpenPost] = react.useState(null);
|
|
3188
|
+
const load = react.useCallback(async () => {
|
|
3189
|
+
setState({ phase: "loading" });
|
|
3190
|
+
try {
|
|
3191
|
+
const [summary, posts2, accounts2, providers2] = await Promise.all([
|
|
3192
|
+
api.summary(),
|
|
3193
|
+
api.posts.list(),
|
|
3194
|
+
api.accounts.list(),
|
|
3195
|
+
api.providers()
|
|
3196
|
+
]);
|
|
3197
|
+
setState({ phase: "ready", data: { summary, posts: posts2, accounts: accounts2, providers: providers2 } });
|
|
3198
|
+
} catch (e) {
|
|
3199
|
+
setState({ phase: "error", error: classifyBackend(e) });
|
|
3200
|
+
}
|
|
3201
|
+
}, [api]);
|
|
3202
|
+
react.useEffect(() => {
|
|
3203
|
+
void load();
|
|
3204
|
+
}, [load]);
|
|
3205
|
+
const providers = state.phase === "ready" ? state.data.providers : [];
|
|
3206
|
+
const posts = state.phase === "ready" ? state.data.posts : [];
|
|
3207
|
+
const accounts = state.phase === "ready" ? state.data.accounts : [];
|
|
3208
|
+
const empty = state.phase === "ready" && posts.length === 0 && accounts.length === 0;
|
|
3209
|
+
const submitDraft = async (draft, mode) => {
|
|
3210
|
+
try {
|
|
3211
|
+
const created = await api.posts.create(draft);
|
|
3212
|
+
if (mode === "now" && created.status === "failed") return created.error || "Publish failed.";
|
|
3213
|
+
} catch (e) {
|
|
3214
|
+
return classifyBackend(e).message || "Failed to create post.";
|
|
3215
|
+
}
|
|
3216
|
+
setComposing(false);
|
|
3217
|
+
void load();
|
|
3218
|
+
return null;
|
|
3219
|
+
};
|
|
3220
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$4", p: "$4", children: [
|
|
3221
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3222
|
+
PageHeader,
|
|
3223
|
+
{
|
|
3224
|
+
title,
|
|
3225
|
+
subtitle,
|
|
3226
|
+
actions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3227
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onPress: () => setComposing(true), icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Plus, { size: 16 }), children: "New post" }),
|
|
3228
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onPress: () => setConnecting(true), icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Link2, { size: 16 }), children: "Connect account" }),
|
|
3229
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { onPress: () => void load(), icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.RefreshCw, { size: 16 }), children: "Refresh" })
|
|
3230
|
+
] })
|
|
3231
|
+
}
|
|
3232
|
+
),
|
|
3233
|
+
state.phase === "error" ? /* @__PURE__ */ jsxRuntime.jsx(BackendStateCard, { state: state.error, onRetry: () => void load() }) : empty ? /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$4", children: [
|
|
3234
|
+
state.phase === "ready" ? /* @__PURE__ */ jsxRuntime.jsx(SocialSummaryBar, { summary: state.data.summary }) : null,
|
|
3235
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3236
|
+
EmptyState,
|
|
3237
|
+
{
|
|
3238
|
+
icon: lucideIcons2.Share2,
|
|
3239
|
+
title: "No posts or accounts yet",
|
|
3240
|
+
description: "Connect a social account, then compose, schedule and publish across X, Instagram, LinkedIn, TikTok and more.",
|
|
3241
|
+
primary: { label: "New post", onPress: () => setComposing(true) }
|
|
3242
|
+
}
|
|
3243
|
+
)
|
|
3244
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$5", children: [
|
|
3245
|
+
state.phase === "ready" ? /* @__PURE__ */ jsxRuntime.jsx(SocialSummaryBar, { summary: state.data.summary }) : null,
|
|
3246
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$3", children: [
|
|
3247
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", justify: "space-between", gap: "$2", flexWrap: "wrap", children: [
|
|
3248
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", children: [
|
|
3249
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Send, { size: 16 }),
|
|
3250
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$5", fontWeight: "500", children: "Posts" })
|
|
3251
|
+
] }),
|
|
3252
|
+
/* @__PURE__ */ jsxRuntime.jsx(ViewToggle, { view, onChange: setView })
|
|
3253
|
+
] }),
|
|
3254
|
+
view === "list" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3255
|
+
DataTable,
|
|
3256
|
+
{
|
|
3257
|
+
columns: POST_COLUMNS,
|
|
3258
|
+
rows: posts,
|
|
3259
|
+
loading: state.phase === "loading",
|
|
3260
|
+
empty: "No posts yet.",
|
|
3261
|
+
rowKey: (p) => p.id,
|
|
3262
|
+
onRowPress: (p) => setOpenPost(p)
|
|
3263
|
+
}
|
|
3264
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(PostAgenda, { posts, onOpen: (p) => setOpenPost(p) })
|
|
3265
|
+
] }),
|
|
3266
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$2", children: [
|
|
3267
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", children: [
|
|
3268
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Link2, { size: 16 }),
|
|
3269
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$5", fontWeight: "500", children: "Accounts" })
|
|
3270
|
+
] }),
|
|
3271
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3272
|
+
DataTable,
|
|
3273
|
+
{
|
|
3274
|
+
columns: ACCOUNT_COLUMNS,
|
|
3275
|
+
rows: accounts,
|
|
3276
|
+
loading: state.phase === "loading",
|
|
3277
|
+
empty: "No accounts connected yet.",
|
|
3278
|
+
rowKey: (a) => a.id
|
|
3279
|
+
}
|
|
3280
|
+
)
|
|
3281
|
+
] })
|
|
3282
|
+
] }),
|
|
3283
|
+
/* @__PURE__ */ jsxRuntime.jsx(SlideOver, { open: composing, onClose: () => setComposing(false), title: "New post", icon: lucideIcons2.Send, ariaLabel: "New post", children: /* @__PURE__ */ jsxRuntime.jsx(PostComposer, { channels: [...PROVIDERS], providers, onSubmit: submitDraft }) }),
|
|
3284
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3285
|
+
SlideOver,
|
|
3286
|
+
{
|
|
3287
|
+
open: connecting,
|
|
3288
|
+
onClose: () => setConnecting(false),
|
|
3289
|
+
title: "Connect account",
|
|
3290
|
+
icon: lucideIcons2.Link2,
|
|
3291
|
+
ariaLabel: "Connect account",
|
|
3292
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3293
|
+
ConnectAccount,
|
|
3294
|
+
{
|
|
3295
|
+
api,
|
|
3296
|
+
providers,
|
|
3297
|
+
onCreated: () => {
|
|
3298
|
+
setConnecting(false);
|
|
3299
|
+
void load();
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
)
|
|
3303
|
+
}
|
|
3304
|
+
),
|
|
3305
|
+
/* @__PURE__ */ jsxRuntime.jsx(SlideOver, { open: openPost !== null, onClose: () => setOpenPost(null), title: "Post", icon: lucideIcons2.Send, ariaLabel: "Post detail", children: openPost ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3306
|
+
PostDetail,
|
|
3307
|
+
{
|
|
3308
|
+
api,
|
|
3309
|
+
post: openPost,
|
|
3310
|
+
onChanged: () => {
|
|
3311
|
+
setOpenPost(null);
|
|
3312
|
+
void load();
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
) : null })
|
|
3316
|
+
] });
|
|
3317
|
+
}
|
|
3318
|
+
var META = {
|
|
3319
|
+
x: { label: "X", bg: "#0f0f12", fg: "#e6e6ea", mark: "\u{1D54F}" },
|
|
3320
|
+
facebook: { label: "Facebook", bg: "#1877f2", fg: "#ffffff", mark: "f" },
|
|
3321
|
+
instagram: { label: "Instagram", bg: "#e1306c", fg: "#ffffff", mark: "IG" },
|
|
3322
|
+
linkedin: { label: "LinkedIn", bg: "#0a66c2", fg: "#ffffff", mark: "in" },
|
|
3323
|
+
tiktok: { label: "TikTok", bg: "#111114", fg: "#25f4ee", mark: "TT" },
|
|
3324
|
+
youtube: { label: "YouTube", bg: "#ff0000", fg: "#ffffff", mark: "\u25B6" },
|
|
3325
|
+
threads: { label: "Threads", bg: "#111114", fg: "#e6e6ea", mark: "@" }
|
|
3326
|
+
};
|
|
3327
|
+
function ChannelBadge({
|
|
3328
|
+
channel,
|
|
3329
|
+
showLabel = false,
|
|
3330
|
+
size = 22
|
|
3331
|
+
}) {
|
|
3332
|
+
const m = META[channel] ?? META.x;
|
|
3333
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", children: [
|
|
3334
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3335
|
+
gui.YStack,
|
|
3336
|
+
{
|
|
3337
|
+
width: size,
|
|
3338
|
+
height: size,
|
|
3339
|
+
items: "center",
|
|
3340
|
+
justify: "center",
|
|
3341
|
+
rounded: "$2",
|
|
3342
|
+
bg: m.bg,
|
|
3343
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", fontWeight: "800", color: m.fg, children: m.mark })
|
|
3344
|
+
}
|
|
3345
|
+
),
|
|
3346
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color12", children: m.label }) : null
|
|
3347
|
+
] });
|
|
3348
|
+
}
|
|
3349
|
+
var money = (cents) => `$${Math.round((cents || 0) / 100).toLocaleString()}`;
|
|
3350
|
+
function CampaignCard({ campaign }) {
|
|
3351
|
+
const pct = campaign.budget > 0 ? Math.min(100, campaign.spend / campaign.budget * 100) : 0;
|
|
3352
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.Card, { p: "$4", gap: "$3", borderWidth: 1, borderColor: "$borderColor", width: "100%", children: [
|
|
3353
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "flex-start", justify: "space-between", gap: "$2", children: [
|
|
3354
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$1", children: [
|
|
3355
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$4", fontWeight: "700", children: campaign.name }),
|
|
3356
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color11", children: campaign.channel })
|
|
3357
|
+
] }),
|
|
3358
|
+
/* @__PURE__ */ jsxRuntime.jsx(StatusTag, { status: campaign.status })
|
|
3359
|
+
] }),
|
|
3360
|
+
campaign.objective ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$2", color: "$color11", children: campaign.objective }) : null,
|
|
3361
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.YStack, { gap: "$1.5", children: [
|
|
3362
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { justify: "space-between", children: [
|
|
3363
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: "$1", color: "$color11", children: [
|
|
3364
|
+
money(campaign.spend),
|
|
3365
|
+
" spent"
|
|
3366
|
+
] }),
|
|
3367
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: "$1", color: "$color11", children: [
|
|
3368
|
+
money(campaign.budget),
|
|
3369
|
+
" budget"
|
|
3370
|
+
] })
|
|
3371
|
+
] }),
|
|
3372
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { height: 6, rounded: "$2", bg: "$color3", overflow: "hidden", children: /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { height: 6, rounded: "$2", bg: "$color9", width: `${pct}%` }) })
|
|
3373
|
+
] })
|
|
3374
|
+
] });
|
|
3375
|
+
}
|
|
3376
|
+
function PostCard({
|
|
3377
|
+
post,
|
|
3378
|
+
onEdit,
|
|
3379
|
+
onDelete
|
|
3380
|
+
}) {
|
|
3381
|
+
const mediaCount = post.media?.length ?? 0;
|
|
3382
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.Card, { p: "$3", gap: "$2.5", borderWidth: 1, borderColor: "$borderColor", width: "100%", children: [
|
|
3383
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", justify: "space-between", gap: "$2", children: [
|
|
3384
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", gap: "$2", children: [
|
|
3385
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChannelBadge, { channel: post.channel }),
|
|
3386
|
+
/* @__PURE__ */ jsxRuntime.jsx(StatusTag, { status: post.status })
|
|
3387
|
+
] }),
|
|
3388
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { gap: "$1", children: [
|
|
3389
|
+
onEdit ? /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$2", chromeless: true, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Pencil, { size: 15 }), onPress: () => onEdit(post) }) : null,
|
|
3390
|
+
onDelete ? /* @__PURE__ */ jsxRuntime.jsx(gui.Button, { size: "$2", chromeless: true, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideIcons2.Trash2, { size: 15 }), onPress: () => onDelete(post) }) : null
|
|
3391
|
+
] })
|
|
3392
|
+
] }),
|
|
3393
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$3", color: "$color12", children: post.content }),
|
|
3394
|
+
/* @__PURE__ */ jsxRuntime.jsxs(gui.XStack, { items: "center", justify: "space-between", gap: "$2", children: [
|
|
3395
|
+
post.scheduleAt ? /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontSize: "$1", color: "$color11", children: formatPostTime(post.scheduleAt) }) : /* @__PURE__ */ jsxRuntime.jsx(gui.YStack, {}),
|
|
3396
|
+
mediaCount ? /* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: "$1", color: "$color10", children: [
|
|
3397
|
+
mediaCount,
|
|
3398
|
+
" media"
|
|
3399
|
+
] }) : null
|
|
3400
|
+
] })
|
|
3401
|
+
] });
|
|
3402
|
+
}
|
|
8
3403
|
|
|
9
|
-
Object.defineProperty(exports, "AppHeader", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () { return chunkM2ILMK44_cjs.AppHeader; }
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "BarChart", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () { return chunkM2ILMK44_cjs.BarChart; }
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "BarRows", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () { return chunkM2ILMK44_cjs.BarRows; }
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(exports, "BrandMark", {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () { return chunkM2ILMK44_cjs.BrandMark; }
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "CHART_OTHER", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () { return chunkM2ILMK44_cjs.CHART_OTHER; }
|
|
28
|
-
});
|
|
29
|
-
Object.defineProperty(exports, "CHART_PALETTE", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () { return chunkM2ILMK44_cjs.CHART_PALETTE; }
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(exports, "ComboBox", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () { return chunkM2ILMK44_cjs.ComboBox; }
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(exports, "ContextMenu", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function () { return chunkM2ILMK44_cjs.ContextMenu; }
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(exports, "CustomModelMark", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
get: function () { return chunkM2ILMK44_cjs.Boxes; }
|
|
44
|
-
});
|
|
45
|
-
Object.defineProperty(exports, "DataTable", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
get: function () { return chunkM2ILMK44_cjs.DataTable; }
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(exports, "Donut", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: function () { return chunkM2ILMK44_cjs.Donut; }
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(exports, "DonutRing", {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
get: function () { return chunkM2ILMK44_cjs.Donut2; }
|
|
56
|
-
});
|
|
57
|
-
Object.defineProperty(exports, "DropdownMenu", {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
get: function () { return chunkM2ILMK44_cjs.DropdownMenu; }
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(exports, "EmptyState", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
get: function () { return chunkM2ILMK44_cjs.EmptyState; }
|
|
64
|
-
});
|
|
65
|
-
Object.defineProperty(exports, "FadeIn", {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () { return chunkM2ILMK44_cjs.FadeIn; }
|
|
68
|
-
});
|
|
69
|
-
Object.defineProperty(exports, "FieldRow", {
|
|
70
|
-
enumerable: true,
|
|
71
|
-
get: function () { return chunkM2ILMK44_cjs.FieldRow; }
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(exports, "FieldSelect", {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
get: function () { return chunkM2ILMK44_cjs.FieldSelect; }
|
|
76
|
-
});
|
|
77
|
-
Object.defineProperty(exports, "FieldSlider", {
|
|
78
|
-
enumerable: true,
|
|
79
|
-
get: function () { return chunkM2ILMK44_cjs.FieldSlider; }
|
|
80
|
-
});
|
|
81
|
-
Object.defineProperty(exports, "FieldSwitch", {
|
|
82
|
-
enumerable: true,
|
|
83
|
-
get: function () { return chunkM2ILMK44_cjs.FieldSwitch; }
|
|
84
|
-
});
|
|
85
|
-
Object.defineProperty(exports, "FieldText", {
|
|
86
|
-
enumerable: true,
|
|
87
|
-
get: function () { return chunkM2ILMK44_cjs.FieldText; }
|
|
88
|
-
});
|
|
89
|
-
Object.defineProperty(exports, "FieldTextArea", {
|
|
90
|
-
enumerable: true,
|
|
91
|
-
get: function () { return chunkM2ILMK44_cjs.FieldTextArea; }
|
|
92
|
-
});
|
|
93
|
-
Object.defineProperty(exports, "FloatingMenu", {
|
|
94
|
-
enumerable: true,
|
|
95
|
-
get: function () { return chunkM2ILMK44_cjs.FloatingMenu; }
|
|
96
|
-
});
|
|
97
|
-
Object.defineProperty(exports, "GenericLogo", {
|
|
98
|
-
enumerable: true,
|
|
99
|
-
get: function () { return chunkM2ILMK44_cjs.GenericLogo; }
|
|
100
|
-
});
|
|
101
|
-
Object.defineProperty(exports, "HanzoMark", {
|
|
102
|
-
enumerable: true,
|
|
103
|
-
get: function () { return chunkM2ILMK44_cjs.HanzoMark; }
|
|
104
|
-
});
|
|
105
|
-
Object.defineProperty(exports, "HintButton", {
|
|
106
|
-
enumerable: true,
|
|
107
|
-
get: function () { return chunkM2ILMK44_cjs.HintButton; }
|
|
108
|
-
});
|
|
109
|
-
Object.defineProperty(exports, "LegendDot", {
|
|
110
|
-
enumerable: true,
|
|
111
|
-
get: function () { return chunkM2ILMK44_cjs.LegendDot; }
|
|
112
|
-
});
|
|
113
|
-
Object.defineProperty(exports, "LineChart", {
|
|
114
|
-
enumerable: true,
|
|
115
|
-
get: function () { return chunkM2ILMK44_cjs.LineChart; }
|
|
116
|
-
});
|
|
117
|
-
Object.defineProperty(exports, "MenuItemView", {
|
|
118
|
-
enumerable: true,
|
|
119
|
-
get: function () { return chunkM2ILMK44_cjs.MenuItemView; }
|
|
120
|
-
});
|
|
121
|
-
Object.defineProperty(exports, "MenuLabelView", {
|
|
122
|
-
enumerable: true,
|
|
123
|
-
get: function () { return chunkM2ILMK44_cjs.MenuLabelView; }
|
|
124
|
-
});
|
|
125
|
-
Object.defineProperty(exports, "MenuPanel", {
|
|
126
|
-
enumerable: true,
|
|
127
|
-
get: function () { return chunkM2ILMK44_cjs.MenuPanel; }
|
|
128
|
-
});
|
|
129
|
-
Object.defineProperty(exports, "MenuSeparatorView", {
|
|
130
|
-
enumerable: true,
|
|
131
|
-
get: function () { return chunkM2ILMK44_cjs.MenuSeparatorView; }
|
|
132
|
-
});
|
|
133
|
-
Object.defineProperty(exports, "MetricCard", {
|
|
134
|
-
enumerable: true,
|
|
135
|
-
get: function () { return chunkM2ILMK44_cjs.MetricCard; }
|
|
136
|
-
});
|
|
137
|
-
Object.defineProperty(exports, "MetricSparkline", {
|
|
138
|
-
enumerable: true,
|
|
139
|
-
get: function () { return chunkM2ILMK44_cjs.Sparkline2; }
|
|
140
|
-
});
|
|
141
|
-
Object.defineProperty(exports, "MiniBars", {
|
|
142
|
-
enumerable: true,
|
|
143
|
-
get: function () { return chunkM2ILMK44_cjs.MiniBars; }
|
|
144
|
-
});
|
|
145
|
-
Object.defineProperty(exports, "OrgMark", {
|
|
146
|
-
enumerable: true,
|
|
147
|
-
get: function () { return chunkM2ILMK44_cjs.OrgMark; }
|
|
148
|
-
});
|
|
149
|
-
Object.defineProperty(exports, "OrgSwitcher", {
|
|
150
|
-
enumerable: true,
|
|
151
|
-
get: function () { return chunkM2ILMK44_cjs.OrgSwitcher; }
|
|
152
|
-
});
|
|
153
|
-
Object.defineProperty(exports, "PageHeader", {
|
|
154
|
-
enumerable: true,
|
|
155
|
-
get: function () { return chunkM2ILMK44_cjs.PageHeader; }
|
|
156
|
-
});
|
|
157
|
-
Object.defineProperty(exports, "Panel", {
|
|
158
|
-
enumerable: true,
|
|
159
|
-
get: function () { return chunkM2ILMK44_cjs.Panel; }
|
|
160
|
-
});
|
|
161
|
-
Object.defineProperty(exports, "PortalTheme", {
|
|
162
|
-
enumerable: true,
|
|
163
|
-
get: function () { return chunkM2ILMK44_cjs.PortalTheme; }
|
|
164
|
-
});
|
|
165
|
-
Object.defineProperty(exports, "PrimaryButton", {
|
|
166
|
-
enumerable: true,
|
|
167
|
-
get: function () { return chunkM2ILMK44_cjs.PrimaryButton; }
|
|
168
|
-
});
|
|
169
|
-
Object.defineProperty(exports, "ProductIcon", {
|
|
170
|
-
enumerable: true,
|
|
171
|
-
get: function () { return chunkM2ILMK44_cjs.ProductIcon; }
|
|
172
|
-
});
|
|
173
|
-
Object.defineProperty(exports, "ProviderLogo", {
|
|
174
|
-
enumerable: true,
|
|
175
|
-
get: function () { return chunkM2ILMK44_cjs.ProviderLogo; }
|
|
176
|
-
});
|
|
177
|
-
Object.defineProperty(exports, "Reorder", {
|
|
178
|
-
enumerable: true,
|
|
179
|
-
get: function () { return chunkM2ILMK44_cjs.Reorder; }
|
|
180
|
-
});
|
|
181
|
-
Object.defineProperty(exports, "SERIES", {
|
|
182
|
-
enumerable: true,
|
|
183
|
-
get: function () { return chunkM2ILMK44_cjs.SERIES; }
|
|
184
|
-
});
|
|
185
|
-
Object.defineProperty(exports, "SLIDEOVER_LG", {
|
|
186
|
-
enumerable: true,
|
|
187
|
-
get: function () { return chunkM2ILMK44_cjs.LG; }
|
|
188
|
-
});
|
|
189
|
-
Object.defineProperty(exports, "SURFACES", {
|
|
190
|
-
enumerable: true,
|
|
191
|
-
get: function () { return chunkM2ILMK44_cjs.SURFACES; }
|
|
192
|
-
});
|
|
193
|
-
Object.defineProperty(exports, "SelectMenu", {
|
|
194
|
-
enumerable: true,
|
|
195
|
-
get: function () { return chunkM2ILMK44_cjs.SelectMenu; }
|
|
196
|
-
});
|
|
197
|
-
Object.defineProperty(exports, "SlideOver", {
|
|
198
|
-
enumerable: true,
|
|
199
|
-
get: function () { return chunkM2ILMK44_cjs.SlideOver; }
|
|
200
|
-
});
|
|
201
|
-
Object.defineProperty(exports, "Sparkline", {
|
|
202
|
-
enumerable: true,
|
|
203
|
-
get: function () { return chunkM2ILMK44_cjs.Sparkline; }
|
|
204
|
-
});
|
|
205
|
-
Object.defineProperty(exports, "StatusTag", {
|
|
206
|
-
enumerable: true,
|
|
207
|
-
get: function () { return chunkM2ILMK44_cjs.StatusTag; }
|
|
208
|
-
});
|
|
209
|
-
Object.defineProperty(exports, "ToastProvider", {
|
|
210
|
-
enumerable: true,
|
|
211
|
-
get: function () { return chunkM2ILMK44_cjs.ToastProvider; }
|
|
212
|
-
});
|
|
213
|
-
Object.defineProperty(exports, "UtilBar", {
|
|
214
|
-
enumerable: true,
|
|
215
|
-
get: function () { return chunkM2ILMK44_cjs.UtilBar; }
|
|
216
|
-
});
|
|
217
|
-
Object.defineProperty(exports, "asColor", {
|
|
218
|
-
enumerable: true,
|
|
219
|
-
get: function () { return chunkM2ILMK44_cjs.asColor; }
|
|
220
|
-
});
|
|
221
|
-
Object.defineProperty(exports, "colorForIndex", {
|
|
222
|
-
enumerable: true,
|
|
223
|
-
get: function () { return chunkM2ILMK44_cjs.colorForIndex; }
|
|
224
|
-
});
|
|
225
|
-
Object.defineProperty(exports, "filterOptions", {
|
|
226
|
-
enumerable: true,
|
|
227
|
-
get: function () { return chunkM2ILMK44_cjs.filterOptions; }
|
|
228
|
-
});
|
|
229
|
-
Object.defineProperty(exports, "filterOrgs", {
|
|
230
|
-
enumerable: true,
|
|
231
|
-
get: function () { return chunkM2ILMK44_cjs.filterOrgs; }
|
|
232
|
-
});
|
|
233
|
-
Object.defineProperty(exports, "isKnownOption", {
|
|
234
|
-
enumerable: true,
|
|
235
|
-
get: function () { return chunkM2ILMK44_cjs.isKnownOption; }
|
|
236
|
-
});
|
|
237
|
-
Object.defineProperty(exports, "monogram", {
|
|
238
|
-
enumerable: true,
|
|
239
|
-
get: function () { return chunkM2ILMK44_cjs.monogram; }
|
|
240
|
-
});
|
|
241
|
-
Object.defineProperty(exports, "orgScope", {
|
|
242
|
-
enumerable: true,
|
|
243
|
-
get: function () { return chunkM2ILMK44_cjs.orgScope; }
|
|
244
|
-
});
|
|
245
|
-
Object.defineProperty(exports, "otherSurfaces", {
|
|
246
|
-
enumerable: true,
|
|
247
|
-
get: function () { return chunkM2ILMK44_cjs.otherSurfaces; }
|
|
248
|
-
});
|
|
249
|
-
Object.defineProperty(exports, "providerInitials", {
|
|
250
|
-
enumerable: true,
|
|
251
|
-
get: function () { return chunkM2ILMK44_cjs.providerInitials; }
|
|
252
|
-
});
|
|
253
|
-
Object.defineProperty(exports, "renderMenuItems", {
|
|
254
|
-
enumerable: true,
|
|
255
|
-
get: function () { return chunkM2ILMK44_cjs.renderMenuItems; }
|
|
256
|
-
});
|
|
257
|
-
Object.defineProperty(exports, "rowShift", {
|
|
258
|
-
enumerable: true,
|
|
259
|
-
get: function () { return chunkM2ILMK44_cjs.rowShift; }
|
|
260
|
-
});
|
|
261
|
-
Object.defineProperty(exports, "targetIndex", {
|
|
262
|
-
enumerable: true,
|
|
263
|
-
get: function () { return chunkM2ILMK44_cjs.targetIndex; }
|
|
264
|
-
});
|
|
265
|
-
Object.defineProperty(exports, "useToast", {
|
|
266
|
-
enumerable: true,
|
|
267
|
-
get: function () { return chunkM2ILMK44_cjs.useToast; }
|
|
268
|
-
});
|
|
269
|
-
Object.defineProperty(exports, "utilColor", {
|
|
270
|
-
enumerable: true,
|
|
271
|
-
get: function () { return chunkM2ILMK44_cjs.utilColor; }
|
|
272
|
-
});
|
|
273
3404
|
Object.defineProperty(exports, "AgnosticThemeToggle", {
|
|
274
3405
|
enumerable: true,
|
|
275
3406
|
get: function () { return chunkYBXVUV7P_cjs.AgnosticThemeToggle; }
|
|
@@ -282,5 +3413,125 @@ Object.defineProperty(exports, "ThemeToggleNext", {
|
|
|
282
3413
|
enumerable: true,
|
|
283
3414
|
get: function () { return chunkYBXVUV7P_cjs.ThemeToggleNext; }
|
|
284
3415
|
});
|
|
3416
|
+
Object.defineProperty(exports, "CustomModelMark", {
|
|
3417
|
+
enumerable: true,
|
|
3418
|
+
get: function () { return lucideIcons2.Boxes; }
|
|
3419
|
+
});
|
|
3420
|
+
exports.ACCOUNT_STATUSES = ACCOUNT_STATUSES;
|
|
3421
|
+
exports.AnimatedLogo = AnimatedLogo;
|
|
3422
|
+
exports.AppHeader = AppHeader;
|
|
3423
|
+
exports.BRANDS = BRANDS;
|
|
3424
|
+
exports.BackendStateCard = BackendStateCard;
|
|
3425
|
+
exports.BarChart = BarChart;
|
|
3426
|
+
exports.BarRows = BarRows;
|
|
3427
|
+
exports.BrandMark = BrandMark;
|
|
3428
|
+
exports.CHART_OTHER = CHART_OTHER;
|
|
3429
|
+
exports.CHART_PALETTE = CHART_PALETTE;
|
|
3430
|
+
exports.COMPOSE_MODES = COMPOSE_MODES;
|
|
3431
|
+
exports.CampaignCard = CampaignCard;
|
|
3432
|
+
exports.ChannelBadge = ChannelBadge;
|
|
3433
|
+
exports.ComboBox = ComboBox;
|
|
3434
|
+
exports.CommerceResource = CommerceResource;
|
|
3435
|
+
exports.ConfirmDelete = ConfirmDelete;
|
|
3436
|
+
exports.ContextMenu = ContextMenu;
|
|
3437
|
+
exports.DataTable = DataTable;
|
|
3438
|
+
exports.Donut = Donut;
|
|
3439
|
+
exports.DonutRing = Donut2;
|
|
3440
|
+
exports.DropdownMenu = DropdownMenu;
|
|
3441
|
+
exports.EmptyState = EmptyState;
|
|
3442
|
+
exports.FadeIn = FadeIn;
|
|
3443
|
+
exports.FieldRow = FieldRow;
|
|
3444
|
+
exports.FieldSelect = FieldSelect;
|
|
3445
|
+
exports.FieldSlider = FieldSlider;
|
|
3446
|
+
exports.FieldSwitch = FieldSwitch;
|
|
3447
|
+
exports.FieldText = FieldText;
|
|
3448
|
+
exports.FieldTextArea = FieldTextArea;
|
|
3449
|
+
exports.FloatingMenu = FloatingMenu;
|
|
3450
|
+
exports.GenericLogo = GenericLogo;
|
|
3451
|
+
exports.HANZO = HANZO;
|
|
3452
|
+
exports.HANZO_MARK_CONTENT = HANZO_MARK_CONTENT;
|
|
3453
|
+
exports.HanzoMark = HanzoMark;
|
|
3454
|
+
exports.HintButton = HintButton;
|
|
3455
|
+
exports.HostProvider = HostProvider;
|
|
3456
|
+
exports.LUX = LUX;
|
|
3457
|
+
exports.LegendDot = LegendDot;
|
|
3458
|
+
exports.LineChart = LineChart;
|
|
3459
|
+
exports.MenuItemView = MenuItemView;
|
|
3460
|
+
exports.MenuLabelView = MenuLabelView;
|
|
3461
|
+
exports.MenuPanel = MenuPanel;
|
|
3462
|
+
exports.MenuSeparatorView = MenuSeparatorView;
|
|
3463
|
+
exports.MetricCard = MetricCard;
|
|
3464
|
+
exports.MetricSparkline = Sparkline2;
|
|
3465
|
+
exports.MiniBars = MiniBars;
|
|
3466
|
+
exports.OrgMark = OrgMark;
|
|
3467
|
+
exports.OrgSwitcher = OrgSwitcher;
|
|
3468
|
+
exports.PARS = PARS;
|
|
3469
|
+
exports.POST_STATUSES = POST_STATUSES;
|
|
3470
|
+
exports.PROVIDERS = PROVIDERS;
|
|
3471
|
+
exports.PageHeader = PageHeader;
|
|
3472
|
+
exports.Panel = Panel;
|
|
3473
|
+
exports.PortalTheme = PortalTheme;
|
|
3474
|
+
exports.PostAgenda = PostAgenda;
|
|
3475
|
+
exports.PostCard = PostCard;
|
|
3476
|
+
exports.PostComposer = PostComposer;
|
|
3477
|
+
exports.PrimaryButton = PrimaryButton;
|
|
3478
|
+
exports.ProductIcon = ProductIcon;
|
|
3479
|
+
exports.ProviderLogo = ProviderLogo;
|
|
3480
|
+
exports.ProviderReadinessList = ProviderReadinessList;
|
|
3481
|
+
exports.Reorder = Reorder;
|
|
3482
|
+
exports.SERIES = SERIES;
|
|
3483
|
+
exports.SLIDEOVER_LG = LG;
|
|
3484
|
+
exports.SURFACES = SURFACES;
|
|
3485
|
+
exports.SearchInput = SearchInput;
|
|
3486
|
+
exports.Segmented = Segmented;
|
|
3487
|
+
exports.SelectMenu = SelectMenu;
|
|
3488
|
+
exports.SiteFooter = SiteFooter;
|
|
3489
|
+
exports.SiteNav = SiteNav;
|
|
3490
|
+
exports.SlideOver = SlideOver;
|
|
3491
|
+
exports.SocialResource = SocialResource;
|
|
3492
|
+
exports.SocialSummaryBar = SocialSummaryBar;
|
|
3493
|
+
exports.Sparkline = Sparkline;
|
|
3494
|
+
exports.StatusTag = StatusTag;
|
|
3495
|
+
exports.ToastProvider = ToastProvider;
|
|
3496
|
+
exports.UtilBar = UtilBar;
|
|
3497
|
+
exports.ViewToggle = ViewToggle;
|
|
3498
|
+
exports.ZOO = ZOO;
|
|
3499
|
+
exports.accentFor = accentFor;
|
|
3500
|
+
exports.asColor = asColor;
|
|
3501
|
+
exports.classifyBackend = classifyBackend;
|
|
3502
|
+
exports.classifyRead = classifyRead;
|
|
3503
|
+
exports.colorForIndex = colorForIndex;
|
|
3504
|
+
exports.contrastText = contrastText;
|
|
3505
|
+
exports.createSocialApi = createSocialApi;
|
|
3506
|
+
exports.filterOptions = filterOptions;
|
|
3507
|
+
exports.filterOrgs = filterOrgs;
|
|
3508
|
+
exports.formatPostTime = formatPostTime;
|
|
3509
|
+
exports.isHexColor = isHexColor;
|
|
3510
|
+
exports.isKnownOption = isKnownOption;
|
|
3511
|
+
exports.monogram = monogram;
|
|
3512
|
+
exports.normalizeAccount = normalizeAccount;
|
|
3513
|
+
exports.normalizeAccounts = normalizeAccounts;
|
|
3514
|
+
exports.normalizePost = normalizePost;
|
|
3515
|
+
exports.normalizePosts = normalizePosts;
|
|
3516
|
+
exports.normalizeProviderCapability = normalizeProviderCapability;
|
|
3517
|
+
exports.normalizeProviders = normalizeProviders;
|
|
3518
|
+
exports.normalizeSummary = normalizeSummary;
|
|
3519
|
+
exports.orgScope = orgScope;
|
|
3520
|
+
exports.otherSurfaces = otherSurfaces;
|
|
3521
|
+
exports.parsePostTime = parsePostTime;
|
|
3522
|
+
exports.postDayBucket = postDayBucket;
|
|
3523
|
+
exports.postPreview = postPreview;
|
|
3524
|
+
exports.providerInitials = providerInitials;
|
|
3525
|
+
exports.renderMenuItems = renderMenuItems;
|
|
3526
|
+
exports.resolveAccent = resolveAccent;
|
|
3527
|
+
exports.resolveBrand = resolveBrand;
|
|
3528
|
+
exports.rowShift = rowShift;
|
|
3529
|
+
exports.setOrgAccent = setOrgAccent;
|
|
3530
|
+
exports.targetIndex = targetIndex;
|
|
3531
|
+
exports.useAccent = useAccent;
|
|
3532
|
+
exports.useContainerWidth = useContainerWidth;
|
|
3533
|
+
exports.useHost = useHost;
|
|
3534
|
+
exports.useToast = useToast;
|
|
3535
|
+
exports.utilColor = utilColor;
|
|
285
3536
|
//# sourceMappingURL=index.cjs.map
|
|
286
3537
|
//# sourceMappingURL=index.cjs.map
|