@snksergio/design-system 0.53.0 → 0.54.0

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.
Files changed (28) hide show
  1. package/dist-lib/chunks/{toggle-group-C9rrkkmh.cjs → toggle-group-BTnqY_nt.cjs} +23 -23
  2. package/dist-lib/chunks/toggle-group-BTnqY_nt.cjs.map +1 -0
  3. package/dist-lib/chunks/{toggle-group-mXbG8_Jm.mjs → toggle-group-BYmj8142.mjs} +22 -22
  4. package/dist-lib/chunks/toggle-group-BYmj8142.mjs.map +1 -0
  5. package/dist-lib/index.cjs +630 -1
  6. package/dist-lib/index.cjs.map +1 -1
  7. package/dist-lib/index.mjs +638 -9
  8. package/dist-lib/index.mjs.map +1 -1
  9. package/dist-lib/shadcn.cjs +1 -1
  10. package/dist-lib/shadcn.mjs +1 -1
  11. package/dist-lib/src/components/index.d.ts +1 -0
  12. package/dist-lib/src/components/index.d.ts.map +1 -1
  13. package/dist-lib/src/components/ui/TabsNavigation/index.d.ts +5 -0
  14. package/dist-lib/src/components/ui/TabsNavigation/index.d.ts.map +1 -0
  15. package/dist-lib/src/components/ui/TabsNavigation/tabs-navigation-context.d.ts +19 -0
  16. package/dist-lib/src/components/ui/TabsNavigation/tabs-navigation-context.d.ts.map +1 -0
  17. package/dist-lib/src/components/ui/TabsNavigation/tabs-navigation.d.ts +84 -0
  18. package/dist-lib/src/components/ui/TabsNavigation/tabs-navigation.d.ts.map +1 -0
  19. package/dist-lib/src/components/ui/TabsNavigation/tabs-navigation.styles.d.ts +393 -0
  20. package/dist-lib/src/components/ui/TabsNavigation/tabs-navigation.styles.d.ts.map +1 -0
  21. package/dist-lib/src/components/ui/TabsNavigation/tabs-navigation.types.d.ts +99 -0
  22. package/dist-lib/src/components/ui/TabsNavigation/tabs-navigation.types.d.ts.map +1 -0
  23. package/dist-lib/src/components/ui/TabsNavigation/use-arrastar-para-rolar.d.ts +26 -0
  24. package/dist-lib/src/components/ui/TabsNavigation/use-arrastar-para-rolar.d.ts.map +1 -0
  25. package/dist-lib/theme.css +15 -0
  26. package/package.json +1 -1
  27. package/dist-lib/chunks/toggle-group-C9rrkkmh.cjs.map +0 -1
  28. package/dist-lib/chunks/toggle-group-mXbG8_Jm.mjs.map +0 -1
