@lanfermann/ui 0.1.1 → 0.3.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/accordion/accordion.js +2 -1
- package/dist/components/copy-page/copy-page.d.ts +46 -0
- package/dist/components/copy-page/copy-page.js +223 -0
- package/dist/components/docs-layout/docs-layout.d.ts +4 -2
- package/dist/components/docs-layout/docs-layout.js +10 -5
- package/dist/components/page-header/page-header.d.ts +4 -1
- package/dist/components/page-header/page-header.js +2 -1
- package/dist/components/parameter-list/parameter-list.js +2 -1
- package/dist/components/seam/seam-outline.js +153 -0
- package/dist/components/seam/seam.d.ts +23 -0
- package/dist/components/seam/seam.js +88 -0
- package/dist/components/separator/separator.js +2 -2
- package/dist/components/table/table.d.ts +6 -6
- package/dist/components/table/table.js +23 -17
- package/dist/components/table-of-contents/table-of-contents.js +11 -6
- package/dist/components/tabs/tabs.js +1 -6
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/internal/rule.js +15 -0
- package/dist/internal/scroll-fade.js +24 -0
- package/dist/lib/cn.js +1 -0
- package/dist/lib/merge-refs.js +9 -0
- package/package.json +1 -1
- package/src/styles/code.css +1 -31
- package/src/styles/copy.css +46 -0
- package/src/styles/depth.css +24 -1
- package/src/styles/scroll-fade.css +52 -0
- package/src/styles.css +2 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { disclosureChevron, disclosurePanel } from "../../internal/disclosure.js";
|
|
3
3
|
import { ChevronDownGlyph } from "../../internal/glyphs.js";
|
|
4
|
+
import { ruleTop } from "../../internal/rule.js";
|
|
4
5
|
import { cn, mergeClassName } from "../../lib/cn.js";
|
|
5
6
|
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -16,7 +17,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
16
17
|
function Accordion({ className, ...props }) {
|
|
17
18
|
return /* @__PURE__ */ jsx(Accordion$1.Root, {
|
|
18
19
|
"data-slot": "accordion",
|
|
19
|
-
className: mergeClassName("flex w-full flex-col
|
|
20
|
+
className: mergeClassName(["flex w-full flex-col", ruleTop], className),
|
|
20
21
|
...props
|
|
21
22
|
});
|
|
22
23
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
export type CopyPageProps = Omit<ComponentProps<"div">, "children"> & {
|
|
3
|
+
/** The page as Markdown, on this site: what is copied, and what "view" opens. */
|
|
4
|
+
href: string;
|
|
5
|
+
/** The button, and the first entry of the menu: the thing, then the action ("Seite kopieren"). */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Under it in the menu: what the copy is, and for whom ("Als Markdown, für eine KI"). */
|
|
8
|
+
description: string;
|
|
9
|
+
/** The second entry: "Als Markdown ansehen". */
|
|
10
|
+
viewLabel: string;
|
|
11
|
+
/** Under it: "Die Seite als reiner Text". */
|
|
12
|
+
viewDescription: string;
|
|
13
|
+
/** The name of the button that opens the menu ("Weitere Möglichkeiten"). */
|
|
14
|
+
moreLabel: string;
|
|
15
|
+
/** Read out once the page is on the clipboard: a full sentence ("Die Seite ist kopiert."). */
|
|
16
|
+
copied: string;
|
|
17
|
+
/** Read out when the clipboard refused or the page could not be loaded. */
|
|
18
|
+
failed: string;
|
|
19
|
+
/** Called once the page has reached the clipboard. */
|
|
20
|
+
onCopied?: () => void;
|
|
21
|
+
/** Opens the menu on the first render: for stories and screenshots. */
|
|
22
|
+
defaultOpen?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Hands a docs page on as Markdown: one raised fitting split in two, the copy and the menu. The
|
|
26
|
+
* copy fetches the page's Markdown and puts it on the clipboard, for a model or an agent; the
|
|
27
|
+
* menu repeats it with a line on what it is, and opens the Markdown in a new tab. Put it in the
|
|
28
|
+
* page header, at the end of the row above the title.
|
|
29
|
+
*
|
|
30
|
+
* It is one part with two keys, so it moves as one: under the pointer the whole fitting lifts,
|
|
31
|
+
* and the key under it takes the hover wash. Pressed, the fitting goes down and drops its
|
|
32
|
+
* ambient shadow, and only the pressed key takes the inner shade, so it rocks on that key and the
|
|
33
|
+
* other keeps its gloss. A copy is confirmed in the key, as in a code block: the copy symbol
|
|
34
|
+
* shrinks away and the tick draws itself, short leg first, then fades where it stands while the
|
|
35
|
+
* symbol seats back. There is no toast; a screen reader hears one sentence.
|
|
36
|
+
*
|
|
37
|
+
* The chevron turns over while the menu is open, settling with a small bounce; the sheet grows
|
|
38
|
+
* out of it and leaves by fading, as every sheet does. The menu's rows carry a tile with their
|
|
39
|
+
* symbol, and the row under the pointer or the keyboard highlights at once. Copying from the
|
|
40
|
+
* menu closes it and confirms in the key, where the eye goes back to.
|
|
41
|
+
*
|
|
42
|
+
* The Markdown is fetched as soon as a pointer or the keyboard reaches the fitting, so the copy
|
|
43
|
+
* that follows is immediate; where the browser takes a promise for the clipboard (Safari, Chrome)
|
|
44
|
+
* the fetch can finish inside the press. Word the labels as the thing, then the action.
|
|
45
|
+
*/
|
|
46
|
+
export declare function CopyPage({ href, label, description, viewLabel, viewDescription, moreLabel, copied: copiedSentence, failed: failedSentence, onCopied, defaultOpen, className, onPointerEnter, onFocus, ...props }: CopyPageProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Icon } from "../icon/icon.js";
|
|
3
|
+
import { MenuContent, MenuItem, MenuLinkItem } from "../menu/menu.js";
|
|
4
|
+
import { ActionArrow } from "../../internal/arrow.js";
|
|
5
|
+
import { ChevronDownGlyph, TickGlyph } from "../../internal/glyphs.js";
|
|
6
|
+
import { cn } from "../../lib/cn.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Copy01Icon } from "@hugeicons/core-free-icons";
|
|
9
|
+
import { useEffect, useRef, useState } from "react";
|
|
10
|
+
import { Menu } from "@base-ui/react/menu";
|
|
11
|
+
// src/components/copy-page/copy-page.tsx
|
|
12
|
+
/** How long a copy stays confirmed before the symbol comes back, in ms (as in a code block). */
|
|
13
|
+
const CONFIRM_MS = 1600;
|
|
14
|
+
/**
|
|
15
|
+
* Hands a docs page on as Markdown: one raised fitting split in two, the copy and the menu. The
|
|
16
|
+
* copy fetches the page's Markdown and puts it on the clipboard, for a model or an agent; the
|
|
17
|
+
* menu repeats it with a line on what it is, and opens the Markdown in a new tab. Put it in the
|
|
18
|
+
* page header, at the end of the row above the title.
|
|
19
|
+
*
|
|
20
|
+
* It is one part with two keys, so it moves as one: under the pointer the whole fitting lifts,
|
|
21
|
+
* and the key under it takes the hover wash. Pressed, the fitting goes down and drops its
|
|
22
|
+
* ambient shadow, and only the pressed key takes the inner shade, so it rocks on that key and the
|
|
23
|
+
* other keeps its gloss. A copy is confirmed in the key, as in a code block: the copy symbol
|
|
24
|
+
* shrinks away and the tick draws itself, short leg first, then fades where it stands while the
|
|
25
|
+
* symbol seats back. There is no toast; a screen reader hears one sentence.
|
|
26
|
+
*
|
|
27
|
+
* The chevron turns over while the menu is open, settling with a small bounce; the sheet grows
|
|
28
|
+
* out of it and leaves by fading, as every sheet does. The menu's rows carry a tile with their
|
|
29
|
+
* symbol, and the row under the pointer or the keyboard highlights at once. Copying from the
|
|
30
|
+
* menu closes it and confirms in the key, where the eye goes back to.
|
|
31
|
+
*
|
|
32
|
+
* The Markdown is fetched as soon as a pointer or the keyboard reaches the fitting, so the copy
|
|
33
|
+
* that follows is immediate; where the browser takes a promise for the clipboard (Safari, Chrome)
|
|
34
|
+
* the fetch can finish inside the press. Word the labels as the thing, then the action.
|
|
35
|
+
*/
|
|
36
|
+
function CopyPage({ href, label, description, viewLabel, viewDescription, moreLabel, copied: copiedSentence, failed: failedSentence, onCopied, defaultOpen, className, onPointerEnter, onFocus, ...props }) {
|
|
37
|
+
const [state, setState] = useState("idle");
|
|
38
|
+
const timer = useRef(void 0);
|
|
39
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
40
|
+
const markdown = useRef(void 0);
|
|
41
|
+
const load = () => {
|
|
42
|
+
markdown.current ??= fetch(href).then((response) => {
|
|
43
|
+
if (!response.ok) throw new Error(`${response.status}`);
|
|
44
|
+
return response.text();
|
|
45
|
+
});
|
|
46
|
+
return markdown.current;
|
|
47
|
+
};
|
|
48
|
+
const settle = (next) => {
|
|
49
|
+
clearTimeout(timer.current);
|
|
50
|
+
setState(next);
|
|
51
|
+
timer.current = setTimeout(() => setState("idle"), CONFIRM_MS);
|
|
52
|
+
};
|
|
53
|
+
async function copy() {
|
|
54
|
+
const text = load();
|
|
55
|
+
try {
|
|
56
|
+
if (typeof ClipboardItem !== "undefined" && navigator.clipboard?.write) {
|
|
57
|
+
const blob = text.then((body) => new Blob([body], { type: "text/plain" }));
|
|
58
|
+
await navigator.clipboard.write([new ClipboardItem({ "text/plain": blob })]);
|
|
59
|
+
} else await navigator.clipboard.writeText(await text);
|
|
60
|
+
settle("copied");
|
|
61
|
+
onCopied?.();
|
|
62
|
+
} catch {
|
|
63
|
+
try {
|
|
64
|
+
await navigator.clipboard.writeText(await text);
|
|
65
|
+
settle("copied");
|
|
66
|
+
onCopied?.();
|
|
67
|
+
} catch {
|
|
68
|
+
markdown.current = void 0;
|
|
69
|
+
settle("failed");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const isCopied = state === "copied";
|
|
74
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
75
|
+
"data-slot": "copy-page",
|
|
76
|
+
className: cn("relative inline-flex h-(--control-sm) shrink-0 items-stretch rounded-md bg-raised depth-raised text-sm font-medium text-fg", "transition-[box-shadow,scale] spring-seat", "has-[button:hover]:spring-snap has-[button:hover:not(:active)]:depth-raised-hover", "has-[button:active]:scale-(--motion-press-scale) has-[button:active]:shadow-pressed has-[button:active]:spring-snap", className),
|
|
77
|
+
onPointerEnter: (event) => {
|
|
78
|
+
load().catch(() => {});
|
|
79
|
+
onPointerEnter?.(event);
|
|
80
|
+
},
|
|
81
|
+
onFocus: (event) => {
|
|
82
|
+
load().catch(() => {});
|
|
83
|
+
onFocus?.(event);
|
|
84
|
+
},
|
|
85
|
+
...props,
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsxs("button", {
|
|
88
|
+
type: "button",
|
|
89
|
+
"data-slot": "copy-page-copy",
|
|
90
|
+
"data-copied": isCopied ? "" : void 0,
|
|
91
|
+
onClick: () => void copy(),
|
|
92
|
+
className: cn(key, "gap-1.5 rounded-l-md pr-2.5 pl-(--control-pad-sm)"),
|
|
93
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
94
|
+
className: "relative flex size-4 shrink-0 items-center justify-center",
|
|
95
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
96
|
+
"data-slot": "copy-page-symbol",
|
|
97
|
+
icon: Copy01Icon,
|
|
98
|
+
size: 16,
|
|
99
|
+
className: "absolute"
|
|
100
|
+
}), /* @__PURE__ */ jsx(TickGlyph, {
|
|
101
|
+
"data-slot": "copy-page-tick",
|
|
102
|
+
width: 20,
|
|
103
|
+
height: 20,
|
|
104
|
+
strokeWidth: 21 / 20,
|
|
105
|
+
className: "absolute"
|
|
106
|
+
})]
|
|
107
|
+
}), label]
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx("span", {
|
|
110
|
+
"aria-hidden": true,
|
|
111
|
+
"data-slot": "copy-page-divider",
|
|
112
|
+
className: "w-px bg-hairline"
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ jsxs(Menu.Root, {
|
|
115
|
+
modal: false,
|
|
116
|
+
defaultOpen,
|
|
117
|
+
children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
118
|
+
"data-slot": "copy-page-more",
|
|
119
|
+
"aria-label": moreLabel,
|
|
120
|
+
className: cn(key, "group/more justify-center rounded-r-md px-1.5 data-popup-open:bg-hover pointer-coarse:px-2.5"),
|
|
121
|
+
children: /* @__PURE__ */ jsx(ChevronDownGlyph, {
|
|
122
|
+
width: 12,
|
|
123
|
+
height: 12,
|
|
124
|
+
className: "text-fg-muted transition-[rotate,color] spring-seat group-hover/more:text-fg group-data-popup-open/more:rotate-180 group-data-popup-open/more:text-fg motion-reduce:transition-none"
|
|
125
|
+
})
|
|
126
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
127
|
+
align: "end",
|
|
128
|
+
className: "w-76 p-1.5",
|
|
129
|
+
children: [/* @__PURE__ */ jsxs(MenuItem, {
|
|
130
|
+
onClick: () => void copy(),
|
|
131
|
+
className: row,
|
|
132
|
+
children: [/* @__PURE__ */ jsx(Tile, { children: /* @__PURE__ */ jsx(Icon, {
|
|
133
|
+
icon: Copy01Icon,
|
|
134
|
+
size: 16
|
|
135
|
+
}) }), /* @__PURE__ */ jsx(RowText, {
|
|
136
|
+
title: label,
|
|
137
|
+
description
|
|
138
|
+
})]
|
|
139
|
+
}), /* @__PURE__ */ jsxs(MenuLinkItem, {
|
|
140
|
+
href,
|
|
141
|
+
target: "_blank",
|
|
142
|
+
rel: "noopener",
|
|
143
|
+
className: row,
|
|
144
|
+
children: [/* @__PURE__ */ jsx(Tile, { children: /* @__PURE__ */ jsx(MarkdownGlyph, {}) }), /* @__PURE__ */ jsx(RowText, {
|
|
145
|
+
title: /* @__PURE__ */ jsxs(Fragment, { children: [viewLabel, /* @__PURE__ */ jsx(ActionArrow, {
|
|
146
|
+
direction: "out",
|
|
147
|
+
size: 12,
|
|
148
|
+
className: "text-fg-muted"
|
|
149
|
+
})] }),
|
|
150
|
+
description: viewDescription
|
|
151
|
+
})]
|
|
152
|
+
})]
|
|
153
|
+
})]
|
|
154
|
+
}),
|
|
155
|
+
/* @__PURE__ */ jsx("span", {
|
|
156
|
+
role: "status",
|
|
157
|
+
className: "sr-only",
|
|
158
|
+
children: state === "copied" ? copiedSentence : state === "failed" ? failedSentence : ""
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* One key of the fitting. It has no face of its own: the fitting's gloss shows through, a wash
|
|
165
|
+
* marks the key under the pointer, and a press shades only this key. On a touch screen its target
|
|
166
|
+
* grows to 44px up and down, never sideways, so the two keys never take each other's taps.
|
|
167
|
+
*/
|
|
168
|
+
const key = [
|
|
169
|
+
"relative inline-flex items-center outline-offset-2 select-none",
|
|
170
|
+
"transition-[background-color,box-shadow] spring-seat hover:bg-hover hover:spring-snap",
|
|
171
|
+
"active:bg-raised-pressed active:inset-shadow-pressed active:spring-snap",
|
|
172
|
+
"focus-visible:z-1 focus-visible:rounded-md focus-visible:outline-2 focus-visible:outline-accent",
|
|
173
|
+
"pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:top-1/2 pointer-coarse:after:h-11 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:content-['']"
|
|
174
|
+
].join(" ");
|
|
175
|
+
/** A row of the menu: a tile, then two lines. It keeps the list's instant highlight. */
|
|
176
|
+
const row = "group/row items-center gap-3 px-2 py-2";
|
|
177
|
+
function Tile({ children }) {
|
|
178
|
+
return /* @__PURE__ */ jsx("span", {
|
|
179
|
+
"aria-hidden": true,
|
|
180
|
+
"data-slot": "copy-page-tile",
|
|
181
|
+
className: "flex size-8 shrink-0 items-center justify-center rounded-md bg-surface text-fg-muted inset-ring inset-ring-hairline group-data-highlighted/row:text-fg forced-colors:inset-ring-[CanvasText]",
|
|
182
|
+
children
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function RowText({ title, description }) {
|
|
186
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
187
|
+
className: "flex min-w-0 flex-col gap-0.5",
|
|
188
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
189
|
+
className: "flex items-center gap-1 text-control leading-tight text-fg",
|
|
190
|
+
children: title
|
|
191
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
192
|
+
className: "text-sm leading-snug text-fg-muted",
|
|
193
|
+
children: description
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/** The Markdown mark (an M and a down arrow in a frame), drawn at the icons' weight. */
|
|
198
|
+
function MarkdownGlyph(props) {
|
|
199
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
200
|
+
"aria-hidden": true,
|
|
201
|
+
width: 16,
|
|
202
|
+
height: 16,
|
|
203
|
+
viewBox: "0 0 24 24",
|
|
204
|
+
fill: "none",
|
|
205
|
+
stroke: "currentColor",
|
|
206
|
+
strokeWidth: 1.5,
|
|
207
|
+
strokeLinecap: "round",
|
|
208
|
+
strokeLinejoin: "round",
|
|
209
|
+
...props,
|
|
210
|
+
children: [
|
|
211
|
+
/* @__PURE__ */ jsx("rect", {
|
|
212
|
+
x: "2",
|
|
213
|
+
y: "5",
|
|
214
|
+
width: "20",
|
|
215
|
+
height: "14",
|
|
216
|
+
rx: "3"
|
|
217
|
+
}),
|
|
218
|
+
/* @__PURE__ */ jsx("path", { d: "M6 15V9l2.5 3L11 9v6" }),
|
|
219
|
+
/* @__PURE__ */ jsx("path", { d: "M16.5 9v6m-2.5-2.5 2.5 2.5 2.5-2.5" })
|
|
220
|
+
]
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
export { CopyPage };
|
|
@@ -5,8 +5,10 @@ import { ComponentProps } from "react";
|
|
|
5
5
|
* in the middle, the page's sections on the right.
|
|
6
6
|
*
|
|
7
7
|
* The side columns stay in view while the text scrolls, below a sticky bar of the height in
|
|
8
|
-
* `--docs-top` (4rem: the `SiteHeader`'s bar, 8px off the top and 56px tall).
|
|
9
|
-
*
|
|
8
|
+
* `--docs-top` (4rem: the `SiteHeader`'s bar, 8px off the top and 56px tall). A side column
|
|
9
|
+
* longer than the window scrolls inside itself, and fades at the end that has more. The pages
|
|
10
|
+
* column shows from `lg`, the sections column from `xl`; below that, the pages go into the
|
|
11
|
+
* site's menu and the sections fold above the text.
|
|
10
12
|
*/
|
|
11
13
|
export declare function DocsLayout({ className, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
12
14
|
/** The pages of the set: a `SideNav`. Hidden below `lg`. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { containerVariants } from "../container/container.js";
|
|
2
|
+
import { ScrollFade } from "../../internal/scroll-fade.js";
|
|
2
3
|
import { cn } from "../../lib/cn.js";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
// src/components/docs-layout/docs-layout.tsx
|
|
@@ -8,8 +9,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
8
9
|
* in the middle, the page's sections on the right.
|
|
9
10
|
*
|
|
10
11
|
* The side columns stay in view while the text scrolls, below a sticky bar of the height in
|
|
11
|
-
* `--docs-top` (4rem: the `SiteHeader`'s bar, 8px off the top and 56px tall).
|
|
12
|
-
*
|
|
12
|
+
* `--docs-top` (4rem: the `SiteHeader`'s bar, 8px off the top and 56px tall). A side column
|
|
13
|
+
* longer than the window scrolls inside itself, and fades at the end that has more. The pages
|
|
14
|
+
* column shows from `lg`, the sections column from `xl`; below that, the pages go into the
|
|
15
|
+
* site's menu and the sections fold above the text.
|
|
13
16
|
*/
|
|
14
17
|
function DocsLayout({ className, ...props }) {
|
|
15
18
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -18,10 +21,11 @@ function DocsLayout({ className, ...props }) {
|
|
|
18
21
|
...props
|
|
19
22
|
});
|
|
20
23
|
}
|
|
21
|
-
const sticky = "sticky top-(--docs-top) max-h-[calc(100dvh-var(--docs-top))] self-start overflow-y-auto overscroll-contain [scrollbar-width:thin]";
|
|
24
|
+
const sticky = "sticky top-(--docs-top) max-h-[calc(100dvh-var(--docs-top))] scroll-py-10 self-start overflow-y-auto overscroll-contain [scrollbar-width:thin]";
|
|
22
25
|
/** The pages of the set: a `SideNav`. Hidden below `lg`. */
|
|
23
26
|
function DocsLayoutNav({ className, ...props }) {
|
|
24
|
-
return /* @__PURE__ */ jsx(
|
|
27
|
+
return /* @__PURE__ */ jsx(ScrollFade, {
|
|
28
|
+
axis: "y",
|
|
25
29
|
"data-slot": "docs-layout-nav",
|
|
26
30
|
className: cn(sticky, "-ml-2.5 hidden pt-10 pr-1 pb-10 pl-2.5 lg:block", className),
|
|
27
31
|
...props
|
|
@@ -37,7 +41,8 @@ function DocsLayoutMain({ className, ...props }) {
|
|
|
37
41
|
}
|
|
38
42
|
/** The sections of the page: a `TableOfContents`. Hidden below `xl`. */
|
|
39
43
|
function DocsLayoutAside({ className, ...props }) {
|
|
40
|
-
return /* @__PURE__ */ jsx(
|
|
44
|
+
return /* @__PURE__ */ jsx(ScrollFade, {
|
|
45
|
+
axis: "y",
|
|
41
46
|
"data-slot": "docs-layout-aside",
|
|
42
47
|
className: cn(sticky, "hidden pt-10 pb-10 pl-1 xl:block", className),
|
|
43
48
|
...props
|
|
@@ -2,7 +2,10 @@ import { HeadingProps } from "../heading/heading.js";
|
|
|
2
2
|
import { TextProps } from "../text/text.js";
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
4
|
export type PageHeaderProps = ComponentProps<"div"> & {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Opens the block with the 2px rule. Every section of a page has one; its opening has none, and
|
|
7
|
+
* neither has a section that a `Seam` opens.
|
|
8
|
+
*/
|
|
6
9
|
rule?: boolean;
|
|
7
10
|
};
|
|
8
11
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Heading } from "../heading/heading.js";
|
|
2
2
|
import { Text } from "../text/text.js";
|
|
3
|
+
import { ruleTop } from "../../internal/rule.js";
|
|
3
4
|
import { cn } from "../../lib/cn.js";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
// src/components/page-header/page-header.tsx
|
|
@@ -10,7 +11,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
10
11
|
function PageHeader({ rule = false, className, ...props }) {
|
|
11
12
|
return /* @__PURE__ */ jsx("div", {
|
|
12
13
|
"data-slot": "page-header",
|
|
13
|
-
className: cn("flex flex-col items-start gap-4", rule && "
|
|
14
|
+
className: cn("flex flex-col items-start gap-4", rule && [ruleTop, "pt-6"], className),
|
|
14
15
|
...props
|
|
15
16
|
});
|
|
16
17
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ruleTop } from "../../internal/rule.js";
|
|
1
2
|
import { cn } from "../../lib/cn.js";
|
|
2
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { Fragment as Fragment$1 } from "react";
|
|
@@ -13,7 +14,7 @@ import { Fragment as Fragment$1 } from "react";
|
|
|
13
14
|
function ParameterList({ className, ...props }) {
|
|
14
15
|
return /* @__PURE__ */ jsx("dl", {
|
|
15
16
|
"data-slot": "parameter-list",
|
|
16
|
-
className: cn("flex flex-col
|
|
17
|
+
className: cn("flex flex-col", ruleTop, className),
|
|
17
18
|
...props
|
|
18
19
|
});
|
|
19
20
|
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// src/components/seam/seam-outline.ts
|
|
2
|
+
/** The band above the edge, in px: it covers the last pixels of the part above, so they match. */
|
|
3
|
+
const BAND = 2;
|
|
4
|
+
/** At `--seam-scale: 1`: the edge steps 26px over a 35px run (about 37°), with bends of 24px. */
|
|
5
|
+
const DEPTH = 26;
|
|
6
|
+
const RUN = 35;
|
|
7
|
+
const BEND = 24;
|
|
8
|
+
/** Points per bend: enough that no facet shows at 3x. */
|
|
9
|
+
const STEPS = 8;
|
|
10
|
+
function unit(x, y) {
|
|
11
|
+
const length = Math.hypot(x, y);
|
|
12
|
+
return {
|
|
13
|
+
x: x / length,
|
|
14
|
+
y: y / length
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const left = unit(-1, 0);
|
|
18
|
+
const downLeft = unit(-35, DEPTH);
|
|
19
|
+
const upLeft = unit(-35, -26);
|
|
20
|
+
/**
|
|
21
|
+
* Clockwise from the right end of the edge. The straight parts of the edge stand at `flat` (in px
|
|
22
|
+
* below the band's foot), the middle at `middle`; the slopes join them at ±(--seam-w + RUN).
|
|
23
|
+
*/
|
|
24
|
+
const shapes = {
|
|
25
|
+
down: {
|
|
26
|
+
flat: 0,
|
|
27
|
+
corners: [
|
|
28
|
+
{
|
|
29
|
+
side: 1,
|
|
30
|
+
at: {
|
|
31
|
+
x: RUN,
|
|
32
|
+
y: 0
|
|
33
|
+
},
|
|
34
|
+
from: left,
|
|
35
|
+
to: downLeft
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
side: 1,
|
|
39
|
+
at: {
|
|
40
|
+
x: 0,
|
|
41
|
+
y: DEPTH
|
|
42
|
+
},
|
|
43
|
+
from: downLeft,
|
|
44
|
+
to: left
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
side: -1,
|
|
48
|
+
at: {
|
|
49
|
+
x: 0,
|
|
50
|
+
y: DEPTH
|
|
51
|
+
},
|
|
52
|
+
from: left,
|
|
53
|
+
to: upLeft
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
side: -1,
|
|
57
|
+
at: {
|
|
58
|
+
x: -35,
|
|
59
|
+
y: 0
|
|
60
|
+
},
|
|
61
|
+
from: upLeft,
|
|
62
|
+
to: left
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
up: {
|
|
67
|
+
flat: DEPTH,
|
|
68
|
+
corners: [
|
|
69
|
+
{
|
|
70
|
+
side: 1,
|
|
71
|
+
at: {
|
|
72
|
+
x: RUN,
|
|
73
|
+
y: DEPTH
|
|
74
|
+
},
|
|
75
|
+
from: left,
|
|
76
|
+
to: upLeft
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
side: 1,
|
|
80
|
+
at: {
|
|
81
|
+
x: 0,
|
|
82
|
+
y: 0
|
|
83
|
+
},
|
|
84
|
+
from: upLeft,
|
|
85
|
+
to: left
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
side: -1,
|
|
89
|
+
at: {
|
|
90
|
+
x: 0,
|
|
91
|
+
y: 0
|
|
92
|
+
},
|
|
93
|
+
from: left,
|
|
94
|
+
to: downLeft
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
side: -1,
|
|
98
|
+
at: {
|
|
99
|
+
x: -35,
|
|
100
|
+
y: DEPTH
|
|
101
|
+
},
|
|
102
|
+
from: downLeft,
|
|
103
|
+
to: left
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
/** How far a bend reaches from its corner along each line. */
|
|
109
|
+
const reach = BEND * Math.tan(Math.atan2(DEPTH, RUN) / 2);
|
|
110
|
+
const px = (value) => `${Math.round(value * 100) / 100}px`;
|
|
111
|
+
const y = (value) => `calc(${px(BAND)} + ${px(value)} * var(--seam-scale))`;
|
|
112
|
+
function point(side, x, at) {
|
|
113
|
+
return `calc(${side === 1 ? "50% + var(--seam-w)" : "50% - var(--seam-w)"} + ${px(x)} * var(--seam-scale)) ${y(at)}`;
|
|
114
|
+
}
|
|
115
|
+
function bend({ side, at, from, to }) {
|
|
116
|
+
const points = [];
|
|
117
|
+
for (let step = 0; step <= STEPS; step += 1) {
|
|
118
|
+
const s = step / STEPS;
|
|
119
|
+
const before = (1 - s) ** 2 * reach;
|
|
120
|
+
const after = s ** 2 * reach;
|
|
121
|
+
points.push(point(side, at.x - from.x * before + to.x * after, at.y - from.y * before + to.y * after));
|
|
122
|
+
}
|
|
123
|
+
return points;
|
|
124
|
+
}
|
|
125
|
+
function outline({ flat, corners }) {
|
|
126
|
+
const top = `-${px(BAND)}`;
|
|
127
|
+
return `polygon(${[
|
|
128
|
+
`0 ${top}`,
|
|
129
|
+
`100% ${top}`,
|
|
130
|
+
`100% ${y(flat)}`,
|
|
131
|
+
...corners.flatMap(bend),
|
|
132
|
+
`0 ${y(flat)}`
|
|
133
|
+
].join(", ")})`;
|
|
134
|
+
}
|
|
135
|
+
/** The polygon per direction (the width and the scale are CSS variables, so one string each). */
|
|
136
|
+
const seamOutline = {
|
|
137
|
+
down: outline(shapes.down),
|
|
138
|
+
up: outline(shapes.up)
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Where the strip that holds the outline starts, measured from the seam (the top of the part
|
|
142
|
+
* below): so high that the straight parts of the edge land on the seam itself.
|
|
143
|
+
*/
|
|
144
|
+
const seamLift = {
|
|
145
|
+
down: `-2px`,
|
|
146
|
+
up: `calc(-2px - ${DEPTH}px * var(--seam-scale))`
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Half the tongue's narrow side as the outline reads it: the width asked for (`--seam-half`), but
|
|
150
|
+
* never so wide that a slope leaves the window or reaches into the page's gutter.
|
|
151
|
+
*/
|
|
152
|
+
const seamHalfWidth = `min(var(--seam-half), 50% - ${RUN}px * var(--seam-scale) - var(--seam-gutter))`;
|
|
153
|
+
export { seamHalfWidth, seamLift, seamOutline };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
declare const seamVariants: (props?: ({
|
|
4
|
+
direction?: "down" | "up" | null | undefined;
|
|
5
|
+
above?: "ground" | "well" | "surface" | null | undefined;
|
|
6
|
+
below?: "ground" | "well" | "surface" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export type SeamProps = Omit<ComponentProps<"div">, "children"> & VariantProps<typeof seamVariants>;
|
|
9
|
+
/**
|
|
10
|
+
* Where one section of a website ends and the next begins, drawn as the edge of two plates: the
|
|
11
|
+
* plate above lies on the part below and throws a short shadow onto it. Across the content column
|
|
12
|
+
* its edge dips down as a tongue (`direction="down"`) or rises as a notch (`"up"`); choose per
|
|
13
|
+
* seam, by what the sections say. Put it between two `Section`s, in place of the rule that would
|
|
14
|
+
* open the second. It takes no room: it is drawn into the padding of the sections around it.
|
|
15
|
+
*
|
|
16
|
+
* Seams go with sections that alternate between the ground and the well (`bg-well` on every other
|
|
17
|
+
* one), so the two plates really differ. Tell the seam both colours: `above` fills the plate's
|
|
18
|
+
* face, `below` what shows in a notch. The page's closing (a `Cta`) needs none: its block closes
|
|
19
|
+
* the page by itself. It is decoration and is hidden from assistive technology: the sections carry
|
|
20
|
+
* the structure.
|
|
21
|
+
*/
|
|
22
|
+
export declare function Seam({ direction, above, below, className, style, ...props }: SeamProps): import("react").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { seamHalfWidth, seamLift, seamOutline } from "./seam-outline.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
// src/components/seam/seam.tsx
|
|
6
|
+
const seamVariants = cva([
|
|
7
|
+
"pointer-events-none relative z-1 h-0",
|
|
8
|
+
"[--seam-half:36rem]",
|
|
9
|
+
"[--seam-gutter:1.25rem] [--seam-scale:0.7] sm:[--seam-gutter:2rem] sm:[--seam-scale:1]"
|
|
10
|
+
], {
|
|
11
|
+
variants: {
|
|
12
|
+
direction: {
|
|
13
|
+
/** The plate above dips into the part below as a tongue. */
|
|
14
|
+
down: "",
|
|
15
|
+
/** The plate above has a notch, and the part below rises into it. */
|
|
16
|
+
up: ""
|
|
17
|
+
},
|
|
18
|
+
/** The colour of the part above: the plate's face. */
|
|
19
|
+
above: {
|
|
20
|
+
ground: "[--seam-face:var(--lf-ground)]",
|
|
21
|
+
well: "[--seam-face:var(--lf-well)]",
|
|
22
|
+
surface: "[--seam-face:var(--lf-surface)]"
|
|
23
|
+
},
|
|
24
|
+
/** The colour of the part below: a notch (`up`) reaches above the seam and shows it there. */
|
|
25
|
+
below: {
|
|
26
|
+
ground: "[--seam-below:var(--lf-ground)]",
|
|
27
|
+
well: "[--seam-below:var(--lf-well)]",
|
|
28
|
+
surface: "[--seam-below:var(--lf-surface)]"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
direction: "down",
|
|
33
|
+
above: "ground",
|
|
34
|
+
below: "ground"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const layer = "absolute inset-0";
|
|
38
|
+
const layers = [
|
|
39
|
+
"translate-y-px bg-(--depth-seam-edge) forced-colors:bg-[color:CanvasText]",
|
|
40
|
+
"bg-(--seam-face) bg-[linear-gradient(var(--depth-seam-lo),var(--depth-seam-lo))]",
|
|
41
|
+
"-translate-y-px bg-(--seam-face) forced-colors:bg-[color:Canvas]"
|
|
42
|
+
];
|
|
43
|
+
/**
|
|
44
|
+
* Where one section of a website ends and the next begins, drawn as the edge of two plates: the
|
|
45
|
+
* plate above lies on the part below and throws a short shadow onto it. Across the content column
|
|
46
|
+
* its edge dips down as a tongue (`direction="down"`) or rises as a notch (`"up"`); choose per
|
|
47
|
+
* seam, by what the sections say. Put it between two `Section`s, in place of the rule that would
|
|
48
|
+
* open the second. It takes no room: it is drawn into the padding of the sections around it.
|
|
49
|
+
*
|
|
50
|
+
* Seams go with sections that alternate between the ground and the well (`bg-well` on every other
|
|
51
|
+
* one), so the two plates really differ. Tell the seam both colours: `above` fills the plate's
|
|
52
|
+
* face, `below` what shows in a notch. The page's closing (a `Cta`) needs none: its block closes
|
|
53
|
+
* the page by itself. It is decoration and is hidden from assistive technology: the sections carry
|
|
54
|
+
* the structure.
|
|
55
|
+
*/
|
|
56
|
+
function Seam({ direction, above, below, className, style, ...props }) {
|
|
57
|
+
const way = direction ?? "down";
|
|
58
|
+
const clip = { clipPath: seamOutline[way] };
|
|
59
|
+
return /* @__PURE__ */ jsx("div", {
|
|
60
|
+
"aria-hidden": true,
|
|
61
|
+
"data-slot": "seam",
|
|
62
|
+
"data-direction": way,
|
|
63
|
+
className: cn(seamVariants({
|
|
64
|
+
direction,
|
|
65
|
+
above,
|
|
66
|
+
below
|
|
67
|
+
}), className),
|
|
68
|
+
style: {
|
|
69
|
+
"--seam-w": seamHalfWidth,
|
|
70
|
+
...style
|
|
71
|
+
},
|
|
72
|
+
...props,
|
|
73
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
"data-slot": "seam-strip",
|
|
75
|
+
className: "absolute inset-x-0 h-16 overflow-hidden",
|
|
76
|
+
style: { top: seamLift[way] },
|
|
77
|
+
children: [way === "up" && /* @__PURE__ */ jsx("div", { className: cn(layer, "bg-(--seam-below) forced-colors:bg-[color:Canvas]") }), /* @__PURE__ */ jsx("div", {
|
|
78
|
+
"data-slot": "seam-plate",
|
|
79
|
+
className: cn(layer, "depth-seam"),
|
|
80
|
+
children: layers.map((look) => /* @__PURE__ */ jsx("div", {
|
|
81
|
+
style: clip,
|
|
82
|
+
className: cn(layer, look)
|
|
83
|
+
}, look))
|
|
84
|
+
})]
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export { Seam };
|
|
@@ -10,8 +10,8 @@ const separatorVariants = cva("shrink-0 data-[orientation=horizontal]:h-(--separ
|
|
|
10
10
|
hairline: "bg-hairline [--separator-size:1px]",
|
|
11
11
|
/** The kit's structural 1px line, visible on its own (3:1). */
|
|
12
12
|
line: "bg-line [--separator-size:1px]",
|
|
13
|
-
/** The 2px rule that opens a block. */
|
|
14
|
-
rule: "bg-rule [--separator-size:2px]"
|
|
13
|
+
/** The 2px rule that opens a block: a line with round ends. */
|
|
14
|
+
rule: "rounded-full bg-rule [--separator-size:2px]"
|
|
15
15
|
} },
|
|
16
16
|
defaultVariants: { variant: "hairline" }
|
|
17
17
|
});
|
|
@@ -8,7 +8,7 @@ type Named = {
|
|
|
8
8
|
"aria-label"?: undefined;
|
|
9
9
|
};
|
|
10
10
|
export type TableProps = Omit<ComponentProps<"table">, "aria-label" | "aria-labelledby"> & Named & {
|
|
11
|
-
/** Classes for the
|
|
11
|
+
/** Classes for the box around the table (its rule and the scrolling region): its place. */
|
|
12
12
|
containerClassName?: string;
|
|
13
13
|
/**
|
|
14
14
|
* What the cells hold. `data` (the default): short values, centred on the row's line.
|
|
@@ -26,13 +26,13 @@ export type TableProps = Omit<ComponentProps<"table">, "aria-label" | "aria-labe
|
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
28
|
* Rows of the same kind of thing, compared column by column: quotes, invoice lines, members.
|
|
29
|
-
* Real `<table>` markup, structured by line and not by box: a 2px rule opens it,
|
|
30
|
-
* divide the rows, no stripes and no card around it.
|
|
29
|
+
* Real `<table>` markup, structured by line and not by box: a 2px rule with round ends opens it,
|
|
30
|
+
* hairlines divide the rows, no stripes and no card around it.
|
|
31
31
|
*
|
|
32
32
|
* On a narrow screen the table keeps its columns and scrolls sideways inside its own region,
|
|
33
|
-
* which is focusable so the keyboard can scroll it too.
|
|
34
|
-
*
|
|
35
|
-
* if its columns must not squeeze.
|
|
33
|
+
* which is focusable so the keyboard can scroll it too. Its edges fade where more columns wait;
|
|
34
|
+
* the rule above stays whole. Name it with `aria-label` (or `aria-labelledby`, pointing at a
|
|
35
|
+
* heading or the `TableCaption`). Give the table a `min-w-*` if its columns must not squeeze.
|
|
36
36
|
*
|
|
37
37
|
* Sorting, filtering and paging are the caller's state; the table only provides the slots.
|
|
38
38
|
*/
|
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
import { ArrowUpGlyph } from "../../internal/glyphs.js";
|
|
2
|
+
import { ruleTop } from "../../internal/rule.js";
|
|
3
|
+
import { ScrollFade } from "../../internal/scroll-fade.js";
|
|
2
4
|
import { cn } from "../../lib/cn.js";
|
|
3
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
6
|
// src/components/table/table.tsx
|
|
5
7
|
/**
|
|
6
8
|
* Rows of the same kind of thing, compared column by column: quotes, invoice lines, members.
|
|
7
|
-
* Real `<table>` markup, structured by line and not by box: a 2px rule opens it,
|
|
8
|
-
* divide the rows, no stripes and no card around it.
|
|
9
|
+
* Real `<table>` markup, structured by line and not by box: a 2px rule with round ends opens it,
|
|
10
|
+
* hairlines divide the rows, no stripes and no card around it.
|
|
9
11
|
*
|
|
10
12
|
* On a narrow screen the table keeps its columns and scrolls sideways inside its own region,
|
|
11
|
-
* which is focusable so the keyboard can scroll it too.
|
|
12
|
-
*
|
|
13
|
-
* if its columns must not squeeze.
|
|
13
|
+
* which is focusable so the keyboard can scroll it too. Its edges fade where more columns wait;
|
|
14
|
+
* the rule above stays whole. Name it with `aria-label` (or `aria-labelledby`, pointing at a
|
|
15
|
+
* heading or the `TableCaption`). Give the table a `min-w-*` if its columns must not squeeze.
|
|
14
16
|
*
|
|
15
17
|
* Sorting, filtering and paging are the caller's state; the table only provides the slots.
|
|
16
18
|
*/
|
|
17
19
|
function Table({ className, containerClassName, content = "data", stack = false, "aria-label": label, "aria-labelledby": labelledBy, ...props }) {
|
|
18
20
|
return /* @__PURE__ */ jsx("div", {
|
|
19
21
|
"data-slot": "table-container",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
className: cn(ruleTop, "rounded-xs", "has-[[data-slot=table-scroll]:focus-visible]:outline-2", "has-[[data-slot=table-scroll]:focus-visible]:outline-offset-2", "has-[[data-slot=table-scroll]:focus-visible]:outline-accent", containerClassName),
|
|
23
|
+
children: /* @__PURE__ */ jsx(ScrollFade, {
|
|
24
|
+
"data-slot": "table-scroll",
|
|
25
|
+
role: "region",
|
|
26
|
+
"aria-label": label,
|
|
27
|
+
"aria-labelledby": labelledBy,
|
|
28
|
+
tabIndex: 0,
|
|
29
|
+
className: cn("relative w-full overflow-x-auto focus-visible:outline-hidden", "scroll-px-10"),
|
|
30
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
31
|
+
"data-slot": "table",
|
|
32
|
+
"data-content": content,
|
|
33
|
+
"data-stack": stack ? "" : void 0,
|
|
34
|
+
role: "table",
|
|
35
|
+
className: cn("w-full caption-bottom border-collapse text-left text-base text-fg-body", "data-stack:max-sm:block", className),
|
|
36
|
+
...props
|
|
37
|
+
})
|
|
32
38
|
})
|
|
33
39
|
});
|
|
34
40
|
}
|
|
@@ -79,18 +79,23 @@ function useCurrentSection(ids) {
|
|
|
79
79
|
}
|
|
80
80
|
return [current, hold];
|
|
81
81
|
}
|
|
82
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Brings an entry into view inside the box that scrolls the contents, never the page. It keeps
|
|
84
|
+
* the box's scroll padding off the edge, which clears the box's fade (`DocsLayoutAside`).
|
|
85
|
+
*/
|
|
83
86
|
function keepInView(link) {
|
|
84
87
|
let box = link.parentElement;
|
|
88
|
+
let style;
|
|
85
89
|
while (box && box !== document.body) {
|
|
86
|
-
|
|
87
|
-
if (overflowY === "auto" || overflowY === "scroll") break;
|
|
90
|
+
style = getComputedStyle(box);
|
|
91
|
+
if (style.overflowY === "auto" || style.overflowY === "scroll") break;
|
|
88
92
|
box = box.parentElement;
|
|
89
93
|
}
|
|
90
|
-
if (!box || box === document.body) return;
|
|
94
|
+
if (!box || box === document.body || !style) return;
|
|
95
|
+
const margin = parseFloat(style.scrollPaddingTop) || 24;
|
|
91
96
|
const top = link.offsetTop - box.offsetTop;
|
|
92
|
-
if (top < box.scrollTop +
|
|
93
|
-
else if (top + link.offsetHeight > box.scrollTop + box.clientHeight -
|
|
97
|
+
if (top < box.scrollTop + margin) box.scrollTop = Math.max(0, top - margin);
|
|
98
|
+
else if (top + link.offsetHeight > box.scrollTop + box.clientHeight - margin) box.scrollTop = top + link.offsetHeight - box.clientHeight + margin;
|
|
94
99
|
}
|
|
95
100
|
const indent = {
|
|
96
101
|
2: "",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useReducedMotion } from "../../internal/reduced-motion.js";
|
|
3
3
|
import { useScrollEdges } from "../../internal/scroll-edges.js";
|
|
4
4
|
import { cn, mergeClassName } from "../../lib/cn.js";
|
|
5
|
+
import { mergeRefs } from "../../lib/merge-refs.js";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { createContext, useContext, useEffect, useRef } from "react";
|
|
7
8
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
@@ -16,12 +17,6 @@ function Tabs({ className, ...props }) {
|
|
|
16
17
|
}
|
|
17
18
|
/** How far a tab keeps off the edge it is scrolled to: past the fade (tabs.css), in px. */
|
|
18
19
|
const REVEAL_MARGIN = 40;
|
|
19
|
-
function mergeRefs(own, theirs) {
|
|
20
|
-
return (node) => {
|
|
21
|
-
for (const ref of [own, theirs]) if (typeof ref === "function") ref(node);
|
|
22
|
-
else if (ref) ref.current = node;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
20
|
/**
|
|
26
21
|
* A row of labels, each with a mark. One soft highlight glides to the current tab (`glide`) and
|
|
27
22
|
* its mark closes from ring to disc. Base UI measures the active tab; we only move the highlight.
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { LineSpec } from "./components/code-block/lines.js";
|
|
|
21
21
|
import { Collapsible, CollapsiblePanel, CollapsiblePanelProps, CollapsibleProps, CollapsibleTrigger, CollapsibleTriggerProps } from "./components/collapsible/collapsible.js";
|
|
22
22
|
import { Combobox, ComboboxCollection, ComboboxContent, ComboboxContentProps, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxInputProps, ComboboxItem, ComboboxItemProps, ComboboxOption, ComboboxOptionGroup, ComboboxProps, ComboboxSeparator } from "./components/combobox/combobox.js";
|
|
23
23
|
import { Container, ContainerProps, containerVariants } from "./components/container/container.js";
|
|
24
|
+
import { CopyPage, CopyPageProps } from "./components/copy-page/copy-page.js";
|
|
24
25
|
import { CopyPill, CopyPillMark, CopyPillProps } from "./components/copy-pill/copy-pill.js";
|
|
25
26
|
import { Cta, CtaAction, CtaActionProps, CtaActions, CtaMessage, CtaMessageProps, CtaProps, CtaText, CtaTitle, CtaTone } from "./components/cta/cta.js";
|
|
26
27
|
import { DateField, DateFieldProps } from "./components/date-field/date-field.js";
|
|
@@ -56,6 +57,7 @@ import { Prose } from "./components/prose/prose.js";
|
|
|
56
57
|
import { Quote, QuoteProps } from "./components/quote/quote.js";
|
|
57
58
|
import { Radio, RadioGroup, RadioGroupProps, RadioProps } from "./components/radio/radio.js";
|
|
58
59
|
import { ReferenceEntry, ReferenceEntryBody, ReferenceEntryHeader, ReferenceEntryMeta, ReferenceEntryName, ReferenceEntryTitle } from "./components/reference-entry/reference-entry.js";
|
|
60
|
+
import { Seam, SeamProps } from "./components/seam/seam.js";
|
|
59
61
|
import { Section, SectionProps } from "./components/section/section.js";
|
|
60
62
|
import { Segment, SegmentProps, SegmentedControl, SegmentedControlProps } from "./components/segmented-control/segmented-control.js";
|
|
61
63
|
import { Select, SelectContent, SelectContentProps, SelectGroup, SelectGroupLabel, SelectItem, SelectItemProps, SelectOption, SelectOptionGroup, SelectProps, SelectSeparator, SelectTrigger, SelectTriggerProps } from "./components/select/select.js";
|
|
@@ -76,4 +78,4 @@ import { ToastOptions, ToastTone, Toaster, ToasterProps, toast, toastManager } f
|
|
|
76
78
|
import { Tooltip, TooltipContent, TooltipContentProps, TooltipProvider, TooltipTrigger } from "./components/tooltip/tooltip.js";
|
|
77
79
|
import { cn, mergeClassName } from "./lib/cn.js";
|
|
78
80
|
import { SpringName, springs, transitions } from "./motion/springs.js";
|
|
79
|
-
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, 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, PageHeader, PageHeaderActions, PageHeaderLead, type PageHeaderProps, PageHeaderTitle, type PageHeaderTitleProps, 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, 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, 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, TimeField, type TimeFieldProps, type ToastOptions, type ToastTone, Toaster, type ToasterProps, type TocItem, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, Wordmark, type WordmarkProps, buttonVariants, cn, containerVariants, linkVariants, mergeClassName, navigationMenuEntryVariants, siteFooterLinkClass, springs, toast, toastManager, transitions, useGround };
|
|
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, PageHeader, PageHeaderActions, PageHeaderLead, type PageHeaderProps, PageHeaderTitle, type PageHeaderTitleProps, 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, 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, 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, TimeField, type TimeFieldProps, type ToastOptions, type ToastTone, Toaster, type ToasterProps, type TocItem, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, Wordmark, type WordmarkProps, buttonVariants, cn, containerVariants, linkVariants, mergeClassName, navigationMenuEntryVariants, siteFooterLinkClass, springs, toast, toastManager, transitions, useGround };
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import { CodeTabs } from "./components/code-block/code-tabs.js";
|
|
|
19
19
|
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "./components/collapsible/collapsible.js";
|
|
20
20
|
import { Combobox, ComboboxCollection, ComboboxContent, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxSeparator } from "./components/combobox/combobox.js";
|
|
21
21
|
import { Container, containerVariants } from "./components/container/container.js";
|
|
22
|
+
import { CopyPage } from "./components/copy-page/copy-page.js";
|
|
22
23
|
import { CopyPill, CopyPillMark } from "./components/copy-pill/copy-pill.js";
|
|
23
24
|
import { Cta, CtaAction, CtaActions, CtaMessage, CtaText, CtaTitle } from "./components/cta/cta.js";
|
|
24
25
|
import { DateField } from "./components/date-field/date-field.js";
|
|
@@ -54,6 +55,7 @@ import { Prose } from "./components/prose/prose.js";
|
|
|
54
55
|
import { Quote } from "./components/quote/quote.js";
|
|
55
56
|
import { Radio, RadioGroup } from "./components/radio/radio.js";
|
|
56
57
|
import { ReferenceEntry, ReferenceEntryBody, ReferenceEntryHeader, ReferenceEntryMeta, ReferenceEntryName, ReferenceEntryTitle } from "./components/reference-entry/reference-entry.js";
|
|
58
|
+
import { Seam } from "./components/seam/seam.js";
|
|
57
59
|
import { Section } from "./components/section/section.js";
|
|
58
60
|
import { Segment, SegmentedControl } from "./components/segmented-control/segmented-control.js";
|
|
59
61
|
import { Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger } from "./components/select/select.js";
|
|
@@ -74,4 +76,4 @@ import { Toaster, toast, toastManager } from "./components/toast/toast.js";
|
|
|
74
76
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip/tooltip.js";
|
|
75
77
|
import { cn, mergeClassName } from "./lib/cn.js";
|
|
76
78
|
import { springs, transitions } from "./motion/springs.js";
|
|
77
|
-
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, 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, PageHeader, PageHeaderActions, PageHeaderLead, PageHeaderTitle, Pager, PagerLink, Parameter, ParameterList, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, ProgressLabel, ProgressTrack, ProgressValue, Prose, Quote, Radio, RadioGroup, ReferenceEntry, ReferenceEntryBody, ReferenceEntryHeader, ReferenceEntryMeta, ReferenceEntryName, ReferenceEntryTitle, Section, Segment, SegmentedControl, Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, Separator, 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, TimeField, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Wordmark, buttonVariants, cn, containerVariants, linkVariants, mergeClassName, navigationMenuEntryVariants, siteFooterLinkClass, springs, toast, toastManager, transitions, useGround };
|
|
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, PageHeader, PageHeaderActions, PageHeaderLead, PageHeaderTitle, Pager, PagerLink, Parameter, ParameterList, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, ProgressLabel, ProgressTrack, ProgressValue, Prose, Quote, Radio, RadioGroup, ReferenceEntry, ReferenceEntryBody, ReferenceEntryHeader, ReferenceEntryMeta, ReferenceEntryName, ReferenceEntryTitle, Seam, Section, Segment, SegmentedControl, Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, Separator, 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, TimeField, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Wordmark, buttonVariants, cn, containerVariants, linkVariants, mergeClassName, navigationMenuEntryVariants, siteFooterLinkClass, springs, toast, toastManager, transitions, useGround };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/internal/rule.ts
|
|
2
|
+
/**
|
|
3
|
+
* The 2px rule that opens a block (`Table`, `Accordion`, `ParameterList`, a `PageHeader` with
|
|
4
|
+
* `rule`): a straight line with round ends. The box keeps a transparent 2px top border, so it is
|
|
5
|
+
* laid out exactly as with `border-t-2`, and the line is drawn into that border as `::before`.
|
|
6
|
+
* A border cannot round its own ends: with a radius it bends down at the corners instead.
|
|
7
|
+
*
|
|
8
|
+
* The box becomes positioned, and must not clip its top edge. Server-safe.
|
|
9
|
+
*/
|
|
10
|
+
const ruleTop = [
|
|
11
|
+
"relative border-t-2 border-t-transparent",
|
|
12
|
+
"before:absolute before:inset-x-0 before:-top-0.5 before:h-0.5 before:rounded-full before:bg-rule",
|
|
13
|
+
"forced-colors:before:bg-[color:CanvasText]"
|
|
14
|
+
].join(" ");
|
|
15
|
+
export { ruleTop };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useScrollEdges } from "./scroll-edges.js";
|
|
3
|
+
import { mergeRefs } from "../lib/merge-refs.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useRef } from "react";
|
|
6
|
+
// src/internal/scroll-fade.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A box that scrolls and fades its edges where more waits (scroll-fade.css), as a code block's
|
|
9
|
+
* long lines and a long row of tabs do. The box itself still needs its `overflow-*`.
|
|
10
|
+
*
|
|
11
|
+
* It is the client part of components that stay server-safe (`Table`, `DocsLayout`): they render
|
|
12
|
+
* this one box, and everything inside it stays theirs. The mask also cuts what is drawn outside
|
|
13
|
+
* the box, so a focus outline belongs on a box around it.
|
|
14
|
+
*/
|
|
15
|
+
function ScrollFade({ axis = "x", ref, ...props }) {
|
|
16
|
+
const box = useRef(null);
|
|
17
|
+
useScrollEdges(box, axis);
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
ref: mergeRefs(box, ref),
|
|
20
|
+
"data-scroll-fade": axis,
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export { ScrollFade };
|
package/dist/lib/cn.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/lib/merge-refs.ts
|
|
2
|
+
/** One ref callback that fills both a component's own ref and the one its caller passed. */
|
|
3
|
+
function mergeRefs(own, theirs) {
|
|
4
|
+
return (node) => {
|
|
5
|
+
for (const ref of [own, theirs]) if (typeof ref === "function") ref(node);
|
|
6
|
+
else if (ref) ref.current = node;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export { mergeRefs };
|
package/package.json
CHANGED
package/src/styles/code.css
CHANGED
|
@@ -218,35 +218,5 @@
|
|
|
218
218
|
--code-fade-end: 2.5rem;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
/*
|
|
222
|
-
* Copy: the copy symbol shrinks away and a tick is drawn in its place, short leg first, as in
|
|
223
|
-
* a checkbox. When the moment has passed the tick fades where it is (it is not undrawn) and the
|
|
224
|
-
* copy symbol seats back with a little bounce.
|
|
225
|
-
*/
|
|
226
|
-
[data-slot="code-copy-symbol"] {
|
|
227
|
-
transition-property: scale, opacity;
|
|
228
|
-
transition-duration: var(--transition-duration-spring-seat);
|
|
229
|
-
transition-timing-function: var(--ease-spring-seat);
|
|
230
|
-
}
|
|
231
|
-
[data-copied] > [data-slot="code-copy-symbol"] {
|
|
232
|
-
scale: 0.5;
|
|
233
|
-
opacity: 0;
|
|
234
|
-
transition-duration: var(--transition-duration-spring-leave);
|
|
235
|
-
transition-timing-function: var(--ease-spring-leave);
|
|
236
|
-
}
|
|
237
|
-
[data-slot="code-copy-tick"] {
|
|
238
|
-
stroke-dasharray: 1;
|
|
239
|
-
stroke-dashoffset: 1;
|
|
240
|
-
opacity: 0;
|
|
241
|
-
transition:
|
|
242
|
-
opacity var(--transition-duration-spring-leave) var(--ease-spring-leave),
|
|
243
|
-
stroke-dashoffset 0s var(--transition-duration-spring-leave);
|
|
244
|
-
}
|
|
245
|
-
[data-copied] > [data-slot="code-copy-tick"] {
|
|
246
|
-
stroke-dashoffset: 0;
|
|
247
|
-
opacity: 1;
|
|
248
|
-
transition:
|
|
249
|
-
opacity 60ms linear 60ms,
|
|
250
|
-
stroke-dashoffset 220ms cubic-bezier(0.3, 0, 0.2, 1) 60ms;
|
|
251
|
-
}
|
|
221
|
+
/* The copy key's confirmation is shared with every control that copies: see copy.css. */
|
|
252
222
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The confirmation of a copy, the same in every control that copies (a code block's key, the
|
|
3
|
+
* page copy): the copy symbol shrinks away and a tick is drawn in its place, short leg first, as
|
|
4
|
+
* in a checkbox. When the moment has passed the tick fades where it is (it is not undrawn) and
|
|
5
|
+
* the copy symbol seats back with a little bounce.
|
|
6
|
+
*
|
|
7
|
+
* The control sets `data-copied` while the moment lasts; the symbol and the tick are found inside
|
|
8
|
+
* it by their slots. Under reduced motion nothing scales or draws: the two only cross-fade.
|
|
9
|
+
*/
|
|
10
|
+
@layer components {
|
|
11
|
+
:is([data-slot="code-copy-symbol"], [data-slot="copy-page-symbol"]) {
|
|
12
|
+
transition-property: scale, opacity;
|
|
13
|
+
transition-duration: var(--transition-duration-spring-seat);
|
|
14
|
+
transition-timing-function: var(--ease-spring-seat);
|
|
15
|
+
}
|
|
16
|
+
[data-copied] :is([data-slot="code-copy-symbol"], [data-slot="copy-page-symbol"]) {
|
|
17
|
+
scale: 0.5;
|
|
18
|
+
opacity: 0;
|
|
19
|
+
transition-duration: var(--transition-duration-spring-leave);
|
|
20
|
+
transition-timing-function: var(--ease-spring-leave);
|
|
21
|
+
}
|
|
22
|
+
:is([data-slot="code-copy-tick"], [data-slot="copy-page-tick"]) {
|
|
23
|
+
stroke-dasharray: 1;
|
|
24
|
+
stroke-dashoffset: 1;
|
|
25
|
+
opacity: 0;
|
|
26
|
+
transition:
|
|
27
|
+
opacity var(--transition-duration-spring-leave) var(--ease-spring-leave),
|
|
28
|
+
stroke-dashoffset 0s var(--transition-duration-spring-leave);
|
|
29
|
+
}
|
|
30
|
+
[data-copied] :is([data-slot="code-copy-tick"], [data-slot="copy-page-tick"]) {
|
|
31
|
+
stroke-dashoffset: 0;
|
|
32
|
+
opacity: 1;
|
|
33
|
+
transition:
|
|
34
|
+
opacity 60ms linear 60ms,
|
|
35
|
+
stroke-dashoffset 220ms cubic-bezier(0.3, 0, 0.2, 1) 60ms;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (prefers-reduced-motion: reduce) {
|
|
39
|
+
[data-copied] :is([data-slot="code-copy-symbol"], [data-slot="copy-page-symbol"]) {
|
|
40
|
+
scale: 1;
|
|
41
|
+
}
|
|
42
|
+
:is([data-slot="code-copy-tick"], [data-slot="copy-page-tick"]) {
|
|
43
|
+
stroke-dashoffset: 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
package/src/styles/depth.css
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* component follows. The look is "Fase" (see DESIGN.md): glossy faces, 1px edges in the fill's
|
|
4
4
|
* own hue, a light top edge, short soft shadows.
|
|
5
5
|
*
|
|
6
|
-
* The rule: only what moves casts a shadow.
|
|
6
|
+
* The rule: only what moves casts a shadow. The one exception is the seam, where a website's
|
|
7
|
+
* sections lie on each other as plates (Justin, 2026-11-16).
|
|
7
8
|
* Panel content and ground flat; rules and lines, no shadow
|
|
8
9
|
* Fitting what a hand presses depth-raised (+ -hover, depth-pressed)
|
|
9
10
|
* Plug a fitting seated in a socket depth-plug (a checked box)
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
* Card one object you act on depth-card
|
|
12
13
|
* Sheet what floats temporarily depth-floating, depth-overlay
|
|
13
14
|
* Bar the site's bar over the page depth-bar
|
|
15
|
+
* Seam where two sections of a site meet depth-seam (components/seam)
|
|
14
16
|
*
|
|
15
17
|
* One light, from above, tinted: edges and contact shadows come from Ink (19 18 28), ambient
|
|
16
18
|
* shadows from Ink mixed 30% toward Indigo (42 37 82), never neutral black.
|
|
@@ -141,6 +143,12 @@
|
|
|
141
143
|
--depth-bar-hi: rgb(255 255 255 / 0.7);
|
|
142
144
|
--depth-bar-near: rgb(19 18 28 / 0.05);
|
|
143
145
|
--depth-bar-far: rgb(42 37 82 / 0.1);
|
|
146
|
+
|
|
147
|
+
/* the seam between two sections: a quiet edge, a short shadow from the plate on top */
|
|
148
|
+
--depth-seam-edge: rgb(19 18 28 / 0.1);
|
|
149
|
+
--depth-seam-lo: rgb(19 18 28 / 0.035);
|
|
150
|
+
--depth-seam-contact: rgb(19 18 28 / 0.06);
|
|
151
|
+
--depth-seam-ambient: rgb(42 37 82 / 0.1);
|
|
144
152
|
}
|
|
145
153
|
|
|
146
154
|
.dark,
|
|
@@ -213,6 +221,11 @@
|
|
|
213
221
|
--depth-bar-hi: rgb(255 255 255 / 0.06);
|
|
214
222
|
--depth-bar-near: rgb(8 7 12 / 0.4);
|
|
215
223
|
--depth-bar-far: rgb(8 7 12 / 0.35);
|
|
224
|
+
|
|
225
|
+
--depth-seam-edge: rgb(8 7 12 / 0.7);
|
|
226
|
+
--depth-seam-lo: rgb(8 7 12 / 0.2);
|
|
227
|
+
--depth-seam-contact: rgb(8 7 12 / 0.5);
|
|
228
|
+
--depth-seam-ambient: rgb(8 7 12 / 0.35);
|
|
216
229
|
}
|
|
217
230
|
|
|
218
231
|
[data-theme="indigo"] {
|
|
@@ -288,6 +301,11 @@
|
|
|
288
301
|
--depth-bar-hi: rgb(255 255 255 / 0.1);
|
|
289
302
|
--depth-bar-near: rgb(19 18 28 / 0.14);
|
|
290
303
|
--depth-bar-far: rgb(19 18 28 / 0.2);
|
|
304
|
+
|
|
305
|
+
--depth-seam-edge: rgb(19 18 28 / 0.28);
|
|
306
|
+
--depth-seam-lo: rgb(19 18 28 / 0.1);
|
|
307
|
+
--depth-seam-contact: rgb(19 18 28 / 0.18);
|
|
308
|
+
--depth-seam-ambient: rgb(19 18 28 / 0.22);
|
|
291
309
|
}
|
|
292
310
|
|
|
293
311
|
@theme inline {
|
|
@@ -459,6 +477,11 @@
|
|
|
459
477
|
outline-offset: -1px;
|
|
460
478
|
}
|
|
461
479
|
}
|
|
480
|
+
/* The shadow a seam's upper plate throws: a filter, because the plate is a clipped shape. */
|
|
481
|
+
@utility depth-seam {
|
|
482
|
+
filter: drop-shadow(0 1px 1px var(--depth-seam-contact))
|
|
483
|
+
drop-shadow(0 4px 6px var(--depth-seam-ambient));
|
|
484
|
+
}
|
|
462
485
|
@utility depth-none {
|
|
463
486
|
@apply shadow-none inset-shadow-none;
|
|
464
487
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A box that scrolls (`ScrollFade`: a wide table, the side columns of a docs page) fades at the
|
|
3
|
+
* edges where more waits, as a code block's long lines (code.css) and a long row of tabs
|
|
4
|
+
* (tabs.css) do: what the edge cuts says that it goes on, instead of looking cut off.
|
|
5
|
+
* `useScrollEdges` sets `data-overflow` from the scroll position; the two lengths are
|
|
6
|
+
* registered so the mask moves on `settle`. A box that fits has no mask.
|
|
7
|
+
*
|
|
8
|
+
* The mask cuts everything the box paints, its outline too: a box that takes the keyboard
|
|
9
|
+
* focus has its outline drawn by a box around it (`Table`).
|
|
10
|
+
*/
|
|
11
|
+
@property --scroll-fade-start {
|
|
12
|
+
syntax: "<length>";
|
|
13
|
+
inherits: false;
|
|
14
|
+
initial-value: 0px;
|
|
15
|
+
}
|
|
16
|
+
@property --scroll-fade-end {
|
|
17
|
+
syntax: "<length>";
|
|
18
|
+
inherits: false;
|
|
19
|
+
initial-value: 0px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@layer components {
|
|
23
|
+
[data-scroll-fade] {
|
|
24
|
+
transition:
|
|
25
|
+
--scroll-fade-start var(--transition-duration-spring-settle) var(--ease-spring-settle),
|
|
26
|
+
--scroll-fade-end var(--transition-duration-spring-settle) var(--ease-spring-settle);
|
|
27
|
+
}
|
|
28
|
+
[data-scroll-fade="x"][data-overflow] {
|
|
29
|
+
mask-image: linear-gradient(
|
|
30
|
+
to right,
|
|
31
|
+
transparent,
|
|
32
|
+
#000 var(--scroll-fade-start),
|
|
33
|
+
#000 calc(100% - var(--scroll-fade-end)),
|
|
34
|
+
transparent
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
[data-scroll-fade="y"][data-overflow] {
|
|
38
|
+
mask-image: linear-gradient(
|
|
39
|
+
to bottom,
|
|
40
|
+
transparent,
|
|
41
|
+
#000 var(--scroll-fade-start),
|
|
42
|
+
#000 calc(100% - var(--scroll-fade-end)),
|
|
43
|
+
transparent
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
[data-scroll-fade][data-overflow~="start"] {
|
|
47
|
+
--scroll-fade-start: 2.5rem;
|
|
48
|
+
}
|
|
49
|
+
[data-scroll-fade][data-overflow~="end"] {
|
|
50
|
+
--scroll-fade-end: 2.5rem;
|
|
51
|
+
}
|
|
52
|
+
}
|
package/src/styles.css
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
@import "./styles/grounds.css";
|
|
16
16
|
@import "./styles/status.css";
|
|
17
17
|
@import "./styles/code.css";
|
|
18
|
+
@import "./styles/copy.css";
|
|
18
19
|
@import "./styles/type.css";
|
|
19
20
|
@import "./styles/radius.css";
|
|
20
21
|
@import "./styles/density.css";
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
@import "./styles/slider.css";
|
|
28
29
|
@import "./styles/segmented.css";
|
|
29
30
|
@import "./styles/tabs.css";
|
|
31
|
+
@import "./styles/scroll-fade.css";
|
|
30
32
|
@import "./styles/calendar.css";
|
|
31
33
|
@import "./styles/prose.css";
|
|
32
34
|
@import "./styles/base.css";
|