@firetail/finchly-ux 0.0.0-stage → 0.1.1
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/README.md +267 -2
- package/dist/components/action-button.d.ts +12 -0
- package/dist/components/action-button.js +34 -0
- package/dist/components/action-button.js.map +1 -0
- package/dist/components/app-shell.d.ts +18 -0
- package/dist/components/app-shell.js +56 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/ask.d.ts +37 -0
- package/dist/components/ask.js +73 -0
- package/dist/components/ask.js.map +1 -0
- package/dist/components/bar.d.ts +11 -0
- package/dist/components/bar.js +187 -0
- package/dist/components/bar.js.map +1 -0
- package/dist/components/choosing.d.ts +18 -0
- package/dist/components/choosing.js +68 -0
- package/dist/components/choosing.js.map +1 -0
- package/dist/components/column-chart.d.ts +50 -0
- package/dist/components/column-chart.js +181 -0
- package/dist/components/column-chart.js.map +1 -0
- package/dist/components/composing.d.ts +40 -0
- package/dist/components/composing.js +101 -0
- package/dist/components/composing.js.map +1 -0
- package/dist/components/conversation.d.ts +50 -0
- package/dist/components/conversation.js +116 -0
- package/dist/components/conversation.js.map +1 -0
- package/dist/components/data-table.d.ts +43 -0
- package/dist/components/data-table.js +212 -0
- package/dist/components/data-table.js.map +1 -0
- package/dist/components/fields.d.ts +61 -0
- package/dist/components/fields.js +144 -0
- package/dist/components/fields.js.map +1 -0
- package/dist/components/file-button.d.ts +16 -0
- package/dist/components/file-button.js +39 -0
- package/dist/components/file-button.js.map +1 -0
- package/dist/components/form-dialog.d.ts +51 -0
- package/dist/components/form-dialog.js +113 -0
- package/dist/components/form-dialog.js.map +1 -0
- package/dist/components/link-button.d.ts +5 -0
- package/dist/components/link-button.js +24 -0
- package/dist/components/link-button.js.map +1 -0
- package/dist/components/link-tabs.d.ts +13 -0
- package/dist/components/link-tabs.js +26 -0
- package/dist/components/link-tabs.js.map +1 -0
- package/dist/components/markdown.d.ts +13 -0
- package/dist/components/markdown.js +132 -0
- package/dist/components/markdown.js.map +1 -0
- package/dist/components/page.d.ts +18 -0
- package/dist/components/page.js +45 -0
- package/dist/components/page.js.map +1 -0
- package/dist/components/palette.d.ts +16 -0
- package/dist/components/palette.js +27 -0
- package/dist/components/palette.js.map +1 -0
- package/dist/components/panel.d.ts +12 -0
- package/dist/components/panel.js +30 -0
- package/dist/components/panel.js.map +1 -0
- package/dist/components/pick-tile.d.ts +21 -0
- package/dist/components/pick-tile.js +40 -0
- package/dist/components/pick-tile.js.map +1 -0
- package/dist/components/provider-mark.d.ts +33 -0
- package/dist/components/provider-mark.js +58 -0
- package/dist/components/provider-mark.js.map +1 -0
- package/dist/components/provider.d.ts +17 -0
- package/dist/components/provider.js +39 -0
- package/dist/components/provider.js.map +1 -0
- package/dist/components/rows.d.ts +48 -0
- package/dist/components/rows.js +112 -0
- package/dist/components/rows.js.map +1 -0
- package/dist/components/side-nav.d.ts +23 -0
- package/dist/components/side-nav.js +41 -0
- package/dist/components/side-nav.js.map +1 -0
- package/dist/components/states.d.ts +19 -0
- package/dist/components/states.js +45 -0
- package/dist/components/states.js.map +1 -0
- package/dist/components/suggest-field.d.ts +19 -0
- package/dist/components/suggest-field.js +124 -0
- package/dist/components/suggest-field.js.map +1 -0
- package/dist/components/tag.d.ts +27 -0
- package/dist/components/tag.js +38 -0
- package/dist/components/tag.js.map +1 -0
- package/dist/components/text.d.ts +41 -0
- package/dist/components/text.js +97 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/tile.d.ts +30 -0
- package/dist/components/tile.js +68 -0
- package/dist/components/tile.js.map +1 -0
- package/dist/components/toast.d.ts +10 -0
- package/dist/components/toast.js +38 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/badge.d.ts +7 -0
- package/dist/components/ui/button.d.ts +8 -0
- package/dist/components/ui/button.js +45 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/card.d.ts +11 -0
- package/dist/components/ui/card.js +57 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +3 -0
- package/dist/components/ui/checkbox.js +20 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +24 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.js +92 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/components/ui/dropdown-menu.js +65 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/empty.d.ts +11 -0
- package/dist/components/ui/field.d.ts +24 -0
- package/dist/components/ui/field.js +89 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +16 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/label.d.ts +3 -0
- package/dist/components/ui/label.js +14 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/native-select.d.ts +8 -0
- package/dist/components/ui/native-select.js +39 -0
- package/dist/components/ui/native-select.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +27 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/separator.d.ts +3 -0
- package/dist/components/ui/separator.js +15 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +13 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +2 -0
- package/dist/components/ui/spinner.js +16 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +53 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +14 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +6 -0
- package/dist/components/ui/tooltip.js +41 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.js +56 -0
- package/dist/lib/api.d.ts +49 -0
- package/dist/lib/api.js +80 -0
- package/dist/lib/api.js.map +1 -0
- package/dist/lib/chart.d.ts +35 -0
- package/dist/lib/chart.js +86 -0
- package/dist/lib/chart.js.map +1 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.js +10 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/events.d.ts +34 -0
- package/dist/lib/events.js +72 -0
- package/dist/lib/events.js.map +1 -0
- package/dist/lib/format.d.ts +16 -0
- package/dist/lib/format.js +71 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/hash.d.ts +2 -0
- package/dist/lib/hash.js +13 -0
- package/dist/lib/hash.js.map +1 -0
- package/dist/lib/launcher.d.ts +54 -0
- package/dist/lib/launcher.js +46 -0
- package/dist/lib/launcher.js.map +1 -0
- package/dist/lib/markdown-inline.d.ts +18 -0
- package/dist/lib/markdown-inline.js +155 -0
- package/dist/lib/markdown-inline.js.map +1 -0
- package/dist/lib/markdown.d.ts +40 -0
- package/dist/lib/markdown.js +198 -0
- package/dist/lib/markdown.js.map +1 -0
- package/dist/lib/marks.d.ts +17 -0
- package/dist/lib/marks.js +56 -0
- package/dist/lib/marks.js.map +1 -0
- package/dist/lib/over.d.ts +26 -0
- package/dist/lib/over.js +38 -0
- package/dist/lib/over.js.map +1 -0
- package/dist/lib/route.d.ts +15 -0
- package/dist/lib/route.js +29 -0
- package/dist/lib/route.js.map +1 -0
- package/dist/lib/table.d.ts +43 -0
- package/dist/lib/table.js +86 -0
- package/dist/lib/table.js.map +1 -0
- package/dist/lib/theme.d.ts +12 -0
- package/dist/lib/theme.js +42 -0
- package/dist/lib/theme.js.map +1 -0
- package/eslint/index.d.ts +8 -0
- package/eslint/index.js +135 -0
- package/eslint/page-imports.js +46 -0
- package/package.json +91 -4
- package/styles/styles.css +221 -0
- package/styles/tokens.css +99 -0
- package/tsconfig.app.json +21 -0
- package/vite/index.d.ts +16 -0
- package/vite/index.js +84 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { initials } from "../lib/format.js";
|
|
2
|
+
import { signOut, useReachable } from "../lib/launcher.js";
|
|
3
|
+
import { useScheme } from "../lib/theme.js";
|
|
4
|
+
import { LinkButton } from "./link-button.js";
|
|
5
|
+
import { toast } from "./toast.js";
|
|
6
|
+
import { Button } from "./ui/button.js";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { BellIcon, LogOutIcon, MoonIcon, SunIcon } from "lucide-react";
|
|
10
|
+
// src/components/bar.tsx
|
|
11
|
+
/** The platform's mark: a small bird, drawn here so that a page needs no image. It is in the tenant's accent. */
|
|
12
|
+
function Mark() {
|
|
13
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
14
|
+
viewBox: "0 0 32 32",
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
className: "size-6.5 flex-none",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ jsx("rect", {
|
|
19
|
+
x: "0",
|
|
20
|
+
y: "0",
|
|
21
|
+
width: "32",
|
|
22
|
+
height: "32",
|
|
23
|
+
rx: "8",
|
|
24
|
+
className: "fill-primary"
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ jsx("path", {
|
|
27
|
+
d: "M7 21c0-6 4.5-10.5 10-10.5 2.2 0 4 .9 5.2 2.3L26 12l-2.4 3.2c.3.9.4 1.8.4 2.8 0 2.8-2.7 5-7 5H9.5C8 23 7 22.2 7 21z",
|
|
28
|
+
className: "fill-primary-foreground"
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ jsx("path", {
|
|
31
|
+
d: "M11 20.5c1.5-3 4-4.6 7.2-4.6-.6 3-2.9 4.9-7.2 4.6z",
|
|
32
|
+
className: "fill-primary"
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ jsx("circle", {
|
|
35
|
+
cx: "19.6",
|
|
36
|
+
cy: "14.2",
|
|
37
|
+
r: "1",
|
|
38
|
+
className: "fill-primary"
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* What the platform is called here, with its logo: the tenant's own where
|
|
45
|
+
* it has one, and one for dark pages where that differs.
|
|
46
|
+
*/
|
|
47
|
+
function Brand({ brand }) {
|
|
48
|
+
const name = brand?.name || "Finchly";
|
|
49
|
+
const logo = "h-7 w-auto max-w-40 flex-none object-contain";
|
|
50
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
51
|
+
href: "/dashboard/",
|
|
52
|
+
"aria-label": name,
|
|
53
|
+
className: "flex items-center gap-2 text-base font-bold tracking-tight text-foreground no-underline",
|
|
54
|
+
children: [brand?.logo ? brand.logoDark ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("img", {
|
|
55
|
+
src: brand.logo,
|
|
56
|
+
alt: "",
|
|
57
|
+
className: `for-light ${logo}`
|
|
58
|
+
}), /* @__PURE__ */ jsx("img", {
|
|
59
|
+
src: brand.logoDark,
|
|
60
|
+
alt: "",
|
|
61
|
+
className: `for-dark ${logo}`
|
|
62
|
+
})] }) : /* @__PURE__ */ jsx("img", {
|
|
63
|
+
src: brand.logo,
|
|
64
|
+
alt: "",
|
|
65
|
+
className: `inline-block ${logo}`
|
|
66
|
+
}) : /* @__PURE__ */ jsx(Mark, {}), /* @__PURE__ */ jsx("span", {
|
|
67
|
+
"aria-hidden": "true",
|
|
68
|
+
children: name
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
var LINK = "rounded-lg px-2.5 py-1.5 font-medium whitespace-nowrap text-muted-foreground no-underline hover:bg-muted hover:text-foreground aria-[current=page]:bg-accent aria-[current=page]:text-primary";
|
|
73
|
+
/**
|
|
74
|
+
* The bar every page has: the platform's mark, where a person can go, who
|
|
75
|
+
* they are, and the way out. AppShell draws it: a page does not.
|
|
76
|
+
*
|
|
77
|
+
* @param current which of the bar's places this page is: `dashboard`, `admin`, `schedules`, `tools`, or none of them
|
|
78
|
+
*/
|
|
79
|
+
function Bar({ current, launcher }) {
|
|
80
|
+
const { scheme, toggle } = useScheme();
|
|
81
|
+
const [leaving, setLeaving] = useState(false);
|
|
82
|
+
const name = launcher.user.name || launcher.user.email;
|
|
83
|
+
const places = [
|
|
84
|
+
[
|
|
85
|
+
"dashboard",
|
|
86
|
+
"/dashboard/",
|
|
87
|
+
"Dashboard",
|
|
88
|
+
true
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
"admin",
|
|
92
|
+
launcher.admin?.path ?? "/admin/",
|
|
93
|
+
"Admin",
|
|
94
|
+
launcher.admin !== null
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
"schedules",
|
|
98
|
+
"/schedule-service/",
|
|
99
|
+
"Workflows",
|
|
100
|
+
useReachable("schedule-service")
|
|
101
|
+
],
|
|
102
|
+
[
|
|
103
|
+
"tools",
|
|
104
|
+
"/mcp-gateway/",
|
|
105
|
+
"Tools",
|
|
106
|
+
useReachable("mcp-gateway")
|
|
107
|
+
]
|
|
108
|
+
];
|
|
109
|
+
const notifications = useReachable("notification-service");
|
|
110
|
+
const leave = async (event) => {
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
setLeaving(true);
|
|
113
|
+
try {
|
|
114
|
+
await signOut();
|
|
115
|
+
} catch {
|
|
116
|
+
setLeaving(false);
|
|
117
|
+
toast("Sign out failed. Please try again.", { danger: true });
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
121
|
+
className: "sticky top-0 z-20 flex h-14 items-center gap-3 border-b bg-card/90 px-4 sm:gap-5 sm:px-5 backdrop-blur-sm backdrop-saturate-150",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsx(Brand, { brand: launcher.brand }),
|
|
124
|
+
/* @__PURE__ */ jsx("nav", {
|
|
125
|
+
"aria-label": "Sections",
|
|
126
|
+
className: "flex min-w-0 gap-0.5 overflow-x-auto",
|
|
127
|
+
children: places.map(([id, href, label, shown]) => shown ? /* @__PURE__ */ jsx("a", {
|
|
128
|
+
href,
|
|
129
|
+
"aria-current": id === current ? "page" : void 0,
|
|
130
|
+
className: LINK,
|
|
131
|
+
children: label
|
|
132
|
+
}, id) : null)
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ jsxs("div", {
|
|
135
|
+
className: "ml-auto flex items-center gap-1 sm:gap-2",
|
|
136
|
+
children: [
|
|
137
|
+
notifications ? /* @__PURE__ */ jsx(LinkButton, {
|
|
138
|
+
variant: "ghost",
|
|
139
|
+
size: "icon",
|
|
140
|
+
href: "/notification-service/settings",
|
|
141
|
+
"aria-label": "Notifications and connections",
|
|
142
|
+
title: "Notifications and connections",
|
|
143
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
144
|
+
}) : null,
|
|
145
|
+
/* @__PURE__ */ jsx(Button, {
|
|
146
|
+
variant: "ghost",
|
|
147
|
+
size: "icon",
|
|
148
|
+
"aria-label": scheme === "dark" ? "Use the light theme" : "Use the dark theme",
|
|
149
|
+
onClick: toggle,
|
|
150
|
+
children: scheme === "dark" ? /* @__PURE__ */ jsx(SunIcon, {}) : /* @__PURE__ */ jsx(MoonIcon, {})
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ jsxs("div", {
|
|
153
|
+
title: launcher.user.email,
|
|
154
|
+
className: "flex items-center gap-2",
|
|
155
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
156
|
+
className: "grid size-7.5 flex-none place-items-center rounded-full bg-accent text-xs font-bold text-primary",
|
|
157
|
+
children: initials(name)
|
|
158
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
159
|
+
className: "hidden max-w-56 truncate font-medium text-muted-foreground sm:inline",
|
|
160
|
+
children: name
|
|
161
|
+
})]
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ jsx("form", {
|
|
164
|
+
method: "post",
|
|
165
|
+
action: "/_gateway/logout",
|
|
166
|
+
onSubmit: leave,
|
|
167
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
168
|
+
type: "submit",
|
|
169
|
+
variant: "ghost",
|
|
170
|
+
size: "sm",
|
|
171
|
+
"aria-label": "Sign out",
|
|
172
|
+
disabled: leaving,
|
|
173
|
+
children: [/* @__PURE__ */ jsx(LogOutIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
174
|
+
"aria-hidden": "true",
|
|
175
|
+
className: "hidden sm:inline",
|
|
176
|
+
children: "Sign out"
|
|
177
|
+
})]
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
})
|
|
182
|
+
]
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
export { Bar };
|
|
186
|
+
|
|
187
|
+
//# sourceMappingURL=bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bar.js","names":["_Fragment"],"sources":["../../src/components/bar.tsx"],"sourcesContent":["import { useState, type FormEvent } from \"react\";\nimport { BellIcon, LogOutIcon, MoonIcon, SunIcon } from \"lucide-react\";\nimport { initials } from \"../lib/format\";\nimport { signOut, useReachable, type Launcher } from \"../lib/launcher\";\nimport { useScheme } from \"../lib/theme\";\nimport { LinkButton } from \"./link-button\";\nimport { toast } from \"./toast\";\nimport { Button } from \"./ui/button\";\n\n/** The platform's mark: a small bird, drawn here so that a page needs no image. It is in the tenant's accent. */\nfunction Mark() {\n return (\n <svg viewBox=\"0 0 32 32\" aria-hidden=\"true\" className=\"size-6.5 flex-none\">\n <rect x=\"0\" y=\"0\" width=\"32\" height=\"32\" rx=\"8\" className=\"fill-primary\" />\n <path d=\"M7 21c0-6 4.5-10.5 10-10.5 2.2 0 4 .9 5.2 2.3L26 12l-2.4 3.2c.3.9.4 1.8.4 2.8 0 2.8-2.7 5-7 5H9.5C8 23 7 22.2 7 21z\" className=\"fill-primary-foreground\" />\n <path d=\"M11 20.5c1.5-3 4-4.6 7.2-4.6-.6 3-2.9 4.9-7.2 4.6z\" className=\"fill-primary\" />\n <circle cx=\"19.6\" cy=\"14.2\" r=\"1\" className=\"fill-primary\" />\n </svg>\n );\n}\n\n/**\n * What the platform is called here, with its logo: the tenant's own where\n * it has one, and one for dark pages where that differs.\n */\nfunction Brand({ brand }: { brand: Launcher[\"brand\"] }) {\n const name = brand?.name || \"Finchly\";\n const logo = \"h-7 w-auto max-w-40 flex-none object-contain\";\n return (\n <a href=\"/dashboard/\" aria-label={name} className=\"flex items-center gap-2 text-base font-bold tracking-tight text-foreground no-underline\">\n {brand?.logo ? (\n brand.logoDark ? (\n <>\n <img src={brand.logo} alt=\"\" className={`for-light ${logo}`} />\n <img src={brand.logoDark} alt=\"\" className={`for-dark ${logo}`} />\n </>\n ) : (\n <img src={brand.logo} alt=\"\" className={`inline-block ${logo}`} />\n )\n ) : (\n <Mark />\n )}\n <span aria-hidden=\"true\">{name}</span>\n </a>\n );\n}\n\nconst LINK = \"rounded-lg px-2.5 py-1.5 font-medium whitespace-nowrap text-muted-foreground no-underline hover:bg-muted hover:text-foreground aria-[current=page]:bg-accent aria-[current=page]:text-primary\";\n\n/**\n * The bar every page has: the platform's mark, where a person can go, who\n * they are, and the way out. AppShell draws it: a page does not.\n *\n * @param current which of the bar's places this page is: `dashboard`, `admin`, `schedules`, `tools`, or none of them\n */\nexport function Bar({ current, launcher }: { current?: string; launcher: Launcher }) {\n const { scheme, toggle } = useScheme();\n const [leaving, setLeaving] = useState(false);\n const name = launcher.user.name || launcher.user.email;\n // The built-in services with a page of their own are optional. Each has\n // its place in the menu whichever answers first.\n const places: Array<[id: string, href: string, label: string, shown: boolean]> = [\n [\"dashboard\", \"/dashboard/\", \"Dashboard\", true],\n [\"admin\", launcher.admin?.path ?? \"/admin/\", \"Admin\", launcher.admin !== null],\n [\"schedules\", \"/schedule-service/\", \"Workflows\", useReachable(\"schedule-service\")],\n [\"tools\", \"/mcp-gateway/\", \"Tools\", useReachable(\"mcp-gateway\")],\n ];\n const notifications = useReachable(\"notification-service\");\n\n // A form, so that it is a way out even where the script fails. Signing out goes on to the identity provider's own page.\n const leave = async (event: FormEvent) => {\n event.preventDefault();\n setLeaving(true);\n try {\n await signOut();\n } catch {\n setLeaving(false);\n toast(\"Sign out failed. Please try again.\", { danger: true });\n }\n };\n\n return (\n <header className=\"sticky top-0 z-20 flex h-14 items-center gap-3 border-b bg-card/90 px-4 sm:gap-5 sm:px-5 backdrop-blur-sm backdrop-saturate-150\">\n <Brand brand={launcher.brand} />\n <nav aria-label=\"Sections\" className=\"flex min-w-0 gap-0.5 overflow-x-auto\">\n {places.map(([id, href, label, shown]) =>\n shown ? (\n <a key={id} href={href} aria-current={id === current ? \"page\" : undefined} className={LINK}>\n {label}\n </a>\n ) : null,\n )}\n </nav>\n <div className=\"ml-auto flex items-center gap-1 sm:gap-2\">\n {notifications ? (\n <LinkButton variant=\"ghost\" size=\"icon\" href=\"/notification-service/settings\" aria-label=\"Notifications and connections\" title=\"Notifications and connections\">\n <BellIcon />\n </LinkButton>\n ) : null}\n <Button variant=\"ghost\" size=\"icon\" aria-label={scheme === \"dark\" ? \"Use the light theme\" : \"Use the dark theme\"} onClick={toggle}>\n {scheme === \"dark\" ? <SunIcon /> : <MoonIcon />}\n </Button>\n <div title={launcher.user.email} className=\"flex items-center gap-2\">\n <span className=\"grid size-7.5 flex-none place-items-center rounded-full bg-accent text-xs font-bold text-primary\">{initials(name)}</span>\n <span className=\"hidden max-w-56 truncate font-medium text-muted-foreground sm:inline\">{name}</span>\n </div>\n <form method=\"post\" action=\"/_gateway/logout\" onSubmit={leave}>\n <Button type=\"submit\" variant=\"ghost\" size=\"sm\" aria-label=\"Sign out\" disabled={leaving}>\n <LogOutIcon />\n <span aria-hidden=\"true\" className=\"hidden sm:inline\">\n Sign out\n </span>\n </Button>\n </form>\n </div>\n </header>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** A choice of one from a few, all in sight: which of several lists is shown, or how. */
|
|
2
|
+
export declare function Segmented<Value extends string>({ label, options, value, onChange }: {
|
|
3
|
+
label: string;
|
|
4
|
+
options: Array<[value: Value, label: string]>;
|
|
5
|
+
value: Value;
|
|
6
|
+
onChange: (value: Value) => void;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* The box a list is narrowed from. `label` says what is searched, and is
|
|
10
|
+
* what the box shows while it is empty. With `shortcut`, "/" goes to it,
|
|
11
|
+
* as it does in many places.
|
|
12
|
+
*/
|
|
13
|
+
export declare function SearchField({ label, value, onChange, shortcut }: {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
onChange: (value: string) => void;
|
|
17
|
+
shortcut?: boolean;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Input } from "./ui/input.js";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { SearchIcon } from "lucide-react";
|
|
5
|
+
// src/components/choosing.tsx
|
|
6
|
+
/** A choice of one from a few, all in sight: which of several lists is shown, or how. */
|
|
7
|
+
function Segmented({ label, options, value, onChange }) {
|
|
8
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9
|
+
role: "group",
|
|
10
|
+
"aria-label": label,
|
|
11
|
+
className: "inline-flex max-w-full flex-wrap rounded-lg border bg-muted p-0.5",
|
|
12
|
+
children: options.map(([option, name]) => /* @__PURE__ */ jsx("button", {
|
|
13
|
+
type: "button",
|
|
14
|
+
"aria-pressed": option === value,
|
|
15
|
+
onClick: () => onChange(option),
|
|
16
|
+
className: "min-h-7.5 cursor-pointer rounded-md px-3 text-sm font-semibold text-muted-foreground aria-pressed:bg-card aria-pressed:text-foreground aria-pressed:shadow-sm",
|
|
17
|
+
children: name
|
|
18
|
+
}, option))
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The box a list is narrowed from. `label` says what is searched, and is
|
|
23
|
+
* what the box shows while it is empty. With `shortcut`, "/" goes to it,
|
|
24
|
+
* as it does in many places.
|
|
25
|
+
*/
|
|
26
|
+
function SearchField({ label, value, onChange, shortcut = false }) {
|
|
27
|
+
const box = useRef(null);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!shortcut) return;
|
|
30
|
+
const go = (event) => {
|
|
31
|
+
const at = document.activeElement;
|
|
32
|
+
const typing = at instanceof HTMLTextAreaElement || at instanceof HTMLInputElement || at instanceof HTMLElement && at.isContentEditable;
|
|
33
|
+
if (event.key === "/" && !typing && !event.metaKey && !event.ctrlKey) {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
box.current?.focus();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
document.addEventListener("keydown", go);
|
|
39
|
+
return () => document.removeEventListener("keydown", go);
|
|
40
|
+
}, [shortcut]);
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
42
|
+
className: "relative min-w-0 flex-1 basis-56 sm:max-w-sm",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx(SearchIcon, {
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
className: "pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-faint"
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsx(Input, {
|
|
49
|
+
ref: box,
|
|
50
|
+
type: "search",
|
|
51
|
+
"aria-label": label,
|
|
52
|
+
placeholder: label,
|
|
53
|
+
autoComplete: "off",
|
|
54
|
+
value,
|
|
55
|
+
onChange: (event) => onChange(event.target.value),
|
|
56
|
+
className: "pl-8"
|
|
57
|
+
}),
|
|
58
|
+
shortcut ? /* @__PURE__ */ jsx("kbd", {
|
|
59
|
+
"aria-hidden": "true",
|
|
60
|
+
className: "pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-sm border border-input px-1.5 font-mono text-xs text-faint",
|
|
61
|
+
children: "/"
|
|
62
|
+
}) : null
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export { SearchField, Segmented };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=choosing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choosing.js","names":[],"sources":["../../src/components/choosing.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { SearchIcon } from \"lucide-react\";\nimport { Input } from \"./ui/input\";\n\n/** A choice of one from a few, all in sight: which of several lists is shown, or how. */\nexport function Segmented<Value extends string>({ label, options, value, onChange }: { label: string; options: Array<[value: Value, label: string]>; value: Value; onChange: (value: Value) => void }) {\n return (\n <div role=\"group\" aria-label={label} className=\"inline-flex max-w-full flex-wrap rounded-lg border bg-muted p-0.5\">\n {options.map(([option, name]) => (\n <button\n key={option}\n type=\"button\"\n aria-pressed={option === value}\n onClick={() => onChange(option)}\n className=\"min-h-7.5 cursor-pointer rounded-md px-3 text-sm font-semibold text-muted-foreground aria-pressed:bg-card aria-pressed:text-foreground aria-pressed:shadow-sm\"\n >\n {name}\n </button>\n ))}\n </div>\n );\n}\n\n/**\n * The box a list is narrowed from. `label` says what is searched, and is\n * what the box shows while it is empty. With `shortcut`, \"/\" goes to it,\n * as it does in many places.\n */\nexport function SearchField({ label, value, onChange, shortcut = false }: { label: string; value: string; onChange: (value: string) => void; shortcut?: boolean }) {\n const box = useRef<HTMLInputElement>(null);\n useEffect(() => {\n if (!shortcut) return;\n const go = (event: KeyboardEvent) => {\n // Not while something is being typed somewhere else: there it is a character.\n const at = document.activeElement;\n const typing = at instanceof HTMLTextAreaElement || at instanceof HTMLInputElement || (at instanceof HTMLElement && at.isContentEditable);\n if (event.key === \"/\" && !typing && !event.metaKey && !event.ctrlKey) {\n event.preventDefault();\n box.current?.focus();\n }\n };\n document.addEventListener(\"keydown\", go);\n return () => document.removeEventListener(\"keydown\", go);\n }, [shortcut]);\n return (\n <div className=\"relative min-w-0 flex-1 basis-56 sm:max-w-sm\">\n <SearchIcon aria-hidden=\"true\" className=\"pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-faint\" />\n <Input ref={box} type=\"search\" aria-label={label} placeholder={label} autoComplete=\"off\" value={value} onChange={(event) => onChange(event.target.value)} className=\"pl-8\" />\n {shortcut ? (\n <kbd aria-hidden=\"true\" className=\"pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-sm border border-input px-1.5 font-mono text-xs text-faint\">\n /\n </kbd>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;AAKA,SAAgB,UAAgC,EAAE,OAAO,SAAS,OAAO,YAA8H;CACrM,OACE,oBAAC,OAAD;EAAK,MAAK;EAAQ,cAAY;EAAO,WAAU;EAC5C,UAAA,QAAQ,KAAK,CAAC,QAAQ,UACrB,oBAAC,UAAD;GAEE,MAAK;GACL,gBAAc,WAAW;GACzB,eAAe,SAAS,MAAM;GAC9B,WAAU;GAET,UAAA;EACK,GAPD,MAOC,CACT;CACE,CAAA;AAET;;;;;;AAOA,SAAgB,YAAY,EAAE,OAAO,OAAO,UAAU,WAAW,SAAkG;CACjK,MAAM,MAAM,OAAyB,IAAI;CACzC,gBAAgB;EACd,IAAI,CAAC,UAAU;EACf,MAAM,MAAM,UAAyB;GAEnC,MAAM,KAAK,SAAS;GACpB,MAAM,SAAS,cAAc,uBAAuB,cAAc,oBAAqB,cAAc,eAAe,GAAG;GACvH,IAAI,MAAM,QAAQ,OAAO,CAAC,UAAU,CAAC,MAAM,WAAW,CAAC,MAAM,SAAS;IACpE,MAAM,eAAe;IACrB,IAAI,SAAS,MAAM;GACrB;EACF;EACA,SAAS,iBAAiB,WAAW,EAAE;EACvC,aAAa,SAAS,oBAAoB,WAAW,EAAE;CACzD,GAAG,CAAC,QAAQ,CAAC;CACb,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,oBAAC,YAAD;IAAY,eAAY;IAAO,WAAU;GAAoF,CAAA;GAC7H,oBAAC,OAAD;IAAO,KAAK;IAAK,MAAK;IAAS,cAAY;IAAO,aAAa;IAAO,cAAa;IAAa;IAAO,WAAW,UAAU,SAAS,MAAM,OAAO,KAAK;IAAG,WAAU;GAAQ,CAAA;GAC3K,WACC,oBAAC,OAAD;IAAK,eAAY;IAAO,WAAU;IAAmI,UAAA;GAEhK,CAAA,IACH;EACD;;AAET"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** One mark of a chart: what it is of, its figure, and a line more about it for whoever asks. */
|
|
3
|
+
export interface ChartPoint {
|
|
4
|
+
key: string;
|
|
5
|
+
/** What it is of, briefly: a day. */
|
|
6
|
+
label: string;
|
|
7
|
+
value: number;
|
|
8
|
+
/** A line more, said with the figure: what else was counted that day. */
|
|
9
|
+
detail?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One measure over time: a thin column for each point, from one
|
|
13
|
+
* baseline. The point under the pointer says its figure, and so does
|
|
14
|
+
* each point reached with the arrow keys. A chart is not the only way to
|
|
15
|
+
* the figures: put a table of them beside it.
|
|
16
|
+
*
|
|
17
|
+
* @param label what is shown, said to someone who cannot see it: "Cost by day"
|
|
18
|
+
* @param said a figure in full, for the point being read
|
|
19
|
+
* @param axis a figure briefly, for the axis. `said`, where it is left out
|
|
20
|
+
*/
|
|
21
|
+
export declare function ColumnChart({ label, points, said, axis }: {
|
|
22
|
+
label: string;
|
|
23
|
+
points: ChartPoint[];
|
|
24
|
+
said: (value: number) => string;
|
|
25
|
+
axis?: (value: number) => string;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
/** Headline figures, side by side: as many to a row as fit. */
|
|
28
|
+
export declare function Stats({ children }: {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* One headline figure: what it is, the figure, and a line under it where
|
|
33
|
+
* there is something to add. `lead` is the one figure a page leads with.
|
|
34
|
+
*/
|
|
35
|
+
export declare function Stat({ label, value, note, lead }: {
|
|
36
|
+
label: string;
|
|
37
|
+
value: ReactNode;
|
|
38
|
+
note?: ReactNode;
|
|
39
|
+
lead?: boolean;
|
|
40
|
+
}): import("react").JSX.Element;
|
|
41
|
+
/**
|
|
42
|
+
* How much one thing is beside the largest of its kind: a bar, with its
|
|
43
|
+
* figure after it. For a column of a table that breaks a total down.
|
|
44
|
+
*
|
|
45
|
+
* @param share from 0 to 1. Anything at all is drawn, however small
|
|
46
|
+
*/
|
|
47
|
+
export declare function ShareBar({ share, children }: {
|
|
48
|
+
share: number;
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { columnPath, columns, namedPlaces, stepped } from "../lib/chart.js";
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/column-chart.tsx
|
|
6
|
+
/**
|
|
7
|
+
* One measure over time: a thin column for each point, from one
|
|
8
|
+
* baseline. The point under the pointer says its figure, and so does
|
|
9
|
+
* each point reached with the arrow keys. A chart is not the only way to
|
|
10
|
+
* the figures: put a table of them beside it.
|
|
11
|
+
*
|
|
12
|
+
* @param label what is shown, said to someone who cannot see it: "Cost by day"
|
|
13
|
+
* @param said a figure in full, for the point being read
|
|
14
|
+
* @param axis a figure briefly, for the axis. `said`, where it is left out
|
|
15
|
+
*/
|
|
16
|
+
function ColumnChart({ label, points, said, axis = said }) {
|
|
17
|
+
const drawing = useRef(null);
|
|
18
|
+
const tip = useRef(null);
|
|
19
|
+
const [width, setWidth] = useState(260);
|
|
20
|
+
const [active, setActive] = useState(-1);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const node = drawing.current;
|
|
23
|
+
if (!node) return void 0;
|
|
24
|
+
const measure = () => setWidth(Math.max(260, Math.floor(node.clientWidth)));
|
|
25
|
+
measure();
|
|
26
|
+
if (typeof ResizeObserver === "undefined") return void 0;
|
|
27
|
+
const watching = new ResizeObserver(measure);
|
|
28
|
+
watching.observe(node);
|
|
29
|
+
return () => watching.disconnect();
|
|
30
|
+
}, []);
|
|
31
|
+
const at = columns(width, points.length, Math.max(0, ...points.map((point) => point.value)));
|
|
32
|
+
const named = new Set(namedPlaces(points.length, width < 420 ? 4 : 6));
|
|
33
|
+
const read = active >= 0 ? points[active] : void 0;
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
|
+
const node = tip.current;
|
|
36
|
+
if (!node || active < 0) return;
|
|
37
|
+
const centre = at.left + (active + .5) * at.band;
|
|
38
|
+
const value = points[active]?.value ?? 0;
|
|
39
|
+
node.style.left = `${Math.min(Math.max(centre - node.offsetWidth / 2, 0), Math.max(0, width - node.offsetWidth))}px`;
|
|
40
|
+
node.style.top = `${Math.max(0, at.y(value) - node.offsetHeight - 8)}px`;
|
|
41
|
+
});
|
|
42
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
role: "group",
|
|
44
|
+
tabIndex: 0,
|
|
45
|
+
"aria-label": `${label}. The left and right arrow keys read each one.`,
|
|
46
|
+
onFocus: () => setActive((before) => before >= 0 ? before : points.length - 1),
|
|
47
|
+
onBlur: () => setActive(-1),
|
|
48
|
+
onKeyDown: (event) => {
|
|
49
|
+
if (event.key === "Escape") return setActive(-1);
|
|
50
|
+
const next = stepped(event.key, active, points.length);
|
|
51
|
+
if (next === null) return void 0;
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
return setActive(next);
|
|
54
|
+
},
|
|
55
|
+
className: "relative outline-offset-4",
|
|
56
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
57
|
+
ref: drawing,
|
|
58
|
+
className: "w-full",
|
|
59
|
+
onPointerLeave: () => setActive(-1),
|
|
60
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
width: at.width,
|
|
63
|
+
height: at.height,
|
|
64
|
+
viewBox: `0 0 ${at.width} ${at.height}`,
|
|
65
|
+
className: "block",
|
|
66
|
+
children: [
|
|
67
|
+
at.ticks.map((tick) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
|
|
68
|
+
x1: at.left,
|
|
69
|
+
x2: at.right,
|
|
70
|
+
y1: at.y(tick),
|
|
71
|
+
y2: at.y(tick),
|
|
72
|
+
className: tick === 0 ? "stroke-input" : "stroke-border"
|
|
73
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
74
|
+
x: at.left - 8,
|
|
75
|
+
y: at.y(tick) + 4,
|
|
76
|
+
textAnchor: "end",
|
|
77
|
+
className: "fill-faint text-xs tabular-nums",
|
|
78
|
+
children: axis(tick)
|
|
79
|
+
})] }, tick)),
|
|
80
|
+
points.map((point, index) => named.has(index) ? /* @__PURE__ */ jsx("text", {
|
|
81
|
+
x: at.left + (index + .5) * at.band,
|
|
82
|
+
y: at.height - 8,
|
|
83
|
+
textAnchor: index === 0 ? "start" : index === points.length - 1 ? "end" : "middle",
|
|
84
|
+
className: "fill-faint text-xs tabular-nums",
|
|
85
|
+
children: point.label
|
|
86
|
+
}, point.key) : null),
|
|
87
|
+
points.map((point, index) => {
|
|
88
|
+
const outline = columnPath(at, index, point.value);
|
|
89
|
+
return outline ? /* @__PURE__ */ jsx("path", {
|
|
90
|
+
d: outline,
|
|
91
|
+
className: cn("fill-chart", index === active && "chart-on")
|
|
92
|
+
}, point.key) : null;
|
|
93
|
+
}),
|
|
94
|
+
points.map((point, index) => /* @__PURE__ */ jsx("rect", {
|
|
95
|
+
x: at.left + index * at.band,
|
|
96
|
+
y: at.top,
|
|
97
|
+
width: at.band,
|
|
98
|
+
height: at.base - at.top,
|
|
99
|
+
className: "fill-transparent",
|
|
100
|
+
onPointerEnter: () => setActive(index)
|
|
101
|
+
}, point.key))
|
|
102
|
+
]
|
|
103
|
+
})
|
|
104
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
105
|
+
ref: tip,
|
|
106
|
+
role: "status",
|
|
107
|
+
hidden: !read,
|
|
108
|
+
className: "pointer-events-none absolute z-10 grid gap-0.5 rounded-lg border bg-popover px-2.5 py-1.5 text-sm whitespace-nowrap text-popover-foreground shadow-md",
|
|
109
|
+
children: read ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
110
|
+
/* @__PURE__ */ jsx("strong", {
|
|
111
|
+
className: "text-base",
|
|
112
|
+
children: said(read.value)
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ jsx("span", {
|
|
115
|
+
className: "text-muted-foreground",
|
|
116
|
+
children: read.label
|
|
117
|
+
}),
|
|
118
|
+
read.detail ? /* @__PURE__ */ jsx("span", {
|
|
119
|
+
className: "text-xs text-faint",
|
|
120
|
+
children: read.detail
|
|
121
|
+
}) : null
|
|
122
|
+
] }) : null
|
|
123
|
+
})]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/** Headline figures, side by side: as many to a row as fit. */
|
|
127
|
+
function Stats({ children }) {
|
|
128
|
+
return /* @__PURE__ */ jsx("dl", {
|
|
129
|
+
className: "grid grid-cols-[repeat(auto-fit,minmax(9.5rem,1fr))] gap-3",
|
|
130
|
+
children
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* One headline figure: what it is, the figure, and a line under it where
|
|
135
|
+
* there is something to add. `lead` is the one figure a page leads with.
|
|
136
|
+
*/
|
|
137
|
+
function Stat({ label, value, note, lead = false }) {
|
|
138
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
139
|
+
className: cn("grid min-w-0 content-start gap-0.5 rounded-xl border bg-card px-4 py-3.5", lead && "col-span-full sm:col-span-2"),
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ jsx("dt", {
|
|
142
|
+
className: "text-sm text-muted-foreground",
|
|
143
|
+
children: label
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ jsx("dd", {
|
|
146
|
+
className: cn("font-semibold tracking-tight wrap-anywhere", lead ? "text-4xl leading-tight sm:text-5xl" : "text-2xl"),
|
|
147
|
+
children: value
|
|
148
|
+
}),
|
|
149
|
+
note ? /* @__PURE__ */ jsx("dd", {
|
|
150
|
+
className: "text-xs text-faint",
|
|
151
|
+
children: note
|
|
152
|
+
}) : null
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* How much one thing is beside the largest of its kind: a bar, with its
|
|
158
|
+
* figure after it. For a column of a table that breaks a total down.
|
|
159
|
+
*
|
|
160
|
+
* @param share from 0 to 1. Anything at all is drawn, however small
|
|
161
|
+
*/
|
|
162
|
+
function ShareBar({ share, children }) {
|
|
163
|
+
const long = share > 0 ? Math.min(100, Math.max(1, share * 100)) : 0;
|
|
164
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
165
|
+
className: "inline-flex min-w-0 items-center gap-2.5 whitespace-nowrap",
|
|
166
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
167
|
+
"aria-hidden": "true",
|
|
168
|
+
className: "inline-block h-2 w-40 max-w-[60%] flex-none overflow-hidden rounded-sm bg-muted",
|
|
169
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
170
|
+
style: { width: `${long.toFixed(2)}%` },
|
|
171
|
+
className: "block h-full rounded-r-sm bg-chart"
|
|
172
|
+
})
|
|
173
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
174
|
+
className: "font-semibold tabular-nums",
|
|
175
|
+
children
|
|
176
|
+
})]
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
export { ColumnChart, ShareBar, Stat, Stats };
|
|
180
|
+
|
|
181
|
+
//# sourceMappingURL=column-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column-chart.js","names":["_Fragment"],"sources":["../../src/components/column-chart.tsx"],"sourcesContent":["import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { columnPath, columns, namedPlaces, stepped } from \"../lib/chart\";\n\n/** One mark of a chart: what it is of, its figure, and a line more about it for whoever asks. */\nexport interface ChartPoint {\n key: string;\n /** What it is of, briefly: a day. */\n label: string;\n value: number;\n /** A line more, said with the figure: what else was counted that day. */\n detail?: string;\n}\n\n/**\n * One measure over time: a thin column for each point, from one\n * baseline. The point under the pointer says its figure, and so does\n * each point reached with the arrow keys. A chart is not the only way to\n * the figures: put a table of them beside it.\n *\n * @param label what is shown, said to someone who cannot see it: \"Cost by day\"\n * @param said a figure in full, for the point being read\n * @param axis a figure briefly, for the axis. `said`, where it is left out\n */\nexport function ColumnChart({ label, points, said, axis = said }: { label: string; points: ChartPoint[]; said: (value: number) => string; axis?: (value: number) => string }) {\n const drawing = useRef<HTMLDivElement>(null);\n const tip = useRef<HTMLDivElement>(null);\n const [width, setWidth] = useState(260);\n const [active, setActive] = useState(-1);\n\n // Drawn at the size it is shown at, so that its text is the size text is, and again when that changes.\n useEffect(() => {\n const node = drawing.current;\n if (!node) return undefined;\n const measure = () => setWidth(Math.max(260, Math.floor(node.clientWidth)));\n measure();\n if (typeof ResizeObserver === \"undefined\") return undefined;\n const watching = new ResizeObserver(measure);\n watching.observe(node);\n return () => watching.disconnect();\n }, []);\n\n const at = columns(width, points.length, Math.max(0, ...points.map((point) => point.value)));\n const named = new Set(namedPlaces(points.length, width < 420 ? 4 : 6));\n const read = active >= 0 ? points[active] : undefined;\n\n // The figure stands over its column, and stays inside the chart at either end.\n useLayoutEffect(() => {\n const node = tip.current;\n if (!node || active < 0) return;\n const centre = at.left + (active + 0.5) * at.band;\n const value = points[active]?.value ?? 0;\n node.style.left = `${Math.min(Math.max(centre - node.offsetWidth / 2, 0), Math.max(0, width - node.offsetWidth))}px`;\n node.style.top = `${Math.max(0, at.y(value) - node.offsetHeight - 8)}px`;\n });\n\n return (\n <div\n role=\"group\"\n tabIndex={0}\n aria-label={`${label}. The left and right arrow keys read each one.`}\n onFocus={() => setActive((before) => (before >= 0 ? before : points.length - 1))}\n onBlur={() => setActive(-1)}\n onKeyDown={(event) => {\n if (event.key === \"Escape\") return setActive(-1);\n const next = stepped(event.key, active, points.length);\n if (next === null) return undefined;\n event.preventDefault();\n return setActive(next);\n }}\n className=\"relative outline-offset-4\"\n >\n <div ref={drawing} className=\"w-full\" onPointerLeave={() => setActive(-1)}>\n <svg aria-hidden=\"true\" width={at.width} height={at.height} viewBox={`0 0 ${at.width} ${at.height}`} className=\"block\">\n {at.ticks.map((tick) => (\n <g key={tick}>\n <line x1={at.left} x2={at.right} y1={at.y(tick)} y2={at.y(tick)} className={tick === 0 ? \"stroke-input\" : \"stroke-border\"} />\n <text x={at.left - 8} y={at.y(tick) + 4} textAnchor=\"end\" className=\"fill-faint text-xs tabular-nums\">\n {axis(tick)}\n </text>\n </g>\n ))}\n {points.map((point, index) =>\n named.has(index) ? (\n <text key={point.key} x={at.left + (index + 0.5) * at.band} y={at.height - 8} textAnchor={index === 0 ? \"start\" : index === points.length - 1 ? \"end\" : \"middle\"} className=\"fill-faint text-xs tabular-nums\">\n {point.label}\n </text>\n ) : null,\n )}\n {points.map((point, index) => {\n const outline = columnPath(at, index, point.value);\n return outline ? <path key={point.key} d={outline} className={cn(\"fill-chart\", index === active && \"chart-on\")} /> : null;\n })}\n {/* What the pointer aims at is the whole of a point's place, not the few pixels of its column. */}\n {points.map((point, index) => (\n <rect key={point.key} x={at.left + index * at.band} y={at.top} width={at.band} height={at.base - at.top} className=\"fill-transparent\" onPointerEnter={() => setActive(index)} />\n ))}\n </svg>\n </div>\n {/* The figure leads, and what it is of follows: whoever is reading has the day, and wants the number. */}\n <div ref={tip} role=\"status\" hidden={!read} className=\"pointer-events-none absolute z-10 grid gap-0.5 rounded-lg border bg-popover px-2.5 py-1.5 text-sm whitespace-nowrap text-popover-foreground shadow-md\">\n {read ? (\n <>\n <strong className=\"text-base\">{said(read.value)}</strong>\n <span className=\"text-muted-foreground\">{read.label}</span>\n {read.detail ? <span className=\"text-xs text-faint\">{read.detail}</span> : null}\n </>\n ) : null}\n </div>\n </div>\n );\n}\n\n/** Headline figures, side by side: as many to a row as fit. */\nexport function Stats({ children }: { children: ReactNode }) {\n return <dl className=\"grid grid-cols-[repeat(auto-fit,minmax(9.5rem,1fr))] gap-3\">{children}</dl>;\n}\n\n/**\n * One headline figure: what it is, the figure, and a line under it where\n * there is something to add. `lead` is the one figure a page leads with.\n */\nexport function Stat({ label, value, note, lead = false }: { label: string; value: ReactNode; note?: ReactNode; lead?: boolean }) {\n return (\n <div className={cn(\"grid min-w-0 content-start gap-0.5 rounded-xl border bg-card px-4 py-3.5\", lead && \"col-span-full sm:col-span-2\")}>\n <dt className=\"text-sm text-muted-foreground\">{label}</dt>\n <dd className={cn(\"font-semibold tracking-tight wrap-anywhere\", lead ? \"text-4xl leading-tight sm:text-5xl\" : \"text-2xl\")}>{value}</dd>\n {note ? <dd className=\"text-xs text-faint\">{note}</dd> : null}\n </div>\n );\n}\n\n/**\n * How much one thing is beside the largest of its kind: a bar, with its\n * figure after it. For a column of a table that breaks a total down.\n *\n * @param share from 0 to 1. Anything at all is drawn, however small\n */\nexport function ShareBar({ share, children }: { share: number; children: ReactNode }) {\n const long = share > 0 ? Math.min(100, Math.max(1, share * 100)) : 0;\n return (\n <span className=\"inline-flex min-w-0 items-center gap-2.5 whitespace-nowrap\">\n {/* For the eye: the figure after it is what is read out. */}\n <span aria-hidden=\"true\" className=\"inline-block h-2 w-40 max-w-[60%] flex-none overflow-hidden rounded-sm bg-muted\">\n <span style={{ width: `${long.toFixed(2)}%` }} className=\"block h-full rounded-r-sm bg-chart\" />\n </span>\n <span className=\"font-semibold tabular-nums\">{children}</span>\n </span>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactNode, Ref } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* One box to write in: the words, and under them what to start from
|
|
4
|
+
* (`footer`) and the way to send it. Enter sends; Shift and Enter is a
|
|
5
|
+
* new line. Nothing is sent while it is empty, or `busy`.
|
|
6
|
+
*
|
|
7
|
+
* @param attached what goes with what is written, such as files, drawn under the words
|
|
8
|
+
* @param withNothing whether there is something to send though nothing is written: files that are attached
|
|
9
|
+
* @param onFiles called with files pasted where the words are written, for a page that takes them
|
|
10
|
+
*/
|
|
11
|
+
export declare function Composer({ label, placeholder, value, onChange, onSubmit, busy, action, busyAction, maxLength, footer, inputRef, attached, withNothing, onFiles, }: {
|
|
12
|
+
label: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
value: string;
|
|
15
|
+
onChange: (value: string) => void;
|
|
16
|
+
onSubmit: (text: string) => void;
|
|
17
|
+
busy?: boolean;
|
|
18
|
+
action?: string;
|
|
19
|
+
/** What the button says while `busy`. */
|
|
20
|
+
busyAction?: string;
|
|
21
|
+
maxLength?: number;
|
|
22
|
+
footer?: ReactNode;
|
|
23
|
+
inputRef?: Ref<HTMLTextAreaElement>;
|
|
24
|
+
attached?: ReactNode;
|
|
25
|
+
withNothing?: boolean;
|
|
26
|
+
onFiles?: (files: File[]) => void;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* A part of a page that is closed until it is asked for: a title and a
|
|
30
|
+
* line about it, which open what is beneath. What is beneath is kept
|
|
31
|
+
* while it is closed, so that something half written is still there.
|
|
32
|
+
*/
|
|
33
|
+
export declare function Expander({ title, description, icon, open, onOpenChange, children }: {
|
|
34
|
+
title: string;
|
|
35
|
+
description?: string; /** Drawn before the title. A plus, which turns as it opens, unless given. */
|
|
36
|
+
icon?: ReactNode;
|
|
37
|
+
open: boolean;
|
|
38
|
+
onOpenChange: (open: boolean) => void;
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}): import("react").JSX.Element;
|