@@ -2,16 +2,16 @@ import { g as getContrastTextColor, a as FormField, e as Avatar, i as isFilterEn
2
2
  import { t, A, u, B, v, C, w, x, y, D, z, E, G, H, I, J, K, M, N, d, O, Q, R, S, U, F, b, V, c, W, X, P, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, p, al, am, an, ao, ap } from "./chunks/panel-DsOKm4Im.mjs";
3
3
  import { C as Chip } from "./chunks/useTheme-Bk8AYqLr.mjs";
4
4
  import { A as A2, a, b as b2, H as H2, c as c2, d as d2, e, f, g, M as M2, S as S2, h, i, j, k, l, m, n, U as U2, o, p as p2, q, r, s, t as t2, v as v2, w as w2, u as u2 } from "./chunks/useTheme-Bk8AYqLr.mjs";
5
- import { a8 as tv, c as cn, V as Popover, Z as PopoverTrigger, Y as PopoverContent, a7 as Button, D as Dialog, w as DialogTrigger, p as DialogContent, v as DialogTitle, W as PopoverAnchor, o as DialogClose, q as DialogDescription, x as DropdownMenu, O as DropdownMenuTrigger, z as DropdownMenuContent, J as DropdownMenuSeparator, E as DropdownMenuItem } from "./chunks/avatar-FPbG1TRy.mjs";
6
- import { P as P2, Q as Q2, R as R2, S as S3, T, U as U3, y as y2, F as F2, H as H3, I as I2, a9 as a92, a6 as a62 } from "./chunks/avatar-FPbG1TRy.mjs";
5
+ import { a8 as tv, c as cn, V as Popover, Z as PopoverTrigger, Y as PopoverContent, a7 as Button, D as Dialog, w as DialogTrigger, p as DialogContent, v as DialogTitle, W as PopoverAnchor, o as DialogClose, q as DialogDescription, x as DropdownMenu, O as DropdownMenuTrigger, z as DropdownMenuContent, F as DropdownMenuLabel, J as DropdownMenuSeparator, E as DropdownMenuItem } from "./chunks/avatar-FPbG1TRy.mjs";
6
+ import { P as P2, Q as Q2, R as R2, S as S3, T, U as U3, y as y2, H as H3, I as I2, a9 as a92, a6 as a62 } from "./chunks/avatar-FPbG1TRy.mjs";
7
7
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
8
8
  import * as React from "react";
9
- import { createContext, forwardRef, useContext, useId, useState, Fragment as Fragment$1, isValidElement, useCallback, useMemo, createElement, useRef, useEffect, useLayoutEffect } from "react";
9
+ import { createContext, forwardRef, useContext, useId, useState, Fragment as Fragment$1, isValidElement, useCallback, useMemo, createElement, useRef, useEffect, useLayoutEffect, Children } from "react";
10
10
  import { Q as Switch, l as Checkbox, C as Calendar, T as Textarea } from "./chunks/sheet-DIpYkRYS.mjs";
11
- import { G as G2, H as H4, F as F3, O as O2 } from "./chunks/sheet-DIpYkRYS.mjs";
12
- import { av as RadioGroup, aw as RadioGroupItem, az as Separator, aA as Skeleton } from "./chunks/toggle-group-mXbG8_Jm.mjs";
13
- import { B as B2, aJ } from "./chunks/toggle-group-mXbG8_Jm.mjs";
14
- import { Check, MoreHorizontal, SlidersHorizontal, Calendar as Calendar$1, AlertCircle, CheckCheck, Clock, MoreVertical, Ban, X as X2, CalendarDays, ChevronDown, ChevronLeft, ChevronRight, RefreshCw, OctagonX, TriangleAlert, CircleCheck, Info, Bell } from "lucide-react";
11
+ import { G as G2, H as H4, F as F2, O as O2 } from "./chunks/sheet-DIpYkRYS.mjs";
12
+ import { av as RadioGroup, aw as RadioGroupItem, az as Separator, aA as Skeleton, _ as HoverCard, a0 as HoverCardTrigger, $ as HoverCardContent } from "./chunks/toggle-group-BYmj8142.mjs";
13
+ import { B as B2, aJ } from "./chunks/toggle-group-BYmj8142.mjs";
14
+ import { Check, MoreHorizontal, SlidersHorizontal, Calendar as Calendar$1, AlertCircle, CheckCheck, Clock, MoreVertical, Ban, X as X2, CalendarDays, ChevronDown, ChevronLeft, ChevronRight, Circle, Plus, RefreshCw, OctagonX, TriangleAlert, CircleCheck, Info, Bell } from "lucide-react";
15
15
  import { Reply } from "lucide-react";
16
16
  import { I as Input } from "./chunks/input-tjIT8HNE.mjs";
17
17
  import { i as i2 } from "./chunks/input-tjIT8HNE.mjs";
@@ -5400,6 +5400,618 @@ const ScreenLoader = forwardRef(
5400
5400
  }
5401
5401
  );
5402
5402
  ScreenLoader.displayName = "ScreenLoader";
