period_picker(
from_name: :from,
to_name: :to,
from: nil,
to: nil,
presets: [], # [{ label:, from:, to: }]
title: "Período"
)
Presets are hashes with label, from and to (nil for an open end). Picking one fills both fields and closes the panel; editing a date clears the preset. It dispatches componeer--period-picker:change.
Data de emissão
<div style="min-height: 280px">
<%= period_picker from: Date.new(2026, 11, 1), to: Date.new(2026, 11, 30), title: "Data de emissão",
presets: [
{ label: "Este mês", from: Date.new(2026, 11, 1), to: Date.new(2026, 11, 30) },
{ label: "Mês passado", from: Date.new(2026, 10, 1), to: Date.new(2026, 10, 31) },
{ label: "Este ano", from: Date.new(2026, 1, 1), to: Date.new(2026, 12, 31) },
{ label: "Qualquer data", from: nil, to: nil }
] %>
</div>