@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,41 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/side-nav.tsx
|
|
4
|
+
var LINK = "flex items-center justify-between gap-2.5 rounded-lg px-2.5 py-1.5 font-medium text-muted-foreground no-underline hover:bg-muted hover:text-foreground aria-[current=page]:bg-accent aria-[current=page]:text-primary max-md:flex-none max-md:whitespace-nowrap";
|
|
5
|
+
/**
|
|
6
|
+
* The sections of a page that has many, down its side: in groups, each
|
|
7
|
+
* with a title, and the one being shown marked. On a narrow screen it is
|
|
8
|
+
* a row across the top, which scrolls, and the groups' titles are left
|
|
9
|
+
* out. Given to AppShell as its `side`.
|
|
10
|
+
*
|
|
11
|
+
* @param current the `href` of the section being shown
|
|
12
|
+
*/
|
|
13
|
+
function SideNav({ label, groups, current }) {
|
|
14
|
+
const nav = useRef(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
nav.current?.querySelector("[aria-current=\"page\"]")?.scrollIntoView?.({
|
|
17
|
+
block: "nearest",
|
|
18
|
+
inline: "nearest"
|
|
19
|
+
});
|
|
20
|
+
}, [current]);
|
|
21
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
22
|
+
ref: nav,
|
|
23
|
+
"aria-label": label,
|
|
24
|
+
className: "flex gap-1 overflow-x-auto pb-1.5 md:sticky md:top-20 md:grid md:gap-4.5 md:self-start md:overflow-visible md:pb-0",
|
|
25
|
+
children: groups.map((group, index) => /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: "contents md:grid md:gap-0.5",
|
|
27
|
+
children: [group.title ? /* @__PURE__ */ jsx("div", {
|
|
28
|
+
className: "hidden px-2.5 pb-1 text-xs font-bold tracking-wider text-faint uppercase md:block",
|
|
29
|
+
children: group.title
|
|
30
|
+
}) : null, group.items.map((item) => /* @__PURE__ */ jsxs("a", {
|
|
31
|
+
href: item.href,
|
|
32
|
+
"aria-current": item.href === current ? "page" : void 0,
|
|
33
|
+
className: LINK,
|
|
34
|
+
children: [item.title, item.badge]
|
|
35
|
+
}, item.href))]
|
|
36
|
+
}, group.title ?? index))
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export { SideNav };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=side-nav.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-nav.js","names":[],"sources":["../../src/components/side-nav.tsx"],"sourcesContent":["import { useEffect, useRef, type ReactNode } from \"react\";\n\n/** One place in a side navigation. `badge` is a word or a count beside it. */\nexport interface SideItem {\n href: string;\n title: string;\n badge?: ReactNode;\n}\n\nconst LINK = \"flex items-center justify-between gap-2.5 rounded-lg px-2.5 py-1.5 font-medium text-muted-foreground no-underline hover:bg-muted hover:text-foreground aria-[current=page]:bg-accent aria-[current=page]:text-primary max-md:flex-none max-md:whitespace-nowrap\";\n\n/**\n * The sections of a page that has many, down its side: in groups, each\n * with a title, and the one being shown marked. On a narrow screen it is\n * a row across the top, which scrolls, and the groups' titles are left\n * out. Given to AppShell as its `side`.\n *\n * @param current the `href` of the section being shown\n */\nexport function SideNav({ label, groups, current }: { label: string; groups: Array<{ title?: string; items: SideItem[] }>; current?: string }) {\n const nav = useRef<HTMLElement>(null);\n // As a row across the top, the section being shown is brought into sight: it may be past the edge.\n useEffect(() => {\n nav.current?.querySelector('[aria-current=\"page\"]')?.scrollIntoView?.({ block: \"nearest\", inline: \"nearest\" });\n }, [current]);\n return (\n <nav ref={nav} aria-label={label} className=\"flex gap-1 overflow-x-auto pb-1.5 md:sticky md:top-20 md:grid md:gap-4.5 md:self-start md:overflow-visible md:pb-0\">\n {groups.map((group, index) => (\n <div key={group.title ?? index} className=\"contents md:grid md:gap-0.5\">\n {group.title ? <div className=\"hidden px-2.5 pb-1 text-xs font-bold tracking-wider text-faint uppercase md:block\">{group.title}</div> : null}\n {group.items.map((item) => (\n <a key={item.href} href={item.href} aria-current={item.href === current ? \"page\" : undefined} className={LINK}>\n {item.title}\n {item.badge}\n </a>\n ))}\n </div>\n ))}\n </nav>\n );\n}\n"],"mappings":";;;AASA,IAAM,OAAO;;;;;;;;;AAUb,SAAgB,QAAQ,EAAE,OAAO,QAAQ,WAAsG;CAC7I,MAAM,MAAM,OAAoB,IAAI;CAEpC,gBAAgB;EACd,IAAI,SAAS,cAAc,yBAAuB,CAAC,EAAE,iBAAiB;GAAE,OAAO;GAAW,QAAQ;EAAU,CAAC;CAC/G,GAAG,CAAC,OAAO,CAAC;CACZ,OACE,oBAAC,OAAD;EAAK,KAAK;EAAK,cAAY;EAAO,WAAU;EACzC,UAAA,OAAO,KAAK,OAAO,UAClB,qBAAC,OAAD;GAAgC,WAAU;GAA1C,UAAA,CACG,MAAM,QAAQ,oBAAC,OAAD;IAAK,WAAU;IAAqF,UAAA,MAAM;GAAW,CAAA,IAAI,MACvI,MAAM,MAAM,KAAK,SAChB,qBAAC,KAAD;IAAmB,MAAM,KAAK;IAAM,gBAAc,KAAK,SAAS,UAAU,SAAS,KAAA;IAAW,WAAW;IAAzG,UAAA,CACG,KAAK,OACL,KAAK,KACL;GAHK,GAAA,KAAK,IAGV,CACJ,CACE;EARK,GAAA,MAAM,SAAS,KAQpB,CACN;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** What is shown while the page waits. */
|
|
3
|
+
export declare function Loading({ children }: {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* What is shown where there is nothing to show. It says so in a few
|
|
8
|
+
* words ("No hooks set") and does not explain the feature.
|
|
9
|
+
*/
|
|
10
|
+
export declare function EmptyState({ title, children }: {
|
|
11
|
+
title: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/** What is shown where something could not be loaded: what went wrong, in words for a person. */
|
|
15
|
+
export declare function Failure({ title, error, children }: {
|
|
16
|
+
title?: string;
|
|
17
|
+
error: unknown;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { explain } from "../lib/api.js";
|
|
2
|
+
import { Spinner } from "./ui/spinner.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/states.tsx
|
|
5
|
+
/** What is shown while the page waits. */
|
|
6
|
+
function Loading({ children = "Loading…" }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8
|
+
role: "status",
|
|
9
|
+
className: "flex items-center justify-center gap-2 px-5 py-12 text-muted-foreground",
|
|
10
|
+
children: [/* @__PURE__ */ jsx(Spinner, {
|
|
11
|
+
"aria-hidden": "true",
|
|
12
|
+
"aria-label": void 0,
|
|
13
|
+
role: void 0
|
|
14
|
+
}), children]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* What is shown where there is nothing to show. It says so in a few
|
|
19
|
+
* words ("No hooks set") and does not explain the feature.
|
|
20
|
+
*/
|
|
21
|
+
function EmptyState({ title, children }) {
|
|
22
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
23
|
+
className: "rounded-xl border border-dashed border-input px-5 py-8 text-center text-muted-foreground",
|
|
24
|
+
children: [/* @__PURE__ */ jsx("strong", {
|
|
25
|
+
className: "block text-foreground",
|
|
26
|
+
children: title
|
|
27
|
+
}), children ? /* @__PURE__ */ jsx("div", {
|
|
28
|
+
className: "mt-1 grid justify-items-center gap-3",
|
|
29
|
+
children
|
|
30
|
+
}) : null]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/** What is shown where something could not be loaded: what went wrong, in words for a person. */
|
|
34
|
+
function Failure({ title = "This could not be loaded", error, children }) {
|
|
35
|
+
return /* @__PURE__ */ jsxs(EmptyState, {
|
|
36
|
+
title,
|
|
37
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
38
|
+
role: "alert",
|
|
39
|
+
children: explain(error)
|
|
40
|
+
}), children]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export { EmptyState, Failure, Loading };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=states.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"states.js","names":[],"sources":["../../src/components/states.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { explain } from \"../lib/api\";\nimport { Spinner } from \"./ui/spinner\";\n\n/** What is shown while the page waits. */\nexport function Loading({ children = \"Loading…\" }: { children?: ReactNode }) {\n return (\n <div role=\"status\" className=\"flex items-center justify-center gap-2 px-5 py-12 text-muted-foreground\">\n <Spinner aria-hidden=\"true\" aria-label={undefined} role={undefined} />\n {children}\n </div>\n );\n}\n\n/**\n * What is shown where there is nothing to show. It says so in a few\n * words (\"No hooks set\") and does not explain the feature.\n */\nexport function EmptyState({ title, children }: { title: string; children?: ReactNode }) {\n return (\n <div className=\"rounded-xl border border-dashed border-input px-5 py-8 text-center text-muted-foreground\">\n <strong className=\"block text-foreground\">{title}</strong>\n {children ? <div className=\"mt-1 grid justify-items-center gap-3\">{children}</div> : null}\n </div>\n );\n}\n\n/** What is shown where something could not be loaded: what went wrong, in words for a person. */\nexport function Failure({ title = \"This could not be loaded\", error, children }: { title?: string; error: unknown; children?: ReactNode }) {\n return (\n <EmptyState title={title}>\n <p role=\"alert\">{explain(error)}</p>\n {children}\n </EmptyState>\n );\n}\n"],"mappings":";;;;;AAKA,SAAgB,QAAQ,EAAE,WAAW,cAAwC;CAC3E,OACE,qBAAC,OAAD;EAAK,MAAK;EAAS,WAAU;EAA7B,UAAA,CACE,oBAAC,SAAD;GAAS,eAAY;GAAO,cAAY,KAAA;GAAW,MAAM,KAAA;EAAY,CAAA,GACpE,QACE;;AAET;;;;;AAMA,SAAgB,WAAW,EAAE,OAAO,YAAqD;CACvF,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,UAAD;GAAQ,WAAU;GAAyB,UAAA;EAAc,CAAA,GACxD,WAAW,oBAAC,OAAD;GAAK,WAAU;GAAwC;EAAc,CAAA,IAAI,IAClF;;AAET;;AAGA,SAAgB,QAAQ,EAAE,QAAQ,4BAA4B,OAAO,YAAsE;CACzI,OACE,qBAAC,YAAD;EAAmB;EAAnB,UAAA,CACE,oBAAC,KAAD;GAAG,MAAK;GAAS,UAAA,QAAQ,KAAK;EAAK,CAAA,GAClC,QACS;;AAEhB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import { Input } from "./ui/input";
|
|
3
|
+
/**
|
|
4
|
+
* A labelled box that can be typed in, with what is usual offered beneath
|
|
5
|
+
* it to choose from. What is typed need not be one of them. Its value is
|
|
6
|
+
* read by name, from the form it is in, or kept by the page (`value`,
|
|
7
|
+
* `onChange`).
|
|
8
|
+
*
|
|
9
|
+
* @param options pairs of what is filled in and what it is shown as
|
|
10
|
+
*/
|
|
11
|
+
export declare function SuggestField({ label, hint, options, value, defaultValue, onChange, className, ...input }: {
|
|
12
|
+
label: string;
|
|
13
|
+
hint?: ReactNode;
|
|
14
|
+
name: string;
|
|
15
|
+
options: Array<[value: string, label: string]>;
|
|
16
|
+
value?: string;
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
} & Omit<ComponentProps<typeof Input>, "name" | "value" | "defaultValue" | "onChange">): import("react").JSX.Element;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { Field, FieldDescription, FieldLabel } from "./ui/field.js";
|
|
3
|
+
import { Input } from "./ui/input.js";
|
|
4
|
+
import { useId, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/suggest-field.tsx
|
|
7
|
+
/** As many suggestions as are shown at once. */
|
|
8
|
+
var MOST = 200;
|
|
9
|
+
/**
|
|
10
|
+
* A labelled box that can be typed in, with what is usual offered beneath
|
|
11
|
+
* it to choose from. What is typed need not be one of them. Its value is
|
|
12
|
+
* read by name, from the form it is in, or kept by the page (`value`,
|
|
13
|
+
* `onChange`).
|
|
14
|
+
*
|
|
15
|
+
* @param options pairs of what is filled in and what it is shown as
|
|
16
|
+
*/
|
|
17
|
+
function SuggestField({ label, hint, options, value, defaultValue = "", onChange, className, ...input }) {
|
|
18
|
+
const id = useId();
|
|
19
|
+
const list = `${id}-choices`;
|
|
20
|
+
const box = useRef(null);
|
|
21
|
+
const [own, setOwn] = useState(defaultValue);
|
|
22
|
+
const text = value ?? own;
|
|
23
|
+
const [showing, setShowing] = useState(null);
|
|
24
|
+
const [active, setActive] = useState(-1);
|
|
25
|
+
const query = showing === "all" ? "" : text.toLowerCase();
|
|
26
|
+
const matches = showing === null ? [] : options.filter(([key, name]) => `${key} ${name}`.toLowerCase().includes(query)).slice(0, MOST);
|
|
27
|
+
const open = matches.length > 0;
|
|
28
|
+
const set = (next) => {
|
|
29
|
+
setOwn(next);
|
|
30
|
+
onChange?.(next);
|
|
31
|
+
};
|
|
32
|
+
const show = (which) => {
|
|
33
|
+
setShowing(which);
|
|
34
|
+
setActive(-1);
|
|
35
|
+
};
|
|
36
|
+
const choose = (key) => {
|
|
37
|
+
set(key);
|
|
38
|
+
show(null);
|
|
39
|
+
};
|
|
40
|
+
const keys = (event) => {
|
|
41
|
+
if (event.key === "Escape" && open) {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
event.stopPropagation();
|
|
44
|
+
show(null);
|
|
45
|
+
}
|
|
46
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
const among = open ? matches : options.slice(0, MOST);
|
|
49
|
+
if (!open) setShowing("all");
|
|
50
|
+
if (among.length === 0) return;
|
|
51
|
+
const next = Math.max(0, Math.min(among.length - 1, (open ? active : -1) + (event.key === "ArrowDown" ? 1 : -1)));
|
|
52
|
+
setActive(next);
|
|
53
|
+
document.getElementById(`${list}-${next}`)?.scrollIntoView?.({ block: "nearest" });
|
|
54
|
+
}
|
|
55
|
+
if (event.key === "Enter" && open && active >= 0) {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
const marked = matches[active];
|
|
58
|
+
if (marked) choose(marked[0]);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ jsxs(Field, { children: [
|
|
62
|
+
/* @__PURE__ */ jsx(FieldLabel, {
|
|
63
|
+
htmlFor: id,
|
|
64
|
+
children: label
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ jsxs("div", {
|
|
67
|
+
className: "relative w-full min-w-0",
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx(Input, {
|
|
70
|
+
...input,
|
|
71
|
+
ref: box,
|
|
72
|
+
id,
|
|
73
|
+
role: "combobox",
|
|
74
|
+
"aria-autocomplete": "list",
|
|
75
|
+
"aria-expanded": open,
|
|
76
|
+
"aria-controls": list,
|
|
77
|
+
"aria-activedescendant": open && active >= 0 ? `${list}-${active}` : void 0,
|
|
78
|
+
autoComplete: "off",
|
|
79
|
+
value: text,
|
|
80
|
+
onChange: (event) => {
|
|
81
|
+
set(event.target.value);
|
|
82
|
+
show("matching");
|
|
83
|
+
},
|
|
84
|
+
onClick: () => show("all"),
|
|
85
|
+
onBlur: () => show(null),
|
|
86
|
+
onKeyDown: keys,
|
|
87
|
+
className: cn("pr-9", className)
|
|
88
|
+
}),
|
|
89
|
+
/* @__PURE__ */ jsx("button", {
|
|
90
|
+
type: "button",
|
|
91
|
+
"aria-label": "Show choices",
|
|
92
|
+
tabIndex: -1,
|
|
93
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
94
|
+
onClick: () => {
|
|
95
|
+
box.current?.focus();
|
|
96
|
+
show(open ? null : "all");
|
|
97
|
+
},
|
|
98
|
+
className: "absolute inset-y-1 right-1 w-7 cursor-pointer rounded-md text-muted-foreground hover:bg-muted",
|
|
99
|
+
children: "▾"
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsx("div", {
|
|
102
|
+
id: list,
|
|
103
|
+
role: "listbox",
|
|
104
|
+
"aria-label": label,
|
|
105
|
+
hidden: !open,
|
|
106
|
+
className: "absolute top-full left-0 z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border bg-popover text-popover-foreground shadow-lg",
|
|
107
|
+
children: matches.map(([key, name], index) => /* @__PURE__ */ jsx("div", {
|
|
108
|
+
id: `${list}-${index}`,
|
|
109
|
+
role: "option",
|
|
110
|
+
"aria-selected": index === active,
|
|
111
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
112
|
+
onClick: () => choose(key),
|
|
113
|
+
className: "cursor-pointer px-3 py-2 text-sm wrap-anywhere hover:bg-muted aria-selected:bg-muted",
|
|
114
|
+
children: name
|
|
115
|
+
}, key))
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
}),
|
|
119
|
+
hint ? /* @__PURE__ */ jsx(FieldDescription, { children: hint }) : null
|
|
120
|
+
] });
|
|
121
|
+
}
|
|
122
|
+
export { SuggestField };
|
|
123
|
+
|
|
124
|
+
//# sourceMappingURL=suggest-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest-field.js","names":[],"sources":["../../src/components/suggest-field.tsx"],"sourcesContent":["import { useId, useRef, useState, type ComponentProps, type KeyboardEvent, type ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { Field, FieldDescription, FieldLabel } from \"./ui/field\";\nimport { Input } from \"./ui/input\";\n\n/** As many suggestions as are shown at once. */\nconst MOST = 200;\n\n/**\n * A labelled box that can be typed in, with what is usual offered beneath\n * it to choose from. What is typed need not be one of them. Its value is\n * read by name, from the form it is in, or kept by the page (`value`,\n * `onChange`).\n *\n * @param options pairs of what is filled in and what it is shown as\n */\nexport function SuggestField({ label, hint, options, value, defaultValue = \"\", onChange, className, ...input }: { label: string; hint?: ReactNode; name: string; options: Array<[value: string, label: string]>; value?: string; defaultValue?: string; onChange?: (value: string) => void } & Omit<ComponentProps<typeof Input>, \"name\" | \"value\" | \"defaultValue\" | \"onChange\">) {\n const id = useId();\n const list = `${id}-choices`;\n const box = useRef<HTMLInputElement>(null);\n const [own, setOwn] = useState(defaultValue);\n const text = value ?? own;\n // Null while the list is closed. Otherwise whether it shows everything, or what matches what is typed.\n const [showing, setShowing] = useState<\"all\" | \"matching\" | null>(null);\n const [active, setActive] = useState(-1);\n\n const query = showing === \"all\" ? \"\" : text.toLowerCase();\n const matches = showing === null ? [] : options.filter(([key, name]) => `${key} ${name}`.toLowerCase().includes(query)).slice(0, MOST);\n const open = matches.length > 0;\n const set = (next: string) => {\n setOwn(next);\n onChange?.(next);\n };\n const show = (which: \"all\" | \"matching\" | null) => {\n setShowing(which);\n setActive(-1);\n };\n const choose = (key: string) => {\n set(key);\n show(null);\n };\n\n const keys = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Escape\" && open) {\n // It closes the list, and not the dialog the box is in.\n event.preventDefault();\n event.stopPropagation();\n show(null);\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n const among = open ? matches : options.slice(0, MOST);\n if (!open) setShowing(\"all\");\n if (among.length === 0) return;\n const next = Math.max(0, Math.min(among.length - 1, (open ? active : -1) + (event.key === \"ArrowDown\" ? 1 : -1)));\n setActive(next);\n document.getElementById(`${list}-${next}`)?.scrollIntoView?.({ block: \"nearest\" });\n }\n if (event.key === \"Enter\" && open && active >= 0) {\n // It chooses what is marked, and does not send the form.\n event.preventDefault();\n const marked = matches[active];\n if (marked) choose(marked[0]);\n }\n };\n\n return (\n <Field>\n <FieldLabel htmlFor={id}>{label}</FieldLabel>\n <div className=\"relative w-full min-w-0\">\n <Input\n {...input}\n ref={box}\n id={id}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={open}\n aria-controls={list}\n aria-activedescendant={open && active >= 0 ? `${list}-${active}` : undefined}\n autoComplete=\"off\"\n value={text}\n onChange={(event) => {\n set(event.target.value);\n show(\"matching\");\n }}\n onClick={() => show(\"all\")}\n onBlur={() => show(null)}\n onKeyDown={keys}\n className={cn(\"pr-9\", className)}\n />\n <button\n type=\"button\"\n aria-label=\"Show choices\"\n tabIndex={-1}\n // Pressing it must not take the cursor out of the box, which would close the list it opens.\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n box.current?.focus();\n show(open ? null : \"all\");\n }}\n className=\"absolute inset-y-1 right-1 w-7 cursor-pointer rounded-md text-muted-foreground hover:bg-muted\"\n >\n ▾\n </button>\n <div id={list} role=\"listbox\" aria-label={label} hidden={!open} className=\"absolute top-full left-0 z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border bg-popover text-popover-foreground shadow-lg\">\n {matches.map(([key, name], index) => (\n <div\n key={key}\n id={`${list}-${index}`}\n role=\"option\"\n aria-selected={index === active}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => choose(key)}\n className=\"cursor-pointer px-3 py-2 text-sm wrap-anywhere hover:bg-muted aria-selected:bg-muted\"\n >\n {name}\n </div>\n ))}\n </div>\n </div>\n {hint ? <FieldDescription>{hint}</FieldDescription> : null}\n </Field>\n );\n}\n"],"mappings":";;;;;;;AAMA,IAAM,OAAO;;;;;;;;;AAUb,SAAgB,aAAa,EAAE,OAAO,MAAM,SAAS,OAAO,eAAe,IAAI,UAAU,WAAW,GAAG,SAA4Q;CACjX,MAAM,KAAK,MAAM;CACjB,MAAM,OAAO,GAAG,GAAG;CACnB,MAAM,MAAM,OAAyB,IAAI;CACzC,MAAM,CAAC,KAAK,UAAU,SAAS,YAAY;CAC3C,MAAM,OAAO,SAAS;CAEtB,MAAM,CAAC,SAAS,cAAc,SAAoC,IAAI;CACtE,MAAM,CAAC,QAAQ,aAAa,SAAS,EAAE;CAEvC,MAAM,QAAQ,YAAY,QAAQ,KAAK,KAAK,YAAY;CACxD,MAAM,UAAU,YAAY,OAAO,CAAC,IAAI,QAAQ,QAAQ,CAAC,KAAK,UAAU,GAAG,IAAI,GAAG,OAAO,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI;CACrI,MAAM,OAAO,QAAQ,SAAS;CAC9B,MAAM,OAAO,SAAiB;EAC5B,OAAO,IAAI;EACX,WAAW,IAAI;CACjB;CACA,MAAM,QAAQ,UAAqC;EACjD,WAAW,KAAK;EAChB,UAAU,EAAE;CACd;CACA,MAAM,UAAU,QAAgB;EAC9B,IAAI,GAAG;EACP,KAAK,IAAI;CACX;CAEA,MAAM,QAAQ,UAA2C;EACvD,IAAI,MAAM,QAAQ,YAAY,MAAM;GAElC,MAAM,eAAe;GACrB,MAAM,gBAAgB;GACtB,KAAK,IAAI;EACX;EACA,IAAI,MAAM,QAAQ,eAAe,MAAM,QAAQ,WAAW;GACxD,MAAM,eAAe;GACrB,MAAM,QAAQ,OAAO,UAAU,QAAQ,MAAM,GAAG,IAAI;GACpD,IAAI,CAAC,MAAM,WAAW,KAAK;GAC3B,IAAI,MAAM,WAAW,GAAG;GACxB,MAAM,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,SAAS,IAAI,OAAO,SAAS,OAAO,MAAM,QAAQ,cAAc,IAAI,GAAG,CAAC;GAChH,UAAU,IAAI;GACd,SAAS,eAAe,GAAG,KAAK,GAAG,MAAM,CAAC,EAAE,iBAAiB,EAAE,OAAO,UAAU,CAAC;EACnF;EACA,IAAI,MAAM,QAAQ,WAAW,QAAQ,UAAU,GAAG;GAEhD,MAAM,eAAe;GACrB,MAAM,SAAS,QAAQ;GACvB,IAAI,QAAQ,OAAO,OAAO,EAAE;EAC9B;CACF;CAEA,OACE,qBAAC,OAAD,EAAA,UAAA;EACE,oBAAC,YAAD;GAAY,SAAS;GAAK,UAAA;EAAkB,CAAA;EAC5C,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACE,oBAAC,OAAD;KACE,GAAI;KACJ,KAAK;KACD;KACJ,MAAK;KACL,qBAAkB;KAClB,iBAAe;KACf,iBAAe;KACf,yBAAuB,QAAQ,UAAU,IAAI,GAAG,KAAK,GAAG,WAAW,KAAA;KACnE,cAAa;KACb,OAAO;KACP,WAAW,UAAU;MACnB,IAAI,MAAM,OAAO,KAAK;MACtB,KAAK,UAAU;KACjB;KACA,eAAe,KAAK,KAAK;KACzB,cAAc,KAAK,IAAI;KACvB,WAAW;KACX,WAAW,GAAG,QAAQ,SAAS;IAChC,CAAA;IACD,oBAAC,UAAD;KACE,MAAK;KACL,cAAW;KACX,UAAU;KAEV,cAAc,UAAU,MAAM,eAAe;KAC7C,eAAe;MACb,IAAI,SAAS,MAAM;MACnB,KAAK,OAAO,OAAO,KAAK;KAC1B;KACA,WAAU;KACX,UAAA;IAEO,CAAA;IACR,oBAAC,OAAD;KAAK,IAAI;KAAM,MAAK;KAAU,cAAY;KAAO,QAAQ,CAAC;KAAM,WAAU;KACvE,UAAA,QAAQ,KAAK,CAAC,KAAK,OAAO,UACzB,oBAAC,OAAD;MAEE,IAAI,GAAG,KAAK,GAAG;MACf,MAAK;MACL,iBAAe,UAAU;MACzB,cAAc,UAAU,MAAM,eAAe;MAC7C,eAAe,OAAO,GAAG;MACzB,WAAU;MAET,UAAA;KACE,GATE,GASF,CACN;IACE,CAAA;GACF;;EACJ,OAAO,oBAAC,kBAAD,EAAA,UAAmB,KAAuB,CAAA,IAAI;CACjD,EAAA,CAAA;AAEX"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
declare const TONES: {
|
|
3
|
+
readonly neutral: "bg-muted text-muted-foreground";
|
|
4
|
+
readonly ok: "bg-success-soft text-success";
|
|
5
|
+
readonly warn: "bg-warning-soft text-warning";
|
|
6
|
+
readonly danger: "bg-destructive-soft text-destructive";
|
|
7
|
+
readonly accent: "bg-accent text-primary";
|
|
8
|
+
readonly agent: "bg-agent-soft text-agent";
|
|
9
|
+
};
|
|
10
|
+
export type Tone = keyof typeof TONES;
|
|
11
|
+
/**
|
|
12
|
+
* A word or two about a thing's state: "Works", "Revoked", "3 tools".
|
|
13
|
+
*
|
|
14
|
+
* @param title said on hover: what the word stands for
|
|
15
|
+
* @param remove for one of several things a thing holds, each of which can be taken away: what the way to take it
|
|
16
|
+
* away is called to a screen reader ("Take audit.read away"), and what it does
|
|
17
|
+
*/
|
|
18
|
+
export declare function Tag({ tone, title, remove, children }: {
|
|
19
|
+
tone?: Tone;
|
|
20
|
+
title?: string;
|
|
21
|
+
remove?: {
|
|
22
|
+
label: string;
|
|
23
|
+
run: () => void;
|
|
24
|
+
};
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { XIcon } from "lucide-react";
|
|
4
|
+
// src/components/tag.tsx
|
|
5
|
+
var TONES = {
|
|
6
|
+
neutral: "bg-muted text-muted-foreground",
|
|
7
|
+
ok: "bg-success-soft text-success",
|
|
8
|
+
warn: "bg-warning-soft text-warning",
|
|
9
|
+
danger: "bg-destructive-soft text-destructive",
|
|
10
|
+
accent: "bg-accent text-primary",
|
|
11
|
+
agent: "bg-agent-soft text-agent"
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A word or two about a thing's state: "Works", "Revoked", "3 tools".
|
|
15
|
+
*
|
|
16
|
+
* @param title said on hover: what the word stands for
|
|
17
|
+
* @param remove for one of several things a thing holds, each of which can be taken away: what the way to take it
|
|
18
|
+
* away is called to a screen reader ("Take audit.read away"), and what it does
|
|
19
|
+
*/
|
|
20
|
+
function Tag({ tone = "neutral", title, remove, children }) {
|
|
21
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
22
|
+
title,
|
|
23
|
+
className: cn("inline-flex items-center gap-1 rounded-full px-2 py-px text-xs font-medium whitespace-nowrap", remove && "pr-0.5", TONES[tone]),
|
|
24
|
+
children: [children, remove ? /* @__PURE__ */ jsx("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
"aria-label": remove.label,
|
|
27
|
+
onClick: remove.run,
|
|
28
|
+
className: "grid size-4 cursor-pointer place-items-center rounded-full hover:bg-destructive-soft hover:text-destructive",
|
|
29
|
+
children: /* @__PURE__ */ jsx(XIcon, {
|
|
30
|
+
"aria-hidden": "true",
|
|
31
|
+
className: "size-3"
|
|
32
|
+
})
|
|
33
|
+
}) : null]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export { Tag };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.js","names":[],"sources":["../../src/components/tag.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { XIcon } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\n\nconst TONES = {\n neutral: \"bg-muted text-muted-foreground\",\n ok: \"bg-success-soft text-success\",\n warn: \"bg-warning-soft text-warning\",\n danger: \"bg-destructive-soft text-destructive\",\n accent: \"bg-accent text-primary\",\n agent: \"bg-agent-soft text-agent\",\n} as const;\n\nexport type Tone = keyof typeof TONES;\n\n/**\n * A word or two about a thing's state: \"Works\", \"Revoked\", \"3 tools\".\n *\n * @param title said on hover: what the word stands for\n * @param remove for one of several things a thing holds, each of which can be taken away: what the way to take it\n * away is called to a screen reader (\"Take audit.read away\"), and what it does\n */\nexport function Tag({ tone = \"neutral\", title, remove, children }: { tone?: Tone; title?: string; remove?: { label: string; run: () => void }; children: ReactNode }) {\n return (\n <span title={title} className={cn(\"inline-flex items-center gap-1 rounded-full px-2 py-px text-xs font-medium whitespace-nowrap\", remove && \"pr-0.5\", TONES[tone])}>\n {children}\n {remove ? (\n <button type=\"button\" aria-label={remove.label} onClick={remove.run} className=\"grid size-4 cursor-pointer place-items-center rounded-full hover:bg-destructive-soft hover:text-destructive\">\n <XIcon aria-hidden=\"true\" className=\"size-3\" />\n </button>\n ) : null}\n </span>\n );\n}\n"],"mappings":";;;;AAIA,IAAM,QAAQ;CACZ,SAAS;CACT,IAAI;CACJ,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,OAAO;AACT;;;;;;;;AAWA,SAAgB,IAAI,EAAE,OAAO,WAAW,OAAO,QAAQ,YAA+G;CACpK,OACE,qBAAC,QAAD;EAAa;EAAO,WAAW,GAAG,gGAAgG,UAAU,UAAU,MAAM,KAAK;EAAjK,UAAA,CACG,UACA,SACC,oBAAC,UAAD;GAAQ,MAAK;GAAS,cAAY,OAAO;GAAO,SAAS,OAAO;GAAK,WAAU;GAC7E,UAAA,oBAAC,OAAD;IAAO,eAAY;IAAO,WAAU;GAAU,CAAA;EACxC,CAAA,IACN,IACA;;AAEV"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { Tone } from "./tag";
|
|
3
|
+
/** Something to copy, such as an address or a key, with the button that copies it. */
|
|
4
|
+
export declare function Copyable({ text }: {
|
|
5
|
+
text: string;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* Several lines of code or configuration, as they are to be typed. `wrap`
|
|
9
|
+
* is for what is read and not typed, such as instructions: its lines are
|
|
10
|
+
* folded, and what is long is scrolled.
|
|
11
|
+
*/
|
|
12
|
+
export declare function Snippet({ wrap, children }: {
|
|
13
|
+
wrap?: boolean;
|
|
14
|
+
children: string;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
declare const NOTICES: Record<Extract<Tone, "neutral" | "warn" | "danger">, string>;
|
|
17
|
+
/** Something a person should read before they go on. */
|
|
18
|
+
export declare function Notice({ tone, children }: {
|
|
19
|
+
tone?: keyof typeof NOTICES;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
/** Pairs of a name and what it is: "Returns to", "claude.ai". */
|
|
23
|
+
export declare function DefinitionList({ items }: {
|
|
24
|
+
items: Array<[term: string, description: ReactNode]>;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
/** A line that matters less than what is around it. */
|
|
27
|
+
export declare function Muted({ small, children }: {
|
|
28
|
+
small?: boolean;
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* Something the person should see to before anything else on the page,
|
|
33
|
+
* with the way to (`action`): what a platform still lacks, said to whoever
|
|
34
|
+
* can put it right.
|
|
35
|
+
*/
|
|
36
|
+
export declare function Callout({ title, action, children }: {
|
|
37
|
+
title: string;
|
|
38
|
+
action?: ReactNode;
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
}): import("react").JSX.Element;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { Button } from "./ui/button.js";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/components/text.tsx
|
|
6
|
+
/** Something to copy, such as an address or a key, with the button that copies it. */
|
|
7
|
+
function Copyable({ text }) {
|
|
8
|
+
const [label, setLabel] = useState("Copy");
|
|
9
|
+
const copy = async () => {
|
|
10
|
+
try {
|
|
11
|
+
await navigator.clipboard.writeText(text);
|
|
12
|
+
setLabel("Copied");
|
|
13
|
+
} catch {
|
|
14
|
+
setLabel("Select and copy it");
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
18
|
+
className: "flex items-center gap-2 rounded-lg border border-input bg-muted py-1.5 pr-1.5 pl-3",
|
|
19
|
+
children: [/* @__PURE__ */ jsx("code", {
|
|
20
|
+
className: "min-w-0 flex-1 text-sm wrap-anywhere",
|
|
21
|
+
children: text
|
|
22
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
23
|
+
variant: "outline",
|
|
24
|
+
size: "sm",
|
|
25
|
+
onClick: copy,
|
|
26
|
+
children: label
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Several lines of code or configuration, as they are to be typed. `wrap`
|
|
32
|
+
* is for what is read and not typed, such as instructions: its lines are
|
|
33
|
+
* folded, and what is long is scrolled.
|
|
34
|
+
*/
|
|
35
|
+
function Snippet({ wrap = false, children }) {
|
|
36
|
+
return /* @__PURE__ */ jsx("pre", {
|
|
37
|
+
className: cn("rounded-lg border border-input bg-muted px-3.5 py-3 text-xs leading-normal", wrap ? "max-h-96 overflow-y-auto wrap-anywhere whitespace-pre-wrap" : "overflow-x-auto"),
|
|
38
|
+
children
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
var NOTICES = {
|
|
42
|
+
neutral: "bg-muted text-muted-foreground",
|
|
43
|
+
warn: "bg-warning-soft text-warning",
|
|
44
|
+
danger: "bg-destructive-soft text-destructive"
|
|
45
|
+
};
|
|
46
|
+
/** Something a person should read before they go on. */
|
|
47
|
+
function Notice({ tone = "neutral", children }) {
|
|
48
|
+
return /* @__PURE__ */ jsx("p", {
|
|
49
|
+
role: "note",
|
|
50
|
+
className: cn("rounded-lg px-3 py-2 text-sm", NOTICES[tone]),
|
|
51
|
+
children
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** Pairs of a name and what it is: "Returns to", "claude.ai". */
|
|
55
|
+
function DefinitionList({ items }) {
|
|
56
|
+
return /* @__PURE__ */ jsx("dl", {
|
|
57
|
+
className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-sm",
|
|
58
|
+
children: items.map(([term, description]) => /* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: "contents",
|
|
60
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
61
|
+
className: "text-muted-foreground",
|
|
62
|
+
children: term
|
|
63
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
64
|
+
className: "min-w-0 wrap-anywhere",
|
|
65
|
+
children: description
|
|
66
|
+
})]
|
|
67
|
+
}, term))
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/** A line that matters less than what is around it. */
|
|
71
|
+
function Muted({ small = false, children }) {
|
|
72
|
+
return /* @__PURE__ */ jsx("p", {
|
|
73
|
+
className: cn("text-muted-foreground", small && "text-sm"),
|
|
74
|
+
children
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Something the person should see to before anything else on the page,
|
|
79
|
+
* with the way to (`action`): what a platform still lacks, said to whoever
|
|
80
|
+
* can put it right.
|
|
81
|
+
*/
|
|
82
|
+
function Callout({ title, action, children }) {
|
|
83
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
84
|
+
role: "status",
|
|
85
|
+
className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2.5 rounded-xl border border-primary/30 bg-accent px-4 py-3",
|
|
86
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
87
|
+
className: "grid min-w-0 gap-0.5",
|
|
88
|
+
children: [/* @__PURE__ */ jsx("strong", { children: title }), children ? /* @__PURE__ */ jsx("span", {
|
|
89
|
+
className: "text-sm text-muted-foreground",
|
|
90
|
+
children
|
|
91
|
+
}) : null]
|
|
92
|
+
}), action]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
export { Callout, Copyable, DefinitionList, Muted, Notice, Snippet };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../src/components/text.tsx"],"sourcesContent":["import { useState, type ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { Button } from \"./ui/button\";\nimport type { Tone } from \"./tag\";\n\n/** Something to copy, such as an address or a key, with the button that copies it. */\nexport function Copyable({ text }: { text: string }) {\n const [label, setLabel] = useState(\"Copy\");\n const copy = async () => {\n try {\n await navigator.clipboard.writeText(text);\n setLabel(\"Copied\");\n } catch {\n setLabel(\"Select and copy it\");\n }\n };\n return (\n <div className=\"flex items-center gap-2 rounded-lg border border-input bg-muted py-1.5 pr-1.5 pl-3\">\n <code className=\"min-w-0 flex-1 text-sm wrap-anywhere\">{text}</code>\n <Button variant=\"outline\" size=\"sm\" onClick={copy}>\n {label}\n </Button>\n </div>\n );\n}\n\n/**\n * Several lines of code or configuration, as they are to be typed. `wrap`\n * is for what is read and not typed, such as instructions: its lines are\n * folded, and what is long is scrolled.\n */\nexport function Snippet({ wrap = false, children }: { wrap?: boolean; children: string }) {\n return <pre className={cn(\"rounded-lg border border-input bg-muted px-3.5 py-3 text-xs leading-normal\", wrap ? \"max-h-96 overflow-y-auto wrap-anywhere whitespace-pre-wrap\" : \"overflow-x-auto\")}>{children}</pre>;\n}\n\nconst NOTICES: Record<Extract<Tone, \"neutral\" | \"warn\" | \"danger\">, string> = {\n neutral: \"bg-muted text-muted-foreground\",\n warn: \"bg-warning-soft text-warning\",\n danger: \"bg-destructive-soft text-destructive\",\n};\n\n/** Something a person should read before they go on. */\nexport function Notice({ tone = \"neutral\", children }: { tone?: keyof typeof NOTICES; children: ReactNode }) {\n return (\n <p role=\"note\" className={cn(\"rounded-lg px-3 py-2 text-sm\", NOTICES[tone])}>\n {children}\n </p>\n );\n}\n\n/** Pairs of a name and what it is: \"Returns to\", \"claude.ai\". */\nexport function DefinitionList({ items }: { items: Array<[term: string, description: ReactNode]> }) {\n return (\n <dl className=\"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-sm\">\n {items.map(([term, description]) => (\n <div key={term} className=\"contents\">\n <dt className=\"text-muted-foreground\">{term}</dt>\n <dd className=\"min-w-0 wrap-anywhere\">{description}</dd>\n </div>\n ))}\n </dl>\n );\n}\n\n/** A line that matters less than what is around it. */\nexport function Muted({ small = false, children }: { small?: boolean; children: ReactNode }) {\n return <p className={cn(\"text-muted-foreground\", small && \"text-sm\")}>{children}</p>;\n}\n\n/**\n * Something the person should see to before anything else on the page,\n * with the way to (`action`): what a platform still lacks, said to whoever\n * can put it right.\n */\nexport function Callout({ title, action, children }: { title: string; action?: ReactNode; children?: ReactNode }) {\n return (\n <div role=\"status\" className=\"flex flex-wrap items-center justify-between gap-x-4 gap-y-2.5 rounded-xl border border-primary/30 bg-accent px-4 py-3\">\n <div className=\"grid min-w-0 gap-0.5\">\n <strong>{title}</strong>\n {children ? <span className=\"text-sm text-muted-foreground\">{children}</span> : null}\n </div>\n {action}\n </div>\n );\n}\n"],"mappings":";;;;;;AAMA,SAAgB,SAAS,EAAE,QAA0B;CACnD,MAAM,CAAC,OAAO,YAAY,SAAS,MAAM;CACzC,MAAM,OAAO,YAAY;EACvB,IAAI;GACF,MAAM,UAAU,UAAU,UAAU,IAAI;GACxC,SAAS,QAAQ;EACnB,QAAQ;GACN,SAAS,oBAAoB;EAC/B;CACF;CACA,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,QAAD;GAAM,WAAU;GAAwC,UAAA;EAAW,CAAA,GACnE,oBAAC,QAAD;GAAQ,SAAQ;GAAU,MAAK;GAAK,SAAS;GAC1C,UAAA;EACK,CAAA,CACL;;AAET;;;;;;AAOA,SAAgB,QAAQ,EAAE,OAAO,OAAO,YAAkD;CACxF,OAAO,oBAAC,OAAD;EAAK,WAAW,GAAG,8EAA8E,OAAO,+DAA+D,iBAAiB;EAAI;CAAc,CAAA;AACnN;AAEA,IAAM,UAAwE;CAC5E,SAAS;CACT,MAAM;CACN,QAAQ;AACV;;AAGA,SAAgB,OAAO,EAAE,OAAO,WAAW,YAAkE;CAC3G,OACE,oBAAC,KAAD;EAAG,MAAK;EAAO,WAAW,GAAG,gCAAgC,QAAQ,KAAK;EACvE;CACA,CAAA;AAEP;;AAGA,SAAgB,eAAe,EAAE,SAAmE;CAClG,OACE,oBAAC,MAAD;EAAI,WAAU;EACX,UAAA,MAAM,KAAK,CAAC,MAAM,iBACjB,qBAAC,OAAD;GAAgB,WAAU;GAA1B,UAAA,CACE,oBAAC,MAAD;IAAI,WAAU;IAAyB,UAAA;GAAS,CAAA,GAChD,oBAAC,MAAD;IAAI,WAAU;IAAyB,UAAA;GAAgB,CAAA,CACpD;EAHK,GAAA,IAGL,CACN;CACC,CAAA;AAER;;AAGA,SAAgB,MAAM,EAAE,QAAQ,OAAO,YAAsD;CAC3F,OAAO,oBAAC,KAAD;EAAG,WAAW,GAAG,yBAAyB,SAAS,SAAS;EAAI;CAAY,CAAA;AACrF;;;;;;AAOA,SAAgB,QAAQ,EAAE,OAAO,QAAQ,YAAyE;CAChH,OACE,qBAAC,OAAD;EAAK,MAAK;EAAS,WAAU;EAA7B,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,UAAD,EAAA,UAAS,MAAc,CAAA,GACtB,WAAW,oBAAC,QAAD;IAAM,WAAU;IAAiC;GAAe,CAAA,IAAI,IAC7E;EACJ,CAAA,GAAA,MACE;;AAET"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The face of something a person can open: its own picture (an emoji or a
|
|
4
|
+
* symbol), or its letters in a colour of its own. An agent's is round, and
|
|
5
|
+
* in the agents' colour, so that it is told from an app at a glance.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Face({ name, picture, agent }: {
|
|
8
|
+
name: string;
|
|
9
|
+
picture?: string | null;
|
|
10
|
+
agent?: boolean;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Something a person can open, as a tile: its face, its name, a line or two
|
|
14
|
+
* about it, and a few words beneath (`meta`). `action` is something to do
|
|
15
|
+
* with it without opening it, drawn in its corner.
|
|
16
|
+
*/
|
|
17
|
+
export declare function Tile({ href, name, text, picture, agent, meta, action, onOpen }: {
|
|
18
|
+
href: string;
|
|
19
|
+
name: string;
|
|
20
|
+
text?: string | null;
|
|
21
|
+
picture?: string | null;
|
|
22
|
+
agent?: boolean;
|
|
23
|
+
meta?: ReactNode;
|
|
24
|
+
action?: ReactNode;
|
|
25
|
+
onOpen?: () => void;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
/** Tiles, as many to a row as fit. */
|
|
28
|
+
export declare function Tiles({ children }: {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { hueOf, initials } from "../lib/format.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/tile.tsx
|
|
5
|
+
/**
|
|
6
|
+
* The face of something a person can open: its own picture (an emoji or a
|
|
7
|
+
* symbol), or its letters in a colour of its own. An agent's is round, and
|
|
8
|
+
* in the agents' colour, so that it is told from an app at a glance.
|
|
9
|
+
*/
|
|
10
|
+
function Face({ name, picture, agent = false }) {
|
|
11
|
+
const shape = agent ? "rounded-full bg-agent-soft text-agent ring-2 ring-agent/45 ring-offset-2 ring-offset-card" : "rounded-xl hue-face";
|
|
12
|
+
const hue = { "--hue": String(hueOf(name)) };
|
|
13
|
+
return /* @__PURE__ */ jsx("span", {
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
style: agent ? void 0 : hue,
|
|
16
|
+
className: cn("grid size-11.5 flex-none place-items-center leading-none font-bold", shape, picture ? "text-2xl" : "text-base tracking-wide"),
|
|
17
|
+
children: picture ? picture.trim() : initials(name)
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Something a person can open, as a tile: its face, its name, a line or two
|
|
22
|
+
* about it, and a few words beneath (`meta`). `action` is something to do
|
|
23
|
+
* with it without opening it, drawn in its corner.
|
|
24
|
+
*/
|
|
25
|
+
function Tile({ href, name, text, picture, agent = false, meta, action, onOpen }) {
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
className: "relative min-w-0",
|
|
28
|
+
children: [/* @__PURE__ */ jsxs("a", {
|
|
29
|
+
href,
|
|
30
|
+
onClick: onOpen,
|
|
31
|
+
className: cn("flex h-full gap-3.5 rounded-xl border bg-card p-4 text-foreground no-underline shadow-sm transition hover:-translate-y-0.5 hover:shadow-lg motion-reduce:transition-none motion-reduce:hover:translate-y-0", agent ? "hover:border-agent/50" : "hover:border-input", action ? "pr-12" : ""),
|
|
32
|
+
children: [/* @__PURE__ */ jsx(Face, {
|
|
33
|
+
name,
|
|
34
|
+
picture,
|
|
35
|
+
agent
|
|
36
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
37
|
+
className: "grid min-w-0 content-start gap-0.5",
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx("span", {
|
|
40
|
+
className: "truncate font-semibold",
|
|
41
|
+
children: name
|
|
42
|
+
}),
|
|
43
|
+
text ? /* @__PURE__ */ jsx("span", {
|
|
44
|
+
className: "line-clamp-2 text-sm text-muted-foreground",
|
|
45
|
+
children: text
|
|
46
|
+
}) : null,
|
|
47
|
+
meta ? /* @__PURE__ */ jsx("span", {
|
|
48
|
+
className: "mt-1.5 flex flex-wrap items-center gap-1.5",
|
|
49
|
+
children: meta
|
|
50
|
+
}) : null
|
|
51
|
+
]
|
|
52
|
+
})]
|
|
53
|
+
}), action ? /* @__PURE__ */ jsx("div", {
|
|
54
|
+
className: "absolute top-2 right-2",
|
|
55
|
+
children: action
|
|
56
|
+
}) : null]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** Tiles, as many to a row as fit. */
|
|
60
|
+
function Tiles({ children }) {
|
|
61
|
+
return /* @__PURE__ */ jsx("div", {
|
|
62
|
+
className: "grid grid-cols-[repeat(auto-fill,minmax(min(270px,100%),1fr))] gap-3.5",
|
|
63
|
+
children
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export { Face, Tile, Tiles };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=tile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.js","names":[],"sources":["../../src/components/tile.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { hueOf, initials } from \"../lib/format\";\n\n/**\n * The face of something a person can open: its own picture (an emoji or a\n * symbol), or its letters in a colour of its own. An agent's is round, and\n * in the agents' colour, so that it is told from an app at a glance.\n */\nexport function Face({ name, picture, agent = false }: { name: string; picture?: string | null; agent?: boolean }) {\n const shape = agent ? \"rounded-full bg-agent-soft text-agent ring-2 ring-agent/45 ring-offset-2 ring-offset-card\" : \"rounded-xl hue-face\";\n const hue = { \"--hue\": String(hueOf(name)) } as CSSProperties;\n return (\n <span aria-hidden=\"true\" style={agent ? undefined : hue} className={cn(\"grid size-11.5 flex-none place-items-center leading-none font-bold\", shape, picture ? \"text-2xl\" : \"text-base tracking-wide\")}>\n {picture ? picture.trim() : initials(name)}\n </span>\n );\n}\n\n/**\n * Something a person can open, as a tile: its face, its name, a line or two\n * about it, and a few words beneath (`meta`). `action` is something to do\n * with it without opening it, drawn in its corner.\n */\nexport function Tile({ href, name, text, picture, agent = false, meta, action, onOpen }: { href: string; name: string; text?: string | null; picture?: string | null; agent?: boolean; meta?: ReactNode; action?: ReactNode; onOpen?: () => void }) {\n return (\n <div className=\"relative min-w-0\">\n <a\n href={href}\n onClick={onOpen}\n className={cn(\n \"flex h-full gap-3.5 rounded-xl border bg-card p-4 text-foreground no-underline shadow-sm transition hover:-translate-y-0.5 hover:shadow-lg motion-reduce:transition-none motion-reduce:hover:translate-y-0\",\n agent ? \"hover:border-agent/50\" : \"hover:border-input\",\n action ? \"pr-12\" : \"\",\n )}\n >\n <Face name={name} picture={picture} agent={agent} />\n <span className=\"grid min-w-0 content-start gap-0.5\">\n <span className=\"truncate font-semibold\">{name}</span>\n {text ? <span className=\"line-clamp-2 text-sm text-muted-foreground\">{text}</span> : null}\n {meta ? <span className=\"mt-1.5 flex flex-wrap items-center gap-1.5\">{meta}</span> : null}\n </span>\n </a>\n {action ? <div className=\"absolute top-2 right-2\">{action}</div> : null}\n </div>\n );\n}\n\n/** Tiles, as many to a row as fit. */\nexport function Tiles({ children }: { children: ReactNode }) {\n return <div className=\"grid grid-cols-[repeat(auto-fill,minmax(min(270px,100%),1fr))] gap-3.5\">{children}</div>;\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,KAAK,EAAE,MAAM,SAAS,QAAQ,SAAqE;CACjH,MAAM,QAAQ,QAAQ,8FAA8F;CACpH,MAAM,MAAM,EAAE,SAAS,OAAO,MAAM,IAAI,CAAC,EAAE;CAC3C,OACE,oBAAC,QAAD;EAAM,eAAY;EAAO,OAAO,QAAQ,KAAA,IAAY;EAAK,WAAW,GAAG,sEAAsE,OAAO,UAAU,aAAa,yBAAyB;EACjM,UAAA,UAAU,QAAQ,KAAK,IAAI,SAAS,IAAI;CACrC,CAAA;AAEV;;;;;;AAOA,SAAgB,KAAK,EAAE,MAAM,MAAM,MAAM,SAAS,QAAQ,OAAO,MAAM,QAAQ,UAAqK;CAClP,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,qBAAC,KAAD;GACQ;GACN,SAAS;GACT,WAAW,GACT,8MACA,QAAQ,0BAA0B,sBAClC,SAAS,UAAU,EACrB;GAPF,UAAA,CASE,oBAAC,MAAD;IAAY;IAAe;IAAgB;GAAQ,CAAA,GACnD,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA;KACE,oBAAC,QAAD;MAAM,WAAU;MAA0B,UAAA;KAAW,CAAA;KACpD,OAAO,oBAAC,QAAD;MAAM,WAAU;MAA8C,UAAA;KAAW,CAAA,IAAI;KACpF,OAAO,oBAAC,QAAD;MAAM,WAAU;MAA8C,UAAA;KAAW,CAAA,IAAI;IACjF;GACL,CAAA,CAAA;EACF,CAAA,GAAA,SAAS,oBAAC,OAAD;GAAK,WAAU;GAA0B,UAAA;EAAY,CAAA,IAAI,IAChE;;AAET;;AAGA,SAAgB,MAAM,EAAE,YAAqC;CAC3D,OAAO,oBAAC,OAAD;EAAK,WAAU;EAA0E;CAAc,CAAA;AAChH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tell the person something briefly, without stopping them. It can be
|
|
3
|
+
* called from anywhere. Where several are said at once, the last three
|
|
4
|
+
* are shown.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toast(message: string, { danger }?: {
|
|
7
|
+
danger?: boolean;
|
|
8
|
+
}): void;
|
|
9
|
+
/** Where toasts appear. FinchlyProvider has one: a page does not add its own. */
|
|
10
|
+
export declare function Toaster(): import("react").JSX.Element;
|