5403
+ const TabsNavigationContext = createContext(null);
5404
+ function useArrastarParaRolar(trilho, ativo = true, limiarPx = 6) {
5405
+ const engolirClique = useRef(false);
5406
+ useEffect(() => {
5407
+ if (!ativo) return;
5408
+ const el = trilho.current;
5409
+ if (!el) return;
5410
+ if (typeof window === "undefined") return;
5411
+ if (window.matchMedia?.("(pointer: coarse)").matches) return;
5412
+ let arrastando = false;
5413
+ let passouLimiar = false;
5414
+ let xInicial = 0;
5415
+ let scrollInicial = 0;
5416
+ const ehInterativo = (alvo) => alvo instanceof Element && !!alvo.closest(
5417
+ 'button, a, input, select, textarea, [role="button"], [role="menuitem"], [data-radix-popper-content-wrapper], [role="dialog"], [role="menu"], [role="tooltip"]'
5418
+ );
5419
+ const onPointerDown = (e2) => {
5420
+ if (e2.button !== 0 || ehInterativo(e2.target)) return;
5421
+ arrastando = true;
5422
+ passouLimiar = false;
5423
+ xInicial = e2.clientX;
5424
+ scrollInicial = el.scrollLeft;
5425
+ };
5426
+ const onPointerMove = (e2) => {
5427
+ if (!arrastando) return;
5428
+ const delta = e2.clientX - xInicial;
5429
+ if (!passouLimiar) {
5430
+ if (Math.abs(delta) < limiarPx) return;
5431
+ passouLimiar = true;
5432
+ engolirClique.current = true;
5433
+ el.setPointerCapture?.(e2.pointerId);
5434
+ el.style.cursor = "grabbing";
5435
+ el.style.userSelect = "none";
5436
+ }
5437
+ el.scrollLeft = scrollInicial - delta;
5438
+ };
5439
+ const encerrar = (e2) => {
5440
+ if (!arrastando) return;
5441
+ arrastando = false;
5442
+ el.releasePointerCapture?.(e2.pointerId);
5443
+ el.style.cursor = "";
5444
+ el.style.userSelect = "";
5445
+ };
5446
+ const onClickCapture = (e2) => {
5447
+ if (!engolirClique.current) return;
5448
+ engolirClique.current = false;
5449
+ e2.stopPropagation();
5450
+ e2.preventDefault();
5451
+ };
5452
+ el.addEventListener("pointerdown", onPointerDown);
5453
+ el.addEventListener("pointermove", onPointerMove);
5454
+ el.addEventListener("pointerup", encerrar);
5455
+ el.addEventListener("pointercancel", encerrar);
5456
+ el.addEventListener("click", onClickCapture, true);
5457
+ return () => {
5458
+ el.removeEventListener("pointerdown", onPointerDown);
5459
+ el.removeEventListener("pointermove", onPointerMove);
5460
+ el.removeEventListener("pointerup", encerrar);
5461
+ el.removeEventListener("pointercancel", encerrar);
5462
+ el.removeEventListener("click", onClickCapture, true);
5463
+ el.style.cursor = "";
5464
+ el.style.userSelect = "";
5465
+ };
5466
+ }, [trilho, ativo, limiarPx]);
5467
+ }
5468
+ const tabsNavigationRoot = tv({
5469
+ base: "flex gap-gp-2xs px-pad-lg",
5470
+ variants: {
5471
+ /**
5472
+ * O RESPIRO DO TOPO É DO COMPONENTE, não do consumidor — e isso é o que torna a peça
5473
+ * independente da superfície onde ela cai.
5474
+ *
5475
+ * Enquanto o padding vinha de um wrapper por fora, aquela faixa de 8px acima das abas
5476
+ * ficava com a cor do container (a superfície do card) enquanto a tira ficava com o
5477
+ * recuo: duas cores na mesma banda, e a aba inativa parecia "um botão de outra cor
5478
+ * pousado num fundo diferente". Trazendo o padding pra cá, o recuo cobre a banda inteira
5479
+ * e a ÚNICA coisa com fundo próprio passa a ser a aba ativa.
5480
+ */
5481
+ respiro: {
5482
+ comfortable: "pt-pad-md",
5483
+ compact: "pt-pad-sm",
5484
+ nenhum: ""
5485
+ },
5486
+ /**
5487
+ * `items-stretch` é o que faz a aba de altura total valer: com `items-end` ela encolheria
5488
+ * pro próprio conteúdo e o `h-full` não teria contra o que medir. A régua some junto.
5489
+ */
5490
+ fill: {
5491
+ true: "items-stretch",
5492
+ false: "items-end border-b border-border-default"
5493
+ },
5494
+ /**
5495
+ * Fundo recuado da tira — o par por modo explicado no cabeçalho deste arquivo.
5496
+ *
5497
+ * No claro é `bg-emphasis` (0.94), não `bg-subtle` (0.973): contra a aba ativa branca, o
5498
+ * delta de 0.027 do subtle quase não se lia. Com `emphasis` o recuo é 0.06 e a aba
5499
+ * selecionada salta. No escuro `emphasis` é branco a 12% **sobre** o que está atrás, ou
5500
+ * seja mais CLARO que a superfície (0.28 contra 0.225) — inverteria a hierarquia; ali quem
5501
+ * recua continua sendo `canvas`, e o reforço vem da sombra na aba ativa.
5502
+ */
5503
+ chrome: {
5504
+ true: "bg-bg-emphasis dark:bg-bg-canvas",
5505
+ false: ""
5506
+ }
5507
+ },
5508
+ defaultVariants: { fill: false, chrome: true, respiro: "comfortable" }
5509
+ });
5510
+ const tabsNavigationTrilho = tv({
5511
+ /**
5512
+ * `scrollbar-none` não é preferência: a barra ocupa 11px DENTRO do trilho e empurra as abas
5513
+ * pra cima da régua, matando a união. A affordance de navegação são as setas + a lista.
5514
+ */
5515
+ base: "flex min-w-0 flex-1 gap-gp-2xs overflow-x-auto scrollbar-none",
5516
+ variants: {
5517
+ /** o `pb-px` só existe pra o `-mb-px` da aba não ser cortado pelo overflow. */
5518
+ fill: {
5519
+ true: "items-stretch",
5520
+ false: "items-end pb-px"
5521
+ }
5522
+ },
5523
+ defaultVariants: { fill: false }
5524
+ });
5525
+ const tabsNavigationTab = tv({
5526
+ base: [
5527
+ "group/aba relative flex shrink-0 cursor-pointer select-none",
5528
+ "items-center gap-gp-sm border border-transparent px-pad-xl",
5529
+ "text-fg-muted transition-colors",
5530
+ "focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring-brand"
5531
+ ],
5532
+ variants: {
5533
+ /**
5534
+ * A largura é fixa (aba que cresce com o título faz a fila dançar a cada troca) — mas
5535
+ * fixa em DOIS degraus: no celular, 228px é quase a tela inteira e o usuário vê uma aba
5536
+ * e meia, sem noção de que há uma fila. Abaixo de `sm` a aba cai pra ~168/148px, que
5537
+ * mostra duas e meia e deixa o gesto de arrastar fazer sentido.
5538
+ */
5539
+ density: {
5540
+ comfortable: "w-[168px] sm:w-[228px]",
5541
+ compact: "w-[148px] sm:w-[196px]"
5542
+ },
5543
+ fill: {
5544
+ true: "h-full self-stretch",
5545
+ false: "-mb-px rounded-t-radius-lg"
5546
+ },
5547
+ /** A superfície da aba ATIVA — tem que casar com o conteúdo logo abaixo dela. */
5548
+ surface: {
5549
+ surface: "",
5550
+ canvas: ""
5551
+ },
5552
+ ativa: {
5553
+ /**
5554
+ * `shadow-sh-sm` faz o trabalho que a cor não consegue no escuro: ali a ativa (0.225) e
5555
+ * o recuo (0.205) distam 0.02, e mudar a cor da ativa quebraria a união com o conteúdo,
5556
+ * que é o ponto do componente. A sombra separa sem mexer na cor — e no dark ela vem
5557
+ * amplificada por token (L-011).
5558
+ */
5559
+ true: "border-border-default text-fg-strong shadow-sh-sm",
5560
+ false: "hover:bg-bg-subtle"
5561
+ }
5562
+ },
5563
+ compoundVariants: [
5564
+ { fill: false, density: "comfortable", class: "min-h-comp-3xl" },
5565
+ { fill: false, density: "compact", class: "min-h-comp-xl" },
5566
+ /**
5567
+ * ⚠️ A borda de baixo da aba ativa é **transparente**, não "da cor do conteúdo".
5568
+ *
5569
+ * A primeira versão pintava `border-b-bg-surface` pra apagar a régua. Funcionava só quando
5570
+ * o conteúdo logo abaixo era exatamente aquela cor — nos exemplos em que a tira ficava
5571
+ * sobre container transparente, ou separada do painel por um gap, sobrava um traço claro
5572
+ * embaixo da aba selecionada. Com a borda transparente é o **fundo da aba** que cobre a
5573
+ * régua (o background pinta sob a border-box, e o `-mb-px` a coloca por cima da linha):
5574
+ * funciona igual em qualquer superfície, que é o comportamento que se espera por padrão —
5575
+ * a aba emenda no conteúdo, sem linha entre os dois.
5576
+ */
5577
+ { ativa: true, surface: "surface", class: "bg-bg-surface border-b-transparent" },
5578
+ { ativa: true, surface: "canvas", class: "bg-bg-canvas border-b-transparent" }
5579
+ ],
5580
+ defaultVariants: { density: "comfortable", fill: false, surface: "surface", ativa: false }
5581
+ });
5582
+ const tabsNavigationDivisoria = tv({
5583
+ base: "w-px shrink-0 bg-border-default",
5584
+ variants: {
5585
+ fill: {
5586
+ true: "h-[20px] self-center",
5587
+ false: "h-[20px] mb-[14px]"
5588
+ },
5589
+ /** Ao lado da aba ativa some: encostada na borda dela vira uma sombra falsa. */
5590
+ oculta: {
5591
+ true: "bg-transparent",
5592
+ false: ""
5593
+ }
5594
+ },
5595
+ defaultVariants: { fill: false, oculta: false }
5596
+ });
5597
+ const tabsNavigationControles = tv({
5598
+ base: "flex shrink-0 items-center gap-gp-2xs",
5599
+ variants: {
5600
+ fill: { true: "h-full", false: "" },
5601
+ density: { comfortable: "h-comp-3xl", compact: "h-comp-xl" }
5602
+ },
5603
+ compoundVariants: [
5604
+ { fill: true, density: "comfortable", class: "h-full" },
5605
+ { fill: true, density: "compact", class: "h-full" }
5606
+ ],
5607
+ defaultVariants: { fill: false, density: "comfortable" }
5608
+ });
5609
+ const tabsNavigationAcao = tv({
5610
+ base: [
5611
+ "inline-flex size-comp-xs items-center justify-center rounded-radius-sm",
5612
+ "transition-colors focus-visible:outline-none focus-visible:ring-4"
5613
+ ],
5614
+ variants: {
5615
+ tom: {
5616
+ neutro: "text-fg-muted hover:bg-bg-muted hover:text-fg-default focus-visible:ring-ring-brand",
5617
+ success: "text-fg-success hover:bg-bg-success-muted focus-visible:ring-ring-success",
5618
+ danger: "text-fg-danger hover:bg-bg-danger-muted focus-visible:ring-ring-danger"
5619
+ }
5620
+ },
5621
+ defaultVariants: { tom: "neutro" }
5622
+ });
5623
+ const tabsNavigationAcoes = tv({
5624
+ base: "grid transition-[grid-template-columns,opacity] duration-150 ease-out",
5625
+ variants: {
5626
+ visivel: {
5627
+ true: "grid-cols-[1fr] opacity-100",
5628
+ false: "grid-cols-[0fr] opacity-0 group-hover/aba:grid-cols-[1fr] group-hover/aba:opacity-100 group-focus-within/aba:grid-cols-[1fr] group-focus-within/aba:opacity-100"
5629
+ }
5630
+ },
5631
+ defaultVariants: { visivel: false }
5632
+ });
5633
+ const tabsNavigationStatus = tv({
5634
+ base: "size-icon-2xs shrink-0",
5635
+ variants: {
5636
+ status: {
5637
+ success: "fill-bg-success text-bg-success",
5638
+ warning: "fill-bg-warning text-bg-warning",
5639
+ danger: "fill-bg-danger text-bg-danger",
5640
+ info: "fill-bg-info text-bg-info",
5641
+ neutral: "fill-fg-subtle text-fg-subtle"
5642
+ }
5643
+ },
5644
+ defaultVariants: { status: "neutral" }
5645
+ });
5646
+ const STATUS_CONHECIDOS = ["success", "warning", "danger", "info", "neutral"];
5647
+ const ehStatusConhecido = (s2) => typeof s2 === "string" && STATUS_CONHECIDOS.includes(s2);
5648
+ function TabsNavigationTitle({ children, className, ...rest }) {
5649
+ return /* @__PURE__ */ jsx(
5650
+ "span",
5651
+ {
5652
+ className: [
5653
+ "block truncate text-body-sm font-medium",
5654
+ "group-aria-selected/aba:font-semibold",
5655
+ className ?? ""
5656
+ ].join(" "),
5657
+ ...rest,
5658
+ children
5659
+ }
5660
+ );
5661
+ }
5662
+ TabsNavigationTitle.displayName = "TabsNavigation.Title";
5663
+ function TabsNavigationSubtitle({ children, className, ...rest }) {
5664
+ const ctx = useContext(TabsNavigationContext);
5665
+ if (ctx?.density === "compact") return null;
5666
+ return /* @__PURE__ */ jsx(
5667
+ "span",
5668
+ {
5669
+ className: ["block truncate text-caption-md text-fg-subtle", className ?? ""].join(" "),
5670
+ ...rest,
5671
+ children
5672
+ }
5673
+ );
5674
+ }
5675
+ TabsNavigationSubtitle.displayName = "TabsNavigation.Subtitle";
5676
+ const TabsNavigationAction = forwardRef(function TabsNavigationAction2({ tom = "neutro", className, onClick, ...rest }, ref) {
5677
+ return /* @__PURE__ */ jsx(
5678
+ "button",
5679
+ {
5680
+ ref,
5681
+ type: "button",
5682
+ className: tabsNavigationAcao({ tom, className }),
5683
+ onClick: (e2) => {
5684
+ e2.stopPropagation();
5685
+ onClick?.(e2);
5686
+ },
5687
+ ...rest
5688
+ }
5689
+ );
5690
+ });
5691
+ TabsNavigationAction.displayName = "TabsNavigation.Action";
5692
+ function TabsNavigationActions({ children }) {
5693
+ return /* @__PURE__ */ jsx(Fragment, { children });
5694
+ }
5695
+ TabsNavigationActions.displayName = "TabsNavigation.Actions";
5696
+ function TabsNavigationPanel({ value, children, className, ...rest }) {
5697
+ const ctx = useContext(TabsNavigationContext);
5698
+ if (!ctx || ctx.value !== value) return null;
5699
+ return /* @__PURE__ */ jsx(
5700
+ "div",
5701
+ {
5702
+ role: "tabpanel",
5703
+ "aria-labelledby": ctx.idTab(value),
5704
+ tabIndex: 0,
5705
+ className,
5706
+ ...rest,
5707
+ children
5708
+ }
5709
+ );
5710
+ }
5711
+ TabsNavigationPanel.displayName = "TabsNavigation.Panel";
5712
+ const TabsNavigationTab = forwardRef(function TabsNavigationTab2({
5713
+ value,
5714
+ leading,
5715
+ status,
5716
+ badge,
5717
+ actions,
5718
+ onClose,
5719
+ menu,
5720
+ panelId,
5721
+ actionsAlwaysVisible = false,
5722
+ hoverCard,
5723
+ children,
5724
+ className,
5725
+ ...rest
5726
+ }, ref) {
5727
+ const ctx = useContext(TabsNavigationContext);
5728
+ if (!ctx) throw new Error("<TabsNavigation.Tab> só funciona dentro de <TabsNavigation>.");
5729
+ const ativa = ctx.value === value;
5730
+ const temAcoesPadrao = !actions && typeof onClose === "function";
5731
+ const conteudoAcoes = actions ?? (temAcoesPadrao ? /* @__PURE__ */ jsx(AcoesPadrao, { onClose, menu }) : null);
5732
+ const aba = /* @__PURE__ */ jsxs(
5733
+ "div",
5734
+ {
5735
+ ref,
5736
+ role: "tab",
5737
+ id: ctx.idTab(value),
5738
+ "data-value": value,
5739
+ "aria-selected": ativa,
5740
+ "aria-controls": panelId,
5741
+ tabIndex: ativa ? 0 : -1,
5742
+ onClick: () => ctx.onValueChange(value),
5743
+ onKeyDown: (e2) => {
5744
+ if (e2.key === "Enter" || e2.key === " ") {
5745
+ e2.preventDefault();
5746
+ ctx.onValueChange(value);
5747
+ }
5748
+ },
5749
+ className: tabsNavigationTab({
5750
+ density: ctx.density,
5751
+ fill: ctx.fill,
5752
+ surface: ctx.surface,
5753
+ ativa,
5754
+ className
5755
+ }),
5756
+ ...rest,
5757
+ children: [
5758
+ leading,
5759
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: status !== void 0 ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-gp-sm", children: [
5760
+ ehStatusConhecido(status) ? /* @__PURE__ */ jsx(Circle, { className: tabsNavigationStatus({ status }), "aria-hidden": true }) : status,
5761
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children })
5762
+ ] }) : children }),
5763
+ !ativa && badge !== void 0 && badge !== null && badge !== 0 ? typeof badge === "number" ? /* @__PURE__ */ jsx(
5764
+ "span",
5765
+ {
5766
+ className: "inline-flex min-w-[18px] items-center justify-center rounded-radius-full bg-bg-brand px-pad-xs text-caption-sm font-semibold text-fg-on-brand",
5767
+ "aria-hidden": true,
5768
+ children: badge
5769
+ }
5770
+ ) : badge : null,
5771
+ conteudoAcoes ? /* @__PURE__ */ jsx(
5772
+ "div",
5773
+ {
5774
+ className: tabsNavigationAcoes({
5775
+ visivel: ativa || actionsAlwaysVisible || ctx.actionsMode === "persistent"
5776
+ }),
5777
+ children: /* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-center gap-gp-2xs overflow-hidden", children: conteudoAcoes })
5778
+ }
5779
+ ) : null
5780
+ ]
5781
+ }
5782
+ );
5783
+ if (!hoverCard || ativa) return aba;
5784
+ return /* @__PURE__ */ jsxs(HoverCard, { openDelay: 500, closeDelay: 120, children: [
5785
+ /* @__PURE__ */ jsx(HoverCardTrigger, { asChild: true, children: aba }),
5786
+ /* @__PURE__ */ jsx(HoverCardContent, { align: "start", className: "w-[300px]", children: hoverCard })
5787
+ ] });
5788
+ });
5789
+ TabsNavigationTab.displayName = "TabsNavigation.Tab";
5790
+ function AcoesPadrao({ onClose, menu }) {
5791
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
5792
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5793
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(TabsNavigationAction, { "aria-label": "Opções da aba", children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "size-icon-sm" }) }) }),
5794
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "start", className: "w-[196px]", children: [
5795
+ menu,
5796
+ menu ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}) : null,
5797
+ /* @__PURE__ */ jsxs(
5798
+ DropdownMenuItem,
5799
+ {
5800
+ onSelect: onClose,
5801
+ className: "text-fg-danger focus:bg-bg-danger-muted focus:text-fg-danger",
5802
+ children: [
5803
+ /* @__PURE__ */ jsx(X2, { className: "size-icon-sm" }),
5804
+ " Fechar aba"
5805
+ ]
5806
+ }
5807
+ )
5808
+ ] })
5809
+ ] }),
5810
+ /* @__PURE__ */ jsx(TabsNavigationAction, { "aria-label": "Fechar aba", onClick: onClose, children: /* @__PURE__ */ jsx(X2, { className: "size-icon-sm" }) })
5811
+ ] });
5812
+ }
5813
+ const TabsNavigationRoot = forwardRef(function TabsNavigation2({
5814
+ value,
5815
+ onValueChange,
5816
+ surface = "surface",
5817
+ density = "comfortable",
5818
+ fill = false,
5819
+ actionsMode = "hover",
5820
+ chrome = true,
5821
+ onNewTab,
5822
+ children,
5823
+ className,
5824
+ "aria-label": ariaLabel,
5825
+ ...rest
5826
+ }, ref) {
5827
+ const prefixo = useId();
5828
+ const trilho = useRef(null);
5829
+ const ctx = useMemo(
5830
+ () => ({
5831
+ value,
5832
+ onValueChange,
5833
+ surface,
5834
+ density,
5835
+ fill,
5836
+ actionsMode,
5837
+ idTab: (v3) => `${prefixo}-${v3}`
5838
+ }),
5839
+ [value, onValueChange, surface, density, fill, actionsMode, prefixo]
5840
+ );
5841
+ const { abas, acoesGlobais } = useMemo(() => {
5842
+ const abas2 = [];
5843
+ let acoesGlobais2 = null;
5844
+ for (const filho of Children.toArray(children)) {
5845
+ if (!isValidElement(filho)) continue;
5846
+ if (filho.type === TabsNavigationActions) acoesGlobais2 = filho;
5847
+ else abas2.push(filho);
5848
+ }
5849
+ return { abas: abas2, acoesGlobais: acoesGlobais2 };
5850
+ }, [children]);
5851
+ const [rolagem, setRolagem] = useState({ transborda: false, esq: false, dir: false });
5852
+ const medir = useCallback(() => {
5853
+ const el = trilho.current;
5854
+ if (!el) return;
5855
+ const max = el.scrollWidth - el.clientWidth;
5856
+ setRolagem({ transborda: max > 1, esq: el.scrollLeft > 1, dir: el.scrollLeft < max - 1 });
5857
+ }, []);
5858
+ useEffect(() => {
5859
+ const el = trilho.current;
5860
+ if (!el) return;
5861
+ medir();
5862
+ if (typeof ResizeObserver === "undefined") return;
5863
+ const ro = new ResizeObserver(medir);
5864
+ ro.observe(el);
5865
+ for (const filho of Array.from(el.children)) ro.observe(filho);
5866
+ return () => ro.disconnect();
5867
+ }, [medir, abas.length]);
5868
+ useEffect(() => {
5869
+ const el = trilho.current;
5870
+ const alvo = el?.querySelector(`[data-value="${CSS.escape(value)}"]`);
5871
+ alvo?.scrollIntoView({ inline: "nearest", block: "nearest", behavior: "smooth" });
5872
+ if (el?.contains(document.activeElement) && alvo !== document.activeElement) alvo?.focus();
5873
+ }, [value]);
5874
+ useArrastarParaRolar(trilho);
5875
+ const rolar = (dir) => trilho.current?.scrollBy({ left: dir * 240, behavior: "smooth" });
5876
+ const onKeyDown = (e2) => {
5877
+ const valores = abas.map((a11) => a11.props.value);
5878
+ const i3 = valores.indexOf(value);
5879
+ if (i3 < 0) return;
5880
+ const proximo = e2.key === "ArrowRight" ? valores[(i3 + 1) % valores.length] : e2.key === "ArrowLeft" ? valores[(i3 - 1 + valores.length) % valores.length] : e2.key === "Home" ? valores[0] : e2.key === "End" ? valores[valores.length - 1] : null;
5881
+ if (!proximo) return;
5882
+ e2.preventDefault();
5883
+ onValueChange(proximo);
5884
+ };
5885
+ const controles = tabsNavigationControles({ fill, density });
5886
+ return /* @__PURE__ */ jsx(TabsNavigationContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
5887
+ "div",
5888
+ {
5889
+ ref,
5890
+ role: "tablist",
5891
+ "aria-label": ariaLabel,
5892
+ "aria-orientation": "horizontal",
5893
+ onKeyDown,
5894
+ className: tabsNavigationRoot({
5895
+ fill,
5896
+ chrome,
5897
+ // em `fill` a aba vai de ponta a ponta: respiro no topo desmontaria justamente isso
5898
+ respiro: fill ? "nenhum" : density,
5899
+ className
5900
+ }),
5901
+ ...rest,
5902
+ children: [
5903
+ rolagem.esq ? /* @__PURE__ */ jsxs("div", { className: `${controles} hidden pr-pad-xs sm:flex`, children: [
5904
+ /* @__PURE__ */ jsx(
5905
+ Button,
5906
+ {
5907
+ variant: "ghost",
5908
+ color: "secondary",
5909
+ size: "icon-sm",
5910
+ "aria-label": "Abas anteriores",
5911
+ onClick: () => rolar(-1),
5912
+ children: /* @__PURE__ */ jsx(ChevronLeft, {})
5913
+ }
5914
+ ),
5915
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: tabsNavigationDivisoria({ fill }) })
5916
+ ] }) : null,
5917
+ /* @__PURE__ */ jsx("div", { ref: trilho, onScroll: medir, className: tabsNavigationTrilho({ fill }), children: abas.map((aba, i3) => {
5918
+ const vizinhaDaAtiva = aba.props.value === value || abas[i3 + 1]?.props.value === value;
5919
+ return /* @__PURE__ */ jsxs(
5920
+ "div",
5921
+ {
5922
+ className: ["flex shrink-0", fill ? "items-stretch" : "items-end"].join(" "),
5923
+ children: [
5924
+ aba,
5925
+ i3 < abas.length - 1 ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: tabsNavigationDivisoria({ fill, oculta: vizinhaDaAtiva }) }) : null
5926
+ ]
5927
+ },
5928
+ aba.props.value
5929
+ );
5930
+ }) }),
5931
+ rolagem.dir ? /* @__PURE__ */ jsxs("div", { className: `${controles} hidden pl-pad-xs sm:flex`, children: [
5932
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: tabsNavigationDivisoria({ fill }) }),
5933
+ /* @__PURE__ */ jsx(
5934
+ Button,
5935
+ {
5936
+ variant: "ghost",
5937
+ color: "secondary",
5938
+ size: "icon-sm",
5939
+ "aria-label": "Próximas abas",
5940
+ onClick: () => rolar(1),
5941
+ children: /* @__PURE__ */ jsx(ChevronRight, {})
5942
+ }
5943
+ )
5944
+ ] }) : null,
5945
+ onNewTab || rolagem.transborda && abas.length || acoesGlobais ? /* @__PURE__ */ jsxs("div", { className: controles, children: [
5946
+ onNewTab ? /* @__PURE__ */ jsx(
5947
+ Button,
5948
+ {
5949
+ variant: "ghost",
5950
+ color: "secondary",
5951
+ size: "icon-sm",
5952
+ "aria-label": "Abrir nova aba",
5953
+ onClick: onNewTab,
5954
+ children: /* @__PURE__ */ jsx(Plus, {})
5955
+ }
5956
+ ) : null,
5957
+ rolagem.transborda && abas.length ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
5958
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
5959
+ Button,
5960
+ {
5961
+ variant: "ghost",
5962
+ color: "secondary",
5963
+ size: "icon-sm",
5964
+ "aria-label": `Listar as ${abas.length} abas abertas`,
5965
+ children: /* @__PURE__ */ jsx(ChevronDown, {})
5966
+ }
5967
+ ) }),
5968
+ /* @__PURE__ */ jsxs(
5969
+ DropdownMenuContent,
5970
+ {
5971
+ align: "end",
5972
+ className: "max-h-[320px] w-[264px] overflow-y-auto scrollbar-thin",
5973
+ children: [
5974
+ /* @__PURE__ */ jsxs(DropdownMenuLabel, { children: [
5975
+ abas.length,
5976
+ " abas abertas"
5977
+ ] }),
5978
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
5979
+ abas.map((aba) => {
5980
+ const p4 = aba.props;
5981
+ return /* @__PURE__ */ jsxs(
5982
+ DropdownMenuItem,
5983
+ {
5984
+ onSelect: () => onValueChange(p4.value),
5985
+ className: p4.value === value ? "bg-bg-brand-subtle text-fg-brand" : void 0,
5986
+ children: [
5987
+ ehStatusConhecido(p4.status) ? /* @__PURE__ */ jsx(Circle, { className: tabsNavigationStatus({ status: p4.status }), "aria-hidden": true }) : null,
5988
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: p4.children })
5989
+ ]
5990
+ },
5991
+ p4.value
5992
+ );
5993
+ })
5994
+ ]
5995
+ }
5996
+ )
5997
+ ] }) : null,
5998
+ acoesGlobais ? /* @__PURE__ */ jsxs(Fragment, { children: [
5999
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: tabsNavigationDivisoria({ fill, className: "mx-pad-xs" }) }),
6000
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-gp-2xs", children: acoesGlobais })
6001
+ ] }) : null
6002
+ ] }) : null
6003
+ ]
6004
+ }
6005
+ ) });
6006
+ });
6007
+ const TabsNavigation = Object.assign(TabsNavigationRoot, {
6008
+ Tab: TabsNavigationTab,
6009
+ Title: TabsNavigationTitle,
6010
+ Subtitle: TabsNavigationSubtitle,
6011
+ Action: TabsNavigationAction,
6012
+ Actions: TabsNavigationActions,
6013
+ Panel: TabsNavigationPanel
6014
+ });
5403
6015
  class Adder {
5404
6016
  constructor() {
5405
6017
  this._partials = new Float64Array(32);
@@ -8382,7 +8994,7 @@ export {
8382
8994
  X as MoreMenu,
8383
8995
  y2 as MoreMenuCheckboxItem,
8384
8996
  DropdownMenuItem as MoreMenuItem,
8385
- F2 as MoreMenuLabel,
8997
+ DropdownMenuLabel as MoreMenuLabel,
8386
8998
  H3 as MoreMenuRadioGroup,
8387
8999
  I2 as MoreMenuRadioItem,
8388
9000
  DropdownMenuSeparator as MoreMenuSeparator,
@@ -8393,7 +9005,7 @@ export {
8393
9005
  H4 as PanelContent,
8394
9006
  Z as PanelFooter,
8395
9007
  _ as PanelHeader,
8396
- F3 as PanelRoot,
9008
+ F2 as PanelRoot,
8397
9009
  O2 as PanelTrigger,
8398
9010
  $ as SELECTION_COLUMN_WIDTH,
8399
9011
  ScreenLoader,
@@ -8418,6 +9030,15 @@ export {
8418
9030
  a9 as TableRow,
8419
9031
  TableToolbar,
8420
9032
  aa as TableToolbarViews,
9033
+ TabsNavigation,
9034
+ TabsNavigationAction,
9035
+ TabsNavigationActions,
9036
+ TabsNavigationContext,
9037
+ TabsNavigationPanel,
9038
+ TabsNavigationRoot,
9039
+ TabsNavigationSubtitle,
9040
+ TabsNavigationTab,
9041
+ TabsNavigationTitle,
8421
9042
  ToastCard,
8422
9043
  ToolbarApplied,
8423
9044
  ab as ToolbarDivider,
@@ -8476,6 +9097,14 @@ export {
8476
9097
  al as savedViewsMockService,
8477
9098
  t2 as shouldPreventNavigation,
8478
9099
  statusColumn,
9100
+ tabsNavigationAcao,
9101
+ tabsNavigationAcoes,
9102
+ tabsNavigationControles,
9103
+ tabsNavigationDivisoria,
9104
+ tabsNavigationRoot,
9105
+ tabsNavigationStatus,
9106
+ tabsNavigationTab,
9107
+ tabsNavigationTrilho,
8479
9108
  textColumn,
8480
9109
  toast,
8481
9110
  toastVariants,