Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
||||
import PreviewTabsAsButtons from "./PreviewTabsAsButtons";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import PreviewTabsAsLinks from "./PreviewTabsAsLinks";
|
||||
|
||||
export default function PreviewTabs() {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import Tabs from "./Tabs";
|
||||
|
||||
export default function PreviewTabsAsButtons() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import Tabs from "./Tabs";
|
||||
|
||||
export default function PreviewTabsAsLinks() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { t as i18nT } from "i18next";
|
||||
import { requestScopedT as i18nT } from "~/locale/request-scoped-t";
|
||||
import TabsVertical from "./TabsVertical";
|
||||
|
||||
export default function PreviewTabsVertical() {
|
||||
|
||||
@@ -3,12 +3,13 @@ import { Link, useLocation, useNavigate } from "react-router";
|
||||
import clsx from "clsx";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { getBestActiveRouteIndex } from "~/utils/navigation/routeMatching";
|
||||
import InputSelect from "../input/InputSelect";
|
||||
|
||||
export interface TabItem {
|
||||
name: any;
|
||||
routePath?: string;
|
||||
exact?: boolean;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
@@ -21,7 +22,7 @@ interface Props {
|
||||
selectedTab?: number;
|
||||
}
|
||||
|
||||
export default function Tabs({ className = "", breakpoint = "md", tabs = [], asLinks = true, onSelected, exact, selectedTab = 0 }: Props) {
|
||||
export default function Tabs({ className = "", breakpoint = "md", tabs = [], asLinks = true, onSelected, exact: _exact, selectedTab = 0 }: Props) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const navigate = useNavigate();
|
||||
@@ -30,11 +31,8 @@ export default function Tabs({ className = "", breakpoint = "md", tabs = [], asL
|
||||
const [selected, setSelected] = useState(selectedTab);
|
||||
|
||||
useEffect(() => {
|
||||
tabs.forEach((tab, index) => {
|
||||
if (tab.routePath && (location.pathname + location.search).includes(tab.routePath)) {
|
||||
setSelected(index);
|
||||
}
|
||||
});
|
||||
const activeIndex = getBestActiveRouteIndex(tabs, location.pathname);
|
||||
if (activeIndex >= 0) setSelected(activeIndex);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [tabs, location.pathname]);
|
||||
|
||||
@@ -56,11 +54,8 @@ export default function Tabs({ className = "", breakpoint = "md", tabs = [], asL
|
||||
}
|
||||
const currentTab = () => {
|
||||
if (asLinks) {
|
||||
if (true) {
|
||||
return tabs.find((element) => element.routePath && UrlUtils.stripTrailingSlash(location.pathname) === UrlUtils.stripTrailingSlash(element.routePath));
|
||||
} else {
|
||||
return tabs.find((element) => element.routePath && (location.pathname + location.search).includes(element.routePath));
|
||||
}
|
||||
const activeIndex = getBestActiveRouteIndex(tabs, location.pathname);
|
||||
return activeIndex >= 0 ? tabs[activeIndex] : undefined;
|
||||
} else {
|
||||
return tabs[selected];
|
||||
}
|
||||
@@ -85,6 +80,8 @@ export default function Tabs({ className = "", breakpoint = "md", tabs = [], asL
|
||||
name: tab.name,
|
||||
}))}
|
||||
canClear={false}
|
||||
triggerAriaLabel={t("components.tabs.ariaLabel")}
|
||||
highContrastText
|
||||
/>
|
||||
{/* <label htmlFor="tabs" className="sr-only">
|
||||
{t("app.shared.tabs.select")}
|
||||
@@ -127,7 +124,9 @@ export default function Tabs({ className = "", breakpoint = "md", tabs = [], asL
|
||||
to={tab.routePath ?? ""}
|
||||
className={clsx(
|
||||
"truncate",
|
||||
isCurrent(idx) ? "text-text-neutral-primary bg-surface-neutral-secondary" : "text-text-neutral-tertiary hover:text-text-neutral-primary hover:bg-surface-neutral-secondary",
|
||||
isCurrent(idx)
|
||||
? "text-text-neutral-primary bg-surface-neutral-secondary"
|
||||
: "text-text-neutral-tertiary hover:text-text-neutral-primary hover:bg-surface-neutral-secondary",
|
||||
"rounded-sm px-3 py-2 text-sm font-medium"
|
||||
)}
|
||||
>
|
||||
@@ -148,7 +147,9 @@ export default function Tabs({ className = "", breakpoint = "md", tabs = [], asL
|
||||
onClick={() => selectTab(idx)}
|
||||
className={clsx(
|
||||
"truncate",
|
||||
isCurrent(idx) ? "text-text-neutral-primary bg-surface-neutral-secondary" : "text-text-neutral-tertiary hover:text-text-neutral-primary hover:bg-surface-neutral-secondary",
|
||||
isCurrent(idx)
|
||||
? "text-text-neutral-primary bg-surface-neutral-secondary"
|
||||
: "text-text-neutral-tertiary hover:text-text-neutral-primary hover:bg-surface-neutral-secondary",
|
||||
"rounded-sm px-3 py-2 text-sm font-medium"
|
||||
)}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user