jett.admin.npmpackage 2.0.23 → 2.0.24
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.js +107 -22
- package/dist/index.mjs +108 -20
- package/package.json +5 -1
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var index_exports = {};
|
|
31
31
|
__export(index_exports, {
|
|
32
32
|
AppSideBar: () => AppSideBar,
|
|
33
|
+
Calendar: () => Calendar,
|
|
33
34
|
Chip: () => Chip,
|
|
34
35
|
CustomAutocomplete: () => CustomAutocomplete,
|
|
35
36
|
CustomButton: () => CustomButton,
|
|
@@ -1803,8 +1804,91 @@ var Dropdown = import_react17.default.forwardRef(
|
|
|
1803
1804
|
);
|
|
1804
1805
|
Dropdown.displayName = "Dropdown";
|
|
1805
1806
|
|
|
1806
|
-
// src/
|
|
1807
|
+
// src/Calendar/Calendar.tsx
|
|
1807
1808
|
var import_react18 = __toESM(require("react"));
|
|
1809
|
+
var import_dates = require("@mantine/dates");
|
|
1810
|
+
var Calendar = (props) => {
|
|
1811
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1812
|
+
const {
|
|
1813
|
+
minDate,
|
|
1814
|
+
maxDate,
|
|
1815
|
+
excludeDate,
|
|
1816
|
+
firstDayOfWeek = 1,
|
|
1817
|
+
locale,
|
|
1818
|
+
size,
|
|
1819
|
+
className,
|
|
1820
|
+
error
|
|
1821
|
+
} = props;
|
|
1822
|
+
const isRange = props.mode === "range";
|
|
1823
|
+
const isDateTime = props.mode === "datetime";
|
|
1824
|
+
const datesProviderSettings = {
|
|
1825
|
+
firstDayOfWeek,
|
|
1826
|
+
consistentWeeks: true
|
|
1827
|
+
};
|
|
1828
|
+
if (locale) {
|
|
1829
|
+
datesProviderSettings.locale = locale;
|
|
1830
|
+
}
|
|
1831
|
+
const anchorDate = isRange ? ((_a = props.value) == null ? void 0 : _a[0]) ?? ((_b = props.value) == null ? void 0 : _b[1]) ?? ((_c = props.defaultValue) == null ? void 0 : _c[0]) ?? ((_d = props.defaultValue) == null ? void 0 : _d[1]) ?? void 0 : !isDateTime ? props.value ?? props.defaultValue ?? void 0 : void 0;
|
|
1832
|
+
const [displayDate, setDisplayDate] = (0, import_react18.useState)(anchorDate ?? void 0);
|
|
1833
|
+
const anchorTime = isRange ? ((_f = (_e = props.value) == null ? void 0 : _e[0]) == null ? void 0 : _f.getTime()) ?? ((_h = (_g = props.value) == null ? void 0 : _g[1]) == null ? void 0 : _h.getTime()) : !isDateTime ? (_i = props.value) == null ? void 0 : _i.getTime() : void 0;
|
|
1834
|
+
(0, import_react18.useEffect)(() => {
|
|
1835
|
+
if (anchorTime !== void 0) {
|
|
1836
|
+
setDisplayDate(new Date(anchorTime));
|
|
1837
|
+
}
|
|
1838
|
+
}, [anchorTime]);
|
|
1839
|
+
const weekendColorStyle = {
|
|
1840
|
+
"--mantine-color-red-6": "var(--mantine-color-text)"
|
|
1841
|
+
};
|
|
1842
|
+
if (isRange) {
|
|
1843
|
+
const datePickerProps2 = {
|
|
1844
|
+
type: "range",
|
|
1845
|
+
value: props.value,
|
|
1846
|
+
defaultValue: props.defaultValue,
|
|
1847
|
+
onChange: props.onChange,
|
|
1848
|
+
minDate,
|
|
1849
|
+
maxDate,
|
|
1850
|
+
excludeDate,
|
|
1851
|
+
size,
|
|
1852
|
+
className,
|
|
1853
|
+
date: displayDate,
|
|
1854
|
+
onDateChange: setDisplayDate,
|
|
1855
|
+
style: weekendColorStyle
|
|
1856
|
+
};
|
|
1857
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_dates.DatesProvider, { settings: datesProviderSettings }, /* @__PURE__ */ import_react18.default.createElement(import_dates.DatePicker, { ...datePickerProps2 }));
|
|
1858
|
+
}
|
|
1859
|
+
if (isDateTime) {
|
|
1860
|
+
const dateTimePickerProps = {
|
|
1861
|
+
value: props.value,
|
|
1862
|
+
defaultValue: props.defaultValue,
|
|
1863
|
+
onChange: props.onChange,
|
|
1864
|
+
minDate,
|
|
1865
|
+
maxDate,
|
|
1866
|
+
excludeDate,
|
|
1867
|
+
size,
|
|
1868
|
+
className,
|
|
1869
|
+
error,
|
|
1870
|
+
style: weekendColorStyle
|
|
1871
|
+
};
|
|
1872
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_dates.DatesProvider, { settings: datesProviderSettings }, /* @__PURE__ */ import_react18.default.createElement(import_dates.DateTimePicker, { ...dateTimePickerProps }));
|
|
1873
|
+
}
|
|
1874
|
+
const datePickerProps = {
|
|
1875
|
+
value: props.value,
|
|
1876
|
+
defaultValue: props.defaultValue,
|
|
1877
|
+
onChange: props.onChange,
|
|
1878
|
+
minDate,
|
|
1879
|
+
maxDate,
|
|
1880
|
+
excludeDate,
|
|
1881
|
+
size,
|
|
1882
|
+
className,
|
|
1883
|
+
date: displayDate,
|
|
1884
|
+
onDateChange: setDisplayDate,
|
|
1885
|
+
style: weekendColorStyle
|
|
1886
|
+
};
|
|
1887
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_dates.DatesProvider, { settings: datesProviderSettings }, /* @__PURE__ */ import_react18.default.createElement(import_dates.DatePicker, { ...datePickerProps }));
|
|
1888
|
+
};
|
|
1889
|
+
|
|
1890
|
+
// src/Pagination/Pagination.jsx
|
|
1891
|
+
var import_react19 = __toESM(require("react"));
|
|
1808
1892
|
var import_lucide_react9 = require("lucide-react");
|
|
1809
1893
|
var Pagination = ({
|
|
1810
1894
|
id = "pagination",
|
|
@@ -1829,26 +1913,26 @@ var Pagination = ({
|
|
|
1829
1913
|
componentProps = {},
|
|
1830
1914
|
...restProps
|
|
1831
1915
|
}) => {
|
|
1832
|
-
const [internalCurrentPage, setInternalCurrentPage] = (0,
|
|
1833
|
-
const [internalItemsPerPage, setInternalItemsPerPage] = (0,
|
|
1916
|
+
const [internalCurrentPage, setInternalCurrentPage] = (0, import_react19.useState)(1);
|
|
1917
|
+
const [internalItemsPerPage, setInternalItemsPerPage] = (0, import_react19.useState)(itemsPerPage);
|
|
1834
1918
|
const isControlled = controlledCurrentPage !== void 0;
|
|
1835
1919
|
const isItemsPerPageControlled = controlledOnItemsPerPageChange !== void 0;
|
|
1836
1920
|
const currentPage = isControlled ? controlledCurrentPage : internalCurrentPage;
|
|
1837
1921
|
const activeItemsPerPage = isItemsPerPageControlled ? itemsPerPage : internalItemsPerPage;
|
|
1838
1922
|
const totalItems = legacyTotalItems !== void 0 ? legacyTotalItems : data.length;
|
|
1839
|
-
const calculatedTotalPages = (0,
|
|
1923
|
+
const calculatedTotalPages = (0, import_react19.useMemo)(() => {
|
|
1840
1924
|
if (totalItems > 0 && activeItemsPerPage > 0) {
|
|
1841
1925
|
return Math.ceil(totalItems / activeItemsPerPage);
|
|
1842
1926
|
}
|
|
1843
1927
|
return 1;
|
|
1844
1928
|
}, [totalItems, activeItemsPerPage]);
|
|
1845
|
-
const paginatedData = (0,
|
|
1929
|
+
const paginatedData = (0, import_react19.useMemo)(() => {
|
|
1846
1930
|
if (!data || data.length === 0) return [];
|
|
1847
1931
|
const startIndex = (currentPage - 1) * activeItemsPerPage;
|
|
1848
1932
|
const endIndex = startIndex + activeItemsPerPage;
|
|
1849
1933
|
return data.slice(startIndex, endIndex);
|
|
1850
1934
|
}, [data, currentPage, activeItemsPerPage]);
|
|
1851
|
-
(0,
|
|
1935
|
+
(0, import_react19.useEffect)(() => {
|
|
1852
1936
|
if (!isControlled && currentPage > calculatedTotalPages && calculatedTotalPages > 0) {
|
|
1853
1937
|
setInternalCurrentPage(1);
|
|
1854
1938
|
}
|
|
@@ -1881,11 +1965,11 @@ var Pagination = ({
|
|
|
1881
1965
|
const endItem = totalItems !== void 0 ? Math.min(currentPage * activeItemsPerPage, totalItems) : null;
|
|
1882
1966
|
const renderContent = () => {
|
|
1883
1967
|
if (Component) {
|
|
1884
|
-
if (
|
|
1968
|
+
if (import_react19.default.isValidElement(Component)) {
|
|
1885
1969
|
const ComponentType = Component.type;
|
|
1886
1970
|
const elementProps = Component.props;
|
|
1887
1971
|
if (isTable) {
|
|
1888
|
-
return /* @__PURE__ */
|
|
1972
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1889
1973
|
CustomTable,
|
|
1890
1974
|
{
|
|
1891
1975
|
tableHeader,
|
|
@@ -1893,7 +1977,7 @@ var Pagination = ({
|
|
|
1893
1977
|
id: `${id}-custom-table-1`
|
|
1894
1978
|
},
|
|
1895
1979
|
data.map((item, index) => {
|
|
1896
|
-
return /* @__PURE__ */
|
|
1980
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1897
1981
|
ComponentType,
|
|
1898
1982
|
{
|
|
1899
1983
|
key: item.id || item._id || index,
|
|
@@ -1908,7 +1992,7 @@ var Pagination = ({
|
|
|
1908
1992
|
);
|
|
1909
1993
|
} else {
|
|
1910
1994
|
if (isTable) {
|
|
1911
|
-
return /* @__PURE__ */
|
|
1995
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1912
1996
|
CustomTable,
|
|
1913
1997
|
{
|
|
1914
1998
|
tableHeader,
|
|
@@ -1916,7 +2000,7 @@ var Pagination = ({
|
|
|
1916
2000
|
id: `${id}-custom-table-2`
|
|
1917
2001
|
},
|
|
1918
2002
|
paginatedData.map((item, index) => {
|
|
1919
|
-
return /* @__PURE__ */
|
|
2003
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1920
2004
|
ComponentType,
|
|
1921
2005
|
{
|
|
1922
2006
|
key: item.id || item._id || index,
|
|
@@ -1932,7 +2016,7 @@ var Pagination = ({
|
|
|
1932
2016
|
}
|
|
1933
2017
|
}
|
|
1934
2018
|
} else {
|
|
1935
|
-
return /* @__PURE__ */
|
|
2019
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1936
2020
|
CustomTable,
|
|
1937
2021
|
{
|
|
1938
2022
|
tableHeader,
|
|
@@ -1940,7 +2024,7 @@ var Pagination = ({
|
|
|
1940
2024
|
id: `${id}-custom-table-3`
|
|
1941
2025
|
},
|
|
1942
2026
|
paginatedData.map((item, index) => {
|
|
1943
|
-
return /* @__PURE__ */
|
|
2027
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1944
2028
|
Component,
|
|
1945
2029
|
{
|
|
1946
2030
|
key: item.id || item._id || index,
|
|
@@ -1956,7 +2040,7 @@ var Pagination = ({
|
|
|
1956
2040
|
}
|
|
1957
2041
|
return null;
|
|
1958
2042
|
};
|
|
1959
|
-
return /* @__PURE__ */
|
|
2043
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, renderContent()), /* @__PURE__ */ import_react19.default.createElement("div", { className: "flex flex-col sm:flex-row justify-between items-center gap-4 px-4 py-3 border-t border-[#e5e5e5] dark:border-[#303036] bg-white dark:bg-[#18181b] z-10", id: `${id}-div-1` }, totalItems !== void 0 && /* @__PURE__ */ import_react19.default.createElement("div", { className: "text-sm text-[#737373] dark:text-white", id: `${id}-div-2` }, "Showing ", startItem, " to ", endItem, " of ", totalItems, " entries"), /* @__PURE__ */ import_react19.default.createElement("div", { className: "flex items-center gap-2", id: `${id}-div-3` }, /* @__PURE__ */ import_react19.default.createElement(
|
|
1960
2044
|
"button",
|
|
1961
2045
|
{
|
|
1962
2046
|
onClick: () => handlePageChange(1),
|
|
@@ -1965,8 +2049,8 @@ var Pagination = ({
|
|
|
1965
2049
|
title: "First page",
|
|
1966
2050
|
id: `${id}-button-1`
|
|
1967
2051
|
},
|
|
1968
|
-
/* @__PURE__ */
|
|
1969
|
-
), /* @__PURE__ */
|
|
2052
|
+
/* @__PURE__ */ import_react19.default.createElement(import_lucide_react9.ChevronsLeft, { size: 16 })
|
|
2053
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
1970
2054
|
"button",
|
|
1971
2055
|
{
|
|
1972
2056
|
onClick: () => handlePageChange(currentPage - 1),
|
|
@@ -1975,8 +2059,8 @@ var Pagination = ({
|
|
|
1975
2059
|
title: "Previous page",
|
|
1976
2060
|
id: `${id}-button-2`
|
|
1977
2061
|
},
|
|
1978
|
-
/* @__PURE__ */
|
|
1979
|
-
), getPageNumbers().map((pageNum) => /* @__PURE__ */
|
|
2062
|
+
/* @__PURE__ */ import_react19.default.createElement(import_lucide_react9.ChevronLeft, { size: 16 })
|
|
2063
|
+
), getPageNumbers().map((pageNum) => /* @__PURE__ */ import_react19.default.createElement(
|
|
1980
2064
|
"button",
|
|
1981
2065
|
{
|
|
1982
2066
|
key: pageNum,
|
|
@@ -1985,7 +2069,7 @@ var Pagination = ({
|
|
|
1985
2069
|
id: `${id}-button-3`
|
|
1986
2070
|
},
|
|
1987
2071
|
pageNum
|
|
1988
|
-
)), /* @__PURE__ */
|
|
2072
|
+
)), /* @__PURE__ */ import_react19.default.createElement(
|
|
1989
2073
|
"button",
|
|
1990
2074
|
{
|
|
1991
2075
|
onClick: () => handlePageChange(currentPage + 1),
|
|
@@ -1994,8 +2078,8 @@ var Pagination = ({
|
|
|
1994
2078
|
title: "Next page",
|
|
1995
2079
|
id: `${id}-button-4`
|
|
1996
2080
|
},
|
|
1997
|
-
/* @__PURE__ */
|
|
1998
|
-
), /* @__PURE__ */
|
|
2081
|
+
/* @__PURE__ */ import_react19.default.createElement(import_lucide_react9.ChevronRight, { size: 16 })
|
|
2082
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
1999
2083
|
"button",
|
|
2000
2084
|
{
|
|
2001
2085
|
onClick: () => handlePageChange(calculatedTotalPages),
|
|
@@ -2004,12 +2088,13 @@ var Pagination = ({
|
|
|
2004
2088
|
title: "Last page",
|
|
2005
2089
|
id: `${id}-button-5`
|
|
2006
2090
|
},
|
|
2007
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ import_react19.default.createElement(import_lucide_react9.ChevronsRight, { size: 16 })
|
|
2008
2092
|
))));
|
|
2009
2093
|
};
|
|
2010
2094
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2011
2095
|
0 && (module.exports = {
|
|
2012
2096
|
AppSideBar,
|
|
2097
|
+
Calendar,
|
|
2013
2098
|
Chip,
|
|
2014
2099
|
CustomAutocomplete,
|
|
2015
2100
|
CustomButton,
|
package/dist/index.mjs
CHANGED
|
@@ -1770,8 +1770,95 @@ var Dropdown = React17.forwardRef(
|
|
|
1770
1770
|
);
|
|
1771
1771
|
Dropdown.displayName = "Dropdown";
|
|
1772
1772
|
|
|
1773
|
+
// src/Calendar/Calendar.tsx
|
|
1774
|
+
import React18, { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1775
|
+
import {
|
|
1776
|
+
DatePicker,
|
|
1777
|
+
DateTimePicker,
|
|
1778
|
+
DatesProvider
|
|
1779
|
+
} from "@mantine/dates";
|
|
1780
|
+
var Calendar = (props) => {
|
|
1781
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1782
|
+
const {
|
|
1783
|
+
minDate,
|
|
1784
|
+
maxDate,
|
|
1785
|
+
excludeDate,
|
|
1786
|
+
firstDayOfWeek = 1,
|
|
1787
|
+
locale,
|
|
1788
|
+
size,
|
|
1789
|
+
className,
|
|
1790
|
+
error
|
|
1791
|
+
} = props;
|
|
1792
|
+
const isRange = props.mode === "range";
|
|
1793
|
+
const isDateTime = props.mode === "datetime";
|
|
1794
|
+
const datesProviderSettings = {
|
|
1795
|
+
firstDayOfWeek,
|
|
1796
|
+
consistentWeeks: true
|
|
1797
|
+
};
|
|
1798
|
+
if (locale) {
|
|
1799
|
+
datesProviderSettings.locale = locale;
|
|
1800
|
+
}
|
|
1801
|
+
const anchorDate = isRange ? ((_a = props.value) == null ? void 0 : _a[0]) ?? ((_b = props.value) == null ? void 0 : _b[1]) ?? ((_c = props.defaultValue) == null ? void 0 : _c[0]) ?? ((_d = props.defaultValue) == null ? void 0 : _d[1]) ?? void 0 : !isDateTime ? props.value ?? props.defaultValue ?? void 0 : void 0;
|
|
1802
|
+
const [displayDate, setDisplayDate] = useState6(anchorDate ?? void 0);
|
|
1803
|
+
const anchorTime = isRange ? ((_f = (_e = props.value) == null ? void 0 : _e[0]) == null ? void 0 : _f.getTime()) ?? ((_h = (_g = props.value) == null ? void 0 : _g[1]) == null ? void 0 : _h.getTime()) : !isDateTime ? (_i = props.value) == null ? void 0 : _i.getTime() : void 0;
|
|
1804
|
+
useEffect4(() => {
|
|
1805
|
+
if (anchorTime !== void 0) {
|
|
1806
|
+
setDisplayDate(new Date(anchorTime));
|
|
1807
|
+
}
|
|
1808
|
+
}, [anchorTime]);
|
|
1809
|
+
const weekendColorStyle = {
|
|
1810
|
+
"--mantine-color-red-6": "var(--mantine-color-text)"
|
|
1811
|
+
};
|
|
1812
|
+
if (isRange) {
|
|
1813
|
+
const datePickerProps2 = {
|
|
1814
|
+
type: "range",
|
|
1815
|
+
value: props.value,
|
|
1816
|
+
defaultValue: props.defaultValue,
|
|
1817
|
+
onChange: props.onChange,
|
|
1818
|
+
minDate,
|
|
1819
|
+
maxDate,
|
|
1820
|
+
excludeDate,
|
|
1821
|
+
size,
|
|
1822
|
+
className,
|
|
1823
|
+
date: displayDate,
|
|
1824
|
+
onDateChange: setDisplayDate,
|
|
1825
|
+
style: weekendColorStyle
|
|
1826
|
+
};
|
|
1827
|
+
return /* @__PURE__ */ React18.createElement(DatesProvider, { settings: datesProviderSettings }, /* @__PURE__ */ React18.createElement(DatePicker, { ...datePickerProps2 }));
|
|
1828
|
+
}
|
|
1829
|
+
if (isDateTime) {
|
|
1830
|
+
const dateTimePickerProps = {
|
|
1831
|
+
value: props.value,
|
|
1832
|
+
defaultValue: props.defaultValue,
|
|
1833
|
+
onChange: props.onChange,
|
|
1834
|
+
minDate,
|
|
1835
|
+
maxDate,
|
|
1836
|
+
excludeDate,
|
|
1837
|
+
size,
|
|
1838
|
+
className,
|
|
1839
|
+
error,
|
|
1840
|
+
style: weekendColorStyle
|
|
1841
|
+
};
|
|
1842
|
+
return /* @__PURE__ */ React18.createElement(DatesProvider, { settings: datesProviderSettings }, /* @__PURE__ */ React18.createElement(DateTimePicker, { ...dateTimePickerProps }));
|
|
1843
|
+
}
|
|
1844
|
+
const datePickerProps = {
|
|
1845
|
+
value: props.value,
|
|
1846
|
+
defaultValue: props.defaultValue,
|
|
1847
|
+
onChange: props.onChange,
|
|
1848
|
+
minDate,
|
|
1849
|
+
maxDate,
|
|
1850
|
+
excludeDate,
|
|
1851
|
+
size,
|
|
1852
|
+
className,
|
|
1853
|
+
date: displayDate,
|
|
1854
|
+
onDateChange: setDisplayDate,
|
|
1855
|
+
style: weekendColorStyle
|
|
1856
|
+
};
|
|
1857
|
+
return /* @__PURE__ */ React18.createElement(DatesProvider, { settings: datesProviderSettings }, /* @__PURE__ */ React18.createElement(DatePicker, { ...datePickerProps }));
|
|
1858
|
+
};
|
|
1859
|
+
|
|
1773
1860
|
// src/Pagination/Pagination.jsx
|
|
1774
|
-
import
|
|
1861
|
+
import React19, { useMemo as useMemo2, useState as useState7, useEffect as useEffect5 } from "react";
|
|
1775
1862
|
import { ChevronLeft, ChevronRight as ChevronRight2, ChevronsLeft, ChevronsRight } from "lucide-react";
|
|
1776
1863
|
var Pagination = ({
|
|
1777
1864
|
id = "pagination",
|
|
@@ -1796,8 +1883,8 @@ var Pagination = ({
|
|
|
1796
1883
|
componentProps = {},
|
|
1797
1884
|
...restProps
|
|
1798
1885
|
}) => {
|
|
1799
|
-
const [internalCurrentPage, setInternalCurrentPage] =
|
|
1800
|
-
const [internalItemsPerPage, setInternalItemsPerPage] =
|
|
1886
|
+
const [internalCurrentPage, setInternalCurrentPage] = useState7(1);
|
|
1887
|
+
const [internalItemsPerPage, setInternalItemsPerPage] = useState7(itemsPerPage);
|
|
1801
1888
|
const isControlled = controlledCurrentPage !== void 0;
|
|
1802
1889
|
const isItemsPerPageControlled = controlledOnItemsPerPageChange !== void 0;
|
|
1803
1890
|
const currentPage = isControlled ? controlledCurrentPage : internalCurrentPage;
|
|
@@ -1815,7 +1902,7 @@ var Pagination = ({
|
|
|
1815
1902
|
const endIndex = startIndex + activeItemsPerPage;
|
|
1816
1903
|
return data.slice(startIndex, endIndex);
|
|
1817
1904
|
}, [data, currentPage, activeItemsPerPage]);
|
|
1818
|
-
|
|
1905
|
+
useEffect5(() => {
|
|
1819
1906
|
if (!isControlled && currentPage > calculatedTotalPages && calculatedTotalPages > 0) {
|
|
1820
1907
|
setInternalCurrentPage(1);
|
|
1821
1908
|
}
|
|
@@ -1848,11 +1935,11 @@ var Pagination = ({
|
|
|
1848
1935
|
const endItem = totalItems !== void 0 ? Math.min(currentPage * activeItemsPerPage, totalItems) : null;
|
|
1849
1936
|
const renderContent = () => {
|
|
1850
1937
|
if (Component) {
|
|
1851
|
-
if (
|
|
1938
|
+
if (React19.isValidElement(Component)) {
|
|
1852
1939
|
const ComponentType = Component.type;
|
|
1853
1940
|
const elementProps = Component.props;
|
|
1854
1941
|
if (isTable) {
|
|
1855
|
-
return /* @__PURE__ */
|
|
1942
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1856
1943
|
CustomTable,
|
|
1857
1944
|
{
|
|
1858
1945
|
tableHeader,
|
|
@@ -1860,7 +1947,7 @@ var Pagination = ({
|
|
|
1860
1947
|
id: `${id}-custom-table-1`
|
|
1861
1948
|
},
|
|
1862
1949
|
data.map((item, index) => {
|
|
1863
|
-
return /* @__PURE__ */
|
|
1950
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1864
1951
|
ComponentType,
|
|
1865
1952
|
{
|
|
1866
1953
|
key: item.id || item._id || index,
|
|
@@ -1875,7 +1962,7 @@ var Pagination = ({
|
|
|
1875
1962
|
);
|
|
1876
1963
|
} else {
|
|
1877
1964
|
if (isTable) {
|
|
1878
|
-
return /* @__PURE__ */
|
|
1965
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1879
1966
|
CustomTable,
|
|
1880
1967
|
{
|
|
1881
1968
|
tableHeader,
|
|
@@ -1883,7 +1970,7 @@ var Pagination = ({
|
|
|
1883
1970
|
id: `${id}-custom-table-2`
|
|
1884
1971
|
},
|
|
1885
1972
|
paginatedData.map((item, index) => {
|
|
1886
|
-
return /* @__PURE__ */
|
|
1973
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1887
1974
|
ComponentType,
|
|
1888
1975
|
{
|
|
1889
1976
|
key: item.id || item._id || index,
|
|
@@ -1899,7 +1986,7 @@ var Pagination = ({
|
|
|
1899
1986
|
}
|
|
1900
1987
|
}
|
|
1901
1988
|
} else {
|
|
1902
|
-
return /* @__PURE__ */
|
|
1989
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1903
1990
|
CustomTable,
|
|
1904
1991
|
{
|
|
1905
1992
|
tableHeader,
|
|
@@ -1907,7 +1994,7 @@ var Pagination = ({
|
|
|
1907
1994
|
id: `${id}-custom-table-3`
|
|
1908
1995
|
},
|
|
1909
1996
|
paginatedData.map((item, index) => {
|
|
1910
|
-
return /* @__PURE__ */
|
|
1997
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1911
1998
|
Component,
|
|
1912
1999
|
{
|
|
1913
2000
|
key: item.id || item._id || index,
|
|
@@ -1923,7 +2010,7 @@ var Pagination = ({
|
|
|
1923
2010
|
}
|
|
1924
2011
|
return null;
|
|
1925
2012
|
};
|
|
1926
|
-
return /* @__PURE__ */
|
|
2013
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(React19.Fragment, null, renderContent()), /* @__PURE__ */ React19.createElement("div", { className: "flex flex-col sm:flex-row justify-between items-center gap-4 px-4 py-3 border-t border-[#e5e5e5] dark:border-[#303036] bg-white dark:bg-[#18181b] z-10", id: `${id}-div-1` }, totalItems !== void 0 && /* @__PURE__ */ React19.createElement("div", { className: "text-sm text-[#737373] dark:text-white", id: `${id}-div-2` }, "Showing ", startItem, " to ", endItem, " of ", totalItems, " entries"), /* @__PURE__ */ React19.createElement("div", { className: "flex items-center gap-2", id: `${id}-div-3` }, /* @__PURE__ */ React19.createElement(
|
|
1927
2014
|
"button",
|
|
1928
2015
|
{
|
|
1929
2016
|
onClick: () => handlePageChange(1),
|
|
@@ -1932,8 +2019,8 @@ var Pagination = ({
|
|
|
1932
2019
|
title: "First page",
|
|
1933
2020
|
id: `${id}-button-1`
|
|
1934
2021
|
},
|
|
1935
|
-
/* @__PURE__ */
|
|
1936
|
-
), /* @__PURE__ */
|
|
2022
|
+
/* @__PURE__ */ React19.createElement(ChevronsLeft, { size: 16 })
|
|
2023
|
+
), /* @__PURE__ */ React19.createElement(
|
|
1937
2024
|
"button",
|
|
1938
2025
|
{
|
|
1939
2026
|
onClick: () => handlePageChange(currentPage - 1),
|
|
@@ -1942,8 +2029,8 @@ var Pagination = ({
|
|
|
1942
2029
|
title: "Previous page",
|
|
1943
2030
|
id: `${id}-button-2`
|
|
1944
2031
|
},
|
|
1945
|
-
/* @__PURE__ */
|
|
1946
|
-
), getPageNumbers().map((pageNum) => /* @__PURE__ */
|
|
2032
|
+
/* @__PURE__ */ React19.createElement(ChevronLeft, { size: 16 })
|
|
2033
|
+
), getPageNumbers().map((pageNum) => /* @__PURE__ */ React19.createElement(
|
|
1947
2034
|
"button",
|
|
1948
2035
|
{
|
|
1949
2036
|
key: pageNum,
|
|
@@ -1952,7 +2039,7 @@ var Pagination = ({
|
|
|
1952
2039
|
id: `${id}-button-3`
|
|
1953
2040
|
},
|
|
1954
2041
|
pageNum
|
|
1955
|
-
)), /* @__PURE__ */
|
|
2042
|
+
)), /* @__PURE__ */ React19.createElement(
|
|
1956
2043
|
"button",
|
|
1957
2044
|
{
|
|
1958
2045
|
onClick: () => handlePageChange(currentPage + 1),
|
|
@@ -1961,8 +2048,8 @@ var Pagination = ({
|
|
|
1961
2048
|
title: "Next page",
|
|
1962
2049
|
id: `${id}-button-4`
|
|
1963
2050
|
},
|
|
1964
|
-
/* @__PURE__ */
|
|
1965
|
-
), /* @__PURE__ */
|
|
2051
|
+
/* @__PURE__ */ React19.createElement(ChevronRight2, { size: 16 })
|
|
2052
|
+
), /* @__PURE__ */ React19.createElement(
|
|
1966
2053
|
"button",
|
|
1967
2054
|
{
|
|
1968
2055
|
onClick: () => handlePageChange(calculatedTotalPages),
|
|
@@ -1971,11 +2058,12 @@ var Pagination = ({
|
|
|
1971
2058
|
title: "Last page",
|
|
1972
2059
|
id: `${id}-button-5`
|
|
1973
2060
|
},
|
|
1974
|
-
/* @__PURE__ */
|
|
2061
|
+
/* @__PURE__ */ React19.createElement(ChevronsRight, { size: 16 })
|
|
1975
2062
|
))));
|
|
1976
2063
|
};
|
|
1977
2064
|
export {
|
|
1978
2065
|
AppSideBar,
|
|
2066
|
+
Calendar,
|
|
1979
2067
|
Chip,
|
|
1980
2068
|
CustomAutocomplete,
|
|
1981
2069
|
CustomButton,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jett.admin.npmpackage",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.24",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -22,8 +22,12 @@
|
|
|
22
22
|
"react-dom": ">=18"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@mantine/core": "^7.17.8",
|
|
26
|
+
"@mantine/dates": "^7.17.8",
|
|
27
|
+
"@mantine/hooks": "^7.17.8",
|
|
25
28
|
"@tailwindcss/postcss": "^4.1.13",
|
|
26
29
|
"clsx": "^2.1.1",
|
|
30
|
+
"dayjs": "^1.11.23",
|
|
27
31
|
"js-cookie": "^3.0.5",
|
|
28
32
|
"lucide-react": "^0.544.0",
|
|
29
33
|
"node-forge": "^1.4.0",
|