@motor-hero/ui-kit 0.43.1 → 0.44.1
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.
- package/dist/components/combobox.d.ts +3 -0
- package/dist/components/combobox.d.ts.map +1 -1
- package/dist/components/date-picker.d.ts.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/combobox.tsx +4 -0
- package/src/components/date-picker.tsx +9 -6
package/package.json
CHANGED
|
@@ -11,6 +11,9 @@ export interface ComboboxOption {
|
|
|
11
11
|
value: string;
|
|
12
12
|
label: string;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
+
/** Optional leading decoration rendered before the label (icon, colored
|
|
15
|
+
* dot) — purely visual, doesn't affect filtering/matching. */
|
|
16
|
+
icon?: React.ReactNode;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export interface ComboboxProps {
|
|
@@ -198,6 +201,7 @@ export function Combobox({
|
|
|
198
201
|
value === option.value ? "opacity-100" : "opacity-0",
|
|
199
202
|
)}
|
|
200
203
|
/>
|
|
204
|
+
{option.icon}
|
|
201
205
|
<span className="truncate">{option.label}</span>
|
|
202
206
|
</CommandPrimitive.Item>
|
|
203
207
|
))}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as PopoverPrimitive from "@radix-ui/react-popover"
|
|
2
2
|
import { InputMask } from "@react-input/mask"
|
|
3
|
-
import { endOfYear, format, isValid, parse, subYears } from "date-fns"
|
|
3
|
+
import { addYears, endOfYear, format, isValid, parse, subYears } from "date-fns"
|
|
4
4
|
import { ptBR } from "date-fns/locale"
|
|
5
5
|
import { CalendarIcon, ChevronDown, ChevronLeft, ChevronRight, Clock } from "lucide-react"
|
|
6
6
|
import * as React from "react"
|
|
@@ -171,12 +171,15 @@ function DatePickerImpl({
|
|
|
171
171
|
const committedDate = withTime ? dateTimeToDate(value) : dateOnlyToDate(value)
|
|
172
172
|
const displayValue = displayFor(value, withTime)
|
|
173
173
|
const matchers = toMatchers(minDate, maxDate, disabledDates)
|
|
174
|
-
// Alcance do dropdown de ano: minDate/maxDate quando informados
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
// prática: só uma opção de ano no lado sem prop)
|
|
174
|
+
// Alcance do dropdown de ano: minDate/maxDate quando informados; senão,
|
|
175
|
+
// calculado explícito nos dois lados porque passar só um dos dois via prop
|
|
176
|
+
// faz a lib truncar o outro em vez de cair no próprio padrão dela (visto na
|
|
177
|
+
// prática: só uma opção de ano no lado sem prop). Do lado do fim, não usamos
|
|
178
|
+
// o padrão da lib (fim do ano corrente) — vencimento de campanha, validade
|
|
179
|
+
// de premiação e agendamentos legitimamente caem anos à frente; +20 anos
|
|
180
|
+
// evita recriar esse teto sem abrir um intervalo sem sentido.
|
|
178
181
|
const startMonth = dateOnlyToDate(minDate) ?? subYears(new Date(), 100)
|
|
179
|
-
const endMonth = dateOnlyToDate(maxDate) ?? endOfYear(new Date())
|
|
182
|
+
const endMonth = dateOnlyToDate(maxDate) ?? endOfYear(addYears(new Date(), 20))
|
|
180
183
|
|
|
181
184
|
const setOpen = (next: boolean) => {
|
|
182
185
|
setOpenRaw(next)
|