@aspprev/versi-ds 0.1.0 → 0.2.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.
Files changed (41) hide show
  1. package/README.md +116 -396
  2. package/dist/charts.js +1 -1
  3. package/dist/{chunk-OWXG2A4N.js → chunk-ATWH3MA6.js} +1 -1
  4. package/dist/chunk-ATWH3MA6.js.map +1 -0
  5. package/dist/{chunk-CWIPMGCA.js → chunk-ET2BGHTO.js} +2 -1
  6. package/dist/chunk-ET2BGHTO.js.map +1 -0
  7. package/dist/{chunk-BY4HJZFJ.js → chunk-FR5W52XU.js} +283 -23
  8. package/dist/chunk-FR5W52XU.js.map +1 -0
  9. package/dist/chunk-H4BBKKRZ.js +380 -0
  10. package/dist/chunk-H4BBKKRZ.js.map +1 -0
  11. package/dist/{chunk-2ACDV5D5.js → chunk-JSPXVXUY.js} +1 -1
  12. package/dist/chunk-JSPXVXUY.js.map +1 -0
  13. package/dist/{chunk-OPUUOVCL.js → chunk-PIXRKI25.js} +84 -10
  14. package/dist/chunk-PIXRKI25.js.map +1 -0
  15. package/dist/{chunk-6MXHE5MD.js → chunk-V66QL3TD.js} +1 -1
  16. package/dist/chunk-V66QL3TD.js.map +1 -0
  17. package/dist/chunk-YCW3REQK.js +3102 -0
  18. package/dist/chunk-YCW3REQK.js.map +1 -0
  19. package/dist/core.d.ts +23 -4
  20. package/dist/core.js +12 -6
  21. package/dist/countries.js +1 -1
  22. package/dist/documents.d.ts +81 -1
  23. package/dist/documents.js +14 -4
  24. package/dist/forms.d.ts +26 -2
  25. package/dist/forms.js +5 -3
  26. package/dist/index.d.ts +3 -3
  27. package/dist/index.js +30 -12
  28. package/dist/manifest.json +9 -9
  29. package/dist/overlays.js +1 -1
  30. package/dist/styles.css +1 -1
  31. package/package.json +27 -19
  32. package/dist/chunk-2ACDV5D5.js.map +0 -1
  33. package/dist/chunk-6MXHE5MD.js.map +0 -1
  34. package/dist/chunk-A3PA5H7L.js +0 -3099
  35. package/dist/chunk-A3PA5H7L.js.map +0 -1
  36. package/dist/chunk-BY4HJZFJ.js.map +0 -1
  37. package/dist/chunk-CWIPMGCA.js.map +0 -1
  38. package/dist/chunk-OPUUOVCL.js.map +0 -1
  39. package/dist/chunk-OWXG2A4N.js.map +0 -1
  40. package/dist/chunk-XGWGBD7X.js +0 -45
  41. package/dist/chunk-XGWGBD7X.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useBreakpoint
3
- } from "./chunk-CWIPMGCA.js";
3
+ } from "./chunk-ET2BGHTO.js";
4
4
  import {
5
5
  __objRest,
6
6
  __spreadProps,
@@ -1592,6 +1592,11 @@ function BackContent({ label }) {
1592
1592
  /* @__PURE__ */ jsx23("span", { children: label })
1593
1593
  ] });
1594
1594
  }
