@proef/common-ui 2.6.19 → 2.6.21

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.
@@ -1,8 +1,11 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
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 { useMenuLateralNaApp } from "../../../capabilities/onepoint-rn/useMenuLateralNaApp.js";
6
+ import { useBarraEstadoNaApp } from "../../../capabilities/onepoint-rn/useBarraEstadoNaApp.js";
7
+ import { useIsDark } from "../../../capabilities/theme/useIsDark.js";
8
+ import { nativo } from "../../../capabilities/onepoint-rn/bridge.js";
6
9
  import { SunIcon, MoonIcon, MonitorIcon, CloseIcon, ChevronLeftIcon, ChevronRightIcon, PanelOpenIcon, ChevronDownIcon, GlobeIcon, LogOutIcon, ExternalLinkIcon } from "../../../foundations/icons/icons.js";
7
10
  const SIDENAV_LABELS = {
8
11
  openMenu: "Abrir menu",
@@ -17,6 +20,7 @@ const SIDENAV_LABELS = {
17
20
  system: "Sistema",
18
21
  language: "Idioma",
19
22
  logout: "Terminar sessão",
23
+ backToApp: "Sair",
20
24
  deployedAt: "Último deploy"
21
25
  };
22
26
  const DRAWER_MAX = 1024;
@@ -56,6 +60,9 @@ function SideNav({
56
60
  [menuProp, naApp, naAppPorOmissao]
57
61
  );
58
62
  const mostrarLogout = onLogout && !naApp;
63
+ const voltarAOnePoint = () => {
64
+ nativo.sairDoPortal().catch(() => void 0);
65
+ };
59
66
  const labels = { ...SIDENAV_LABELS, ...labelsProp };
60
67
  const location = useLocation();
61
68
  const [hovered, setHovered] = useState(false);
@@ -70,6 +77,8 @@ function SideNav({
70
77
  return () => mq.removeEventListener("change", onChange);
71
78
  }, []);
72
79
  useMenuLateralNaApp(gaveta);
80
+ const escuro = useIsDark();
81
+ useBarraEstadoNaApp(gaveta ? open || escuro ? "claros" : "escuros" : null);
73
82
  const expanded = open || hovered || gaveta;
74
83
  const [animar, setAnimar] = useState(false);
75
84
  const estadoVisto = useRef(`${open}|${expanded}`);
@@ -130,7 +139,7 @@ function SideNav({
130
139
  if (!a.moveu && Math.abs(d) < 6) return;
131
140
  a.moveu = true;
132
141
  a.desvio = open ? Math.max(-a.tamanho, Math.min(0, d)) : Math.max(0, Math.min(a.tamanho, d));
133
- setDesvio({ px: a.desvio, deitado: a.deitado });
142
+ setDesvio({ px: a.desvio, deitado: a.deitado, tamanho: a.tamanho });
134
143
  };
135
144
  const onTabUp = (e) => {
136
145
  const a = arrasto.current;
@@ -208,240 +217,267 @@ function SideNav({
208
217
  item.to
209
218
  );
210
219
  };
211
- return /* @__PURE__ */ jsxs(
212
- "aside",
213
- {
214
- onPointerEnter: (e) => {
215
- if (e.pointerType === "mouse" && !open) setHovered(true);
216
- },
217
- onPointerLeave: () => setHovered(false),
218
- ref: asideRef,
219
- style: {
220
- top: "var(--app-shell-top, 0px)",
221
- height: "calc(100dvh - var(--app-shell-top, 0px))",
222
- // A espreitar (toque com a gaveta fechada): com a transição de sempre, para ir e voltar suave.
223
- ...espreita !== null && !open && !desvio && { translate: espreita ? "0 calc(-100% + 20px)" : "calc(-100% + 20px) 0" },
224
- ...desvio && {
225
- translate: desvio.deitado ? `0 calc(${open ? "0%" : "-100%"} + ${desvio.px}px)` : `calc(${open ? "0%" : "-100%"} + ${desvio.px}px) 0`,
226
- transition: "none"
227
- }
228
- },
229
- className: (
230
- // max-lg:overflow-visible: o separador vive fora da gaveta (a lista e o rodapé tratam do seu próprio scroll).
231
- // Gaveta (max-lg) sem o risco da borda: o separador sai dessa borda e o risco cortava-o da gaveta.
232
- // Deitado, o canto de baixo à esquerda é reto — é dali que o separador se pendura.
233
- `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 duration-300 ${animar ? "transition-[translate,width,box-shadow]" : ""} 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"}`
234
- ),
235
- children: [
236
- /* @__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: [
237
- expanded && /* @__PURE__ */ jsxs("div", { className: "flex flex-col pl-2", children: [
238
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
239
- /* @__PURE__ */ jsx("span", { className: "text-3xl font-black tracking-tighter text-white", children: "proef" }),
240
- /* @__PURE__ */ jsx("span", { className: "mt-3 h-2 w-2 rounded-full bg-proef-turquoise motion-safe:animate-pulse" })
220
+ const fundo = desvio ? Math.abs((open ? desvio.tamanho : 0) + desvio.px) / Math.max(1, desvio.tamanho) : open ? 1 : 0;
221
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
222
+ /* @__PURE__ */ jsx(
223
+ "div",
224
+ {
225
+ "aria-hidden": true,
226
+ onClick: () => onOpenChange(false),
227
+ style: {
228
+ opacity: fundo,
229
+ visibility: fundo > 0 ? "visible" : "hidden",
230
+ pointerEvents: open && !desvio ? "auto" : "none",
231
+ transition: desvio ? "none" : "opacity 300ms, visibility 300ms"
232
+ },
233
+ className: "fixed inset-0 z-30 bg-slate-900/50 backdrop-blur-sm lg:hidden"
234
+ }
235
+ ),
236
+ /* @__PURE__ */ jsxs(
237
+ "aside",
238
+ {
239
+ onPointerEnter: (e) => {
240
+ if (e.pointerType === "mouse" && !open) setHovered(true);
241
+ },
242
+ onPointerLeave: () => setHovered(false),
243
+ ref: asideRef,
244
+ style: {
245
+ top: "var(--app-shell-top, 0px)",
246
+ height: "calc(100dvh - var(--app-shell-top, 0px))",
247
+ paddingTop: "var(--sidenav-topo, 0px)",
248
+ // A espreitar (toque com a gaveta fechada): com a transição de sempre, para ir e voltar suave.
249
+ ...espreita !== null && !open && !desvio && { translate: espreita ? "0 calc(-100% + 20px)" : "calc(-100% + 20px) 0" },
250
+ ...desvio && {
251
+ translate: desvio.deitado ? `0 calc(${open ? "0%" : "-100%"} + ${desvio.px}px)` : `calc(${open ? "0%" : "-100%"} + ${desvio.px}px) 0`,
252
+ transition: "none"
253
+ }
254
+ },
255
+ className: (
256
+ // max-lg:overflow-visible: o separador vive fora da gaveta (a lista e o rodapé tratam do seu próprio scroll).
257
+ // Gaveta (max-lg) sem o risco da borda: o separador sai dessa borda e o risco cortava-o da gaveta.
258
+ // Deitado, o canto de baixo à esquerda é reto — é dali que o separador se pendura.
259
+ `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 duration-300 ${animar ? "transition-[translate,width,box-shadow]" : ""} 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"}`
260
+ ),
261
+ children: [
262
+ /* @__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: [
263
+ expanded && /* @__PURE__ */ jsxs("div", { className: "flex flex-col pl-2", children: [
264
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
265
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-black tracking-tighter text-white", children: "proef" }),
266
+ /* @__PURE__ */ jsx("span", { className: "mt-3 h-2 w-2 rounded-full bg-proef-turquoise motion-safe:animate-pulse" })
267
+ ] }),
268
+ appTitle && /* @__PURE__ */ jsx("span", { className: "mt-1 pl-1 text-[10px] font-black tracking-[0.3em] text-white/50 uppercase", children: appTitle })
241
269
  ] }),
242
- appTitle && /* @__PURE__ */ jsx("span", { className: "mt-1 pl-1 text-[10px] font-black tracking-[0.3em] text-white/50 uppercase", children: appTitle })
270
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
271
+ avatar && /* @__PURE__ */ jsx("div", { className: "flex-none", children: avatar }),
272
+ open && expanded && !gaveta && /* @__PURE__ */ jsxs(
273
+ "button",
274
+ {
275
+ type: "button",
276
+ onClick: () => onOpenChange(false),
277
+ "aria-label": isDrawer() ? labels.closeMenu : labels.collapseMenu,
278
+ 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",
279
+ children: [
280
+ /* @__PURE__ */ jsx(CloseIcon, { size: 18, className: "lg:hidden" }),
281
+ /* @__PURE__ */ jsx(ChevronLeftIcon, { size: 16, className: "hidden lg:block" })
282
+ ]
283
+ }
284
+ ),
285
+ !open && expanded && /* @__PURE__ */ jsx(
286
+ "button",
287
+ {
288
+ type: "button",
289
+ onClick: () => onOpenChange(true),
290
+ "aria-label": labels.expandMenu,
291
+ className: "hidden cursor-pointer items-center justify-center rounded-lg border-0 bg-white/5 p-1.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:flex",
292
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, { size: 16 })
293
+ }
294
+ )
295
+ ] })
243
296
  ] }),
244
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
245
- avatar && /* @__PURE__ */ jsx("div", { className: "flex-none", children: avatar }),
246
- open && expanded && !gaveta && /* @__PURE__ */ jsxs(
247
- "button",
248
- {
249
- type: "button",
250
- onClick: () => onOpenChange(false),
251
- "aria-label": isDrawer() ? labels.closeMenu : labels.collapseMenu,
252
- 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",
253
- children: [
254
- /* @__PURE__ */ jsx(CloseIcon, { size: 18, className: "lg:hidden" }),
255
- /* @__PURE__ */ jsx(ChevronLeftIcon, { size: 16, className: "hidden lg:block" })
256
- ]
257
- }
258
- ),
259
- !open && expanded && /* @__PURE__ */ jsx(
297
+ /* @__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: [
298
+ !expanded && /* @__PURE__ */ jsx(
260
299
  "button",
261
300
  {
262
301
  type: "button",
263
302
  onClick: () => onOpenChange(true),
303
+ "data-tip": labels.expandMenu,
264
304
  "aria-label": labels.expandMenu,
265
- className: "hidden cursor-pointer items-center justify-center rounded-lg border-0 bg-white/5 p-1.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:flex",
266
- children: /* @__PURE__ */ jsx(ChevronRightIcon, { size: 16 })
305
+ className: "mb-1 flex w-full cursor-pointer items-center justify-center border-0 bg-transparent py-3 text-white/40 transition-colors hover:bg-white/5 hover:text-white focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none",
306
+ children: /* @__PURE__ */ jsx(PanelOpenIcon, { size: 20 })
267
307
  }
268
- )
269
- ] })
270
- ] }),
271
- /* @__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: [
272
- !expanded && /* @__PURE__ */ jsx(
273
- "button",
308
+ ),
309
+ 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) }),
310
+ groups.map((g) => {
311
+ const isOpen = expanded ? !collapsed[g] : g === activeGroup;
312
+ const name = groupLabels[g] ?? g;
313
+ return /* @__PURE__ */ jsxs(
314
+ "div",
315
+ {
316
+ 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",
317
+ children: [
318
+ expanded ? /* @__PURE__ */ jsxs(
319
+ "button",
320
+ {
321
+ type: "button",
322
+ onClick: () => setCollapsed((prev) => ({ ...prev, [g]: !prev[g] })),
323
+ "aria-expanded": isOpen,
324
+ "aria-label": `${isOpen ? labels.closeGroup : labels.openGroup} ${name}`,
325
+ 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",
326
+ children: [
327
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between", children: [
328
+ /* @__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 }),
329
+ /* @__PURE__ */ jsx(ChevronDownIcon, { size: 10, className: `text-white/30 transition-transform group-hover/grp:text-white/50 ${isOpen ? "" : "-rotate-90"}` })
330
+ ] }),
331
+ /* @__PURE__ */ jsx("span", { className: "mt-1 block h-px bg-white/10" })
332
+ ]
333
+ }
334
+ ) : isOpen && /* @__PURE__ */ jsx("div", { className: "mx-auto my-3 h-px w-8 bg-white/15" }),
335
+ 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) })
336
+ ]
337
+ },
338
+ g
339
+ );
340
+ })
341
+ ] }),
342
+ /* @__PURE__ */ jsxs(
343
+ "div",
274
344
  {
275
- type: "button",
276
- onClick: () => onOpenChange(true),
277
- "data-tip": labels.expandMenu,
278
- "aria-label": labels.expandMenu,
279
- className: "mb-1 flex w-full cursor-pointer items-center justify-center border-0 bg-transparent py-3 text-white/40 transition-colors hover:bg-white/5 hover:text-white focus-visible:ring-2 focus-visible:ring-proef-turquoise/50 focus-visible:outline-none",
280
- children: /* @__PURE__ */ jsx(PanelOpenIcon, { size: 20 })
281
- }
282
- ),
283
- 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) }),
284
- groups.map((g) => {
285
- const isOpen = expanded ? !collapsed[g] : g === activeGroup;
286
- const name = groupLabels[g] ?? g;
287
- return /* @__PURE__ */ jsxs(
288
- "div",
289
- {
290
- 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",
291
- children: [
292
- expanded ? /* @__PURE__ */ jsxs(
345
+ 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"}`,
346
+ children: [
347
+ 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) }),
348
+ onThemeChange && (expanded ? /* @__PURE__ */ jsxs("div", { children: [
349
+ /* @__PURE__ */ jsx("p", { className: "m-0 px-1 pb-1 text-[8px] font-black tracking-[0.25em] text-white/30 uppercase", children: labels.theme }),
350
+ /* @__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(
293
351
  "button",
294
352
  {
295
353
  type: "button",
296
- onClick: () => setCollapsed((prev) => ({ ...prev, [g]: !prev[g] })),
297
- "aria-expanded": isOpen,
298
- "aria-label": `${isOpen ? labels.closeGroup : labels.openGroup} ${name}`,
299
- 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",
354
+ onClick: () => onThemeChange(value),
355
+ "aria-pressed": currentTheme.value === value,
356
+ 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"}`,
300
357
  children: [
301
- /* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between", children: [
302
- /* @__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 }),
303
- /* @__PURE__ */ jsx(ChevronDownIcon, { size: 10, className: `text-white/30 transition-transform group-hover/grp:text-white/50 ${isOpen ? "" : "-rotate-90"}` })
304
- ] }),
305
- /* @__PURE__ */ jsx("span", { className: "mt-1 block h-px bg-white/10" })
358
+ /* @__PURE__ */ jsx(Icon, { size: 14 }),
359
+ label
306
360
  ]
307
- }
308
- ) : isOpen && /* @__PURE__ */ jsx("div", { className: "mx-auto my-3 h-px w-8 bg-white/15" }),
309
- 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) })
310
- ]
311
- },
312
- g
313
- );
314
- })
315
- ] }),
316
- /* @__PURE__ */ jsxs(
317
- "div",
318
- {
319
- 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"}`,
320
- children: [
321
- 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) }),
322
- onThemeChange && (expanded ? /* @__PURE__ */ jsxs("div", { children: [
323
- /* @__PURE__ */ jsx("p", { className: "m-0 px-1 pb-1 text-[8px] font-black tracking-[0.25em] text-white/30 uppercase", children: labels.theme }),
324
- /* @__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(
361
+ },
362
+ value
363
+ )) })
364
+ ] }) : /* @__PURE__ */ jsx(
325
365
  "button",
326
366
  {
327
367
  type: "button",
328
- onClick: () => onThemeChange(value),
329
- "aria-pressed": currentTheme.value === value,
330
- 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"}`,
331
- children: [
332
- /* @__PURE__ */ jsx(Icon, { size: 14 }),
333
- label
334
- ]
335
- },
336
- value
337
- )) })
338
- ] }) : /* @__PURE__ */ jsx(
339
- "button",
340
- {
341
- type: "button",
342
- onClick: () => onThemeChange(cycle(themeOptions, currentTheme).value),
343
- "aria-label": `${labels.theme}: ${currentTheme.label}`,
344
- "data-tip": `${labels.theme}: ${currentTheme.label}`,
345
- className: footerIconButton,
346
- children: /* @__PURE__ */ jsx(currentTheme.Icon, { size: 18 })
347
- }
348
- )),
349
- 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(
350
- "button",
351
- {
352
- type: "button",
353
- onClick: () => onLanguageChange(l.code),
354
- "aria-pressed": currentLanguage === l.code,
355
- 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"}`,
356
- children: l.label
357
- },
358
- l.code
359
- )) }) : /* @__PURE__ */ jsx(
360
- "button",
361
- {
362
- type: "button",
363
- onClick: () => {
364
- const codes = languages.map((l) => l.code);
365
- onLanguageChange(cycle(codes, currentLanguage ?? codes[0]));
368
+ onClick: () => onThemeChange(cycle(themeOptions, currentTheme).value),
369
+ "aria-label": `${labels.theme}: ${currentTheme.label}`,
370
+ "data-tip": `${labels.theme}: ${currentTheme.label}`,
371
+ className: footerIconButton,
372
+ children: /* @__PURE__ */ jsx(currentTheme.Icon, { size: 18 })
373
+ }
374
+ )),
375
+ 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(
376
+ "button",
377
+ {
378
+ type: "button",
379
+ onClick: () => onLanguageChange(l.code),
380
+ "aria-pressed": currentLanguage === l.code,
381
+ 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"}`,
382
+ children: l.label
366
383
  },
367
- "aria-label": `${labels.language}: ${currentLanguage?.toUpperCase() ?? ""}`,
368
- "data-tip": `${labels.language}: ${currentLanguage?.toUpperCase() ?? ""}`,
369
- className: footerIconButton,
370
- children: /* @__PURE__ */ jsx(GlobeIcon, { size: 18 })
371
- }
372
- )),
373
- mostrarLogout && (expanded ? /* @__PURE__ */ jsx(
374
- "button",
375
- {
376
- type: "button",
377
- onClick: onLogout,
378
- 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",
379
- children: labels.logout
380
- }
381
- ) : /* @__PURE__ */ jsx("button", { type: "button", onClick: onLogout, "aria-label": labels.logout, "data-tip": labels.logout, className: footerIconButton, children: /* @__PURE__ */ jsx(LogOutIcon, { size: 18 }) })),
382
- 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) })
383
- ]
384
- }
385
- ),
386
- gaveta && /* @__PURE__ */ jsxs(
387
- "button",
388
- {
389
- type: "button",
390
- onClick: (e) => {
391
- if (ignorarClique.current) {
392
- ignorarClique.current = false;
393
- return;
394
- }
395
- if (!open && e.detail !== 0) {
396
- setAnimar(true);
397
- setEspreita(isTopDrawer());
398
- return;
399
- }
400
- onOpenChange(!open);
401
- },
402
- onPointerDown: onTabDown,
403
- onPointerMove: onTabMove,
404
- onPointerUp: onTabUp,
405
- onPointerCancel: onTabCancel,
406
- "aria-expanded": open,
407
- "aria-label": open ? labels.closeMenu : labels.openMenu,
408
- className: (
409
- // touch-none: o arrasto é nosso — sem ele o browser rolava a página com o mesmo dedo.
410
- `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`
411
- ),
412
- children: [
413
- /* @__PURE__ */ jsx(
414
- "svg",
415
- {
416
- "aria-hidden": true,
417
- viewBox: "0 0 22 72",
418
- className: "pointer-events-none absolute -top-2 -left-0.5 h-[72px] w-[22px] fill-proef-navy max-lg:[@media(max-height:500px)]:hidden",
419
- 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" })
384
+ l.code
385
+ )) }) : /* @__PURE__ */ jsx(
386
+ "button",
387
+ {
388
+ type: "button",
389
+ onClick: () => {
390
+ const codes = languages.map((l) => l.code);
391
+ onLanguageChange(cycle(codes, currentLanguage ?? codes[0]));
392
+ },
393
+ "aria-label": `${labels.language}: ${currentLanguage?.toUpperCase() ?? ""}`,
394
+ "data-tip": `${labels.language}: ${currentLanguage?.toUpperCase() ?? ""}`,
395
+ className: footerIconButton,
396
+ children: /* @__PURE__ */ jsx(GlobeIcon, { size: 18 })
397
+ }
398
+ )),
399
+ mostrarLogout && (expanded ? /* @__PURE__ */ jsx(
400
+ "button",
401
+ {
402
+ type: "button",
403
+ onClick: onLogout,
404
+ 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",
405
+ children: labels.logout
406
+ }
407
+ ) : /* @__PURE__ */ jsx("button", { type: "button", onClick: onLogout, "aria-label": labels.logout, "data-tip": labels.logout, className: footerIconButton, children: /* @__PURE__ */ jsx(LogOutIcon, { size: 18 }) })),
408
+ naApp && (expanded ? /* @__PURE__ */ jsx(
409
+ "button",
410
+ {
411
+ type: "button",
412
+ onClick: voltarAOnePoint,
413
+ 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",
414
+ children: labels.backToApp
415
+ }
416
+ ) : /* @__PURE__ */ jsx("button", { type: "button", onClick: voltarAOnePoint, "aria-label": labels.backToApp, "data-tip": labels.backToApp, className: footerIconButton, children: /* @__PURE__ */ jsx(ChevronLeftIcon, { size: 18 }) })),
417
+ 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) })
418
+ ]
419
+ }
420
+ ),
421
+ gaveta && /* @__PURE__ */ jsxs(
422
+ "button",
423
+ {
424
+ type: "button",
425
+ onClick: (e) => {
426
+ if (ignorarClique.current) {
427
+ ignorarClique.current = false;
428
+ return;
420
429
  }
421
- ),
422
- /* @__PURE__ */ jsx(
423
- "svg",
424
- {
425
- "aria-hidden": true,
426
- viewBox: "0 0 56 22",
427
- 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",
428
- 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" })
430
+ if (!open && e.detail !== 0) {
431
+ setAnimar(true);
432
+ setEspreita(isTopDrawer());
433
+ return;
429
434
  }
435
+ onOpenChange(!open);
436
+ },
437
+ onPointerDown: onTabDown,
438
+ onPointerMove: onTabMove,
439
+ onPointerUp: onTabUp,
440
+ onPointerCancel: onTabCancel,
441
+ "aria-expanded": open,
442
+ "aria-label": open ? labels.closeMenu : labels.openMenu,
443
+ className: (
444
+ // touch-none: o arrasto é nosso — sem ele o browser rolava a página com o mesmo dedo.
445
+ `group/tab absolute top-[calc(0.75rem+var(--sidenav-topo,0px))] 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`
430
446
  ),
431
- [0, 1].map((i) => /* @__PURE__ */ jsx(
432
- "span",
433
- {
434
- "aria-hidden": true,
435
- 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"}`
436
- },
437
- i
438
- ))
439
- ]
440
- }
441
- )
442
- ]
443
- }
444
- );
447
+ children: [
448
+ /* @__PURE__ */ jsx(
449
+ "svg",
450
+ {
451
+ "aria-hidden": true,
452
+ viewBox: "0 0 22 72",
453
+ className: "pointer-events-none absolute -top-2 -left-0.5 h-[72px] w-[22px] fill-proef-navy max-lg:[@media(max-height:500px)]:hidden",
454
+ 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" })
455
+ }
456
+ ),
457
+ /* @__PURE__ */ jsx(
458
+ "svg",
459
+ {
460
+ "aria-hidden": true,
461
+ viewBox: "0 0 56 22",
462
+ 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",
463
+ 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" })
464
+ }
465
+ ),
466
+ [0, 1].map((i) => /* @__PURE__ */ jsx(
467
+ "span",
468
+ {
469
+ "aria-hidden": true,
470
+ 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"}`
471
+ },
472
+ i
473
+ ))
474
+ ]
475
+ }
476
+ )
477
+ ]
478
+ }
479
+ )
480
+ ] });
445
481
  }
446
482
  export {
447
483
  DRAWER_MAX,