@andreagiugni/tailwind-dashboard-ui 0.3.0 → 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/dist/index.cjs CHANGED
@@ -6,6 +6,7 @@ var chunkBGA7AECV_cjs = require('./chunk-BGA7AECV.cjs');
6
6
  var chunkMYOOZFHK_cjs = require('./chunk-MYOOZFHK.cjs');
7
7
  var chunkHT7SQXRF_cjs = require('./chunk-HT7SQXRF.cjs');
8
8
  var chunkW7SNEBD7_cjs = require('./chunk-W7SNEBD7.cjs');
9
+ var chunk3T6AZMUZ_cjs = require('./chunk-3T6AZMUZ.cjs');
9
10
  var chunkYERNSNT4_cjs = require('./chunk-YERNSNT4.cjs');
10
11
  var jsxRuntime = require('react/jsx-runtime');
11
12
  var React5 = require('react');
@@ -31,7 +32,7 @@ function styleOverride({
31
32
  }
32
33
  var sizeClasses = {
33
34
  sm: "px-4 py-3 text-sm",
34
- md: "px-5 py-3.5 text-sm"
35
+ md: "px-5 py-2.5 text-sm"
35
36
  };
36
37
  var variantClasses = {
37
38
  primary: "bg-brand-500 text-white shadow-theme-xs hover:bg-brand-600 disabled:bg-brand-300",
@@ -552,64 +553,87 @@ var Dropzone = ({
552
553
  }
553
554
  );
554
555
  };
556
+ var navButton = "flex h-10 items-center justify-center rounded-lg border border-gray-300 bg-white px-3.5 py-2.5 text-sm text-gray-700 shadow-theme-xs hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-white/[0.03]";
557
+ var justifyByAlign = {
558
+ left: "justify-start",
559
+ center: "justify-center",
560
+ right: "justify-end"
561
+ };
555
562
  var Pagination = ({
556
563
  currentPage,
557
564
  totalPages,
558
- onPageChange
565
+ onPageChange,
566
+ align
559
567
  }) => {
560
568
  const pagesAroundCurrent = Array.from(
561
569
  { length: Math.min(3, totalPages) },
562
570
  (_, i) => i + Math.max(currentPage - 1, 1)
563
571
  );
564
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center ", children: [
565
- /* @__PURE__ */ jsxRuntime.jsx(
566
- "button",
567
- {
568
- onClick: () => onPageChange(currentPage - 1),
569
- disabled: currentPage === 1,
570
- "aria-label": "Previous",
571
- className: chunkYERNSNT4_cjs.cn(
572
- "mr-2.5 flex items-center h-10 justify-center rounded-lg border border-gray-300 bg-white px-3.5 py-2.5 text-gray-700 shadow-theme-xs hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-white/[0.03] text-sm"
573
- ),
574
- children: "Previous"
575
- }
576
- ),
577
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
578
- currentPage > 3 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-2", children: "..." }),
579
- pagesAroundCurrent.map((page) => /* @__PURE__ */ jsxRuntime.jsx(
580
- "button",
581
- {
582
- onClick: () => onPageChange(page),
583
- "aria-current": currentPage === page ? "page" : void 0,
584
- className: chunkYERNSNT4_cjs.cn(
585
- "flex w-10 items-center justify-center h-10 rounded-lg text-sm font-medium",
586
- currentPage === page ? (
587
- // active page keeps its color on hover (no hover restyle)
588
- "bg-brand-500 text-white"
589
- ) : (
590
- // hover effect applies only to non-active page indices
591
- "text-gray-700 hover:bg-blue-500/[0.08] hover:text-brand-500 dark:text-gray-400 dark:hover:text-brand-500"
592
- )
593
- ),
594
- children: page
595
- },
596
- page
597
- )),
598
- currentPage < totalPages - 2 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-2", children: "..." })
599
- ] }),
600
- /* @__PURE__ */ jsxRuntime.jsx(
572
+ const prev = /* @__PURE__ */ jsxRuntime.jsx(
573
+ "button",
574
+ {
575
+ onClick: () => onPageChange(currentPage - 1),
576
+ disabled: currentPage === 1,
577
+ "aria-label": "Previous",
578
+ className: navButton,
579
+ children: "Previous"
580
+ }
581
+ );
582
+ const indices = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
583
+ currentPage > 3 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-2", children: "..." }),
584
+ pagesAroundCurrent.map((page) => /* @__PURE__ */ jsxRuntime.jsx(
601
585
  "button",
602
586
  {
603
- onClick: () => onPageChange(currentPage + 1),
604
- disabled: currentPage === totalPages,
605
- "aria-label": "Next",
587
+ onClick: () => onPageChange(page),
588
+ "aria-current": currentPage === page ? "page" : void 0,
606
589
  className: chunkYERNSNT4_cjs.cn(
607
- "ml-2.5 flex items-center justify-center rounded-lg border border-gray-300 bg-white px-3.5 py-2.5 text-gray-700 shadow-theme-xs text-sm hover:bg-gray-50 h-10 disabled:opacity-50 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-white/[0.03]"
590
+ "flex w-10 items-center justify-center h-10 rounded-lg text-sm font-medium",
591
+ currentPage === page ? (
592
+ // active page keeps its color on hover (no hover restyle)
593
+ "bg-brand-500 text-white"
594
+ ) : (
595
+ // hover effect applies only to non-active page indices
596
+ "text-gray-700 hover:bg-blue-500/[0.08] hover:text-brand-500 dark:text-gray-400 dark:hover:text-brand-500"
597
+ )
608
598
  ),
609
- children: "Next"
610
- }
611
- )
599
+ children: page
600
+ },
601
+ page
602
+ )),
603
+ currentPage < totalPages - 2 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-2", children: "..." })
612
604
  ] });
