@aspprev/versi-ds 0.4.9 → 0.5.3

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.
@@ -289,11 +289,12 @@ var Divider = ({
289
289
  height = "h-[1px]",
290
290
  children,
291
291
  bgColor = "black",
292
+ className,
292
293
  ...rest
293
294
  }) => {
294
295
  const colorClass = colorClassMap[bgColor];
295
296
  const barClass = classNames(children ? "w-1/3" : "w-1/2", height, colorClass);
296
- return /* @__PURE__ */ jsxs3("div", { className: classNames(width, "flex items-center justify-center"), children: [
297
+ return /* @__PURE__ */ jsxs3("div", { ...rest, className: classNames(width, "flex items-center justify-center", className), children: [
297
298
  /* @__PURE__ */ jsx4("div", { className: barClass }),
298
299
  children && /* @__PURE__ */ jsxs3("div", { className: "px-3", children: [
299
300
  children,
@@ -621,7 +622,7 @@ var avatarSizeMap = {
621
622
  };
622
623
  function Inicials(name) {
623
624
  const nome = name;
624
- if (!!nome) {
625
+ if (nome) {
625
626
  const array = nome.split(" ");
626
627
  const primeiraLetra = nome.charAt(0);
627
628
  const posicaoUltimoEspaco = nome.lastIndexOf(" ");
@@ -645,7 +646,7 @@ var Avatar = ({
645
646
  ...rest
646
647
  }) => {
647
648
  const avatarSizeClass = avatarSizeMap[size];
648
- const avatarComponent = image ? /* @__PURE__ */ jsx11(AvatarImage_default, { src: image, altDescription: description }) : !!name ? /* @__PURE__ */ jsx11(
649
+ const avatarComponent = image ? /* @__PURE__ */ jsx11(AvatarImage_default, { src: image, altDescription: description }) : name ? /* @__PURE__ */ jsx11(
649
650
  "span",
650
651
  {
651
652
  className: classNames5(
@@ -888,10 +889,10 @@ function PageButtons(props) {
888
889
  const { currentPage, totalResults, perPage, onClick, size } = props;
889
890
  const pages = Math.max(1, Math.ceil(totalResults / perPage));
890
891
  const sizeClasses = PAGINATION_SIZE_CLASSES[size];
891
- let pagesAfter = pages - currentPage > 2 ? 2 : pages - currentPage;
892
- let pagesBefore = currentPage > 2 ? 2 : currentPage === 2 ? 1 : 0;
892
+ const pagesAfter = pages - currentPage > 2 ? 2 : pages - currentPage;
893
+ const pagesBefore = currentPage > 2 ? 2 : currentPage === 2 ? 1 : 0;
893
894
  let buttonsBefore = [];
894
- let buttonsAfter = [];
895
+ const buttonsAfter = [];
895
896
  for (let i = 1; i <= pagesBefore; i++) {
896
897
  const page = currentPage - i;
897
898
  buttonsBefore = [
@@ -1070,7 +1071,7 @@ function Checkbox({
1070
1071
  layout = "row",
1071
1072
  ...props
1072
1073
  }) {
1073
- let containerClass = "";
1074
+ let containerClass;
1074
1075
  if (layout === "col") {
1075
1076
  containerClass = "flex flex-col gap-y-3 mt-3";
1076
1077
  } else if (layout === "grid-2") {
@@ -1402,15 +1403,12 @@ var InputSlider = ({
1402
1403
  prefix,
1403
1404
  suffix,
1404
1405
  sufix,
1405
- marks,
1406
- valueLabelDisplay = "auto",
1407
1406
  showLabel = false,
1408
1407
  disabled = false,
1409
1408
  inputDisabled = false,
1410
1409
  valueFormmated,
1411
1410
  showInput = false,
1412
- ariaLabel,
1413
- ...rest
1411
+ ariaLabel
1414
1412
  }) => {
1415
1413
  const [value, setValue] = useState2(initialValue);
1416
1414
  const resolvedSuffix = suffix ?? sufix;
@@ -1421,7 +1419,7 @@ var InputSlider = ({
1421
1419
  const parsedValue = Number(newValue);
1422
1420
  setValue(parsedValue);
1423
1421
  },
1424
- [functionChange]
1422
+ []
1425
1423
  );
1426
1424
  const handleInputChange = useCallback2(
1427
1425
  (event) => {
@@ -1696,18 +1694,18 @@ function resolveOptionalValue(value, options = {}) {
1696
1694
  // src/components/info-grid/InfoGrid.tsx
1697
1695
  import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
1698
1696
  var COLUMN_STYLES2 = {
1699
- 1: "grid-cols-1",
1700
- 2: "grid-cols-1 mobile:grid-cols-2",
1701
- 3: "grid-cols-1 mobile:grid-cols-2 tablet:grid-cols-3",
1702
- 4: "grid-cols-1 mobile:grid-cols-2 desktop:grid-cols-4",
1703
- 6: "grid-cols-1 mobile:grid-cols-2 tablet:grid-cols-3 desktop:grid-cols-6"
1697
+ 1: "versi-info-grid--1",
1698
+ 2: "versi-info-grid--2",
1699
+ 3: "versi-info-grid--3",
1700
+ 4: "versi-info-grid--4",
1701
+ 6: "versi-info-grid--6"
1704
1702
  };
1705
1703
  function InfoGrid({ columns = 3, className, ...rest }) {
1706
1704
  return /* @__PURE__ */ jsx25(
1707
1705
  "dl",
1708
1706
  {
1709
1707
  className: classNames10(
1710
- "grid gap-x-8 gap-y-5",
1708
+ "versi-info-grid grid gap-x-8 gap-y-5",
1711
1709
  COLUMN_STYLES2[columns],
1712
1710
  className
1713
1711
  ),
@@ -1774,150 +1772,84 @@ function FilterBar({
1774
1772
  }
1775
1773
 
1776
1774
  // 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
- ])
1775
+ var TONE_TO_COLOR = {
1776
+ info: "blue",
1777
+ warning: "yellow",
1778
+ success: "green",
1779
+ danger: "red",
1780
+ neutral: "slate"
1808
1781
  };
1809
1782
  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
- };
1783
+ var isLegacyConfig = (config) => "tone" in config;
1784
+ var normalizeConfig = (config) => isLegacyConfig(config) ? { color: TONE_TO_COLOR[config.tone], appearance: config.appearance } : config;
1831
1785
  var resolveStatusAppearance = (status, domain = "generic", options) => {
1786
+ void domain;
1832
1787
  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" };
1843
- }
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" };
1788
+ if (normalized && options?.map) {
1789
+ const mappedAppearance = Object.entries(options.map).find(
1790
+ ([key]) => normalizeStatus(key) === normalized
1791
+ )?.[1];
1792
+ if (mappedAppearance) return normalizeConfig(mappedAppearance);
1861
1793
  }
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
- }
1794
+ if (options?.color) {
1795
+ return {
1796
+ color: options.color,
1797
+ appearance: options.appearance ?? "outline"
1798
+ };
1875
1799
  }
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
- }
1800
+ if (options?.tone) {
1801
+ return {
1802
+ color: TONE_TO_COLOR[options.tone],
1803
+ appearance: options.appearance ?? "outline"
1804
+ };
1889
1805
  }
1890
- return options?.fallback ?? resolveGenericStatus(normalized);
1806
+ return options?.fallback ?? { color: "slate", appearance: "outline" };
1891
1807
  };
1808
+ var getStatusBadgeColorFromTone = (tone) => TONE_TO_COLOR[tone];
1892
1809
 
1893
1810
  // src/components/status-badge/StatusBadge.tsx
1894
1811
  import classNames12 from "classnames";
1895
1812
  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"
1813
+ var COLOR_STYLES = {
1814
+ primary: {
1815
+ outline: "border-primary-1 text-primary-1",
1816
+ soft: "border-primary-1 bg-primary-5 text-primary-2",
1817
+ solid: "border-action-primary bg-action-primary text-action-primary-content"
1818
+ },
1819
+ blue: {
1820
+ outline: "border-status-blue-outline-border text-status-blue-outline-foreground",
1821
+ soft: "border-status-blue-outline-border bg-status-blue-soft-background text-status-blue-soft-foreground",
1822
+ solid: "border-status-blue-solid-background bg-status-blue-solid-background text-status-blue-solid-foreground"
1823
+ },
1824
+ green: {
1825
+ outline: "border-status-green-outline-border text-status-green-outline-foreground",
1826
+ soft: "border-status-green-outline-border bg-status-green-soft-background text-status-green-soft-foreground",
1827
+ solid: "border-status-green-solid-background bg-status-green-solid-background text-status-green-solid-foreground"
1901
1828
  },
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"
1829
+ orange: {
1830
+ outline: "border-status-orange-outline-border text-status-orange-outline-foreground",
1831
+ soft: "border-status-orange-outline-border bg-status-orange-soft-background text-status-orange-soft-foreground",
1832
+ solid: "border-status-orange-solid-background bg-status-orange-solid-background text-status-orange-solid-foreground"
1906
1833
  },
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"
1834
+ yellow: {
1835
+ outline: "border-status-yellow-outline-border text-status-yellow-outline-foreground",
1836
+ soft: "border-status-yellow-outline-border bg-status-yellow-soft-background text-status-yellow-soft-foreground",
1837
+ solid: "border-status-yellow-solid-background bg-status-yellow-solid-background text-status-yellow-solid-foreground"
1911
1838
  },
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"
1839
+ red: {
1840
+ outline: "border-status-red-outline-border text-status-red-outline-foreground",
1841
+ soft: "border-status-red-outline-border bg-status-red-soft-background text-status-red-soft-foreground",
1842
+ solid: "border-status-red-solid-background bg-status-red-solid-background text-status-red-solid-foreground"
1916
1843
  },
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"
1844
+ slate: {
1845
+ outline: "border-status-slate-outline-border text-status-slate-outline-foreground",
1846
+ soft: "border-status-slate-outline-border bg-status-slate-soft-background text-status-slate-soft-foreground",
1847
+ solid: "border-status-slate-solid-background bg-status-slate-solid-background text-status-slate-solid-foreground"
1848
+ },
1849
+ black: {
1850
+ outline: "border-status-black-outline-border text-status-black-outline-foreground",
1851
+ soft: "border-status-black-outline-border bg-status-black-soft-background text-status-black-soft-foreground",
1852
+ solid: "border-status-black-solid-background bg-status-black-solid-background text-status-black-solid-foreground"
1921
1853
  }
1922
1854
  };
1923
1855
  var SIZE_STYLES = {
@@ -1926,7 +1858,8 @@ var SIZE_STYLES = {
1926
1858
  };
1927
1859
  function StatusBadge({
1928
1860
  children,
1929
- tone = "neutral",
1861
+ color,
1862
+ tone,
1930
1863
  appearance = "outline",
1931
1864
  size = "md",
1932
1865
  overflow = "wrap",
@@ -1941,7 +1874,7 @@ function StatusBadge({
1941
1874
  className: classNames12(
1942
1875
  "inline-flex w-fit max-w-full items-center justify-center rounded-sm border-2 text-center font-bold uppercase tracking-wide",
1943
1876
  SIZE_STYLES[size],
1944
- TONE_STYLES2[tone][appearance],
1877
+ COLOR_STYLES[color ?? getStatusBadgeColorFromTone(tone ?? "neutral")][appearance],
1945
1878
  overflow === "truncate" ? "overflow-hidden text-ellipsis whitespace-nowrap" : "whitespace-normal break-words",
1946
1879
  className
1947
1880
  ),
@@ -1952,7 +1885,10 @@ function StatusBadge({
1952
1885
  }
1953
1886
  );
1954
1887
  }
1955
- var getStatusBadgeClassName = (tone, appearance) => TONE_STYLES2[tone][appearance];
1888
+ var getStatusBadgeClassName = (colorOrTone, appearance) => {
1889
+ const color = colorOrTone in COLOR_STYLES ? colorOrTone : getStatusBadgeColorFromTone(colorOrTone);
1890
+ return COLOR_STYLES[color][appearance];
1891
+ };
1956
1892
 
1957
1893
  // src/components/status-badge/DomainStatusBadge.tsx
1958
1894
  import { jsx as jsx28 } from "react/jsx-runtime";
@@ -1962,15 +1898,25 @@ function DomainStatusBadge({
1962
1898
  empty = "hide",
1963
1899
  placeholder = "-",
1964
1900
  statusMap,
1901
+ fallback,
1902
+ color,
1903
+ tone,
1904
+ appearance,
1965
1905
  ...rest
1966
1906
  }) {
1967
1907
  const label = status?.trim();
1968
1908
  if (!label && empty === "hide") return null;
1969
- const resolved = resolveStatusAppearance(label, domain, { map: statusMap });
1909
+ const resolved = resolveStatusAppearance(label, domain, {
1910
+ map: statusMap,
1911
+ color,
1912
+ tone,
1913
+ appearance,
1914
+ fallback
1915
+ });
1970
1916
  return /* @__PURE__ */ jsx28(
1971
1917
  StatusBadge,
1972
1918
  {
1973
- tone: resolved.tone,
1919
+ color: resolved.color,
1974
1920
  appearance: resolved.appearance,
1975
1921
  ...rest,
1976
1922
  children: label || placeholder
@@ -2074,7 +2020,6 @@ function FormErrorNavigation() {
2074
2020
  cleanupPendingNavigation?.();
2075
2021
  const form = event.target;
2076
2022
  let handled = false;
2077
- let observer;
2078
2023
  const timers = [];
2079
2024
  const cleanup = () => {
2080
2025
  observer?.disconnect();
@@ -2088,7 +2033,7 @@ function FormErrorNavigation() {
2088
2033
  cleanup();
2089
2034
  navigateToInvalidField(field);
2090
2035
  };
2091
- observer = new MutationObserver(tryNavigate);
2036
+ const observer = new MutationObserver(tryNavigate);
2092
2037
  observer.observe(form, {
2093
2038
  attributeFilter: ["aria-invalid"],
2094
2039
  attributes: true,
@@ -3266,15 +3211,13 @@ function resolveContainerBreakpoint(width, breakpoints = defaultContainerBreakpo
3266
3211
  );
3267
3212
  }
3268
3213
  function getBreakpointMapKey(breakpoints) {
3269
- return Object.entries(breakpoints).sort(([first], [second]) => first.localeCompare(second)).map(([name, threshold]) => `${name}:${threshold}`).join("|");
3214
+ return JSON.stringify(Object.entries(breakpoints).sort(([, first], [, second]) => first - second));
3270
3215
  }
3271
3216
  function useContainerBreakpoint(ref, options = {}) {
3272
3217
  const thresholds = options.breakpoints ?? defaultContainerBreakpoints;
3273
3218
  const thresholdsKey = getBreakpointMapKey(thresholds);
3274
3219
  const sortedThresholds = useMemo4(
3275
- () => Object.entries(thresholds).sort(
3276
- ([, first], [, second]) => first === second ? 0 : first - second
3277
- ),
3220
+ () => JSON.parse(thresholdsKey),
3278
3221
  [thresholdsKey]
3279
3222
  );
3280
3223
  const [current, setCurrent] = useState6();
@@ -3339,4 +3282,4 @@ export {
3339
3282
  resolveContainerBreakpoint,
3340
3283
  useContainerBreakpoint
3341
3284
  };
3342
- //# sourceMappingURL=chunk-RMWSF4YF.js.map
3285
+ //# sourceMappingURL=chunk-7GTKG537.js.map