@argon8/react 0.0.0-stage → 0.2.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/CHANGELOG.md +12 -0
- package/LICENSE +202 -0
- package/README.md +15 -2
- package/dist/alert.d.ts +51 -0
- package/dist/alert.js +29 -0
- package/dist/button.d.ts +20 -0
- package/dist/button.js +47 -0
- package/dist/choice.d.ts +53 -0
- package/dist/choice.js +31 -0
- package/dist/cn.d.ts +2 -0
- package/dist/cn.js +14 -0
- package/dist/code.d.ts +22 -0
- package/dist/code.js +40 -0
- package/dist/containers.d.ts +39 -0
- package/dist/containers.js +36 -0
- package/dist/dialog.d.ts +28 -0
- package/dist/dialog.js +62 -0
- package/dist/field.d.ts +26 -0
- package/dist/field.js +25 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/menu.d.ts +18 -0
- package/dist/menu.js +117 -0
- package/dist/navigation.d.ts +35 -0
- package/dist/navigation.js +39 -0
- package/dist/page.d.ts +38 -0
- package/dist/page.js +80 -0
- package/dist/sheet.d.ts +20 -0
- package/dist/sheet.js +96 -0
- package/dist/sidebar.d.ts +56 -0
- package/dist/sidebar.js +112 -0
- package/dist/slot.d.ts +4 -0
- package/dist/slot.js +25 -0
- package/dist/status.d.ts +40 -0
- package/dist/status.js +48 -0
- package/dist/strict.css +2 -0
- package/dist/styles.css +30 -0
- package/dist/table.d.ts +26 -0
- package/dist/table.js +36 -0
- package/dist/tabs.d.ts +16 -0
- package/dist/tabs.js +26 -0
- package/dist/term.d.ts +9 -0
- package/dist/term.js +26 -0
- package/dist/time.d.ts +32 -0
- package/dist/time.js +76 -0
- package/dist/toast.d.ts +19 -0
- package/dist/toast.js +55 -0
- package/package.json +56 -3
package/dist/sheet.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { cn } from "./cn.js";
|
|
4
|
+
import { Slot } from "./slot.js";
|
|
5
|
+
const SheetContext = createContext(null);
|
|
6
|
+
function useSheet() {
|
|
7
|
+
const ctx = useContext(SheetContext);
|
|
8
|
+
if (!ctx)
|
|
9
|
+
throw new Error("Sheet parts must be used inside <Sheet>.");
|
|
10
|
+
return ctx;
|
|
11
|
+
}
|
|
12
|
+
export function Sheet({ open: openProp, onOpenChange, defaultOpen = false, children }) {
|
|
13
|
+
const id = useId();
|
|
14
|
+
const [own, setOwn] = useState(defaultOpen);
|
|
15
|
+
const open = openProp ?? own;
|
|
16
|
+
const value = useMemo(() => ({
|
|
17
|
+
open,
|
|
18
|
+
setOpen: (next) => {
|
|
19
|
+
if (openProp === undefined)
|
|
20
|
+
setOwn(next);
|
|
21
|
+
onOpenChange?.(next);
|
|
22
|
+
},
|
|
23
|
+
titleId: `${id}-title`,
|
|
24
|
+
descriptionId: `${id}-description`,
|
|
25
|
+
}), [id, open, openProp, onOpenChange]);
|
|
26
|
+
return _jsx(SheetContext.Provider, { value: value, children: children });
|
|
27
|
+
}
|
|
28
|
+
export function SheetTrigger({ asChild, onClick, ...props }) {
|
|
29
|
+
const { open, setOpen } = useSheet();
|
|
30
|
+
const Comp = asChild ? Slot : "button";
|
|
31
|
+
return (_jsx(Comp, { "data-slot": "sheet-trigger", type: asChild ? undefined : "button", "aria-haspopup": "dialog", "aria-expanded": open, onClick: (e) => {
|
|
32
|
+
onClick?.(e);
|
|
33
|
+
if (!e.defaultPrevented)
|
|
34
|
+
setOpen(true);
|
|
35
|
+
}, ...props }));
|
|
36
|
+
}
|
|
37
|
+
export function SheetContent({ className, children, ...props }) {
|
|
38
|
+
const { open, setOpen, titleId, descriptionId } = useSheet();
|
|
39
|
+
const ref = useRef(null);
|
|
40
|
+
const returnTo = useRef(null);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const d = ref.current;
|
|
43
|
+
if (!d)
|
|
44
|
+
return;
|
|
45
|
+
if (open && !d.open) {
|
|
46
|
+
returnTo.current = document.activeElement;
|
|
47
|
+
d.showModal();
|
|
48
|
+
d.querySelector("[data-autofocus]")?.focus();
|
|
49
|
+
}
|
|
50
|
+
else if (!open && d.open) {
|
|
51
|
+
d.close();
|
|
52
|
+
}
|
|
53
|
+
}, [open]);
|
|
54
|
+
return (_jsx("dialog", { ref: ref, "data-slot": "sheet-content", "aria-labelledby": titleId, "aria-describedby": descriptionId, onCancel: (e) => {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
setOpen(false);
|
|
57
|
+
}, onClose: () => {
|
|
58
|
+
if (returnTo.current instanceof HTMLElement)
|
|
59
|
+
returnTo.current.focus();
|
|
60
|
+
if (open)
|
|
61
|
+
setOpen(false);
|
|
62
|
+
},
|
|
63
|
+
// A click on the backdrop lands on the <dialog> itself; the panel's own content is inside the div.
|
|
64
|
+
onClick: (e) => {
|
|
65
|
+
if (e.target === e.currentTarget)
|
|
66
|
+
setOpen(false);
|
|
67
|
+
}, className: cn("fixed inset-y-0 right-0 left-auto m-0 h-dvh max-h-none w-full max-w-none border-l border-line bg-surface-raised p-0 text-ink shadow-float sm:max-w-md", "lg:backdrop:bg-transparent", className), ...props, children: _jsx("div", { className: "flex h-full flex-col", children: children }) }));
|
|
68
|
+
}
|
|
69
|
+
export function SheetHeader({ className, children, ...props }) {
|
|
70
|
+
const { setOpen } = useSheet();
|
|
71
|
+
return (_jsxs("div", { "data-slot": "sheet-header", className: cn("flex items-start gap-3 border-b border-line px-5 py-4", className), ...props, children: [_jsx("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: children }), _jsx("button", { type: "button", "aria-label": "Close", onClick: () => setOpen(false), className: "-mt-1 -mr-2 grid size-8 shrink-0 place-items-center rounded-tag text-ink-muted hover:bg-surface-hover hover:text-ink", children: _jsx("svg", { viewBox: "0 0 12 12", "aria-hidden": true, className: "size-3", children: _jsx("path", { d: "M2.5 2.5l7 7M9.5 2.5l-7 7", className: "fill-none stroke-current", strokeWidth: "1.5", strokeLinecap: "round" }) }) })] }));
|
|
72
|
+
}
|
|
73
|
+
export function SheetTitle({ className, ...props }) {
|
|
74
|
+
const { titleId } = useSheet();
|
|
75
|
+
return _jsx("h2", { id: titleId, "data-slot": "sheet-title", className: cn("text-section font-semibold", className), ...props });
|
|
76
|
+
}
|
|
77
|
+
export function SheetDescription({ className, ...props }) {
|
|
78
|
+
const { descriptionId } = useSheet();
|
|
79
|
+
return _jsx("p", { id: descriptionId, "data-slot": "sheet-description", className: cn("text-body text-ink-muted", className), ...props });
|
|
80
|
+
}
|
|
81
|
+
export function SheetBody({ className, ...props }) {
|
|
82
|
+
return _jsx("div", { "data-slot": "sheet-body", className: cn("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-5 py-4", className), ...props });
|
|
83
|
+
}
|
|
84
|
+
/** Cancel then the primary, at the bottom right (patterns.md §9). */
|
|
85
|
+
export function SheetFooter({ className, ...props }) {
|
|
86
|
+
return _jsx("div", { "data-slot": "sheet-footer", className: cn("flex flex-wrap justify-end gap-2 border-t border-line px-5 py-3", className), ...props });
|
|
87
|
+
}
|
|
88
|
+
export function SheetClose({ asChild, onClick, ...props }) {
|
|
89
|
+
const { setOpen } = useSheet();
|
|
90
|
+
const Comp = asChild ? Slot : "button";
|
|
91
|
+
return (_jsx(Comp, { "data-slot": "sheet-close", type: asChild ? undefined : "button", onClick: (e) => {
|
|
92
|
+
onClick?.(e);
|
|
93
|
+
if (!e.defaultPrevented)
|
|
94
|
+
setOpen(false);
|
|
95
|
+
}, ...props }));
|
|
96
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import { Button } from "./button.js";
|
|
3
|
+
type SidebarState = {
|
|
4
|
+
id: string;
|
|
5
|
+
open: boolean;
|
|
6
|
+
setOpen: (open: boolean) => void;
|
|
7
|
+
toggle: () => void;
|
|
8
|
+
};
|
|
9
|
+
/** The sidebar's state: whether the menu is open below `lg`. Close it on route change. */
|
|
10
|
+
export declare function useSidebar(): SidebarState;
|
|
11
|
+
export declare function SidebarProvider({ open: openProp, onOpenChange, defaultOpen, className, children, ...props }: ComponentProps<"div"> & {
|
|
12
|
+
open?: boolean;
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
14
|
+
defaultOpen?: boolean;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
/** Below `lg` only: the wordmark and the Menu button, 48 px, sticky. */
|
|
17
|
+
export declare function SidebarTopBar({ className, ...props }: ComponentProps<"header">): import("react").JSX.Element;
|
|
18
|
+
/** The Menu button below `lg`. Shows the total attention count when given one. */
|
|
19
|
+
export declare function SidebarTrigger({ children, count, countLabel, className, onClick, ...props }: ComponentProps<typeof Button> & {
|
|
20
|
+
count?: number;
|
|
21
|
+
countLabel?: string;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
23
|
+
/** The sidebar itself: a column from `lg`; below it, hidden until the Menu opens it under the top bar. */
|
|
24
|
+
export declare function Sidebar({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
25
|
+
/** Top of the sidebar: the wordmark and the switcher. Give the wordmark `hidden lg:block`: below `lg` the top bar shows it. */
|
|
26
|
+
export declare function SidebarHeader({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
27
|
+
/** The scrolling middle: the app's main navigation landmark. */
|
|
28
|
+
export declare function SidebarContent({ className, "aria-label": label, ...props }: ComponentProps<"nav">): import("react").JSX.Element;
|
|
29
|
+
/** Bottom of the sidebar: the account line. Outside the navigation landmark. */
|
|
30
|
+
export declare function SidebarFooter({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
31
|
+
/** One labelled group of places (Watch, Set up). */
|
|
32
|
+
export declare function SidebarGroup({ className, children, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
33
|
+
export declare function SidebarGroupLabel({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
34
|
+
export declare function SidebarMenu({ className, ...props }: ComponentProps<"ul">): import("react").JSX.Element;
|
|
35
|
+
export declare function SidebarMenuItem({ className, ...props }: ComponentProps<"li">): import("react").JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* A place in the app. An `<a>` by default; `asChild` hands its props to the app's router link.
|
|
38
|
+
* `isActive` marks the current section (and stays on for its detail pages). Choosing one closes the
|
|
39
|
+
* menu below `lg`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function SidebarMenuButton({ asChild, isActive, className, onClick, ...props }: ComponentProps<"a"> & {
|
|
42
|
+
asChild?: boolean;
|
|
43
|
+
isActive?: boolean;
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
}): import("react").JSX.Element;
|
|
46
|
+
/** What needs the user in that place ("2 need you"). Nothing for totals; nothing when zero. */
|
|
47
|
+
export declare function SidebarMenuBadge({ value, label, className }: {
|
|
48
|
+
value: number;
|
|
49
|
+
label: string;
|
|
50
|
+
className?: string;
|
|
51
|
+
}): import("react").JSX.Element | null;
|
|
52
|
+
/** Everything right of the sidebar: system banners, then the page's <main id="main">. */
|
|
53
|
+
export declare function SidebarInset({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
54
|
+
/** The system banners' place: what stops everything, on every page. Empty renders nothing. */
|
|
55
|
+
export declare function SystemBanners({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
56
|
+
export {};
|
package/dist/sidebar.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useId, useMemo, useState } from "react";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import { cn } from "./cn.js";
|
|
5
|
+
import { Slot } from "./slot.js";
|
|
6
|
+
import { Count } from "./status.js";
|
|
7
|
+
const SidebarContext = createContext(null);
|
|
8
|
+
/** The sidebar's state: whether the menu is open below `lg`. Close it on route change. */
|
|
9
|
+
export function useSidebar() {
|
|
10
|
+
const ctx = useContext(SidebarContext);
|
|
11
|
+
if (!ctx)
|
|
12
|
+
throw new Error("useSidebar must be used inside <SidebarProvider>.");
|
|
13
|
+
return ctx;
|
|
14
|
+
}
|
|
15
|
+
export function SidebarProvider({ open: openProp, onOpenChange, defaultOpen = false, className, children, ...props }) {
|
|
16
|
+
const id = useId();
|
|
17
|
+
const [own, setOwn] = useState(defaultOpen);
|
|
18
|
+
const open = openProp ?? own;
|
|
19
|
+
const value = useMemo(() => {
|
|
20
|
+
const setOpen = (next) => {
|
|
21
|
+
if (openProp === undefined)
|
|
22
|
+
setOwn(next);
|
|
23
|
+
onOpenChange?.(next);
|
|
24
|
+
};
|
|
25
|
+
return { id: `${id}-sidebar`, open, setOpen, toggle: () => setOpen(!open) };
|
|
26
|
+
}, [id, open, openProp, onOpenChange]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!open)
|
|
29
|
+
return;
|
|
30
|
+
const onKey = (e) => {
|
|
31
|
+
if (e.key === "Escape")
|
|
32
|
+
value.setOpen(false);
|
|
33
|
+
};
|
|
34
|
+
window.addEventListener("keydown", onKey);
|
|
35
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
36
|
+
}, [open, value]);
|
|
37
|
+
return (_jsx(SidebarContext.Provider, { value: value, children: _jsx("div", { "data-slot": "sidebar-wrapper", className: cn("min-h-svh lg:grid lg:grid-cols-[14rem_minmax(0,1fr)]", className), ...props, children: children }) }));
|
|
38
|
+
}
|
|
39
|
+
/** Below `lg` only: the wordmark and the Menu button, 48 px, sticky. */
|
|
40
|
+
export function SidebarTopBar({ className, ...props }) {
|
|
41
|
+
return _jsx("header", { "data-slot": "sidebar-top-bar", className: cn("sticky top-0 z-30 flex h-12 items-center gap-3 border-b border-line bg-surface px-4 lg:hidden", className), ...props });
|
|
42
|
+
}
|
|
43
|
+
/** The Menu button below `lg`. Shows the total attention count when given one. */
|
|
44
|
+
export function SidebarTrigger({ children = "Menu", count, countLabel, className, onClick, ...props }) {
|
|
45
|
+
const { id, open, toggle } = useSidebar();
|
|
46
|
+
return (_jsxs(Button, { "data-slot": "sidebar-trigger", variant: "ghost", "aria-expanded": open, "aria-controls": id, className: cn("ml-auto", className), onClick: (e) => {
|
|
47
|
+
onClick?.(e);
|
|
48
|
+
if (!e.defaultPrevented)
|
|
49
|
+
toggle();
|
|
50
|
+
}, ...props, children: [children, count ? _jsx(Count, { value: count, label: countLabel ?? `${count} need you` }) : null] }));
|
|
51
|
+
}
|
|
52
|
+
/** The sidebar itself: a column from `lg`; below it, hidden until the Menu opens it under the top bar. */
|
|
53
|
+
export function Sidebar({ className, ...props }) {
|
|
54
|
+
const { id, open } = useSidebar();
|
|
55
|
+
return (_jsx("div", { id: id, "data-slot": "sidebar", "data-open": open, className: cn("hidden flex-col border-b border-line bg-surface data-[open=true]:flex", "lg:sticky lg:top-0 lg:flex lg:h-svh lg:border-r lg:border-b-0", className), ...props }));
|
|
56
|
+
}
|
|
57
|
+
/** Top of the sidebar: the wordmark and the switcher. Give the wordmark `hidden lg:block`: below `lg` the top bar shows it. */
|
|
58
|
+
export function SidebarHeader({ className, ...props }) {
|
|
59
|
+
return _jsx("div", { "data-slot": "sidebar-header", className: cn("flex flex-col gap-2 px-3 pt-3 pb-2", className), ...props });
|
|
60
|
+
}
|
|
61
|
+
/** The scrolling middle: the app's main navigation landmark. */
|
|
62
|
+
export function SidebarContent({ className, "aria-label": label = "Main", ...props }) {
|
|
63
|
+
return _jsx("nav", { "data-slot": "sidebar-content", "aria-label": label, className: cn("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-3 py-2", className), ...props });
|
|
64
|
+
}
|
|
65
|
+
/** Bottom of the sidebar: the account line. Outside the navigation landmark. */
|
|
66
|
+
export function SidebarFooter({ className, ...props }) {
|
|
67
|
+
return _jsx("div", { "data-slot": "sidebar-footer", className: cn("flex flex-col gap-2 border-t border-line px-3 py-3", className), ...props });
|
|
68
|
+
}
|
|
69
|
+
const GroupContext = createContext(undefined);
|
|
70
|
+
/** One labelled group of places (Watch, Set up). */
|
|
71
|
+
export function SidebarGroup({ className, children, ...props }) {
|
|
72
|
+
const labelId = useId();
|
|
73
|
+
return (_jsx(GroupContext.Provider, { value: labelId, children: _jsx("div", { "data-slot": "sidebar-group", role: "group", "aria-labelledby": labelId, className: cn("flex flex-col gap-1", className), ...props, children: children }) }));
|
|
74
|
+
}
|
|
75
|
+
export function SidebarGroupLabel({ className, ...props }) {
|
|
76
|
+
const id = useContext(GroupContext);
|
|
77
|
+
return _jsx("div", { id: id, "data-slot": "sidebar-group-label", className: cn("px-2 text-meta font-medium text-ink-muted", className), ...props });
|
|
78
|
+
}
|
|
79
|
+
export function SidebarMenu({ className, ...props }) {
|
|
80
|
+
return _jsx("ul", { "data-slot": "sidebar-menu", className: cn("flex flex-col gap-0.5", className), ...props });
|
|
81
|
+
}
|
|
82
|
+
export function SidebarMenuItem({ className, ...props }) {
|
|
83
|
+
return _jsx("li", { "data-slot": "sidebar-menu-item", className: cn("relative flex items-center", className), ...props });
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A place in the app. An `<a>` by default; `asChild` hands its props to the app's router link.
|
|
87
|
+
* `isActive` marks the current section (and stays on for its detail pages). Choosing one closes the
|
|
88
|
+
* menu below `lg`.
|
|
89
|
+
*/
|
|
90
|
+
export function SidebarMenuButton({ asChild, isActive, className, onClick, ...props }) {
|
|
91
|
+
const { setOpen } = useSidebar();
|
|
92
|
+
const Comp = asChild ? Slot : "a";
|
|
93
|
+
return (_jsx(Comp, { "data-slot": "sidebar-menu-button", "data-active": isActive || undefined, "aria-current": isActive ? "page" : undefined, className: cn("flex w-full min-w-0 items-center gap-2 rounded-control px-2 py-3 text-prose text-ink-muted hover:bg-surface-hover hover:text-ink lg:py-1.5 lg:text-body", "data-active:bg-surface-sunk data-active:font-medium data-active:text-ink", className), onClick: (e) => {
|
|
94
|
+
onClick?.(e);
|
|
95
|
+
if (!e.defaultPrevented)
|
|
96
|
+
setOpen(false);
|
|
97
|
+
}, ...props }));
|
|
98
|
+
}
|
|
99
|
+
/** What needs the user in that place ("2 need you"). Nothing for totals; nothing when zero. */
|
|
100
|
+
export function SidebarMenuBadge({ value, label, className }) {
|
|
101
|
+
if (!value)
|
|
102
|
+
return null;
|
|
103
|
+
return (_jsx("span", { "data-slot": "sidebar-menu-badge", className: cn("pointer-events-none absolute right-2", className), children: _jsx(Count, { value: value, label: label }) }));
|
|
104
|
+
}
|
|
105
|
+
/** Everything right of the sidebar: system banners, then the page's <main id="main">. */
|
|
106
|
+
export function SidebarInset({ className, ...props }) {
|
|
107
|
+
return _jsx("div", { "data-slot": "sidebar-inset", className: cn("flex min-w-0 flex-col", className), ...props });
|
|
108
|
+
}
|
|
109
|
+
/** The system banners' place: what stops everything, on every page. Empty renders nothing. */
|
|
110
|
+
export function SystemBanners({ className, ...props }) {
|
|
111
|
+
return _jsx("div", { "data-slot": "system-banners", className: cn("flex flex-col gap-3 px-4 pt-4 empty:hidden sm:px-6", className), ...props });
|
|
112
|
+
}
|
package/dist/slot.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactElement, type ReactNode } from "react";
|
|
2
|
+
export declare function Slot({ children, ...props }: HTMLAttributes<HTMLElement> & {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
} & Record<string, unknown>): ReactElement<Record<string, unknown>, string | import("react").JSXElementConstructor<any>> | null;
|
package/dist/slot.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Children, cloneElement, isValidElement } from "react";
|
|
2
|
+
import { cn } from "./cn.js";
|
|
3
|
+
// `asChild` (the shadcn and Radix pattern): a component renders its one child instead of its own
|
|
4
|
+
// element and gives it its props, so an app's router <Link> can be a sidebar item or a tab.
|
|
5
|
+
// className is merged; event handlers run the child's first, then ours unless the child prevented it.
|
|
6
|
+
export function Slot({ children, ...props }) {
|
|
7
|
+
const child = Children.only(children);
|
|
8
|
+
if (!isValidElement(child))
|
|
9
|
+
return null;
|
|
10
|
+
const own = child.props;
|
|
11
|
+
const merged = { ...props, ...own };
|
|
12
|
+
for (const key of Object.keys(props)) {
|
|
13
|
+
const ours = props[key];
|
|
14
|
+
const theirs = own[key];
|
|
15
|
+
if (/^on[A-Z]/.test(key) && typeof ours === "function" && typeof theirs === "function") {
|
|
16
|
+
merged[key] = (event, ...rest) => {
|
|
17
|
+
theirs(event, ...rest);
|
|
18
|
+
if (!event?.defaultPrevented)
|
|
19
|
+
ours(event, ...rest);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
merged.className = cn(props.className, own.className);
|
|
24
|
+
return cloneElement(child, merged);
|
|
25
|
+
}
|
package/dist/status.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The five tones, by what they mean for the data (docs/components.md 1.3), worst first:
|
|
4
|
+
* danger (stopped), warning (behind or partial), info (working), neutral (off, or not yet), success.
|
|
5
|
+
*/
|
|
6
|
+
export type Tone = "danger" | "warning" | "info" | "neutral" | "success";
|
|
7
|
+
export declare const TONES: readonly Tone[];
|
|
8
|
+
/** A view's tone is the worst of its parts. */
|
|
9
|
+
export declare function worstTone(...tones: (Tone | null | undefined | false)[]): Tone;
|
|
10
|
+
export declare const toneText: (t: Tone) => string;
|
|
11
|
+
export declare const toneSolid: (t: Tone) => string;
|
|
12
|
+
/** A tone's left edge, for a calm panel that carries a status (`border-l-4` with it). */
|
|
13
|
+
export declare const toneEdge: (t: Tone) => string;
|
|
14
|
+
/** A tone's tint and line, for a strong panel (what stops everything). */
|
|
15
|
+
export declare const toneTint: (t: Tone) => string;
|
|
16
|
+
/** A tone's shape, so tones differ without colour. Decorative: the words beside it say it. */
|
|
17
|
+
export declare function ToneIcon({ tone, className, live, size }: {
|
|
18
|
+
tone: Tone;
|
|
19
|
+
className?: string;
|
|
20
|
+
live?: boolean;
|
|
21
|
+
size?: 12 | 16;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
23
|
+
/** A status: its shape for scanning, and always the words. `live` pulses a working status. */
|
|
24
|
+
export declare function Badge({ tone, children, title, live, className }: {
|
|
25
|
+
tone?: Tone;
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
title?: string;
|
|
28
|
+
live?: boolean;
|
|
29
|
+
className?: string;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* A count beside a nav item or a button: `danger` when the things counted need someone, else
|
|
33
|
+
* `neutral`. The figure is decorative; `label` is what a screen reader hears ("2 need you").
|
|
34
|
+
*/
|
|
35
|
+
export declare function Count({ value, label, tone, className }: {
|
|
36
|
+
value: number;
|
|
37
|
+
label: string;
|
|
38
|
+
tone?: "danger" | "neutral";
|
|
39
|
+
className?: string;
|
|
40
|
+
}): import("react").JSX.Element;
|
package/dist/status.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "./cn.js";
|
|
3
|
+
export const TONES = ["danger", "warning", "info", "neutral", "success"];
|
|
4
|
+
/** A view's tone is the worst of its parts. */
|
|
5
|
+
export function worstTone(...tones) {
|
|
6
|
+
return tones.filter(Boolean).reduce((a, b) => (TONES.indexOf(b) < TONES.indexOf(a) ? b : a), "success");
|
|
7
|
+
}
|
|
8
|
+
const TONE = {
|
|
9
|
+
danger: { text: "text-danger", solid: "text-danger-solid", badge: "border-danger-line bg-danger-tint text-danger", edge: "border-l-danger-solid", tint: "border-danger-line bg-danger-tint" },
|
|
10
|
+
warning: { text: "text-warning", solid: "text-warning-solid", badge: "border-warning-line bg-warning-tint text-warning", edge: "border-l-warning-solid", tint: "border-warning-line bg-warning-tint" },
|
|
11
|
+
info: { text: "text-info", solid: "text-info-solid", badge: "border-info-line bg-info-tint text-info", edge: "border-l-info-solid", tint: "border-info-line bg-info-tint" },
|
|
12
|
+
neutral: { text: "text-neutral", solid: "text-neutral-solid", badge: "border-neutral-line bg-neutral-tint text-neutral", edge: "border-l-neutral-solid", tint: "border-neutral-line bg-neutral-tint" },
|
|
13
|
+
success: { text: "text-success", solid: "text-success-solid", badge: "border-success-line bg-success-tint text-success", edge: "border-l-success-solid", tint: "border-success-line bg-success-tint" },
|
|
14
|
+
};
|
|
15
|
+
export const toneText = (t) => TONE[t].text;
|
|
16
|
+
export const toneSolid = (t) => TONE[t].solid;
|
|
17
|
+
/** A tone's left edge, for a calm panel that carries a status (`border-l-4` with it). */
|
|
18
|
+
export const toneEdge = (t) => TONE[t].edge;
|
|
19
|
+
/** A tone's tint and line, for a strong panel (what stops everything). */
|
|
20
|
+
export const toneTint = (t) => TONE[t].tint;
|
|
21
|
+
/** A tone's shape, so tones differ without colour. Decorative: the words beside it say it. */
|
|
22
|
+
export function ToneIcon({ tone, className, live, size = 12 }) {
|
|
23
|
+
const cls = cn(size === 16 ? "size-4" : "size-3", "shrink-0", TONE[tone].solid, live && tone === "info" && "motion-safe:animate-pulse", className);
|
|
24
|
+
const common = { viewBox: "0 0 12 12", "aria-hidden": true, focusable: "false", className: cls, "data-tone": tone };
|
|
25
|
+
switch (tone) {
|
|
26
|
+
case "danger":
|
|
27
|
+
return (_jsxs("svg", { ...common, children: [_jsx("path", { d: "M3.8 0.5h4.4l3.3 3.3v4.4l-3.3 3.3H3.8L0.5 8.2V3.8z", className: "fill-current" }), _jsx("path", { d: "M6 3v3.4M6 8.2v.6", className: "stroke-on-danger", strokeWidth: "1.5", strokeLinecap: "round" })] }));
|
|
28
|
+
case "warning":
|
|
29
|
+
return (_jsxs("svg", { ...common, children: [_jsx("path", { d: "M6 0.8l5.4 10H0.6z", className: "fill-current" }), _jsx("path", { d: "M6 4.3v2.9M6 8.7v.2", className: "stroke-surface", strokeWidth: "1.3", strokeLinecap: "round" })] }));
|
|
30
|
+
case "info":
|
|
31
|
+
return (_jsxs("svg", { ...common, children: [_jsx("circle", { cx: "6", cy: "6", r: "4.9", className: "fill-none stroke-current", strokeWidth: "1.4" }), _jsx("path", { d: "M6 1.1a4.9 4.9 0 0 1 0 9.8z", className: "fill-current" })] }));
|
|
32
|
+
case "success":
|
|
33
|
+
return (_jsxs("svg", { ...common, children: [_jsx("circle", { cx: "6", cy: "6", r: "5.5", className: "fill-current" }), _jsx("path", { d: "M3.4 6.2l1.8 1.8 3.5-3.6", className: "fill-none stroke-surface", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
34
|
+
default:
|
|
35
|
+
return (_jsx("svg", { ...common, children: _jsx("circle", { cx: "6", cy: "6", r: "4.6", className: "fill-none stroke-current", strokeWidth: "1.6" }) }));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** A status: its shape for scanning, and always the words. `live` pulses a working status. */
|
|
39
|
+
export function Badge({ tone = "neutral", children, title, live, className }) {
|
|
40
|
+
return (_jsxs("span", { title: title, "data-tone": tone, className: cn("inline-flex max-w-full items-center gap-1 rounded-tag border px-1.5 py-0.5 text-meta font-medium", TONE[tone].badge, className), children: [_jsx(ToneIcon, { tone: tone, live: live }), _jsx("span", { className: "min-w-0", children: children })] }));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A count beside a nav item or a button: `danger` when the things counted need someone, else
|
|
44
|
+
* `neutral`. The figure is decorative; `label` is what a screen reader hears ("2 need you").
|
|
45
|
+
*/
|
|
46
|
+
export function Count({ value, label, tone = "danger", className }) {
|
|
47
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, "data-tone": tone, className: cn("rounded-tag px-1.5 text-meta leading-4 font-semibold tabular-nums", tone === "danger" ? "bg-danger-solid text-on-danger" : "bg-neutral-tint text-neutral", className), children: value }), _jsxs("span", { className: "sr-only", children: [", ", label] })] }));
|
|
48
|
+
}
|
package/dist/strict.css
ADDED
package/dist/styles.css
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* What a product app imports, after Tailwind:
|
|
3
|
+
*
|
|
4
|
+
* @import "tailwindcss";
|
|
5
|
+
* @import "@argon8/react/strict.css";
|
|
6
|
+
* @import "@argon8/react/styles.css";
|
|
7
|
+
*
|
|
8
|
+
* The tokens and their Tailwind theme (from @argon8/tokens), the components' classes (@source), and
|
|
9
|
+
* the base layer that follows from the tokens. No colour, size or duration is defined here:
|
|
10
|
+
* @argon8/tokens is the one source. strict.css deletes Tailwind's default palette so only the
|
|
11
|
+
* tokens compile.
|
|
12
|
+
*/
|
|
13
|
+
@import "@argon8/tokens/tailwind.css";
|
|
14
|
+
|
|
15
|
+
/* Tailwind scans these for the classes the components use. */
|
|
16
|
+
@source "./";
|
|
17
|
+
|
|
18
|
+
@layer base {
|
|
19
|
+
/* A bare `border` means the divider token, not currentColor. */
|
|
20
|
+
*, ::before, ::after { border-color: var(--a8-color-line); }
|
|
21
|
+
|
|
22
|
+
/* Figures line up in columns wherever they are data. */
|
|
23
|
+
td, time, [data-numeric] { font-variant-numeric: tabular-nums; }
|
|
24
|
+
|
|
25
|
+
/* The focus ring: accent, 2px, offset 2px, on every focusable thing. */
|
|
26
|
+
:focus-visible { outline: 2px solid var(--a8-color-accent); outline-offset: 2px; }
|
|
27
|
+
|
|
28
|
+
/* A dialog's backdrop. (Tailwind's backdrop: variant works too; this is the default for every dialog.) */
|
|
29
|
+
dialog::backdrop { background-color: var(--a8-color-overlay); }
|
|
30
|
+
}
|
package/dist/table.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
export type Density = "dense" | "compact" | "comfortable";
|
|
3
|
+
export declare function DensityProvider({ density, children }: {
|
|
4
|
+
density: "comfortable" | "compact";
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
/** `multiline`: some cells hold more than one line (a badge and its reason), so every cell reads from the top. */
|
|
8
|
+
export declare function Table({ caption, density: own, fixed, stickyHeader, multiline, className, children, ...props }: ComponentProps<"table"> & {
|
|
9
|
+
caption: string;
|
|
10
|
+
density?: Density;
|
|
11
|
+
fixed?: boolean;
|
|
12
|
+
stickyHeader?: boolean;
|
|
13
|
+
multiline?: boolean;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
export declare function THead({ className, ...props }: ComponentProps<"thead">): import("react").JSX.Element;
|
|
16
|
+
export declare function TBody({ className, ...props }: ComponentProps<"tbody">): import("react").JSX.Element;
|
|
17
|
+
/** `link`: the whole row leads somewhere, so it shows hover. */
|
|
18
|
+
export declare function Tr({ className, link, ...props }: ComponentProps<"tr"> & {
|
|
19
|
+
link?: boolean;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
export declare function Th({ className, num, scope, ...props }: ComponentProps<"th"> & {
|
|
22
|
+
num?: boolean;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
export declare function Td({ className, num, ...props }: ComponentProps<"td"> & {
|
|
25
|
+
num?: boolean;
|
|
26
|
+
}): import("react").JSX.Element;
|
package/dist/table.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { cn } from "./cn.js";
|
|
4
|
+
const DensityCtx = createContext("comfortable");
|
|
5
|
+
// D30: tables are comfortable unless the person picks compact for the whole app (one setting, not
|
|
6
|
+
// one per table). A table may still say `dense` for logs and long lists of IDs.
|
|
7
|
+
const AppDensityCtx = createContext("comfortable");
|
|
8
|
+
export function DensityProvider({ density, children }) {
|
|
9
|
+
return _jsx(AppDensityCtx, { value: density, children: children });
|
|
10
|
+
}
|
|
11
|
+
// The height is a minimum: a cell with more than one line grows, keeping its padding.
|
|
12
|
+
const ROW = { dense: "h-row-dense py-1", compact: "h-row-compact py-1.5", comfortable: "h-row-comfortable py-2" };
|
|
13
|
+
/** `multiline`: some cells hold more than one line (a badge and its reason), so every cell reads from the top. */
|
|
14
|
+
export function Table({ caption, density: own, fixed, stickyHeader, multiline, className, children, ...props }) {
|
|
15
|
+
const app = useContext(AppDensityCtx);
|
|
16
|
+
const density = own ?? app;
|
|
17
|
+
return (_jsx("div", { className: cn("overflow-x-auto", className), children: _jsxs("table", { "data-density": density, "data-sticky": stickyHeader ? "" : undefined, "data-multiline": multiline ? "" : undefined, className: cn("w-full border-collapse text-body", fixed && "table-fixed"), ...props, children: [_jsx("caption", { className: "sr-only", children: caption }), _jsx(DensityCtx, { value: density, children: children })] }) }));
|
|
18
|
+
}
|
|
19
|
+
export function THead({ className, ...props }) {
|
|
20
|
+
return _jsx("thead", { className: cn("border-b border-line text-meta text-ink-muted [[data-sticky]_&]:sticky [[data-sticky]_&]:top-0 [[data-sticky]_&]:bg-surface", className), ...props });
|
|
21
|
+
}
|
|
22
|
+
export function TBody({ className, ...props }) {
|
|
23
|
+
return _jsx("tbody", { className: cn("divide-y divide-line", className), ...props });
|
|
24
|
+
}
|
|
25
|
+
/** `link`: the whole row leads somewhere, so it shows hover. */
|
|
26
|
+
export function Tr({ className, link, ...props }) {
|
|
27
|
+
return _jsx("tr", { className: cn(link && "hover:bg-surface-hover", className), ...props });
|
|
28
|
+
}
|
|
29
|
+
export function Th({ className, num, scope = "col", ...props }) {
|
|
30
|
+
const d = useContext(DensityCtx);
|
|
31
|
+
return _jsx("th", { scope: scope, className: cn(ROW[d], "px-3 text-left font-medium [[data-multiline]_tbody_&]:align-top", num && "text-right", className), ...props });
|
|
32
|
+
}
|
|
33
|
+
export function Td({ className, num, ...props }) {
|
|
34
|
+
const d = useContext(DensityCtx);
|
|
35
|
+
return _jsx("td", { className: cn(ROW[d], "px-3 align-middle [[data-multiline]_&]:align-top", num && "text-right tabular-nums", className), ...props });
|
|
36
|
+
}
|
package/dist/tabs.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
export declare function Tabs({ className, children, ...props }: ComponentProps<"nav"> & {
|
|
3
|
+
"aria-label": string;
|
|
4
|
+
}): import("react").JSX.Element;
|
|
5
|
+
/** One tab. An `<a>` by default; `asChild` hands its props to the app's router link. */
|
|
6
|
+
export declare function TabsLink({ asChild, isActive, className, children, ...props }: ComponentProps<"a"> & {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
isActive?: boolean;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
/** What inside the tab needs the user (Rejected rows 12). Not for plain totals. */
|
|
12
|
+
export declare function TabsCount({ value, label, className }: {
|
|
13
|
+
value: number;
|
|
14
|
+
label: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
}): import("react").JSX.Element | null;
|
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "./cn.js";
|
|
3
|
+
import { Slot } from "./slot.js";
|
|
4
|
+
import { Count } from "./status.js";
|
|
5
|
+
// docs/patterns.md §7. Tabs on a detail page, below its status panel. Each tab is a URL, so they
|
|
6
|
+
// are links in a <nav> with aria-current, not an ARIA tablist; Back, refresh and a copied link all
|
|
7
|
+
// land on the same tab. 2 to 5 tabs; the row scrolls sideways instead of wrapping.
|
|
8
|
+
//
|
|
9
|
+
// <Tabs aria-label="Run">
|
|
10
|
+
// <TabsLink asChild isActive><Link to="." search={{ tab: undefined }}>Summary</Link></TabsLink>
|
|
11
|
+
// <TabsLink asChild><Link to="." search={{ tab: "rows" }}>Rejected rows <TabsCount value={12} label="12 rejected rows" /></Link></TabsLink>
|
|
12
|
+
// </Tabs>
|
|
13
|
+
export function Tabs({ className, children, ...props }) {
|
|
14
|
+
return (_jsx("nav", { "data-slot": "tabs", className: cn("-mx-4 overflow-x-auto px-4 sm:mx-0 sm:px-0", className), ...props, children: _jsx("ul", { className: "flex min-w-max gap-5 border-b border-line", children: children }) }));
|
|
15
|
+
}
|
|
16
|
+
/** One tab. An `<a>` by default; `asChild` hands its props to the app's router link. */
|
|
17
|
+
export function TabsLink({ asChild, isActive, className, children, ...props }) {
|
|
18
|
+
const Comp = asChild ? Slot : "a";
|
|
19
|
+
return (_jsx("li", { className: "flex", children: _jsx(Comp, { "data-slot": "tabs-link", "data-active": isActive || undefined, "aria-current": isActive ? "page" : undefined, className: cn("-mb-px inline-flex items-center gap-1.5 border-b-2 border-transparent pt-1 pb-2 text-body whitespace-nowrap text-ink-muted hover:border-line-strong hover:text-ink", "data-active:border-ink data-active:font-medium data-active:text-ink", className), ...props, children: children }) }));
|
|
20
|
+
}
|
|
21
|
+
/** What inside the tab needs the user (Rejected rows 12). Not for plain totals. */
|
|
22
|
+
export function TabsCount({ value, label, className }) {
|
|
23
|
+
if (!value)
|
|
24
|
+
return null;
|
|
25
|
+
return _jsx(Count, { value: value, label: label, tone: "neutral", className: className });
|
|
26
|
+
}
|
package/dist/term.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A word that needs explaining (docs/components.md 3.6, Tooltip / Term). Opens on hover, on keyboard focus and on a tap
|
|
4
|
+
* (an `abbr title` shows nothing on focus or touch); closes on Escape or when focus leaves.
|
|
5
|
+
*/
|
|
6
|
+
export declare function Term({ tip, children }: {
|
|
7
|
+
tip: ReactNode;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}): import("react").JSX.Element;
|
package/dist/term.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useState } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* A word that needs explaining (docs/components.md 3.6, Tooltip / Term). Opens on hover, on keyboard focus and on a tap
|
|
5
|
+
* (an `abbr title` shows nothing on focus or touch); closes on Escape or when focus leaves.
|
|
6
|
+
*/
|
|
7
|
+
export function Term({ tip, children }) {
|
|
8
|
+
const id = useId();
|
|
9
|
+
const [open, setOpen] = useState(false);
|
|
10
|
+
const [pinned, setPinned] = useState(false);
|
|
11
|
+
const show = open || pinned;
|
|
12
|
+
const onKey = (e) => {
|
|
13
|
+
if (e.key === "Escape" && show) {
|
|
14
|
+
e.stopPropagation();
|
|
15
|
+
setOpen(false);
|
|
16
|
+
setPinned(false);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return (_jsxs("span", { className: "relative inline-block", onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false), children: [_jsx("button", { type: "button", "aria-expanded": show, "aria-describedby": show ? id : undefined, onFocus: () => setOpen(true), onBlur: () => {
|
|
20
|
+
setOpen(false);
|
|
21
|
+
setPinned(false);
|
|
22
|
+
}, onClick: (e) => {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
setPinned((p) => !p);
|
|
25
|
+
}, onKeyDown: onKey, className: "cursor-help text-left underline decoration-ink-subtle decoration-dotted underline-offset-2", children: children }), _jsx("span", { id: id, role: "tooltip", hidden: !show, className: "absolute top-full left-0 z-20 mt-1 w-64 max-w-[80vw] rounded-control border border-line bg-surface-raised p-2 text-meta font-normal whitespace-normal text-ink-muted normal-case shadow-float", children: tip })] }));
|
|
26
|
+
}
|
package/dist/time.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type Instant = Date | string | null | undefined;
|
|
2
|
+
declare function local(d: Date, withDate: boolean): string;
|
|
3
|
+
/** "3 min ago", "in 2 hours". */
|
|
4
|
+
export declare function relativeText(d: Date, now: number): string;
|
|
5
|
+
/** An instant: local date and time (no year when it is this year), UTC in the tooltip. `relative` adds "· 3 min ago". */
|
|
6
|
+
export declare function When({ at, relative: rel, fallback, timeOnly }: {
|
|
7
|
+
at: Instant;
|
|
8
|
+
relative?: boolean;
|
|
9
|
+
fallback?: string;
|
|
10
|
+
timeOnly?: boolean;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
/** A calendar day as people say it: "Nov 9" ("Nov 9, 2025" in another year). The same on the server and in the browser. */
|
|
13
|
+
export declare function dayText(at: Date | string): string;
|
|
14
|
+
/** A date that is a calendar day in the data (a watermark): the day, ISO and UTC in the tooltip. */
|
|
15
|
+
export declare function Day({ at, fallback, className }: {
|
|
16
|
+
at: Instant;
|
|
17
|
+
fallback?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* A period: "Oct 26 – Nov 9". Periods end at midnight of the day after their last day, so the end
|
|
22
|
+
* shown is the last day the period covers.
|
|
23
|
+
*/
|
|
24
|
+
export declare function DayRange({ start, end }: {
|
|
25
|
+
start: Instant;
|
|
26
|
+
end: Instant;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
export declare function dayRangeText(start: Date | string, end: Date | string): string;
|
|
29
|
+
export declare function Ago({ seconds }: {
|
|
30
|
+
seconds: number | null;
|
|
31
|
+
}): import("react").JSX.Element;
|
|
32
|
+
export { local as formatLocal };
|