@aspprev/versi-ds 0.4.6 → 0.4.8

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.
@@ -862,10 +862,34 @@ import cs2 from "classnames";
862
862
 
863
863
  // src/components/pagination/components/PageButtons.tsx
864
864
  import cs from "classnames";
865
+
866
+ // src/components/pagination/pagination-styles.ts
867
+ var PAGINATION_SIZE_CLASSES = {
868
+ normal: {
869
+ itemHeight: "box-border h-7 min-h-7",
870
+ pageWidth: "w-8",
871
+ controlWidth: "w-24",
872
+ controlPadding: "px-2",
873
+ text: "text-sm",
874
+ gap: "gap-1.5"
875
+ },
876
+ small: {
877
+ itemHeight: "box-border h-6 min-h-6",
878
+ pageWidth: "w-6",
879
+ controlWidth: "w-20",
880
+ controlPadding: "px-1.5",
881
+ text: "text-xs",
882
+ gap: "gap-1"
883
+ }
884
+ };
885
+ var PAGINATION_ITEM_HEIGHT_CLASS = PAGINATION_SIZE_CLASSES.normal.itemHeight;
886
+
887
+ // src/components/pagination/components/PageButtons.tsx
865
888
  import { jsx as jsx16 } from "react/jsx-runtime";
866
889
  function PageButtons(props) {
867
- const { currentPage, totalResults, perPage, onClick } = props;
868
- const pages = totalResults > 10 ? Math.ceil(totalResults / perPage) : 1;
890
+ const { currentPage, totalResults, perPage, onClick, size } = props;
891
+ const pages = Math.max(1, Math.ceil(totalResults / perPage));
892
+ const sizeClasses = PAGINATION_SIZE_CLASSES[size];
869
893
  let pagesAfter = pages - currentPage > 2 ? 2 : pages - currentPage;
870
894
  let pagesBefore = currentPage > 2 ? 2 : currentPage === 2 ? 1 : 0;
871
895
  let buttonsBefore = [];
@@ -879,8 +903,13 @@ function PageButtons(props) {
879
903
  type: "button",
880
904
  "aria-label": `P\xE1gina ${page}`,
881
905
  className: cs(
882
- "flex h-7 w-8 items-center justify-center rounded border border-border-default",
883
- "cursor-pointer bg-surface-card text-sm text-content-primary hover:bg-surface-muted",
906
+ sizeClasses.itemHeight,
907
+ "flex",
908
+ sizeClasses.pageWidth,
909
+ "items-center justify-center rounded border border-border-default",
910
+ "cursor-pointer bg-surface-card",
911
+ sizeClasses.text,
912
+ "text-content-primary hover:bg-surface-muted",
884
913
  "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
885
914
  ),
886
915
  onClick: () => onClick(page),
@@ -900,8 +929,13 @@ function PageButtons(props) {
900
929
  type: "button",
901
930
  "aria-label": `P\xE1gina ${page}`,
902
931
  className: cs(
903
- "flex h-7 w-8 items-center justify-center rounded border border-border-default",
904
- "cursor-pointer bg-surface-card text-sm text-content-primary hover:bg-surface-muted",
932
+ sizeClasses.itemHeight,
933
+ "flex",
934
+ sizeClasses.pageWidth,
935
+ "items-center justify-center rounded border border-border-default",
936
+ "cursor-pointer bg-surface-card",
937
+ sizeClasses.text,
938
+ "text-content-primary hover:bg-surface-muted",
905
939
  "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
906
940
  ),
907
941
  onClick: () => onClick(page),
@@ -921,8 +955,13 @@ function PageButtons(props) {
921
955
  "aria-current": "page",
922
956
  disabled: true,
923
957
  className: cs(
924
- "flex h-7 w-8 items-center justify-center rounded border border-selection-border",
925
- "cursor-default bg-selection-background text-sm text-selection-content"
958
+ sizeClasses.itemHeight,
959
+ "flex",
960
+ sizeClasses.pageWidth,
961
+ "items-center justify-center rounded border border-selection-border",
962
+ "cursor-default bg-selection-background",
963
+ sizeClasses.text,
964
+ "text-selection-content"
926
965
  ),
927
966
  children: currentPage
928
967
  },
@@ -936,7 +975,17 @@ var PageButtons_default = PageButtons;
936
975
  // src/components/pagination/PaginationView.tsx
937
976
  import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
938
977
  function PaginationView(props) {
939
- const { currentPage, totalResults, perPage, onClick } = props;
978
+ const {
979
+ currentPage,
980
+ totalResults,
981
+ perPage,
982
+ onClick,
983
+ size = "normal",
984
+ variant = "default"
985
+ } = props;
986
+ const totalPages = Math.max(1, Math.ceil(totalResults / perPage));
987
+ const sizeClasses = PAGINATION_SIZE_CLASSES[size];
988
+ const controlWidth = variant === "arrows" ? sizeClasses.pageWidth : sizeClasses.controlWidth;
940
989
  return /* @__PURE__ */ jsxs9(
941
990
  "nav",
942
991
  {
@@ -954,20 +1003,25 @@ function PaginationView(props) {
954
1003
  totalResults,
955
1004
  " resultados"
956
1005
  ] }),
957
- /* @__PURE__ */ jsxs9("div", { className: "flex items-stretch gap-1.5", children: [
1006
+ /* @__PURE__ */ jsxs9("div", { className: cs2("flex items-stretch", sizeClasses.gap), children: [
958
1007
  currentPage > 1 && /* @__PURE__ */ jsxs9(
959
1008
  "button",
960
1009
  {
961
1010
  type: "button",
1011
+ "aria-label": "Ir para a p\xE1gina anterior",
962
1012
  className: cs2(
963
- "h-7 w-24 rounded-sm border border-border-default",
964
- "flex items-center justify-center gap-1 text-content-primary text-sm",
1013
+ sizeClasses.itemHeight,
1014
+ controlWidth,
1015
+ sizeClasses.controlPadding,
1016
+ "rounded-sm border border-border-default",
1017
+ "flex items-center justify-center gap-1 text-content-primary",
1018
+ sizeClasses.text,
965
1019
  "cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
966
1020
  ),
967
1021
  onClick: () => onClick(currentPage - 1),
968
1022
  children: [
969
- /* @__PURE__ */ jsx17(MdChevronLeft, { size: 10, "aria-hidden": "true", focusable: "false" }),
970
- "Anterior"
1023
+ /* @__PURE__ */ jsx17(MdChevronLeft, { size: size === "small" ? 9 : 10, "aria-hidden": "true", focusable: "false" }),
1024
+ variant === "default" && "Anterior"
971
1025
  ]
972
1026
  }
973
1027
  ),
@@ -977,22 +1031,28 @@ function PaginationView(props) {
977
1031
  currentPage,
978
1032
  totalResults,
979
1033
  perPage,
980
- onClick
1034
+ onClick,
1035
+ size
981
1036
  }
982
1037
  ),
983
- currentPage < Math.ceil(totalResults / 10) && /* @__PURE__ */ jsxs9(
1038
+ currentPage < totalPages && /* @__PURE__ */ jsxs9(
984
1039
  "button",
985
1040
  {
986
1041
  type: "button",
1042
+ "aria-label": "Ir para a pr\xF3xima p\xE1gina",
987
1043
  className: cs2(
988
- "h-7 w-24 rounded-sm border border-border-default",
989
- "flex items-center justify-center gap-1 text-content-primary text-sm",
1044
+ sizeClasses.itemHeight,
1045
+ controlWidth,
1046
+ sizeClasses.controlPadding,
1047
+ "rounded-sm border border-border-default",
1048
+ "flex items-center justify-center gap-1 text-content-primary",
1049
+ sizeClasses.text,
990
1050
  "cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
991
1051
  ),
992
1052
  onClick: () => onClick(currentPage + 1),
993
1053
  children: [
994
- "Pr\xF3xima",
995
- /* @__PURE__ */ jsx17(MdChevronRight, { size: 10, "aria-hidden": "true", focusable: "false" })
1054
+ variant === "default" && "Pr\xF3xima",
1055
+ /* @__PURE__ */ jsx17(MdChevronRight, { size: size === "small" ? 9 : 10, "aria-hidden": "true", focusable: "false" })
996
1056
  ]
997
1057
  }
998
1058
  )
@@ -1589,7 +1649,7 @@ function PageTabsHeader({
1589
1649
  "nav",
1590
1650
  {
1591
1651
  "aria-label": title,
1592
- className: "flex w-full min-w-0 max-w-full flex-row flex-nowrap items-end gap-3 overflow-x-auto tablet:w-fit tablet:shrink-0 tablet:justify-end tablet:overflow-visible",
1652
+ className: "flex w-auto flex-row flex-nowrap items-end gap-3 overflow-x-auto tablet:w-fit tablet:shrink-0 tablet:justify-end tablet:overflow-visible",
1593
1653
  children: /* @__PURE__ */ jsx24("div", { role: "tablist", className: "flex flex-nowrap items-end gap-3", children: tabs.map((tab) => {
1594
1654
  const Icon = tab.icon;
1595
1655
  const isActive = activeTab === tab.id;
@@ -2461,6 +2521,7 @@ function TableView({
2461
2521
  };
2462
2522
  const isNarrowContainer = tableWidth !== void 0 && tableWidth < 640;
2463
2523
  const paginationVariant = isNarrowContainer ? "arrows" : pagination?.variant ?? "default";
2524
+ const paginationSizeClasses = PAGINATION_SIZE_CLASSES[pagination?.size ?? "normal"];
2464
2525
  const isAdaptiveCompact = overflowMode === "adaptive" && tableWidth !== void 0 && tableWidth < adaptiveBreakpoint;
2465
2526
  const overflowClass = overflowMode === "scroll" ? "overflow-x-auto" : "overflow-x-hidden";
2466
2527
  const resolvedScrollAreaMaxHeight = stickyHeader ? scrollAreaMaxHeight ?? "calc(100dvh - 240px)" : scrollAreaMaxHeight;
@@ -2590,7 +2651,7 @@ function TableView({
2590
2651
  ]
2591
2652
  }
2592
2653
  ),
2593
- /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1", children: [
2654
+ /* @__PURE__ */ jsxs18("div", { className: `flex items-center ${paginationSizeClasses.gap}`, children: [
2594
2655
  /* @__PURE__ */ jsxs18(
2595
2656
  "button",
2596
2657
  {
@@ -2598,7 +2659,7 @@ function TableView({
2598
2659
  onClick: pagination.onPrevious,
2599
2660
  disabled: pagination.currentPage === 1,
2600
2661
  "aria-label": "Ir para a p\xE1gina anterior",
2601
- 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" : ""}`,
2662
+ className: `${paginationSizeClasses.itemHeight} inline-flex ${paginationVariant === "arrows" ? paginationSizeClasses.pageWidth : paginationSizeClasses.controlWidth} items-center justify-center gap-1 rounded border border-border-default ${paginationSizeClasses.controlPadding} ${paginationSizeClasses.text} leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:border-border-default disabled:opacity-50`,
2602
2663
  children: [
2603
2664
  /* @__PURE__ */ jsx33(MdKeyboardArrowLeft, { className: "h-3 w-3 text-content-muted" }),
2604
2665
  paginationVariant !== "arrows" && "Anterior"
@@ -2610,7 +2671,7 @@ function TableView({
2610
2671
  {
2611
2672
  "aria-live": "polite",
2612
2673
  "aria-atomic": "true",
2613
- className: "inline-flex h-6 min-w-6 items-center justify-center rounded border border-selection-border bg-selection-background px-1.5 text-sm font-bold leading-none text-selection-content tablet:h-7 tablet:min-w-7",
2674
+ className: `${paginationSizeClasses.itemHeight} inline-flex ${paginationSizeClasses.pageWidth} items-center justify-center rounded border border-selection-border bg-selection-background ${paginationSizeClasses.controlPadding} ${paginationSizeClasses.text} font-bold leading-none text-selection-content`,
2614
2675
  children: pagination.currentPage
2615
2676
  }
2616
2677
  ),
@@ -2621,7 +2682,7 @@ function TableView({
2621
2682
  onClick: pagination.onNext,
2622
2683
  disabled: pagination.currentPage === pagination.totalPages,
2623
2684
  "aria-label": "Ir para a pr\xF3xima p\xE1gina",
2624
- 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" : ""}`,
2685
+ className: `${paginationSizeClasses.itemHeight} inline-flex ${paginationVariant === "arrows" ? paginationSizeClasses.pageWidth : paginationSizeClasses.controlWidth} items-center justify-center gap-1 rounded border border-border-default ${paginationSizeClasses.controlPadding} ${paginationSizeClasses.text} leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:border-border-default disabled:opacity-50`,
2625
2686
  children: [
2626
2687
  paginationVariant !== "arrows" && "Pr\xF3xima",
2627
2688
  /* @__PURE__ */ jsx33(MdKeyboardArrowRight, { className: "h-3 w-3 text-content-muted" })
@@ -2657,6 +2718,7 @@ function Table(props) {
2657
2718
  totalWidthUnits,
2658
2719
  showRowDivider = false,
2659
2720
  enableRowHover = false,
2721
+ paginationSize = "normal",
2660
2722
  paginationVariant = "default",
2661
2723
  expandable,
2662
2724
  overflowMode,
@@ -2916,6 +2978,7 @@ function Table(props) {
2916
2978
  totalItems: internalPagination.totalItems,
2917
2979
  startItem: internalPagination.startItem,
2918
2980
  endItem: internalPagination.endItem,
2981
+ size: paginationSize,
2919
2982
  variant: paginationVariant,
2920
2983
  onPrevious: () => setCurrentPage((prev) => Math.max(prev - 1, 1)),
2921
2984
  onNext: () => setCurrentPage(
@@ -2923,6 +2986,7 @@ function Table(props) {
2923
2986
  )
2924
2987
  } : pagination ? {
2925
2988
  ...pagination,
2989
+ size: pagination.size ?? "normal",
2926
2990
  variant: pagination.variant ?? "default"
2927
2991
  } : pagination;
2928
2992
  const resolvedShowPagination = data ? Boolean(
@@ -3148,7 +3212,7 @@ function MobileCardTable({
3148
3212
  onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)),
3149
3213
  disabled: pagination.currentPage === 1,
3150
3214
  "aria-label": "Ir para a p\xE1gina anterior",
3151
- className: "inline-flex h-7 items-center justify-center gap-1 rounded border border-border-default px-3 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50",
3215
+ className: `${PAGINATION_ITEM_HEIGHT_CLASS} inline-flex items-center justify-center gap-1 rounded border border-border-default px-3 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50`,
3152
3216
  children: [
3153
3217
  /* @__PURE__ */ jsx35(MdKeyboardArrowLeft2, { className: "h-3 w-3 text-content-muted" }),
3154
3218
  "Anterior"
@@ -3160,7 +3224,7 @@ function MobileCardTable({
3160
3224
  {
3161
3225
  "aria-live": "polite",
3162
3226
  "aria-atomic": "true",
3163
- className: "inline-flex h-7 min-w-7 items-center justify-center rounded border border-selection-border bg-selection-background px-2 text-sm font-bold leading-none text-selection-content",
3227
+ className: `${PAGINATION_ITEM_HEIGHT_CLASS} inline-flex min-w-7 items-center justify-center rounded border border-selection-border bg-selection-background px-2 text-sm font-bold leading-none text-selection-content`,
3164
3228
  children: pagination.currentPage
3165
3229
  }
3166
3230
  ),
@@ -3173,7 +3237,7 @@ function MobileCardTable({
3173
3237
  ),
3174
3238
  disabled: pagination.currentPage === pagination.totalPages,
3175
3239
  "aria-label": "Ir para a pr\xF3xima p\xE1gina",
3176
- className: "inline-flex h-7 items-center justify-center gap-1 rounded border border-border-default px-3 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50",
3240
+ className: `${PAGINATION_ITEM_HEIGHT_CLASS} inline-flex items-center justify-center gap-1 rounded border border-border-default px-3 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50`,
3177
3241
  children: [
3178
3242
  "Pr\xF3ximo",
3179
3243
  /* @__PURE__ */ jsx35(MdKeyboardArrowRight2, { className: "h-3 w-3 text-content-muted" })
@@ -3277,4 +3341,4 @@ export {
3277
3341
  resolveContainerBreakpoint,
3278
3342
  useContainerBreakpoint
3279
3343
  };
3280
- //# sourceMappingURL=chunk-5LJGBVPA.js.map
3344
+ //# sourceMappingURL=chunk-3UXUAX5K.js.map