@orbitcommerce/constellation-docs 0.0.0-stage → 1.0.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/LICENSE.md +6 -0
- package/README.md +6 -2
- package/dist/docs.css +8260 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +308 -0
- package/dist/pages/Playground-CNbBbErC.js +129 -0
- package/dist/pages/_figures-data-BDmScEny.js +606 -0
- package/dist/pages/_foundations-blXWyYh8.js +30 -0
- package/dist/pages/_overlays-specimens-Dpn6oiyH.js +310 -0
- package/dist/pages/alert-BD4e6QTh.js +769 -0
- package/dist/pages/app-shell-KbA-nRqZ.js +1479 -0
- package/dist/pages/area-chart-B91dLcGo.js +562 -0
- package/dist/pages/avatar-DPPHXJAu.js +713 -0
- package/dist/pages/badge-C9JR0thI.js +729 -0
- package/dist/pages/button-D3V912P4.js +518 -0
- package/dist/pages/calendar-DSDZ9nRH.js +630 -0
- package/dist/pages/card-DUggbis3.js +659 -0
- package/dist/pages/checkbox-DwimQaK3.js +365 -0
- package/dist/pages/colour-BwuO8xAv.js +1498 -0
- package/dist/pages/command-palette-xAD7fOg6.js +1243 -0
- package/dist/pages/date-picker-BYSa816m.js +1421 -0
- package/dist/pages/delta-CtAo0eIM.js +574 -0
- package/dist/pages/dialog-BRAf4LMh.js +1451 -0
- package/dist/pages/docs-BNOb7AqR.js +515 -0
- package/dist/pages/empty-state-C-mLrXW2.js +417 -0
- package/dist/pages/figure-tabs-CoPFzzKz.js +460 -0
- package/dist/pages/home-dashboard-CFQwDtC9.js +959 -0
- package/dist/pages/host-B6znjEgQ.js +109 -0
- package/dist/pages/icon-button-C9eSVPPW.js +861 -0
- package/dist/pages/icons-sxkTs5Ob.js +473 -0
- package/dist/pages/input-KF9Gkawf.js +1093 -0
- package/dist/pages/installation-DpsX8G_n.js +445 -0
- package/dist/pages/kbd-cNfDoikz.js +544 -0
- package/dist/pages/live-globe-ClvLn9Lb.js +571 -0
- package/dist/pages/logo-BfGF1Pq9.js +571 -0
- package/dist/pages/menu-by2sgQ09.js +1618 -0
- package/dist/pages/motion-BvTGc2Dk.js +855 -0
- package/dist/pages/orbit-spinner-Dil1Z3Oy.js +332 -0
- package/dist/pages/overview-BPEbZQ6g.js +130 -0
- package/dist/pages/pagination-BBUnGvv5.js +249 -0
- package/dist/pages/popover-Db1gLDpb.js +1136 -0
- package/dist/pages/principles-CeAIOIdt.js +483 -0
- package/dist/pages/radio-group-CkdBWWfG.js +1077 -0
- package/dist/pages/registry-CroHzK9I.js +244 -0
- package/dist/pages/release-Dvo684UJ.js +13 -0
- package/dist/pages/rolling-number-qmvH84Mq.js +529 -0
- package/dist/pages/search-field-BN7MWGQ4.js +693 -0
- package/dist/pages/segmented-control-CTbIpRBW.js +777 -0
- package/dist/pages/select-DguELoRR.js +1429 -0
- package/dist/pages/separator-CPZub9pv.js +351 -0
- package/dist/pages/shape-DKvA0YKr.js +627 -0
- package/dist/pages/skeleton-DLuBhP46.js +561 -0
- package/dist/pages/sparkline-DMMYGbHn.js +668 -0
- package/dist/pages/switch-B-Qe4kcT.js +517 -0
- package/dist/pages/table-AMoODng4.js +607 -0
- package/dist/pages/tabs-B4M-usCV.js +1455 -0
- package/dist/pages/textarea-fTuUZRQb.js +693 -0
- package/dist/pages/toast-CKP03zjy.js +1176 -0
- package/dist/pages/tooltip-CBYil3kt.js +697 -0
- package/dist/pages/typography-PCbg8Bhg.js +735 -0
- package/manifest.json +3125 -0
- package/package.json +35 -4
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as useDocsHost, o as useDocumentTheme, s as useHydrated } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useMemo, useState } from "react";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Badge, IconButton, SegmentedControl, Skeleton, ThemeScope, Tooltip } from "@orbitcommerce/constellation";
|
|
6
|
+
import { CheckIcon, CodeIcon, CopySimpleIcon, MoonIcon, SunIcon, XIcon } from "@orbitcommerce/constellation/icons";
|
|
7
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
8
|
+
//#region src/site/highlight.ts
|
|
9
|
+
var highlighter = null;
|
|
10
|
+
function load() {
|
|
11
|
+
highlighter ??= (async () => {
|
|
12
|
+
const [{ createHighlighterCore, createCssVariablesTheme }, { createJavaScriptRegexEngine }] = await Promise.all([import("shiki/core"), import("shiki/engine/javascript")]);
|
|
13
|
+
return createHighlighterCore({
|
|
14
|
+
themes: [createCssVariablesTheme({
|
|
15
|
+
name: "orbit",
|
|
16
|
+
variablePrefix: "--code-",
|
|
17
|
+
fontStyle: true
|
|
18
|
+
})],
|
|
19
|
+
langs: [
|
|
20
|
+
import("shiki/langs/tsx.mjs"),
|
|
21
|
+
import("shiki/langs/css.mjs"),
|
|
22
|
+
import("shiki/langs/bash.mjs")
|
|
23
|
+
],
|
|
24
|
+
engine: createJavaScriptRegexEngine()
|
|
25
|
+
});
|
|
26
|
+
})();
|
|
27
|
+
return highlighter;
|
|
28
|
+
}
|
|
29
|
+
async function highlight(code, lang = "tsx") {
|
|
30
|
+
return (await load()).codeToHtml(code, {
|
|
31
|
+
lang,
|
|
32
|
+
theme: "orbit"
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/site/docs.tsx
|
|
37
|
+
var TocContext = createContext(null);
|
|
38
|
+
var DocsCollectorContext = createContext(null);
|
|
39
|
+
function DocPage({ title, lead, status, importNames, importFrom = "@orbitcommerce/constellation", children }) {
|
|
40
|
+
const { documentTitle } = useDocsHost();
|
|
41
|
+
useContext(DocsCollectorContext)?.page({
|
|
42
|
+
title,
|
|
43
|
+
lead,
|
|
44
|
+
status,
|
|
45
|
+
importNames
|
|
46
|
+
});
|
|
47
|
+
const [toc, setToc] = useState([]);
|
|
48
|
+
const register = useCallback((entry) => {
|
|
49
|
+
setToc((list) => list.some((e) => e.id === entry.id) ? list : [...list, entry]);
|
|
50
|
+
return () => setToc((list) => list.filter((e) => e.id !== entry.id));
|
|
51
|
+
}, []);
|
|
52
|
+
const ctx = useMemo(() => ({ register }), [register]);
|
|
53
|
+
const active = useScrollSpy(toc.map((t) => t.id));
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (documentTitle) document.title = title.includes("Constellation by Orbit Commerce") ? title : `${title} · Constellation by Orbit Commerce`;
|
|
56
|
+
}, [title, documentTitle]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const id = decodeURIComponent(window.location.hash.slice(1));
|
|
59
|
+
if (!id) return;
|
|
60
|
+
const frame = requestAnimationFrame(() => document.getElementById(id)?.scrollIntoView());
|
|
61
|
+
return () => cancelAnimationFrame(frame);
|
|
62
|
+
}, []);
|
|
63
|
+
return /* @__PURE__ */ jsx(TocContext.Provider, {
|
|
64
|
+
value: ctx,
|
|
65
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
66
|
+
className: "doc",
|
|
67
|
+
children: [/* @__PURE__ */ jsxs("article", {
|
|
68
|
+
className: "doc__main",
|
|
69
|
+
children: [/* @__PURE__ */ jsxs("header", {
|
|
70
|
+
className: "doc__header",
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: "doc__title-row",
|
|
74
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
75
|
+
className: "doc__title",
|
|
76
|
+
children: title
|
|
77
|
+
}), status ? /* @__PURE__ */ jsx(Badge, {
|
|
78
|
+
tone: status === "stable" ? "positive" : status === "beta" ? "warning" : "accent",
|
|
79
|
+
size: "sm",
|
|
80
|
+
children: status === "stable" ? "Stable" : status === "beta" ? "Beta" : "New"
|
|
81
|
+
}) : null]
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx("p", {
|
|
84
|
+
className: "doc__lead",
|
|
85
|
+
children: lead
|
|
86
|
+
}),
|
|
87
|
+
importNames?.length ? /* @__PURE__ */ jsx(ImportLine, { code: `import { ${importNames.join(", ")} } from '${importFrom}'` }) : null
|
|
88
|
+
]
|
|
89
|
+
}), children]
|
|
90
|
+
}), toc.length > 1 ? /* @__PURE__ */ jsx(Toc, {
|
|
91
|
+
entries: toc,
|
|
92
|
+
active
|
|
93
|
+
}) : null]
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/** On this page: the sections, with a satellite mark gliding along the line to the one in view. */
|
|
98
|
+
function Toc({ entries, active }) {
|
|
99
|
+
const reduce = useReducedMotion();
|
|
100
|
+
return /* @__PURE__ */ jsxs("nav", {
|
|
101
|
+
className: "doc__toc",
|
|
102
|
+
"aria-label": "On this page",
|
|
103
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
104
|
+
className: "doc__toc-title",
|
|
105
|
+
children: "On this page"
|
|
106
|
+
}), /* @__PURE__ */ jsx("ul", { children: entries.map((entry) => /* @__PURE__ */ jsxs("li", { children: [active === entry.id ? /* @__PURE__ */ jsx(motion.span, {
|
|
107
|
+
layoutId: "doc-toc-mark",
|
|
108
|
+
className: "doc__toc-mark",
|
|
109
|
+
transition: reduce ? { duration: 0 } : {
|
|
110
|
+
type: "spring",
|
|
111
|
+
stiffness: 520,
|
|
112
|
+
damping: 38
|
|
113
|
+
},
|
|
114
|
+
"aria-hidden": "true"
|
|
115
|
+
}) : null, /* @__PURE__ */ jsx("a", {
|
|
116
|
+
href: `#${entry.id}`,
|
|
117
|
+
"aria-current": active === entry.id ? "location" : void 0,
|
|
118
|
+
children: entry.title
|
|
119
|
+
})] }, entry.id)) })]
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function useScrollSpy(ids) {
|
|
123
|
+
const [active, setActive] = useState(null);
|
|
124
|
+
const key = ids.join("|");
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (!ids.length) return;
|
|
127
|
+
const seen = /* @__PURE__ */ new Map();
|
|
128
|
+
const observer = new IntersectionObserver((entries) => {
|
|
129
|
+
entries.forEach((e) => seen.set(e.target.id, e.isIntersecting));
|
|
130
|
+
const first = ids.find((id) => seen.get(id));
|
|
131
|
+
if (first) setActive(first);
|
|
132
|
+
}, { rootMargin: "-80px 0px -60% 0px" });
|
|
133
|
+
ids.forEach((id) => {
|
|
134
|
+
const el = document.getElementById(id);
|
|
135
|
+
if (el) observer.observe(el);
|
|
136
|
+
});
|
|
137
|
+
return () => observer.disconnect();
|
|
138
|
+
}, [key]);
|
|
139
|
+
return active;
|
|
140
|
+
}
|
|
141
|
+
/** A titled part of a page; appears in "On this page". */
|
|
142
|
+
function Section({ id, title, description, children }) {
|
|
143
|
+
useContext(DocsCollectorContext)?.section({
|
|
144
|
+
id,
|
|
145
|
+
title,
|
|
146
|
+
description
|
|
147
|
+
});
|
|
148
|
+
const toc = useContext(TocContext);
|
|
149
|
+
useEffect(() => toc?.register({
|
|
150
|
+
id,
|
|
151
|
+
title
|
|
152
|
+
}), [
|
|
153
|
+
toc,
|
|
154
|
+
id,
|
|
155
|
+
title
|
|
156
|
+
]);
|
|
157
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
158
|
+
className: "doc-section",
|
|
159
|
+
id,
|
|
160
|
+
"aria-labelledby": `${id}-title`,
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsx("h2", {
|
|
163
|
+
className: "doc-section__title",
|
|
164
|
+
id: `${id}-title`,
|
|
165
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
166
|
+
href: `#${id}`,
|
|
167
|
+
children: title
|
|
168
|
+
})
|
|
169
|
+
}),
|
|
170
|
+
description ? /* @__PURE__ */ jsx("div", {
|
|
171
|
+
className: "doc-section__description",
|
|
172
|
+
children: description
|
|
173
|
+
}) : null,
|
|
174
|
+
children
|
|
175
|
+
]
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/** A smaller heading inside a section, e.g. one variant. Not in the table of contents. */
|
|
179
|
+
function SubSection({ title, description, children }) {
|
|
180
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
181
|
+
className: "doc-sub",
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ jsx("h3", {
|
|
184
|
+
className: "doc-sub__title",
|
|
185
|
+
children: title
|
|
186
|
+
}),
|
|
187
|
+
description ? /* @__PURE__ */ jsx("div", {
|
|
188
|
+
className: "doc-sub__description",
|
|
189
|
+
children: description
|
|
190
|
+
}) : null,
|
|
191
|
+
children
|
|
192
|
+
]
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function useCopy() {
|
|
196
|
+
const [copied, setCopied] = useState(false);
|
|
197
|
+
const copy = (text) => {
|
|
198
|
+
navigator.clipboard?.writeText(text);
|
|
199
|
+
setCopied(true);
|
|
200
|
+
window.setTimeout(() => setCopied(false), 1400);
|
|
201
|
+
};
|
|
202
|
+
return {
|
|
203
|
+
copied,
|
|
204
|
+
copy
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function CodeBlock({ code, lang = "tsx", label }) {
|
|
208
|
+
const [html, setHtml] = useState(null);
|
|
209
|
+
const { copied, copy } = useCopy();
|
|
210
|
+
const trimmed = code.replace(/^\n+|\n+\s*$/g, "");
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
let live = true;
|
|
213
|
+
highlight(trimmed, lang).then((h) => live && setHtml(h));
|
|
214
|
+
return () => {
|
|
215
|
+
live = false;
|
|
216
|
+
};
|
|
217
|
+
}, [trimmed, lang]);
|
|
218
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
219
|
+
className: "doc-code",
|
|
220
|
+
children: [
|
|
221
|
+
label ? /* @__PURE__ */ jsx("div", {
|
|
222
|
+
className: "doc-code__label",
|
|
223
|
+
children: label
|
|
224
|
+
}) : null,
|
|
225
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
226
|
+
content: copied ? "Copied" : "Copy code",
|
|
227
|
+
side: "left",
|
|
228
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
229
|
+
label: "Copy code",
|
|
230
|
+
size: "sm",
|
|
231
|
+
className: "doc-code__copy",
|
|
232
|
+
onClick: () => copy(trimmed),
|
|
233
|
+
children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopySimpleIcon, {})
|
|
234
|
+
})
|
|
235
|
+
}),
|
|
236
|
+
html ? /* @__PURE__ */ jsx("div", {
|
|
237
|
+
className: "doc-code__body",
|
|
238
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
239
|
+
}) : /* @__PURE__ */ jsx("pre", {
|
|
240
|
+
className: "doc-code__body doc-code__plain",
|
|
241
|
+
children: /* @__PURE__ */ jsx("code", { children: trimmed })
|
|
242
|
+
})
|
|
243
|
+
]
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function ImportLine({ code }) {
|
|
247
|
+
const { copied, copy } = useCopy();
|
|
248
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
249
|
+
type: "button",
|
|
250
|
+
className: "doc-import",
|
|
251
|
+
onClick: () => copy(code),
|
|
252
|
+
"aria-label": `Copy: ${code}`,
|
|
253
|
+
children: [/* @__PURE__ */ jsx("code", { children: code }), /* @__PURE__ */ jsx("span", {
|
|
254
|
+
className: "doc-import__icon",
|
|
255
|
+
"aria-hidden": "true",
|
|
256
|
+
children: copied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopySimpleIcon, {})
|
|
257
|
+
})]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* A stage follows the page's theme until its own light/dark switch picks one. While it follows,
|
|
262
|
+
* it sets no theme of its own, so the server's HTML is right for every visitor before hydration.
|
|
263
|
+
*/
|
|
264
|
+
function useStageTheme() {
|
|
265
|
+
const pageTheme = useDocumentTheme();
|
|
266
|
+
const [override, setOverride] = useState(null);
|
|
267
|
+
return {
|
|
268
|
+
theme: override ?? pageTheme,
|
|
269
|
+
override,
|
|
270
|
+
choose: (next) => setOverride(next === pageTheme ? null : next)
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
/** A ThemeScope once a stage has picked a theme; until then a plain wrapper that inherits the page's. */
|
|
274
|
+
var StageScope = forwardRef(function StageScope({ theme, className, ...rest }, ref) {
|
|
275
|
+
if (theme) return /* @__PURE__ */ jsx(ThemeScope, {
|
|
276
|
+
ref,
|
|
277
|
+
theme,
|
|
278
|
+
className,
|
|
279
|
+
...rest
|
|
280
|
+
});
|
|
281
|
+
return /* @__PURE__ */ jsx("div", {
|
|
282
|
+
ref,
|
|
283
|
+
className: className ? `o-theme-scope ${className}` : "o-theme-scope",
|
|
284
|
+
...rest
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
/** Renders its children in the browser only, with a quiet placeholder until then. See Example's `clientOnly`. */
|
|
288
|
+
function ClientOnly({ children, fallback, height = 120 }) {
|
|
289
|
+
if (useHydrated()) return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
290
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: fallback ?? /* @__PURE__ */ jsx(Skeleton, {
|
|
291
|
+
className: "doc-client-only",
|
|
292
|
+
height,
|
|
293
|
+
radius: "lg"
|
|
294
|
+
}) });
|
|
295
|
+
}
|
|
296
|
+
var THEME_OPTIONS = [{
|
|
297
|
+
value: "light",
|
|
298
|
+
icon: /* @__PURE__ */ jsx(SunIcon, {}),
|
|
299
|
+
label: "Light",
|
|
300
|
+
iconOnly: true
|
|
301
|
+
}, {
|
|
302
|
+
value: "dark",
|
|
303
|
+
icon: /* @__PURE__ */ jsx(MoonIcon, {}),
|
|
304
|
+
label: "Dark",
|
|
305
|
+
iconOnly: true
|
|
306
|
+
}];
|
|
307
|
+
/**
|
|
308
|
+
* A live preview on a stage, plus the code that makes it. The stage follows the site theme until
|
|
309
|
+
* its own light/dark switch is used, so one example can be checked in both without leaving the page.
|
|
310
|
+
*/
|
|
311
|
+
function Example({ children, code, lang = "tsx", codeOpen = false, align = "center", minHeight, surface = "canvas", caption, clientOnly }) {
|
|
312
|
+
const stage = useStageTheme();
|
|
313
|
+
const [showCode, setShowCode] = useState(codeOpen);
|
|
314
|
+
const codeId = useId();
|
|
315
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
316
|
+
className: "doc-example",
|
|
317
|
+
"data-code-open": code && showCode ? "" : void 0,
|
|
318
|
+
children: [
|
|
319
|
+
/* @__PURE__ */ jsxs(StageScope, {
|
|
320
|
+
theme: stage.override,
|
|
321
|
+
className: "doc-example__frame",
|
|
322
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
323
|
+
className: "doc-example__toolbar",
|
|
324
|
+
children: [/* @__PURE__ */ jsx(SegmentedControl, {
|
|
325
|
+
"aria-label": "Preview theme",
|
|
326
|
+
size: "sm",
|
|
327
|
+
value: stage.theme,
|
|
328
|
+
onValueChange: stage.choose,
|
|
329
|
+
options: THEME_OPTIONS
|
|
330
|
+
}), code ? /* @__PURE__ */ jsx(Tooltip, {
|
|
331
|
+
content: showCode ? "Hide code" : "Show code",
|
|
332
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
333
|
+
label: showCode ? "Hide code" : "Show code",
|
|
334
|
+
size: "sm",
|
|
335
|
+
variant: showCode ? "soft" : "ghost",
|
|
336
|
+
"aria-expanded": showCode,
|
|
337
|
+
"aria-controls": codeId,
|
|
338
|
+
onClick: () => setShowCode((v) => !v),
|
|
339
|
+
children: /* @__PURE__ */ jsx(CodeIcon, {})
|
|
340
|
+
})
|
|
341
|
+
}) : null]
|
|
342
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
343
|
+
className: "doc-example__stage",
|
|
344
|
+
"data-align": align,
|
|
345
|
+
"data-surface": surface,
|
|
346
|
+
style: minHeight ? { minHeight } : void 0,
|
|
347
|
+
children: clientOnly ? /* @__PURE__ */ jsx(ClientOnly, {
|
|
348
|
+
height: minHeight ? Math.max(120, minHeight - 64) : void 0,
|
|
349
|
+
children
|
|
350
|
+
}) : children
|
|
351
|
+
})]
|
|
352
|
+
}),
|
|
353
|
+
code && showCode ? /* @__PURE__ */ jsx("div", {
|
|
354
|
+
id: codeId,
|
|
355
|
+
children: /* @__PURE__ */ jsx(CodeBlock, {
|
|
356
|
+
code,
|
|
357
|
+
lang
|
|
358
|
+
})
|
|
359
|
+
}) : null,
|
|
360
|
+
caption ? /* @__PURE__ */ jsx("figcaption", {
|
|
361
|
+
className: "doc-example__caption",
|
|
362
|
+
children: caption
|
|
363
|
+
}) : null
|
|
364
|
+
]
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* The same render in light and dark, side by side: for judging a design at a glance. Children
|
|
369
|
+
* render twice, so each side keeps its own state.
|
|
370
|
+
*/
|
|
371
|
+
function ThemePair({ children, minHeight, align = "center", caption, clientOnly }) {
|
|
372
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
373
|
+
className: "doc-pair",
|
|
374
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
375
|
+
className: "doc-pair__stages",
|
|
376
|
+
children: ["light", "dark"].map((t) => /* @__PURE__ */ jsxs(ThemeScope, {
|
|
377
|
+
theme: t,
|
|
378
|
+
className: "doc-pair__stage",
|
|
379
|
+
"data-align": align,
|
|
380
|
+
style: minHeight ? { minHeight } : void 0,
|
|
381
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
382
|
+
className: "doc-pair__label",
|
|
383
|
+
children: t === "light" ? "Light" : "Dark"
|
|
384
|
+
}), clientOnly ? /* @__PURE__ */ jsx(ClientOnly, { children }) : children]
|
|
385
|
+
}, t))
|
|
386
|
+
}), caption ? /* @__PURE__ */ jsx("figcaption", {
|
|
387
|
+
className: "doc-example__caption",
|
|
388
|
+
children: caption
|
|
389
|
+
}) : null]
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
function PropsTable({ rows, title }) {
|
|
393
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
394
|
+
className: "doc-props",
|
|
395
|
+
children: [title ? /* @__PURE__ */ jsx("h3", {
|
|
396
|
+
className: "doc-sub__title",
|
|
397
|
+
children: title
|
|
398
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
399
|
+
className: "doc-props__scroll",
|
|
400
|
+
children: /* @__PURE__ */ jsxs("table", { children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
401
|
+
/* @__PURE__ */ jsx("th", {
|
|
402
|
+
scope: "col",
|
|
403
|
+
children: "Prop"
|
|
404
|
+
}),
|
|
405
|
+
/* @__PURE__ */ jsx("th", {
|
|
406
|
+
scope: "col",
|
|
407
|
+
children: "Type"
|
|
408
|
+
}),
|
|
409
|
+
/* @__PURE__ */ jsx("th", {
|
|
410
|
+
scope: "col",
|
|
411
|
+
children: "Default"
|
|
412
|
+
}),
|
|
413
|
+
/* @__PURE__ */ jsx("th", {
|
|
414
|
+
scope: "col",
|
|
415
|
+
children: "Description"
|
|
416
|
+
})
|
|
417
|
+
] }) }), /* @__PURE__ */ jsx("tbody", { children: rows.map((row) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
418
|
+
/* @__PURE__ */ jsxs("td", { children: [/* @__PURE__ */ jsx("code", {
|
|
419
|
+
className: "doc-props__name",
|
|
420
|
+
children: row.name
|
|
421
|
+
}), row.required ? /* @__PURE__ */ jsx("span", {
|
|
422
|
+
className: "doc-props__required",
|
|
423
|
+
children: "Required"
|
|
424
|
+
}) : null] }),
|
|
425
|
+
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("code", {
|
|
426
|
+
className: "doc-props__type",
|
|
427
|
+
children: row.type
|
|
428
|
+
}) }),
|
|
429
|
+
/* @__PURE__ */ jsx("td", { children: row.default ? /* @__PURE__ */ jsx("code", {
|
|
430
|
+
className: "doc-props__default",
|
|
431
|
+
children: row.default
|
|
432
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
433
|
+
className: "doc-props__none",
|
|
434
|
+
children: "None"
|
|
435
|
+
}) }),
|
|
436
|
+
/* @__PURE__ */ jsx("td", {
|
|
437
|
+
className: "doc-props__description",
|
|
438
|
+
children: row.description
|
|
439
|
+
})
|
|
440
|
+
] }, row.name)) })] })
|
|
441
|
+
})]
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
/** A plain reference table: a header row, then rows of cells. For options, tokens, sizes and the like. */
|
|
445
|
+
function DocTable({ columns, rows }) {
|
|
446
|
+
return /* @__PURE__ */ jsx("div", {
|
|
447
|
+
className: "doc-props doc-table",
|
|
448
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
449
|
+
className: "doc-props__scroll",
|
|
450
|
+
children: /* @__PURE__ */ jsxs("table", { children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((column, i) => /* @__PURE__ */ jsx("th", {
|
|
451
|
+
scope: "col",
|
|
452
|
+
children: column
|
|
453
|
+
}, i)) }) }), /* @__PURE__ */ jsx("tbody", { children: rows.map((row, i) => /* @__PURE__ */ jsx("tr", { children: row.map((cell, j) => /* @__PURE__ */ jsx("td", { children: cell }, j)) }, i)) })] })
|
|
454
|
+
})
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
/** A pair of small previews: the right way and the wrong way, each with one line of why. */
|
|
458
|
+
function DoDont({ do: good, dont: bad, clientOnly }) {
|
|
459
|
+
const stage = (children) => clientOnly ? /* @__PURE__ */ jsx(ClientOnly, { children }) : children;
|
|
460
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
461
|
+
className: "doc-dodont",
|
|
462
|
+
children: [/* @__PURE__ */ jsxs("figure", {
|
|
463
|
+
className: "doc-dodont__item",
|
|
464
|
+
"data-kind": "do",
|
|
465
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
466
|
+
className: "doc-dodont__stage",
|
|
467
|
+
children: stage(good.children)
|
|
468
|
+
}), /* @__PURE__ */ jsxs("figcaption", {
|
|
469
|
+
className: "doc-dodont__caption",
|
|
470
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
471
|
+
className: "doc-dodont__label",
|
|
472
|
+
children: [/* @__PURE__ */ jsx(CheckIcon, {
|
|
473
|
+
weight: "bold",
|
|
474
|
+
"aria-hidden": "true"
|
|
475
|
+
}), "Do"]
|
|
476
|
+
}), good.caption]
|
|
477
|
+
})]
|
|
478
|
+
}), /* @__PURE__ */ jsxs("figure", {
|
|
479
|
+
className: "doc-dodont__item",
|
|
480
|
+
"data-kind": "dont",
|
|
481
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
482
|
+
className: "doc-dodont__stage",
|
|
483
|
+
children: stage(bad.children)
|
|
484
|
+
}), /* @__PURE__ */ jsxs("figcaption", {
|
|
485
|
+
className: "doc-dodont__caption",
|
|
486
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
487
|
+
className: "doc-dodont__label",
|
|
488
|
+
children: [/* @__PURE__ */ jsx(XIcon, {
|
|
489
|
+
weight: "bold",
|
|
490
|
+
"aria-hidden": "true"
|
|
491
|
+
}), "Don't"]
|
|
492
|
+
}), bad.caption]
|
|
493
|
+
})]
|
|
494
|
+
})]
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
/** Plain guidance bullets under a section. */
|
|
498
|
+
function Guidelines({ items }) {
|
|
499
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
500
|
+
className: "doc-guidelines",
|
|
501
|
+
children: items.map((item, i) => /* @__PURE__ */ jsx("li", { children: item }, i))
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
/** A quiet aside for a caveat or tip. No coloured side stripe: a tinted surface and a label. */
|
|
505
|
+
function Note({ title = "Note", children }) {
|
|
506
|
+
return /* @__PURE__ */ jsxs("aside", {
|
|
507
|
+
className: "doc-note",
|
|
508
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
509
|
+
className: "doc-note__title",
|
|
510
|
+
children: title
|
|
511
|
+
}), /* @__PURE__ */ jsx("div", { children })]
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
//#endregion
|
|
515
|
+
export { DocTable as a, ImportLine as c, Section as d, StageScope as f, useStageTheme as h, DocPage as i, Note as l, ThemePair as m, CodeBlock as n, Example as o, SubSection as p, DoDont as r, Guidelines as s, ClientOnly as t, PropsTable as u };
|