1595
+ function getBackHref(href) {
1596
+ if (!href) return void 0;
1597
+ const protocol = href.replace(/^[\u0000-\u0020]+/, "").replace(/[\t\r\n]/g, "");
1598
+ return /^javascript:/i.test(protocol) ? void 0 : href;
1599
+ }
1595
1600
  function PageHeading({
1596
1601
  title,
1597
1602
  subtitle,
@@ -1601,6 +1606,7 @@ function PageHeading({
1601
1606
  contentClassName,
1602
1607
  spacing = "default"
1603
1608
  }) {
1609
+ const backHref = getBackHref(back == null ? void 0 : back.href);
1604
1610
  const backClassName = "mb-2 inline-flex w-fit items-center gap-1 text-sm font-semibold text-content-link hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring";
1605
1611
  return /* @__PURE__ */ jsxs13(
1606
1612
  "header",
@@ -1612,7 +1618,7 @@ function PageHeading({
1612
1618
  ),
1613
1619
  children: [
1614
1620
  /* @__PURE__ */ jsxs13("div", { className: classNames9("min-w-0", contentClassName), children: [
1615
- (back == null ? void 0 : back.href) ? /* @__PURE__ */ jsx23("a", { className: backClassName, href: back.href, children: /* @__PURE__ */ jsx23(BackContent, { label: back.label }) }) : back ? /* @__PURE__ */ jsx23(
1621
+ back && backHref ? /* @__PURE__ */ jsx23("a", { className: backClassName, href: backHref, children: /* @__PURE__ */ jsx23(BackContent, { label: back.label }) }) : back ? /* @__PURE__ */ jsx23(
1616
1622
  "button",
1617
1623
  {
1618
1624
  type: "button",
@@ -1842,6 +1848,7 @@ function StatusBadge(_a) {
1842
1848
  appearance = "outline",
1843
1849
  size = "md",
1844
1850
  overflow = "wrap",
1851
+ statusLabel,
1845
1852
  className,
1846
1853
  title
1847
1854
  } = _b, rest = __objRest(_b, [
@@ -1850,6 +1857,7 @@ function StatusBadge(_a) {
1850
1857
  "appearance",
1851
1858
  "size",
1852
1859
  "overflow",
1860
+ "statusLabel",
1853
1861
  "className",
1854
1862
  "title"
1855
1863
  ]);
@@ -1863,7 +1871,8 @@ function StatusBadge(_a) {
1863
1871
  overflow === "truncate" ? "overflow-hidden text-ellipsis whitespace-nowrap" : "whitespace-normal break-words",
1864
1872
  className
1865
1873
  ),
1866
- title: title != null ? title : typeof children === "string" ? children : void 0
1874
+ title: title != null ? title : typeof children === "string" ? children : void 0,
1875
+ "aria-label": statusLabel
1867
1876
  }, rest), {
1868
1877
  children
1869
1878
  })
@@ -1954,6 +1963,31 @@ var resolveStatusAppearance = (status, domain = "generic") => {
1954
1963
  if (domain === "participation") {
1955
1964
  return { tone: "neutral", appearance: "solid" };
1956
1965
  }
1966
+ if (domain === "payment") {
1967
+ if (["PAGO", "QUITADO", "LIBERADO"].includes(normalized)) {
1968
+ return { tone: "success", appearance: "solid" };
1969
+ }
1970
+ if (["EM PAGAMENTO", "AGUARDANDO PAGAMENTO"].includes(normalized)) {
1971
+ return { tone: "info", appearance: "outline" };
1972
+ }
1973
+ if (["VENCIDO", "ESTORNADO", "FALHOU"].includes(normalized)) {
1974
+ return { tone: "danger", appearance: "solid" };
1975
+ }
1976
+ }
1977
+ if (domain === "claim" || domain === "request" || domain === "protocol") {
1978
+ if (["RECEBIDO", "PROTOCOLADO", "EMITIDO"].includes(normalized)) {
1979
+ return { tone: "info", appearance: "outline" };
1980
+ }
1981
+ if (["EM ANALISE", "AGUARDANDO DOCUMENTACAO", "AGUARDANDO ANALISE"].includes(normalized)) {
1982
+ return { tone: "warning", appearance: "soft" };
1983
+ }
1984
+ if (["APROVADO", "CONCEDIDO", "ATENDIDO"].includes(normalized)) {
1985
+ return { tone: "success", appearance: "solid" };
1986
+ }
1987
+ if (["NEGADO", "ARQUIVADO", "RECUSADO"].includes(normalized)) {
1988
+ return { tone: "danger", appearance: "solid" };
1989
+ }
1990
+ }
1957
1991
  return resolveGenericStatus(normalized);
1958
1992
  };
1959
1993
 
@@ -2482,7 +2516,8 @@ function TableView({
2482
2516
  }
2483
2517
  return `${widthUnits / resolvedTotalWidthUnits * 100}%`;
2484
2518
  };
2485
- const paginationVariant = isMobile ? "arrows" : (_a = pagination == null ? void 0 : pagination.variant) != null ? _a : "default";
2519
+ const isNarrowContainer = tableWidth !== void 0 && tableWidth < 640;
2520
+ const paginationVariant = isMobile || isNarrowContainer ? "arrows" : (_a = pagination == null ? void 0 : pagination.variant) != null ? _a : "default";
2486
2521
  const isAdaptiveCompact = overflowMode === "adaptive" && tableWidth !== void 0 && tableWidth < adaptiveBreakpoint;
2487
2522
  const overflowClass = overflowMode === "scroll" ? "overflow-x-auto" : "overflow-x-hidden";
2488
2523
  const resolvedScrollAreaMaxHeight = stickyHeader ? scrollAreaMaxHeight != null ? scrollAreaMaxHeight : "calc(100dvh - 240px)" : scrollAreaMaxHeight;
@@ -2531,7 +2566,7 @@ function TableView({
2531
2566
  type: "button",
2532
2567
  "aria-expanded": openFilter === index,
2533
2568
  "aria-label": `Filtrar ou ordenar por ${item.title}`,
2534
- className: `flex w-full items-center gap-1.5 rounded-sm text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ${headerFocusClass} ${((_b2 = item.className) == null ? void 0 : _b2.includes("text-right")) ? "justify-end" : ""}`,
2569
+ className: `flex min-h-11 w-full items-center gap-1.5 rounded-sm text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ${headerFocusClass} ${((_b2 = item.className) == null ? void 0 : _b2.includes("text-right")) ? "justify-end" : ""}`,
2535
2570
  onClick: () => handleHeaderAction(item, index),
2536
2571
  children: [
2537
2572
  /* @__PURE__ */ jsx33("span", { className: "min-w-0 truncate", children: item.title }),
@@ -2594,7 +2629,7 @@ function TableView({
2594
2629
  onClick: pagination.onPrevious,
2595
2630
  disabled: pagination.currentPage === 1,
2596
2631
  "aria-label": "Ir para a p\xE1gina anterior",
2597
- className: `inline-flex h-6 items-center justify-center gap-1 rounded border border-border-default px-2 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:border-border-default disabled:opacity-50 tablet:h-7 ${paginationVariant === "arrows" ? "min-w-6 tablet:min-w-7" : ""}`,
2632
+ className: `inline-flex min-h-11 min-w-11 items-center justify-center gap-1 rounded border border-border-default px-2 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:border-border-default disabled:opacity-50 ${paginationVariant === "arrows" ? "min-w-6 tablet:min-w-7" : ""}`,
2598
2633
  children: [
2599
2634
  /* @__PURE__ */ jsx33(MdKeyboardArrowLeft, { className: "h-3 w-3 text-content-muted" }),
2600
2635
  paginationVariant !== "arrows" && "Anterior"
@@ -2617,7 +2652,7 @@ function TableView({
2617
2652
  onClick: pagination.onNext,
2618
2653
  disabled: pagination.currentPage === pagination.totalPages,
2619
2654
  "aria-label": "Ir para a pr\xF3xima p\xE1gina",
2620
- className: `inline-flex h-6 items-center justify-center gap-1 rounded border border-border-default px-2 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:border-border-default disabled:opacity-50 tablet:h-7 ${paginationVariant === "arrows" ? "min-w-6 tablet:min-w-7" : ""}`,
2655
+ className: `inline-flex min-h-11 min-w-11 items-center justify-center gap-1 rounded border border-border-default px-2 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:border-border-default disabled:opacity-50 ${paginationVariant === "arrows" ? "min-w-6 tablet:min-w-7" : ""}`,
2621
2656
  children: [
2622
2657
  paginationVariant !== "arrows" && "Pr\xF3xima",
2623
2658
  /* @__PURE__ */ jsx33(MdKeyboardArrowRight, { className: "h-3 w-3 text-content-muted" })
@@ -2648,6 +2683,7 @@ function Table(props) {
2648
2683
  data,
2649
2684
  itemsPerPage = 10,
2650
2685
  emptyMessage = "Nenhum item encontrado",
2686
+ errorMessage,
2651
2687
  totalWidthUnits,
2652
2688
  showRowDivider = false,
2653
2689
  enableRowHover = false,
@@ -2893,7 +2929,7 @@ function Table(props) {
2893
2929
  {
2894
2930
  colSpan: normalizedHeader.length,
2895
2931
  className: emptyCellClassName,
2896
- children: emptyMessage
2932
+ children: errorMessage ? /* @__PURE__ */ jsx34("span", { role: "alert", children: errorMessage }) : /* @__PURE__ */ jsx34("span", { role: "status", children: emptyMessage })
2897
2933
  }
2898
2934
  ) })
2899
2935
  ] });
@@ -2901,6 +2937,7 @@ function Table(props) {
2901
2937
  children,
2902
2938
  data,
2903
2939
  emptyMessage,
2940
+ errorMessage,
2904
2941
  emptyCellClassName,
2905
2942
  enableRowHover,
2906
2943
  expandable,
@@ -3113,6 +3150,7 @@ function MobileCardTable({
3113
3150
  })()) }) : /* @__PURE__ */ jsx35(
3114
3151
  "div",
3115
3152
  {
3153
+ role: "status",
3116
3154
  className: `px-3 py-4 text-center text-md text-content-secondary ${emptyClassName}`.trim(),
3117
3155
  children: emptyMessage
3118
3156
  }
@@ -3186,6 +3224,41 @@ function MobileCardTable({
3186
3224
  }
3187
3225
  var MobileCardTable_default = MobileCardTable;
3188
3226
 
3227
+ // src/hooks/useContainerBreakpoint.ts
3228
+ import { useEffect as useEffect10, useState as useState6 } from "react";
3229
+ var defaultContainerBreakpoints = {
3230
+ mobile: 0,
3231
+ tablet: 640,
3232
+ desktop: 1024,
3233
+ wide: 1440
3234
+ };
3235
+ function useContainerBreakpoint(ref, options = {}) {
3236
+ var _a;
3237
+ const thresholds = (_a = options.breakpoints) != null ? _a : defaultContainerBreakpoints;
3238
+ const [current, setCurrent] = useState6();
3239
+ useEffect10(() => {
3240
+ const element = ref.current;
3241
+ if (!element) return;
3242
+ const resolve = (width) => {
3243
+ const entries = Object.entries(thresholds).sort(([, a], [, b]) => a - b);
3244
+ return entries.reduce(
3245
+ (result, [name, threshold]) => width >= threshold ? name : result,
3246
+ void 0
3247
+ );
3248
+ };
3249
+ const update = () => setCurrent(resolve(element.getBoundingClientRect().width));
3250
+ if (typeof ResizeObserver === "undefined") {
3251
+ update();
3252
+ return void 0;
3253
+ }
3254
+ const observer = new ResizeObserver(update);
3255
+ observer.observe(element);
3256
+ update();
3257
+ return () => observer.disconnect();
3258
+ }, [ref, thresholds]);
3259
+ return current;
3260
+ }
3261
+
3189
3262
  export {
3190
3263
  LoadingDotsView_default,
3191
3264
  Button_default,
@@ -3221,6 +3294,7 @@ export {
3221
3294
  findFirstInvalidField,
3222
3295
  FormErrorNavigation,
3223
3296
  Table_default,
3224
- MobileCardTable_default
3297
+ MobileCardTable_default,
3298
+ useContainerBreakpoint
3225
3299
  };
3226
- //# sourceMappingURL=chunk-OPUUOVCL.js.map
3300
+ //# sourceMappingURL=chunk-PIXRKI25.js.map