@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
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AnchorHTMLAttributes, ComponentType, ReactNode, RefAttributes } from 'react'
|
|
2
|
+
|
|
3
|
+
/** Who reads the pages. 'public' leaves out what only Orbit's own team needs. */
|
|
4
|
+
export type DocsAudience = 'internal' | 'public'
|
|
5
|
+
|
|
6
|
+
/** What the host's link component receives: anchor props with the full href (base path included). */
|
|
7
|
+
export type DocsLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & RefAttributes<HTMLAnchorElement> & { href: string }
|
|
8
|
+
|
|
9
|
+
export interface DocsHostProviderProps {
|
|
10
|
+
/** Draws every link in the docs, e.g. a wrapper around next/link. */
|
|
11
|
+
link?: ComponentType<DocsLinkProps>
|
|
12
|
+
/** Where the docs live in the host, e.g. '/constellation'. */
|
|
13
|
+
basePath?: string
|
|
14
|
+
audience?: DocsAudience
|
|
15
|
+
/** Goes to a full href, e.g. after choosing a page in the search palette (next/navigation's router.push). */
|
|
16
|
+
navigate?: (href: string) => void
|
|
17
|
+
/** Switches the site between light and dark; the frame's toggle calls it. */
|
|
18
|
+
setTheme?: (theme: 'light' | 'dark') => void
|
|
19
|
+
/** A way back to the rest of the host's site, shown in the top bar. */
|
|
20
|
+
backLink?: { href: string; label: string } | null
|
|
21
|
+
/** Whether pages set document.title. Turn it off where the host sets titles. Default true. */
|
|
22
|
+
documentTitle?: boolean
|
|
23
|
+
children: ReactNode
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Once, around the docs routes. A client component. */
|
|
27
|
+
export declare function ConstellationDocsHost(props: DocsHostProviderProps): ReactNode
|
|
28
|
+
|
|
29
|
+
/** The docs' frame (sidebar, top bar, search, theme switch) around the page at `path` (a docs path). Put it in a layout so it stays put between pages. */
|
|
30
|
+
export declare function ConstellationDocsFrame(props: { path: string; children: ReactNode }): ReactNode
|
|
31
|
+
|
|
32
|
+
/** One docs page by its docs path ('/' for the overview, '/components/button' and so on). Renders on the server too. */
|
|
33
|
+
export declare function ConstellationDocsPage(props: { path: string }): ReactNode
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as useDocsHost, i as docsHref, n as DocsHostProvider, o as useDocumentTheme, t as DocLink } from "./pages/host-B6znjEgQ.js";
|
|
3
|
+
import { t as CONSTELLATION_VERSION } from "./pages/release-Cs6tl16C.js";
|
|
4
|
+
import { a as pageAt, i as navSections, n as GROUPS, r as PAGES } from "./pages/registry-BZg-xAbi.js";
|
|
5
|
+
import "@orbitcommerce/constellation/fonts.css";
|
|
6
|
+
import "@orbitcommerce/constellation/styles.css";
|
|
7
|
+
import "./docs.css";
|
|
8
|
+
import { Component, Suspense, lazy, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { flushSync } from "react-dom";
|
|
11
|
+
import { AppShell, Breadcrumbs, Button, Canvas, CommandEmpty, CommandGroup, CommandItem, CommandPalette, IconButton, OrbitLogo, SearchTrigger, Sidebar, SidebarFooter, SidebarHeader, SidebarItem, SidebarNav, SidebarSection, Skeleton, SkeletonText, Tooltip, TooltipProvider, TopBar, useShell } from "@orbitcommerce/constellation";
|
|
12
|
+
import { ArrowLeftIcon, BookOpenTextIcon, CubeIcon, MagnifyingGlassIcon, MoonIcon, PaletteIcon, SquaresFourIcon, SunIcon } from "@orbitcommerce/constellation/icons";
|
|
13
|
+
//#region src/site/frame.tsx
|
|
14
|
+
var SEARCH_PLACEHOLDER = "Search components and guides";
|
|
15
|
+
function DocsFrame({ path, children }) {
|
|
16
|
+
const [searchOpen, setSearchOpen] = useState(false);
|
|
17
|
+
const scrollRef = useRef(null);
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: "o-root site-root docs-site",
|
|
20
|
+
children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [/* @__PURE__ */ jsx(AppShell, {
|
|
21
|
+
className: "site",
|
|
22
|
+
collapsed: false,
|
|
23
|
+
sidebar: /* @__PURE__ */ jsx(SiteSidebar, { path }),
|
|
24
|
+
header: /* @__PURE__ */ jsx(SiteTopBar, {
|
|
25
|
+
path,
|
|
26
|
+
onSearch: () => setSearchOpen(true)
|
|
27
|
+
}),
|
|
28
|
+
children: /* @__PURE__ */ jsxs(Canvas, {
|
|
29
|
+
ref: scrollRef,
|
|
30
|
+
id: "main",
|
|
31
|
+
scrollClassName: "site-scroll",
|
|
32
|
+
children: [/* @__PURE__ */ jsx(ScrollReset, {
|
|
33
|
+
scrollRef,
|
|
34
|
+
path
|
|
35
|
+
}), children]
|
|
36
|
+
})
|
|
37
|
+
}), /* @__PURE__ */ jsx(SiteSearch, {
|
|
38
|
+
open: searchOpen,
|
|
39
|
+
onOpenChange: setSearchOpen
|
|
40
|
+
})] })
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function SiteSidebar({ path }) {
|
|
44
|
+
const shell = useShell();
|
|
45
|
+
const sections = useMemo(navSections, []);
|
|
46
|
+
const current = pageAt(path);
|
|
47
|
+
const close = () => shell.setDrawerOpen(false);
|
|
48
|
+
return /* @__PURE__ */ jsxs(Sidebar, {
|
|
49
|
+
label: "Documentation",
|
|
50
|
+
className: "site-sidebar",
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx(SidebarHeader, { children: /* @__PURE__ */ jsxs(DocLink, {
|
|
53
|
+
to: "/",
|
|
54
|
+
className: "site-brand",
|
|
55
|
+
onClick: close,
|
|
56
|
+
"aria-label": "Constellation by Orbit Commerce, home",
|
|
57
|
+
children: [/* @__PURE__ */ jsx(OrbitLogo, {
|
|
58
|
+
variant: "mark",
|
|
59
|
+
size: 24,
|
|
60
|
+
className: "site-brand__mark",
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
title: ""
|
|
63
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
64
|
+
className: "site-brand__text",
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
67
|
+
className: "site-brand__name",
|
|
68
|
+
children: "Constellation"
|
|
69
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
70
|
+
className: "site-brand__by",
|
|
71
|
+
children: "by Orbit Commerce"
|
|
72
|
+
})]
|
|
73
|
+
})]
|
|
74
|
+
}) }),
|
|
75
|
+
/* @__PURE__ */ jsx(SidebarNav, {
|
|
76
|
+
label: "Pages",
|
|
77
|
+
children: sections.map((section) => /* @__PURE__ */ jsx(SidebarSection, {
|
|
78
|
+
title: section.title,
|
|
79
|
+
children: section.pages.map((page) => /* @__PURE__ */ jsx(SidebarItem, {
|
|
80
|
+
itemId: page.path,
|
|
81
|
+
label: page.title,
|
|
82
|
+
active: current?.path === page.path,
|
|
83
|
+
link: /* @__PURE__ */ jsx(DocLink, { to: page.path }),
|
|
84
|
+
onSelect: close
|
|
85
|
+
}, page.path))
|
|
86
|
+
}, section.id))
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsxs("span", {
|
|
89
|
+
className: "site-version",
|
|
90
|
+
children: ["v", CONSTELLATION_VERSION]
|
|
91
|
+
}) })
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function SiteTopBar({ path, onSearch }) {
|
|
96
|
+
const shell = useShell();
|
|
97
|
+
const page = pageAt(path);
|
|
98
|
+
const group = page ? GROUPS.find((g) => g.id === page.group) : void 0;
|
|
99
|
+
const mobile = shell.mode === "mobile";
|
|
100
|
+
const crumbs = !page ? [{ label: "Page not found" }] : page.path === "/" ? [{ label: "Overview" }] : [{ label: group?.title ?? "" }, { label: page.title }];
|
|
101
|
+
return /* @__PURE__ */ jsx(TopBar, {
|
|
102
|
+
start: /* @__PURE__ */ jsx(Breadcrumbs, { items: crumbs }),
|
|
103
|
+
center: mobile ? null : /* @__PURE__ */ jsx(SearchTrigger, {
|
|
104
|
+
placeholder: SEARCH_PLACEHOLDER,
|
|
105
|
+
width: 340,
|
|
106
|
+
onOpen: onSearch
|
|
107
|
+
}),
|
|
108
|
+
end: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
109
|
+
mobile ? /* @__PURE__ */ jsx(IconButton, {
|
|
110
|
+
label: SEARCH_PLACEHOLDER,
|
|
111
|
+
onClick: onSearch,
|
|
112
|
+
children: /* @__PURE__ */ jsx(MagnifyingGlassIcon, {})
|
|
113
|
+
}) : null,
|
|
114
|
+
/* @__PURE__ */ jsx(BackLink, {}),
|
|
115
|
+
/* @__PURE__ */ jsx(ThemeToggle, {})
|
|
116
|
+
] })
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/** The way back to the rest of the host's site (the developer portal), when it has one. */
|
|
120
|
+
function BackLink() {
|
|
121
|
+
const { backLink, link: Link } = useDocsHost();
|
|
122
|
+
const shell = useShell();
|
|
123
|
+
if (!backLink) return null;
|
|
124
|
+
if (shell.mode === "mobile") return /* @__PURE__ */ jsx(Tooltip, {
|
|
125
|
+
content: backLink.label,
|
|
126
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
127
|
+
asChild: true,
|
|
128
|
+
label: backLink.label,
|
|
129
|
+
children: /* @__PURE__ */ jsx(Link, {
|
|
130
|
+
href: backLink.href,
|
|
131
|
+
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
136
|
+
asChild: true,
|
|
137
|
+
variant: "ghost",
|
|
138
|
+
size: "sm",
|
|
139
|
+
icon: /* @__PURE__ */ jsx(ArrowLeftIcon, {}),
|
|
140
|
+
className: "site-back",
|
|
141
|
+
children: /* @__PURE__ */ jsx(Link, {
|
|
142
|
+
href: backLink.href,
|
|
143
|
+
children: backLink.label
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Light and dark. The new theme spreads out from the button in a widening circle (a view
|
|
149
|
+
* transition), or swaps instantly when motion is reduced or the browser cannot animate it.
|
|
150
|
+
*/
|
|
151
|
+
function ThemeToggle() {
|
|
152
|
+
const { setTheme } = useDocsHost();
|
|
153
|
+
const theme = useDocumentTheme();
|
|
154
|
+
const ref = useRef(null);
|
|
155
|
+
const next = theme === "dark" ? "light" : "dark";
|
|
156
|
+
const label = next === "dark" ? "Switch to dark theme" : "Switch to light theme";
|
|
157
|
+
const toggle = () => {
|
|
158
|
+
const apply = () => flushSync(() => setTheme(next));
|
|
159
|
+
const reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
160
|
+
if (!document.startViewTransition || reduce) return apply();
|
|
161
|
+
const rect = ref.current?.getBoundingClientRect();
|
|
162
|
+
const x = rect ? rect.left + rect.width / 2 : innerWidth - 40;
|
|
163
|
+
const y = rect ? rect.top + rect.height / 2 : 30;
|
|
164
|
+
const radius = Math.hypot(Math.max(x, innerWidth - x), Math.max(y, innerHeight - y));
|
|
165
|
+
document.startViewTransition(apply).ready.then(() => {
|
|
166
|
+
document.documentElement.animate({ clipPath: [`circle(0px at ${x}px ${y}px)`, `circle(${radius}px at ${x}px ${y}px)`] }, {
|
|
167
|
+
duration: 560,
|
|
168
|
+
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
169
|
+
pseudoElement: "::view-transition-new(root)"
|
|
170
|
+
});
|
|
171
|
+
}).catch(() => {});
|
|
172
|
+
};
|
|
173
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
174
|
+
content: label,
|
|
175
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
176
|
+
ref,
|
|
177
|
+
label,
|
|
178
|
+
onClick: toggle,
|
|
179
|
+
className: "site-theme-toggle",
|
|
180
|
+
"data-theme": theme,
|
|
181
|
+
children: theme === "dark" ? /* @__PURE__ */ jsx(SunIcon, {}) : /* @__PURE__ */ jsx(MoonIcon, {})
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
var SECTION_ICONS = {
|
|
186
|
+
start: /* @__PURE__ */ jsx(BookOpenTextIcon, {}),
|
|
187
|
+
foundations: /* @__PURE__ */ jsx(PaletteIcon, {}),
|
|
188
|
+
patterns: /* @__PURE__ */ jsx(SquaresFourIcon, {})
|
|
189
|
+
};
|
|
190
|
+
function SiteSearch({ open, onOpenChange }) {
|
|
191
|
+
const { navigate, basePath } = useDocsHost();
|
|
192
|
+
const sections = useMemo(navSections, []);
|
|
193
|
+
return /* @__PURE__ */ jsxs(CommandPalette, {
|
|
194
|
+
open,
|
|
195
|
+
onOpenChange,
|
|
196
|
+
label: "Search the docs",
|
|
197
|
+
placeholder: SEARCH_PLACEHOLDER,
|
|
198
|
+
children: [/* @__PURE__ */ jsx(CommandEmpty, {
|
|
199
|
+
description: "Try a component name, like menu or badge.",
|
|
200
|
+
children: "No pages match that"
|
|
201
|
+
}), sections.map((section) => /* @__PURE__ */ jsx(CommandGroup, {
|
|
202
|
+
heading: section.title,
|
|
203
|
+
children: section.pages.map((page) => /* @__PURE__ */ jsx(CommandItem, {
|
|
204
|
+
value: page.path,
|
|
205
|
+
keywords: [page.title, section.title],
|
|
206
|
+
icon: SECTION_ICONS[section.id] ?? /* @__PURE__ */ jsx(CubeIcon, {}),
|
|
207
|
+
onSelect: () => {
|
|
208
|
+
onOpenChange(false);
|
|
209
|
+
navigate(docsHref(basePath, page.path));
|
|
210
|
+
},
|
|
211
|
+
children: page.title
|
|
212
|
+
}, page.path))
|
|
213
|
+
}, section.id))]
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/** A new page starts at the top; a link to a section lands on it (DocPage handles that once loaded). */
|
|
217
|
+
function ScrollReset({ scrollRef, path }) {
|
|
218
|
+
useLayoutEffect(() => {
|
|
219
|
+
if (!window.location.hash) scrollRef.current?.scrollTo({ top: 0 });
|
|
220
|
+
}, [path, scrollRef]);
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
function PageSkeleton() {
|
|
224
|
+
return /* @__PURE__ */ jsx("div", {
|
|
225
|
+
className: "doc",
|
|
226
|
+
"aria-busy": "true",
|
|
227
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
228
|
+
className: "doc__main site-skeleton",
|
|
229
|
+
children: [
|
|
230
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
231
|
+
width: 240,
|
|
232
|
+
height: 40,
|
|
233
|
+
radius: "md"
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ jsx(SkeletonText, { lines: 2 }),
|
|
236
|
+
/* @__PURE__ */ jsx(Skeleton, {
|
|
237
|
+
height: 220,
|
|
238
|
+
radius: "lg"
|
|
239
|
+
})
|
|
240
|
+
]
|
|
241
|
+
})
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/** The error itself, for Orbit's own team only. */
|
|
245
|
+
function ErrorDetail({ error }) {
|
|
246
|
+
if (useDocsHost().audience !== "internal") return null;
|
|
247
|
+
return /* @__PURE__ */ jsx("pre", {
|
|
248
|
+
className: "site-error",
|
|
249
|
+
children: String(error.stack ?? error.message)
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/** One page's error stays on that page; the frame and the other pages keep working. */
|
|
253
|
+
var PageBoundary = class extends Component {
|
|
254
|
+
state = { error: null };
|
|
255
|
+
static getDerivedStateFromError(error) {
|
|
256
|
+
return { error };
|
|
257
|
+
}
|
|
258
|
+
componentDidUpdate(prev) {
|
|
259
|
+
if (prev.resetKey !== this.props.resetKey && this.state.error) this.setState({ error: null });
|
|
260
|
+
}
|
|
261
|
+
render() {
|
|
262
|
+
if (!this.state.error) return this.props.children;
|
|
263
|
+
return /* @__PURE__ */ jsx("div", {
|
|
264
|
+
className: "doc",
|
|
265
|
+
children: /* @__PURE__ */ jsxs("article", {
|
|
266
|
+
className: "doc__main",
|
|
267
|
+
children: [/* @__PURE__ */ jsxs("header", {
|
|
268
|
+
className: "doc__header",
|
|
269
|
+
children: [/* @__PURE__ */ jsx("h1", {
|
|
270
|
+
className: "doc__title",
|
|
271
|
+
children: "This page did not load"
|
|
272
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
273
|
+
className: "doc__lead",
|
|
274
|
+
children: "Something went wrong drawing it. The rest of the docs still work."
|
|
275
|
+
})]
|
|
276
|
+
}), /* @__PURE__ */ jsx(ErrorDetail, { error: this.state.error })]
|
|
277
|
+
})
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/lib/index.tsx
|
|
283
|
+
/** Once, around the docs routes: the host's links, navigation and theme, where the docs live and who reads them. */
|
|
284
|
+
function ConstellationDocsHost(props) {
|
|
285
|
+
return /* @__PURE__ */ jsx(DocsHostProvider, { ...props });
|
|
286
|
+
}
|
|
287
|
+
/** The docs' frame (sidebar, top bar, search, theme switch) around the page at `path`. */
|
|
288
|
+
function ConstellationDocsFrame({ path, children }) {
|
|
289
|
+
return /* @__PURE__ */ jsx(DocsFrame, {
|
|
290
|
+
path,
|
|
291
|
+
children
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
var PAGE_COMPONENTS = new Map(PAGES.map((page) => [page.path, lazy(() => page.load().then((mod) => ({ default: mod.Page })))]));
|
|
295
|
+
/** One docs page by its docs path. It renders on the server too; an unknown path renders nothing (the host 404s first). */
|
|
296
|
+
function ConstellationDocsPage({ path }) {
|
|
297
|
+
const Page = PAGE_COMPONENTS.get(path);
|
|
298
|
+
if (!Page) return null;
|
|
299
|
+
return /* @__PURE__ */ jsx(PageBoundary, {
|
|
300
|
+
resetKey: path,
|
|
301
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
302
|
+
fallback: /* @__PURE__ */ jsx(PageSkeleton, {}),
|
|
303
|
+
children: /* @__PURE__ */ jsx(Page, {})
|
|
304
|
+
})
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
//#endregion
|
|
308
|
+
export { ConstellationDocsFrame, ConstellationDocsHost, ConstellationDocsPage };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { f as StageScope, h as useStageTheme, n as CodeBlock$1, t as ClientOnly } from "./docs-lM2UBSir.js";
|
|
3
|
+
import { useId, useMemo, useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Input, SegmentedControl, Switch } from "@orbitcommerce/constellation";
|
|
6
|
+
import { MoonIcon, SunIcon } from "@orbitcommerce/constellation/icons";
|
|
7
|
+
//#region src/site/Playground.tsx
|
|
8
|
+
function initialValues(controls) {
|
|
9
|
+
return Object.fromEntries(controls.map((c) => [c.prop, c.default]));
|
|
10
|
+
}
|
|
11
|
+
function toCode(component, controls, values, childrenProp, extraCode) {
|
|
12
|
+
const attrs = [];
|
|
13
|
+
for (const c of controls) {
|
|
14
|
+
if (c.prop === childrenProp) continue;
|
|
15
|
+
const v = values[c.prop];
|
|
16
|
+
if (c.toAttr) {
|
|
17
|
+
const attr = c.toAttr(v);
|
|
18
|
+
if (attr) attrs.push(attr);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (c.type === "text") {
|
|
22
|
+
if (String(v) !== "") attrs.push(`${c.prop}="${String(v).replace(/"/g, """)}"`);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (v === c.default) continue;
|
|
26
|
+
if (c.type === "boolean") attrs.push(v ? c.prop : `${c.prop}={false}`);
|
|
27
|
+
else attrs.push(`${c.prop}="${String(v).replace(/"/g, """)}"`);
|
|
28
|
+
}
|
|
29
|
+
attrs.push(...extraCode?.(values) ?? []);
|
|
30
|
+
const children = childrenProp ? String(values[childrenProp] ?? "") : "";
|
|
31
|
+
const oneLine = attrs.length ? `<${component} ${attrs.join(" ")}` : `<${component}`;
|
|
32
|
+
if (oneLine.length + children.length > 72 && attrs.length > 1) {
|
|
33
|
+
const tag = `<${component}\n${attrs.map((a) => ` ${a}`).join("\n")}\n`;
|
|
34
|
+
return children ? `${tag}>\n ${children}\n</${component}>` : `${tag}/>`;
|
|
35
|
+
}
|
|
36
|
+
return children ? `${oneLine}>${children}</${component}>` : `${oneLine} />`;
|
|
37
|
+
}
|
|
38
|
+
var THEMES = [{
|
|
39
|
+
value: "light",
|
|
40
|
+
icon: /* @__PURE__ */ jsx(SunIcon, {}),
|
|
41
|
+
label: "Light",
|
|
42
|
+
iconOnly: true
|
|
43
|
+
}, {
|
|
44
|
+
value: "dark",
|
|
45
|
+
icon: /* @__PURE__ */ jsx(MoonIcon, {}),
|
|
46
|
+
label: "Dark",
|
|
47
|
+
iconOnly: true
|
|
48
|
+
}];
|
|
49
|
+
function Playground({ component, controls, render, childrenProp, extraCode, minHeight, clientOnly }) {
|
|
50
|
+
const [values, setValues] = useState(() => initialValues(controls));
|
|
51
|
+
const stage = useStageTheme();
|
|
52
|
+
const baseId = useId();
|
|
53
|
+
const set = (prop, value) => setValues((v) => ({
|
|
54
|
+
...v,
|
|
55
|
+
[prop]: value
|
|
56
|
+
}));
|
|
57
|
+
const code = useMemo(() => toCode(component, controls, values, childrenProp, extraCode), [
|
|
58
|
+
component,
|
|
59
|
+
controls,
|
|
60
|
+
values,
|
|
61
|
+
childrenProp,
|
|
62
|
+
extraCode
|
|
63
|
+
]);
|
|
64
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
65
|
+
className: "doc-playground",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx(StageScope, {
|
|
68
|
+
theme: stage.override,
|
|
69
|
+
className: "doc-playground__stage",
|
|
70
|
+
style: minHeight ? { minHeight } : void 0,
|
|
71
|
+
children: clientOnly ? /* @__PURE__ */ jsx(ClientOnly, { children: render(values) }) : render(values)
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: "doc-playground__controls",
|
|
75
|
+
role: "group",
|
|
76
|
+
"aria-label": `${component} props`,
|
|
77
|
+
children: [controls.map((c) => {
|
|
78
|
+
const labelId = `${baseId}${c.prop}`;
|
|
79
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
80
|
+
className: "doc-playground__control",
|
|
81
|
+
"data-type": c.type,
|
|
82
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: "doc-playground__label",
|
|
84
|
+
id: labelId,
|
|
85
|
+
children: c.prop
|
|
86
|
+
}), c.type === "select" ? /* @__PURE__ */ jsx("div", {
|
|
87
|
+
className: "doc-playground__scroll",
|
|
88
|
+
children: /* @__PURE__ */ jsx(SegmentedControl, {
|
|
89
|
+
"aria-label": c.prop,
|
|
90
|
+
size: "sm",
|
|
91
|
+
value: String(values[c.prop]),
|
|
92
|
+
onValueChange: (v) => set(c.prop, v),
|
|
93
|
+
options: c.options.map((o) => ({
|
|
94
|
+
value: o,
|
|
95
|
+
label: o
|
|
96
|
+
}))
|
|
97
|
+
})
|
|
98
|
+
}) : c.type === "boolean" ? /* @__PURE__ */ jsx(Switch, {
|
|
99
|
+
size: "sm",
|
|
100
|
+
"aria-labelledby": labelId,
|
|
101
|
+
checked: Boolean(values[c.prop]),
|
|
102
|
+
onCheckedChange: (v) => set(c.prop, v)
|
|
103
|
+
}) : /* @__PURE__ */ jsx(Input, {
|
|
104
|
+
size: "sm",
|
|
105
|
+
"aria-labelledby": labelId,
|
|
106
|
+
value: String(values[c.prop]),
|
|
107
|
+
onChange: (e) => set(c.prop, e.target.value)
|
|
108
|
+
})]
|
|
109
|
+
}, c.prop);
|
|
110
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
111
|
+
className: "doc-playground__control doc-playground__theme",
|
|
112
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: "doc-playground__label",
|
|
114
|
+
children: "theme"
|
|
115
|
+
}), /* @__PURE__ */ jsx(SegmentedControl, {
|
|
116
|
+
"aria-label": "Preview theme",
|
|
117
|
+
size: "sm",
|
|
118
|
+
value: stage.theme,
|
|
119
|
+
onValueChange: stage.choose,
|
|
120
|
+
options: THEMES
|
|
121
|
+
})]
|
|
122
|
+
})]
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ jsx(CodeBlock$1, { code })
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
export { Playground as t };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/pages/components/_address-data.ts
|
|
3
|
+
var PLACES = [
|
|
4
|
+
[
|
|
5
|
+
"10 Harbour Street",
|
|
6
|
+
"Whitby",
|
|
7
|
+
"North Yorkshire",
|
|
8
|
+
"YO21 3PU",
|
|
9
|
+
"United Kingdom",
|
|
10
|
+
"GB",
|
|
11
|
+
"Europe/London"
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
"12 Harbour Street",
|
|
15
|
+
"Whitby",
|
|
16
|
+
"North Yorkshire",
|
|
17
|
+
"YO21 3PU",
|
|
18
|
+
"United Kingdom",
|
|
19
|
+
"GB",
|
|
20
|
+
"Europe/London"
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"4 Harbour Row",
|
|
24
|
+
"Falmouth",
|
|
25
|
+
"Cornwall",
|
|
26
|
+
"TR11 2RN",
|
|
27
|
+
"United Kingdom",
|
|
28
|
+
"GB",
|
|
29
|
+
"Europe/London"
|
|
30
|
+
],
|
|
31
|
+
[
|
|
32
|
+
"27 Arden Road",
|
|
33
|
+
"Leamington Spa",
|
|
34
|
+
"Warwickshire",
|
|
35
|
+
"CV32 5LE",
|
|
36
|
+
"United Kingdom",
|
|
37
|
+
"GB",
|
|
38
|
+
"Europe/London"
|
|
39
|
+
],
|
|
40
|
+
[
|
|
41
|
+
"3 Quay Lane",
|
|
42
|
+
"Kinsale",
|
|
43
|
+
"County Cork",
|
|
44
|
+
"P17 YX40",
|
|
45
|
+
"Ireland",
|
|
46
|
+
"IE",
|
|
47
|
+
"Europe/Dublin"
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"18 Marina Parade",
|
|
51
|
+
"Brighton",
|
|
52
|
+
"East Sussex",
|
|
53
|
+
"BN2 1EP",
|
|
54
|
+
"United Kingdom",
|
|
55
|
+
"GB",
|
|
56
|
+
"Europe/London"
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
"55 Market Place",
|
|
60
|
+
"Ripon",
|
|
61
|
+
"North Yorkshire",
|
|
62
|
+
"HG4 1BZ",
|
|
63
|
+
"United Kingdom",
|
|
64
|
+
"GB",
|
|
65
|
+
"Europe/London"
|
|
66
|
+
]
|
|
67
|
+
].map(([street, city, state, postcode, country, countryCode, timeZone], index) => ({
|
|
68
|
+
id: `place-${index}`,
|
|
69
|
+
street,
|
|
70
|
+
city,
|
|
71
|
+
state,
|
|
72
|
+
postcode,
|
|
73
|
+
country,
|
|
74
|
+
countryCode,
|
|
75
|
+
timeZone,
|
|
76
|
+
formatted: `${street}, ${city}, ${postcode}, ${country}`
|
|
77
|
+
}));
|
|
78
|
+
var later = (value, ms, signal) => new Promise((resolve, reject) => {
|
|
79
|
+
const timer = window.setTimeout(() => resolve(value), ms);
|
|
80
|
+
signal.addEventListener("abort", () => {
|
|
81
|
+
window.clearTimeout(timer);
|
|
82
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
var demoSource = {
|
|
86
|
+
suggest: (term, { countries, signal }) => {
|
|
87
|
+
const words = term.toLowerCase().split(/\s+/).filter(Boolean);
|
|
88
|
+
return later(PLACES.filter((place) => (!countries || countries.includes(place.countryCode)) && words.every((word) => `${place.formatted} ${place.state}`.toLowerCase().includes(word))).map((place) => ({
|
|
89
|
+
id: place.id,
|
|
90
|
+
label: place.street,
|
|
91
|
+
description: `${place.city}, ${place.postcode}, ${place.country}`
|
|
92
|
+
})), 450, signal);
|
|
93
|
+
},
|
|
94
|
+
resolve: (suggestion, { signal }) => later(PLACES.find((place) => place.id === suggestion.id) ?? null, 250, signal)
|
|
95
|
+
};
|
|
96
|
+
var STATES = {
|
|
97
|
+
GB: [
|
|
98
|
+
"Cornwall",
|
|
99
|
+
"East Sussex",
|
|
100
|
+
"Greater London",
|
|
101
|
+
"North Yorkshire",
|
|
102
|
+
"Warwickshire"
|
|
103
|
+
].map((label) => ({
|
|
104
|
+
value: `gb-${label}`,
|
|
105
|
+
label
|
|
106
|
+
})),
|
|
107
|
+
IE: [
|
|
108
|
+
"County Cork",
|
|
109
|
+
"County Dublin",
|
|
110
|
+
"County Galway"
|
|
111
|
+
].map((label) => ({
|
|
112
|
+
value: `ie-${label}`,
|
|
113
|
+
label
|
|
114
|
+
}))
|
|
115
|
+
};
|
|
116
|
+
var CITIES = {
|
|
117
|
+
Cornwall: [
|
|
118
|
+
"Falmouth",
|
|
119
|
+
"Penzance",
|
|
120
|
+
"Truro"
|
|
121
|
+
],
|
|
122
|
+
"East Sussex": [
|
|
123
|
+
"Brighton",
|
|
124
|
+
"Eastbourne",
|
|
125
|
+
"Lewes"
|
|
126
|
+
],
|
|
127
|
+
"Greater London": [
|
|
128
|
+
"Camden",
|
|
129
|
+
"Greenwich",
|
|
130
|
+
"Islington"
|
|
131
|
+
],
|
|
132
|
+
"North Yorkshire": [
|
|
133
|
+
"Ripon",
|
|
134
|
+
"Scarborough",
|
|
135
|
+
"Whitby",
|
|
136
|
+
"York"
|
|
137
|
+
],
|
|
138
|
+
Warwickshire: [
|
|
139
|
+
"Leamington Spa",
|
|
140
|
+
"Stratford-upon-Avon",
|
|
141
|
+
"Warwick"
|
|
142
|
+
],
|
|
143
|
+
"County Cork": [
|
|
144
|
+
"Cobh",
|
|
145
|
+
"Cork",
|
|
146
|
+
"Kinsale"
|
|
147
|
+
],
|
|
148
|
+
"County Dublin": [
|
|
149
|
+
"Dublin",
|
|
150
|
+
"Howth",
|
|
151
|
+
"Swords"
|
|
152
|
+
],
|
|
153
|
+
"County Galway": ["Clifden", "Galway"]
|
|
154
|
+
};
|
|
155
|
+
var searchStates = (country, { term, signal }) => later({ options: (STATES[country] ?? []).filter((state) => state.label.toLowerCase().includes(term.toLowerCase())) }, 300, signal);
|
|
156
|
+
var searchCities = (_country, state, { term, signal }) => later({ options: (CITIES[state.name] ?? []).filter((city) => city.toLowerCase().includes(term.toLowerCase())).map((city) => ({
|
|
157
|
+
value: `city-${city}`,
|
|
158
|
+
label: city
|
|
159
|
+
})) }, 300, signal);
|
|
160
|
+
//#endregion
|
|
161
|
+
export { searchCities as n, searchStates as r, demoSource as t };
|