@seedgrid/fe-components 2026.8.5 → 2026.8.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgYearPartSelector.d.ts","sourceRoot":"","sources":["../../src/inputs/SgYearPartSelector.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EAMZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,oFAAoF;IACpF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAChD,wFAAwF;IACxF,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAC9B,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA2BF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"SgYearPartSelector.d.ts","sourceRoot":"","sources":["../../src/inputs/SgYearPartSelector.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EAMZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,oFAAoF;IACpF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAChD,wFAAwF;IACxF,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAC9B,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA2BF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,uBAAuB,CAAC,2CA6J1E"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { cn } from "../layout/sgDocking";
|
|
5
|
-
import { SgAutocomplete } from "./SgAutocomplete";
|
|
6
5
|
import { SgCombobox } from "./SgCombobox";
|
|
7
6
|
import { YearPartKind, clampYearPart, resolveYearPart, yearPartKindLabel, yearPartOf, yearPartOptions } from "./yearPart";
|
|
8
7
|
const FIELD_LABELS = {
|
|
@@ -60,16 +59,6 @@ export function SgYearPartSelector(props) {
|
|
|
60
59
|
return { id: year, label: String(year) };
|
|
61
60
|
});
|
|
62
61
|
}, [firstYear, lastYear]);
|
|
63
|
-
/*
|
|
64
|
-
* O SgAutocomplete pede uma FONTE (funcao da query), nao um array. Filtra por prefixo, que e' o
|
|
65
|
-
* unico casamento que faz sentido em ano: "202" oferece 2029..2020, e nao 1202.
|
|
66
|
-
*/
|
|
67
|
-
const yearSource = React.useCallback((query) => {
|
|
68
|
-
const typed = query.trim();
|
|
69
|
-
if (!typed)
|
|
70
|
-
return yearItems;
|
|
71
|
-
return yearItems.filter((item) => item.label.startsWith(typed));
|
|
72
|
-
}, [yearItems]);
|
|
73
62
|
const kindItems = React.useMemo(() => kinds.map((kind) => ({ id: kind, label: yearPartKindLabel(kind, locale) })), [kinds, locale]);
|
|
74
63
|
// Depende do recorte: trocar de trimestre para semestre troca 4 opcoes por 2.
|
|
75
64
|
const partItems = React.useMemo(() => yearPartOptions(current.kind, locale).map((option) => ({ id: option.value, label: option.label })), [current.kind, locale]);
|
|
@@ -79,14 +68,11 @@ export function SgYearPartSelector(props) {
|
|
|
79
68
|
* Flex em vez de grid de 3 colunas: com o combo de recorte escondido a linha reflui para dois
|
|
80
69
|
* controles, em vez de deixar uma coluna vazia no meio.
|
|
81
70
|
*/
|
|
82
|
-
return (_jsxs("div", { className: cn("w-full", className), children: [label ? (_jsxs("span", { className: "mb-1 block text-sm font-medium text-[rgb(var(--sg-text))]", children: [label, required ? " *" : ""] })) : null, _jsxs("div", { className: "flex w-full flex-col gap-2 sm:flex-row sm:items-start sm:gap-3", children: [_jsx("div", { className: "w-full sm:flex-1", children: _jsx(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
* larga sem avisar ninguem.
|
|
88
|
-
*/
|
|
89
|
-
minLengthForSearch: 0, openOnFocus: true, showDropDownButton: true, cacheEnabled: false, maxResult: yearItems.length, enabled: enabled, required: required, onSelect: (item) => commit({ ...current, year: Number(item.id) }) }) }), showKind ? (_jsx("div", { className: "w-full sm:flex-1", children: _jsx(SgCombobox, { id: `${id}-kind`, label: pickLocale(FIELD_LABELS.kind, locale), source: kindItems, value: current.kind, openOnFocus: true, enabled: enabled, required: required, onValueChange: (raw) => {
|
|
71
|
+
return (_jsxs("div", { className: cn("w-full", className), children: [label ? (_jsxs("span", { className: "mb-1 block text-sm font-medium text-[rgb(var(--sg-text))]", children: [label, required ? " *" : ""] })) : null, _jsxs("div", { className: "flex w-full flex-col gap-2 sm:flex-row sm:items-start sm:gap-3", children: [_jsx("div", { className: "w-full sm:flex-1", children: _jsx(SgCombobox, { id: `${id}-year`, label: pickLocale(FIELD_LABELS.year, locale), source: yearItems, value: current.year, openOnFocus: true, enabled: enabled, required: required, onValueChange: (value) => {
|
|
72
|
+
if (value === null || value === undefined)
|
|
73
|
+
return;
|
|
74
|
+
commit({ ...current, year: Number(value) });
|
|
75
|
+
} }) }), showKind ? (_jsx("div", { className: "w-full sm:flex-1", children: _jsx(SgCombobox, { id: `${id}-kind`, label: pickLocale(FIELD_LABELS.kind, locale), source: kindItems, value: current.kind, openOnFocus: true, enabled: enabled, required: required, onValueChange: (raw) => {
|
|
90
76
|
if (raw == null)
|
|
91
77
|
return;
|
|
92
78
|
// A fatia pode nao existir no recorte novo (estava no Q4 e virou semestre); quem
|