605
+ const next = /* @__PURE__ */ jsxRuntime.jsx(
606
+ "button",
607
+ {
608
+ onClick: () => onPageChange(currentPage + 1),
609
+ disabled: currentPage === totalPages,
610
+ "aria-label": "Next",
611
+ className: navButton,
612
+ children: "Next"
613
+ }
614
+ );
615
+ if (align === "full") {
616
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between", children: [
617
+ prev,
618
+ indices,
619
+ next
620
+ ] });
621
+ }
622
+ return /* @__PURE__ */ jsxRuntime.jsxs(
623
+ "div",
624
+ {
625
+ className: chunkYERNSNT4_cjs.cn(
626
+ "flex items-center gap-2.5",
627
+ align && "w-full",
628
+ align && justifyByAlign[align]
629
+ ),
630
+ children: [
631
+ prev,
632
+ indices,
633
+ next
634
+ ]
635
+ }
636
+ );
613
637
  };
614
638
  var Input = ({
615
639
  className,
@@ -675,6 +699,7 @@ function DataDrivenTable({
675
699
  rowsPerPage = 10,
676
700
  rowsPerPageOptions = [5, 10, 25, 50],
677
701
  pagination = true,
702
+ paginationAlign = "right",
678
703
  showSizeSelector = true,
679
704
  searchKeys,
680
705
  searchPlaceholder = "Search...",
@@ -726,6 +751,7 @@ function DataDrivenTable({
726
751
  const sizeOptions = rowsPerPageOptions.length ? rowsPerPageOptions : [];
727
752
  const showSelector = pagination && showSizeSelector && sizeOptions.length > 1;
728
753
  const showControls = showSearch || showSelector;
754
+ const counterText = total === 0 ? "Showing 0 entries" : `Showing ${start + 1} to ${Math.min(start + pageSize, total)} of ${total} entries`;
729
755
  return /* @__PURE__ */ jsxRuntime.jsxs(
730
756
  "div",
731
757
  {
@@ -824,10 +850,36 @@ function DataDrivenTable({
824
850
  pageRows.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: columns.length, className: "px-5 py-6 text-center text-sm text-gray-400", children: emptyContent }) })
825
851
  ] })
826
852
  ] }) }),
827
- pagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 p-4", children: [
828
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: total === 0 ? "Showing 0 entries" : `Showing ${start + 1} to ${Math.min(start + pageSize, total)} of ${total} entries` }),
829
- totalPages > 1 && /* @__PURE__ */ jsxRuntime.jsx(Pagination, { currentPage: current, totalPages, onPageChange: setPage })
830
- ] })
853
+ pagination && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: paginationAlign === "right" ? (
854
+ // Default layout: entry counter on the left, controls on the right.
855
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
856
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: counterText }),
857
+ totalPages > 1 && /* @__PURE__ */ jsxRuntime.jsx(Pagination, { currentPage: current, totalPages, onPageChange: setPage })
858
+ ] })
859
+ ) : (
860
+ // Aligned layout: controls aligned/stretched, counter underneath.
861
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
862
+ totalPages > 1 && /* @__PURE__ */ jsxRuntime.jsx(
863
+ Pagination,
864
+ {
865
+ align: paginationAlign,
866
+ currentPage: current,
867
+ totalPages,
868
+ onPageChange: setPage
869
+ }
870
+ ),
871
+ /* @__PURE__ */ jsxRuntime.jsx(
872
+ "p",
873
+ {
874
+ className: chunkYERNSNT4_cjs.cn(
875
+ "text-sm text-gray-500 dark:text-gray-400",
876
+ paginationAlign === "center" && "text-center"
877
+ ),
878
+ children: counterText
879
+ }
880
+ )
881
+ ] })
882
+ ) })
831
883
  ]
832
884
  }
833
885
  );
@@ -839,6 +891,7 @@ function Table({
839
891
  rowsPerPage,
840
892
  rowsPerPageOptions,
841
893
  pagination,
894
+ paginationAlign,
842
895
  showSizeSelector,
843
896
  searchKeys,
844
897
  searchPlaceholder,
@@ -859,6 +912,7 @@ function Table({
859
912
  rowsPerPage,
860
913
  rowsPerPageOptions,
861
914
  pagination,
915
+ paginationAlign,
862
916
  showSizeSelector,
863
917
  searchKeys,
864
918
  searchPlaceholder,
@@ -3104,6 +3158,10 @@ Object.defineProperty(exports, "Editor", {
3104
3158
  enumerable: true,
3105
3159
  get: function () { return chunkW7SNEBD7_cjs.Editor; }
3106
3160
  });
3161
+ Object.defineProperty(exports, "ColorPicker", {
3162
+ enumerable: true,
3163
+ get: function () { return chunk3T6AZMUZ_cjs.ColorPicker; }
3164
+ });
3107
3165
  Object.defineProperty(exports, "cn", {
3108
3166
  enumerable: true,
3109
3167
  get: function () { return chunkYERNSNT4_cjs.cn; }