@firetail/finchly-ux 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +54 -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 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","names":[],"sources":["../../src/components/markdown.tsx"],"sourcesContent":["import { memo, useMemo, type ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { parseMarkdown, type Align, type Block, type Inline } from \"../lib/markdown\";\n\n/** What marks words, drawn. A link opens somewhere else, and is told nothing of where it was followed from. */\nfunction Marked({ nodes }: { nodes: Inline[] }): ReactNode {\n return nodes.map((node, place) => {\n if (typeof node === \"string\") return node;\n if (node.type === \"break\") return <br key={place} />;\n if (node.type === \"code\") {\n return (\n <code key={place} className=\"rounded-sm bg-muted px-1 py-0.5 font-mono text-[0.9em]\">\n {node.text}\n </code>\n );\n }\n if (node.type === \"link\") {\n return (\n <a key={place} href={node.href} target=\"_blank\" rel=\"noopener noreferrer\" className=\"underline underline-offset-2\">\n <Marked nodes={node.children} />\n </a>\n );\n }\n const Mark = node.type;\n return (\n <Mark key={place}>\n <Marked nodes={node.children} />\n </Mark>\n );\n });\n}\n\nconst HEADINGS = [\"h3\", \"h4\", \"h5\", \"h6\", \"h6\", \"h6\"] as const;\nconst SIZES = [\"text-xl\", \"text-lg\", \"text-base\", \"text-base\", \"text-base\", \"text-base\"];\nconst ALIGNED: Record<NonNullable<Align>, string> = { left: \"text-left\", right: \"text-right\", center: \"text-center\" };\n\n/** Blocks, one under another. */\nfunction Blocks({ blocks }: { blocks: Block[] }) {\n return blocks.map((block, place) => <Drawn key={place} block={block} />);\n}\n\n/** One block, as the element it is. */\nfunction Drawn({ block }: { block: Block }) {\n if (block.type === \"paragraph\") {\n return (\n <p>\n <Marked nodes={block.inline} />\n </p>\n );\n }\n if (block.type === \"heading\") {\n // Within a page that has its own headings: a text's first is the page's third.\n const Heading = HEADINGS[block.level - 1] ?? \"h6\";\n return (\n <Heading className={cn(\"leading-snug font-semibold not-first:mt-1.5\", SIZES[block.level - 1])}>\n <Marked nodes={block.inline} />\n </Heading>\n );\n }\n if (block.type === \"rule\") return <hr className=\"border-t\" />;\n if (block.type === \"code\") {\n return (\n // What does not fit is scrolled, and can be reached with the keys to scroll it.\n <pre tabIndex={0} data-language={block.language ? block.language.slice(0, 40) : undefined} className=\"overflow-x-auto rounded-lg border border-input bg-muted px-3 py-2.5 text-sm leading-normal wrap-normal whitespace-pre\">\n <code>{block.text}</code>\n </pre>\n );\n }\n if (block.type === \"quote\") {\n return (\n <blockquote className=\"grid gap-3 border-l-4 border-input py-0.5 pl-3 text-muted-foreground *:min-w-0\">\n <Blocks blocks={block.blocks} />\n </blockquote>\n );\n }\n if (block.type === \"list\") {\n const List = block.ordered ? \"ol\" : \"ul\";\n return (\n <List start={block.ordered && block.start !== 1 && block.start !== null ? block.start : undefined} className={cn(\"grid gap-1 pl-6 *:min-w-0\", block.ordered ? \"list-decimal\" : \"list-disc\")}>\n {block.items.map((item, place) => {\n // An item that is one line is drawn as a line, not as a paragraph within the item.\n const [first, ...rest] = item.blocks;\n return (\n <li key={place} className={cn(item.checked !== null && \"-ml-5 list-none\", rest.length > 0 && \"*:not-first:mt-1.5\")}>\n {item.checked === null ? null : <input type=\"checkbox\" disabled checked={item.checked} aria-label={item.checked ? \"Done\" : \"Not done\"} className=\"mr-2 align-middle\" />}\n {first?.type === \"paragraph\" ? <Marked nodes={first.inline} /> : first ? <Drawn block={first} /> : null}\n <Blocks blocks={rest} />\n </li>\n );\n })}\n </List>\n );\n }\n const cell = (Cell: \"th\" | \"td\", nodes: Inline[], column: number) => {\n const align = block.align[column];\n return (\n <Cell key={column} className={cn(\"border px-2.5 py-1.5 align-top wrap-normal\", Cell === \"th\" && \"bg-muted font-semibold\", align ? ALIGNED[align] : \"text-left\")}>\n <Marked nodes={nodes} />\n </Cell>\n );\n };\n return (\n // A table is wider than a narrow page: it scrolls within itself.\n <div tabIndex={0} className=\"overflow-x-auto\">\n <table className=\"border-collapse text-sm\">\n <thead>\n <tr>{block.head.map((nodes, column) => cell(\"th\", nodes, column))}</tr>\n </thead>\n <tbody>\n {block.rows.map((row, place) => (\n <tr key={place}>{row.map((nodes, column) => cell(\"td\", nodes, column))}</tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\n/**\n * Markdown, as a model writes it, shown as a page shows text: headings,\n * lists, tables, code and links. Nothing of it is ever treated as HTML.\n * A link leads only to the web or to a letter, and a picture is never\n * fetched: it is shown as a link to it.\n *\n * It can be given again with more of an answer as it arrives: what is\n * half written is drawn as far as it goes, and what was drawn before\n * stays as it is, so that reading or selecting it is not disturbed.\n */\nexport const Markdown = memo(function Markdown({ children }: { children: string | null | undefined }) {\n const blocks = useMemo(() => parseMarkdown(children), [children]);\n return (\n <div data-slot=\"markdown\" className=\"grid min-w-0 gap-3 leading-relaxed wrap-anywhere whitespace-normal *:min-w-0\">\n <Blocks blocks={blocks} />\n </div>\n );\n});\n"],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** Where a page's own content goes, below the bar. `narrow` is for a page that asks one thing. */
|
|
3
|
+
export declare function Page({ narrow, children }: {
|
|
4
|
+
narrow?: boolean;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
/** A page's title, a line about it, and what can be done from here. */
|
|
8
|
+
export declare function PageHeader({ title, lede, actions }: {
|
|
9
|
+
title: string;
|
|
10
|
+
lede?: ReactNode;
|
|
11
|
+
actions?: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
/** The title of a part of a page, with how many things it holds. `mark` is drawn before the title, to tell one kind of part from another. */
|
|
14
|
+
export declare function SectionHeader({ title, count, mark }: {
|
|
15
|
+
title: string;
|
|
16
|
+
count?: number;
|
|
17
|
+
mark?: ReactNode;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/page.tsx
|
|
4
|
+
/** Where a page's own content goes, below the bar. `narrow` is for a page that asks one thing. */
|
|
5
|
+
function Page({ narrow = false, children }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("main", {
|
|
7
|
+
className: cn("mx-auto grid gap-4.5 px-5 pb-20", narrow ? "max-w-xl pt-12" : "max-w-6xl pt-9"),
|
|
8
|
+
children
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/** A page's title, a line about it, and what can be done from here. */
|
|
12
|
+
function PageHeader({ title, lede, actions }) {
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
14
|
+
className: "mb-1.5 flex flex-wrap items-end gap-4",
|
|
15
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
16
|
+
className: "min-w-0 flex-1 basis-64",
|
|
17
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
18
|
+
className: "text-2xl leading-tight font-semibold tracking-tight",
|
|
19
|
+
children: title
|
|
20
|
+
}), lede ? /* @__PURE__ */ jsx("p", {
|
|
21
|
+
className: "mt-1.5 text-muted-foreground",
|
|
22
|
+
children: lede
|
|
23
|
+
}) : null]
|
|
24
|
+
}), actions ? /* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: "flex flex-wrap items-center gap-2",
|
|
26
|
+
children: actions
|
|
27
|
+
}) : null]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** The title of a part of a page, with how many things it holds. `mark` is drawn before the title, to tell one kind of part from another. */
|
|
31
|
+
function SectionHeader({ title, count, mark }) {
|
|
32
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
33
|
+
className: "mt-4.5 flex items-baseline gap-2.5",
|
|
34
|
+
children: [/* @__PURE__ */ jsxs("h2", {
|
|
35
|
+
className: "flex items-center gap-2 text-lg leading-tight font-semibold tracking-tight",
|
|
36
|
+
children: [mark, title]
|
|
37
|
+
}), count !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
38
|
+
className: "font-medium text-faint tabular-nums",
|
|
39
|
+
children: count
|
|
40
|
+
}) : null]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export { Page, PageHeader, SectionHeader };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.js","names":[],"sources":["../../src/components/page.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\n\n/** Where a page's own content goes, below the bar. `narrow` is for a page that asks one thing. */\nexport function Page({ narrow = false, children }: { narrow?: boolean; children: ReactNode }) {\n return <main className={cn(\"mx-auto grid gap-4.5 px-5 pb-20\", narrow ? \"max-w-xl pt-12\" : \"max-w-6xl pt-9\")}>{children}</main>;\n}\n\n/** A page's title, a line about it, and what can be done from here. */\nexport function PageHeader({ title, lede, actions }: { title: string; lede?: ReactNode; actions?: ReactNode }) {\n return (\n <div className=\"mb-1.5 flex flex-wrap items-end gap-4\">\n {/* The words keep room of their own: where there are more actions than fit beside them, those go below, and the words are not squeezed. */}\n <div className=\"min-w-0 flex-1 basis-64\">\n <h1 className=\"text-2xl leading-tight font-semibold tracking-tight\">{title}</h1>\n {lede ? <p className=\"mt-1.5 text-muted-foreground\">{lede}</p> : null}\n </div>\n {actions ? <div className=\"flex flex-wrap items-center gap-2\">{actions}</div> : null}\n </div>\n );\n}\n\n/** The title of a part of a page, with how many things it holds. `mark` is drawn before the title, to tell one kind of part from another. */\nexport function SectionHeader({ title, count, mark }: { title: string; count?: number; mark?: ReactNode }) {\n return (\n <div className=\"mt-4.5 flex items-baseline gap-2.5\">\n <h2 className=\"flex items-center gap-2 text-lg leading-tight font-semibold tracking-tight\">\n {mark}\n {title}\n </h2>\n {count !== undefined ? <span className=\"font-medium text-faint tabular-nums\">{count}</span> : null}\n </div>\n );\n}\n"],"mappings":";;;;AAIA,SAAgB,KAAK,EAAE,SAAS,OAAO,YAAuD;CAC5F,OAAO,oBAAC,QAAD;EAAM,WAAW,GAAG,mCAAmC,SAAS,mBAAmB,gBAAgB;EAAI;CAAe,CAAA;AAC/H;;AAGA,SAAgB,WAAW,EAAE,OAAO,MAAM,WAAqE;CAC7G,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CAEE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,MAAD;IAAI,WAAU;IAAuD,UAAA;GAAU,CAAA,GAC9E,OAAO,oBAAC,KAAD;IAAG,WAAU;IAAgC,UAAA;GAAQ,CAAA,IAAI,IAC9D;EACJ,CAAA,GAAA,UAAU,oBAAC,OAAD;GAAK,WAAU;GAAqC,UAAA;EAAa,CAAA,IAAI,IAC7E;;AAET;;AAGA,SAAgB,cAAc,EAAE,OAAO,OAAO,QAA6D;CACzG,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,qBAAC,MAAD;GAAI,WAAU;GAAd,UAAA,CACG,MACA,KACC;EACH,CAAA,GAAA,UAAU,KAAA,IAAY,oBAAC,QAAD;GAAM,WAAU;GAAuC,UAAA;EAAY,CAAA,IAAI,IAC3F;;AAET"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A part of a page drawn in a palette of its own, so that a choice of
|
|
4
|
+
* colours is seen before it is made: a tenant's look, light or dark,
|
|
5
|
+
* beside the form that chooses it. Everything inside it, built from this
|
|
6
|
+
* library, is drawn in that palette.
|
|
7
|
+
*
|
|
8
|
+
* @param tokens the platform's tokens, by the names platform-core gives them: `paper`, `ink`, `accent`, `accentSoft`…
|
|
9
|
+
* @param label what it shows, to someone who cannot see it
|
|
10
|
+
*/
|
|
11
|
+
export declare function Palette({ tokens, label, className, children }: {
|
|
12
|
+
tokens: Record<string, string>;
|
|
13
|
+
label?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/palette.tsx
|
|
4
|
+
/** A token's name as a stylesheet has it: `accentSoft` is `--accent-soft`. */
|
|
5
|
+
var dashed = (name) => `--${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`;
|
|
6
|
+
/**
|
|
7
|
+
* A part of a page drawn in a palette of its own, so that a choice of
|
|
8
|
+
* colours is seen before it is made: a tenant's look, light or dark,
|
|
9
|
+
* beside the form that chooses it. Everything inside it, built from this
|
|
10
|
+
* library, is drawn in that palette.
|
|
11
|
+
*
|
|
12
|
+
* @param tokens the platform's tokens, by the names platform-core gives them: `paper`, `ink`, `accent`, `accentSoft`…
|
|
13
|
+
* @param label what it shows, to someone who cannot see it
|
|
14
|
+
*/
|
|
15
|
+
function Palette({ tokens, label, className, children }) {
|
|
16
|
+
const style = Object.fromEntries(Object.entries(tokens).map(([name, value]) => [dashed(name), value]));
|
|
17
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18
|
+
role: label ? "group" : void 0,
|
|
19
|
+
"aria-label": label,
|
|
20
|
+
style,
|
|
21
|
+
className: cn("overflow-hidden rounded-xl border bg-background text-foreground", className),
|
|
22
|
+
children
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export { Palette };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.js","names":[],"sources":["../../src/components/palette.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\n\n/** A token's name as a stylesheet has it: `accentSoft` is `--accent-soft`. */\nconst dashed = (name: string): string => `--${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`;\n\n/**\n * A part of a page drawn in a palette of its own, so that a choice of\n * colours is seen before it is made: a tenant's look, light or dark,\n * beside the form that chooses it. Everything inside it, built from this\n * library, is drawn in that palette.\n *\n * @param tokens the platform's tokens, by the names platform-core gives them: `paper`, `ink`, `accent`, `accentSoft`…\n * @param label what it shows, to someone who cannot see it\n */\nexport function Palette({ tokens, label, className, children }: { tokens: Record<string, string>; label?: string; className?: string; children: ReactNode }) {\n // Set through the element's own style, which the platform's content security policy lets a script do: it is a style\n // attribute written in the page that it refuses.\n const style = Object.fromEntries(Object.entries(tokens).map(([name, value]) => [dashed(name), value])) as CSSProperties;\n return (\n <div role={label ? \"group\" : undefined} aria-label={label} style={style} className={cn(\"overflow-hidden rounded-xl border bg-background text-foreground\", className)}>\n {children}\n </div>\n );\n}\n"],"mappings":";;;;AAIA,IAAM,UAAU,SAAyB,KAAK,KAAK,QAAQ,WAAW,WAAW,IAAI,OAAO,YAAY,GAAG;;;;;;;;;;AAW3G,SAAgB,QAAQ,EAAE,QAAQ,OAAO,WAAW,YAAyG;CAG3J,MAAM,QAAQ,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,WAAW,CAAC,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC;CACrG,OACE,oBAAC,OAAD;EAAK,MAAM,QAAQ,UAAU,KAAA;EAAW,cAAY;EAAc;EAAO,WAAW,GAAG,mEAAmE,SAAS;EAChK;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A titled box: the unit a page is made of. `flush` is for what brings its
|
|
4
|
+
* own edges, such as a DataTable or a list of rows.
|
|
5
|
+
*/
|
|
6
|
+
export declare function Panel({ title, actions, flush, main, children }: {
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
actions?: ReactNode;
|
|
9
|
+
flush?: boolean; /** Whether this is the whole of a page, so that its title is the page's. */
|
|
10
|
+
main?: boolean;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/panel.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A titled box: the unit a page is made of. `flush` is for what brings its
|
|
7
|
+
* own edges, such as a DataTable or a list of rows.
|
|
8
|
+
*/
|
|
9
|
+
function Panel({ title, actions, flush = false, main = false, children }) {
|
|
10
|
+
const Title = main ? "h1" : "h2";
|
|
11
|
+
const id = useId();
|
|
12
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
13
|
+
"aria-labelledby": id,
|
|
14
|
+
className: "overflow-hidden rounded-xl border bg-card text-card-foreground shadow-sm",
|
|
15
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
16
|
+
className: "flex flex-wrap items-center gap-2.5 border-b px-4 py-3",
|
|
17
|
+
children: [/* @__PURE__ */ jsx(Title, {
|
|
18
|
+
id,
|
|
19
|
+
className: "flex min-w-0 flex-1 basis-32 flex-wrap items-center gap-1.5 text-base font-semibold wrap-anywhere",
|
|
20
|
+
children: title
|
|
21
|
+
}), actions]
|
|
22
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
23
|
+
className: cn(!flush && "grid gap-2.5 p-4"),
|
|
24
|
+
children
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { Panel };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.js","names":[],"sources":["../../src/components/panel.tsx"],"sourcesContent":["import { useId, type ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\n\n/**\n * A titled box: the unit a page is made of. `flush` is for what brings its\n * own edges, such as a DataTable or a list of rows.\n */\nexport function Panel({ title, actions, flush = false, main = false, children }: { title: ReactNode; actions?: ReactNode; flush?: boolean; /** Whether this is the whole of a page, so that its title is the page's. */ main?: boolean; children: ReactNode }) {\n const Title = main ? \"h1\" : \"h2\";\n const id = useId();\n return (\n <section aria-labelledby={id} className=\"overflow-hidden rounded-xl border bg-card text-card-foreground shadow-sm\">\n <div className=\"flex flex-wrap items-center gap-2.5 border-b px-4 py-3\">\n {/* The title keeps room of its own: where there are more actions than fit beside it, they go below it and it is not squeezed. */}\n <Title id={id} className=\"flex min-w-0 flex-1 basis-32 flex-wrap items-center gap-1.5 text-base font-semibold wrap-anywhere\">{title}</Title>\n {actions}\n </div>\n <div className={cn(!flush && \"grid gap-2.5 p-4\")}>{children}</div>\n </section>\n );\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,MAAM,EAAE,OAAO,SAAS,QAAQ,OAAO,OAAO,OAAO,YAA0L;CAC7P,MAAM,QAAQ,OAAO,OAAO;CAC5B,MAAM,KAAK,MAAM;CACjB,OACE,qBAAC,WAAD;EAAS,mBAAiB;EAAI,WAAU;EAAxC,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CAEE,oBAAC,OAAD;IAAW;IAAI,WAAU;IAAqG,UAAA;GAAa,CAAA,GAC1I,OACE;EACL,CAAA,GAAA,oBAAC,OAAD;GAAK,WAAW,GAAG,CAAC,SAAS,kBAAkB;GAAI;EAAc,CAAA,CAC1D;;AAEb"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** Things to choose one of, as tiles side by side. `label` says what they are, to someone who cannot see them together. */
|
|
3
|
+
export declare function PickTiles({ label, children }: {
|
|
4
|
+
label: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* Something to choose by pressing it: its mark, its name, and a word
|
|
9
|
+
* beneath (`note`), such as that it is connected already.
|
|
10
|
+
*
|
|
11
|
+
* @param label what it is called to a screen reader, where its name alone would not say enough
|
|
12
|
+
* @param title said on hover: how it is signed in to, what it is for
|
|
13
|
+
*/
|
|
14
|
+
export declare function PickTile({ mark, name, note, label, title, onPick }: {
|
|
15
|
+
mark?: ReactNode;
|
|
16
|
+
name: string;
|
|
17
|
+
note?: ReactNode;
|
|
18
|
+
label?: string;
|
|
19
|
+
title?: string;
|
|
20
|
+
onPick: () => void;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
// src/components/pick-tile.tsx
|
|
3
|
+
/** Things to choose one of, as tiles side by side. `label` says what they are, to someone who cannot see them together. */
|
|
4
|
+
function PickTiles({ label, children }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
role: "group",
|
|
7
|
+
"aria-label": label,
|
|
8
|
+
className: "flex flex-wrap gap-2",
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Something to choose by pressing it: its mark, its name, and a word
|
|
14
|
+
* beneath (`note`), such as that it is connected already.
|
|
15
|
+
*
|
|
16
|
+
* @param label what it is called to a screen reader, where its name alone would not say enough
|
|
17
|
+
* @param title said on hover: how it is signed in to, what it is for
|
|
18
|
+
*/
|
|
19
|
+
function PickTile({ mark, name, note, label, title, onPick }) {
|
|
20
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
21
|
+
type: "button",
|
|
22
|
+
title,
|
|
23
|
+
"aria-label": label,
|
|
24
|
+
onClick: onPick,
|
|
25
|
+
className: "inline-flex max-w-full cursor-pointer items-center gap-2 rounded-lg border bg-card py-1.5 pr-3 pl-1.5 text-left hover:border-primary hover:bg-accent focus-visible:border-primary focus-visible:bg-accent",
|
|
26
|
+
children: [mark, /* @__PURE__ */ jsxs("span", {
|
|
27
|
+
className: "grid min-w-0 leading-tight",
|
|
28
|
+
children: [/* @__PURE__ */ jsx("strong", {
|
|
29
|
+
className: "text-sm wrap-anywhere",
|
|
30
|
+
children: name
|
|
31
|
+
}), note ? /* @__PURE__ */ jsx("small", {
|
|
32
|
+
className: "text-xs text-muted-foreground",
|
|
33
|
+
children: note
|
|
34
|
+
}) : null]
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export { PickTile, PickTiles };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=pick-tile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pick-tile.js","names":[],"sources":["../../src/components/pick-tile.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\n/** Things to choose one of, as tiles side by side. `label` says what they are, to someone who cannot see them together. */\nexport function PickTiles({ label, children }: { label: string; children: ReactNode }) {\n return (\n <div role=\"group\" aria-label={label} className=\"flex flex-wrap gap-2\">\n {children}\n </div>\n );\n}\n\n/**\n * Something to choose by pressing it: its mark, its name, and a word\n * beneath (`note`), such as that it is connected already.\n *\n * @param label what it is called to a screen reader, where its name alone would not say enough\n * @param title said on hover: how it is signed in to, what it is for\n */\nexport function PickTile({ mark, name, note, label, title, onPick }: { mark?: ReactNode; name: string; note?: ReactNode; label?: string; title?: string; onPick: () => void }) {\n return (\n <button type=\"button\" title={title} aria-label={label} onClick={onPick} className=\"inline-flex max-w-full cursor-pointer items-center gap-2 rounded-lg border bg-card py-1.5 pr-3 pl-1.5 text-left hover:border-primary hover:bg-accent focus-visible:border-primary focus-visible:bg-accent\">\n {mark}\n <span className=\"grid min-w-0 leading-tight\">\n <strong className=\"text-sm wrap-anywhere\">{name}</strong>\n {note ? <small className=\"text-xs text-muted-foreground\">{note}</small> : null}\n </span>\n </button>\n );\n}\n"],"mappings":";;;AAGA,SAAgB,UAAU,EAAE,OAAO,YAAoD;CACrF,OACE,oBAAC,OAAD;EAAK,MAAK;EAAQ,cAAY;EAAO,WAAU;EAC5C;CACE,CAAA;AAET;;;;;;;;AASA,SAAgB,SAAS,EAAE,MAAM,MAAM,MAAM,OAAO,OAAO,UAAoH;CAC7K,OACE,qBAAC,UAAD;EAAQ,MAAK;EAAgB;EAAO,cAAY;EAAO,SAAS;EAAQ,WAAU;EAAlF,UAAA,CACG,MACD,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACE,oBAAC,UAAD;IAAQ,WAAU;IAAyB,UAAA;GAAa,CAAA,GACvD,OAAO,oBAAC,SAAD;IAAO,WAAU;IAAiC,UAAA;GAAY,CAAA,IAAI,IACtE;EACA,CAAA,CAAA;;AAEZ"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare const SIZES: {
|
|
2
|
+
readonly sm: {
|
|
3
|
+
readonly tile: "size-5.5 rounded-sm text-[9px]";
|
|
4
|
+
readonly picture: "size-3.5";
|
|
5
|
+
};
|
|
6
|
+
readonly default: {
|
|
7
|
+
readonly tile: "size-7 rounded-md text-[10.5px]";
|
|
8
|
+
readonly picture: "size-4.5";
|
|
9
|
+
};
|
|
10
|
+
readonly lg: {
|
|
11
|
+
readonly tile: "size-9 rounded-lg text-[13px]";
|
|
12
|
+
readonly picture: "size-5.5";
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The mark of what something is connected to, or is to be: a provider, a
|
|
17
|
+
* kind of connection, a server the platform knows of. It is on a light
|
|
18
|
+
* tile, so that it reads the same on a dark page. Where no mark is kept,
|
|
19
|
+
* or the mark cannot be fetched, its initials are shown in a colour of
|
|
20
|
+
* its own, never a broken picture.
|
|
21
|
+
*
|
|
22
|
+
* It is said by the name beside it, so it is hidden from a screen
|
|
23
|
+
* reader: always put the name beside it.
|
|
24
|
+
*
|
|
25
|
+
* @param id what it is: a kind of connection, a provider, or a known server
|
|
26
|
+
* @param name what it is called, for its initials
|
|
27
|
+
*/
|
|
28
|
+
export declare function ProviderMark({ id, name, size }: {
|
|
29
|
+
id: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
size?: keyof typeof SIZES;
|
|
32
|
+
}): import("react").JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { hueOf } from "../lib/format.js";
|
|
3
|
+
import { markLetters, markOf } from "../lib/marks.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
// src/components/provider-mark.tsx
|
|
7
|
+
var SIZES = {
|
|
8
|
+
sm: {
|
|
9
|
+
tile: "size-5.5 rounded-sm text-[9px]",
|
|
10
|
+
picture: "size-3.5"
|
|
11
|
+
},
|
|
12
|
+
default: {
|
|
13
|
+
tile: "size-7 rounded-md text-[10.5px]",
|
|
14
|
+
picture: "size-4.5"
|
|
15
|
+
},
|
|
16
|
+
lg: {
|
|
17
|
+
tile: "size-9 rounded-lg text-[13px]",
|
|
18
|
+
picture: "size-5.5"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The mark of what something is connected to, or is to be: a provider, a
|
|
23
|
+
* kind of connection, a server the platform knows of. It is on a light
|
|
24
|
+
* tile, so that it reads the same on a dark page. Where no mark is kept,
|
|
25
|
+
* or the mark cannot be fetched, its initials are shown in a colour of
|
|
26
|
+
* its own, never a broken picture.
|
|
27
|
+
*
|
|
28
|
+
* It is said by the name beside it, so it is hidden from a screen
|
|
29
|
+
* reader: always put the name beside it.
|
|
30
|
+
*
|
|
31
|
+
* @param id what it is: a kind of connection, a provider, or a known server
|
|
32
|
+
* @param name what it is called, for its initials
|
|
33
|
+
*/
|
|
34
|
+
function ProviderMark({ id, name, size = "default" }) {
|
|
35
|
+
const [failed, setFailed] = useState(false);
|
|
36
|
+
const src = markOf(id);
|
|
37
|
+
const tile = cn("inline-grid flex-none place-items-center border align-middle leading-none font-bold tracking-wide", SIZES[size].tile);
|
|
38
|
+
if (!src || failed) return /* @__PURE__ */ jsx("span", {
|
|
39
|
+
"aria-hidden": "true",
|
|
40
|
+
style: { "--hue": String(hueOf(id || name || "")) },
|
|
41
|
+
className: cn(tile, "hue-mark"),
|
|
42
|
+
children: markLetters(name || id)
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ jsx("span", {
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
className: cn(tile, "bg-white"),
|
|
47
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
48
|
+
src,
|
|
49
|
+
alt: "",
|
|
50
|
+
loading: "lazy",
|
|
51
|
+
onError: () => setFailed(true),
|
|
52
|
+
className: cn("block", SIZES[size].picture)
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export { ProviderMark };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=provider-mark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-mark.js","names":[],"sources":["../../src/components/provider-mark.tsx"],"sourcesContent":["import { useState, type CSSProperties } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { hueOf } from \"../lib/format\";\nimport { markLetters, markOf } from \"../lib/marks\";\n\nconst SIZES = {\n sm: { tile: \"size-5.5 rounded-sm text-[9px]\", picture: \"size-3.5\" },\n default: { tile: \"size-7 rounded-md text-[10.5px]\", picture: \"size-4.5\" },\n lg: { tile: \"size-9 rounded-lg text-[13px]\", picture: \"size-5.5\" },\n} as const;\n\n/**\n * The mark of what something is connected to, or is to be: a provider, a\n * kind of connection, a server the platform knows of. It is on a light\n * tile, so that it reads the same on a dark page. Where no mark is kept,\n * or the mark cannot be fetched, its initials are shown in a colour of\n * its own, never a broken picture.\n *\n * It is said by the name beside it, so it is hidden from a screen\n * reader: always put the name beside it.\n *\n * @param id what it is: a kind of connection, a provider, or a known server\n * @param name what it is called, for its initials\n */\nexport function ProviderMark({ id, name, size = \"default\" }: { id: string; name?: string; size?: keyof typeof SIZES }) {\n const [failed, setFailed] = useState(false);\n const src = markOf(id);\n const tile = cn(\"inline-grid flex-none place-items-center border align-middle leading-none font-bold tracking-wide\", SIZES[size].tile);\n if (!src || failed) {\n return (\n <span aria-hidden=\"true\" style={{ \"--hue\": String(hueOf(id || name || \"\")) } as CSSProperties} className={cn(tile, \"hue-mark\")}>\n {markLetters(name || id)}\n </span>\n );\n }\n return (\n <span aria-hidden=\"true\" className={cn(tile, \"bg-white\")}>\n <img src={src} alt=\"\" loading=\"lazy\" onError={() => setFailed(true)} className={cn(\"block\", SIZES[size].picture)} />\n </span>\n );\n}\n"],"mappings":";;;;;;AAKA,IAAM,QAAQ;CACZ,IAAI;EAAE,MAAM;EAAkC,SAAS;CAAW;CAClE,SAAS;EAAE,MAAM;EAAmC,SAAS;CAAW;CACxE,IAAI;EAAE,MAAM;EAAiC,SAAS;CAAW;AACnE;;;;;;;;;;;;;;AAeA,SAAgB,aAAa,EAAE,IAAI,MAAM,OAAO,aAAuE;CACrH,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK;CAC1C,MAAM,MAAM,OAAO,EAAE;CACrB,MAAM,OAAO,GAAG,qGAAqG,MAAM,KAAK,CAAC,IAAI;CACrI,IAAI,CAAC,OAAO,QACV,OACE,oBAAC,QAAD;EAAM,eAAY;EAAO,OAAO,EAAE,SAAS,OAAO,MAAM,MAAM,QAAQ,EAAE,CAAC,EAAE;EAAoB,WAAW,GAAG,MAAM,UAAU;EAC1H,UAAA,YAAY,QAAQ,EAAE;CACnB,CAAA;CAGV,OACE,oBAAC,QAAD;EAAM,eAAY;EAAO,WAAW,GAAG,MAAM,UAAU;EACrD,UAAA,oBAAC,OAAD;GAAU;GAAK,KAAI;GAAG,SAAQ;GAAO,eAAe,UAAU,IAAI;GAAG,WAAW,GAAG,SAAS,MAAM,KAAK,CAAC,OAAO;EAAI,CAAA;CAC/G,CAAA;AAEV"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
3
|
+
/**
|
|
4
|
+
* What every component here needs around it. mount() puts it there: a
|
|
5
|
+
* page uses this itself only in a test.
|
|
6
|
+
*/
|
|
7
|
+
export declare function FinchlyProvider({ children, client }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
client?: QueryClient;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* Start a page: draw it into the element the page's HTML has for it.
|
|
13
|
+
* This is the one call an app's entry makes.
|
|
14
|
+
*/
|
|
15
|
+
export declare function mount(page: ReactNode, { into }?: {
|
|
16
|
+
into?: string;
|
|
17
|
+
}): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AskHost } from "./ask.js";
|
|
2
|
+
import { Toaster } from "./toast.js";
|
|
3
|
+
import { TooltipProvider } from "./ui/tooltip.js";
|
|
4
|
+
import { StrictMode, useState } from "react";
|
|
5
|
+
import { createRoot } from "react-dom/client";
|
|
6
|
+
import { CSPProvider } from "@base-ui/react/csp-provider";
|
|
7
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
// src/components/provider.tsx
|
|
10
|
+
/**
|
|
11
|
+
* What every component here needs around it. mount() puts it there: a
|
|
12
|
+
* page uses this itself only in a test.
|
|
13
|
+
*/
|
|
14
|
+
function FinchlyProvider({ children, client }) {
|
|
15
|
+
const [queries] = useState(() => client ?? new QueryClient({ defaultOptions: { queries: { retry: false } } }));
|
|
16
|
+
return /* @__PURE__ */ jsx(CSPProvider, {
|
|
17
|
+
disableStyleElements: true,
|
|
18
|
+
children: /* @__PURE__ */ jsxs(QueryClientProvider, {
|
|
19
|
+
client: queries,
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsx(TooltipProvider, { children }),
|
|
22
|
+
/* @__PURE__ */ jsx(AskHost, {}),
|
|
23
|
+
/* @__PURE__ */ jsx(Toaster, {})
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Start a page: draw it into the element the page's HTML has for it.
|
|
30
|
+
* This is the one call an app's entry makes.
|
|
31
|
+
*/
|
|
32
|
+
function mount(page, { into = "#root" } = {}) {
|
|
33
|
+
const element = document.querySelector(into);
|
|
34
|
+
if (!element) throw new Error(`The page has no ${into} to be drawn into`);
|
|
35
|
+
createRoot(element).render(/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(FinchlyProvider, { children: page }) }));
|
|
36
|
+
}
|
|
37
|
+
export { FinchlyProvider, mount };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","names":[],"sources":["../../src/components/provider.tsx"],"sourcesContent":["import { StrictMode, useState, type ReactNode } from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { CSPProvider } from \"@base-ui/react/csp-provider\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { AskHost } from \"./ask\";\nimport { Toaster } from \"./toast\";\nimport { TooltipProvider } from \"./ui/tooltip\";\n\n/**\n * What every component here needs around it. mount() puts it there: a\n * page uses this itself only in a test.\n */\nexport function FinchlyProvider({ children, client }: { children: ReactNode; client?: QueryClient }) {\n // A refusal is an answer, not something to try again: the person is told at once.\n const [queries] = useState(() => client ?? new QueryClient({ defaultOptions: { queries: { retry: false } } }));\n return (\n // The platform's pages take no inline style element: styles.css has what Base UI would have written.\n <CSPProvider disableStyleElements>\n <QueryClientProvider client={queries}>\n <TooltipProvider>{children}</TooltipProvider>\n <AskHost />\n <Toaster />\n </QueryClientProvider>\n </CSPProvider>\n );\n}\n\n/**\n * Start a page: draw it into the element the page's HTML has for it.\n * This is the one call an app's entry makes.\n */\nexport function mount(page: ReactNode, { into = \"#root\" }: { into?: string } = {}): void {\n const element = document.querySelector(into);\n if (!element) throw new Error(`The page has no ${into} to be drawn into`);\n createRoot(element).render(\n <StrictMode>\n <FinchlyProvider>{page}</FinchlyProvider>\n </StrictMode>,\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,gBAAgB,EAAE,UAAU,UAAyD;CAEnG,MAAM,CAAC,WAAW,eAAe,UAAU,IAAI,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,MAAM,EAAE,EAAE,CAAC,CAAC;CAC7G,OAEE,oBAAC,aAAD;EAAa,sBAAA;EACX,UAAA,qBAAC,qBAAD;GAAqB,QAAQ;GAA7B,UAAA;IACE,oBAAC,iBAAD,EAAkB,SAA0B,CAAA;IAC5C,oBAAC,SAAD,CAAU,CAAA;IACV,oBAAC,SAAD,CAAU,CAAA;GACS;;CACV,CAAA;AAEjB;;;;;AAMA,SAAgB,MAAM,MAAiB,EAAE,OAAO,YAA+B,CAAC,GAAS;CACvF,MAAM,UAAU,SAAS,cAAc,IAAI;CAC3C,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,mBAAmB,KAAK,kBAAkB;CACxE,WAAW,OAAO,CAAC,CAAC,OAClB,oBAAC,YAAD,EAAA,UACE,oBAAC,iBAAD,EAAA,UAAkB,KAAsB,CAAA,EAC9B,CAAA,CACd;AACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** Things a tenant has, one to a row, each with what can be done with it. For a `flush` Panel. */
|
|
3
|
+
export declare function Rows({ children }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* One thing: what it is called, a line about it, and at its side its
|
|
8
|
+
* state and what can be done with it.
|
|
9
|
+
*
|
|
10
|
+
* @param detail a smaller line: where it runs, what it costs
|
|
11
|
+
* @param code what is to be read exactly: the names of its tools
|
|
12
|
+
* @param problem what is wrong with it, in place of `code`
|
|
13
|
+
* @param body what it says or holds, in the page's own ink: a message's words, something to open and read
|
|
14
|
+
* @param children what stands between the two, such as a Meter
|
|
15
|
+
*/
|
|
16
|
+
export declare function Row({ title, about, detail, code, problem, body, side, children }: {
|
|
17
|
+
title: ReactNode;
|
|
18
|
+
about?: ReactNode;
|
|
19
|
+
detail?: ReactNode;
|
|
20
|
+
code?: ReactNode;
|
|
21
|
+
problem?: ReactNode;
|
|
22
|
+
body?: ReactNode;
|
|
23
|
+
side?: ReactNode;
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* How far something has got: a bar that fills as it is done. Unlike a
|
|
28
|
+
* Meter, all of it is good.
|
|
29
|
+
*
|
|
30
|
+
* @param label said to someone who cannot see it: "2 of 5 steps done"
|
|
31
|
+
*/
|
|
32
|
+
export declare function Progress({ done, total, label }: {
|
|
33
|
+
done: number;
|
|
34
|
+
total: number;
|
|
35
|
+
label: string;
|
|
36
|
+
}): import("react").JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* How much of something that is limited has been used: a bar, in the
|
|
39
|
+
* accent until it is nearly all, and in the colour of what went wrong
|
|
40
|
+
* once it is. `children` say it in words beneath.
|
|
41
|
+
*
|
|
42
|
+
* @param share from 0 to 1, and over where more was used than there is
|
|
43
|
+
*/
|
|
44
|
+
export declare function Meter({ share, label, children }: {
|
|
45
|
+
share: number;
|
|
46
|
+
label: string;
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/rows.tsx
|
|
4
|
+
/** Things a tenant has, one to a row, each with what can be done with it. For a `flush` Panel. */
|
|
5
|
+
function Rows({ children }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
7
|
+
className: "grid",
|
|
8
|
+
children
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One thing: what it is called, a line about it, and at its side its
|
|
13
|
+
* state and what can be done with it.
|
|
14
|
+
*
|
|
15
|
+
* @param detail a smaller line: where it runs, what it costs
|
|
16
|
+
* @param code what is to be read exactly: the names of its tools
|
|
17
|
+
* @param problem what is wrong with it, in place of `code`
|
|
18
|
+
* @param body what it says or holds, in the page's own ink: a message's words, something to open and read
|
|
19
|
+
* @param children what stands between the two, such as a Meter
|
|
20
|
+
*/
|
|
21
|
+
function Row({ title, about, detail, code, problem, body, side, children }) {
|
|
22
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
23
|
+
className: "flex flex-wrap items-center gap-x-3.5 gap-y-2 border-t px-4 py-3 first:border-t-0",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: "min-w-0 flex-1 basis-64",
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsx("strong", {
|
|
29
|
+
className: "block",
|
|
30
|
+
children: title
|
|
31
|
+
}),
|
|
32
|
+
about ? /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: "text-muted-foreground",
|
|
34
|
+
children: about
|
|
35
|
+
}) : null,
|
|
36
|
+
detail ? /* @__PURE__ */ jsx("div", {
|
|
37
|
+
className: "text-sm text-muted-foreground",
|
|
38
|
+
children: detail
|
|
39
|
+
}) : null,
|
|
40
|
+
problem ? /* @__PURE__ */ jsx("div", {
|
|
41
|
+
className: "text-sm text-destructive",
|
|
42
|
+
children: problem
|
|
43
|
+
}) : code ? /* @__PURE__ */ jsx("div", {
|
|
44
|
+
className: "font-mono text-sm wrap-anywhere",
|
|
45
|
+
children: code
|
|
46
|
+
}) : null,
|
|
47
|
+
body ? /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: "mt-1.5 min-w-0 wrap-anywhere",
|
|
49
|
+
children: body
|
|
50
|
+
}) : null
|
|
51
|
+
]
|
|
52
|
+
}),
|
|
53
|
+
children,
|
|
54
|
+
side ? /* @__PURE__ */ jsx("div", {
|
|
55
|
+
className: "flex flex-wrap items-center gap-2",
|
|
56
|
+
children: side
|
|
57
|
+
}) : null
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* How far something has got: a bar that fills as it is done. Unlike a
|
|
63
|
+
* Meter, all of it is good.
|
|
64
|
+
*
|
|
65
|
+
* @param label said to someone who cannot see it: "2 of 5 steps done"
|
|
66
|
+
*/
|
|
67
|
+
function Progress({ done, total, label }) {
|
|
68
|
+
const share = total > 0 ? Math.min(100, Math.max(0, Math.round(done / total * 100))) : 100;
|
|
69
|
+
return /* @__PURE__ */ jsx("div", {
|
|
70
|
+
role: "progressbar",
|
|
71
|
+
"aria-label": label,
|
|
72
|
+
"aria-valuemin": 0,
|
|
73
|
+
"aria-valuemax": total,
|
|
74
|
+
"aria-valuenow": Math.min(done, total),
|
|
75
|
+
className: "h-1.5 overflow-hidden rounded-full bg-muted",
|
|
76
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
77
|
+
style: { width: `${share}%` },
|
|
78
|
+
className: "block h-full rounded-full bg-primary"
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* How much of something that is limited has been used: a bar, in the
|
|
84
|
+
* accent until it is nearly all, and in the colour of what went wrong
|
|
85
|
+
* once it is. `children` say it in words beneath.
|
|
86
|
+
*
|
|
87
|
+
* @param share from 0 to 1, and over where more was used than there is
|
|
88
|
+
*/
|
|
89
|
+
function Meter({ share, label, children }) {
|
|
90
|
+
const used = Math.min(100, Math.max(0, Math.round(share * 100)));
|
|
91
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
92
|
+
className: "min-w-30 flex-initial basis-44",
|
|
93
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
94
|
+
role: "meter",
|
|
95
|
+
"aria-label": label,
|
|
96
|
+
"aria-valuemin": 0,
|
|
97
|
+
"aria-valuemax": 100,
|
|
98
|
+
"aria-valuenow": used,
|
|
99
|
+
className: "h-1.5 overflow-hidden rounded-full bg-muted",
|
|
100
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
101
|
+
style: { width: `${used}%` },
|
|
102
|
+
className: cn("block h-full", share >= 1 ? "bg-destructive" : share >= .8 ? "bg-warning" : "bg-primary")
|
|
103
|
+
})
|
|
104
|
+
}), children ? /* @__PURE__ */ jsx("small", {
|
|
105
|
+
className: "mt-1 block text-xs text-muted-foreground",
|
|
106
|
+
children
|
|
107
|
+
}) : null]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
export { Meter, Progress, Row, Rows };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rows.js","names":[],"sources":["../../src/components/rows.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\n\n/** Things a tenant has, one to a row, each with what can be done with it. For a `flush` Panel. */\nexport function Rows({ children }: { children: ReactNode }) {\n return <ul className=\"grid\">{children}</ul>;\n}\n\n/**\n * One thing: what it is called, a line about it, and at its side its\n * state and what can be done with it.\n *\n * @param detail a smaller line: where it runs, what it costs\n * @param code what is to be read exactly: the names of its tools\n * @param problem what is wrong with it, in place of `code`\n * @param body what it says or holds, in the page's own ink: a message's words, something to open and read\n * @param children what stands between the two, such as a Meter\n */\nexport function Row({ title, about, detail, code, problem, body, side, children }: { title: ReactNode; about?: ReactNode; detail?: ReactNode; code?: ReactNode; problem?: ReactNode; body?: ReactNode; side?: ReactNode; children?: ReactNode }) {\n return (\n <li className=\"flex flex-wrap items-center gap-x-3.5 gap-y-2 border-t px-4 py-3 first:border-t-0\">\n <div className=\"min-w-0 flex-1 basis-64\">\n <strong className=\"block\">{title}</strong>\n {about ? <span className=\"text-muted-foreground\">{about}</span> : null}\n {detail ? <div className=\"text-sm text-muted-foreground\">{detail}</div> : null}\n {problem ? <div className=\"text-sm text-destructive\">{problem}</div> : code ? <div className=\"font-mono text-sm wrap-anywhere\">{code}</div> : null}\n {body ? <div className=\"mt-1.5 min-w-0 wrap-anywhere\">{body}</div> : null}\n </div>\n {children}\n {side ? <div className=\"flex flex-wrap items-center gap-2\">{side}</div> : null}\n </li>\n );\n}\n\n/**\n * How far something has got: a bar that fills as it is done. Unlike a\n * Meter, all of it is good.\n *\n * @param label said to someone who cannot see it: \"2 of 5 steps done\"\n */\nexport function Progress({ done, total, label }: { done: number; total: number; label: string }) {\n const share = total > 0 ? Math.min(100, Math.max(0, Math.round((done / total) * 100))) : 100;\n return (\n <div role=\"progressbar\" aria-label={label} aria-valuemin={0} aria-valuemax={total} aria-valuenow={Math.min(done, total)} className=\"h-1.5 overflow-hidden rounded-full bg-muted\">\n <span style={{ width: `${share}%` }} className=\"block h-full rounded-full bg-primary\" />\n </div>\n );\n}\n\n/**\n * How much of something that is limited has been used: a bar, in the\n * accent until it is nearly all, and in the colour of what went wrong\n * once it is. `children` say it in words beneath.\n *\n * @param share from 0 to 1, and over where more was used than there is\n */\nexport function Meter({ share, label, children }: { share: number; label: string; children?: ReactNode }) {\n const used = Math.min(100, Math.max(0, Math.round(share * 100)));\n return (\n <div className=\"min-w-30 flex-initial basis-44\">\n <div role=\"meter\" aria-label={label} aria-valuemin={0} aria-valuemax={100} aria-valuenow={used} className=\"h-1.5 overflow-hidden rounded-full bg-muted\">\n <span style={{ width: `${used}%` }} className={cn(\"block h-full\", share >= 1 ? \"bg-destructive\" : share >= 0.8 ? \"bg-warning\" : \"bg-primary\")} />\n </div>\n {children ? <small className=\"mt-1 block text-xs text-muted-foreground\">{children}</small> : null}\n </div>\n );\n}\n"],"mappings":";;;;AAIA,SAAgB,KAAK,EAAE,YAAqC;CAC1D,OAAO,oBAAC,MAAD;EAAI,WAAU;EAAQ;CAAa,CAAA;AAC5C;;;;;;;;;;;AAYA,SAAgB,IAAI,EAAE,OAAO,OAAO,QAAQ,MAAM,SAAS,MAAM,MAAM,YAA0K;CAC/O,OACE,qBAAC,MAAD;EAAI,WAAU;EAAd,UAAA;GACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,oBAAC,UAAD;MAAQ,WAAU;MAAS,UAAA;KAAc,CAAA;KACxC,QAAQ,oBAAC,QAAD;MAAM,WAAU;MAAyB,UAAA;KAAY,CAAA,IAAI;KACjE,SAAS,oBAAC,OAAD;MAAK,WAAU;MAAiC,UAAA;KAAY,CAAA,IAAI;KACzE,UAAU,oBAAC,OAAD;MAAK,WAAU;MAA4B,UAAA;KAAa,CAAA,IAAI,OAAO,oBAAC,OAAD;MAAK,WAAU;MAAmC,UAAA;KAAU,CAAA,IAAI;KAC7I,OAAO,oBAAC,OAAD;MAAK,WAAU;MAAgC,UAAA;KAAU,CAAA,IAAI;IAClE;;GACJ;GACA,OAAO,oBAAC,OAAD;IAAK,WAAU;IAAqC,UAAA;GAAU,CAAA,IAAI;EACxE;;AAER;;;;;;;AAQA,SAAgB,SAAS,EAAE,MAAM,OAAO,SAAyD;CAC/F,MAAM,QAAQ,QAAQ,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,MAAO,OAAO,QAAS,GAAG,CAAC,CAAC,IAAI;CACzF,OACE,oBAAC,OAAD;EAAK,MAAK;EAAc,cAAY;EAAO,iBAAe;EAAG,iBAAe;EAAO,iBAAe,KAAK,IAAI,MAAM,KAAK;EAAG,WAAU;EACjI,UAAA,oBAAC,QAAD;GAAM,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG;GAAG,WAAU;EAAwC,CAAA;CACpF,CAAA;AAET;;;;;;;;AASA,SAAgB,MAAM,EAAE,OAAO,OAAO,YAAoE;CACxG,MAAM,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,MAAM,QAAQ,GAAG,CAAC,CAAC;CAC/D,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,OAAD;GAAK,MAAK;GAAQ,cAAY;GAAO,iBAAe;GAAG,iBAAe;GAAK,iBAAe;GAAM,WAAU;GACxG,UAAA,oBAAC,QAAD;IAAM,OAAO,EAAE,OAAO,GAAG,KAAK,GAAG;IAAG,WAAW,GAAG,gBAAgB,SAAS,IAAI,mBAAmB,SAAS,KAAM,eAAe,YAAY;GAAI,CAAA;EAC7I,CAAA,GACJ,WAAW,oBAAC,SAAD;GAAO,WAAU;GAA4C;EAAgB,CAAA,IAAI,IAC1F;;AAET"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** One place in a side navigation. `badge` is a word or a count beside it. */
|
|
3
|
+
export interface SideItem {
|
|
4
|
+
href: string;
|
|
5
|
+
title: string;
|
|
6
|
+
badge?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The sections of a page that has many, down its side: in groups, each
|
|
10
|
+
* with a title, and the one being shown marked. On a narrow screen it is
|
|
11
|
+
* a row across the top, which scrolls, and the groups' titles are left
|
|
12
|
+
* out. Given to AppShell as its `side`.
|
|
13
|
+
*
|
|
14
|
+
* @param current the `href` of the section being shown
|
|
15
|
+
*/
|
|
16
|
+
export declare function SideNav({ label, groups, current }: {
|
|
17
|
+
label: string;
|
|
18
|
+
groups: Array<{
|
|
19
|
+
title?: string;
|
|
20
|
+
items: SideItem[];
|
|
21
|
+
}>;
|
|
22
|
+
current?: string;
|
|
23
|
+
}): import("react").JSX.Element;
|