Skip to content

feat(smae-description-list): adiciona modo grid e ajusta testes/docs#575

Merged
Eduruiz merged 6 commits intohomolfrom
feature/add-modo-grid-no-smae-description-list
Feb 23, 2026
Merged

feat(smae-description-list): adiciona modo grid e ajusta testes/docs#575
Eduruiz merged 6 commits intohomolfrom
feature/add-modo-grid-no-smae-description-list

Conversation

@Eduruiz
Copy link
Copy Markdown
Collaborator

@Eduruiz Eduruiz commented Feb 20, 2026

Agora é possível definir o layout da description-list usando o modo grid pra auto-posicionar as colunas sem fazer expansão da largura, ideal pra quando temos mais itens em linha do que o modo flex

Summary by CodeRabbit

  • New Features

    • SmaeDescriptionList supports two layouts: Flex (default) and Grid, with configurable behavior and full-width item support.
    • Added configurable minimum item width for responsive grid control and a layout prop to toggle modes.
  • Documentation

    • Docs updated with separate Layout Flex and Layout Grid sections, examples, and guidance for sizing and full-width items.
  • Tests

    • Expanded tests for layout switching, larguraMinima behavior, and full-width item handling.

Agora é possível definir o layout da description-list usando o modo grid
pra auto-posicionar as colunas sem fazer expansão da largura, ideal pra
quando temos mais itens em linha do que o modo flex
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

Adds grid layout support to SmaeDescriptionList via a new layout prop ('flex' | 'grid') and a larguraMinima prop; updates rendering, styles, tests, and documentation to reflect distinct flex vs grid behaviors, new classes, and CSS variable usage.

Changes

