@aspprev/versi-ds 0.4.9 → 0.5.0

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/README.md CHANGED
@@ -95,7 +95,7 @@ import {
95
95
  - `validateFiles` retorna `code`, nome, extensão, tamanho e limite da rejeição e aceita mensagens por código; `FileViewer` também aceita `Promise<FileViewerSource>` como source.
96
96
  - Upload e `FileViewer` são controlados pelo consumidor; transporte, autenticação, persistência e download não fazem parte do pacote.
97
97
  - `DatePicker` aceita `selectionMode="year"` e mantém `selectionMode="day"` como padrão.
98
- - `DomainStatusBadge` aceita `statusMap` para vocabulário específico do produto.
98
+ - `StatusBadge` oferece as cores `primary`, `blue`, `green`, `orange`, `yellow`, `red`, `slate` e `black` nas aparências `solid`, `soft` e `outline`. `DomainStatusBadge` aceita um `statusMap` definido pelo consumidor; o DS não associa nomes de status a cores.
99
99
  - `Table` preserva os modos `fit`, `adaptive` e `scroll`; filtros e paginação respondem ao espaço do container.
100
100
  - `InputPhone`/`PhoneInput` e `SelectCountry` aceitam `showFlags`; o padrão é `true` e `showFlags={false}` remove a bandeira sem reservar espaço.
101
101
  - Os controles de formulário ocupam a largura disponível do container; `className="w-full"` pode ser usado em grids, flex containers e colunas responsivas.
@@ -1774,150 +1774,84 @@ function FilterBar({
1774
1774
  }
1775
1775
 
1776
1776
  // src/utils/resolve-status-appearance.ts
1777
- var NORMALIZED_STATUS = {
1778
- infoOutline: /* @__PURE__ */ new Set(["ABERTO", "PAGO", "EM PAGAMENTO"]),
1779
- infoSolid: /* @__PURE__ */ new Set([
1780
- "EM ANDAMENTO",
1781
- "SOLICITADO",
1782
- "NAO ASSINADO",
1783
- "AGUARDANDO ASSINATURA"
1784
- ]),
1785
- warning: /* @__PURE__ */ new Set([
1786
- "EM ANALISE",
1787
- "PENDENTE",
1788
- "SUSPENSO",
1789
- "AGUARDANDO PARTICIPANTE"
1790
- ]),
1791
- success: /* @__PURE__ */ new Set([
1792
- "DEFERIDO",
1793
- "QUITADO",
1794
- "LIBERADO",
1795
- "ATIVO",
1796
- "VIGENTE",
1797
- "RESPONDIDO",
1798
- "ASSINADO"
1799
- ]),
1800
- danger: /* @__PURE__ */ new Set(["INDEFERIDO", "VENCIDO", "CANCELADO", "ERRO"]),
1801
- neutral: /* @__PURE__ */ new Set([
1802
- "CONCLUIDO",
1803
- "ENCERRADO",
1804
- "FINALIZADO",
1805
- "RENEGOCIADO",
1806
- "INATIVO"
1807
- ])
1777
+ var TONE_TO_COLOR = {
1778
+ info: "blue",
1779
+ warning: "yellow",
1780
+ success: "green",
1781
+ danger: "red",
1782
+ neutral: "slate"
1808
1783
  };
1809
1784
  var normalizeStatus = (status) => String(status ?? "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, " ").trim().toUpperCase();
1810
- var resolveGenericStatus = (status) => {
1811
- if (NORMALIZED_STATUS.infoOutline.has(status)) {
1812
- return { tone: "info", appearance: "outline" };
1813
- }
1814
- if (NORMALIZED_STATUS.infoSolid.has(status)) {
1815
- return { tone: "info", appearance: "solid" };
1816
- }
1817
- if (NORMALIZED_STATUS.warning.has(status)) {
1818
- return { tone: "warning", appearance: "soft" };
1819
- }
1820
- if (NORMALIZED_STATUS.success.has(status)) {
1821
- return { tone: "success", appearance: "solid" };
1822
- }
1823
- if (NORMALIZED_STATUS.danger.has(status)) {
1824
- return { tone: "danger", appearance: "solid" };
1825
- }
1826
- if (NORMALIZED_STATUS.neutral.has(status)) {
1827
- return { tone: "neutral", appearance: "solid" };
1828
- }
1829
- return { tone: "neutral", appearance: "outline" };
1830
- };
1785
+ var isLegacyConfig = (config) => "tone" in config;
1786
+ var normalizeConfig = (config) => isLegacyConfig(config) ? { color: TONE_TO_COLOR[config.tone], appearance: config.appearance } : config;
1831
1787
  var resolveStatusAppearance = (status, domain = "generic", options) => {
1788
+ void domain;
1832
1789
  const normalized = normalizeStatus(status);
1833
- if (!normalized) {
1834
- return options?.fallback ?? { tone: "neutral", appearance: "outline" };
1835
- }
1836
- const mappedAppearance = options?.map ? Object.entries(options.map).find(
1837
- ([key]) => normalizeStatus(key) === normalized
1838
- )?.[1] : void 0;
1839
- if (mappedAppearance) return mappedAppearance;
1840
- if (domain === "beneficiary") {
1841
- if (normalized === "VIGENTE") return { tone: "success", appearance: "solid" };
1842
- if (normalized === "ENCERRADO") return { tone: "neutral", appearance: "solid" };
1790
+ if (normalized && options?.map) {
1791
+ const mappedAppearance = Object.entries(options.map).find(
1792
+ ([key]) => normalizeStatus(key) === normalized
1793
+ )?.[1];
1794
+ if (mappedAppearance) return normalizeConfig(mappedAppearance);
1843
1795
  }
1844
- if (domain === "document") {
1845
- if (["ANEXADO", "ASSINADO", "CONCLUIDO"].includes(normalized)) {
1846
- return { tone: "success", appearance: "solid" };
1847
- }
1848
- if (normalized.includes("AGUARDANDO") || normalized === "PENDENTE") {
1849
- return { tone: "warning", appearance: "soft" };
1850
- }
1851
- if (normalized === "BLOQUEADO") return { tone: "neutral", appearance: "solid" };
1852
- }
1853
- if (domain === "signature") {
1854
- if (normalized === "ASSINADO") return { tone: "success", appearance: "solid" };
1855
- if (normalized.includes("AGUARDANDO")) return { tone: "warning", appearance: "soft" };
1856
- if (normalized === "NAO ASSINADO") return { tone: "info", appearance: "solid" };
1857
- }
1858
- if (domain === "benefit") {
1859
- if (normalized === "EM PAGAMENTO") return { tone: "info", appearance: "outline" };
1860
- if (normalized === "SUSPENSO") return { tone: "warning", appearance: "soft" };
1861
- }
1862
- if (domain === "participation") {
1863
- return { tone: "neutral", appearance: "solid" };
1864
- }
1865
- if (domain === "payment") {
1866
- if (["PAGO", "QUITADO", "LIBERADO"].includes(normalized)) {
1867
- return { tone: "success", appearance: "solid" };
1868
- }
1869
- if (["EM PAGAMENTO", "AGUARDANDO PAGAMENTO"].includes(normalized)) {
1870
- return { tone: "info", appearance: "outline" };
1871
- }
1872
- if (["VENCIDO", "ESTORNADO", "FALHOU"].includes(normalized)) {
1873
- return { tone: "danger", appearance: "solid" };
1874
- }
1796
+ if (options?.color) {
1797
+ return {
1798
+ color: options.color,
1799
+ appearance: options.appearance ?? "outline"
1800
+ };
1875
1801
  }
1876
- if (domain === "claim" || domain === "request" || domain === "protocol") {
1877
- if (["RECEBIDO", "PROTOCOLADO", "EMITIDO"].includes(normalized)) {
1878
- return { tone: "info", appearance: "outline" };
1879
- }
1880
- if (["EM ANALISE", "AGUARDANDO DOCUMENTACAO", "AGUARDANDO ANALISE"].includes(normalized)) {
1881
- return { tone: "warning", appearance: "soft" };
1882
- }
1883
- if (["APROVADO", "CONCEDIDO", "ATENDIDO"].includes(normalized)) {
1884
- return { tone: "success", appearance: "solid" };
1885
- }
1886
- if (["NEGADO", "ARQUIVADO", "RECUSADO"].includes(normalized)) {
1887
- return { tone: "danger", appearance: "solid" };
1888
- }
1802
+ if (options?.tone) {
1803
+ return {
1804
+ color: TONE_TO_COLOR[options.tone],
1805
+ appearance: options.appearance ?? "outline"
1806
+ };
1889
1807
  }
1890
- return options?.fallback ?? resolveGenericStatus(normalized);
1808
+ return options?.fallback ?? { color: "slate", appearance: "outline" };
1891
1809
  };
1810
+ var getStatusBadgeColorFromTone = (tone) => TONE_TO_COLOR[tone];
1892
1811
 
1893
1812
  // src/components/status-badge/StatusBadge.tsx
1894
1813
  import classNames12 from "classnames";
1895
1814
  import { jsx as jsx27 } from "react/jsx-runtime";
1896
- var TONE_STYLES2 = {
1897
- info: {
1898
- outline: "border-feedback-info-border text-feedback-info-content",
1899
- soft: "border-feedback-info-border bg-feedback-info-soft text-feedback-info-content",
1900
- solid: "border-feedback-info-strong bg-feedback-info-strong text-surface-subtle"
1815
+ var COLOR_STYLES = {
1816
+ primary: {
1817
+ outline: "border-primary-1 text-primary-1",
1818
+ soft: "border-primary-1 bg-primary-5 text-primary-2",
1819
+ solid: "border-action-primary bg-action-primary text-action-primary-content"
1820
+ },
1821
+ blue: {
1822
+ outline: "border-status-blue-outline-border text-status-blue-outline-foreground",
1823
+ soft: "border-status-blue-outline-border bg-status-blue-soft-background text-status-blue-soft-foreground",
1824
+ solid: "border-status-blue-solid-background bg-status-blue-solid-background text-status-blue-solid-foreground"
1825
+ },
1826
+ green: {
1827
+ outline: "border-status-green-outline-border text-status-green-outline-foreground",
1828
+ soft: "border-status-green-outline-border bg-status-green-soft-background text-status-green-soft-foreground",
1829
+ solid: "border-status-green-solid-background bg-status-green-solid-background text-status-green-solid-foreground"
1901
1830
  },
1902
- warning: {
1903
- outline: "border-feedback-warning-border text-feedback-warning-content",
1904
- soft: "border-feedback-warning-border bg-feedback-warning-soft text-feedback-warning-content",
1905
- solid: "border-feedback-warning-strong bg-feedback-warning-strong text-surface-subtle"
1831
+ orange: {
1832
+ outline: "border-status-orange-outline-border text-status-orange-outline-foreground",
1833
+ soft: "border-status-orange-outline-border bg-status-orange-soft-background text-status-orange-soft-foreground",
1834
+ solid: "border-status-orange-solid-background bg-status-orange-solid-background text-status-orange-solid-foreground"
1906
1835
  },
1907
- success: {
1908
- outline: "border-feedback-success-border text-feedback-success-content",
1909
- soft: "border-feedback-success-border bg-feedback-success-soft text-feedback-success-content",
1910
- solid: "border-feedback-success-strong bg-feedback-success-strong text-surface-subtle"
1836
+ yellow: {
1837
+ outline: "border-status-yellow-outline-border text-status-yellow-outline-foreground",
1838
+ soft: "border-status-yellow-outline-border bg-status-yellow-soft-background text-status-yellow-soft-foreground",
1839
+ solid: "border-status-yellow-solid-background bg-status-yellow-solid-background text-status-yellow-solid-foreground"
1911
1840
  },
1912
- danger: {
1913
- outline: "border-feedback-danger-border text-feedback-danger-content",
1914
- soft: "border-feedback-danger-border bg-feedback-danger-soft text-feedback-danger-content",
1915
- solid: "border-feedback-danger-strong bg-feedback-danger-strong text-surface-subtle"
1841
+ red: {
1842
+ outline: "border-status-red-outline-border text-status-red-outline-foreground",
1843
+ soft: "border-status-red-outline-border bg-status-red-soft-background text-status-red-soft-foreground",
1844
+ solid: "border-status-red-solid-background bg-status-red-solid-background text-status-red-solid-foreground"
1916
1845
  },
1917
- neutral: {
1918
- outline: "border-border-strong text-content-secondary",
1919
- soft: "border-border-default bg-surface-subtle text-content-secondary",
1920
- solid: "border-surface-action-neutral bg-surface-action-neutral text-surface-subtle"
1846
+ slate: {
1847
+ outline: "border-status-slate-outline-border text-status-slate-outline-foreground",
1848
+ soft: "border-status-slate-outline-border bg-status-slate-soft-background text-status-slate-soft-foreground",
1849
+ solid: "border-status-slate-solid-background bg-status-slate-solid-background text-status-slate-solid-foreground"
1850
+ },
1851
+ black: {
1852
+ outline: "border-status-black-outline-border text-status-black-outline-foreground",
1853
+ soft: "border-status-black-outline-border bg-status-black-soft-background text-status-black-soft-foreground",
1854
+ solid: "border-status-black-solid-background bg-status-black-solid-background text-status-black-solid-foreground"
1921
1855
  }
1922
1856
  };
1923
1857
  var SIZE_STYLES = {
@@ -1926,7 +1860,8 @@ var SIZE_STYLES = {
1926
1860
  };
1927
1861
  function StatusBadge({
1928
1862
  children,
1929
- tone = "neutral",
1863
+ color,
1864
+ tone,
1930
1865
  appearance = "outline",
1931
1866
  size = "md",
1932
1867
  overflow = "wrap",
@@ -1941,7 +1876,7 @@ function StatusBadge({
1941
1876
  className: classNames12(
1942
1877
  "inline-flex w-fit max-w-full items-center justify-center rounded-sm border-2 text-center font-bold uppercase tracking-wide",
1943
1878
  SIZE_STYLES[size],
1944
- TONE_STYLES2[tone][appearance],
1879
+ COLOR_STYLES[color ?? getStatusBadgeColorFromTone(tone ?? "neutral")][appearance],
1945
1880
  overflow === "truncate" ? "overflow-hidden text-ellipsis whitespace-nowrap" : "whitespace-normal break-words",
1946
1881
  className
1947
1882
  ),
@@ -1952,7 +1887,10 @@ function StatusBadge({
1952
1887
  }
1953
1888
  );
1954
1889
  }
1955
- var getStatusBadgeClassName = (tone, appearance) => TONE_STYLES2[tone][appearance];
1890
+ var getStatusBadgeClassName = (colorOrTone, appearance) => {
1891
+ const color = colorOrTone in COLOR_STYLES ? colorOrTone : getStatusBadgeColorFromTone(colorOrTone);
1892
+ return COLOR_STYLES[color][appearance];
1893
+ };
1956
1894
 
1957
1895
  // src/components/status-badge/DomainStatusBadge.tsx
1958
1896
  import { jsx as jsx28 } from "react/jsx-runtime";
@@ -1962,15 +1900,25 @@ function DomainStatusBadge({
1962
1900
  empty = "hide",
1963
1901
  placeholder = "-",
1964
1902
  statusMap,
1903
+ fallback,
1904
+ color,
1905
+ tone,
1906
+ appearance,
1965
1907
  ...rest
1966
1908
  }) {
1967
1909
  const label = status?.trim();
1968
1910
  if (!label && empty === "hide") return null;
1969
- const resolved = resolveStatusAppearance(label, domain, { map: statusMap });
1911
+ const resolved = resolveStatusAppearance(label, domain, {
1912
+ map: statusMap,
1913
+ color,
1914
+ tone,
1915
+ appearance,
1916
+ fallback
1917
+ });
1970
1918
  return /* @__PURE__ */ jsx28(
1971
1919
  StatusBadge,
1972
1920
  {
1973
- tone: resolved.tone,
1921
+ color: resolved.color,
1974
1922
  appearance: resolved.appearance,
1975
1923
  ...rest,
1976
1924
  children: label || placeholder
@@ -3339,4 +3287,4 @@ export {
3339
3287
  resolveContainerBreakpoint,
3340
3288
  useContainerBreakpoint
3341
3289
  };
3342
- //# sourceMappingURL=chunk-RMWSF4YF.js.map
3290
+ //# sourceMappingURL=chunk-5Q7V22OH.js.map