jett.admin.npmpackage 2.0.22 → 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/Inter-Bold-UGVMS3V6-UGVMS3V6.woff2 +0 -0
- package/dist/Inter-Medium-5IRUMIHZ-5IRUMIHZ.woff2 +0 -0
- package/dist/Inter-Regular-GS5EHSMB-GS5EHSMB.woff2 +0 -0
- package/dist/Inter-SemiBold-SVBZ7NC6-SVBZ7NC6.woff2 +0 -0
- package/dist/index.css +25 -19
- package/dist/index.js +257 -22
- package/dist/index.mjs +259 -22
- package/package.json +6 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.css
CHANGED
|
@@ -2,23 +2,6 @@
|
|
|
2
2
|
@layer properties;
|
|
3
3
|
:root,
|
|
4
4
|
:host {
|
|
5
|
-
--font-sans:
|
|
6
|
-
ui-sans-serif,
|
|
7
|
-
system-ui,
|
|
8
|
-
sans-serif,
|
|
9
|
-
"Apple Color Emoji",
|
|
10
|
-
"Segoe UI Emoji",
|
|
11
|
-
"Segoe UI Symbol",
|
|
12
|
-
"Noto Color Emoji";
|
|
13
|
-
--font-mono:
|
|
14
|
-
ui-monospace,
|
|
15
|
-
SFMono-Regular,
|
|
16
|
-
Menlo,
|
|
17
|
-
Monaco,
|
|
18
|
-
Consolas,
|
|
19
|
-
"Liberation Mono",
|
|
20
|
-
"Courier New",
|
|
21
|
-
monospace;
|
|
22
5
|
--color-red-50: oklch(97.1% 0.013 17.38);
|
|
23
6
|
--color-red-100: oklch(93.6% 0.032 17.717);
|
|
24
7
|
--color-red-200: oklch(88.5% 0.062 18.334);
|
|
@@ -172,6 +155,9 @@
|
|
|
172
155
|
.mb-6 {
|
|
173
156
|
margin-bottom: calc(var(--spacing) * 6);
|
|
174
157
|
}
|
|
158
|
+
.ml-0\.5 {
|
|
159
|
+
margin-left: calc(var(--spacing) * 0.5);
|
|
160
|
+
}
|
|
175
161
|
.ml-2 {
|
|
176
162
|
margin-left: calc(var(--spacing) * 2);
|
|
177
163
|
}
|
|
@@ -866,6 +852,10 @@
|
|
|
866
852
|
var(--tw-ring-shadow),
|
|
867
853
|
var(--tw-shadow);
|
|
868
854
|
}
|
|
855
|
+
.outline {
|
|
856
|
+
outline-style: var(--tw-outline-style);
|
|
857
|
+
outline-width: 1px;
|
|
858
|
+
}
|
|
869
859
|
.outline-offset-2 {
|
|
870
860
|
outline-offset: 2px;
|
|
871
861
|
}
|
|
@@ -961,6 +951,22 @@
|
|
|
961
951
|
background-color: var(--color-primary);
|
|
962
952
|
}
|
|
963
953
|
}
|
|
954
|
+
.placeholder\:text-\[14px\] {
|
|
955
|
+
&::placeholder {
|
|
956
|
+
font-size: 14px;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
.placeholder\:font-normal {
|
|
960
|
+
&::placeholder {
|
|
961
|
+
--tw-font-weight: var(--font-weight-normal);
|
|
962
|
+
font-weight: var(--font-weight-normal);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
.placeholder\:text-\[\#6b7280\] {
|
|
966
|
+
&::placeholder {
|
|
967
|
+
color: #6b7280;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
964
970
|
.focus-within\:outline-2 {
|
|
965
971
|
&:focus-within {
|
|
966
972
|
outline-style: var(--tw-outline-style);
|
|
@@ -1395,9 +1401,9 @@ body {
|
|
|
1395
1401
|
@property --tw-ring-offset-width { syntax: "<length>"; inherits: false; initial-value: 0px; }
|
|
1396
1402
|
@property --tw-ring-offset-color { syntax: "*"; inherits: false; initial-value: #fff; }
|
|
1397
1403
|
@property --tw-ring-offset-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }
|
|
1404
|
+
@property --tw-outline-style { syntax: "*"; inherits: false; initial-value: solid; }
|
|
1398
1405
|
@property --tw-duration { syntax: "*"; inherits: false; }
|
|
1399
1406
|
@property --tw-ease { syntax: "*"; inherits: false; }
|
|
1400
|
-
@property --tw-outline-style { syntax: "*"; inherits: false; initial-value: solid; }
|
|
1401
1407
|
@property --tw-space-x-reverse { syntax: "*"; inherits: false; initial-value: 0; }
|
|
1402
1408
|
@layer properties {
|
|
1403
1409
|
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
@@ -1431,9 +1437,9 @@ body {
|
|
|
1431
1437
|
--tw-ring-offset-width: 0px;
|
|
1432
1438
|
--tw-ring-offset-color: #fff;
|
|
1433
1439
|
--tw-ring-offset-shadow: 0 0 #0000;
|
|
1440
|
+
--tw-outline-style: solid;
|
|
1434
1441
|
--tw-duration: initial;
|
|
1435
1442
|
--tw-ease: initial;
|
|
1436
|
-
--tw-outline-style: solid;
|
|
1437
1443
|
--tw-space-x-reverse: 0;
|
|
1438
1444
|
}
|
|
1439
1445
|
}
|
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,
|
|
@@ -41,6 +42,7 @@ __export(index_exports, {
|
|
|
41
42
|
CustomTable: () => CustomTable,
|
|
42
43
|
CustomTextarea: () => CustomTextarea,
|
|
43
44
|
CustomUpload: () => CustomUpload,
|
|
45
|
+
Dropdown: () => Dropdown,
|
|
44
46
|
Pagination: () => Pagination,
|
|
45
47
|
ProgressBar: () => ProgressBar,
|
|
46
48
|
RightSheet: () => RightSheet
|
|
@@ -320,6 +322,7 @@ var CustomInput = ({
|
|
|
320
322
|
"input",
|
|
321
323
|
{
|
|
322
324
|
className: `border border-gray-200 rounded-md h-10 px-4 py-2 w-full text-[14px]
|
|
325
|
+
placeholder:text-[14px] placeholder:font-normal placeholder:text-[#6b7280]
|
|
323
326
|
focus:outline-2 outline-black dark:outline-white outline-offset-2
|
|
324
327
|
dark:bg-transparent dark:text-white dark:border-[#303036]
|
|
325
328
|
${disabled ? "bg-gray-100 cursor-not-allowed text-gray-500 border-gray-300" : error ? "border-red-500 bg-red-50" : "bg-white border-[hsl(0_0%_89.8%)]"}
|
|
@@ -1654,8 +1657,238 @@ var CustomTable = ({
|
|
|
1654
1657
|
)), /* @__PURE__ */ import_react16.default.createElement("tbody", { id: `${id}-tbody-1` }, children))));
|
|
1655
1658
|
};
|
|
1656
1659
|
|
|
1657
|
-
// src/
|
|
1660
|
+
// src/inputs/Dropdown.jsx
|
|
1658
1661
|
var import_react17 = __toESM(require("react"));
|
|
1662
|
+
var import_react_select = __toESM(require("react-select"));
|
|
1663
|
+
var isDarkMode = () => typeof document !== "undefined" && document.documentElement.classList.contains("dark");
|
|
1664
|
+
function buildStyles(isDark, error) {
|
|
1665
|
+
return {
|
|
1666
|
+
control: (base, state) => ({
|
|
1667
|
+
...base,
|
|
1668
|
+
minHeight: "40px !important",
|
|
1669
|
+
fontSize: 14,
|
|
1670
|
+
borderRadius: "6px",
|
|
1671
|
+
boxShadow: "none",
|
|
1672
|
+
backgroundColor: state.isDisabled ? "#f3f4f6" : error ? "#fef2f2" : isDark ? "#18181b" : "#ffffff",
|
|
1673
|
+
borderColor: state.isDisabled ? "#d1d5db" : error ? "#ef4444" : isDark ? "#303036" : "#e5e5e5",
|
|
1674
|
+
outline: state.isFocused ? "2px solid #000" : "none",
|
|
1675
|
+
outlineOffset: "2px",
|
|
1676
|
+
"&:hover": {
|
|
1677
|
+
borderColor: error ? "#ef4444" : "none"
|
|
1678
|
+
}
|
|
1679
|
+
}),
|
|
1680
|
+
menu: (base) => ({
|
|
1681
|
+
...base,
|
|
1682
|
+
backgroundColor: isDark ? "#18181b" : "#ffffff",
|
|
1683
|
+
zIndex: 9999
|
|
1684
|
+
}),
|
|
1685
|
+
menuPortal: (base) => ({ ...base, zIndex: 9999 }),
|
|
1686
|
+
option: (base, state) => ({
|
|
1687
|
+
...base,
|
|
1688
|
+
fontSize: 14,
|
|
1689
|
+
cursor: "pointer",
|
|
1690
|
+
backgroundColor: state.isSelected ? "#0087FA" : state.isFocused ? isDark ? "#303036" : "#EBF5FF" : "transparent",
|
|
1691
|
+
color: state.isSelected ? "#ffffff" : isDark ? "#f3f4f6" : "#111827",
|
|
1692
|
+
"&:active": { backgroundColor: "#0087FA", color: "#ffffff" }
|
|
1693
|
+
}),
|
|
1694
|
+
singleValue: (base, state) => ({
|
|
1695
|
+
...base,
|
|
1696
|
+
fontSize: 14,
|
|
1697
|
+
fontWeight: 400,
|
|
1698
|
+
color: state.isDisabled ? "#6b7280" : isDark ? "#f3f4f6" : "#111827"
|
|
1699
|
+
}),
|
|
1700
|
+
multiValue: (base) => ({
|
|
1701
|
+
...base,
|
|
1702
|
+
backgroundColor: isDark ? "#303036" : "#EBF5FF"
|
|
1703
|
+
}),
|
|
1704
|
+
multiValueLabel: (base) => ({
|
|
1705
|
+
...base,
|
|
1706
|
+
fontSize: 12,
|
|
1707
|
+
color: isDark ? "#f3f4f6" : "#0087FA"
|
|
1708
|
+
}),
|
|
1709
|
+
multiValueRemove: (base) => ({
|
|
1710
|
+
...base,
|
|
1711
|
+
color: isDark ? "#9ca3af" : "#0087FA",
|
|
1712
|
+
"&:hover": { backgroundColor: "#0087FA", color: "#ffffff" }
|
|
1713
|
+
}),
|
|
1714
|
+
placeholder: (base) => ({
|
|
1715
|
+
...base,
|
|
1716
|
+
fontSize: 14,
|
|
1717
|
+
fontWeight: 400,
|
|
1718
|
+
color: "#6b7280"
|
|
1719
|
+
}),
|
|
1720
|
+
input: (base) => ({
|
|
1721
|
+
...base,
|
|
1722
|
+
fontSize: 14,
|
|
1723
|
+
fontWeight: 400,
|
|
1724
|
+
color: isDark ? "#f3f4f6" : "#111827"
|
|
1725
|
+
}),
|
|
1726
|
+
indicatorSeparator: () => ({ display: "none" }),
|
|
1727
|
+
dropdownIndicator: (base) => ({
|
|
1728
|
+
...base,
|
|
1729
|
+
padding: "0 6px",
|
|
1730
|
+
color: isDark ? "#9ca3af" : "#6b7280"
|
|
1731
|
+
}),
|
|
1732
|
+
clearIndicator: (base) => ({
|
|
1733
|
+
...base,
|
|
1734
|
+
padding: "0 4px",
|
|
1735
|
+
color: isDark ? "#9ca3af" : "#6b7280",
|
|
1736
|
+
cursor: "pointer",
|
|
1737
|
+
"&:hover": { color: "#0087FA" }
|
|
1738
|
+
}),
|
|
1739
|
+
valueContainer: (base) => ({ ...base, padding: "2px 16px" })
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
var Dropdown = import_react17.default.forwardRef(
|
|
1743
|
+
({
|
|
1744
|
+
id = "dropdown",
|
|
1745
|
+
options,
|
|
1746
|
+
placeholder = "Select...",
|
|
1747
|
+
isDisabled = false,
|
|
1748
|
+
isClearable = true,
|
|
1749
|
+
isLoading = false,
|
|
1750
|
+
error = false,
|
|
1751
|
+
label,
|
|
1752
|
+
heading,
|
|
1753
|
+
isRequired = false,
|
|
1754
|
+
name,
|
|
1755
|
+
menuPortalTarget,
|
|
1756
|
+
menuPosition = "absolute",
|
|
1757
|
+
className,
|
|
1758
|
+
style,
|
|
1759
|
+
isMulti = false,
|
|
1760
|
+
value,
|
|
1761
|
+
onChange
|
|
1762
|
+
}, ref) => {
|
|
1763
|
+
const reactId = (0, import_react17.useId)();
|
|
1764
|
+
const isDark = isDarkMode();
|
|
1765
|
+
const styles = (0, import_react17.useMemo)(() => buildStyles(isDark, !!error), [isDark, error]);
|
|
1766
|
+
const selectedValue = isMulti ? options.filter((o) => (value ?? []).includes(o.value)) : options.find((o) => o.value === value) ?? null;
|
|
1767
|
+
const handleChange = (selected) => {
|
|
1768
|
+
if (isMulti) {
|
|
1769
|
+
onChange((selected ?? []).map((o) => o.value));
|
|
1770
|
+
} else {
|
|
1771
|
+
onChange((selected == null ? void 0 : selected.value) ?? null);
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
return /* @__PURE__ */ import_react17.default.createElement("div", { className: `flex flex-col gap-1 w-full ${className ?? ""}`, style, id: `${id}-div-1` }, heading && /* @__PURE__ */ import_react17.default.createElement("h3", { className: "text-lg font-semibold", id: `${id}-h3-1` }, heading), label && /* @__PURE__ */ import_react17.default.createElement(
|
|
1775
|
+
"label",
|
|
1776
|
+
{
|
|
1777
|
+
htmlFor: reactId,
|
|
1778
|
+
className: `font-[500] text-sm ${heading ? "text-[#737373]" : "text-black"} dark:text-white`,
|
|
1779
|
+
id: `${id}-label-1`
|
|
1780
|
+
},
|
|
1781
|
+
label,
|
|
1782
|
+
isRequired && /* @__PURE__ */ import_react17.default.createElement("span", { className: "text-red-500 ml-0.5", id: `${id}-span-1` }, "*")
|
|
1783
|
+
), /* @__PURE__ */ import_react17.default.createElement(
|
|
1784
|
+
import_react_select.default,
|
|
1785
|
+
{
|
|
1786
|
+
ref,
|
|
1787
|
+
inputId: reactId,
|
|
1788
|
+
name,
|
|
1789
|
+
options,
|
|
1790
|
+
value: selectedValue,
|
|
1791
|
+
onChange: handleChange,
|
|
1792
|
+
placeholder,
|
|
1793
|
+
isDisabled,
|
|
1794
|
+
isClearable,
|
|
1795
|
+
isLoading,
|
|
1796
|
+
isMulti,
|
|
1797
|
+
styles,
|
|
1798
|
+
menuPortalTarget,
|
|
1799
|
+
menuPosition,
|
|
1800
|
+
classNamePrefix: "jett-dropdown"
|
|
1801
|
+
}
|
|
1802
|
+
));
|
|
1803
|
+
}
|
|
1804
|
+
);
|
|
1805
|
+
Dropdown.displayName = "Dropdown";
|
|
1806
|
+
|
|
1807
|
+
// src/Calendar/Calendar.tsx
|
|
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"));
|
|
1659
1892
|
var import_lucide_react9 = require("lucide-react");
|
|
1660
1893
|
var Pagination = ({
|
|
1661
1894
|
id = "pagination",
|
|
@@ -1680,26 +1913,26 @@ var Pagination = ({
|
|
|
1680
1913
|
componentProps = {},
|
|
1681
1914
|
...restProps
|
|
1682
1915
|
}) => {
|
|
1683
|
-
const [internalCurrentPage, setInternalCurrentPage] = (0,
|
|
1684
|
-
const [internalItemsPerPage, setInternalItemsPerPage] = (0,
|
|
1916
|
+
const [internalCurrentPage, setInternalCurrentPage] = (0, import_react19.useState)(1);
|
|
1917
|
+
const [internalItemsPerPage, setInternalItemsPerPage] = (0, import_react19.useState)(itemsPerPage);
|
|
1685
1918
|
const isControlled = controlledCurrentPage !== void 0;
|
|
1686
1919
|
const isItemsPerPageControlled = controlledOnItemsPerPageChange !== void 0;
|
|
1687
1920
|
const currentPage = isControlled ? controlledCurrentPage : internalCurrentPage;
|
|
1688
1921
|
const activeItemsPerPage = isItemsPerPageControlled ? itemsPerPage : internalItemsPerPage;
|
|
1689
1922
|
const totalItems = legacyTotalItems !== void 0 ? legacyTotalItems : data.length;
|
|
1690
|
-
const calculatedTotalPages = (0,
|
|
1923
|
+
const calculatedTotalPages = (0, import_react19.useMemo)(() => {
|
|
1691
1924
|
if (totalItems > 0 && activeItemsPerPage > 0) {
|
|
1692
1925
|
return Math.ceil(totalItems / activeItemsPerPage);
|
|
1693
1926
|
}
|
|
1694
1927
|
return 1;
|
|
1695
1928
|
}, [totalItems, activeItemsPerPage]);
|
|
1696
|
-
const paginatedData = (0,
|
|
1929
|
+
const paginatedData = (0, import_react19.useMemo)(() => {
|
|
1697
1930
|
if (!data || data.length === 0) return [];
|
|
1698
1931
|
const startIndex = (currentPage - 1) * activeItemsPerPage;
|
|
1699
1932
|
const endIndex = startIndex + activeItemsPerPage;
|
|
1700
1933
|
return data.slice(startIndex, endIndex);
|
|
1701
1934
|
}, [data, currentPage, activeItemsPerPage]);
|
|
1702
|
-
(0,
|
|
1935
|
+
(0, import_react19.useEffect)(() => {
|
|
1703
1936
|
if (!isControlled && currentPage > calculatedTotalPages && calculatedTotalPages > 0) {
|
|
1704
1937
|
setInternalCurrentPage(1);
|
|
1705
1938
|
}
|
|
@@ -1732,11 +1965,11 @@ var Pagination = ({
|
|
|
1732
1965
|
const endItem = totalItems !== void 0 ? Math.min(currentPage * activeItemsPerPage, totalItems) : null;
|
|
1733
1966
|
const renderContent = () => {
|
|
1734
1967
|
if (Component) {
|
|
1735
|
-
if (
|
|
1968
|
+
if (import_react19.default.isValidElement(Component)) {
|
|
1736
1969
|
const ComponentType = Component.type;
|
|
1737
1970
|
const elementProps = Component.props;
|
|
1738
1971
|
if (isTable) {
|
|
1739
|
-
return /* @__PURE__ */
|
|
1972
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1740
1973
|
CustomTable,
|
|
1741
1974
|
{
|
|
1742
1975
|
tableHeader,
|
|
@@ -1744,7 +1977,7 @@ var Pagination = ({
|
|
|
1744
1977
|
id: `${id}-custom-table-1`
|
|
1745
1978
|
},
|
|
1746
1979
|
data.map((item, index) => {
|
|
1747
|
-
return /* @__PURE__ */
|
|
1980
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1748
1981
|
ComponentType,
|
|
1749
1982
|
{
|
|
1750
1983
|
key: item.id || item._id || index,
|
|
@@ -1759,7 +1992,7 @@ var Pagination = ({
|
|
|
1759
1992
|
);
|
|
1760
1993
|
} else {
|
|
1761
1994
|
if (isTable) {
|
|
1762
|
-
return /* @__PURE__ */
|
|
1995
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1763
1996
|
CustomTable,
|
|
1764
1997
|
{
|
|
1765
1998
|
tableHeader,
|
|
@@ -1767,7 +2000,7 @@ var Pagination = ({
|
|
|
1767
2000
|
id: `${id}-custom-table-2`
|
|
1768
2001
|
},
|
|
1769
2002
|
paginatedData.map((item, index) => {
|
|
1770
|
-
return /* @__PURE__ */
|
|
2003
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1771
2004
|
ComponentType,
|
|
1772
2005
|
{
|
|
1773
2006
|
key: item.id || item._id || index,
|
|
@@ -1783,7 +2016,7 @@ var Pagination = ({
|
|
|
1783
2016
|
}
|
|
1784
2017
|
}
|
|
1785
2018
|
} else {
|
|
1786
|
-
return /* @__PURE__ */
|
|
2019
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1787
2020
|
CustomTable,
|
|
1788
2021
|
{
|
|
1789
2022
|
tableHeader,
|
|
@@ -1791,7 +2024,7 @@ var Pagination = ({
|
|
|
1791
2024
|
id: `${id}-custom-table-3`
|
|
1792
2025
|
},
|
|
1793
2026
|
paginatedData.map((item, index) => {
|
|
1794
|
-
return /* @__PURE__ */
|
|
2027
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1795
2028
|
Component,
|
|
1796
2029
|
{
|
|
1797
2030
|
key: item.id || item._id || index,
|
|
@@ -1807,7 +2040,7 @@ var Pagination = ({
|
|
|
1807
2040
|
}
|
|
1808
2041
|
return null;
|
|
1809
2042
|
};
|
|
1810
|
-
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(
|
|
1811
2044
|
"button",
|
|
1812
2045
|
{
|
|
1813
2046
|
onClick: () => handlePageChange(1),
|
|
@@ -1816,8 +2049,8 @@ var Pagination = ({
|
|
|
1816
2049
|
title: "First page",
|
|
1817
2050
|
id: `${id}-button-1`
|
|
1818
2051
|
},
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
), /* @__PURE__ */
|
|
2052
|
+
/* @__PURE__ */ import_react19.default.createElement(import_lucide_react9.ChevronsLeft, { size: 16 })
|
|
2053
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
1821
2054
|
"button",
|
|
1822
2055
|
{
|
|
1823
2056
|
onClick: () => handlePageChange(currentPage - 1),
|
|
@@ -1826,8 +2059,8 @@ var Pagination = ({
|
|
|
1826
2059
|
title: "Previous page",
|
|
1827
2060
|
id: `${id}-button-2`
|
|
1828
2061
|
},
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
), 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(
|
|
1831
2064
|
"button",
|
|
1832
2065
|
{
|
|
1833
2066
|
key: pageNum,
|
|
@@ -1836,7 +2069,7 @@ var Pagination = ({
|
|
|
1836
2069
|
id: `${id}-button-3`
|
|
1837
2070
|
},
|
|
1838
2071
|
pageNum
|
|
1839
|
-
)), /* @__PURE__ */
|
|
2072
|
+
)), /* @__PURE__ */ import_react19.default.createElement(
|
|
1840
2073
|
"button",
|
|
1841
2074
|
{
|
|
1842
2075
|
onClick: () => handlePageChange(currentPage + 1),
|
|
@@ -1845,8 +2078,8 @@ var Pagination = ({
|
|
|
1845
2078
|
title: "Next page",
|
|
1846
2079
|
id: `${id}-button-4`
|
|
1847
2080
|
},
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
), /* @__PURE__ */
|
|
2081
|
+
/* @__PURE__ */ import_react19.default.createElement(import_lucide_react9.ChevronRight, { size: 16 })
|
|
2082
|
+
), /* @__PURE__ */ import_react19.default.createElement(
|
|
1850
2083
|
"button",
|
|
1851
2084
|
{
|
|
1852
2085
|
onClick: () => handlePageChange(calculatedTotalPages),
|
|
@@ -1855,12 +2088,13 @@ var Pagination = ({
|
|
|
1855
2088
|
title: "Last page",
|
|
1856
2089
|
id: `${id}-button-5`
|
|
1857
2090
|
},
|
|
1858
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ import_react19.default.createElement(import_lucide_react9.ChevronsRight, { size: 16 })
|
|
1859
2092
|
))));
|
|
1860
2093
|
};
|
|
1861
2094
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1862
2095
|
0 && (module.exports = {
|
|
1863
2096
|
AppSideBar,
|
|
2097
|
+
Calendar,
|
|
1864
2098
|
Chip,
|
|
1865
2099
|
CustomAutocomplete,
|
|
1866
2100
|
CustomButton,
|
|
@@ -1872,6 +2106,7 @@ var Pagination = ({
|
|
|
1872
2106
|
CustomTable,
|
|
1873
2107
|
CustomTextarea,
|
|
1874
2108
|
CustomUpload,
|
|
2109
|
+
Dropdown,
|
|
1875
2110
|
Pagination,
|
|
1876
2111
|
ProgressBar,
|
|
1877
2112
|
RightSheet
|
package/dist/index.mjs
CHANGED
|
@@ -271,6 +271,7 @@ var CustomInput = ({
|
|
|
271
271
|
"input",
|
|
272
272
|
{
|
|
273
273
|
className: `border border-gray-200 rounded-md h-10 px-4 py-2 w-full text-[14px]
|
|
274
|
+
placeholder:text-[14px] placeholder:font-normal placeholder:text-[#6b7280]
|
|
274
275
|
focus:outline-2 outline-black dark:outline-white outline-offset-2
|
|
275
276
|
dark:bg-transparent dark:text-white dark:border-[#303036]
|
|
276
277
|
${disabled ? "bg-gray-100 cursor-not-allowed text-gray-500 border-gray-300" : error ? "border-red-500 bg-red-50" : "bg-white border-[hsl(0_0%_89.8%)]"}
|
|
@@ -1622,8 +1623,242 @@ var CustomTable = ({
|
|
|
1622
1623
|
)), /* @__PURE__ */ React16.createElement("tbody", { id: `${id}-tbody-1` }, children))));
|
|
1623
1624
|
};
|
|
1624
1625
|
|
|
1626
|
+
// src/inputs/Dropdown.jsx
|
|
1627
|
+
import React17, { useId, useMemo } from "react";
|
|
1628
|
+
import ReactSelect from "react-select";
|
|
1629
|
+
var isDarkMode = () => typeof document !== "undefined" && document.documentElement.classList.contains("dark");
|
|
1630
|
+
function buildStyles(isDark, error) {
|
|
1631
|
+
return {
|
|
1632
|
+
control: (base, state) => ({
|
|
1633
|
+
...base,
|
|
1634
|
+
minHeight: "40px !important",
|
|
1635
|
+
fontSize: 14,
|
|
1636
|
+
borderRadius: "6px",
|
|
1637
|
+
boxShadow: "none",
|
|
1638
|
+
backgroundColor: state.isDisabled ? "#f3f4f6" : error ? "#fef2f2" : isDark ? "#18181b" : "#ffffff",
|
|
1639
|
+
borderColor: state.isDisabled ? "#d1d5db" : error ? "#ef4444" : isDark ? "#303036" : "#e5e5e5",
|
|
1640
|
+
outline: state.isFocused ? "2px solid #000" : "none",
|
|
1641
|
+
outlineOffset: "2px",
|
|
1642
|
+
"&:hover": {
|
|
1643
|
+
borderColor: error ? "#ef4444" : "none"
|
|
1644
|
+
}
|
|
1645
|
+
}),
|
|
1646
|
+
menu: (base) => ({
|
|
1647
|
+
...base,
|
|
1648
|
+
backgroundColor: isDark ? "#18181b" : "#ffffff",
|
|
1649
|
+
zIndex: 9999
|
|
1650
|
+
}),
|
|
1651
|
+
menuPortal: (base) => ({ ...base, zIndex: 9999 }),
|
|
1652
|
+
option: (base, state) => ({
|
|
1653
|
+
...base,
|
|
1654
|
+
fontSize: 14,
|
|
1655
|
+
cursor: "pointer",
|
|
1656
|
+
backgroundColor: state.isSelected ? "#0087FA" : state.isFocused ? isDark ? "#303036" : "#EBF5FF" : "transparent",
|
|
1657
|
+
color: state.isSelected ? "#ffffff" : isDark ? "#f3f4f6" : "#111827",
|
|
1658
|
+
"&:active": { backgroundColor: "#0087FA", color: "#ffffff" }
|
|
1659
|
+
}),
|
|
1660
|
+
singleValue: (base, state) => ({
|
|
1661
|
+
...base,
|
|
1662
|
+
fontSize: 14,
|
|
1663
|
+
fontWeight: 400,
|
|
1664
|
+
color: state.isDisabled ? "#6b7280" : isDark ? "#f3f4f6" : "#111827"
|
|
1665
|
+
}),
|
|
1666
|
+
multiValue: (base) => ({
|
|
1667
|
+
...base,
|
|
1668
|
+
backgroundColor: isDark ? "#303036" : "#EBF5FF"
|
|
1669
|
+
}),
|
|
1670
|
+
multiValueLabel: (base) => ({
|
|
1671
|
+
...base,
|
|
1672
|
+
fontSize: 12,
|
|
1673
|
+
color: isDark ? "#f3f4f6" : "#0087FA"
|
|
1674
|
+
}),
|
|
1675
|
+
multiValueRemove: (base) => ({
|
|
1676
|
+
...base,
|
|
1677
|
+
color: isDark ? "#9ca3af" : "#0087FA",
|
|
1678
|
+
"&:hover": { backgroundColor: "#0087FA", color: "#ffffff" }
|
|
1679
|
+
}),
|
|
1680
|
+
placeholder: (base) => ({
|
|
1681
|
+
...base,
|
|
1682
|
+
fontSize: 14,
|
|
1683
|
+
fontWeight: 400,
|
|
1684
|
+
color: "#6b7280"
|
|
1685
|
+
}),
|
|
1686
|
+
input: (base) => ({
|
|
1687
|
+
...base,
|
|
1688
|
+
fontSize: 14,
|
|
1689
|
+
fontWeight: 400,
|
|
1690
|
+
color: isDark ? "#f3f4f6" : "#111827"
|
|
1691
|
+
}),
|
|
1692
|
+
indicatorSeparator: () => ({ display: "none" }),
|
|
1693
|
+
dropdownIndicator: (base) => ({
|
|
1694
|
+
...base,
|
|
1695
|
+
padding: "0 6px",
|
|
1696
|
+
color: isDark ? "#9ca3af" : "#6b7280"
|
|
1697
|
+
}),
|
|
1698
|
+
clearIndicator: (base) => ({
|
|
1699
|
+
...base,
|
|
1700
|
+
padding: "0 4px",
|
|
1701
|
+
color: isDark ? "#9ca3af" : "#6b7280",
|
|
1702
|
+
cursor: "pointer",
|
|
1703
|
+
"&:hover": { color: "#0087FA" }
|
|
1704
|
+
}),
|
|
1705
|
+
valueContainer: (base) => ({ ...base, padding: "2px 16px" })
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
var Dropdown = React17.forwardRef(
|
|
1709
|
+
({
|
|
1710
|
+
id = "dropdown",
|
|
1711
|
+
options,
|
|
1712
|
+
placeholder = "Select...",
|
|
1713
|
+
isDisabled = false,
|
|
1714
|
+
isClearable = true,
|
|
1715
|
+
isLoading = false,
|
|
1716
|
+
error = false,
|
|
1717
|
+
label,
|
|
1718
|
+
heading,
|
|
1719
|
+
isRequired = false,
|
|
1720
|
+
name,
|
|
1721
|
+
menuPortalTarget,
|
|
1722
|
+
menuPosition = "absolute",
|
|
1723
|
+
className,
|
|
1724
|
+
style,
|
|
1725
|
+
isMulti = false,
|
|
1726
|
+
value,
|
|
1727
|
+
onChange
|
|
1728
|
+
}, ref) => {
|
|
1729
|
+
const reactId = useId();
|
|
1730
|
+
const isDark = isDarkMode();
|
|
1731
|
+
const styles = useMemo(() => buildStyles(isDark, !!error), [isDark, error]);
|
|
1732
|
+
const selectedValue = isMulti ? options.filter((o) => (value ?? []).includes(o.value)) : options.find((o) => o.value === value) ?? null;
|
|
1733
|
+
const handleChange = (selected) => {
|
|
1734
|
+
if (isMulti) {
|
|
1735
|
+
onChange((selected ?? []).map((o) => o.value));
|
|
1736
|
+
} else {
|
|
1737
|
+
onChange((selected == null ? void 0 : selected.value) ?? null);
|
|
1738
|
+
}
|
|
1739
|
+
};
|
|
1740
|
+
return /* @__PURE__ */ React17.createElement("div", { className: `flex flex-col gap-1 w-full ${className ?? ""}`, style, id: `${id}-div-1` }, heading && /* @__PURE__ */ React17.createElement("h3", { className: "text-lg font-semibold", id: `${id}-h3-1` }, heading), label && /* @__PURE__ */ React17.createElement(
|
|
1741
|
+
"label",
|
|
1742
|
+
{
|
|
1743
|
+
htmlFor: reactId,
|
|
1744
|
+
className: `font-[500] text-sm ${heading ? "text-[#737373]" : "text-black"} dark:text-white`,
|
|
1745
|
+
id: `${id}-label-1`
|
|
1746
|
+
},
|
|
1747
|
+
label,
|
|
1748
|
+
isRequired && /* @__PURE__ */ React17.createElement("span", { className: "text-red-500 ml-0.5", id: `${id}-span-1` }, "*")
|
|
1749
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1750
|
+
ReactSelect,
|
|
1751
|
+
{
|
|
1752
|
+
ref,
|
|
1753
|
+
inputId: reactId,
|
|
1754
|
+
name,
|
|
1755
|
+
options,
|
|
1756
|
+
value: selectedValue,
|
|
1757
|
+
onChange: handleChange,
|
|
1758
|
+
placeholder,
|
|
1759
|
+
isDisabled,
|
|
1760
|
+
isClearable,
|
|
1761
|
+
isLoading,
|
|
1762
|
+
isMulti,
|
|
1763
|
+
styles,
|
|
1764
|
+
menuPortalTarget,
|
|
1765
|
+
menuPosition,
|
|
1766
|
+
classNamePrefix: "jett-dropdown"
|
|
1767
|
+
}
|
|
1768
|
+
));
|
|
1769
|
+
}
|
|
1770
|
+
);
|
|
1771
|
+
Dropdown.displayName = "Dropdown";
|
|
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
|
+
|
|
1625
1860
|
// src/Pagination/Pagination.jsx
|
|
1626
|
-
import
|
|
1861
|
+
import React19, { useMemo as useMemo2, useState as useState7, useEffect as useEffect5 } from "react";
|
|
1627
1862
|
import { ChevronLeft, ChevronRight as ChevronRight2, ChevronsLeft, ChevronsRight } from "lucide-react";
|
|
1628
1863
|
var Pagination = ({
|
|
1629
1864
|
id = "pagination",
|
|
@@ -1648,26 +1883,26 @@ var Pagination = ({
|
|
|
1648
1883
|
componentProps = {},
|
|
1649
1884
|
...restProps
|
|
1650
1885
|
}) => {
|
|
1651
|
-
const [internalCurrentPage, setInternalCurrentPage] =
|
|
1652
|
-
const [internalItemsPerPage, setInternalItemsPerPage] =
|
|
1886
|
+
const [internalCurrentPage, setInternalCurrentPage] = useState7(1);
|
|
1887
|
+
const [internalItemsPerPage, setInternalItemsPerPage] = useState7(itemsPerPage);
|
|
1653
1888
|
const isControlled = controlledCurrentPage !== void 0;
|
|
1654
1889
|
const isItemsPerPageControlled = controlledOnItemsPerPageChange !== void 0;
|
|
1655
1890
|
const currentPage = isControlled ? controlledCurrentPage : internalCurrentPage;
|
|
1656
1891
|
const activeItemsPerPage = isItemsPerPageControlled ? itemsPerPage : internalItemsPerPage;
|
|
1657
1892
|
const totalItems = legacyTotalItems !== void 0 ? legacyTotalItems : data.length;
|
|
1658
|
-
const calculatedTotalPages =
|
|
1893
|
+
const calculatedTotalPages = useMemo2(() => {
|
|
1659
1894
|
if (totalItems > 0 && activeItemsPerPage > 0) {
|
|
1660
1895
|
return Math.ceil(totalItems / activeItemsPerPage);
|
|
1661
1896
|
}
|
|
1662
1897
|
return 1;
|
|
1663
1898
|
}, [totalItems, activeItemsPerPage]);
|
|
1664
|
-
const paginatedData =
|
|
1899
|
+
const paginatedData = useMemo2(() => {
|
|
1665
1900
|
if (!data || data.length === 0) return [];
|
|
1666
1901
|
const startIndex = (currentPage - 1) * activeItemsPerPage;
|
|
1667
1902
|
const endIndex = startIndex + activeItemsPerPage;
|
|
1668
1903
|
return data.slice(startIndex, endIndex);
|
|
1669
1904
|
}, [data, currentPage, activeItemsPerPage]);
|
|
1670
|
-
|
|
1905
|
+
useEffect5(() => {
|
|
1671
1906
|
if (!isControlled && currentPage > calculatedTotalPages && calculatedTotalPages > 0) {
|
|
1672
1907
|
setInternalCurrentPage(1);
|
|
1673
1908
|
}
|
|
@@ -1700,11 +1935,11 @@ var Pagination = ({
|
|
|
1700
1935
|
const endItem = totalItems !== void 0 ? Math.min(currentPage * activeItemsPerPage, totalItems) : null;
|
|
1701
1936
|
const renderContent = () => {
|
|
1702
1937
|
if (Component) {
|
|
1703
|
-
if (
|
|
1938
|
+
if (React19.isValidElement(Component)) {
|
|
1704
1939
|
const ComponentType = Component.type;
|
|
1705
1940
|
const elementProps = Component.props;
|
|
1706
1941
|
if (isTable) {
|
|
1707
|
-
return /* @__PURE__ */
|
|
1942
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1708
1943
|
CustomTable,
|
|
1709
1944
|
{
|
|
1710
1945
|
tableHeader,
|
|
@@ -1712,7 +1947,7 @@ var Pagination = ({
|
|
|
1712
1947
|
id: `${id}-custom-table-1`
|
|
1713
1948
|
},
|
|
1714
1949
|
data.map((item, index) => {
|
|
1715
|
-
return /* @__PURE__ */
|
|
1950
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1716
1951
|
ComponentType,
|
|
1717
1952
|
{
|
|
1718
1953
|
key: item.id || item._id || index,
|
|
@@ -1727,7 +1962,7 @@ var Pagination = ({
|
|
|
1727
1962
|
);
|
|
1728
1963
|
} else {
|
|
1729
1964
|
if (isTable) {
|
|
1730
|
-
return /* @__PURE__ */
|
|
1965
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1731
1966
|
CustomTable,
|
|
1732
1967
|
{
|
|
1733
1968
|
tableHeader,
|
|
@@ -1735,7 +1970,7 @@ var Pagination = ({
|
|
|
1735
1970
|
id: `${id}-custom-table-2`
|
|
1736
1971
|
},
|
|
1737
1972
|
paginatedData.map((item, index) => {
|
|
1738
|
-
return /* @__PURE__ */
|
|
1973
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1739
1974
|
ComponentType,
|
|
1740
1975
|
{
|
|
1741
1976
|
key: item.id || item._id || index,
|
|
@@ -1751,7 +1986,7 @@ var Pagination = ({
|
|
|
1751
1986
|
}
|
|
1752
1987
|
}
|
|
1753
1988
|
} else {
|
|
1754
|
-
return /* @__PURE__ */
|
|
1989
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1755
1990
|
CustomTable,
|
|
1756
1991
|
{
|
|
1757
1992
|
tableHeader,
|
|
@@ -1759,7 +1994,7 @@ var Pagination = ({
|
|
|
1759
1994
|
id: `${id}-custom-table-3`
|
|
1760
1995
|
},
|
|
1761
1996
|
paginatedData.map((item, index) => {
|
|
1762
|
-
return /* @__PURE__ */
|
|
1997
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1763
1998
|
Component,
|
|
1764
1999
|
{
|
|
1765
2000
|
key: item.id || item._id || index,
|
|
@@ -1775,7 +2010,7 @@ var Pagination = ({
|
|
|
1775
2010
|
}
|
|
1776
2011
|
return null;
|
|
1777
2012
|
};
|
|
1778
|
-
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(
|
|
1779
2014
|
"button",
|
|
1780
2015
|
{
|
|
1781
2016
|
onClick: () => handlePageChange(1),
|
|
@@ -1784,8 +2019,8 @@ var Pagination = ({
|
|
|
1784
2019
|
title: "First page",
|
|
1785
2020
|
id: `${id}-button-1`
|
|
1786
2021
|
},
|
|
1787
|
-
/* @__PURE__ */
|
|
1788
|
-
), /* @__PURE__ */
|
|
2022
|
+
/* @__PURE__ */ React19.createElement(ChevronsLeft, { size: 16 })
|
|
2023
|
+
), /* @__PURE__ */ React19.createElement(
|
|
1789
2024
|
"button",
|
|
1790
2025
|
{
|
|
1791
2026
|
onClick: () => handlePageChange(currentPage - 1),
|
|
@@ -1794,8 +2029,8 @@ var Pagination = ({
|
|
|
1794
2029
|
title: "Previous page",
|
|
1795
2030
|
id: `${id}-button-2`
|
|
1796
2031
|
},
|
|
1797
|
-
/* @__PURE__ */
|
|
1798
|
-
), getPageNumbers().map((pageNum) => /* @__PURE__ */
|
|
2032
|
+
/* @__PURE__ */ React19.createElement(ChevronLeft, { size: 16 })
|
|
2033
|
+
), getPageNumbers().map((pageNum) => /* @__PURE__ */ React19.createElement(
|
|
1799
2034
|
"button",
|
|
1800
2035
|
{
|
|
1801
2036
|
key: pageNum,
|
|
@@ -1804,7 +2039,7 @@ var Pagination = ({
|
|
|
1804
2039
|
id: `${id}-button-3`
|
|
1805
2040
|
},
|
|
1806
2041
|
pageNum
|
|
1807
|
-
)), /* @__PURE__ */
|
|
2042
|
+
)), /* @__PURE__ */ React19.createElement(
|
|
1808
2043
|
"button",
|
|
1809
2044
|
{
|
|
1810
2045
|
onClick: () => handlePageChange(currentPage + 1),
|
|
@@ -1813,8 +2048,8 @@ var Pagination = ({
|
|
|
1813
2048
|
title: "Next page",
|
|
1814
2049
|
id: `${id}-button-4`
|
|
1815
2050
|
},
|
|
1816
|
-
/* @__PURE__ */
|
|
1817
|
-
), /* @__PURE__ */
|
|
2051
|
+
/* @__PURE__ */ React19.createElement(ChevronRight2, { size: 16 })
|
|
2052
|
+
), /* @__PURE__ */ React19.createElement(
|
|
1818
2053
|
"button",
|
|
1819
2054
|
{
|
|
1820
2055
|
onClick: () => handlePageChange(calculatedTotalPages),
|
|
@@ -1823,11 +2058,12 @@ var Pagination = ({
|
|
|
1823
2058
|
title: "Last page",
|
|
1824
2059
|
id: `${id}-button-5`
|
|
1825
2060
|
},
|
|
1826
|
-
/* @__PURE__ */
|
|
2061
|
+
/* @__PURE__ */ React19.createElement(ChevronsRight, { size: 16 })
|
|
1827
2062
|
))));
|
|
1828
2063
|
};
|
|
1829
2064
|
export {
|
|
1830
2065
|
AppSideBar,
|
|
2066
|
+
Calendar,
|
|
1831
2067
|
Chip,
|
|
1832
2068
|
CustomAutocomplete,
|
|
1833
2069
|
CustomButton,
|
|
@@ -1839,6 +2075,7 @@ export {
|
|
|
1839
2075
|
CustomTable,
|
|
1840
2076
|
CustomTextarea,
|
|
1841
2077
|
CustomUpload,
|
|
2078
|
+
Dropdown,
|
|
1842
2079
|
Pagination,
|
|
1843
2080
|
ProgressBar,
|
|
1844
2081
|
RightSheet
|
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,11 +22,16 @@
|
|
|
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",
|
|
34
|
+
"react-select": "^5.10.2",
|
|
30
35
|
"tailwind-merge": "^3.3.1",
|
|
31
36
|
"tsup": "^8.5.0"
|
|
32
37
|
},
|