@proef/common-ui 2.6.17 → 2.6.18
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/esm/legacy/components/atoms/Acronym/Acronym.js.map +1 -1
- package/dist/esm/legacy/components/atoms/BreadCrumb/BreadCrumb.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Button/variants/ActionButton.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Button/variants/FilterButton.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Button/variants/IconButton.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Button/variants/MainButton.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Button/variants/TabButton.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Field/Field.js.map +1 -1
- package/dist/esm/legacy/components/atoms/IconText/IconText.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Icone/Icone.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/legacy/components/atoms/InputData/InputData.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Label/Label.js.map +1 -1
- package/dist/esm/legacy/components/atoms/MultiTagPickerTag/MultiTagPickerTag.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Select/Select.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Stack/Stack.js.map +1 -1
- package/dist/esm/legacy/components/atoms/Switch/CustomSwitch.js.map +1 -1
- package/dist/esm/legacy/components/charts/Charts.js.map +1 -1
- package/dist/esm/legacy/components/layout/AppLauncher/AppLauncher.js.map +1 -1
- package/dist/esm/legacy/components/layout/Error/Error.js.map +1 -1
- package/dist/esm/legacy/components/layout/Footer/Footer.js.map +1 -1
- package/dist/esm/legacy/components/layout/Header/Header.js.map +1 -1
- package/dist/esm/legacy/components/layout/Layout/Layout.js.map +1 -1
- package/dist/esm/legacy/components/layout/Sidebar/Sidebar.js.map +1 -1
- package/dist/esm/legacy/components/layout/TopBar/TopBar.js.map +1 -1
- package/dist/esm/legacy/components/layout/TopNavLayout/TopNavLayout.js.map +1 -1
- package/dist/esm/legacy/components/molecules/BarraValor/BarraValor.js.map +1 -1
- package/dist/esm/legacy/components/molecules/ColumnPicker/ColumnPicker.js.map +1 -1
- package/dist/esm/legacy/components/molecules/ConfirmModal/ConfirmModal.js.map +1 -1
- package/dist/esm/legacy/components/molecules/DataTable/DataTable.js.map +1 -1
- package/dist/esm/legacy/components/molecules/FileDropzone/FileDropzone.js.map +1 -1
- package/dist/esm/legacy/components/molecules/LanguageSwitcher/LanguageSwitcher.js.map +1 -1
- package/dist/esm/legacy/components/molecules/Modal/Modal.js.map +1 -1
- package/dist/esm/legacy/components/molecules/MultiTagPicker/MultiTagPicker.js.map +1 -1
- package/dist/esm/legacy/components/molecules/SeletorPesquisa/SeletorPesquisa.js.map +1 -1
- package/dist/esm/legacy/components/molecules/Sidebar/Sidebar.js.map +1 -1
- package/dist/esm/legacy/components/molecules/UserAvatar/UserAvatar.js.map +1 -1
- package/dist/esm/legacy/components/organisms/GanttChart/GanttChart.js.map +1 -1
- package/dist/esm/legacy/components/organisms/Kanban/Kanban.js.map +1 -1
- package/dist/esm/legacy/components/organisms/LazyLoader/LazyLoader.js.map +1 -1
- package/dist/esm/legacy/components/organisms/MapaPontos/MapaPontos.js.map +1 -1
- package/dist/esm/legacy/components/organisms/PainelFiltros/PainelFiltros.js.map +1 -1
- package/dist/esm/legacy/components/organisms/PesquisaRapida/PesquisaRapida.js.map +1 -1
- package/dist/esm/legacy/components/organisms/Profile/Profile.js.map +1 -1
- package/dist/esm/legacy/components/organisms/RoleGuard/RoleGuard.js.map +1 -1
- package/dist/esm/legacy/components/organisms/Selector/Selector.js.map +1 -1
- package/dist/esm/legacy/components/organisms/StatusMatrix/StatusMatrix.js.map +1 -1
- package/dist/esm/legacy/components/ui/Avisos.js.map +1 -1
- package/dist/esm/legacy/components/ui/BarraAcoes.js.map +1 -1
- package/dist/esm/legacy/components/ui/CabecalhoPagina.js.map +1 -1
- package/dist/esm/legacy/components/ui/CaixaPesquisa.js.map +1 -1
- package/dist/esm/legacy/components/ui/Confirmacao.js.map +1 -1
- package/dist/esm/legacy/components/ui/Escolha.js.map +1 -1
- package/dist/esm/legacy/components/ui/FaixaAviso.js.map +1 -1
- package/dist/esm/legacy/components/ui/MenuAcoes.js.map +1 -1
- package/dist/esm/legacy/components/ui/Passos.js.map +1 -1
- package/dist/esm/legacy/components/ui/Separadores.js.map +1 -1
- package/dist/esm/legacy/components/ui/TextoAuto.js.map +1 -1
- package/dist/esm/legacy/components/ui/Ui.js.map +1 -1
- package/dist/esm/legacy/components/ui/painelFlutuante.js.map +1 -1
- package/dist/esm/legacy/constants/Colors.js.map +1 -1
- package/dist/esm/legacy/constants/FontWeight.js.map +1 -1
- package/dist/esm/legacy/contexts/apiContext.js.map +1 -1
- package/dist/esm/legacy/contexts/authContext.js.map +1 -1
- package/dist/esm/legacy/contexts/socketContext.js.map +1 -1
- package/dist/esm/legacy/hooks/useApi.js.map +1 -1
- package/dist/esm/legacy/pages/Error/ErrorPage.js.map +1 -1
- package/dist/esm/legacy/pages/Loading/Loading.js.map +1 -1
- package/dist/esm/legacy/pages/Login/LoginScreen.js.map +1 -1
- package/dist/esm/legacy/pages/NotFound/NotFound.js.map +1 -1
- package/dist/esm/legacy/styles/themes/ButtonThemes.js.map +1 -1
- package/dist/esm/legacy/styles/utils/utils.js.map +1 -1
- package/dist/esm/legacy/utils/stringUtils.js.map +1 -1
- package/dist/esm/v1/capabilities/documents/QRScanning/scanQRCodes.js.map +1 -1
- package/dist/esm/v1/capabilities/graph-photos/cacheDeFotos.js.map +1 -1
- package/dist/esm/v1/capabilities/graph-photos/loteDeFotos.js.map +1 -1
- package/dist/esm/v1/capabilities/onepoint-rn/bridge.js.map +1 -1
- package/dist/esm/v1/capabilities/onepoint-rn/dentroDaApp.js.map +1 -1
- package/dist/esm/v1/capabilities/onepoint-rn/onepoint.js.map +1 -1
- package/dist/esm/v1/capabilities/onepoint-rn/useOrientacaoNaApp.js.map +1 -1
- package/dist/esm/v1/capabilities/overlay/useFloatingPanel.js.map +1 -1
- package/dist/esm/v1/capabilities/theme/useIsDark.js.map +1 -1
- package/dist/esm/v1/capabilities/theme/useTheme.js.map +1 -1
- package/dist/esm/v1/components/data/Charts/Charts.js.map +1 -1
- package/dist/esm/v1/components/data/DayTimeline/DayTimeline.js.map +1 -1
- package/dist/esm/v1/components/data/MonthCalendar/MonthCalendar.js.map +1 -1
- package/dist/esm/v1/components/data/Pagination/Pagination.js.map +1 -1
- package/dist/esm/v1/components/documents/DocumentDropzone/DocumentDropzone.js.map +1 -1
- package/dist/esm/v1/components/feedback/Toast/Toast.js.map +1 -1
- package/dist/esm/v1/components/forms/FormField/FormField.js.map +1 -1
- package/dist/esm/v1/components/forms/FormGrid/FormGrid.js.map +1 -1
- package/dist/esm/v1/components/layout/AppShell/AppShell.js +15 -16
- package/dist/esm/v1/components/layout/AppShell/AppShell.js.map +1 -1
- package/dist/esm/v1/components/layout/Page/Page.js.map +1 -1
- package/dist/esm/v1/components/layout/PageHeader/PageHeader.js.map +1 -1
- package/dist/esm/v1/components/layout/SideNav/SideNav.js +233 -91
- package/dist/esm/v1/components/layout/SideNav/SideNav.js.map +1 -1
- package/dist/esm/v1/components/layout/navTrail.js.map +1 -1
- package/dist/esm/v1/components/lists/ListFinder/ListFinder.js.map +1 -1
- package/dist/esm/v1/components/lists/ListFinder/labels.js.map +1 -1
- package/dist/esm/v1/components/overlays/ConfirmDialog/ConfirmDialog.js.map +1 -1
- package/dist/esm/v1/components/overlays/Dialog/Dialog.js.map +1 -1
- package/dist/esm/v1/components/overlays/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/esm/v1/components/overlays/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/v1/components/overlays/Tooltip/TooltipLayer.js.map +1 -1
- package/dist/esm/v1/components/overlays/Tooltip/TooltipPanel.js.map +1 -1
- package/dist/esm/v1/components/overlays/topLayer.js.map +1 -1
- package/dist/esm/v1/components/tables/PaginatedTable/PaginatedTable.js.map +1 -1
- package/dist/esm/v1/components/tables/Table/ColumnFilter.js.map +1 -1
- package/dist/esm/v1/components/tables/Table/OverlayScrollbar.js.map +1 -1
- package/dist/esm/v1/components/tables/Table/Table.js.map +1 -1
- package/dist/esm/v1/components/tables/Table/labels.js.map +1 -1
- package/dist/esm/v1/foundations/icons/icons.js.map +1 -1
- package/dist/esm/v1/primitives/buttons/Button/Button.js.map +1 -1
- package/dist/esm/v1/primitives/buttons/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/esm/v1/primitives/buttons/SegmentedControl/segmentedStyles.js.map +1 -1
- package/dist/esm/v1/primitives/display/Avatar/Avatar.js.map +1 -1
- package/dist/esm/v1/primitives/display/AvatarStack/AvatarStack.js.map +1 -1
- package/dist/esm/v1/primitives/display/Badge/Badge.js.map +1 -1
- package/dist/esm/v1/primitives/display/Card/Card.js.map +1 -1
- package/dist/esm/v1/primitives/display/DescriptionList/DescriptionList.js.map +1 -1
- package/dist/esm/v1/primitives/display/FilterChips/FilterChips.js.map +1 -1
- package/dist/esm/v1/primitives/display/Kpi/Kpi.js.map +1 -1
- package/dist/esm/v1/primitives/display/Notice/Notice.js.map +1 -1
- package/dist/esm/v1/primitives/display/PeopleFilter/PeopleFilter.js.map +1 -1
- package/dist/esm/v1/primitives/display/Person/Person.js.map +1 -1
- package/dist/esm/v1/primitives/display/RichText/RichText.js.map +1 -1
- package/dist/esm/v1/primitives/display/RichText/utils.js.map +1 -1
- package/dist/esm/v1/primitives/documents/PdfPreview/PdfPreview.js.map +1 -1
- package/dist/esm/v1/primitives/documents/PdfPreview/pdfjs.js.map +1 -1
- package/dist/esm/v1/primitives/feedback/Spinner/Spinner.js.map +1 -1
- package/dist/esm/v1/primitives/forms/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/v1/primitives/forms/DateInput/DateInput.js.map +1 -1
- package/dist/esm/v1/primitives/forms/LookupInput/LookupInput.js.map +1 -1
- package/dist/esm/v1/primitives/forms/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/esm/v1/primitives/forms/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/v1/primitives/forms/SelectInput/SelectInput.js.map +1 -1
- package/dist/esm/v1/primitives/forms/Switch/Switch.js.map +1 -1
- package/dist/esm/v1/primitives/forms/TextArea/TextArea.js.map +1 -1
- package/dist/esm/v1/primitives/forms/TextInput/TextInput.js.map +1 -1
- package/dist/esm/v1/primitives/forms/field.js.map +1 -1
- package/dist/esm/v1/primitives/lists/ListItem/ListItem.js.map +1 -1
- package/dist/esm/v1/primitives/navigation/Steps/Steps.js.map +1 -1
- package/dist/esm/v1/primitives/navigation/Tabs/Tabs.js.map +1 -1
- package/dist/style.components.css +2 -2
- package/dist/style.css +2 -2
- package/dist/style.layered.css +2 -2
- package/dist/tailwind.css +24 -24
- package/dist/theme.css +300 -300
- package/dist/tokens.css +131 -131
- package/dist/types/v1/components/layout/SideNav/SideNav.d.ts +2 -0
- package/package.json +125 -125
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useState,
|
|
2
|
+
import { useMemo, useState, useRef, useEffect, useLayoutEffect } from "react";
|
|
3
3
|
import { useLocation } from "react-router-dom";
|
|
4
|
-
import { MenuIcon } from "../../../foundations/icons/icons.js";
|
|
5
4
|
import SideNav, { isDrawer } from "../SideNav/SideNav.js";
|
|
6
5
|
import { findNavTrail, NavTrailContext } from "../navTrail.js";
|
|
7
6
|
function AppShell({
|
|
@@ -23,12 +22,22 @@ function AppShell({
|
|
|
23
22
|
setOpenState(value);
|
|
24
23
|
onOpenChange?.(value);
|
|
25
24
|
};
|
|
25
|
+
const raiz = useRef(null);
|
|
26
26
|
useEffect(() => {
|
|
27
|
+
let fim;
|
|
27
28
|
const onResize = () => {
|
|
29
|
+
raiz.current?.setAttribute("data-a-redimensionar", "");
|
|
30
|
+
clearTimeout(fim);
|
|
31
|
+
fim = setTimeout(() => raiz.current?.removeAttribute("data-a-redimensionar"), 200);
|
|
28
32
|
if (isDrawer()) setOpenState(false);
|
|
29
33
|
};
|
|
30
34
|
window.addEventListener("resize", onResize);
|
|
31
|
-
|
|
35
|
+
window.addEventListener("orientationchange", onResize);
|
|
36
|
+
return () => {
|
|
37
|
+
clearTimeout(fim);
|
|
38
|
+
window.removeEventListener("resize", onResize);
|
|
39
|
+
window.removeEventListener("orientationchange", onResize);
|
|
40
|
+
};
|
|
32
41
|
}, []);
|
|
33
42
|
useEffect(() => {
|
|
34
43
|
if (isDrawer()) setOpenState(false);
|
|
@@ -52,24 +61,14 @@ function AppShell({
|
|
|
52
61
|
return /* @__PURE__ */ jsxs(
|
|
53
62
|
"div",
|
|
54
63
|
{
|
|
64
|
+
ref: raiz,
|
|
55
65
|
style: { "--app-shell-top": `${top}px` },
|
|
56
|
-
className: `flex bg-background text-foreground ${fullHeight ? "h-dvh overflow-hidden" : "min-h-dvh"}`,
|
|
66
|
+
className: `flex bg-background text-foreground [&[data-a-redimensionar]_*]:transition-none! ${fullHeight ? "h-dvh overflow-hidden" : "min-h-dvh"}`,
|
|
57
67
|
children: [
|
|
58
68
|
banners && /* @__PURE__ */ jsx("div", { ref: bannersRef, className: "fixed inset-x-0 top-0 z-50", children: banners }),
|
|
59
69
|
/* @__PURE__ */ jsx(SideNav, { ...sideNav, footer: sidebarFooter, labels, open, onOpenChange: setOpen }),
|
|
60
70
|
open && /* @__PURE__ */ jsx("div", { onClick: () => setOpen(false), "aria-hidden": true, className: "fixed inset-0 z-30 bg-slate-900/50 backdrop-blur-sm lg:hidden" }),
|
|
61
71
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", style: { paddingTop: "var(--app-shell-top)" }, children: [
|
|
62
|
-
!open && /* @__PURE__ */ jsx(
|
|
63
|
-
"button",
|
|
64
|
-
{
|
|
65
|
-
type: "button",
|
|
66
|
-
onClick: () => setOpen(true),
|
|
67
|
-
"aria-label": labels?.openMenu ?? "Abrir menu",
|
|
68
|
-
style: { top: "calc(var(--app-shell-top) + 0.75rem)" },
|
|
69
|
-
className: "absolute left-5 z-40 flex cursor-pointer items-center justify-center rounded-xl border border-border bg-card p-3 text-muted-foreground shadow-page transition-colors hover:text-proef-blue lg:hidden",
|
|
70
|
-
children: /* @__PURE__ */ jsx(MenuIcon, { size: 20 })
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
72
|
topBar && /* @__PURE__ */ jsx("div", { style: { top: "var(--app-shell-top)" }, className: `sticky z-30 transition-[margin] duration-300 ${margin}`, children: topBar }),
|
|
74
73
|
/* @__PURE__ */ jsx(
|
|
75
74
|
"main",
|
|
@@ -78,7 +77,7 @@ function AppShell({
|
|
|
78
77
|
// overflow-x-clip: uma peça mais larga do que o ecrã (um botão que não parte, um código comprido) fazia o
|
|
79
78
|
// telemóvel alargar a página toda e cortar tudo à direita. Assim só essa peça fica cortada. Clip, e não
|
|
80
79
|
// hidden, para não criar uma caixa de scroll (o sticky dentro da página continua a funcionar).
|
|
81
|
-
`min-w-0 overflow-x-clip px-page-x-narrow transition-[margin] duration-300 sm:px-page-x ${margin} ${topBar ? "pt-6" : "pt-page-top-narrow lg:pt-page-top max-lg:[--app-shell-title-lift:calc(var(--spacing-page-top-narrow)-19px)] max-lg:[--app-shell-menu-inset:calc(
|
|
80
|
+
`min-w-0 overflow-x-clip px-page-x-narrow transition-[margin] duration-300 sm:px-page-x ${margin} ${topBar ? "pt-6" : "pt-page-top-narrow lg:pt-page-top max-lg:[--app-shell-title-lift:calc(var(--spacing-page-top-narrow)-19px)] max-lg:[--app-shell-menu-inset:calc(44px-var(--spacing-page-x-narrow))] max-lg:[--app-shell-menu-row:35px] sm:max-lg:[--app-shell-menu-inset:calc(44px-var(--spacing-page-x))] max-lg:[@media(max-height:500px)]:[--app-shell-menu-inset:calc(60px-var(--spacing-page-x-narrow))] sm:max-lg:[@media(max-height:500px)]:[--app-shell-menu-inset:calc(60px-var(--spacing-page-x))]"} ` + (fullHeight ? "flex min-h-0 flex-1 flex-col overflow-hidden pb-4" : "pb-16")
|
|
82
81
|
),
|
|
83
82
|
children: /* @__PURE__ */ jsx(NavTrailContext.Provider, { value: trail, children })
|
|
84
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.js","sources":["../../../../../../src/v1/components/layout/AppShell/AppShell.tsx"],"sourcesContent":["import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\
|
|
1
|
+
{"version":3,"file":"AppShell.js","sources":["../../../../../../src/v1/components/layout/AppShell/AppShell.tsx"],"sourcesContent":["import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\nimport { useLocation } from 'react-router-dom'\nimport SideNav, { isDrawer, type SideNavLabels, type SideNavProps } from '../SideNav/SideNav'\nimport { NavTrailContext, findNavTrail } from '../navTrail'\n\nexport interface AppShellLabels extends SideNavLabels {\n openMenu: string\n}\n\nexport interface AppShellProps extends Omit<SideNavProps, 'open' | 'onOpenChange' | 'footer' | 'labels'> {\n children: React.ReactNode\n /** Conteúdo extra no rodapé do menu, por cima do tema (ex: um filtro global). */\n sidebarFooter?: (expanded: boolean) => React.ReactNode\n /** Barras no topo, com a largura toda (ex: \"A ver como…\", \"A sincronizar…\"). Empurram o menu e a página para baixo. */\n banners?: React.ReactNode\n /** Barra fixa por cima da página, à direita do menu (ex: título e alertas). Traz o seu próprio fundo. */\n topBar?: React.ReactNode\n /**\n * A página ocupa a altura que sobra do ecrã, sem scroll da página (ex:\n * quadros e listas que fazem scroll por dentro, com o `Page` em `fill`).\n * As margens são as mesmas das outras páginas.\n */\n fullHeight?: boolean\n /** Menu aberto ao entrar (ecrãs grandes). Por omissão sim; fechado fica só com os ícones. */\n defaultOpen?: boolean\n /** A pessoa abriu ou fechou o menu (para a app guardar a escolha, se quiser). */\n onOpenChange?: (open: boolean) => void\n labels?: Partial<AppShellLabels>\n}\n\n/**\n * A moldura da app: o menu lateral (`SideNav`) à esquerda e a página à\n * direita, com barras opcionais no topo.\n *\n * Em ecrãs pequenos (< 1024px) o menu é uma gaveta, aberta pelo botão no canto,\n * que fecha ao mudar de página.\n *\n * Precisa de estar dentro de um Router do react-router.\n */\nexport default function AppShell({\n children,\n sidebarFooter,\n banners,\n topBar,\n fullHeight = false,\n defaultOpen = true,\n onOpenChange,\n labels,\n ...sideNav\n}: AppShellProps) {\n const location = useLocation()\n // O lugar da página no menu, para o `Page` mostrar o caminho \"grupo › página\".\n const { menu, groupLabels } = sideNav\n const trail = useMemo(() => findNavTrail(menu, groupLabels ?? {}, location.pathname), [menu, groupLabels, location.pathname])\n const [open, setOpenState] = useState(() => !isDrawer() && defaultOpen)\n\n // Escolha da pessoa: avisa a app. O ajuste ao redimensionar não é escolha dela.\n const setOpen = (value: boolean) => {\n setOpenState(value)\n onOpenChange?.(value)\n }\n\n /*\n Ao redimensionar (janela a mudar de tamanho, telemóvel a rodar) as\n animações da moldura desligam-se: as classes do menu e das margens mudam\n com o tamanho (gaveta ↔ painel de cima, ícones ↔ aberto) e cada mudança\n animava-se 300ms — o menu a deslizar e a esticar sem ninguém lhe ter\n tocado. Voltam 200ms depois do último `resize`.\n O atributo é posto à mão no elemento, já dentro do evento: um estado do\n React só chegava ao ecrã depois de o browser ter começado as animações.\n */\n const raiz = useRef<HTMLDivElement>(null)\n useEffect(() => {\n let fim: ReturnType<typeof setTimeout> | undefined\n const onResize = () => {\n raiz.current?.setAttribute('data-a-redimensionar', '')\n clearTimeout(fim)\n fim = setTimeout(() => raiz.current?.removeAttribute('data-a-redimensionar'), 200)\n if (isDrawer()) setOpenState(false)\n }\n window.addEventListener('resize', onResize)\n window.addEventListener('orientationchange', onResize)\n return () => {\n clearTimeout(fim)\n window.removeEventListener('resize', onResize)\n window.removeEventListener('orientationchange', onResize)\n }\n }, [])\n\n // A gaveta fecha ao mudar de página (incluindo links fora do menu).\n useEffect(() => {\n if (isDrawer()) setOpenState(false)\n }, [location.pathname])\n\n // Altura das barras do topo: o menu e a página começam por baixo delas.\n const bannersRef = useRef<HTMLDivElement>(null)\n const [top, setTop] = useState(0)\n useLayoutEffect(() => {\n const el = bannersRef.current\n if (!el) {\n setTop(0)\n return\n }\n const measure = () => setTop(el.offsetHeight)\n measure()\n if (typeof ResizeObserver === 'undefined') return\n const ro = new ResizeObserver(measure)\n ro.observe(el)\n return () => ro.disconnect()\n }, [banners])\n\n const margin = open ? 'lg:ml-64' : 'lg:ml-20'\n\n return (\n <div\n ref={raiz}\n style={{ '--app-shell-top': `${top}px` } as React.CSSProperties}\n className={`flex bg-background text-foreground [&[data-a-redimensionar]_*]:transition-none! ${fullHeight ? 'h-dvh overflow-hidden' : 'min-h-dvh'}`}\n >\n {banners && (\n <div ref={bannersRef} className=\"fixed inset-x-0 top-0 z-50\">\n {banners}\n </div>\n )}\n\n <SideNav {...sideNav} footer={sidebarFooter} labels={labels} open={open} onOpenChange={setOpen} />\n\n {open && <div onClick={() => setOpen(false)} aria-hidden className=\"fixed inset-0 z-30 bg-slate-900/50 backdrop-blur-sm lg:hidden\" />}\n\n <div className=\"flex min-w-0 flex-1 flex-col\" style={{ paddingTop: 'var(--app-shell-top)' }}>\n {topBar && (\n <div style={{ top: 'var(--app-shell-top)' }} className={`sticky z-30 transition-[margin] duration-300 ${margin}`}>\n {topBar}\n </div>\n )}\n {/* As margens da página vêm daqui, iguais em todas as páginas (também nas\n de altura total) e com o menu aberto ou fechado: as páginas não põem as\n suas. Os valores são tokens (--spacing-page-x, --spacing-page-top). Em\n ecrãs pequenos o espaço de cima deixa lugar ao botão do menu. */}\n {/* Sem topBar, abaixo de 1024px o título do PageHeader sobe para o lado do botão\n do menu (as variáveis dizem-lhe quanto subir e quanto se afastar do botão). */}\n <main\n className={\n // overflow-x-clip: uma peça mais larga do que o ecrã (um botão que não parte, um código comprido) fazia o\n // telemóvel alargar a página toda e cortar tudo à direita. Assim só essa peça fica cortada. Clip, e não\n // hidden, para não criar uma caixa de scroll (o sticky dentro da página continua a funcionar).\n `min-w-0 overflow-x-clip px-page-x-narrow transition-[margin] duration-300 sm:px-page-x ${margin} ${topBar ? 'pt-6' : 'pt-page-top-narrow lg:pt-page-top max-lg:[--app-shell-title-lift:calc(var(--spacing-page-top-narrow)-19px)] max-lg:[--app-shell-menu-inset:calc(44px-var(--spacing-page-x-narrow))] max-lg:[--app-shell-menu-row:35px] sm:max-lg:[--app-shell-menu-inset:calc(44px-var(--spacing-page-x))] max-lg:[@media(max-height:500px)]:[--app-shell-menu-inset:calc(60px-var(--spacing-page-x-narrow))] sm:max-lg:[@media(max-height:500px)]:[--app-shell-menu-inset:calc(60px-var(--spacing-page-x))]'} ` +\n (fullHeight ? 'flex min-h-0 flex-1 flex-col overflow-hidden pb-4' : 'pb-16')\n }\n >\n <NavTrailContext.Provider value={trail}>{children}</NavTrailContext.Provider>\n </main>\n </div>\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;AAuCA,SAAwB,SAAS;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkB;AAChB,QAAM,WAAW,YAAA;AAEjB,QAAM,EAAE,MAAM,YAAA,IAAgB;AAC9B,QAAM,QAAQ,QAAQ,MAAM,aAAa,MAAM,eAAe,CAAA,GAAI,SAAS,QAAQ,GAAG,CAAC,MAAM,aAAa,SAAS,QAAQ,CAAC;AAC5H,QAAM,CAAC,MAAM,YAAY,IAAI,SAAS,MAAM,CAAC,SAAA,KAAc,WAAW;AAGtE,QAAM,UAAU,CAAC,UAAmB;AAClC,iBAAa,KAAK;AAClB,mBAAe,KAAK;AAAA,EACtB;AAWA,QAAM,OAAO,OAAuB,IAAI;AACxC,YAAU,MAAM;AACd,QAAI;AACJ,UAAM,WAAW,MAAM;AACrB,WAAK,SAAS,aAAa,wBAAwB,EAAE;AACrD,mBAAa,GAAG;AAChB,YAAM,WAAW,MAAM,KAAK,SAAS,gBAAgB,sBAAsB,GAAG,GAAG;AACjF,UAAI,SAAA,EAAY,cAAa,KAAK;AAAA,IACpC;AACA,WAAO,iBAAiB,UAAU,QAAQ;AAC1C,WAAO,iBAAiB,qBAAqB,QAAQ;AACrD,WAAO,MAAM;AACX,mBAAa,GAAG;AAChB,aAAO,oBAAoB,UAAU,QAAQ;AAC7C,aAAO,oBAAoB,qBAAqB,QAAQ;AAAA,IAC1D;AAAA,EACF,GAAG,CAAA,CAAE;AAGL,YAAU,MAAM;AACd,QAAI,SAAA,EAAY,cAAa,KAAK;AAAA,EACpC,GAAG,CAAC,SAAS,QAAQ,CAAC;AAGtB,QAAM,aAAa,OAAuB,IAAI;AAC9C,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,CAAC;AAChC,kBAAgB,MAAM;AACpB,UAAM,KAAK,WAAW;AACtB,QAAI,CAAC,IAAI;AACP,aAAO,CAAC;AACR;AAAA,IACF;AACA,UAAM,UAAU,MAAM,OAAO,GAAG,YAAY;AAC5C,YAAA;AACA,QAAI,OAAO,mBAAmB,YAAa;AAC3C,UAAM,KAAK,IAAI,eAAe,OAAO;AACrC,OAAG,QAAQ,EAAE;AACb,WAAO,MAAM,GAAG,WAAA;AAAA,EAClB,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,SAAS,OAAO,aAAa;AAEnC,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,OAAO,EAAE,mBAAmB,GAAG,GAAG,KAAA;AAAA,MAClC,WAAW,mFAAmF,aAAa,0BAA0B,WAAW;AAAA,MAE/I,UAAA;AAAA,QAAA,+BACE,OAAA,EAAI,KAAK,YAAY,WAAU,8BAC7B,UAAA,SACH;AAAA,QAGF,oBAAC,WAAS,GAAG,SAAS,QAAQ,eAAe,QAAgB,MAAY,cAAc,SAAS;AAAA,QAE/F,QAAQ,oBAAC,OAAA,EAAI,SAAS,MAAM,QAAQ,KAAK,GAAG,eAAW,MAAC,WAAU,gEAAA,CAAgE;AAAA,QAEnI,qBAAC,SAAI,WAAU,gCAA+B,OAAO,EAAE,YAAY,0BAChE,UAAA;AAAA,UAAA,UACC,oBAAC,OAAA,EAAI,OAAO,EAAE,KAAK,uBAAA,GAA0B,WAAW,gDAAgD,MAAM,IAC3G,UAAA,OAAA,CACH;AAAA,UAQF;AAAA,YAAC;AAAA,YAAA;AAAA,cACC;AAAA;AAAA;AAAA;AAAA,gBAIE,0FAA0F,MAAM,IAAI,SAAS,SAAS,8dAA8d,OACnlB,aAAa,sDAAsD;AAAA;AAAA,cAGtE,8BAAC,gBAAgB,UAAhB,EAAyB,OAAO,OAAQ,SAAA,CAAS;AAAA,YAAA;AAAA,UAAA;AAAA,QACpD,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.js","sources":["../../../../../../src/v1/components/layout/Page/Page.tsx"],"sourcesContent":["import React from 'react'\
|
|
1
|
+
{"version":3,"file":"Page.js","sources":["../../../../../../src/v1/components/layout/Page/Page.tsx"],"sourcesContent":["import React from 'react'\nimport PageHeader, { type PageHeaderProps } from '../PageHeader/PageHeader'\nimport { useNavTrail } from '../navTrail'\n\nexport interface PageProps extends PageHeaderProps {\n /** Separadores da página (ex: `<Tabs …/>`), entre o cabeçalho e o conteúdo. */\n tabs?: React.ReactNode\n /**\n * A página ocupa a altura que sobra e o conteúdo faz scroll por dentro (ex:\n * quadros e listas compridas). Usar com o `fullHeight` do `AppShell`.\n */\n fill?: boolean\n children: React.ReactNode\n}\n\n/**\n * Uma página da app: cabeçalho (`PageHeader`), separadores opcionais e o\n * conteúdo, sempre com os mesmos espaços entre eles. As margens à volta vêm do\n * `AppShell`; a página não põe as suas.\n *\n * **Caminho automático**: dentro do `AppShell`, numa página que está num grupo\n * do menu, o caminho por cima do título é \"grupo › página\" (ex: \"App & Dev ›\n * Sprints\"), com os nomes do menu. Passar `breadcrumb` substitui-o (ex: no\n * detalhe de um registo); `breadcrumb={[]}` tira-o.\n */\nexport default function Page({ tabs, fill = false, children, breadcrumb, ...header }: PageProps) {\n const trail = useNavTrail()\n const auto = trail?.group ? [{ label: trail.group }, { label: trail.page }] : undefined\n\n return (\n <div className={`flex flex-col gap-4 ${fill ? 'min-h-0 flex-1' : ''}`}>\n <PageHeader {...header} breadcrumb={breadcrumb ?? auto} />\n {tabs && <div className=\"flex-none\">{tabs}</div>}\n {/* Em ecrã estreito, menos espaço entre o cabeçalho e o conteúdo: no telemóvel cada linha conta. */}\n <div className={`${tabs ? 'pt-2' : 'pt-4 max-lg:pt-0'} ${fill ? 'flex min-h-0 flex-1 flex-col overflow-hidden' : ''}`}>{children}</div>\n </div>\n )\n}\n"],"names":[],"mappings":";;;AAyBA,SAAwB,KAAK,EAAE,MAAM,OAAO,OAAO,UAAU,YAAY,GAAG,UAAqB;AAC/F,QAAM,QAAQ,YAAA;AACd,QAAM,OAAO,OAAO,QAAQ,CAAC,EAAE,OAAO,MAAM,MAAA,GAAS,EAAE,OAAO,MAAM,KAAA,CAAM,IAAI;AAE9E,8BACG,OAAA,EAAI,WAAW,uBAAuB,OAAO,mBAAmB,EAAE,IACjE,UAAA;AAAA,IAAA,oBAAC,YAAA,EAAY,GAAG,QAAQ,YAAY,cAAc,MAAM;AAAA,IACvD,QAAQ,oBAAC,OAAA,EAAI,WAAU,aAAa,UAAA,MAAK;AAAA,IAE1C,oBAAC,OAAA,EAAI,WAAW,GAAG,OAAO,SAAS,kBAAkB,IAAI,OAAO,iDAAiD,EAAE,IAAK,SAAA,CAAS;AAAA,EAAA,GACnI;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageHeader.js","sources":["../../../../../../src/v1/components/layout/PageHeader/PageHeader.tsx"],"sourcesContent":["import React from 'react'\
|
|
1
|
+
{"version":3,"file":"PageHeader.js","sources":["../../../../../../src/v1/components/layout/PageHeader/PageHeader.tsx"],"sourcesContent":["import React from 'react'\n\n/** Um nível do caminho por cima do título. */\nexport interface BreadcrumbItem {\n label: React.ReactNode\n /** Ligação normal. Para o router da app, usar `onClick` (ex: `() => navigate('/x')`). */\n href?: string\n onClick?: () => void\n}\n\nexport interface PageHeaderProps {\n title: React.ReactNode\n description?: React.ReactNode\n /**\n * Caminho até à página (área › lista › registo). O último nível é a página\n * atual e não leva ligação, mesmo que a traga.\n */\n breadcrumb?: BreadcrumbItem[]\n /** Botões da página (ex: \"Novo\", \"Editar\"). Ficam à direita e descem em ecrã estreito. */\n actions?: React.ReactNode\n /** Linha extra por baixo da descrição (etiquetas de estado, responsável…). */\n extra?: React.ReactNode\n /** Nome da navegação do caminho, para leitores de ecrã. Por omissão: \"Caminho\". */\n breadcrumbLabel?: string\n}\n\n/**\n * Cabeçalho comum a todas as páginas: caminho, título com a barra turquesa,\n * descrição e ações.\n *\n * Existe para o título deixar de ser desenhado à mão em cada ecrã — com\n * tamanhos, cores e posições diferentes de página para página. O nome no menu,\n * o título e o último nível do caminho devem ser o mesmo texto.\n *\n * Normalmente usa-se através do `Page`, que também arruma os separadores e o\n * conteúdo por baixo.\n */\nexport default function PageHeader({ title, description, breadcrumb, actions, extra, breadcrumbLabel = 'Caminho' }: PageHeaderProps) {\n // Título igual ao último nível do caminho (ex: \"TK-4693\"): no telemóvel o caminho, ao lado do menu,\n // já o mostra, e repeti-lo logo por baixo só gasta altura. Fica para leitores de ecrã (sr-only).\n const ultimo = breadcrumb?.[breadcrumb.length - 1]?.label\n const repeteCaminho = (typeof title === 'string' || typeof title === 'number') && title === ultimo\n const soLeitor = repeteCaminho ? 'max-sm:sr-only' : ''\n return (\n // Dentro do AppShell, em ecrã estreito, o caminho e o título ficam ao lado do botão do menu.\n <header className=\"flex flex-col gap-3 mt-[calc(var(--app-shell-title-lift,0px)*-1)]\">\n {breadcrumb && breadcrumb.length > 0 && (\n // --app-shell-menu-row (AppShell, ecrã estreito): a linha do caminho tem a altura do botão do menu,\n // para o título, que vem por baixo com a largura toda, nunca ficar tapado pelo botão.\n <nav aria-label={breadcrumbLabel} className=\"flex min-h-[var(--app-shell-menu-row,0px)] items-center pl-[var(--app-shell-menu-inset,0px)]\">\n <ol className=\"m-0 flex min-w-0 list-none flex-wrap items-center gap-1.5 p-0 text-xs font-semibold text-muted-foreground\">\n {breadcrumb.map((n, i) => {\n const last = i === breadcrumb.length - 1\n const link = 'cursor-pointer border-0 bg-transparent p-0 font-semibold text-proef-blue no-underline hover:text-primary hover:underline dark:text-sky-300 dark:hover:text-sky-200'\n return (\n <li key={i} className=\"flex items-center gap-1.5\">\n {last ? (\n <span aria-current=\"page\" className=\"text-foreground/70\">\n {n.label}\n </span>\n ) : n.href ? (\n <a href={n.href} onClick={n.onClick} className={link}>\n {n.label}\n </a>\n ) : n.onClick ? (\n <button type=\"button\" onClick={n.onClick} className={`text-xs ${link}`}>\n {n.label}\n </button>\n ) : (\n <span>{n.label}</span>\n )}\n {!last && (\n <span aria-hidden=\"true\" className=\"text-muted-foreground/60\">\n ›\n </span>\n )}\n </li>\n )\n })}\n </ol>\n </nav>\n )}\n <div className=\"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between\">\n <div className=\"min-w-0\">\n {/* Tamanho pelo token --text-page-title (tokens.css): igual em todos os portais; no telemóvel\n baixa para 18px e sem maiúsculas (em 18px, um título longo em maiúsculas lê-se mal). Com caminho, este já fica ao lado do botão do menu e o título usa a largura\n toda por baixo — um título longo (ex: assunto de um ticket) não fica numa coluna estreita. */}\n <h1 className={`m-0 ${breadcrumb && breadcrumb.length > 0 ? '' : 'pl-[var(--app-shell-menu-inset,0px)]'} text-page-title max-sm:text-lg max-sm:leading-6 font-black tracking-tighter text-primary uppercase max-sm:normal-case dark:text-foreground ${soLeitor}`}>{title}</h1>\n <div className={`mt-1 ${breadcrumb && breadcrumb.length > 0 ? '' : 'ml-[var(--app-shell-menu-inset,0px)]'} h-1 w-12 bg-proef-turquoise ${repeteCaminho ? 'max-sm:hidden' : ''}`} />\n {description && <p className=\"m-0 mt-3 text-sm font-medium text-muted-foreground\">{description}</p>}\n {/* empty:hidden: um botão condicional que não aparece (ex: `<>{cond && <b/>}</>`)\n não deixa espaço vazio por baixo do título. */}\n {extra && <div className=\"mt-2 flex flex-wrap items-center gap-2 empty:hidden\">{extra}</div>}\n </div>\n {/* No telemóvel os botões ficam numa linha própria por baixo e repartem a largura toda, como os\n filtros das listas. Se a página os embrulhar num contentor, este estica e ela reparte por dentro. */}\n {actions && <div className=\"flex shrink-0 flex-wrap items-center gap-2 max-sm:[&>*]:flex-1 empty:hidden\">{actions}</div>}\n </div>\n </header>\n )\n}\n"],"names":[],"mappings":";AAqCA,SAAwB,WAAW,EAAE,OAAO,aAAa,YAAY,SAAS,OAAO,kBAAkB,aAA8B;AAGnI,QAAM,SAAS,aAAa,WAAW,SAAS,CAAC,GAAG;AACpD,QAAM,iBAAiB,OAAO,UAAU,YAAY,OAAO,UAAU,aAAa,UAAU;AAC5F,QAAM,WAAW,gBAAgB,mBAAmB;AACpD;AAAA;AAAA,IAEE,qBAAC,UAAA,EAAO,WAAU,qEACf,UAAA;AAAA,MAAA,cAAc,WAAW,SAAS;AAAA;AAAA,MAGjC,oBAAC,OAAA,EAAI,cAAY,iBAAiB,WAAU,gGAC1C,UAAA,oBAAC,MAAA,EAAG,WAAU,6GACX,UAAA,WAAW,IAAI,CAAC,GAAG,MAAM;AACxB,cAAM,OAAO,MAAM,WAAW,SAAS;AACvC,cAAM,OAAO;AACb,eACE,qBAAC,MAAA,EAAW,WAAU,6BACnB,UAAA;AAAA,UAAA,2BACE,QAAA,EAAK,gBAAa,QAAO,WAAU,sBACjC,YAAE,MAAA,CACL,IACE,EAAE,OACJ,oBAAC,OAAE,MAAM,EAAE,MAAM,SAAS,EAAE,SAAS,WAAW,MAC7C,YAAE,MAAA,CACL,IACE,EAAE,UACJ,oBAAC,YAAO,MAAK,UAAS,SAAS,EAAE,SAAS,WAAW,WAAW,IAAI,IACjE,UAAA,EAAE,MAAA,CACL,IAEA,oBAAC,QAAA,EAAM,YAAE,MAAA,CAAM;AAAA,UAEhB,CAAC,QACA,oBAAC,QAAA,EAAK,eAAY,QAAO,WAAU,4BAA2B,UAAA,IAAA,CAE9D;AAAA,QAAA,EAAA,GAnBK,CAqBT;AAAA,MAEJ,CAAC,GACH,GACF;AAAA,MAEF,qBAAC,OAAA,EAAI,WAAU,mEACb,UAAA;AAAA,QAAA,qBAAC,OAAA,EAAI,WAAU,WAIb,UAAA;AAAA,UAAA,oBAAC,MAAA,EAAG,WAAW,OAAO,cAAc,WAAW,SAAS,IAAI,KAAK,sCAAsC,+IAA+I,QAAQ,IAAK,UAAA,OAAM;AAAA,UACzQ,oBAAC,OAAA,EAAI,WAAW,QAAQ,cAAc,WAAW,SAAS,IAAI,KAAK,sCAAsC,gCAAgC,gBAAgB,kBAAkB,EAAE,IAAI;AAAA,UAChL,eAAe,oBAAC,KAAA,EAAE,WAAU,sDAAsD,UAAA,aAAY;AAAA,UAG9F,SAAS,oBAAC,OAAA,EAAI,WAAU,uDAAuD,UAAA,MAAA,CAAM;AAAA,QAAA,GACxF;AAAA,QAGC,WAAW,oBAAC,OAAA,EAAI,WAAU,+EAA+E,UAAA,QAAA,CAAQ;AAAA,MAAA,EAAA,CACpH;AAAA,IAAA,EAAA,CACF;AAAA;AAEJ;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React, { useState, useEffect } from "react";
|
|
2
|
+
import React, { useState, useEffect, useRef } from "react";
|
|
3
3
|
import { useLocation, NavLink } from "react-router-dom";
|
|
4
4
|
import { dentroDaApp } from "../../../capabilities/onepoint-rn/dentroDaApp.js";
|
|
5
5
|
import { SunIcon, MoonIcon, MonitorIcon, CloseIcon, ChevronLeftIcon, ChevronRightIcon, PanelOpenIcon, ChevronDownIcon, GlobeIcon, LogOutIcon, ExternalLinkIcon } from "../../../foundations/icons/icons.js";
|
|
6
6
|
const SIDENAV_LABELS = {
|
|
7
|
+
openMenu: "Abrir menu",
|
|
7
8
|
closeMenu: "Fechar menu",
|
|
8
9
|
expandMenu: "Expandir menu",
|
|
9
10
|
collapseMenu: "Recolher menu",
|
|
@@ -19,6 +20,7 @@ const SIDENAV_LABELS = {
|
|
|
19
20
|
};
|
|
20
21
|
const DRAWER_MAX = 1024;
|
|
21
22
|
const isDrawer = () => typeof window !== "undefined" && window.innerWidth < DRAWER_MAX;
|
|
23
|
+
const isTopDrawer = () => typeof window !== "undefined" && !!window.matchMedia?.(`(max-width: ${DRAWER_MAX - 0.02}px) and (max-height: 500px)`).matches;
|
|
22
24
|
function formatDeploy(value) {
|
|
23
25
|
const d = value instanceof Date ? value : new Date(value);
|
|
24
26
|
if (Number.isNaN(d.getTime())) return "";
|
|
@@ -57,7 +59,16 @@ function SideNav({
|
|
|
57
59
|
const location = useLocation();
|
|
58
60
|
const [hovered, setHovered] = useState(false);
|
|
59
61
|
const [collapsed, setCollapsed] = useState({});
|
|
60
|
-
const
|
|
62
|
+
const [gaveta, setGaveta] = useState(isDrawer);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!window.matchMedia) return;
|
|
65
|
+
const mq = window.matchMedia(`(max-width: ${DRAWER_MAX - 0.02}px)`);
|
|
66
|
+
const onChange = () => setGaveta(mq.matches);
|
|
67
|
+
onChange();
|
|
68
|
+
mq.addEventListener("change", onChange);
|
|
69
|
+
return () => mq.removeEventListener("change", onChange);
|
|
70
|
+
}, []);
|
|
71
|
+
const expanded = open || hovered || gaveta;
|
|
61
72
|
useEffect(() => {
|
|
62
73
|
const reset = () => setHovered(false);
|
|
63
74
|
window.addEventListener("blur", reset);
|
|
@@ -73,6 +84,54 @@ function SideNav({
|
|
|
73
84
|
const closeIfDrawer = () => {
|
|
74
85
|
if (isDrawer()) onOpenChange(false);
|
|
75
86
|
};
|
|
87
|
+
const LIMIAR = 0.3;
|
|
88
|
+
const VELOCIDADE = 0.5;
|
|
89
|
+
const asideRef = useRef(null);
|
|
90
|
+
const arrasto = useRef(null);
|
|
91
|
+
const ignorarClique = useRef(false);
|
|
92
|
+
const [desvio, setDesvio] = useState(null);
|
|
93
|
+
const [espreita, setEspreita] = useState(null);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (espreita === null) return;
|
|
96
|
+
const t = setTimeout(() => setEspreita(null), 300);
|
|
97
|
+
return () => clearTimeout(t);
|
|
98
|
+
}, [espreita]);
|
|
99
|
+
const onTabDown = (e) => {
|
|
100
|
+
if (e.button !== 0 || !asideRef.current) return;
|
|
101
|
+
const deitado = isTopDrawer();
|
|
102
|
+
arrasto.current = {
|
|
103
|
+
id: e.pointerId,
|
|
104
|
+
inicio: deitado ? e.clientY : e.clientX,
|
|
105
|
+
t: e.timeStamp,
|
|
106
|
+
tamanho: deitado ? asideRef.current.offsetHeight : asideRef.current.offsetWidth,
|
|
107
|
+
deitado,
|
|
108
|
+
desvio: 0,
|
|
109
|
+
moveu: false
|
|
110
|
+
};
|
|
111
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
112
|
+
};
|
|
113
|
+
const onTabMove = (e) => {
|
|
114
|
+
const a = arrasto.current;
|
|
115
|
+
if (!a || a.id !== e.pointerId) return;
|
|
116
|
+
const d = (a.deitado ? e.clientY : e.clientX) - a.inicio;
|
|
117
|
+
if (!a.moveu && Math.abs(d) < 6) return;
|
|
118
|
+
a.moveu = true;
|
|
119
|
+
a.desvio = open ? Math.max(-a.tamanho, Math.min(0, d)) : Math.max(0, Math.min(a.tamanho, d));
|
|
120
|
+
setDesvio({ px: a.desvio, deitado: a.deitado });
|
|
121
|
+
};
|
|
122
|
+
const onTabUp = (e) => {
|
|
123
|
+
const a = arrasto.current;
|
|
124
|
+
arrasto.current = null;
|
|
125
|
+
if (!a || a.id !== e.pointerId || !a.moveu) return;
|
|
126
|
+
ignorarClique.current = true;
|
|
127
|
+
const rapido = Math.abs(a.desvio) / Math.max(1, e.timeStamp - a.t) > VELOCIDADE;
|
|
128
|
+
setDesvio(null);
|
|
129
|
+
if (Math.abs(a.desvio) > a.tamanho * LIMIAR || rapido) onOpenChange(!open);
|
|
130
|
+
};
|
|
131
|
+
const onTabCancel = () => {
|
|
132
|
+
arrasto.current = null;
|
|
133
|
+
setDesvio(null);
|
|
134
|
+
};
|
|
76
135
|
const themeOptions = [
|
|
77
136
|
{ value: "light", Icon: SunIcon, label: labels.light },
|
|
78
137
|
{ value: "dark", Icon: MoonIcon, label: labels.dark },
|
|
@@ -83,7 +142,7 @@ function SideNav({
|
|
|
83
142
|
const footerIconButton = "flex cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent p-2 text-white/30 transition-colors hover:bg-white/5 hover:text-proef-turquoise focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none";
|
|
84
143
|
const renderItem = (item) => {
|
|
85
144
|
const badges = (item.badges ?? []).filter((b) => b.count > 0);
|
|
86
|
-
const rowClass = (active) => `mx-2 flex items-center gap-4 rounded-lg no-underline transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none ${expanded ? "px-6 py-3 lg:py-2.5" : "justify-center px-0 py-3 lg:py-2.5"} ${active ? "bg-proef-turquoise/15 font-semibold text-proef-turquoise" : "text-white/50 hover:bg-white/5 hover:text-white"}`;
|
|
145
|
+
const rowClass = (active) => `mx-2 flex items-center gap-4 rounded-lg no-underline transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none ${expanded ? "px-6 py-3 lg:py-2.5 max-lg:[@media(max-height:500px)]:mx-0 max-lg:[@media(max-height:500px)]:gap-3 max-lg:[@media(max-height:500px)]:px-3 max-lg:[@media(max-height:500px)]:py-2" : "justify-center px-0 py-3 lg:py-2.5"} ${active ? "bg-proef-turquoise/15 font-semibold text-proef-turquoise" : "text-white/50 hover:bg-white/5 hover:text-white"}`;
|
|
87
146
|
const content = (active) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
88
147
|
/* @__PURE__ */ jsxs("span", { className: "relative flex-none", children: [
|
|
89
148
|
/* @__PURE__ */ jsx(item.icon, { size: 20, className: active ? "drop-shadow-[0_0_6px_rgba(0,230,200,0.6)]" : "" }),
|
|
@@ -142,10 +201,25 @@ function SideNav({
|
|
|
142
201
|
if (e.pointerType === "mouse" && !open) setHovered(true);
|
|
143
202
|
},
|
|
144
203
|
onPointerLeave: () => setHovered(false),
|
|
145
|
-
|
|
146
|
-
|
|
204
|
+
ref: asideRef,
|
|
205
|
+
style: {
|
|
206
|
+
top: "var(--app-shell-top, 0px)",
|
|
207
|
+
height: "calc(100dvh - var(--app-shell-top, 0px))",
|
|
208
|
+
// A espreitar (toque com a gaveta fechada): com a transição de sempre, para ir e voltar suave.
|
|
209
|
+
...espreita !== null && !open && !desvio && { translate: espreita ? "0 calc(-100% + 20px)" : "calc(-100% + 20px) 0" },
|
|
210
|
+
...desvio && {
|
|
211
|
+
translate: desvio.deitado ? `0 calc(${open ? "0%" : "-100%"} + ${desvio.px}px)` : `calc(${open ? "0%" : "-100%"} + ${desvio.px}px) 0`,
|
|
212
|
+
transition: "none"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
className: (
|
|
216
|
+
// max-lg:overflow-visible: o separador vive fora da gaveta (a lista e o rodapé tratam do seu próprio scroll).
|
|
217
|
+
// Gaveta (max-lg) sem o risco da borda: o separador sai dessa borda e o risco cortava-o da gaveta.
|
|
218
|
+
// Deitado, o canto de baixo à esquerda é reto — é dali que o separador se pendura.
|
|
219
|
+
`fixed left-0 z-40 flex w-64 flex-col overflow-hidden max-lg:overflow-visible border-r border-white/10 max-lg:border-r-0 bg-proef-navy text-white transition-[translate,width,box-shadow] duration-300 max-lg:[@media(max-height:500px)]:right-0 max-lg:[@media(max-height:500px)]:w-auto max-lg:[@media(max-height:500px)]:h-auto! max-lg:[@media(max-height:500px)]:max-h-[85dvh] max-lg:[@media(max-height:500px)]:rounded-br-2xl max-lg:[@media(max-height:500px)]:pl-[env(safe-area-inset-left)] max-lg:[@media(max-height:500px)]:pr-[env(safe-area-inset-right)] max-lg:[@media(max-height:500px)]:translate-x-0 ${open ? "translate-x-0 max-lg:[@media(max-height:500px)]:translate-y-0 max-lg:[@media(max-height:500px)]:shadow-2xl" : "-translate-x-full max-lg:[@media(max-height:500px)]:-translate-y-full"} lg:translate-x-0 ${expanded ? "lg:w-64" : "lg:w-20"}`
|
|
220
|
+
),
|
|
147
221
|
children: [
|
|
148
|
-
/* @__PURE__ */ jsxs("div", { className: `flex h-16 flex-none items-center px-4 ${expanded ? "justify-between" : "justify-center"}`, children: [
|
|
222
|
+
/* @__PURE__ */ jsxs("div", { className: `flex h-16 max-lg:[@media(max-height:500px)]:h-14 flex-none items-center px-4 ${expanded ? "justify-between" : "justify-center"}`, children: [
|
|
149
223
|
expanded && /* @__PURE__ */ jsxs("div", { className: "flex flex-col pl-2", children: [
|
|
150
224
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
151
225
|
/* @__PURE__ */ jsx("span", { className: "text-3xl font-black tracking-tighter text-white", children: "proef" }),
|
|
@@ -155,13 +229,13 @@ function SideNav({
|
|
|
155
229
|
] }),
|
|
156
230
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
157
231
|
avatar && /* @__PURE__ */ jsx("div", { className: "flex-none", children: avatar }),
|
|
158
|
-
open && expanded && /* @__PURE__ */ jsxs(
|
|
232
|
+
open && expanded && !gaveta && /* @__PURE__ */ jsxs(
|
|
159
233
|
"button",
|
|
160
234
|
{
|
|
161
235
|
type: "button",
|
|
162
236
|
onClick: () => onOpenChange(false),
|
|
163
237
|
"aria-label": isDrawer() ? labels.closeMenu : labels.collapseMenu,
|
|
164
|
-
className: "flex cursor-pointer items-center justify-center rounded-lg border-0 bg-white/5 p-2.5 text-white/40 transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none lg:p-1.5",
|
|
238
|
+
className: "flex cursor-pointer items-center justify-center rounded-lg border-0 bg-white/5 p-2.5 text-white/40 transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none max-lg:hidden lg:p-1.5",
|
|
165
239
|
children: [
|
|
166
240
|
/* @__PURE__ */ jsx(CloseIcon, { size: 18, className: "lg:hidden" }),
|
|
167
241
|
/* @__PURE__ */ jsx(ChevronLeftIcon, { size: 16, className: "hidden lg:block" })
|
|
@@ -180,7 +254,7 @@ function SideNav({
|
|
|
180
254
|
)
|
|
181
255
|
] })
|
|
182
256
|
] }),
|
|
183
|
-
/* @__PURE__ */ jsxs("nav", { className: "flex-1 overflow-x-hidden overflow-y-auto pt-2", children: [
|
|
257
|
+
/* @__PURE__ */ jsxs("nav", { className: "flex-1 overflow-x-hidden overflow-y-auto pt-2 max-lg:[@media(max-height:500px)]:flex max-lg:[@media(max-height:500px)]:min-h-0 max-lg:[@media(max-height:500px)]:items-stretch max-lg:[@media(max-height:500px)]:overflow-y-hidden max-lg:[@media(max-height:500px)]:gap-1 max-lg:[@media(max-height:500px)]:px-2 max-lg:[@media(max-height:500px)]:pt-0 max-lg:[@media(max-height:500px)]:pb-2", children: [
|
|
184
258
|
!expanded && /* @__PURE__ */ jsx(
|
|
185
259
|
"button",
|
|
186
260
|
{
|
|
@@ -192,96 +266,164 @@ function SideNav({
|
|
|
192
266
|
children: /* @__PURE__ */ jsx(PanelOpenIcon, { size: 20 })
|
|
193
267
|
}
|
|
194
268
|
),
|
|
195
|
-
ungrouped.map(renderItem),
|
|
269
|
+
ungrouped.length > 0 && /* @__PURE__ */ jsx("div", { className: "max-lg:[@media(max-height:500px)]:min-w-40 max-lg:[@media(max-height:500px)]:flex-1 max-lg:[@media(max-height:500px)]:min-h-0 max-lg:[@media(max-height:500px)]:overflow-y-auto max-lg:[@media(max-height:500px)]:mt-[1.875rem]", children: ungrouped.map(renderItem) }),
|
|
196
270
|
groups.map((g) => {
|
|
197
271
|
const isOpen = expanded ? !collapsed[g] : g === activeGroup;
|
|
198
272
|
const name = groupLabels[g] ?? g;
|
|
199
|
-
return /* @__PURE__ */ jsxs(
|
|
200
|
-
|
|
201
|
-
"button",
|
|
202
|
-
{
|
|
203
|
-
type: "button",
|
|
204
|
-
onClick: () => setCollapsed((prev) => ({ ...prev, [g]: !prev[g] })),
|
|
205
|
-
"aria-expanded": isOpen,
|
|
206
|
-
"aria-label": `${isOpen ? labels.closeGroup : labels.openGroup} ${name}`,
|
|
207
|
-
className: "group/grp w-full cursor-pointer border-0 bg-transparent px-6 pt-5 pb-3 text-left focus-visible:outline-none lg:pb-1.5",
|
|
208
|
-
children: [
|
|
209
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between", children: [
|
|
210
|
-
/* @__PURE__ */ jsx("span", { className: "text-[9px] font-black tracking-[0.25em] text-white/30 uppercase transition-colors group-hover/grp:text-white/50 group-focus-visible/grp:text-white", children: name }),
|
|
211
|
-
/* @__PURE__ */ jsx(ChevronDownIcon, { size: 10, className: `text-white/30 transition-transform group-hover/grp:text-white/50 ${isOpen ? "" : "-rotate-90"}` })
|
|
212
|
-
] }),
|
|
213
|
-
/* @__PURE__ */ jsx("span", { className: "mt-1 block h-px bg-white/10" })
|
|
214
|
-
]
|
|
215
|
-
}
|
|
216
|
-
) : isOpen && /* @__PURE__ */ jsx("div", { className: "mx-auto my-3 h-px w-8 bg-white/15" }),
|
|
217
|
-
isOpen && menu.filter((item) => item.group === g).map(renderItem)
|
|
218
|
-
] }, g);
|
|
219
|
-
})
|
|
220
|
-
] }),
|
|
221
|
-
/* @__PURE__ */ jsxs("div", { className: `mt-auto flex flex-none flex-col border-t border-white/10 px-2 py-3 ${expanded ? "gap-2" : "items-center gap-3"}`, children: [
|
|
222
|
-
footer && /* @__PURE__ */ jsx("div", { className: expanded ? "" : "flex w-full justify-center", children: footer(expanded) }),
|
|
223
|
-
onThemeChange && (expanded ? /* @__PURE__ */ jsxs("div", { children: [
|
|
224
|
-
/* @__PURE__ */ jsx("p", { className: "m-0 px-1 pb-1 text-[8px] font-black tracking-[0.25em] text-white/30 uppercase", children: labels.theme }),
|
|
225
|
-
/* @__PURE__ */ jsx("div", { role: "group", "aria-label": labels.theme, className: "grid grid-cols-3 gap-1 rounded-lg border border-white/5 bg-white/5 p-1", children: themeOptions.map(({ value, Icon, label }) => /* @__PURE__ */ jsxs(
|
|
226
|
-
"button",
|
|
273
|
+
return /* @__PURE__ */ jsxs(
|
|
274
|
+
"div",
|
|
227
275
|
{
|
|
228
|
-
|
|
229
|
-
onClick: () => onThemeChange(value),
|
|
230
|
-
"aria-pressed": currentTheme.value === value,
|
|
231
|
-
className: `flex cursor-pointer flex-col items-center gap-1 rounded-md border-0 py-1.5 text-[8px] font-black tracking-wider uppercase transition-colors focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none ${currentTheme.value === value ? "bg-proef-turquoise/15 text-proef-turquoise" : "bg-transparent text-white/40 hover:bg-white/5 hover:text-white/70"}`,
|
|
276
|
+
className: "max-lg:[@media(max-height:500px)]:flex max-lg:[@media(max-height:500px)]:min-h-0 max-lg:[@media(max-height:500px)]:min-w-40 max-lg:[@media(max-height:500px)]:flex-1 max-lg:[@media(max-height:500px)]:flex-col",
|
|
232
277
|
children: [
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
|
|
278
|
+
expanded ? /* @__PURE__ */ jsxs(
|
|
279
|
+
"button",
|
|
280
|
+
{
|
|
281
|
+
type: "button",
|
|
282
|
+
onClick: () => setCollapsed((prev) => ({ ...prev, [g]: !prev[g] })),
|
|
283
|
+
"aria-expanded": isOpen,
|
|
284
|
+
"aria-label": `${isOpen ? labels.closeGroup : labels.openGroup} ${name}`,
|
|
285
|
+
className: "group/grp w-full cursor-pointer border-0 bg-transparent px-6 pt-5 pb-3 text-left focus-visible:outline-none lg:pb-1.5 max-lg:[@media(max-height:500px)]:flex-none max-lg:[@media(max-height:500px)]:px-3 max-lg:[@media(max-height:500px)]:pt-2 max-lg:[@media(max-height:500px)]:pb-1.5",
|
|
286
|
+
children: [
|
|
287
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between", children: [
|
|
288
|
+
/* @__PURE__ */ jsx("span", { className: "text-[9px] font-black tracking-[0.25em] text-white/30 uppercase transition-colors group-hover/grp:text-white/50 group-focus-visible/grp:text-white", children: name }),
|
|
289
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { size: 10, className: `text-white/30 transition-transform group-hover/grp:text-white/50 ${isOpen ? "" : "-rotate-90"}` })
|
|
290
|
+
] }),
|
|
291
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1 block h-px bg-white/10" })
|
|
292
|
+
]
|
|
293
|
+
}
|
|
294
|
+
) : isOpen && /* @__PURE__ */ jsx("div", { className: "mx-auto my-3 h-px w-8 bg-white/15" }),
|
|
295
|
+
isOpen && /* @__PURE__ */ jsx("div", { className: "max-lg:[@media(max-height:500px)]:min-h-0 max-lg:[@media(max-height:500px)]:flex-1 max-lg:[@media(max-height:500px)]:overflow-y-auto max-lg:[@media(max-height:500px)]:[scrollbar-width:thin] max-lg:[@media(max-height:500px)]:[scrollbar-color:rgba(255,255,255,0.15)_transparent]", children: menu.filter((item) => item.group === g).map(renderItem) })
|
|
235
296
|
]
|
|
236
297
|
},
|
|
237
|
-
|
|
238
|
-
)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
className:
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
298
|
+
g
|
|
299
|
+
);
|
|
300
|
+
})
|
|
301
|
+
] }),
|
|
302
|
+
/* @__PURE__ */ jsxs(
|
|
303
|
+
"div",
|
|
304
|
+
{
|
|
305
|
+
className: `mt-auto flex flex-none flex-col border-t border-white/10 px-2 py-3 max-lg:[@media(max-height:500px)]:mt-0 max-lg:[@media(max-height:500px)]:flex-row max-lg:[@media(max-height:500px)]:items-center max-lg:[@media(max-height:500px)]:px-3 max-lg:[@media(max-height:500px)]:py-2 ${expanded ? "gap-2" : "items-center gap-3"}`,
|
|
306
|
+
children: [
|
|
307
|
+
footer && /* @__PURE__ */ jsx("div", { className: expanded ? "max-lg:[@media(max-height:500px)]:min-w-0 max-lg:[@media(max-height:500px)]:flex-1" : "flex w-full justify-center", children: footer(expanded) }),
|
|
308
|
+
onThemeChange && (expanded ? /* @__PURE__ */ jsxs("div", { children: [
|
|
309
|
+
/* @__PURE__ */ jsx("p", { className: "m-0 px-1 pb-1 text-[8px] font-black tracking-[0.25em] text-white/30 uppercase", children: labels.theme }),
|
|
310
|
+
/* @__PURE__ */ jsx("div", { role: "group", "aria-label": labels.theme, className: "grid grid-cols-3 gap-1 rounded-lg border border-white/5 bg-white/5 p-1", children: themeOptions.map(({ value, Icon, label }) => /* @__PURE__ */ jsxs(
|
|
311
|
+
"button",
|
|
312
|
+
{
|
|
313
|
+
type: "button",
|
|
314
|
+
onClick: () => onThemeChange(value),
|
|
315
|
+
"aria-pressed": currentTheme.value === value,
|
|
316
|
+
className: `flex cursor-pointer flex-col items-center gap-1 rounded-md border-0 py-1.5 text-[8px] font-black tracking-wider uppercase transition-colors focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none ${currentTheme.value === value ? "bg-proef-turquoise/15 text-proef-turquoise" : "bg-transparent text-white/40 hover:bg-white/5 hover:text-white/70"}`,
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ jsx(Icon, { size: 14 }),
|
|
319
|
+
label
|
|
320
|
+
]
|
|
321
|
+
},
|
|
322
|
+
value
|
|
323
|
+
)) })
|
|
324
|
+
] }) : /* @__PURE__ */ jsx(
|
|
325
|
+
"button",
|
|
326
|
+
{
|
|
327
|
+
type: "button",
|
|
328
|
+
onClick: () => onThemeChange(cycle(themeOptions, currentTheme).value),
|
|
329
|
+
"aria-label": `${labels.theme}: ${currentTheme.label}`,
|
|
330
|
+
"data-tip": `${labels.theme}: ${currentTheme.label}`,
|
|
331
|
+
className: footerIconButton,
|
|
332
|
+
children: /* @__PURE__ */ jsx(currentTheme.Icon, { size: 18 })
|
|
333
|
+
}
|
|
334
|
+
)),
|
|
335
|
+
languages && languages.length > 0 && onLanguageChange && (expanded ? /* @__PURE__ */ jsx("div", { role: "group", "aria-label": labels.language, className: "flex gap-1 max-lg:[@media(max-height:500px)]:w-28 max-lg:[@media(max-height:500px)]:flex-none", children: languages.map((l) => /* @__PURE__ */ jsx(
|
|
336
|
+
"button",
|
|
337
|
+
{
|
|
338
|
+
type: "button",
|
|
339
|
+
onClick: () => onLanguageChange(l.code),
|
|
340
|
+
"aria-pressed": currentLanguage === l.code,
|
|
341
|
+
className: `flex-1 cursor-pointer rounded-md border bg-transparent py-1.5 text-[10px] font-black tracking-widest uppercase transition-colors focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none ${currentLanguage === l.code ? "border-proef-turquoise/40 text-proef-turquoise" : "border-white/5 text-white/40 hover:border-white/20 hover:text-white"}`,
|
|
342
|
+
children: l.label
|
|
343
|
+
},
|
|
344
|
+
l.code
|
|
345
|
+
)) }) : /* @__PURE__ */ jsx(
|
|
346
|
+
"button",
|
|
347
|
+
{
|
|
348
|
+
type: "button",
|
|
349
|
+
onClick: () => {
|
|
350
|
+
const codes = languages.map((l) => l.code);
|
|
351
|
+
onLanguageChange(cycle(codes, currentLanguage ?? codes[0]));
|
|
352
|
+
},
|
|
353
|
+
"aria-label": `${labels.language}: ${currentLanguage?.toUpperCase() ?? ""}`,
|
|
354
|
+
"data-tip": `${labels.language}: ${currentLanguage?.toUpperCase() ?? ""}`,
|
|
355
|
+
className: footerIconButton,
|
|
356
|
+
children: /* @__PURE__ */ jsx(GlobeIcon, { size: 18 })
|
|
357
|
+
}
|
|
358
|
+
)),
|
|
359
|
+
mostrarLogout && (expanded ? /* @__PURE__ */ jsx(
|
|
360
|
+
"button",
|
|
361
|
+
{
|
|
362
|
+
type: "button",
|
|
363
|
+
onClick: onLogout,
|
|
364
|
+
className: "w-full max-lg:[@media(max-height:500px)]:w-auto max-lg:[@media(max-height:500px)]:flex-none max-lg:[@media(max-height:500px)]:px-4 max-lg:[@media(max-height:500px)]:py-2 cursor-pointer rounded-lg border border-white/5 bg-transparent py-2.5 text-center text-[10px] font-black tracking-widest text-white/40 uppercase transition-colors hover:border-proef-turquoise/30 hover:text-proef-turquoise focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none",
|
|
365
|
+
children: labels.logout
|
|
366
|
+
}
|
|
367
|
+
) : /* @__PURE__ */ jsx("button", { type: "button", onClick: onLogout, "aria-label": labels.logout, "data-tip": labels.logout, className: footerIconButton, children: /* @__PURE__ */ jsx(LogOutIcon, { size: 18 }) })),
|
|
368
|
+
deployedAt != null && expanded && /* @__PURE__ */ jsx("p", { "data-tip": labels.deployedAt, className: "m-0 text-center text-[9px] tracking-wider text-white/25 tabular-nums select-text max-lg:[@media(max-height:500px)]:flex-none max-lg:[@media(max-height:500px)]:whitespace-nowrap", children: formatDeploy(deployedAt) })
|
|
369
|
+
]
|
|
370
|
+
}
|
|
371
|
+
),
|
|
372
|
+
gaveta && /* @__PURE__ */ jsxs(
|
|
373
|
+
"button",
|
|
374
|
+
{
|
|
375
|
+
type: "button",
|
|
376
|
+
onClick: (e) => {
|
|
377
|
+
if (ignorarClique.current) {
|
|
378
|
+
ignorarClique.current = false;
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
if (!open && e.detail !== 0) {
|
|
382
|
+
setEspreita(isTopDrawer());
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
onOpenChange(!open);
|
|
258
386
|
},
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
387
|
+
onPointerDown: onTabDown,
|
|
388
|
+
onPointerMove: onTabMove,
|
|
389
|
+
onPointerUp: onTabUp,
|
|
390
|
+
onPointerCancel: onTabCancel,
|
|
391
|
+
"aria-expanded": open,
|
|
392
|
+
"aria-label": open ? labels.closeMenu : labels.openMenu,
|
|
393
|
+
className: (
|
|
394
|
+
// touch-none: o arrasto é nosso — sem ele o browser rolava a página com o mesmo dedo.
|
|
395
|
+
`group/tab absolute top-3 left-full flex h-14 w-5 touch-none select-none items-center justify-center gap-[3px] border-0 bg-transparent p-0 outline-none [-webkit-tap-highlight-color:transparent] lg:hidden ${desvio ? "cursor-grabbing" : "cursor-grab"} after:absolute after:-top-1 after:-bottom-1 after:left-0 after:-right-5 after:content-[''] max-lg:[@media(max-height:500px)]:top-full max-lg:[@media(max-height:500px)]:left-[calc(env(safe-area-inset-left,0px)+0.5rem)] max-lg:[@media(max-height:500px)]:h-5 max-lg:[@media(max-height:500px)]:w-10 max-lg:[@media(max-height:500px)]:flex-col max-lg:[@media(max-height:500px)]:after:right-0 max-lg:[@media(max-height:500px)]:after:-bottom-5`
|
|
396
|
+
),
|
|
397
|
+
children: [
|
|
398
|
+
/* @__PURE__ */ jsx(
|
|
399
|
+
"svg",
|
|
400
|
+
{
|
|
401
|
+
"aria-hidden": true,
|
|
402
|
+
viewBox: "0 0 22 72",
|
|
403
|
+
className: "pointer-events-none absolute -top-2 -left-0.5 h-[72px] w-[22px] fill-proef-navy max-lg:[@media(max-height:500px)]:hidden",
|
|
404
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0H2A8 8 0 0 0 10 8H14A8 8 0 0 1 22 16V56A8 8 0 0 1 14 64H10A8 8 0 0 0 2 72H0Z" })
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
/* @__PURE__ */ jsx(
|
|
408
|
+
"svg",
|
|
409
|
+
{
|
|
410
|
+
"aria-hidden": true,
|
|
411
|
+
viewBox: "0 0 56 22",
|
|
412
|
+
className: "pointer-events-none absolute -top-0.5 -left-2 hidden h-[22px] w-14 fill-proef-navy max-lg:[@media(max-height:500px)]:block",
|
|
413
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0H56V2A8 8 0 0 0 48 10V14A8 8 0 0 1 40 22H16A8 8 0 0 1 8 14V10A8 8 0 0 0 0 2Z" })
|
|
414
|
+
}
|
|
415
|
+
),
|
|
416
|
+
[0, 1].map((i) => /* @__PURE__ */ jsx(
|
|
417
|
+
"span",
|
|
418
|
+
{
|
|
419
|
+
"aria-hidden": true,
|
|
420
|
+
className: `pointer-events-none relative h-3.5 w-0.5 rounded-full transition-colors duration-150 max-lg:[@media(max-height:500px)]:h-0.5 max-lg:[@media(max-height:500px)]:w-3.5 group-active/tab:bg-proef-turquoise group-focus-visible/tab:bg-proef-turquoise ${desvio ? "bg-proef-turquoise" : "bg-white/35"}`
|
|
421
|
+
},
|
|
422
|
+
i
|
|
423
|
+
))
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
)
|
|
285
427
|
]
|
|
286
428
|
}
|
|
287
429
|
);
|