@lanfermann/ui 0.3.0 → 0.5.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/dist/components/anchor-heading/anchor-heading.d.ts +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.js +5 -10
- package/dist/components/button/button.d.ts +3 -0
- package/dist/components/button/button.js +14 -4
- package/dist/components/button-group/button-group-context.js +14 -0
- package/dist/components/button-group/button-group-variants.d.ts +14 -0
- package/dist/components/button-group/button-group-variants.js +93 -0
- package/dist/components/button-group/button-group.d.ts +36 -0
- package/dist/components/button-group/button-group.js +46 -0
- package/dist/components/code-block/code-block-frame.js +22 -6
- package/dist/components/code-block/code-block-live.d.ts +15 -3
- package/dist/components/code-block/code-block-live.js +14 -6
- package/dist/components/code-block/code-block.d.ts +8 -3
- package/dist/components/code-block/code-block.js +9 -3
- package/dist/components/code-block/code-keys.d.ts +24 -0
- package/dist/components/code-block/code-keys.js +107 -0
- package/dist/components/code-block/code-lines-live.d.ts +7 -0
- package/dist/components/code-block/code-lines-live.js +167 -0
- package/dist/components/code-block/code-lines-view.d.ts +1 -0
- package/dist/components/code-block/code-lines-view.js +50 -18
- package/dist/components/code-block/code-lines.d.ts +3 -0
- package/dist/components/code-block/code-scroll.js +2 -1
- package/dist/components/code-block/code-tabs-frame.js +12 -5
- package/dist/components/code-block/code-tabs.d.ts +10 -4
- package/dist/components/code-block/code-tabs.js +9 -6
- package/dist/components/code-block/highlight.d.ts +1 -0
- package/dist/components/code-block/line-diff.js +135 -0
- package/dist/components/code-block/lines.js +23 -1
- package/dist/components/copy-page/copy-page.d.ts +4 -4
- package/dist/components/copy-page/copy-page.js +16 -28
- package/dist/components/docs-layout/docs-layout.d.ts +1 -1
- package/dist/components/docs-layout/docs-layout.js +3 -3
- package/dist/components/docs-layout/docs-nav.d.ts +51 -0
- package/dist/components/docs-layout/docs-nav.js +60 -0
- package/dist/components/grow/grow.d.ts +20 -0
- package/dist/components/grow/grow.js +104 -0
- package/dist/components/heading/heading.d.ts +4 -0
- package/dist/components/heading/heading.js +8 -4
- package/dist/components/hover-card/hover-card.d.ts +24 -0
- package/dist/components/hover-card/hover-card.js +51 -0
- package/dist/components/pager/pager.js +19 -24
- package/dist/components/scroll-fade/scroll-fade.d.ts +29 -0
- package/dist/components/scroll-fade/scroll-fade.js +40 -0
- package/dist/components/scroll-fade/use-scroll-edges.d.ts +13 -0
- package/dist/{internal/scroll-edges.js → components/scroll-fade/use-scroll-edges.js} +10 -7
- package/dist/components/section/section.d.ts +2 -1
- package/dist/components/section/section.js +2 -1
- package/dist/components/segmented-control/segmented-control.d.ts +7 -1
- package/dist/components/segmented-control/segmented-control.js +22 -11
- package/dist/components/select/select.d.ts +4 -1
- package/dist/components/select/select.js +15 -3
- package/dist/components/shimmer/shimmer.d.ts +21 -0
- package/dist/components/shimmer/shimmer.js +24 -0
- package/dist/components/side-nav/side-nav.js +11 -20
- package/dist/components/site-header/site-header.d.ts +1 -1
- package/dist/components/site-header/site-header.js +6 -3
- package/dist/components/slider/slider.d.ts +3 -1
- package/dist/components/slider/slider.js +45 -19
- package/dist/components/table/table.js +2 -1
- package/dist/components/tabs/tabs.js +3 -2
- package/dist/components/theme-switch/theme-switch.d.ts +47 -0
- package/dist/components/theme-switch/theme-switch.js +102 -0
- package/dist/components/trace/trace.d.ts +71 -0
- package/dist/components/trace/trace.js +201 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +10 -2
- package/dist/internal/render-as.js +24 -0
- package/dist/internal/rule.js +5 -4
- package/package.json +1 -1
- package/src/styles/button-group.css +57 -0
- package/src/styles/code.css +102 -38
- package/src/styles/marks.css +10 -0
- package/src/styles/motion.css +4 -3
- package/src/styles/scroll-fade.css +26 -20
- package/src/styles/shimmer.css +68 -0
- package/src/styles/slider.css +57 -19
- package/src/styles.css +2 -1
- package/dist/components/page-header/page-header.d.ts +0 -30
- package/dist/components/page-header/page-header.js +0 -49
- package/dist/internal/scroll-fade.js +0 -24
- package/src/styles/tabs.css +0 -39
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Icon } from "../icon/icon.js";
|
|
3
|
+
import { Segment, SegmentedControl } from "../segmented-control/segmented-control.js";
|
|
4
|
+
import { Select, SelectContent, SelectItem, SelectTrigger } from "../select/select.js";
|
|
5
|
+
import { cn } from "../../lib/cn.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { ComputerIcon, Moon02Icon, Sun03Icon } from "@hugeicons/core-free-icons";
|
|
8
|
+
import { useMemo } from "react";
|
|
9
|
+
// src/components/theme-switch/theme-switch.tsx
|
|
10
|
+
const themes = [
|
|
11
|
+
{
|
|
12
|
+
value: "system",
|
|
13
|
+
icon: ComputerIcon
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: "light",
|
|
17
|
+
icon: Sun03Icon
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: "dark",
|
|
21
|
+
icon: Moon02Icon
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
const defaultLabels = {
|
|
25
|
+
system: "System",
|
|
26
|
+
light: "Hell",
|
|
27
|
+
dark: "Dunkel"
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The choice between the system's appearance, light and dark. Two forms of the same choice: a
|
|
31
|
+
* select that shows the chosen one by symbol and name, and three symbols in a round trough whose
|
|
32
|
+
* thumb travels to the chosen one.
|
|
33
|
+
*
|
|
34
|
+
* It is the control only. It holds a choice and reports it (`onValueChange`); it does not
|
|
35
|
+
* remember the choice, read the system's setting or change the page. The app does that: it sets
|
|
36
|
+
* `data-theme="paper"` or `"ink"` on `<html>`, and for `system` follows
|
|
37
|
+
* `prefers-color-scheme`.
|
|
38
|
+
*/
|
|
39
|
+
function ThemeSwitch(props) {
|
|
40
|
+
return props.variant === "segmented" ? /* @__PURE__ */ jsx(ThemeSegments, { ...props }) : /* @__PURE__ */ jsx(ThemeSelect, { ...props });
|
|
41
|
+
}
|
|
42
|
+
function ThemeSelect({ variant: _variant, value, defaultValue = "system", onValueChange, "aria-label": label = "Erscheinungsbild", labels, size, id, className, ...root }) {
|
|
43
|
+
const items = useMemo(() => themes.map((theme) => ({
|
|
44
|
+
value: theme.value,
|
|
45
|
+
label: labels?.[theme.value] ?? defaultLabels[theme.value],
|
|
46
|
+
icon: theme.icon
|
|
47
|
+
})), [labels]);
|
|
48
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
49
|
+
items,
|
|
50
|
+
value,
|
|
51
|
+
defaultValue: value === void 0 ? defaultValue : void 0,
|
|
52
|
+
onValueChange: (next) => {
|
|
53
|
+
if (next !== null) onValueChange?.(next);
|
|
54
|
+
},
|
|
55
|
+
...root,
|
|
56
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
57
|
+
id,
|
|
58
|
+
"aria-label": label,
|
|
59
|
+
size,
|
|
60
|
+
className: cn("min-w-32", className)
|
|
61
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: items.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
62
|
+
value: item.value,
|
|
63
|
+
children: item.label
|
|
64
|
+
}, item.value)) })]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function ThemeSegments({ variant: _variant, value, defaultValue = "system", onValueChange, "aria-label": label = "Erscheinungsbild", labels, withLabels = false, id, className }) {
|
|
68
|
+
const names = {
|
|
69
|
+
...defaultLabels,
|
|
70
|
+
...labels
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ jsx(SegmentedControl, {
|
|
73
|
+
id,
|
|
74
|
+
shape: "round",
|
|
75
|
+
marks: false,
|
|
76
|
+
"aria-label": label,
|
|
77
|
+
value,
|
|
78
|
+
defaultValue: value === void 0 ? defaultValue : void 0,
|
|
79
|
+
onValueChange: (next) => onValueChange?.(next),
|
|
80
|
+
className,
|
|
81
|
+
children: themes.map((theme) => withLabels ? /* @__PURE__ */ jsx(Segment, {
|
|
82
|
+
value: theme.value,
|
|
83
|
+
className: "px-3.5",
|
|
84
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
85
|
+
className: "inline-flex items-center gap-1.5",
|
|
86
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
87
|
+
icon: theme.icon,
|
|
88
|
+
size: 16
|
|
89
|
+
}), names[theme.value]]
|
|
90
|
+
})
|
|
91
|
+
}, theme.value) : /* @__PURE__ */ jsx(Segment, {
|
|
92
|
+
value: theme.value,
|
|
93
|
+
"aria-label": names[theme.value],
|
|
94
|
+
className: "w-(--control-md) px-0",
|
|
95
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
96
|
+
icon: theme.icon,
|
|
97
|
+
size: 16
|
|
98
|
+
})
|
|
99
|
+
}, theme.value))
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export { ThemeSwitch };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { IconSvgElement } from "../icon/icon.js";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
/** Where a step stands: not begun, being worked on, finished, or failed. */
|
|
4
|
+
export type TraceStatus = "pending" | "running" | "done" | "error";
|
|
5
|
+
/** What stands in front of a finished step: the system's disc, or the step's own symbol. */
|
|
6
|
+
export type TraceMarks = "dots" | "symbols";
|
|
7
|
+
export type TraceProps = ComponentProps<"ol"> & {
|
|
8
|
+
/**
|
|
9
|
+
* `dots` keeps to the system's marks: ring, arc and disc. It is the quieter list. `symbols`
|
|
10
|
+
* shows a finished step's `icon` in place of its disc, so the kind of step can be read down
|
|
11
|
+
* the rail: a search, a file, a mail. A step without an `icon` keeps its disc.
|
|
12
|
+
*/
|
|
13
|
+
marks?: TraceMarks;
|
|
14
|
+
/** What each state is called for assistive tech, where the mark alone would say it. */
|
|
15
|
+
statusLabels?: Partial<Record<TraceStatus, string>>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* What an assistant is doing, step by step: the searches, the files, the tools, in the order
|
|
19
|
+
* they happen. It is read, not operated, so it is flat: a list of lines, each with the system's
|
|
20
|
+
* mark in front, joined by a hairline. An open ring waits, the spinner's arc works (it is the
|
|
21
|
+
* ring before it has closed), and the disc is done; a step that failed carries the danger
|
|
22
|
+
* symbol and says so in words.
|
|
23
|
+
*
|
|
24
|
+
* Put `TraceStep`s inside. A step that joins a list already on screen fades in, and its title
|
|
25
|
+
* is announced; the steps that are there when the list first shows do not move. For one line
|
|
26
|
+
* that stands for the whole of it and opens the steps, wrap the list in a `TraceSummary`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function Trace({ marks, statusLabels, className, ...props }: TraceProps): import("react").JSX.Element;
|
|
29
|
+
type RowProps = {
|
|
30
|
+
/** Where the step stands. Done unless said otherwise. */
|
|
31
|
+
status?: TraceStatus;
|
|
32
|
+
/**
|
|
33
|
+
* What is being done, as a short line: in the present while it runs ("Zahlungen werden
|
|
34
|
+
* abgeglichen"), in the past once it is done ("Zahlungen abgeglichen").
|
|
35
|
+
*/
|
|
36
|
+
title: ReactNode;
|
|
37
|
+
/** A second, quieter fact after the title: how long it took, how much was found. */
|
|
38
|
+
meta?: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* A symbol for the kind of step. A list with `marks="symbols"` shows it in place of the disc
|
|
41
|
+
* once the step is done. Give every step one or none.
|
|
42
|
+
*/
|
|
43
|
+
icon?: IconSvgElement;
|
|
44
|
+
/** Whether the detail shows (controlled). */
|
|
45
|
+
open?: boolean;
|
|
46
|
+
/** Whether the detail shows at first. */
|
|
47
|
+
defaultOpen?: boolean;
|
|
48
|
+
onOpenChange?: (open: boolean) => void;
|
|
49
|
+
};
|
|
50
|
+
export type TraceStepProps = Omit<ComponentProps<"li">, "title"> & RowProps;
|
|
51
|
+
/**
|
|
52
|
+
* One step. With children it opens: the line becomes a button, and what it did stands under it
|
|
53
|
+
* (the command, the result, the sources as `Badge`s, the steps of a helper as a `Trace` of its
|
|
54
|
+
* own). Without children it is a plain line and not a tab stop.
|
|
55
|
+
*/
|
|
56
|
+
export declare function TraceStep({ status, title, meta, icon, open, defaultOpen, onOpenChange, className, children, ...props }: TraceStepProps): import("react").JSX.Element;
|
|
57
|
+
export type TraceSummaryProps = Omit<ComponentProps<"div">, "title"> & Omit<RowProps, "icon"> & {
|
|
58
|
+
/** The steps: a `Trace`. */
|
|
59
|
+
children: ReactNode;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* One line that stands for a whole piece of work and opens its steps: "Arbeitet …" while it
|
|
63
|
+
* goes on, "In 14 Sekunden erledigt" afterwards, the number of steps as its second fact. It is
|
|
64
|
+
* what a chat shows above an answer.
|
|
65
|
+
*
|
|
66
|
+
* It follows the work: open while the work is running, so the steps can be watched, and closed
|
|
67
|
+
* once it is done, so the answer has the room. From the moment the reader opens or closes it,
|
|
68
|
+
* it stays as they left it. `open` and `defaultOpen` fix it from outside.
|
|
69
|
+
*/
|
|
70
|
+
export declare function TraceSummary({ status, title, meta, open, defaultOpen, onOpenChange, className, children, ...props }: TraceSummaryProps): import("react").JSX.Element;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Icon } from "../icon/icon.js";
|
|
3
|
+
import { Spinner } from "../spinner/spinner.js";
|
|
4
|
+
import { disclosurePanel } from "../../internal/disclosure.js";
|
|
5
|
+
import { ChevronRightGlyph } from "../../internal/glyphs.js";
|
|
6
|
+
import { cn } from "../../lib/cn.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Alert02Icon } from "@hugeicons/core-free-icons";
|
|
9
|
+
import { createContext, useContext, useEffect, useMemo, useState } from "react";
|
|
10
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
11
|
+
// src/components/trace/trace.tsx
|
|
12
|
+
const defaultStatusLabels = {
|
|
13
|
+
pending: "Steht aus",
|
|
14
|
+
running: "Läuft",
|
|
15
|
+
done: "Erledigt",
|
|
16
|
+
error: "Fehlgeschlagen"
|
|
17
|
+
};
|
|
18
|
+
const TraceContext = createContext({
|
|
19
|
+
labels: defaultStatusLabels,
|
|
20
|
+
marks: "dots"
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* What an assistant is doing, step by step: the searches, the files, the tools, in the order
|
|
24
|
+
* they happen. It is read, not operated, so it is flat: a list of lines, each with the system's
|
|
25
|
+
* mark in front, joined by a hairline. An open ring waits, the spinner's arc works (it is the
|
|
26
|
+
* ring before it has closed), and the disc is done; a step that failed carries the danger
|
|
27
|
+
* symbol and says so in words.
|
|
28
|
+
*
|
|
29
|
+
* Put `TraceStep`s inside. A step that joins a list already on screen fades in, and its title
|
|
30
|
+
* is announced; the steps that are there when the list first shows do not move. For one line
|
|
31
|
+
* that stands for the whole of it and opens the steps, wrap the list in a `TraceSummary`.
|
|
32
|
+
*/
|
|
33
|
+
function Trace({ marks = "dots", statusLabels, className, ...props }) {
|
|
34
|
+
const [live, setLive] = useState(false);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const frame = requestAnimationFrame(() => setLive(true));
|
|
37
|
+
return () => cancelAnimationFrame(frame);
|
|
38
|
+
}, []);
|
|
39
|
+
const context = useMemo(() => ({
|
|
40
|
+
labels: {
|
|
41
|
+
...defaultStatusLabels,
|
|
42
|
+
...statusLabels
|
|
43
|
+
},
|
|
44
|
+
marks
|
|
45
|
+
}), [statusLabels, marks]);
|
|
46
|
+
return /* @__PURE__ */ jsx(TraceContext, {
|
|
47
|
+
value: context,
|
|
48
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
49
|
+
"data-slot": "trace",
|
|
50
|
+
"data-live": live ? "" : void 0,
|
|
51
|
+
"aria-live": "polite",
|
|
52
|
+
"aria-relevant": "additions",
|
|
53
|
+
className: cn("flex flex-col text-control", className),
|
|
54
|
+
...props
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/** The mark in front of a line: ring, arc, disc, or the danger symbol. */
|
|
59
|
+
function TraceMark({ status, icon }) {
|
|
60
|
+
return /* @__PURE__ */ jsx("span", {
|
|
61
|
+
"aria-hidden": true,
|
|
62
|
+
"data-slot": "trace-mark",
|
|
63
|
+
className: "flex size-4 shrink-0 items-center justify-center",
|
|
64
|
+
children: status === "running" ? /* @__PURE__ */ jsx(Spinner, {
|
|
65
|
+
size: 14,
|
|
66
|
+
className: "text-fg"
|
|
67
|
+
}) : status === "error" ? /* @__PURE__ */ jsx(Icon, {
|
|
68
|
+
icon: Alert02Icon,
|
|
69
|
+
size: 14,
|
|
70
|
+
className: "text-danger"
|
|
71
|
+
}) : icon && status === "done" ? /* @__PURE__ */ jsx(Icon, {
|
|
72
|
+
icon,
|
|
73
|
+
size: 14,
|
|
74
|
+
className: "text-fg-muted transition-opacity spring-settle in-data-live:starting:opacity-0"
|
|
75
|
+
}) : /* @__PURE__ */ jsx("span", { className: cn("mark", status === "done" && "mark-on in-data-live:mark-closes") })
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const titleTone = {
|
|
79
|
+
pending: "text-fg-muted",
|
|
80
|
+
running: "shimmer",
|
|
81
|
+
done: "text-fg-body",
|
|
82
|
+
error: "text-fg"
|
|
83
|
+
};
|
|
84
|
+
/** The line itself: the mark, the title, the quieter fact, and a chevron if it opens. */
|
|
85
|
+
function TraceLine({ status, title, meta, icon, opens }) {
|
|
86
|
+
const { labels, marks } = useContext(TraceContext);
|
|
87
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
88
|
+
/* @__PURE__ */ jsx(TraceMark, {
|
|
89
|
+
status,
|
|
90
|
+
icon: marks === "symbols" ? icon : void 0
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ jsxs("span", {
|
|
93
|
+
"data-slot": "trace-title",
|
|
94
|
+
className: cn("min-w-0 truncate", titleTone[status]),
|
|
95
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
96
|
+
className: "sr-only",
|
|
97
|
+
children: [labels[status], ": "]
|
|
98
|
+
}), title]
|
|
99
|
+
}),
|
|
100
|
+
meta !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
101
|
+
"data-slot": "trace-meta",
|
|
102
|
+
className: "shrink-0 text-sm text-fg-muted tabular-nums",
|
|
103
|
+
children: meta
|
|
104
|
+
}),
|
|
105
|
+
opens && /* @__PURE__ */ jsx(ChevronRightGlyph, {
|
|
106
|
+
"data-slot": "trace-chevron",
|
|
107
|
+
width: 10,
|
|
108
|
+
height: 10,
|
|
109
|
+
className: cn("text-fg-muted transition-[rotate,color] spring-seat group-hover:text-fg group-data-disabled:text-on-disabled", "group-data-panel-open:rotate-90")
|
|
110
|
+
})
|
|
111
|
+
] });
|
|
112
|
+
}
|
|
113
|
+
const line = "flex min-h-7 items-center gap-2.5";
|
|
114
|
+
/** A line that opens: the whole of it is the button. */
|
|
115
|
+
const trigger = [
|
|
116
|
+
line,
|
|
117
|
+
"group -mx-1.5 max-w-[calc(100%+0.75rem)] rounded-sm px-1.5 text-left select-none",
|
|
118
|
+
"focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent"
|
|
119
|
+
].join(" ");
|
|
120
|
+
/** What a step or a summary opens: set under the title, a size smaller. */
|
|
121
|
+
function TraceDetail({ children }) {
|
|
122
|
+
return /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
123
|
+
"data-slot": "trace-detail",
|
|
124
|
+
className: cn("h-(--collapsible-panel-height) self-stretch", disclosurePanel),
|
|
125
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
126
|
+
className: "flex flex-col gap-2 pt-1 pr-1 pb-2 pl-[1.625rem] text-sm text-fg-body",
|
|
127
|
+
children
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* One step. With children it opens: the line becomes a button, and what it did stands under it
|
|
133
|
+
* (the command, the result, the sources as `Badge`s, the steps of a helper as a `Trace` of its
|
|
134
|
+
* own). Without children it is a plain line and not a tab stop.
|
|
135
|
+
*/
|
|
136
|
+
function TraceStep({ status = "done", title, meta, icon, open, defaultOpen, onOpenChange, className, children, ...props }) {
|
|
137
|
+
const opens = children !== void 0 && children !== null && children !== false;
|
|
138
|
+
const content = /* @__PURE__ */ jsx(TraceLine, {
|
|
139
|
+
status,
|
|
140
|
+
title,
|
|
141
|
+
meta,
|
|
142
|
+
icon,
|
|
143
|
+
opens
|
|
144
|
+
});
|
|
145
|
+
return /* @__PURE__ */ jsx("li", {
|
|
146
|
+
"data-slot": "trace-step",
|
|
147
|
+
"data-status": status,
|
|
148
|
+
className: cn("relative flex flex-col", "transition-[opacity,translate] spring-settle in-data-live:starting:translate-y-(--motion-enter-offset) in-data-live:starting:opacity-0", "before:absolute before:top-[1.4375rem] before:-bottom-[0.3125rem] before:left-[0.46875rem] before:w-px before:bg-hairline last:before:hidden forced-colors:before:bg-[CanvasText]", className),
|
|
149
|
+
...props,
|
|
150
|
+
children: opens ? /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
151
|
+
open,
|
|
152
|
+
defaultOpen,
|
|
153
|
+
onOpenChange,
|
|
154
|
+
className: "flex flex-col items-start",
|
|
155
|
+
children: [/* @__PURE__ */ jsx(Collapsible.Trigger, {
|
|
156
|
+
"data-slot": "trace-trigger",
|
|
157
|
+
className: trigger,
|
|
158
|
+
children: content
|
|
159
|
+
}), /* @__PURE__ */ jsx(TraceDetail, { children })]
|
|
160
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
161
|
+
className: line,
|
|
162
|
+
children: content
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* One line that stands for a whole piece of work and opens its steps: "Arbeitet …" while it
|
|
168
|
+
* goes on, "In 14 Sekunden erledigt" afterwards, the number of steps as its second fact. It is
|
|
169
|
+
* what a chat shows above an answer.
|
|
170
|
+
*
|
|
171
|
+
* It follows the work: open while the work is running, so the steps can be watched, and closed
|
|
172
|
+
* once it is done, so the answer has the room. From the moment the reader opens or closes it,
|
|
173
|
+
* it stays as they left it. `open` and `defaultOpen` fix it from outside.
|
|
174
|
+
*/
|
|
175
|
+
function TraceSummary({ status = "done", title, meta, open, defaultOpen, onOpenChange, className, children, ...props }) {
|
|
176
|
+
const [chosen, setChosen] = useState(defaultOpen);
|
|
177
|
+
const shown = open ?? chosen ?? status === "running";
|
|
178
|
+
return /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
179
|
+
"data-slot": "trace-summary",
|
|
180
|
+
"data-status": status,
|
|
181
|
+
"aria-busy": status === "running" || void 0,
|
|
182
|
+
open: shown,
|
|
183
|
+
onOpenChange: (next) => {
|
|
184
|
+
setChosen(next);
|
|
185
|
+
onOpenChange?.(next);
|
|
186
|
+
},
|
|
187
|
+
className: cn("flex flex-col items-start text-control", className),
|
|
188
|
+
...props,
|
|
189
|
+
children: [/* @__PURE__ */ jsx(Collapsible.Trigger, {
|
|
190
|
+
"data-slot": "trace-trigger",
|
|
191
|
+
className: trigger,
|
|
192
|
+
children: /* @__PURE__ */ jsx(TraceLine, {
|
|
193
|
+
status,
|
|
194
|
+
title,
|
|
195
|
+
meta,
|
|
196
|
+
opens: true
|
|
197
|
+
})
|
|
198
|
+
}), /* @__PURE__ */ jsx(TraceDetail, { children })]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
export { Trace, TraceStep, TraceSummary };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Badge, BadgeProps } from "./components/badge/badge.js";
|
|
|
7
7
|
import { BreadcrumbItem, BreadcrumbLink, BreadcrumbLinkProps, BreadcrumbPage, Breadcrumbs, BreadcrumbsProps } from "./components/breadcrumbs/breadcrumbs.js";
|
|
8
8
|
import { Button, ButtonProps } from "./components/button/button.js";
|
|
9
9
|
import { ButtonVariants, buttonVariants } from "./components/button/button-variants.js";
|
|
10
|
+
import { ButtonGroup, ButtonGroupProps } from "./components/button-group/button-group.js";
|
|
10
11
|
import { Calendar, CalendarProps, DateRange } from "./components/calendar/calendar.js";
|
|
11
12
|
import { Callout, CalloutProps, CalloutTone } from "./components/callout/callout.js";
|
|
12
13
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/card/card.js";
|
|
@@ -15,6 +16,7 @@ import { CheckboxGroup, CheckboxGroupItems, CheckboxGroupProps } from "./compone
|
|
|
15
16
|
import { Code } from "./components/code/code.js";
|
|
16
17
|
import { CodeBlock, CodeBlockProps } from "./components/code-block/code-block.js";
|
|
17
18
|
import { CodeBlockLive, CodeBlockLiveProps, CodePiece, CodeRole } from "./components/code-block/code-block-live.js";
|
|
19
|
+
import { CodeKeyOptions } from "./components/code-block/code-keys.js";
|
|
18
20
|
import { CodeTab, CodeTabs, CodeTabsProps } from "./components/code-block/code-tabs.js";
|
|
19
21
|
import { CodeLanguage } from "./components/code-block/highlight.js";
|
|
20
22
|
import { LineSpec } from "./components/code-block/lines.js";
|
|
@@ -28,13 +30,16 @@ import { DateField, DateFieldProps } from "./components/date-field/date-field.js
|
|
|
28
30
|
import { DateRangeField, DateRangeFieldProps } from "./components/date-range-field/date-range-field.js";
|
|
29
31
|
import { Dialog, DialogBody, DialogClose, DialogContent, DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./components/dialog/dialog.js";
|
|
30
32
|
import { DocsLayout, DocsLayoutAside, DocsLayoutMain, DocsLayoutNav } from "./components/docs-layout/docs-layout.js";
|
|
33
|
+
import { DocsCrumb, DocsGroup, DocsNav, DocsPage, DocsPlace, docsPageState, docsPages, findDocsPage, sameDocsPage } from "./components/docs-layout/docs-nav.js";
|
|
31
34
|
import { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerProps, DrawerSide, DrawerTitle, DrawerTrigger } from "./components/drawer/drawer.js";
|
|
32
35
|
import { Field, FieldDescription, FieldError, FieldLabel } from "./components/field/field.js";
|
|
33
36
|
import { Fieldset, FieldsetLegend } from "./components/fieldset/fieldset.js";
|
|
34
37
|
import { Figure, FigureCaption, FigureFrame } from "./components/figure/figure.js";
|
|
35
38
|
import { Form, FormProps } from "./components/form/form.js";
|
|
36
39
|
import { Ground, GroundName, GroundProps, useGround } from "./components/ground/ground.js";
|
|
40
|
+
import { Grow, GrowProps } from "./components/grow/grow.js";
|
|
37
41
|
import { Heading, HeadingProps } from "./components/heading/heading.js";
|
|
42
|
+
import { HoverCard, HoverCardContent, HoverCardContentProps, HoverCardTrigger, HoverCardTriggerProps } from "./components/hover-card/hover-card.js";
|
|
38
43
|
import { Icon, IconProps, IconSvgElement } from "./components/icon/icon.js";
|
|
39
44
|
import { Input, InputProps } from "./components/input/input.js";
|
|
40
45
|
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupButtonProps, InputGroupProps } from "./components/input-group/input-group.js";
|
|
@@ -48,7 +53,6 @@ import { Meter, MeterLabel, MeterProps, MeterTrack, MeterValue } from "./compone
|
|
|
48
53
|
import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuLinkDescription, NavigationMenuLinkProps, NavigationMenuLinkTitle, NavigationMenuList, NavigationMenuProps, NavigationMenuTrigger } from "./components/navigation-menu/navigation-menu.js";
|
|
49
54
|
import { NavigationMenuEntryVariants, navigationMenuEntryVariants } from "./components/navigation-menu/navigation-menu-variants.js";
|
|
50
55
|
import { NumberField, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, NumberFieldProps } from "./components/number-field/number-field.js";
|
|
51
|
-
import { PageHeader, PageHeaderActions, PageHeaderLead, PageHeaderProps, PageHeaderTitle, PageHeaderTitleProps } from "./components/page-header/page-header.js";
|
|
52
56
|
import { Pager, PagerLink, PagerLinkProps, PagerProps } from "./components/pager/pager.js";
|
|
53
57
|
import { Parameter, ParameterList, ParameterProps } from "./components/parameter-list/parameter-list.js";
|
|
54
58
|
import { Popover, PopoverClose, PopoverContent, PopoverContentProps, PopoverDescription, PopoverTitle, PopoverTrigger } from "./components/popover/popover.js";
|
|
@@ -57,11 +61,14 @@ import { Prose } from "./components/prose/prose.js";
|
|
|
57
61
|
import { Quote, QuoteProps } from "./components/quote/quote.js";
|
|
58
62
|
import { Radio, RadioGroup, RadioGroupProps, RadioProps } from "./components/radio/radio.js";
|
|
59
63
|
import { ReferenceEntry, ReferenceEntryBody, ReferenceEntryHeader, ReferenceEntryMeta, ReferenceEntryName, ReferenceEntryTitle } from "./components/reference-entry/reference-entry.js";
|
|
64
|
+
import { ScrollFade, ScrollFadeProps } from "./components/scroll-fade/scroll-fade.js";
|
|
65
|
+
import { useScrollEdges } from "./components/scroll-fade/use-scroll-edges.js";
|
|
60
66
|
import { Seam, SeamProps } from "./components/seam/seam.js";
|
|
61
67
|
import { Section, SectionProps } from "./components/section/section.js";
|
|
62
68
|
import { Segment, SegmentProps, SegmentedControl, SegmentedControlProps } from "./components/segmented-control/segmented-control.js";
|
|
63
69
|
import { Select, SelectContent, SelectContentProps, SelectGroup, SelectGroupLabel, SelectItem, SelectItemProps, SelectOption, SelectOptionGroup, SelectProps, SelectSeparator, SelectTrigger, SelectTriggerProps } from "./components/select/select.js";
|
|
64
70
|
import { Separator, SeparatorProps } from "./components/separator/separator.js";
|
|
71
|
+
import { Shimmer, ShimmerProps } from "./components/shimmer/shimmer.js";
|
|
65
72
|
import { SideNav, SideNavGroup, SideNavGroupProps, SideNavLink, SideNavLinkProps, SideNavProps, SideNavSubLink, SideNavSubLinkProps } from "./components/side-nav/side-nav.js";
|
|
66
73
|
import { SiteFooter, SiteFooterBrand, SiteFooterGroup, SiteFooterGroupProps, SiteFooterLegal, SiteFooterLink, SiteFooterMain, SiteFooterNav, siteFooterLinkClass } from "./components/site-footer/site-footer.js";
|
|
67
74
|
import { SiteHeader, SiteHeaderActions, SiteHeaderBrand, SiteHeaderBrandProps, SiteHeaderMenu, SiteHeaderMenuGroup, SiteHeaderMenuGroupProps, SiteHeaderMenuLink, SiteHeaderMenuLinkProps, SiteHeaderMenuProps, SiteHeaderProps } from "./components/site-header/site-header.js";
|
|
@@ -73,9 +80,11 @@ import { TableOfContents, TableOfContentsProps, TocItem } from "./components/tab
|
|
|
73
80
|
import { Tab, Tabs, TabsList, TabsPanel, TabsPanels, TabsPanelsProps, TabsProps } from "./components/tabs/tabs.js";
|
|
74
81
|
import { Text, TextProps } from "./components/text/text.js";
|
|
75
82
|
import { Textarea, TextareaProps } from "./components/textarea/textarea.js";
|
|
83
|
+
import { Theme, ThemeSwitch, ThemeSwitchProps } from "./components/theme-switch/theme-switch.js";
|
|
76
84
|
import { TimeField, TimeFieldProps } from "./components/time-field/time-field.js";
|
|
77
85
|
import { ToastOptions, ToastTone, Toaster, ToasterProps, toast, toastManager } from "./components/toast/toast.js";
|
|
78
86
|
import { Tooltip, TooltipContent, TooltipContentProps, TooltipProvider, TooltipTrigger } from "./components/tooltip/tooltip.js";
|
|
87
|
+
import { Trace, TraceMarks, TraceProps, TraceStatus, TraceStep, TraceStepProps, TraceSummary, TraceSummaryProps } from "./components/trace/trace.js";
|
|
79
88
|
import { cn, mergeClassName } from "./lib/cn.js";
|
|
80
89
|
import { SpringName, springs, transitions } from "./motion/springs.js";
|
|
81
|
-
export { Accordion, AccordionItem, type AccordionItemProps, AccordionPanel, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDescription, AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, AnchorHeading, type AnchorHeadingProps, Avatar, AvatarFallback, AvatarImage, type AvatarProps, Badge, type BadgeProps, BreadcrumbItem, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbPage, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, type ButtonVariants, Calendar, type CalendarProps, Callout, type CalloutProps, type CalloutTone, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroup, CheckboxGroupItems, type CheckboxGroupProps, type CheckboxProps, Code, CodeBlock, CodeBlockLive, type CodeBlockLiveProps, type CodeBlockProps, type CodeLanguage, type CodePiece, type CodeRole, type CodeTab, CodeTabs, type CodeTabsProps, Collapsible, CollapsiblePanel, type CollapsiblePanelProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps, Combobox, ComboboxCollection, ComboboxContent, type ComboboxContentProps, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, type ComboboxInputProps, ComboboxItem, type ComboboxItemProps, type ComboboxOption, type ComboboxOptionGroup, type ComboboxProps, ComboboxSeparator, Container, type ContainerProps, CopyPage, type CopyPageProps, CopyPill, CopyPillMark, type CopyPillProps, Cta, CtaAction, type CtaActionProps, CtaActions, CtaMessage, type CtaMessageProps, type CtaProps, CtaText, CtaTitle, type CtaTone, DateField, type DateFieldProps, type DateRange, DateRangeField, type DateRangeFieldProps, Dialog, DialogBody, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DocsLayout, DocsLayoutAside, DocsLayoutMain, DocsLayoutNav, Drawer, DrawerBody, DrawerClose, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, type DrawerProps, type DrawerSide, DrawerTitle, DrawerTrigger, Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend, Figure, FigureCaption, FigureFrame, Form, type FormProps, Ground, type GroundName, type GroundProps, Heading, type HeadingProps, Icon, type IconProps, type IconSvgElement, Input, InputGroup, InputGroupAddon, InputGroupButton, type InputGroupButtonProps, type InputGroupProps, type InputProps, Kbd, type LineSpec, Link, type LinkProps, type LinkVariants, Logomark, type LogomarkProps, Menu, MenuCheckboxItem, MenuContent, type MenuContentProps, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Meter, MeterLabel, type MeterProps, MeterTrack, MeterValue, NavigationMenu, NavigationMenuContent, type NavigationMenuEntryVariants, NavigationMenuItem, NavigationMenuLink, NavigationMenuLinkDescription, type NavigationMenuLinkProps, NavigationMenuLinkTitle, NavigationMenuList, type NavigationMenuProps, NavigationMenuTrigger, NumberField, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, type NumberFieldProps,
|
|
90
|
+
export { Accordion, AccordionItem, type AccordionItemProps, AccordionPanel, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, Alert, AlertDescription, AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, AnchorHeading, type AnchorHeadingProps, Avatar, AvatarFallback, AvatarImage, type AvatarProps, Badge, type BadgeProps, BreadcrumbItem, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbPage, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, type ButtonVariants, Calendar, type CalendarProps, Callout, type CalloutProps, type CalloutTone, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroup, CheckboxGroupItems, type CheckboxGroupProps, type CheckboxProps, Code, CodeBlock, CodeBlockLive, type CodeBlockLiveProps, type CodeBlockProps, type CodeKeyOptions, type CodeLanguage, type CodePiece, type CodeRole, type CodeTab, CodeTabs, type CodeTabsProps, Collapsible, CollapsiblePanel, type CollapsiblePanelProps, type CollapsibleProps, CollapsibleTrigger, type CollapsibleTriggerProps, Combobox, ComboboxCollection, ComboboxContent, type ComboboxContentProps, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, type ComboboxInputProps, ComboboxItem, type ComboboxItemProps, type ComboboxOption, type ComboboxOptionGroup, type ComboboxProps, ComboboxSeparator, Container, type ContainerProps, CopyPage, type CopyPageProps, CopyPill, CopyPillMark, type CopyPillProps, Cta, CtaAction, type CtaActionProps, CtaActions, CtaMessage, type CtaMessageProps, type CtaProps, CtaText, CtaTitle, type CtaTone, DateField, type DateFieldProps, type DateRange, DateRangeField, type DateRangeFieldProps, Dialog, DialogBody, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, type DocsCrumb, type DocsGroup, DocsLayout, DocsLayoutAside, DocsLayoutMain, DocsLayoutNav, type DocsNav, type DocsPage, type DocsPlace, Drawer, DrawerBody, DrawerClose, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, type DrawerProps, type DrawerSide, DrawerTitle, DrawerTrigger, Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend, Figure, FigureCaption, FigureFrame, Form, type FormProps, Ground, type GroundName, type GroundProps, Grow, type GrowProps, Heading, type HeadingProps, HoverCard, HoverCardContent, type HoverCardContentProps, HoverCardTrigger, type HoverCardTriggerProps, Icon, type IconProps, type IconSvgElement, Input, InputGroup, InputGroupAddon, InputGroupButton, type InputGroupButtonProps, type InputGroupProps, type InputProps, Kbd, type LineSpec, Link, type LinkProps, type LinkVariants, Logomark, type LogomarkProps, Menu, MenuCheckboxItem, MenuContent, type MenuContentProps, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Meter, MeterLabel, type MeterProps, MeterTrack, MeterValue, NavigationMenu, NavigationMenuContent, type NavigationMenuEntryVariants, NavigationMenuItem, NavigationMenuLink, NavigationMenuLinkDescription, type NavigationMenuLinkProps, NavigationMenuLinkTitle, NavigationMenuList, type NavigationMenuProps, NavigationMenuTrigger, NumberField, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, type NumberFieldProps, Pager, PagerLink, type PagerLinkProps, type PagerProps, Parameter, ParameterList, type ParameterProps, Popover, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, Prose, Quote, type QuoteProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, ReferenceEntry, ReferenceEntryBody, ReferenceEntryHeader, ReferenceEntryMeta, ReferenceEntryName, ReferenceEntryTitle, ScrollFade, type ScrollFadeProps, Seam, type SeamProps, Section, type SectionProps, Segment, type SegmentProps, SegmentedControl, type SegmentedControlProps, Select, SelectContent, type SelectContentProps, SelectGroup, SelectGroupLabel, SelectItem, type SelectItemProps, type SelectOption, type SelectOptionGroup, type SelectProps, SelectSeparator, SelectTrigger, type SelectTriggerProps, Separator, type SeparatorProps, Shimmer, type ShimmerProps, SideNav, SideNavGroup, type SideNavGroupProps, SideNavLink, type SideNavLinkProps, type SideNavProps, SideNavSubLink, type SideNavSubLinkProps, SiteFooter, SiteFooterBrand, SiteFooterGroup, type SiteFooterGroupProps, SiteFooterLegal, SiteFooterLink, SiteFooterMain, SiteFooterNav, SiteHeader, SiteHeaderActions, SiteHeaderBrand, type SiteHeaderBrandProps, SiteHeaderMenu, SiteHeaderMenuGroup, type SiteHeaderMenuGroupProps, SiteHeaderMenuLink, type SiteHeaderMenuLinkProps, type SiteHeaderMenuProps, type SiteHeaderProps, Slider, SliderControl, type SliderControlProps, SliderLabel, type SliderProps, SliderThumb, type SliderThumbProps, SliderValue, Spinner, type SpinnerProps, type SpringName, Switch, type SwitchProps, Tab, Table, TableBody, TableCaption, TableCell, type TableCellProps, TableFooter, TableHead, type TableHeadProps, TableHeader, TableOfContents, type TableOfContentsProps, type TableProps, TableRow, type TableRowProps, TableSortButton, type TableSortButtonProps, Tabs, TabsList, TabsPanel, TabsPanels, type TabsPanelsProps, type TabsProps, Text, type TextProps, Textarea, type TextareaProps, type Theme, ThemeSwitch, type ThemeSwitchProps, TimeField, type TimeFieldProps, type ToastOptions, type ToastTone, Toaster, type ToasterProps, type TocItem, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, Trace, type TraceMarks, type TraceProps, type TraceStatus, TraceStep, type TraceStepProps, TraceSummary, type TraceSummaryProps, Wordmark, type WordmarkProps, buttonVariants, cn, containerVariants, docsPageState, docsPages, findDocsPage, linkVariants, mergeClassName, navigationMenuEntryVariants, sameDocsPage, siteFooterLinkClass, springs, toast, toastManager, transitions, useGround, useScrollEdges };
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { Badge } from "./components/badge/badge.js";
|
|
|
7
7
|
import { BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, Breadcrumbs } from "./components/breadcrumbs/breadcrumbs.js";
|
|
8
8
|
import { Button } from "./components/button/button.js";
|
|
9
9
|
import { buttonVariants } from "./components/button/button-variants.js";
|
|
10
|
+
import { ButtonGroup } from "./components/button-group/button-group.js";
|
|
10
11
|
import { Calendar } from "./components/calendar/calendar.js";
|
|
11
12
|
import { Callout } from "./components/callout/callout.js";
|
|
12
13
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/card/card.js";
|
|
@@ -26,13 +27,16 @@ import { DateField } from "./components/date-field/date-field.js";
|
|
|
26
27
|
import { DateRangeField } from "./components/date-range-field/date-range-field.js";
|
|
27
28
|
import { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./components/dialog/dialog.js";
|
|
28
29
|
import { DocsLayout, DocsLayoutAside, DocsLayoutMain, DocsLayoutNav } from "./components/docs-layout/docs-layout.js";
|
|
30
|
+
import { docsPageState, docsPages, findDocsPage, sameDocsPage } from "./components/docs-layout/docs-nav.js";
|
|
29
31
|
import { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from "./components/drawer/drawer.js";
|
|
30
32
|
import { Field, FieldDescription, FieldError, FieldLabel } from "./components/field/field.js";
|
|
31
33
|
import { Fieldset, FieldsetLegend } from "./components/fieldset/fieldset.js";
|
|
32
34
|
import { Figure, FigureCaption, FigureFrame } from "./components/figure/figure.js";
|
|
33
35
|
import { Form } from "./components/form/form.js";
|
|
34
36
|
import { Ground, useGround } from "./components/ground/ground.js";
|
|
37
|
+
import { Grow } from "./components/grow/grow.js";
|
|
35
38
|
import { Heading } from "./components/heading/heading.js";
|
|
39
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger } from "./components/hover-card/hover-card.js";
|
|
36
40
|
import { Icon } from "./components/icon/icon.js";
|
|
37
41
|
import { Input } from "./components/input/input.js";
|
|
38
42
|
import { InputGroup, InputGroupAddon, InputGroupButton } from "./components/input-group/input-group.js";
|
|
@@ -46,7 +50,6 @@ import { Meter, MeterLabel, MeterTrack, MeterValue } from "./components/meter/me
|
|
|
46
50
|
import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuLinkDescription, NavigationMenuLinkTitle, NavigationMenuList, NavigationMenuTrigger } from "./components/navigation-menu/navigation-menu.js";
|
|
47
51
|
import { navigationMenuEntryVariants } from "./components/navigation-menu/navigation-menu-variants.js";
|
|
48
52
|
import { NumberField, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput } from "./components/number-field/number-field.js";
|
|
49
|
-
import { PageHeader, PageHeaderActions, PageHeaderLead, PageHeaderTitle } from "./components/page-header/page-header.js";
|
|
50
53
|
import { Pager, PagerLink } from "./components/pager/pager.js";
|
|
51
54
|
import { Parameter, ParameterList } from "./components/parameter-list/parameter-list.js";
|
|
52
55
|
import { Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger } from "./components/popover/popover.js";
|
|
@@ -55,11 +58,14 @@ import { Prose } from "./components/prose/prose.js";
|
|
|
55
58
|
import { Quote } from "./components/quote/quote.js";
|
|
56
59
|
import { Radio, RadioGroup } from "./components/radio/radio.js";
|
|
57
60
|
import { ReferenceEntry, ReferenceEntryBody, ReferenceEntryHeader, ReferenceEntryMeta, ReferenceEntryName, ReferenceEntryTitle } from "./components/reference-entry/reference-entry.js";
|
|
61
|
+
import { ScrollFade } from "./components/scroll-fade/scroll-fade.js";
|
|
62
|
+
import { useScrollEdges } from "./components/scroll-fade/use-scroll-edges.js";
|
|
58
63
|
import { Seam } from "./components/seam/seam.js";
|
|
59
64
|
import { Section } from "./components/section/section.js";
|
|
60
65
|
import { Segment, SegmentedControl } from "./components/segmented-control/segmented-control.js";
|
|
61
66
|
import { Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger } from "./components/select/select.js";
|
|
62
67
|
import { Separator } from "./components/separator/separator.js";
|
|
68
|
+
import { Shimmer } from "./components/shimmer/shimmer.js";
|
|
63
69
|
import { SideNav, SideNavGroup, SideNavLink, SideNavSubLink } from "./components/side-nav/side-nav.js";
|
|
64
70
|
import { SiteFooter, SiteFooterBrand, SiteFooterGroup, SiteFooterLegal, SiteFooterLink, SiteFooterMain, SiteFooterNav, siteFooterLinkClass } from "./components/site-footer/site-footer.js";
|
|
65
71
|
import { SiteHeader, SiteHeaderActions, SiteHeaderBrand, SiteHeaderMenu, SiteHeaderMenuGroup, SiteHeaderMenuLink } from "./components/site-header/site-header.js";
|
|
@@ -71,9 +77,11 @@ import { TableOfContents } from "./components/table-of-contents/table-of-content
|
|
|
71
77
|
import { Tab, Tabs, TabsList, TabsPanel, TabsPanels } from "./components/tabs/tabs.js";
|
|
72
78
|
import { Text } from "./components/text/text.js";
|
|
73
79
|
import { Textarea } from "./components/textarea/textarea.js";
|
|
80
|
+
import { ThemeSwitch } from "./components/theme-switch/theme-switch.js";
|
|
74
81
|
import { TimeField } from "./components/time-field/time-field.js";
|
|
75
82
|
import { Toaster, toast, toastManager } from "./components/toast/toast.js";
|
|
76
83
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip/tooltip.js";
|
|
84
|
+
import { Trace, TraceStep, TraceSummary } from "./components/trace/trace.js";
|
|
77
85
|
import { cn, mergeClassName } from "./lib/cn.js";
|
|
78
86
|
import { springs, transitions } from "./motion/springs.js";
|
|
79
|
-
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnchorHeading, Avatar, AvatarFallback, AvatarImage, Badge, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, Breadcrumbs, Button, Calendar, Callout, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroup, CheckboxGroupItems, Code, CodeBlock, CodeBlockLive, CodeTabs, Collapsible, CollapsiblePanel, CollapsibleTrigger, Combobox, ComboboxCollection, ComboboxContent, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxSeparator, Container, CopyPage, CopyPill, CopyPillMark, Cta, CtaAction, CtaActions, CtaMessage, CtaText, CtaTitle, DateField, DateRangeField, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DocsLayout, DocsLayoutAside, DocsLayoutMain, DocsLayoutNav, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend, Figure, FigureCaption, FigureFrame, Form, Ground, Heading, Icon, Input, InputGroup, InputGroupAddon, InputGroupButton, Kbd, Link, Logomark, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Meter, MeterLabel, MeterTrack, MeterValue, NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuLinkDescription, NavigationMenuLinkTitle, NavigationMenuList, NavigationMenuTrigger, NumberField, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput,
|
|
87
|
+
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnchorHeading, Avatar, AvatarFallback, AvatarImage, Badge, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, Breadcrumbs, Button, ButtonGroup, Calendar, Callout, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroup, CheckboxGroupItems, Code, CodeBlock, CodeBlockLive, CodeTabs, Collapsible, CollapsiblePanel, CollapsibleTrigger, Combobox, ComboboxCollection, ComboboxContent, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxSeparator, Container, CopyPage, CopyPill, CopyPillMark, Cta, CtaAction, CtaActions, CtaMessage, CtaText, CtaTitle, DateField, DateRangeField, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DocsLayout, DocsLayoutAside, DocsLayoutMain, DocsLayoutNav, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend, Figure, FigureCaption, FigureFrame, Form, Ground, Grow, Heading, HoverCard, HoverCardContent, HoverCardTrigger, Icon, Input, InputGroup, InputGroupAddon, InputGroupButton, Kbd, Link, Logomark, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Meter, MeterLabel, MeterTrack, MeterValue, NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuLinkDescription, NavigationMenuLinkTitle, NavigationMenuList, NavigationMenuTrigger, NumberField, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, Pager, PagerLink, Parameter, ParameterList, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, ProgressLabel, ProgressTrack, ProgressValue, Prose, Quote, Radio, RadioGroup, ReferenceEntry, ReferenceEntryBody, ReferenceEntryHeader, ReferenceEntryMeta, ReferenceEntryName, ReferenceEntryTitle, ScrollFade, Seam, Section, Segment, SegmentedControl, Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, Separator, Shimmer, SideNav, SideNavGroup, SideNavLink, SideNavSubLink, SiteFooter, SiteFooterBrand, SiteFooterGroup, SiteFooterLegal, SiteFooterLink, SiteFooterMain, SiteFooterNav, SiteHeader, SiteHeaderActions, SiteHeaderBrand, SiteHeaderMenu, SiteHeaderMenuGroup, SiteHeaderMenuLink, Slider, SliderControl, SliderLabel, SliderThumb, SliderValue, Spinner, Switch, Tab, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableOfContents, TableRow, TableSortButton, Tabs, TabsList, TabsPanel, TabsPanels, Text, Textarea, ThemeSwitch, TimeField, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Trace, TraceStep, TraceSummary, Wordmark, buttonVariants, cn, containerVariants, docsPageState, docsPages, findDocsPage, linkVariants, mergeClassName, navigationMenuEntryVariants, sameDocsPage, siteFooterLinkClass, springs, toast, toastManager, transitions, useGround, useScrollEdges };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { mergeRefs } from "../lib/merge-refs.js";
|
|
2
|
+
import { cloneElement, createElement } from "react";
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
// src/internal/render-as.ts
|
|
5
|
+
/**
|
|
6
|
+
* Renders a part as its own element, or as the element its caller hands in as `render`: a
|
|
7
|
+
* router's link in place of an `<a>`. The part's props and the element's own are merged the way
|
|
8
|
+
* Base UI merges them (class names joined, styles and handlers merged, the element's own props
|
|
9
|
+
* winning otherwise).
|
|
10
|
+
*
|
|
11
|
+
* It is what Base UI's `useRender` does, as a plain function. `useRender` is a hook, which makes
|
|
12
|
+
* every part that calls it a client component; a part of plain markup (a link of the `SideNav`,
|
|
13
|
+
* of the `Breadcrumbs`, of the `Pager`) would then travel to the browser for nothing. With this
|
|
14
|
+
* it stays server-safe: no `"use client"`, and no script for a page of documentation.
|
|
15
|
+
*/
|
|
16
|
+
function renderAs(tag, render, props) {
|
|
17
|
+
if (render === void 0) return createElement(tag, props);
|
|
18
|
+
if (typeof render === "function") return render(props, {});
|
|
19
|
+
const own = render.props;
|
|
20
|
+
const merged = mergeProps(props, own);
|
|
21
|
+
if (props.ref && own.ref) merged.ref = mergeRefs(props.ref, own.ref);
|
|
22
|
+
return cloneElement(render, merged);
|
|
23
|
+
}
|
|
24
|
+
export { renderAs };
|
package/dist/internal/rule.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/internal/rule.ts
|
|
2
2
|
/**
|
|
3
|
-
* The 2px rule that opens a block (`Table`, `Accordion`, `ParameterList
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* The 2px rule that opens a block (`Table`, `Accordion`, `ParameterList`): a straight line with
|
|
4
|
+
* round ends. The box keeps a transparent 2px top border, so it is laid out exactly as with
|
|
5
|
+
* `border-t-2`, and the line is drawn into that border as `::before`. A border cannot round its
|
|
6
|
+
* own ends: with a radius it bends down at the corners instead. Where the rule stands by itself,
|
|
7
|
+
* above a section's title, it is a `Separator` (`variant="rule"`).
|
|
7
8
|
*
|
|
8
9
|
* The box becomes positioned, and must not clip its top edge. Server-safe.
|
|
9
10
|
*/
|