@rspress/core 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -11
- package/dist/index.js.map +1 -1
- package/dist/loader.js +2 -2
- package/dist/loader.js.map +1 -1
- package/dist/runtime/App.js +89 -0
- package/dist/runtime/Content.js +20 -0
- package/dist/runtime/NoSSR.js +16 -0
- package/dist/runtime/clientEntry.js +52 -0
- package/dist/runtime/hooks.js +20 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/ssrEntry.js +30 -0
- package/dist/runtime/utils.js +15 -0
- package/dist/theme/bundle.css +44 -19
- package/dist/theme/bundle.js +41 -38
- package/dist/theme/bundle.js.map +1 -1
- package/package.json +13 -13
- package/src/runtime/App.tsx +3 -1
- package/src/runtime/clientEntry.tsx +3 -1
- package/src/theme-default/components/HomeHero/index.tsx +2 -2
- package/src/theme-default/components/Sidebar/index.module.scss +6 -0
- package/src/theme-default/components/Tabs/index.module.scss +32 -6
- package/src/theme-default/components/Tabs/index.tsx +41 -39
- package/src/theme-default/styles/vars.css +7 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import siteData from "virtual-site-data";
|
|
3
|
+
import { matchRoutes, useLocation } from "react-router-dom";
|
|
4
|
+
import { HelmetProvider } from "react-helmet-async";
|
|
5
|
+
import { useContext, useLayoutEffect } from "react";
|
|
6
|
+
import { cleanUrl, isProduction } from "@rspress/shared";
|
|
7
|
+
import { isEqualPath, normalizeRoutePath } from "./utils";
|
|
8
|
+
import { DataContext } from "./hooks";
|
|
9
|
+
import "virtual-global-styles";
|
|
10
|
+
const { default: Theme } = require("@theme");
|
|
11
|
+
export async function initPageData(routePath) {
|
|
12
|
+
const { routes } = process.env.__SSR__ ? require("virtual-routes-ssr") : require("virtual-routes");
|
|
13
|
+
const matched = matchRoutes(routes, routePath);
|
|
14
|
+
if (matched) {
|
|
15
|
+
const matchedRoute = matched[0].route;
|
|
16
|
+
const mod = await matchedRoute.preload();
|
|
17
|
+
const pagePath = cleanUrl(matched[0].route.filePath);
|
|
18
|
+
const extractPageInfo = siteData.pages.find((page) => {
|
|
19
|
+
const normalize = (p) => (
|
|
20
|
+
// compat the path that has no / suffix
|
|
21
|
+
p.replace(/\/$/, "")
|
|
22
|
+
);
|
|
23
|
+
return isEqualPath(normalize(page.routePath), normalize(routePath));
|
|
24
|
+
});
|
|
25
|
+
const encodedPagePath = encodeURIComponent(pagePath);
|
|
26
|
+
let {
|
|
27
|
+
// eslint-disable-next-line prefer-const
|
|
28
|
+
toc = [],
|
|
29
|
+
// eslint-disable-next-line prefer-const
|
|
30
|
+
title = "",
|
|
31
|
+
frontmatter
|
|
32
|
+
} = globalThis.__RSPRESS_PAGE_META?.[encodedPagePath] || {};
|
|
33
|
+
frontmatter = frontmatter || mod.frontmatter || {};
|
|
34
|
+
return {
|
|
35
|
+
siteData,
|
|
36
|
+
page: {
|
|
37
|
+
pagePath,
|
|
38
|
+
...extractPageInfo,
|
|
39
|
+
pageType: frontmatter?.pageType || "doc",
|
|
40
|
+
title,
|
|
41
|
+
frontmatter,
|
|
42
|
+
// Trade off:
|
|
43
|
+
// 1. the `extractPageInfo` includes complete toc even if import doc fragments, because we use `flattenMdxContent` function to make all doc fragments' toc included.However, it is only computed once when build
|
|
44
|
+
// 2. the mod.toc is not complete toc, but it is computed every time through loader when doc changed
|
|
45
|
+
// We choose the better solutions for different environments:
|
|
46
|
+
// In production, we use the extractPageInfo.toc to ensure the toc is complete and accurate.
|
|
47
|
+
// In development, we use the mod.toc to ensure the toc is up to date to ensure DX.However, we cannot ensure the complete toc info when including doc fragments.
|
|
48
|
+
toc: isProduction() ? extractPageInfo?.toc : toc
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
} else {
|
|
52
|
+
return {
|
|
53
|
+
siteData,
|
|
54
|
+
page: {
|
|
55
|
+
pagePath: "",
|
|
56
|
+
pageType: "404",
|
|
57
|
+
routePath: "/404",
|
|
58
|
+
lang: siteData.lang || "",
|
|
59
|
+
frontmatter: {},
|
|
60
|
+
title: "404",
|
|
61
|
+
toc: [],
|
|
62
|
+
_filepath: "",
|
|
63
|
+
_relativePath: ""
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export function App({ helmetContext }) {
|
|
69
|
+
const { setData: setPageData } = useContext(DataContext);
|
|
70
|
+
const { pathname } = useLocation();
|
|
71
|
+
useLayoutEffect(() => {
|
|
72
|
+
async function refetchData() {
|
|
73
|
+
try {
|
|
74
|
+
const pageData = await initPageData(normalizeRoutePath(pathname));
|
|
75
|
+
setPageData(pageData);
|
|
76
|
+
} catch (e) {
|
|
77
|
+
console.log(e);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
refetchData();
|
|
81
|
+
}, [
|
|
82
|
+
pathname,
|
|
83
|
+
setPageData
|
|
84
|
+
]);
|
|
85
|
+
return /* @__PURE__ */ _jsx(HelmetProvider, {
|
|
86
|
+
context: helmetContext,
|
|
87
|
+
children: /* @__PURE__ */ _jsx(Theme.Layout, {})
|
|
88
|
+
});
|
|
89
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense } from "react";
|
|
3
|
+
import { matchRoutes, useLocation } from "react-router-dom";
|
|
4
|
+
import { normalizeRoutePath } from "./utils";
|
|
5
|
+
const { routes } = process.env.__SSR__ ? require("virtual-routes-ssr") : require("virtual-routes");
|
|
6
|
+
export const Content = ({ fallback = /* @__PURE__ */ _jsx(_Fragment, {}) }) => {
|
|
7
|
+
const { pathname } = useLocation();
|
|
8
|
+
const matched = matchRoutes(routes, normalizeRoutePath(pathname));
|
|
9
|
+
if (!matched) {
|
|
10
|
+
return /* @__PURE__ */ _jsx("div", {});
|
|
11
|
+
}
|
|
12
|
+
const routesElement = matched[0].route.element;
|
|
13
|
+
if (!process.env.__IS_REACT_18__ && process.env.__SSR__) {
|
|
14
|
+
return routesElement;
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ _jsx(Suspense, {
|
|
17
|
+
fallback,
|
|
18
|
+
children: routesElement
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
export function NoSSR(props) {
|
|
4
|
+
const { children } = props;
|
|
5
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
setIsMounted(true);
|
|
8
|
+
}, []);
|
|
9
|
+
if (!isMounted) {
|
|
10
|
+
return null;
|
|
11
|
+
} else {
|
|
12
|
+
return /* @__PURE__ */ _jsx(_Fragment, {
|
|
13
|
+
children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { BrowserRouter } from "react-router-dom";
|
|
4
|
+
import { isProduction } from "@rspress/shared";
|
|
5
|
+
import { App, initPageData } from "./App";
|
|
6
|
+
import { DataContext, ThemeContext } from "./hooks";
|
|
7
|
+
import { normalizeRoutePath } from "./utils";
|
|
8
|
+
const { default: Theme } = require("@theme");
|
|
9
|
+
export async function renderInBrowser() {
|
|
10
|
+
const container = document.getElementById("root");
|
|
11
|
+
const enhancedApp = async () => {
|
|
12
|
+
const initialPageData = await initPageData(normalizeRoutePath(window.location.pathname));
|
|
13
|
+
return function RootApp2() {
|
|
14
|
+
const [data, setData] = useState(initialPageData);
|
|
15
|
+
const [theme, setTheme] = useState("light");
|
|
16
|
+
return /* @__PURE__ */ _jsx(ThemeContext.Provider, {
|
|
17
|
+
value: {
|
|
18
|
+
theme,
|
|
19
|
+
setTheme
|
|
20
|
+
},
|
|
21
|
+
children: /* @__PURE__ */ _jsx(DataContext.Provider, {
|
|
22
|
+
value: {
|
|
23
|
+
data,
|
|
24
|
+
setData
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ _jsx(BrowserRouter, {
|
|
27
|
+
children: /* @__PURE__ */ _jsx(App, {})
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const RootApp = await enhancedApp();
|
|
34
|
+
if (process.env.__IS_REACT_18__) {
|
|
35
|
+
const { createRoot, hydrateRoot } = require("react-dom/client");
|
|
36
|
+
if (isProduction()) {
|
|
37
|
+
hydrateRoot(container, /* @__PURE__ */ _jsx(RootApp, {}));
|
|
38
|
+
} else {
|
|
39
|
+
createRoot(container).render(/* @__PURE__ */ _jsx(RootApp, {}));
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
const ReactDOM = require("react-dom");
|
|
43
|
+
if (isProduction()) {
|
|
44
|
+
ReactDOM.hydrate(/* @__PURE__ */ _jsx(RootApp, {}), container);
|
|
45
|
+
} else {
|
|
46
|
+
ReactDOM.render(/* @__PURE__ */ _jsx(RootApp, {}), container);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
renderInBrowser().then(() => {
|
|
51
|
+
Theme.setup();
|
|
52
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import i18nTextData from "virtual-i18n-text";
|
|
3
|
+
export const DataContext = createContext({});
|
|
4
|
+
export const ThemeContext = createContext({});
|
|
5
|
+
export function usePageData() {
|
|
6
|
+
const ctx = useContext(DataContext);
|
|
7
|
+
return ctx.data;
|
|
8
|
+
}
|
|
9
|
+
export function useLang() {
|
|
10
|
+
const ctx = useContext(DataContext);
|
|
11
|
+
return ctx.data.page.lang || "";
|
|
12
|
+
}
|
|
13
|
+
export function useDark() {
|
|
14
|
+
const ctx = useContext(ThemeContext);
|
|
15
|
+
return ctx.theme === "dark";
|
|
16
|
+
}
|
|
17
|
+
export function useI18n() {
|
|
18
|
+
const lang = useLang();
|
|
19
|
+
return (key) => i18nTextData[key][lang];
|
|
20
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./hooks";
|
|
2
|
+
export * from "./Content";
|
|
3
|
+
export { normalizeHref, withBase, removeBase, addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeRoutePath, isEqualPath } from "./utils";
|
|
4
|
+
export { useLocation, useNavigate } from "react-router-dom";
|
|
5
|
+
export { Helmet } from "react-helmet-async";
|
|
6
|
+
export { NoSSR } from "./NoSSR";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { renderToString } from "react-dom/server";
|
|
3
|
+
import { StaticRouter } from "react-router-dom/server";
|
|
4
|
+
import { App, initPageData } from "./App";
|
|
5
|
+
import { DataContext, ThemeContext } from "./hooks";
|
|
6
|
+
const DEFAULT_THEME = "light";
|
|
7
|
+
export async function render(pagePath, helmetContext) {
|
|
8
|
+
const initialPageData = await initPageData(pagePath);
|
|
9
|
+
const appHtml = renderToString(/* @__PURE__ */ _jsx(ThemeContext.Provider, {
|
|
10
|
+
value: {
|
|
11
|
+
theme: DEFAULT_THEME
|
|
12
|
+
},
|
|
13
|
+
children: /* @__PURE__ */ _jsx(DataContext.Provider, {
|
|
14
|
+
value: {
|
|
15
|
+
data: initialPageData
|
|
16
|
+
},
|
|
17
|
+
children: /* @__PURE__ */ _jsx(StaticRouter, {
|
|
18
|
+
location: pagePath,
|
|
19
|
+
children: /* @__PURE__ */ _jsx(App, {
|
|
20
|
+
helmetContext
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
}));
|
|
25
|
+
return {
|
|
26
|
+
appHtml,
|
|
27
|
+
pageData: initialPageData
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export { routes } from "virtual-routes-ssr";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import siteData from "virtual-site-data";
|
|
2
|
+
import { addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeHref, withBase as rawWithBase, removeBase as rawRemoveBase } from "@rspress/shared";
|
|
3
|
+
export function normalizeRoutePath(routePath) {
|
|
4
|
+
return decodeURIComponent(routePath).replace(/\.html$/, "").replace(/\/index$/, "/");
|
|
5
|
+
}
|
|
6
|
+
export function withBase(url = "/") {
|
|
7
|
+
return rawWithBase(url, siteData.base);
|
|
8
|
+
}
|
|
9
|
+
export function removeBase(url) {
|
|
10
|
+
return rawRemoveBase(url, siteData.base);
|
|
11
|
+
}
|
|
12
|
+
export function isEqualPath(a, b) {
|
|
13
|
+
return withBase(normalizeHref(a)) === withBase(normalizeHref(b));
|
|
14
|
+
}
|
|
15
|
+
export { addLeadingSlash, removeTrailingSlash, normalizeSlash, isProduction, normalizeHref };
|
package/dist/theme/bundle.css
CHANGED
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
--rp-c-gray-light-3: #d1d1d1;
|
|
27
27
|
--rp-c-gray-light-4: #e5e5e5;
|
|
28
28
|
--rp-c-gray-light-5: #f2f2f2;
|
|
29
|
+
--rp-c-dark: #000000;
|
|
30
|
+
--rp-c-dark-light-1: #2f2f2f;
|
|
31
|
+
--rp-c-dark-light-2: #3a3a3a;
|
|
32
|
+
--rp-c-dark-light-3: #4a4a4a;
|
|
33
|
+
--rp-c-dark-light-4: #5c5c5c;
|
|
34
|
+
--rp-c-dark-light-5: #6b6b6b;
|
|
29
35
|
}
|
|
30
36
|
.dark {
|
|
31
37
|
--rp-c-bg: #000;
|
|
@@ -552,6 +558,9 @@ video {
|
|
|
552
558
|
.h-full {
|
|
553
559
|
height: 100%;
|
|
554
560
|
}
|
|
561
|
+
.min-h-\[50vh\] {
|
|
562
|
+
min-height: 50vh;
|
|
563
|
+
}
|
|
555
564
|
.w-12 {
|
|
556
565
|
width: 3rem;
|
|
557
566
|
}
|
|
@@ -567,12 +576,6 @@ video {
|
|
|
567
576
|
.w-full {
|
|
568
577
|
width: 100%;
|
|
569
578
|
}
|
|
570
|
-
.w-max {
|
|
571
|
-
width: max-content;
|
|
572
|
-
}
|
|
573
|
-
.min-w-full {
|
|
574
|
-
min-width: 100%;
|
|
575
|
-
}
|
|
576
579
|
.max-w-6xl {
|
|
577
580
|
max-width: 72rem;
|
|
578
581
|
}
|
|
@@ -672,9 +675,6 @@ video {
|
|
|
672
675
|
.border {
|
|
673
676
|
border-width: 1px;
|
|
674
677
|
}
|
|
675
|
-
.border-b {
|
|
676
|
-
border-bottom-width: 1px;
|
|
677
|
-
}
|
|
678
678
|
.border-l-2 {
|
|
679
679
|
border-left-width: 2px;
|
|
680
680
|
}
|
|
@@ -1199,8 +1199,8 @@ button:focus-visible {
|
|
|
1199
1199
|
.md\:pb-3 {
|
|
1200
1200
|
padding-bottom: 0.75rem;
|
|
1201
1201
|
}
|
|
1202
|
-
.md\:pt-
|
|
1203
|
-
padding-top:
|
|
1202
|
+
.md\:pt-16 {
|
|
1203
|
+
padding-top: 4rem;
|
|
1204
1204
|
}
|
|
1205
1205
|
.md\:text-2xl {
|
|
1206
1206
|
font-size: 1.5rem;
|
|
@@ -1573,7 +1573,7 @@ button:focus-visible {
|
|
|
1573
1573
|
transition: color 0.25s;
|
|
1574
1574
|
}
|
|
1575
1575
|
|
|
1576
|
-
/* src/theme-default/components/Sidebar/index.module.scss?css_virtual&hash=
|
|
1576
|
+
/* src/theme-default/components/Sidebar/index.module.scss?css_virtual&hash=1e50b22992d3cc70c0758d47a8be6804 */
|
|
1577
1577
|
.sidebar_74484 {
|
|
1578
1578
|
position: fixed;
|
|
1579
1579
|
top: 0;
|
|
@@ -1669,6 +1669,9 @@ button:focus-visible {
|
|
|
1669
1669
|
height: 100%;
|
|
1670
1670
|
background-color: var(--rp-c-gray-light-4);
|
|
1671
1671
|
}
|
|
1672
|
+
.dark .rspress-sidebar-group::before {
|
|
1673
|
+
background-color: var(--rp-c-bg-mute);
|
|
1674
|
+
}
|
|
1672
1675
|
|
|
1673
1676
|
/* src/theme-default/components/LocalSideBar/index.module.scss?css_virtual&hash=8ee65aa6fc817c893cd6d70fa6feed70 */
|
|
1674
1677
|
.localNav_dce60 {
|
|
@@ -2345,25 +2348,47 @@ button:focus-visible {
|
|
|
2345
2348
|
transform: translateX(4px);
|
|
2346
2349
|
}
|
|
2347
2350
|
|
|
2348
|
-
/* src/theme-default/components/Tabs/index.module.scss?css_virtual&hash=
|
|
2351
|
+
/* src/theme-default/components/Tabs/index.module.scss?css_virtual&hash=c9e818d0bb47534fff6481cd9a970a36 */
|
|
2352
|
+
.container_7e0fb {
|
|
2353
|
+
border: 1px solid var(--rp-c-gray-light-3);
|
|
2354
|
+
border-radius: 8px;
|
|
2355
|
+
}
|
|
2356
|
+
.dark .container_7e0fb {
|
|
2357
|
+
border-color: var(--rp-c-dark-light-1);
|
|
2358
|
+
}
|
|
2359
|
+
.tab-list_7e0fb {
|
|
2360
|
+
padding-left: 8px;
|
|
2361
|
+
padding-top: 4px;
|
|
2362
|
+
display: flex;
|
|
2363
|
+
min-width: 100%;
|
|
2364
|
+
border-bottom-width: 1px;
|
|
2365
|
+
border-color: var(--rp-c-gray-light-3);
|
|
2366
|
+
}
|
|
2367
|
+
.dark .tab-list_7e0fb {
|
|
2368
|
+
border-color: var(--rp-c-dark-light-1);
|
|
2369
|
+
}
|
|
2349
2370
|
.tab_7e0fb {
|
|
2350
2371
|
color: var(--rp-c-text-2);
|
|
2351
|
-
border-bottom:
|
|
2372
|
+
border-bottom: 1px solid transparent;
|
|
2352
2373
|
box-sizing: border-box;
|
|
2353
2374
|
margin-right: 10px;
|
|
2354
|
-
padding:
|
|
2355
|
-
transition: colors 0.2s;
|
|
2375
|
+
padding: 6px 8px;
|
|
2356
2376
|
margin-bottom: -1px;
|
|
2357
2377
|
user-select: none;
|
|
2358
|
-
transition: all 0.
|
|
2378
|
+
transition: all 0.2s ease-in-out;
|
|
2359
2379
|
}
|
|
2360
2380
|
.tab_7e0fb:last-child {
|
|
2361
2381
|
margin-right: 0;
|
|
2362
2382
|
}
|
|
2363
2383
|
.not-selected_7e0fb:hover {
|
|
2364
2384
|
color: var(--rp-c-text-1);
|
|
2365
|
-
border-color: var(--rp-c-gray
|
|
2366
|
-
border-radius:
|
|
2385
|
+
border-color: var(--rp-c-gray);
|
|
2386
|
+
border-top-left-radius: 10px;
|
|
2387
|
+
border-top-right-radius: 10px;
|
|
2388
|
+
background-color: var(--rp-c-gray-light-5);
|
|
2389
|
+
}
|
|
2390
|
+
.dark .not-selected_7e0fb:hover {
|
|
2391
|
+
background-color: var(--rp-c-dark-light-3);
|
|
2367
2392
|
}
|
|
2368
2393
|
.selected_7e0fb {
|
|
2369
2394
|
color: var(--rp-c-brand-dark);
|
package/dist/theme/bundle.js
CHANGED
|
@@ -1815,7 +1815,7 @@ function HomeHero({ frontmatter }) {
|
|
|
1815
1815
|
const hero = ((_frontmatter = frontmatter) === null || _frontmatter === void 0 ? void 0 : _frontmatter.hero) || DEFAULT_HERO;
|
|
1816
1816
|
const hasImage = hero.image !== void 0;
|
|
1817
1817
|
return /* @__PURE__ */ _jsxs10("div", {
|
|
1818
|
-
className: "m-auto pt-0 px-6 pb-12 sm:pt-10 sm:px-16 md:pt-
|
|
1818
|
+
className: "m-auto pt-0 px-6 pb-12 sm:pt-10 sm:px-16 md:pt-16 md:px-16 md:pb-16",
|
|
1819
1819
|
children: [
|
|
1820
1820
|
/* @__PURE__ */ _jsx15("div", {
|
|
1821
1821
|
className: index_module_default9.mask,
|
|
@@ -1824,7 +1824,7 @@ function HomeHero({ frontmatter }) {
|
|
|
1824
1824
|
}
|
|
1825
1825
|
}),
|
|
1826
1826
|
/* @__PURE__ */ _jsxs10("div", {
|
|
1827
|
-
className: "m-auto flex flex-col md:flex-row max-w-6xl",
|
|
1827
|
+
className: "m-auto flex flex-col md:flex-row max-w-6xl min-h-[50vh]",
|
|
1828
1828
|
children: [
|
|
1829
1829
|
/* @__PURE__ */ _jsxs10("div", {
|
|
1830
1830
|
className: "flex flex-col justify-center text-center max-w-xl sm:max-w-4xl m-auto order-2 md:order-1",
|
|
@@ -3606,7 +3606,7 @@ import { useContext as useContext4 } from "react";
|
|
|
3606
3606
|
import { Tab as HeadlessTab } from "@headlessui/react";
|
|
3607
3607
|
|
|
3608
3608
|
// src/theme-default/components/Tabs/index.module.scss
|
|
3609
|
-
var index_module_default16 = { "tab": "tab_7e0fb", "not-selected": "not-selected_7e0fb", "notSelected": "not-selected_7e0fb", "selected": "selected_7e0fb" };
|
|
3609
|
+
var index_module_default16 = { "container": "container_7e0fb", "tab-list": "tab-list_7e0fb", "tabList": "tab-list_7e0fb", "tab": "tab_7e0fb", "not-selected": "not-selected_7e0fb", "notSelected": "not-selected_7e0fb", "selected": "selected_7e0fb" };
|
|
3610
3610
|
|
|
3611
3611
|
// src/theme-default/components/Tabs/index.tsx
|
|
3612
3612
|
function _define_property19(obj, key, value) {
|
|
@@ -3732,48 +3732,51 @@ function Tabs(props) {
|
|
|
3732
3732
|
return false;
|
|
3733
3733
|
});
|
|
3734
3734
|
}
|
|
3735
|
-
return /* @__PURE__ */
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3735
|
+
return /* @__PURE__ */ _jsx36("div", {
|
|
3736
|
+
className: index_module_default16.container,
|
|
3737
|
+
children: /* @__PURE__ */ _jsxs24(HeadlessTab.Group, _object_spread_props15(_object_spread19({
|
|
3738
|
+
onChange: (index) => {
|
|
3739
|
+
var _onChange;
|
|
3740
|
+
(_onChange = onChange) === null || _onChange === void 0 ? void 0 : _onChange(index);
|
|
3741
|
+
if (groupId) {
|
|
3742
|
+
setTabData(_object_spread_props15(_object_spread19({}, tabData), {
|
|
3743
|
+
[groupId]: index
|
|
3744
|
+
}));
|
|
3745
|
+
}
|
|
3743
3746
|
}
|
|
3744
|
-
}
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
}
|
|
3762
|
-
})
|
|
3763
|
-
})
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
})
|
|
3747
|
+
}, needSync ? {
|
|
3748
|
+
selectedIndex: defaultIndex
|
|
3749
|
+
} : {
|
|
3750
|
+
defaultIndex
|
|
3751
|
+
}), {
|
|
3752
|
+
children: [
|
|
3753
|
+
/* @__PURE__ */ _jsx36("div", {
|
|
3754
|
+
className: tabContainerClassName,
|
|
3755
|
+
children: tabValues.length ? /* @__PURE__ */ _jsx36(HeadlessTab.List, {
|
|
3756
|
+
className: index_module_default16.tabList,
|
|
3757
|
+
children: tabValues.map((item, index) => {
|
|
3758
|
+
const disabled = Boolean(item && typeof item === "object" && "disabled" in item && item.disabled);
|
|
3759
|
+
return /* @__PURE__ */ _jsx36(HeadlessTab, {
|
|
3760
|
+
disabled,
|
|
3761
|
+
className: ({ selected }) => `${index_module_default16.tab} ${selected ? index_module_default16.selected : index_module_default16.notSelected}`,
|
|
3762
|
+
children: renderTab(item)
|
|
3763
|
+
}, index);
|
|
3764
|
+
})
|
|
3765
|
+
}) : null
|
|
3766
|
+
}),
|
|
3767
|
+
/* @__PURE__ */ _jsx36(HeadlessTab.Panels, {
|
|
3768
|
+
children
|
|
3769
|
+
})
|
|
3770
|
+
]
|
|
3771
|
+
}))
|
|
3772
|
+
});
|
|
3770
3773
|
}
|
|
3771
3774
|
function Tab(_param) {
|
|
3772
3775
|
var { children } = _param, props = _object_without_properties(_param, [
|
|
3773
3776
|
"children"
|
|
3774
3777
|
]);
|
|
3775
3778
|
return /* @__PURE__ */ _jsx36(HeadlessTab.Panel, _object_spread_props15(_object_spread19({}, props), {
|
|
3776
|
-
className: "rounded
|
|
3779
|
+
className: "rounded px-2",
|
|
3777
3780
|
children
|
|
3778
3781
|
}));
|
|
3779
3782
|
}
|