@clarify-labs/renderer 0.9.0 → 0.9.2
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/output/{ClarifyShell-BPv2bxI4.js → ClarifyShell-C38EkErX.js} +397 -250
- package/output/ClarifyShell-C38EkErX.js.map +1 -0
- package/output/{ClarifyShell-B74Fq4UU.cjs → ClarifyShell-DdYRgrfY.cjs} +396 -249
- package/output/ClarifyShell-DdYRgrfY.cjs.map +1 -0
- package/output/{OpenApiOperation-BMXfV15v.cjs → OpenApiOperation-CP_fxT_F.cjs} +344 -219
- package/output/OpenApiOperation-CP_fxT_F.cjs.map +1 -0
- package/output/{OpenApiOperation-fJ3QQOJX.js → OpenApiOperation-DIFaYAe5.js} +344 -219
- package/output/OpenApiOperation-DIFaYAe5.js.map +1 -0
- package/output/{PageActions-DOKkt2zo.cjs → PageActions-B08cDCzq.cjs} +278 -167
- package/output/PageActions-B08cDCzq.cjs.map +1 -0
- package/output/{PageActions-BwY7ierv.js → PageActions-tmnpzi23.js} +279 -168
- package/output/PageActions-tmnpzi23.js.map +1 -0
- package/output/app/SectionProvider.d.ts +1 -0
- package/output/client.cjs +3 -3
- package/output/client.js +3 -3
- package/output/core/types.d.ts +1 -0
- package/output/index.cjs +4 -4
- package/output/index.js +4 -4
- package/output/openapi/components/CodeDisplay.d.ts +25 -0
- package/output/openapi/components/EndpointSections.d.ts +4 -0
- package/output/openapi/components/ExamplePanels.d.ts +8 -17
- package/output/openapi/components/OpenApiOperation.state.d.ts +43 -0
- package/output/openapi/components/SelectControl.d.ts +15 -0
- package/output/openapi/components/helpers.d.ts +22 -0
- package/output/preview.cjs +114 -67
- package/output/preview.cjs.map +1 -1
- package/output/preview.js +114 -67
- package/output/preview.js.map +1 -1
- package/output/{render-Cghgq1AQ.js → render-6gHfrR9h.js} +2 -2
- package/output/{render-Cghgq1AQ.js.map → render-6gHfrR9h.js.map} +1 -1
- package/output/{render-ZSckbg74.cjs → render-Bvf5ZMZb.cjs} +2 -2
- package/output/{render-ZSckbg74.cjs.map → render-Bvf5ZMZb.cjs.map} +1 -1
- package/output/renderer.css +168 -107
- package/output/server.cjs +2 -2
- package/output/server.js +2 -2
- package/output/shell/Header.d.ts +2 -0
- package/package.json +1 -1
- package/output/ClarifyShell-B74Fq4UU.cjs.map +0 -1
- package/output/ClarifyShell-BPv2bxI4.js.map +0 -1
- package/output/OpenApiOperation-BMXfV15v.cjs.map +0 -1
- package/output/OpenApiOperation-fJ3QQOJX.js.map +0 -1
- package/output/PageActions-BwY7ierv.js.map +0 -1
- package/output/PageActions-DOKkt2zo.cjs.map +0 -1
|
@@ -767,41 +767,93 @@ function createSectionStore(sections) {
|
|
|
767
767
|
} : section) }))
|
|
768
768
|
}));
|
|
769
769
|
}
|
|
770
|
-
function
|
|
771
|
-
const
|
|
772
|
-
|
|
770
|
+
function getHeaderBlockedTop(innerHeight, headerTopAreaRef) {
|
|
771
|
+
const blockedTop = headerTopAreaRef?.current?.offsetHeight ?? 0;
|
|
772
|
+
return Math.max(0, Math.min(innerHeight, blockedTop));
|
|
773
|
+
}
|
|
774
|
+
function getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef) {
|
|
775
|
+
return scrollY + getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
776
|
+
}
|
|
777
|
+
function getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef) {
|
|
778
|
+
const blockedTop = getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
779
|
+
return scrollY + Math.max(0, innerHeight - blockedTop);
|
|
780
|
+
}
|
|
781
|
+
function computeVisibleSections(sections, scrollY, viewportTop, viewportBottom) {
|
|
782
|
+
const visibleSections = [];
|
|
783
|
+
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex += 1) {
|
|
784
|
+
const { id, headingRef, offsetRem = 0 } = sections[sectionIndex];
|
|
785
|
+
if (!headingRef?.current) continue;
|
|
786
|
+
const offset = remToPx(offsetRem);
|
|
787
|
+
const sectionTop = headingRef.current.getBoundingClientRect().top + scrollY - offset;
|
|
788
|
+
if (sectionIndex === 0 && sectionTop > viewportTop) visibleSections.push("_top");
|
|
789
|
+
const nextSection = sections[sectionIndex + 1];
|
|
790
|
+
const nextOffset = remToPx(nextSection?.offsetRem ?? offsetRem);
|
|
791
|
+
if ((nextSection?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY - nextOffset > viewportTop && sectionTop < viewportBottom) visibleSections.push(id);
|
|
792
|
+
}
|
|
793
|
+
return visibleSections;
|
|
794
|
+
}
|
|
795
|
+
function useSectionVisibilityDebug(headerTopAreaRef) {
|
|
796
|
+
const lastDebugSignatureRef = (0, react.useRef)("");
|
|
797
|
+
return (snapshot) => {
|
|
798
|
+
const { scrollY, innerHeight, blockedTop, visibleSections } = snapshot;
|
|
799
|
+
const debugSignature = [
|
|
800
|
+
Math.round(scrollY),
|
|
801
|
+
innerHeight,
|
|
802
|
+
Math.round(blockedTop),
|
|
803
|
+
visibleSections.join(",")
|
|
804
|
+
].join("|");
|
|
805
|
+
if (lastDebugSignatureRef.current === debugSignature) return;
|
|
806
|
+
lastDebugSignatureRef.current = debugSignature;
|
|
807
|
+
console.info("[clarify][section-visibility]", {
|
|
808
|
+
...snapshot,
|
|
809
|
+
topAreaHeight: headerTopAreaRef?.current?.offsetHeight ?? 0
|
|
810
|
+
});
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
function useSectionVisibilityObserver(checkVisibleSections, headerTopAreaRef) {
|
|
773
814
|
(0, react.useEffect)(() => {
|
|
774
|
-
function checkVisibleSections() {
|
|
775
|
-
const { innerHeight, scrollY } = window;
|
|
776
|
-
const viewportTop = scrollY;
|
|
777
|
-
const viewportBottom = scrollY + innerHeight;
|
|
778
|
-
const newVisibleSections = [];
|
|
779
|
-
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex += 1) {
|
|
780
|
-
const { id, headingRef, offsetRem = 0 } = sections[sectionIndex];
|
|
781
|
-
if (!headingRef?.current) continue;
|
|
782
|
-
const offset = remToPx(offsetRem);
|
|
783
|
-
const top = headingRef.current.getBoundingClientRect().top + scrollY;
|
|
784
|
-
if (sectionIndex === 0 && top - offset > viewportTop) newVisibleSections.push("_top");
|
|
785
|
-
if ((sections[sectionIndex + 1]?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY > viewportTop && top < viewportBottom) newVisibleSections.push(id);
|
|
786
|
-
}
|
|
787
|
-
setVisibleSections(newVisibleSections);
|
|
788
|
-
}
|
|
789
815
|
const raf = window.requestAnimationFrame(() => checkVisibleSections());
|
|
790
816
|
window.addEventListener("scroll", checkVisibleSections, { passive: true });
|
|
791
817
|
window.addEventListener("resize", checkVisibleSections);
|
|
818
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(() => {
|
|
819
|
+
checkVisibleSections();
|
|
820
|
+
});
|
|
821
|
+
if (resizeObserver && headerTopAreaRef?.current) resizeObserver.observe(headerTopAreaRef.current);
|
|
792
822
|
return () => {
|
|
793
823
|
window.cancelAnimationFrame(raf);
|
|
794
824
|
window.removeEventListener("scroll", checkVisibleSections);
|
|
795
825
|
window.removeEventListener("resize", checkVisibleSections);
|
|
826
|
+
resizeObserver?.disconnect();
|
|
796
827
|
};
|
|
797
|
-
}, [
|
|
828
|
+
}, [checkVisibleSections, headerTopAreaRef]);
|
|
798
829
|
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
|
|
830
|
+
function useVisibleSections(sectionStore, headerTopAreaRef) {
|
|
831
|
+
const setVisibleSections = (0, zustand.useStore)(sectionStore, (state) => state.setVisibleSections);
|
|
832
|
+
const sections = (0, zustand.useStore)(sectionStore, (state) => state.sections);
|
|
833
|
+
const emitVisibilityDebug = useSectionVisibilityDebug(headerTopAreaRef);
|
|
834
|
+
useSectionVisibilityObserver((0, react.useCallback)(() => {
|
|
835
|
+
const { innerHeight, scrollY } = window;
|
|
836
|
+
const viewportTop = getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef);
|
|
837
|
+
const viewportBottom = getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef);
|
|
838
|
+
const blockedTop = getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
839
|
+
const newVisibleSections = computeVisibleSections(sections, scrollY, viewportTop, viewportBottom);
|
|
840
|
+
emitVisibilityDebug({
|
|
841
|
+
scrollY,
|
|
842
|
+
innerHeight,
|
|
843
|
+
blockedTop,
|
|
844
|
+
viewportTop,
|
|
845
|
+
viewportBottom,
|
|
846
|
+
visibleSections: newVisibleSections
|
|
847
|
+
});
|
|
848
|
+
setVisibleSections(newVisibleSections);
|
|
849
|
+
}, [
|
|
850
|
+
emitVisibilityDebug,
|
|
851
|
+
headerTopAreaRef,
|
|
852
|
+
sections,
|
|
853
|
+
setVisibleSections
|
|
854
|
+
]), headerTopAreaRef);
|
|
855
|
+
}
|
|
856
|
+
function useSyncSections(sectionStore, sections) {
|
|
805
857
|
useIsomorphicLayoutEffect(() => {
|
|
806
858
|
sectionStore.setState((state) => ({
|
|
807
859
|
sections: sections.map((section) => {
|
|
@@ -815,6 +867,14 @@ function SectionProvider(arg0) {
|
|
|
815
867
|
visibleSections: []
|
|
816
868
|
}));
|
|
817
869
|
}, [sectionStore, sections]);
|
|
870
|
+
}
|
|
871
|
+
var SectionStoreContext = (0, react.createContext)(null);
|
|
872
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
873
|
+
function SectionProvider(arg0) {
|
|
874
|
+
const { sections, headerTopAreaRef, children } = arg0;
|
|
875
|
+
const [sectionStore] = (0, react.useState)(() => createSectionStore(sections));
|
|
876
|
+
useVisibleSections(sectionStore, headerTopAreaRef);
|
|
877
|
+
useSyncSections(sectionStore, sections);
|
|
818
878
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionStoreContext.Provider, {
|
|
819
879
|
value: sectionStore,
|
|
820
880
|
children
|
|
@@ -1191,6 +1251,7 @@ function routeGroupTitles(navigation) {
|
|
|
1191
1251
|
function buildSearchItems(routes, navigation) {
|
|
1192
1252
|
const groupTitles = routeGroupTitles(navigation);
|
|
1193
1253
|
return routes.flatMap((route) => {
|
|
1254
|
+
if (route.isBareAlias) return [];
|
|
1194
1255
|
const groupTitle = groupTitles.get(route.path);
|
|
1195
1256
|
return [{
|
|
1196
1257
|
title: route.title,
|
|
@@ -1377,17 +1438,33 @@ function SearchResult(arg0) {
|
|
|
1377
1438
|
}
|
|
1378
1439
|
//#endregion
|
|
1379
1440
|
//#region source/shell/search/SearchDialog.tsx
|
|
1380
|
-
function
|
|
1381
|
-
const { open, setOpen
|
|
1382
|
-
const t = useBuiltInText();
|
|
1383
|
-
const navigate = (0, react_router_dom.useNavigate)();
|
|
1441
|
+
function useSearchDialogLifecycle(arg0) {
|
|
1442
|
+
const { open, setOpen } = arg0;
|
|
1384
1443
|
const location = (0, react_router_dom.useLocation)();
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1444
|
+
(0, react.useEffect)(() => {
|
|
1445
|
+
setOpen(false);
|
|
1446
|
+
}, [
|
|
1447
|
+
location.pathname,
|
|
1448
|
+
location.search,
|
|
1449
|
+
location.hash,
|
|
1450
|
+
setOpen
|
|
1451
|
+
]);
|
|
1452
|
+
(0, react.useEffect)(() => {
|
|
1453
|
+
if (open) return void 0;
|
|
1454
|
+
function onKeyDown(event) {
|
|
1455
|
+
if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
|
|
1456
|
+
event.preventDefault();
|
|
1457
|
+
setOpen(true);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
window.addEventListener("keydown", onKeyDown);
|
|
1461
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1462
|
+
}, [open, setOpen]);
|
|
1463
|
+
}
|
|
1464
|
+
function useSearchData(arg0) {
|
|
1465
|
+
const { query, searchItems, routePrefix, currentLocale } = arg0;
|
|
1388
1466
|
const [fullTextState, setFullTextState] = (0, react.useState)(null);
|
|
1389
1467
|
const [pagefindState, setPagefindState] = (0, react.useState)(null);
|
|
1390
|
-
const searchItems = (0, react.useMemo)(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1391
1468
|
const quickResults = (0, react.useMemo)(() => {
|
|
1392
1469
|
const normalizedQuery = query.trim().toLowerCase();
|
|
1393
1470
|
if (!normalizedQuery) return [];
|
|
@@ -1404,15 +1481,7 @@ function SearchDialog(arg0) {
|
|
|
1404
1481
|
const fullTextKey = `${pagefindKey}:${trimmedQuery}`;
|
|
1405
1482
|
const results = (fullTextState?.key === fullTextKey ? fullTextState.results : null) ?? quickResults;
|
|
1406
1483
|
const searchInputLoading = pagefindAvailable === null || Boolean(trimmedQuery && pagefind && fullTextState?.key !== fullTextKey);
|
|
1407
|
-
const showNoResults = query && results.length === 0 && pagefindAvailable !== null;
|
|
1408
|
-
(0, react.useEffect)(() => {
|
|
1409
|
-
setOpen(false);
|
|
1410
|
-
}, [
|
|
1411
|
-
location.pathname,
|
|
1412
|
-
location.search,
|
|
1413
|
-
location.hash,
|
|
1414
|
-
setOpen
|
|
1415
|
-
]);
|
|
1484
|
+
const showNoResults = Boolean(query.trim()) && results.length === 0 && pagefindAvailable !== null;
|
|
1416
1485
|
(0, react.useEffect)(() => {
|
|
1417
1486
|
let cancelled = false;
|
|
1418
1487
|
loadPagefind(routePrefix, currentLocale).then((loadedPagefind) => {
|
|
@@ -1475,17 +1544,30 @@ function SearchDialog(arg0) {
|
|
|
1475
1544
|
routePrefix,
|
|
1476
1545
|
trimmedQuery
|
|
1477
1546
|
]);
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1547
|
+
return {
|
|
1548
|
+
results,
|
|
1549
|
+
searchInputLoading,
|
|
1550
|
+
showNoResults
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
function SearchDialog(arg0) {
|
|
1554
|
+
const { open, setOpen, routes, navigation, routePrefix = "/", currentLocale, className, onNavigate = () => {} } = arg0;
|
|
1555
|
+
const t = useBuiltInText();
|
|
1556
|
+
const navigate = (0, react_router_dom.useNavigate)();
|
|
1557
|
+
const inputRef = (0, react.useRef)(null);
|
|
1558
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
1559
|
+
const [activeIndex, setActiveIndex] = (0, react.useState)(0);
|
|
1560
|
+
const searchItems = (0, react.useMemo)(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1561
|
+
useSearchDialogLifecycle({
|
|
1562
|
+
open,
|
|
1563
|
+
setOpen
|
|
1564
|
+
});
|
|
1565
|
+
const { results, searchInputLoading, showNoResults } = useSearchData({
|
|
1566
|
+
query,
|
|
1567
|
+
searchItems,
|
|
1568
|
+
routePrefix,
|
|
1569
|
+
currentLocale
|
|
1570
|
+
});
|
|
1489
1571
|
const updateQuery = (value) => {
|
|
1490
1572
|
setQuery(value);
|
|
1491
1573
|
setActiveIndex(0);
|
|
@@ -1500,6 +1582,29 @@ function SearchDialog(arg0) {
|
|
|
1500
1582
|
onNavigate();
|
|
1501
1583
|
closeDialog();
|
|
1502
1584
|
}
|
|
1585
|
+
function renderResultsPanel() {
|
|
1586
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1587
|
+
className: "border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5",
|
|
1588
|
+
children: [showNoResults ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1589
|
+
className: "p-6 text-center",
|
|
1590
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SearchX, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1591
|
+
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
1592
|
+
children: t("search.noResults", { query })
|
|
1593
|
+
})]
|
|
1594
|
+
}) : null, results.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1595
|
+
id: "clarify-search-results",
|
|
1596
|
+
className: "clarify-search-results",
|
|
1597
|
+
role: "listbox",
|
|
1598
|
+
children: results.map((result, resultIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchResult, {
|
|
1599
|
+
result,
|
|
1600
|
+
query,
|
|
1601
|
+
active: resultIndex === activeIndex,
|
|
1602
|
+
onActive: () => setActiveIndex(resultIndex),
|
|
1603
|
+
onSelect: () => selectResult(result)
|
|
1604
|
+
}, result.type === "full-text" ? result.id : result.url))
|
|
1605
|
+
}) : null]
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1503
1608
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Dialog, {
|
|
1504
1609
|
open,
|
|
1505
1610
|
onClose: closeDialog,
|
|
@@ -1529,27 +1634,7 @@ function SearchDialog(arg0) {
|
|
|
1529
1634
|
onClose: closeDialog,
|
|
1530
1635
|
onSubmit: () => selectResult(),
|
|
1531
1636
|
loading: searchInputLoading
|
|
1532
|
-
}),
|
|
1533
|
-
className: "border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5",
|
|
1534
|
-
children: [showNoResults ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1535
|
-
className: "p-6 text-center",
|
|
1536
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SearchX, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1537
|
-
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
1538
|
-
children: t("search.noResults", { query })
|
|
1539
|
-
})]
|
|
1540
|
-
}) : null, results.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1541
|
-
id: "clarify-search-results",
|
|
1542
|
-
className: "clarify-search-results",
|
|
1543
|
-
role: "listbox",
|
|
1544
|
-
children: results.map((result, resultIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchResult, {
|
|
1545
|
-
result,
|
|
1546
|
-
query,
|
|
1547
|
-
active: resultIndex === activeIndex,
|
|
1548
|
-
onActive: () => setActiveIndex(resultIndex),
|
|
1549
|
-
onSelect: () => selectResult(result)
|
|
1550
|
-
}, result.type === "full-text" ? result.id : result.url))
|
|
1551
|
-
}) : null]
|
|
1552
|
-
})]
|
|
1637
|
+
}), renderResultsPanel()]
|
|
1553
1638
|
})
|
|
1554
1639
|
})]
|
|
1555
1640
|
});
|
|
@@ -1792,6 +1877,7 @@ function ProductTabs(arg0) {
|
|
|
1792
1877
|
const pathname = normalizeRoutePath((0, react_router_dom.useLocation)().pathname);
|
|
1793
1878
|
if (!tabs?.length) return null;
|
|
1794
1879
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1880
|
+
"data-clarify-header-tabs": true,
|
|
1795
1881
|
className: "clarify-product-tabs hidden h-14 border-t border-(--clarify-theme-tokens-colors-border) lg:block dark:border-white/10",
|
|
1796
1882
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1797
1883
|
className: "clarify-product-tabs-nav mx-auto flex h-full w-full max-w-(--clarify-theme-layout-max-width) items-stretch gap-6 overflow-x-auto px-5",
|
|
@@ -1824,7 +1910,7 @@ function ProductTabs(arg0) {
|
|
|
1824
1910
|
});
|
|
1825
1911
|
}
|
|
1826
1912
|
var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
1827
|
-
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, className, ...props } = arg0;
|
|
1913
|
+
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, topAreaRef, className, ...props } = arg0;
|
|
1828
1914
|
const t = useBuiltInText();
|
|
1829
1915
|
const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
|
|
1830
1916
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
@@ -1833,7 +1919,121 @@ var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
|
1833
1919
|
const { scrollY } = (0, framer_motion.useScroll)();
|
|
1834
1920
|
const bgOpacityLight = (0, framer_motion.useTransform)(scrollY, [0, 72], ["70%", "95%"]);
|
|
1835
1921
|
const bgOpacityDark = (0, framer_motion.useTransform)(scrollY, [0, 72], ["60%", "92%"]);
|
|
1836
|
-
|
|
1922
|
+
const hasNavbarLinks = Boolean(config.navbar?.links?.length);
|
|
1923
|
+
function renderBrand() {
|
|
1924
|
+
if (homeExternal) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1925
|
+
as: "a",
|
|
1926
|
+
href: homeHref,
|
|
1927
|
+
"aria-label": t("navbar.home"),
|
|
1928
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1929
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1930
|
+
logo: config.logo,
|
|
1931
|
+
className: "h-6 w-auto shrink-0 object-contain"
|
|
1932
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1933
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
1934
|
+
children: config.title
|
|
1935
|
+
})]
|
|
1936
|
+
});
|
|
1937
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1938
|
+
as: react_router_dom.Link,
|
|
1939
|
+
to: homeHref,
|
|
1940
|
+
"aria-label": t("navbar.home"),
|
|
1941
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1942
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1943
|
+
logo: config.logo,
|
|
1944
|
+
className: "h-6 w-auto shrink-0 object-contain"
|
|
1945
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1946
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
1947
|
+
children: config.title
|
|
1948
|
+
})]
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
function renderTopLinks() {
|
|
1952
|
+
if (!hasNavbarLinks) return null;
|
|
1953
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1954
|
+
className: "clarify-top-nav hidden md:block",
|
|
1955
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1956
|
+
role: "list",
|
|
1957
|
+
className: "flex items-center gap-8",
|
|
1958
|
+
children: config.navbar?.links?.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TopLevelNavItem, {
|
|
1959
|
+
href: localizeHref(link.href, config, currentLocale),
|
|
1960
|
+
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1961
|
+
}, link.href))
|
|
1962
|
+
})
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
function renderHeaderActions() {
|
|
1966
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1967
|
+
className: "clarify-header-actions flex shrink-0 items-center gap-5",
|
|
1968
|
+
children: [
|
|
1969
|
+
renderTopLinks(),
|
|
1970
|
+
hasNavbarLinks ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "hidden md:block md:h-5 md:w-px md:bg-(--clarify-theme-tokens-colors-border) md:dark:bg-white/15" }) : null,
|
|
1971
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSearch, {
|
|
1972
|
+
routes,
|
|
1973
|
+
navigation,
|
|
1974
|
+
routePrefix: config.routePrefix,
|
|
1975
|
+
currentLocale
|
|
1976
|
+
}),
|
|
1977
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguageSwitcher, {
|
|
1978
|
+
config,
|
|
1979
|
+
currentLocale,
|
|
1980
|
+
currentRoute
|
|
1981
|
+
}),
|
|
1982
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeToggle, {}),
|
|
1983
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavbarMenu, {
|
|
1984
|
+
links: config.navbar?.links,
|
|
1985
|
+
config,
|
|
1986
|
+
currentLocale
|
|
1987
|
+
})
|
|
1988
|
+
]
|
|
1989
|
+
});
|
|
1990
|
+
}
|
|
1991
|
+
function renderHeaderMain() {
|
|
1992
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1993
|
+
"data-clarify-header-main": true,
|
|
1994
|
+
className: (0, clsx.default)("clarify-header-main relative mx-auto flex h-14 w-full max-w-(--clarify-theme-layout-max-width) items-center justify-between gap-6 px-4 sm:px-6 lg:px-5", (isInsideMobileNavigation || !mobileNavIsOpen) && "shadow-none"),
|
|
1995
|
+
children: [
|
|
1996
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1997
|
+
className: "clarify-header-left flex min-w-0 items-center gap-5",
|
|
1998
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1999
|
+
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
2000
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavigation, {
|
|
2001
|
+
config,
|
|
2002
|
+
navigation,
|
|
2003
|
+
tabs,
|
|
2004
|
+
routes,
|
|
2005
|
+
currentLocale,
|
|
2006
|
+
currentRoute
|
|
2007
|
+
})
|
|
2008
|
+
}), renderBrand()]
|
|
2009
|
+
}),
|
|
2010
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2011
|
+
className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
|
|
2012
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
|
|
2013
|
+
routes,
|
|
2014
|
+
navigation,
|
|
2015
|
+
routePrefix: config.routePrefix,
|
|
2016
|
+
currentLocale
|
|
2017
|
+
})
|
|
2018
|
+
}),
|
|
2019
|
+
renderHeaderActions()
|
|
2020
|
+
]
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
function renderTopArea() {
|
|
2024
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2025
|
+
ref: topAreaRef,
|
|
2026
|
+
children: [
|
|
2027
|
+
renderHeaderMain(),
|
|
2028
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2029
|
+
"data-clarify-header-banner": true,
|
|
2030
|
+
children: banner
|
|
2031
|
+
}),
|
|
2032
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, { tabs })
|
|
2033
|
+
]
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.header, {
|
|
1837
2037
|
...props,
|
|
1838
2038
|
ref,
|
|
1839
2039
|
"data-pagefind-ignore": true,
|
|
@@ -1842,96 +2042,7 @@ var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
|
1842
2042
|
"--bg-opacity-light": bgOpacityLight,
|
|
1843
2043
|
"--bg-opacity-dark": bgOpacityDark
|
|
1844
2044
|
},
|
|
1845
|
-
children:
|
|
1846
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1847
|
-
className: (0, clsx.default)("clarify-header-main relative mx-auto flex h-14 w-full max-w-(--clarify-theme-layout-max-width) items-center justify-between gap-6 px-4 sm:px-6 lg:px-5", (isInsideMobileNavigation || !mobileNavIsOpen) && "shadow-none"),
|
|
1848
|
-
children: [
|
|
1849
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1850
|
-
className: "clarify-header-left flex min-w-0 items-center gap-5",
|
|
1851
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1852
|
-
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
1853
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavigation, {
|
|
1854
|
-
config,
|
|
1855
|
-
navigation,
|
|
1856
|
-
tabs,
|
|
1857
|
-
routes,
|
|
1858
|
-
currentLocale,
|
|
1859
|
-
currentRoute
|
|
1860
|
-
})
|
|
1861
|
-
}), homeExternal ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1862
|
-
as: "a",
|
|
1863
|
-
href: homeHref,
|
|
1864
|
-
"aria-label": t("navbar.home"),
|
|
1865
|
-
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1866
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1867
|
-
logo: config.logo,
|
|
1868
|
-
className: "h-6 w-auto shrink-0 object-contain"
|
|
1869
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1870
|
-
className: "clarify-brand-title truncate font-semibold",
|
|
1871
|
-
children: config.title
|
|
1872
|
-
})]
|
|
1873
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1874
|
-
as: react_router_dom.Link,
|
|
1875
|
-
to: homeHref,
|
|
1876
|
-
"aria-label": t("navbar.home"),
|
|
1877
|
-
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1878
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1879
|
-
logo: config.logo,
|
|
1880
|
-
className: "h-6 w-auto shrink-0 object-contain"
|
|
1881
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1882
|
-
className: "clarify-brand-title truncate font-semibold",
|
|
1883
|
-
children: config.title
|
|
1884
|
-
})]
|
|
1885
|
-
})]
|
|
1886
|
-
}),
|
|
1887
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1888
|
-
className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
|
|
1889
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
|
|
1890
|
-
routes,
|
|
1891
|
-
navigation,
|
|
1892
|
-
routePrefix: config.routePrefix,
|
|
1893
|
-
currentLocale
|
|
1894
|
-
})
|
|
1895
|
-
}),
|
|
1896
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1897
|
-
className: "clarify-header-actions flex shrink-0 items-center gap-5",
|
|
1898
|
-
children: [
|
|
1899
|
-
config.navbar?.links?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1900
|
-
className: "clarify-top-nav hidden md:block",
|
|
1901
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1902
|
-
role: "list",
|
|
1903
|
-
className: "flex items-center gap-8",
|
|
1904
|
-
children: config.navbar.links.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TopLevelNavItem, {
|
|
1905
|
-
href: localizeHref(link.href, config, currentLocale),
|
|
1906
|
-
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1907
|
-
}, link.href))
|
|
1908
|
-
})
|
|
1909
|
-
}) : null,
|
|
1910
|
-
config.navbar?.links?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "hidden md:block md:h-5 md:w-px md:bg-(--clarify-theme-tokens-colors-border) md:dark:bg-white/15" }) : null,
|
|
1911
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSearch, {
|
|
1912
|
-
routes,
|
|
1913
|
-
navigation,
|
|
1914
|
-
routePrefix: config.routePrefix,
|
|
1915
|
-
currentLocale
|
|
1916
|
-
}),
|
|
1917
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguageSwitcher, {
|
|
1918
|
-
config,
|
|
1919
|
-
currentLocale,
|
|
1920
|
-
currentRoute
|
|
1921
|
-
}),
|
|
1922
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeToggle, {}),
|
|
1923
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavbarMenu, {
|
|
1924
|
-
links: config.navbar?.links,
|
|
1925
|
-
config,
|
|
1926
|
-
currentLocale
|
|
1927
|
-
})
|
|
1928
|
-
]
|
|
1929
|
-
})
|
|
1930
|
-
]
|
|
1931
|
-
}),
|
|
1932
|
-
banner,
|
|
1933
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, { tabs })
|
|
1934
|
-
]
|
|
2045
|
+
children: renderTopArea()
|
|
1935
2046
|
});
|
|
1936
2047
|
});
|
|
1937
2048
|
//#endregion
|
|
@@ -2160,4 +2271,4 @@ Object.defineProperty(exports, "useTheme", {
|
|
|
2160
2271
|
}
|
|
2161
2272
|
});
|
|
2162
2273
|
|
|
2163
|
-
//# sourceMappingURL=PageActions-
|
|
2274
|
+
//# sourceMappingURL=PageActions-B08cDCzq.cjs.map
|