@orbitcommerce/constellation-docs 0.0.0-stage → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +6 -0
- package/README.md +6 -2
- package/dist/docs.css +20787 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +308 -0
- package/dist/pages/Playground-Mk1yIWXb.js +129 -0
- package/dist/pages/_address-data-L9BR499w.js +161 -0
- package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
- package/dist/pages/_card-art-0be5ncyV.js +18 -0
- package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
- package/dist/pages/_figures-data-DaDvB7Nm.js +606 -0
- package/dist/pages/_foundations-blXWyYh8.js +30 -0
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/_overlays-specimens-bawR331Z.js +320 -0
- package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
- package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
- package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
- package/dist/pages/address-block-BZOOOPA9.js +368 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/alert-D3i7xZTU.js +914 -0
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/app-shell-D4hdlHps.js +1558 -0
- package/dist/pages/area-chart-BEWFwiB2.js +718 -0
- package/dist/pages/avatar-BFEqQViw.js +895 -0
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/badge-0-PyMrih.js +1035 -0
- package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
- package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
- package/dist/pages/board-card-D2tZY_mU.js +415 -0
- package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
- package/dist/pages/button-DAyfssDY.js +715 -0
- package/dist/pages/calendar-Ds7KsgSI.js +682 -0
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CQEM1_wc.js +1567 -0
- package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
- package/dist/pages/chart-legend-B20AbakD.js +724 -0
- package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
- package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
- package/dist/pages/checklist-card-DEyykVFS.js +783 -0
- package/dist/pages/chip-Ck-o3Ui6.js +839 -0
- package/dist/pages/chip-list-k1LxXuCi.js +414 -0
- package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
- package/dist/pages/coachmark-Be2ghobT.js +366 -0
- package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
- package/dist/pages/collab-field-CfqqK7d2.js +696 -0
- package/dist/pages/color-field-CZpfcA-A.js +1127 -0
- package/dist/pages/colour-q2ntvI0w.js +1974 -0
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/command-palette-CJ7uBA04.js +1386 -0
- package/dist/pages/comment-box-CDSGYhr5.js +346 -0
- package/dist/pages/composer-D4B0NgpA.js +689 -0
- package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
- package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
- package/dist/pages/context-menu-F9DV30ia.js +487 -0
- package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
- package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
- package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
- package/dist/pages/date-input-GOW067EB.js +956 -0
- package/dist/pages/date-picker-GdBciR99.js +1569 -0
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/delta-CNAGv8JY.js +779 -0
- package/dist/pages/description-list-BPeXn1eW.js +1268 -0
- package/dist/pages/device-switcher-BCaN99c1.js +554 -0
- package/dist/pages/dialog-CRpkRC98.js +3164 -0
- package/dist/pages/docs-lM2UBSir.js +520 -0
- package/dist/pages/doodle-nzkqi2UI.js +201 -0
- package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
- package/dist/pages/drill-menu-cskH5mol.js +490 -0
- package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
- package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
- package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
- package/dist/pages/empty-state-4U2txFpI.js +1113 -0
- package/dist/pages/facet-filters-McbBeY9e.js +353 -0
- package/dist/pages/figure-D-HF5vCj.js +563 -0
- package/dist/pages/figure-strip-BB3mNl7D.js +1364 -0
- package/dist/pages/figure-tabs-QOeQMY6N.js +578 -0
- package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
- package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
- package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
- package/dist/pages/form-grid-BfWCVlie.js +692 -0
- package/dist/pages/gallery-BBk2EOri.js +453 -0
- package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
- package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
- package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
- package/dist/pages/heatmap-BohgIcNk.js +507 -0
- package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
- package/dist/pages/home-dashboard-CxPmvduE.js +962 -0
- package/dist/pages/host-B6znjEgQ.js +109 -0
- package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
- package/dist/pages/hosted-field-BLh-53AE.js +208 -0
- package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
- package/dist/pages/icon-button-Bu4Gj5sy.js +1200 -0
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/icons-CJ9Aar3d.js +736 -0
- package/dist/pages/image-cropper-NyougqLH.js +466 -0
- package/dist/pages/image-field-7knBv4mJ.js +567 -0
- package/dist/pages/import-result-CmTtGXW_.js +486 -0
- package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
- package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
- package/dist/pages/input-CzLCzfyx.js +2372 -0
- package/dist/pages/installation-C3UcpQJT.js +528 -0
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/kbd-UNj4zqxn.js +545 -0
- package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
- package/dist/pages/line-chart-CntWxeMF.js +1117 -0
- package/dist/pages/link-CXqvAg9z.js +689 -0
- package/dist/pages/link-picker-BMFGCC67.js +478 -0
- package/dist/pages/link-row-x8yaUuWc.js +595 -0
- package/dist/pages/live-globe-95ROMhGQ.js +715 -0
- package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
- package/dist/pages/loading-state-BNbCo51C.js +556 -0
- package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
- package/dist/pages/logo-B38rnzoq.js +571 -0
- package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
- package/dist/pages/markdown-Ied72vMT.js +237 -0
- package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
- package/dist/pages/media-banner-DkStCia0.js +233 -0
- package/dist/pages/menu-NrLYKqKp.js +2132 -0
- package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
- package/dist/pages/meta-line-D5p2TycR.js +371 -0
- package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
- package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
- package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
- package/dist/pages/motion-CrXtiBvA.js +865 -0
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/orbit-spinner-Dxv5qAhr.js +348 -0
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/overview-LA9XRhZc.js +130 -0
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/pagination-C1EgVtW4.js +294 -0
- package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
- package/dist/pages/password-field-DHEQKyUC.js +912 -0
- package/dist/pages/person-cell-BmjbADBz.js +564 -0
- package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
- package/dist/pages/plan-card-DRaA6RuB.js +621 -0
- package/dist/pages/plan-card-DtloWvMh.js +258 -0
- package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
- package/dist/pages/plan-grid-cfPVTB5V.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/popover-C3Oar9D5.js +1198 -0
- package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
- package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
- package/dist/pages/price-CRBLoa9h.js +604 -0
- package/dist/pages/principles-pnDyfHpK.js +483 -0
- package/dist/pages/print-page-BkLv6bW8.js +513 -0
- package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
- package/dist/pages/progress-CP_awmo4.js +904 -0
- package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
- package/dist/pages/radio-group-C-4tg6FS.js +1639 -0
- package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
- package/dist/pages/rating-CweKN2SX.js +471 -0
- package/dist/pages/record-layout-DUP_X0RL.js +719 -0
- package/dist/pages/record-pager-y9D7JFgb.js +278 -0
- package/dist/pages/registry-BZg-xAbi.js +594 -0
- package/dist/pages/release-Cs6tl16C.js +16 -0
- package/dist/pages/repeater-BRZYKRQa.js +1351 -0
- package/dist/pages/reply-feedback-BDnHprla.js +192 -0
- package/dist/pages/reveal-BygENBbL.js +460 -0
- package/dist/pages/rich-text-DOFQZEpT.js +156 -0
- package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
- package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
- package/dist/pages/rolling-number-GR3Cyfpz.js +529 -0
- package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
- package/dist/pages/rule-list-DTCmIMpT.js +648 -0
- package/dist/pages/save-status-B5KkyMZP.js +378 -0
- package/dist/pages/schedule-YycI95O1.js +243 -0
- package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
- package/dist/pages/search-field-D1uG7R6A.js +693 -0
- package/dist/pages/search-menu-DMuXyUUW.js +580 -0
- package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
- package/dist/pages/section-rail-BtTCETS5.js +637 -0
- package/dist/pages/section-v2Pubup9.js +639 -0
- package/dist/pages/segmented-control-D-FB1K1T.js +1190 -0
- package/dist/pages/select-DZ43NpOm.js +1434 -0
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/separator-CFwqRvfO.js +428 -0
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/shape-DzniHAVT.js +627 -0
- package/dist/pages/share-list-D4wgBxKN.js +926 -0
- package/dist/pages/side-panel-CCtkrZjs.js +811 -0
- package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
- package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
- package/dist/pages/skip-link-BxznhSkz.js +252 -0
- package/dist/pages/slider-CAoPURKD.js +774 -0
- package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
- package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
- package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
- package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
- package/dist/pages/sparkline-D3aavCly.js +947 -0
- package/dist/pages/split-bar-DYgZnFID.js +414 -0
- package/dist/pages/split-button-Be08-VI-.js +335 -0
- package/dist/pages/split-pane-lSNZgTKt.js +523 -0
- package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
- package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
- package/dist/pages/status-dot-D99gAGsV.js +567 -0
- package/dist/pages/stepper-CxKTbEA-.js +1093 -0
- package/dist/pages/success-mark-CqFTOBEu.js +142 -0
- package/dist/pages/swatch-H_kNvHuC.js +565 -0
- package/dist/pages/switch-C93K6j9h.js +617 -0
- package/dist/pages/table-CL0vomno.js +3225 -0
- package/dist/pages/tabs-Dh0mUsLw.js +1690 -0
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/textarea-CCM-SnGN.js +949 -0
- package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
- package/dist/pages/time-input-CA9-uZAa.js +442 -0
- package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
- package/dist/pages/timeline-BsMUTlpR.js +1798 -0
- package/dist/pages/toast-zXLRiMRT.js +1391 -0
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/tooltip-LHtCUkF-.js +826 -0
- package/dist/pages/translation-field-CTRXiF2N.js +251 -0
- package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
- package/dist/pages/tree-select-DU1qXHy_.js +492 -0
- package/dist/pages/tree-view-g_RjLtAb.js +739 -0
- package/dist/pages/typography-BSijtiRl.js +876 -0
- package/dist/pages/unit-input-Dml4fjmK.js +659 -0
- package/dist/pages/upload-rules-yozEzSah.js +419 -0
- package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
- package/dist/pages/value-change-CnubDKyO.js +489 -0
- package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
- package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
- package/dist/pages/working-status-CENemSsw.js +389 -0
- package/manifest.json +13001 -0
- package/package.json +35 -4
|
@@ -0,0 +1,520 @@
|
|
|
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, useThemeScope } 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$1({ 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$1({ 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
|
+
/**
|
|
274
|
+
* A ThemeScope that sets a theme once the stage has picked one; until then it sets none and inherits the page's (no
|
|
275
|
+
* `data-o-theme`, and no theme for the menus and popovers opened in it). Always the same element, so a stage's own theme
|
|
276
|
+
* switch restyles it rather than remounting it: an example keeps its state (an open menu, a typed value) across the switch.
|
|
277
|
+
*/
|
|
278
|
+
var StageScope = forwardRef(function StageScope({ theme, ...rest }, ref) {
|
|
279
|
+
const around = useThemeScope();
|
|
280
|
+
return /* @__PURE__ */ jsx(ThemeScope, {
|
|
281
|
+
ref,
|
|
282
|
+
theme: theme ?? around,
|
|
283
|
+
...rest
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
/** Renders its children in the browser only, with a quiet placeholder until then. See Example's `clientOnly`. */
|
|
287
|
+
function ClientOnly({ children, fallback, height = 120 }) {
|
|
288
|
+
if (useHydrated()) return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
289
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: fallback ?? /* @__PURE__ */ jsx(Skeleton, {
|
|
290
|
+
className: "doc-client-only",
|
|
291
|
+
height,
|
|
292
|
+
radius: "lg"
|
|
293
|
+
}) });
|
|
294
|
+
}
|
|
295
|
+
var THEME_OPTIONS = [{
|
|
296
|
+
value: "light",
|
|
297
|
+
icon: /* @__PURE__ */ jsx(SunIcon, {}),
|
|
298
|
+
label: "Light",
|
|
299
|
+
iconOnly: true
|
|
300
|
+
}, {
|
|
301
|
+
value: "dark",
|
|
302
|
+
icon: /* @__PURE__ */ jsx(MoonIcon, {}),
|
|
303
|
+
label: "Dark",
|
|
304
|
+
iconOnly: true
|
|
305
|
+
}];
|
|
306
|
+
/**
|
|
307
|
+
* A live preview on a stage, plus the code that makes it. The stage follows the site theme until
|
|
308
|
+
* its own light/dark switch is used, so one example can be checked in both without leaving the page.
|
|
309
|
+
*/
|
|
310
|
+
function Example({ children, code, lang = "tsx", codeOpen = false, align = "center", minHeight, surface = "canvas", caption, clientOnly }) {
|
|
311
|
+
const stage = useStageTheme();
|
|
312
|
+
const [showCode, setShowCode] = useState(codeOpen);
|
|
313
|
+
const codeId = useId();
|
|
314
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
315
|
+
className: "doc-example",
|
|
316
|
+
"data-code-open": code && showCode ? "" : void 0,
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ jsxs(StageScope, {
|
|
319
|
+
theme: stage.override,
|
|
320
|
+
className: "doc-example__frame",
|
|
321
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
322
|
+
className: "doc-example__toolbar",
|
|
323
|
+
children: [/* @__PURE__ */ jsx(SegmentedControl, {
|
|
324
|
+
"aria-label": "Preview theme",
|
|
325
|
+
size: "sm",
|
|
326
|
+
value: stage.theme,
|
|
327
|
+
onValueChange: stage.choose,
|
|
328
|
+
options: THEME_OPTIONS
|
|
329
|
+
}), code ? /* @__PURE__ */ jsx(Tooltip, {
|
|
330
|
+
content: showCode ? "Hide code" : "Show code",
|
|
331
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
332
|
+
label: showCode ? "Hide code" : "Show code",
|
|
333
|
+
size: "sm",
|
|
334
|
+
variant: showCode ? "soft" : "ghost",
|
|
335
|
+
"aria-expanded": showCode,
|
|
336
|
+
"aria-controls": codeId,
|
|
337
|
+
onClick: () => setShowCode((v) => !v),
|
|
338
|
+
children: /* @__PURE__ */ jsx(CodeIcon, {})
|
|
339
|
+
})
|
|
340
|
+
}) : null]
|
|
341
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
342
|
+
className: "doc-example__stage",
|
|
343
|
+
"data-align": align,
|
|
344
|
+
"data-surface": surface,
|
|
345
|
+
style: minHeight ? { minHeight } : void 0,
|
|
346
|
+
children: clientOnly ? /* @__PURE__ */ jsx(ClientOnly, {
|
|
347
|
+
height: minHeight ? Math.max(120, minHeight - 64) : void 0,
|
|
348
|
+
children
|
|
349
|
+
}) : children
|
|
350
|
+
})]
|
|
351
|
+
}),
|
|
352
|
+
code && showCode ? /* @__PURE__ */ jsx("div", {
|
|
353
|
+
id: codeId,
|
|
354
|
+
children: /* @__PURE__ */ jsx(CodeBlock$1, {
|
|
355
|
+
code,
|
|
356
|
+
lang
|
|
357
|
+
})
|
|
358
|
+
}) : null,
|
|
359
|
+
caption ? /* @__PURE__ */ jsx("figcaption", {
|
|
360
|
+
className: "doc-example__caption",
|
|
361
|
+
children: caption
|
|
362
|
+
}) : null
|
|
363
|
+
]
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* The same render in light and dark, side by side: for judging a design at a glance. Children
|
|
368
|
+
* render twice, so each side keeps its own state.
|
|
369
|
+
*/
|
|
370
|
+
function ThemePair({ children, minHeight, align = "center", caption, clientOnly }) {
|
|
371
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
372
|
+
className: "doc-pair",
|
|
373
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
374
|
+
className: "doc-pair__stages",
|
|
375
|
+
children: ["light", "dark"].map((t) => /* @__PURE__ */ jsxs(ThemeScope, {
|
|
376
|
+
theme: t,
|
|
377
|
+
className: "doc-pair__stage",
|
|
378
|
+
"data-align": align,
|
|
379
|
+
style: minHeight ? { minHeight } : void 0,
|
|
380
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
381
|
+
className: "doc-pair__label",
|
|
382
|
+
children: t === "light" ? "Light" : "Dark"
|
|
383
|
+
}), clientOnly ? /* @__PURE__ */ jsx(ClientOnly, { children }) : children]
|
|
384
|
+
}, t))
|
|
385
|
+
}), caption ? /* @__PURE__ */ jsx("figcaption", {
|
|
386
|
+
className: "doc-example__caption",
|
|
387
|
+
children: caption
|
|
388
|
+
}) : null]
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
function PropsTable({ rows, title }) {
|
|
392
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
393
|
+
className: "doc-props",
|
|
394
|
+
children: [title ? /* @__PURE__ */ jsx("h3", {
|
|
395
|
+
className: "doc-sub__title",
|
|
396
|
+
children: title
|
|
397
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
398
|
+
className: "doc-props__scroll",
|
|
399
|
+
role: "region",
|
|
400
|
+
"aria-label": title ?? "Props",
|
|
401
|
+
tabIndex: 0,
|
|
402
|
+
children: /* @__PURE__ */ jsxs("table", { children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
403
|
+
/* @__PURE__ */ jsx("th", {
|
|
404
|
+
scope: "col",
|
|
405
|
+
children: "Prop"
|
|
406
|
+
}),
|
|
407
|
+
/* @__PURE__ */ jsx("th", {
|
|
408
|
+
scope: "col",
|
|
409
|
+
children: "Type"
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ jsx("th", {
|
|
412
|
+
scope: "col",
|
|
413
|
+
children: "Default"
|
|
414
|
+
}),
|
|
415
|
+
/* @__PURE__ */ jsx("th", {
|
|
416
|
+
scope: "col",
|
|
417
|
+
children: "Description"
|
|
418
|
+
})
|
|
419
|
+
] }) }), /* @__PURE__ */ jsx("tbody", { children: rows.map((row) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
420
|
+
/* @__PURE__ */ jsxs("td", { children: [/* @__PURE__ */ jsx("code", {
|
|
421
|
+
className: "doc-props__name",
|
|
422
|
+
children: row.name
|
|
423
|
+
}), row.required ? /* @__PURE__ */ jsx("span", {
|
|
424
|
+
className: "doc-props__required",
|
|
425
|
+
children: "Required"
|
|
426
|
+
}) : null] }),
|
|
427
|
+
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("code", {
|
|
428
|
+
className: "doc-props__type",
|
|
429
|
+
children: row.type
|
|
430
|
+
}) }),
|
|
431
|
+
/* @__PURE__ */ jsx("td", { children: row.default ? /* @__PURE__ */ jsx("code", {
|
|
432
|
+
className: "doc-props__default",
|
|
433
|
+
children: row.default
|
|
434
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
435
|
+
className: "doc-props__none",
|
|
436
|
+
children: "None"
|
|
437
|
+
}) }),
|
|
438
|
+
/* @__PURE__ */ jsx("td", {
|
|
439
|
+
className: "doc-props__description",
|
|
440
|
+
children: row.description
|
|
441
|
+
})
|
|
442
|
+
] }, row.name)) })] })
|
|
443
|
+
})]
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
/** A plain reference table: a header row, then rows of cells. For options, tokens, sizes and the like. */
|
|
447
|
+
function DocTable({ columns, rows }) {
|
|
448
|
+
return /* @__PURE__ */ jsx("div", {
|
|
449
|
+
className: "doc-props doc-table",
|
|
450
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
451
|
+
className: "doc-props__scroll",
|
|
452
|
+
role: "region",
|
|
453
|
+
"aria-label": "Reference table",
|
|
454
|
+
tabIndex: 0,
|
|
455
|
+
children: /* @__PURE__ */ jsxs("table", { children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: columns.map((column, i) => /* @__PURE__ */ jsx("th", {
|
|
456
|
+
scope: "col",
|
|
457
|
+
children: column
|
|
458
|
+
}, i)) }) }), /* @__PURE__ */ jsx("tbody", { children: rows.map((row, i) => /* @__PURE__ */ jsx("tr", { children: row.map((cell, j) => /* @__PURE__ */ jsx("td", { children: cell }, j)) }, i)) })] })
|
|
459
|
+
})
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
/** A pair of small previews: the right way and the wrong way, each with one line of why. */
|
|
463
|
+
function DoDont({ do: good, dont: bad, clientOnly }) {
|
|
464
|
+
const stage = (children) => clientOnly ? /* @__PURE__ */ jsx(ClientOnly, { children }) : children;
|
|
465
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
466
|
+
className: "doc-dodont",
|
|
467
|
+
children: [/* @__PURE__ */ jsxs("figure", {
|
|
468
|
+
className: "doc-dodont__item",
|
|
469
|
+
"data-kind": "do",
|
|
470
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
471
|
+
className: "doc-dodont__stage",
|
|
472
|
+
children: stage(good.children)
|
|
473
|
+
}), /* @__PURE__ */ jsxs("figcaption", {
|
|
474
|
+
className: "doc-dodont__caption",
|
|
475
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
476
|
+
className: "doc-dodont__label",
|
|
477
|
+
children: [/* @__PURE__ */ jsx(CheckIcon, {
|
|
478
|
+
weight: "bold",
|
|
479
|
+
"aria-hidden": "true"
|
|
480
|
+
}), "Do"]
|
|
481
|
+
}), good.caption]
|
|
482
|
+
})]
|
|
483
|
+
}), /* @__PURE__ */ jsxs("figure", {
|
|
484
|
+
className: "doc-dodont__item",
|
|
485
|
+
"data-kind": "dont",
|
|
486
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
487
|
+
className: "doc-dodont__stage",
|
|
488
|
+
children: stage(bad.children)
|
|
489
|
+
}), /* @__PURE__ */ jsxs("figcaption", {
|
|
490
|
+
className: "doc-dodont__caption",
|
|
491
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
492
|
+
className: "doc-dodont__label",
|
|
493
|
+
children: [/* @__PURE__ */ jsx(XIcon, {
|
|
494
|
+
weight: "bold",
|
|
495
|
+
"aria-hidden": "true"
|
|
496
|
+
}), "Don't"]
|
|
497
|
+
}), bad.caption]
|
|
498
|
+
})]
|
|
499
|
+
})]
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
/** Plain guidance bullets under a section. */
|
|
503
|
+
function Guidelines({ items }) {
|
|
504
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
505
|
+
className: "doc-guidelines",
|
|
506
|
+
children: items.map((item, i) => /* @__PURE__ */ jsx("li", { children: item }, i))
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
/** A quiet aside for a caveat or tip. No coloured side stripe: a tinted surface and a label. */
|
|
510
|
+
function Note({ title = "Note", children }) {
|
|
511
|
+
return /* @__PURE__ */ jsxs("aside", {
|
|
512
|
+
className: "doc-note",
|
|
513
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
514
|
+
className: "doc-note__title",
|
|
515
|
+
children: title
|
|
516
|
+
}), /* @__PURE__ */ jsx("div", { children })]
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
//#endregion
|
|
520
|
+
export { DocTable as a, ImportLine as c, Section$1 as d, StageScope as f, useStageTheme as h, DocPage as i, Note as l, ThemePair as m, CodeBlock$1 as n, Example as o, SubSection as p, DoDont as r, Guidelines as s, ClientOnly as t, PropsTable as u };
|