From 718c211391c66e6633feba7c5a09d0c9445eddc1 Mon Sep 17 00:00:00 2001 From: Gabriel Menezes Date: Mon, 2 Nov 2026 10:59:02 -0400 Subject: [PATCH] fix(dashboard): render custom period modal via portal with z-index to prevent stacking context overlap --- .../components/dashboard/PeriodSelector.tsx | 217 +++++++++--------- 1 file changed, 110 insertions(+), 107 deletions(-) diff --git a/frontend/src/components/dashboard/PeriodSelector.tsx b/frontend/src/components/dashboard/PeriodSelector.tsx index e854a59..8daaa56 100644 --- a/frontend/src/components/dashboard/PeriodSelector.tsx +++ b/frontend/src/components/dashboard/PeriodSelector.tsx @@ -1,4 +1,5 @@ import React, { useState, useRef, useEffect } from 'react' +import { createPortal } from 'react-dom' import { Calendar, ChevronDown, @@ -94,7 +95,7 @@ export const PeriodSelector: React.FC = ({ const isSecondaryActive = SECONDARY_PRESETS.includes(value) return ( -
+
{/* Left: Buttons & Presets */}
@@ -197,119 +198,121 @@ export const PeriodSelector: React.FC = ({
{/* Modal / Dialog for Custom Date Range */} - {customModalOpen && ( -
-
-
-
-
- + {customModalOpen && typeof document !== 'undefined' && + createPortal( +
+
+
+
+
+ +
+
+

+ Definir Período Personalizado +

+

+ Selecione a data de início e término desejadas. +

+
-
-

- Definir Período Personalizado -

-

- Selecione a data de início e término desejadas. -

-
-
- -
- -
-
-
- - setTempStart(e.target.value)} - required - className="w-full px-3 py-2 rounded-xl border border-border-soft bg-surface text-xs text-foreground focus:outline-hidden focus:border-brand shadow-xs" - /> -
-
- - setTempEnd(e.target.value)} - required - className="w-full px-3 py-2 rounded-xl border border-border-soft bg-surface text-xs text-foreground focus:outline-hidden focus:border-brand shadow-xs" - /> -
-
- - {/* Quick shortcut pills inside modal */} -
- - Atalhos de Meses: - -
- {[ - { - label: 'Últimos 30 dias', - days: 30, - }, - { - label: 'Últimos 60 dias', - days: 60, - }, - { - label: 'Últimos 90 dias', - days: 90, - }, - { - label: 'Últimos 180 dias', - days: 180, - }, - ].map((shortcut) => ( - - ))} -
-
- -
-
-
-
-
- )} + +
+
+
+ + setTempStart(e.target.value)} + required + className="w-full px-3 py-2 rounded-xl border border-border-soft bg-surface text-xs text-foreground focus:outline-hidden focus:border-brand shadow-xs" + /> +
+
+ + setTempEnd(e.target.value)} + required + className="w-full px-3 py-2 rounded-xl border border-border-soft bg-surface text-xs text-foreground focus:outline-hidden focus:border-brand shadow-xs" + /> +
+
+ + {/* Quick shortcut pills inside modal */} +
+ + Atalhos de Meses: + +
+ {[ + { + label: 'Últimos 30 dias', + days: 30, + }, + { + label: 'Últimos 60 dias', + days: 60, + }, + { + label: 'Últimos 90 dias', + days: 90, + }, + { + label: 'Últimos 180 dias', + days: 180, + }, + ].map((shortcut) => ( + + ))} +
+
+ +
+ + +
+
+
+
, + document.body + )}
) }