Cohort / File(s) Summary
Component Implementation
frontend/src/components/SmaeDescriptionList.vue
Added layout (`'flex'
Tests
frontend/src/components/SmaeDescriptionList.spec.js
Updated tests to expect new classes (description-list--flex, description-list--grid, description-list__item, description-list__item--full). Added tests for layout default/toggle, full-width behavior with larguraBase under grid, and larguraMinima setting CSS variable only in grid mode.
Documentation
frontend/src/components/SmaeDescriptionList.md
Documented layout and larguraMinima props, added Layouts section (Flex vs Grid), updated HTML examples and behavior notes, and added usage examples demonstrating layout="grid", larguraMinima, and larguraBase scenarios.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • GustavoFSoares
  • robsonsobral

Poem

🐰 I hopped through markup, classes new and neat,
Flex stretches wide, while grid aligns each beat,
Min-width whispers in a CSS line,
Items span or fit — arrangement by design,
A bunny cheers for lists now tidy and sweet.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding grid layout mode and adjusting tests/documentation for the SmaeDescriptionList component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-modo-grid-no-smae-description-list

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 20, 2026

Deploying smae with  Cloudflare Pages  Cloudflare Pages

Latest commit: d5fef65
Status: ✅  Deploy successful!
Preview URL: https://52a18d76.smae.pages.dev
Branch Preview URL: https://feature-add-modo-grid-no-sma.smae.pages.dev

View logs

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
frontend/src/components/SmaeDescriptionList.vue (1)

60-64: Consider adding a runtime validator for the layout prop

The TypeScript type String as () => 'flex' | 'grid' protects at compile time, but any runtime value slips through silently (falling back to flex). A validator would emit a Vue development warning for misuse.

♻️ Proposed addition
  layout: {
    type: String as () => 'flex' | 'grid',
    required: false,
    default: 'flex',
+   validator: (value: string) => ['flex', 'grid'].includes(value),
  },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/SmaeDescriptionList.vue` around lines 60 - 64, The
layout prop in SmaeDescriptionList.vue currently uses only a TypeScript
annotation and can accept invalid runtime values; add a runtime validator to the
layout prop definition (the prop named "layout") that returns true only for
'flex' or 'grid' (e.g., value => value === 'flex' || value === 'grid') so Vue
emits a dev warning on invalid values and preserves the existing default 'flex'.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/components/SmaeDescriptionList.md`:
- Line 85: The props table entry for larguraMinima is inaccurate: update the
default to match the component prop default (empty string) and add a note that a
CSS fallback of 180px is applied via the .description-list--grid rule
(--dl-item-min-width: 180px); reference the prop name larguraMinima and the CSS
class .description-list--grid in the SmaeDescriptionList.md content so readers
understand the empty-string default and the separate stylesheet fallback.
- Around line 280-289: The HTML example for the grid layout incorrectly shows an
inline style that is only produced when the larguraMinima prop is set; update
the example in SmaeDescriptionList.md to reflect the true default output by
removing the inline `style="--dl-item-min-width: 180px;"` from the <dl> example
(or alternatively add a brief comment that it appears only if larguraMinima is
provided), and mention that the inline style is generated by the estiloContainer
logic when larguraMinima is passed so readers can reproduce the 180px value by
using the larguraMinima prop.

In `@frontend/src/components/SmaeDescriptionList.vue`:
- Around line 104-108: The grid branch currently concatenates resultado.class
into a string which breaks when atributosDoItem.class is an array or object; in
the isGrid/larguraBase === '100%' block (where você reads const classeExistente
= resultado.class) change the assignment to keep an array instead of joining
into a string — e.g. set resultado.class = [classeExistente,
'description-list__item--full'].filter(Boolean) (do not .join(' ')) so Vue's
native class merging handles string/array/object inputs correctly.

---

Nitpick comments:
In `@frontend/src/components/SmaeDescriptionList.vue`:
- Around line 60-64: The layout prop in SmaeDescriptionList.vue currently uses
only a TypeScript annotation and can accept invalid runtime values; add a
runtime validator to the layout prop definition (the prop named "layout") that
returns true only for 'flex' or 'grid' (e.g., value => value === 'flex' || value
=== 'grid') so Vue emits a dev warning on invalid values and preserves the
existing default 'flex'.

Comment thread frontend/src/components/SmaeDescriptionList.md Outdated
Comment thread frontend/src/components/SmaeDescriptionList.md
Comment thread frontend/src/components/SmaeDescriptionList.vue
Eduruiz and others added 2 commits February 20, 2026 15:32
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@frontend/src/components/SmaeDescriptionList.md`:
- Around line 280-289: Update the grid HTML example in SmaeDescriptionList.md so
it no longer shows the inline style unconditionally: use the <dl> with class
"description-list description-list--grid" without style for the case where
larguraMinima is not provided (CSS fallback applies), and add a separate example
that includes the inline style (e.g., style="--dl-item-min-width: 250px;") to
demonstrate when the larguraMinima prop is used; reference the class
"description-list description-list--grid" and the prop name larguraMinima to
make the intent clear.

Com `larguraMinima` fornecida, o inline style é adicionado:

```html
<dl class="description-list description-list--grid" style="--dl-item-min-width: 250px;">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ê, laia! As larguras em px!

Comment thread frontend/src/components/SmaeDescriptionList.vue
Comment thread frontend/src/components/SmaeDescriptionList.vue Outdated
- Adiciona validator ao prop 'layout' para garantir apenas valores 'flex' ou 'grid'
- Converte largura mínima padrão de 180px para 13rem (alinhado com font-size: 14px do projeto)
- Alterar exemplos de 200px/250px para 15rem
- Alterar default de 180px para 13rem (~180px)
- Alinhar unidades com font-size: 14px do projeto
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
frontend/src/components/SmaeDescriptionList.vue (1)

100-111: Optional: avoid the unconditional shallow copy when grid mode doesn't mutate resultado.

resultado = { ...atributos } is created at line 105 before the isGrid branch. When isGrid is true and larguraBase !== '100%', the function returns resultado unchanged — a needless allocation. The early-return pattern used for !larguraBase at line 101 could be reused here.

♻️ Proposed refactor
-  const resultado = { ...atributos };
-
-  if (isGrid.value) {
+  if (isGrid.value) {
     if (larguraBase === '100%') {
+      const resultado = { ...atributos };
       const classeExistente = resultado.class;
       resultado.class = [classeExistente, 'description-list__item--full'].filter(Boolean);
+      return resultado;
     }
+    return atributos;
   } else {
+    const resultado = { ...atributos };
     ...
     return resultado;
   }
-
-  return resultado;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/SmaeDescriptionList.vue` around lines 100 - 111, The
function currently always creates a shallow copy `resultado = { ...atributos }`
even when no mutation occurs; change the logic to avoid that allocation by only
copying when needed: if `!larguraBase` return `atributos`, and if `isGrid.value`
is false or `larguraBase !== '100%'` return `atributos` directly; only create a
shallow copy and set `resultado.class = [existing,
'description-list__item--full']` when `isGrid.value` is true and `larguraBase
=== '100%'` (use the existing symbols `atributos`, `resultado`, `isGrid`,
`larguraBase`, `class`, `description-list__item--full` to locate the code).
frontend/src/components/SmaeDescriptionList.md (1)

214-216: Optional: clarify that larguraBase values other than '100%' only take effect in flex mode.

Line 216 describes larguraBase as accepting "qualquer valor CSS válido para flex-basis", but in grid mode only '100%' produces a visible effect (it maps to grid-column: 1 / -1 via description-list__item--full). Any other value (e.g. '20em') is silently ignored. A brief note would prevent silent misbehavior for consumers who switch to layout="grid".

📝 Suggested addition
 A largura dos itens pode ser controlada através da propriedade `larguraBase` (em `itensSelecionados` ou em itens de `lista`), que aceita qualquer valor CSS válido para `flex-basis`:
+
+> **Nota:** no modo `grid`, apenas `'100%'` tem efeito (faz o item ocupar toda a largura via `grid-column: 1 / -1`). Demais valores são ignorados.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/SmaeDescriptionList.md` around lines 214 - 216,
Update the documentation for the larguraBase prop to note that while it accepts
any valid CSS flex-basis value (used on itensSelecionados or lista), values
other than '100%' only take effect when the component is in flex mode; in grid
mode (layout="grid") only '100%' is mapped to the full-width behavior via the
description-list__item--full rule and other values are ignored. Mention
larguraBase, itensSelecionados, lista, layout="grid" and
description-list__item--full so readers can locate the related code and avoid
silent misbehavior when switching layouts.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/components/SmaeDescriptionList.md`:
- Line 303: Update the docs to accurately reflect the CSS: change the
description mentioning `flex: 1` to state that `.description-list__item` uses
`flex: 1 1 auto` (not `flex: 1`), explain that this means items use their
natural/content width as the flex-basis before growing, and note the practical
impact for users when sizing items with `larguraBase` (i.e., items will start at
content size then grow, not from 0%). Reference the `.description-list__item`
selector and the `larguraBase` prop in the updated text so consumers understand
the exact sizing behavior.

---

Nitpick comments:
In `@frontend/src/components/SmaeDescriptionList.md`:
- Around line 214-216: Update the documentation for the larguraBase prop to note
that while it accepts any valid CSS flex-basis value (used on itensSelecionados
or lista), values other than '100%' only take effect when the component is in
flex mode; in grid mode (layout="grid") only '100%' is mapped to the full-width
behavior via the description-list__item--full rule and other values are ignored.
Mention larguraBase, itensSelecionados, lista, layout="grid" and
description-list__item--full so readers can locate the related code and avoid
silent misbehavior when switching layouts.

In `@frontend/src/components/SmaeDescriptionList.vue`:
- Around line 100-111: The function currently always creates a shallow copy
`resultado = { ...atributos }` even when no mutation occurs; change the logic to
avoid that allocation by only copying when needed: if `!larguraBase` return
`atributos`, and if `isGrid.value` is false or `larguraBase !== '100%'` return
`atributos` directly; only create a shallow copy and set `resultado.class =
[existing, 'description-list__item--full']` when `isGrid.value` is true and
`larguraBase === '100%'` (use the existing symbols `atributos`, `resultado`,
`isGrid`, `larguraBase`, `class`, `description-list__item--full` to locate the
code).

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3fdc57f and d5fef65.

📒 Files selected for processing (2)
  • frontend/src/components/SmaeDescriptionList.md
  • frontend/src/components/SmaeDescriptionList.vue

- Quando `valor` é `null`, `undefined` ou vazio, exibe "—" (travessão)
- Listas consecutivas recebem borda superior e espaçamento automático
- Os itens usam `flex: 1` por padrão, expandindo para preencher o espaço disponível
- **Layout flex:** os itens usam `flex: 1` por padrão, expandindo para preencher o espaço disponível
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Minor doc inaccuracy: flex: 1flex: 1 1 auto.

The CSS declares .description-list__item { flex: 1 1 auto; }, but line 303 documents it as flex: 1. These expand differently: flex: 1flex: 1 1 0% (all items start at zero basis and grow equally), whereas flex: 1 1 auto → items start from their natural/content width before growing. The behaviour description in the docs is misleading for consumers sizing items with larguraBase.

📝 Suggested correction
-- **Layout flex:** os itens usam `flex: 1` por padrão, expandindo para preencher o espaço disponível
+- **Layout flex:** os itens usam `flex: 1 1 auto` por padrão, expandindo para preencher o espaço disponível
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **Layout flex:** os itens usam `flex: 1` por padrão, expandindo para preencher o espaço disponível
- **Layout flex:** os itens usam `flex: 1 1 auto` por padrão, expandindo para preencher o espaço disponível
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/SmaeDescriptionList.md` at line 303, Update the docs
to accurately reflect the CSS: change the description mentioning `flex: 1` to
state that `.description-list__item` uses `flex: 1 1 auto` (not `flex: 1`),
explain that this means items use their natural/content width as the flex-basis
before growing, and note the practical impact for users when sizing items with
`larguraBase` (i.e., items will start at content size then grow, not from 0%).
Reference the `.description-list__item` selector and the `larguraBase` prop in
the updated text so consumers understand the exact sizing behavior.

@Eduruiz Eduruiz merged commit 11d34d5 into homol Feb 23, 2026
4 checks passed
@Eduruiz Eduruiz deleted the feature/add-modo-grid-no-smae-description-list branch February 23, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants