Skip to content

fix(core): MR-772 calendário do DateRange/DatePicker na largura dos dois campos - #1257

Merged
igor-monteiro-almeida merged 4 commits into
masterfrom
fix/MR-772-date-range-calendar-full-width
Sep 18, 2026
Merged

igor-monteiro-almeida merged 4 commits into
masterfrom
fix/MR-772-date-range-calendar-full-width

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

O DateRange abria o calendário com meia largura, alinhado só sob o primeiro campo: .ods-date__calendar-container era o terceiro filho da grid .ods-date__form-row (2 colunas), então caía na primeira coluna da linha seguinte e ainda criava uma linha extra (empurrava o conteúdo abaixo em drawers/modais). Cada MFE do portal remendou isso localmente (16 remendos em 8 MFEs).

1. Layout (ocean-core, sem mudar a API)

.ods-date__form-row, .ods-date__form-row-datepicker { position: relative; }
.ods-date__calendar-container { position: absolute; top: 100%; left: 0; right: 0; width: 100%; z-index: 1;
  &--inline { position: relative; }   // DatePicker inline segue no fluxo
}
.ods-date__calendar { left: 0; right: 0; width: 100%; margin-top: $spacing-inline-xxxs; }
.ods-date__form-controls > label { display: flex; align-items: center; min-height: 22px; }  // alinha com o label do Input vizinho
  • Calendário nas duas colunas, borda esquerda em "De" e direita em "Até", sobreposto ao conteúdo seguinte (0px de reflow em drawer/modal).
  • Removidos _calendar_m2 { top: 150px } (≤321px) e os top dos _calendar_m1/_m2, que compensavam o posicionamento antigo.
  • DatePicker ganha ods-date__calendar-container--inline quando inline.
  • Stories novas em Components/DateRange: InsideDrawer, InsideModal, InlineWithInput, NarrowContainer.

2. Erro por campo (ocean-react, aditivo e retrocompatível)

error e helperText do DateRange/DatePicker passam a aceitar também um objeto por campo:

export type DateFieldFlags = { from?: boolean; to?: boolean };
export type DateFieldTexts = { from?: string; to?: string };
error?: boolean | DateFieldFlags;        // true → os dois campos (como hoje)
helperText?: string | DateFieldTexts;    // string → mesma mensagem nos dois (como hoje)
  • error={{ from: true }} marca só "De"; helperText={{ from: '...' }} mostra a mensagem só nele.
  • Quando há erro, o calendário fecha (useDateRange: setShowDayPicker(false)) para não cobrir a mensagem; o helperText é omitido enquanto o calendário está aberto.
  • Story PerFieldError.

Jira: MR-772 · Ledger: MR-772 · Preview aprovado: https://dist-yklhlpxf.devinapps.com

Consumidores que removem os remendos após a publicação: Pagnet/mfe-core#370 e as 8 PRs listadas no Ledger; Pagnet/mfe-statement#134 usa o erro por campo.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • yarn jest packages/ocean-react/src/Date — 39 testes, 2 snapshots OK (inclui erro por campo e fechamento do calendário).
  • eslint + stylelint nos arquivos alterados.
  • Layout validado no preview aprovado (mesmo CSS): Vendas (drawer), Extrato (modal), formulário em linha, meses de 5 e 6 semanas; homologação no playground mr772 (18/09): cenários de layout aprovados pelo design.

Screenshots (if appropriate):

Ver preview: https://dist-yklhlpxf.devinapps.com

Checklist:

  • I have read the CONTRIBUTING document
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • My changes work in Chrome, Edge, and Firefox
  • I have made corresponding changes to the documentation (if appropriate)
  • I have added tests that prove my fix is effective or that my feature works
  • All new and existing tests passed

Link to Devin session: https://app.devin.ai/sessions/fd793ad203934b328e6c968bfba5b89f
Open in Devin Desktop: https://app.devin.ai/desktop/session/fd793ad203934b328e6c968bfba5b89f?variant=devin
Requested by: @igor-monteiro-almeida

O container do calendário deixa de ser filho da grid (ocupava só a
primeira coluna) e passa a ser posicionado sob a linha dos campos, na
largura inteira e sobreposto ao conteúdo seguinte (drawers/modais não
sofrem reflow). Labels alinhadas ao Input vizinho. Stories para drawer,
modal e linha com Input.

Co-authored-by: Igor Monteiro <igor.monteiro@useblu.com.br>
Co-Authored-By: igor.monteiro <igor.monteiro@useblu.com.br>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Original prompt from igor.monteiro

@playbook:playbook-761b740ef1fb4b0fa415f5dc51c9c5f7 https://useblu.atlassian.net/browse/MR-772

devin-ai-integration Bot and others added 2 commits September 17, 2026 19:04
Co-authored-by: Igor Monteiro <igor.monteiro@useblu.com.br>
Co-Authored-By: igor.monteiro <igor.monteiro@useblu.com.br>
…erro (mr-772)

- error/helperText aceitam { from, to } além de boolean/string (compatível)
- calendário fecha quando um erro chega, para a mensagem ficar visível
- DatePicker (data única) mantém boolean/string

Co-authored-by: Igor Monteiro <igor.monteiro@useblu.com.br>
Co-Authored-By: igor.monteiro <igor.monteiro@useblu.com.br>
@igor-monteiro-almeida
igor-monteiro-almeida marked this pull request as ready for review September 18, 2026 13:09
@sonarqubecloud

Copy link
Copy Markdown

@igor-monteiro-almeida
igor-monteiro-almeida merged commit 0e533a5 into master Sep 18, 2026
11 of 12 checks passed
@igor-monteiro-almeida
igor-monteiro-almeida deleted the fix/MR-772-date-range-calendar-full-width branch September 18, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant