@mohasinac/ui 1.0.0 → 1.1.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 +617 -59
- package/dist/index.d.cts +196 -56
- package/dist/index.d.ts +196 -56
- package/dist/index.js +601 -58
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -1686,11 +1687,502 @@ function ImageLightbox({
|
|
|
1686
1687
|
);
|
|
1687
1688
|
}
|
|
1688
1689
|
|
|
1690
|
+
// src/components/TagInput.tsx
|
|
1691
|
+
import { useRef as useRef5, useState as useState4 } from "react";
|
|
1692
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1693
|
+
function TagInput({
|
|
1694
|
+
value,
|
|
1695
|
+
onChange,
|
|
1696
|
+
disabled = false,
|
|
1697
|
+
label,
|
|
1698
|
+
placeholder = "Add a tag...",
|
|
1699
|
+
className = "",
|
|
1700
|
+
helperText = "Press Enter or comma to add a tag"
|
|
1701
|
+
}) {
|
|
1702
|
+
const [draft, setDraft] = useState4("");
|
|
1703
|
+
const inputRef = useRef5(null);
|
|
1704
|
+
const addTag = (raw) => {
|
|
1705
|
+
const tag = raw.trim().replace(/,+$/, "").trim();
|
|
1706
|
+
if (!tag || value.includes(tag)) {
|
|
1707
|
+
setDraft("");
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
onChange([...value, tag]);
|
|
1711
|
+
setDraft("");
|
|
1712
|
+
};
|
|
1713
|
+
const removeTag = (tag) => {
|
|
1714
|
+
onChange(value.filter((t) => t !== tag));
|
|
1715
|
+
};
|
|
1716
|
+
const handleKeyDown = (e) => {
|
|
1717
|
+
if (e.key === "Enter" || e.key === ",") {
|
|
1718
|
+
e.preventDefault();
|
|
1719
|
+
addTag(draft);
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1722
|
+
if (e.key === "Backspace" && draft === "" && value.length > 0) {
|
|
1723
|
+
onChange(value.slice(0, -1));
|
|
1724
|
+
}
|
|
1725
|
+
};
|
|
1726
|
+
const handleChange = (e) => {
|
|
1727
|
+
var _a;
|
|
1728
|
+
const inputValue = e.target.value;
|
|
1729
|
+
if (inputValue.includes(",")) {
|
|
1730
|
+
const parts = inputValue.split(",");
|
|
1731
|
+
const last = (_a = parts.pop()) != null ? _a : "";
|
|
1732
|
+
parts.forEach((part) => addTag(part));
|
|
1733
|
+
setDraft(last);
|
|
1734
|
+
return;
|
|
1735
|
+
}
|
|
1736
|
+
setDraft(inputValue);
|
|
1737
|
+
};
|
|
1738
|
+
const handleBlur = () => {
|
|
1739
|
+
if (draft.trim()) {
|
|
1740
|
+
addTag(draft);
|
|
1741
|
+
}
|
|
1742
|
+
};
|
|
1743
|
+
return /* @__PURE__ */ jsxs15("div", { className, children: [
|
|
1744
|
+
label && /* @__PURE__ */ jsx18(Label, { className: "mb-1.5 block text-sm font-medium", children: label }),
|
|
1745
|
+
/* @__PURE__ */ jsxs15(
|
|
1746
|
+
"div",
|
|
1747
|
+
{
|
|
1748
|
+
onClick: () => {
|
|
1749
|
+
var _a;
|
|
1750
|
+
return !disabled && ((_a = inputRef.current) == null ? void 0 : _a.focus());
|
|
1751
|
+
},
|
|
1752
|
+
className: [
|
|
1753
|
+
"flex min-h-[42px] w-full cursor-text flex-wrap items-center gap-1.5 rounded-lg border px-3 py-2",
|
|
1754
|
+
"border-zinc-300 bg-white dark:border-slate-700 dark:bg-slate-900",
|
|
1755
|
+
disabled ? "cursor-not-allowed opacity-50" : "transition-colors focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/30"
|
|
1756
|
+
].join(" "),
|
|
1757
|
+
children: [
|
|
1758
|
+
value.map((tag) => /* @__PURE__ */ jsxs15(
|
|
1759
|
+
"span",
|
|
1760
|
+
{
|
|
1761
|
+
className: "inline-flex items-center gap-1 rounded-full bg-primary-500/10 px-2 py-0.5 text-xs font-medium text-primary-700 dark:text-primary-300",
|
|
1762
|
+
children: [
|
|
1763
|
+
/* @__PURE__ */ jsx18(Span, { size: "xs", children: tag }),
|
|
1764
|
+
!disabled && /* @__PURE__ */ jsx18(
|
|
1765
|
+
"button",
|
|
1766
|
+
{
|
|
1767
|
+
type: "button",
|
|
1768
|
+
onClick: (e) => {
|
|
1769
|
+
e.stopPropagation();
|
|
1770
|
+
removeTag(tag);
|
|
1771
|
+
},
|
|
1772
|
+
className: "ml-0.5 text-primary-700/70 hover:text-primary-700 dark:text-primary-300/70 dark:hover:text-primary-300",
|
|
1773
|
+
"aria-label": `Remove tag ${tag}`,
|
|
1774
|
+
children: "x"
|
|
1775
|
+
}
|
|
1776
|
+
)
|
|
1777
|
+
]
|
|
1778
|
+
},
|
|
1779
|
+
tag
|
|
1780
|
+
)),
|
|
1781
|
+
/* @__PURE__ */ jsx18(
|
|
1782
|
+
"input",
|
|
1783
|
+
{
|
|
1784
|
+
ref: inputRef,
|
|
1785
|
+
value: draft,
|
|
1786
|
+
onChange: handleChange,
|
|
1787
|
+
onKeyDown: handleKeyDown,
|
|
1788
|
+
onBlur: handleBlur,
|
|
1789
|
+
disabled,
|
|
1790
|
+
placeholder: value.length === 0 ? placeholder : "",
|
|
1791
|
+
className: [
|
|
1792
|
+
"min-w-[100px] flex-1 bg-transparent text-sm outline-none",
|
|
1793
|
+
"text-zinc-900 placeholder:text-zinc-400 dark:text-zinc-100 dark:placeholder:text-zinc-500",
|
|
1794
|
+
disabled ? "cursor-not-allowed" : ""
|
|
1795
|
+
].join(" "),
|
|
1796
|
+
"aria-label": label != null ? label : "Tag input"
|
|
1797
|
+
}
|
|
1798
|
+
)
|
|
1799
|
+
]
|
|
1800
|
+
}
|
|
1801
|
+
),
|
|
1802
|
+
helperText && /* @__PURE__ */ jsx18(Span, { size: "xs", className: "mt-1 text-zinc-500 dark:text-zinc-400", children: helperText })
|
|
1803
|
+
] });
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
// src/style.helper.ts
|
|
1807
|
+
function classNames(...classes) {
|
|
1808
|
+
return classes.filter(Boolean).join(" ");
|
|
1809
|
+
}
|
|
1810
|
+
function mergeTailwindClasses(...classes) {
|
|
1811
|
+
const classArray = classes.filter(Boolean).join(" ").split(" ");
|
|
1812
|
+
return Array.from(new Set(classArray)).join(" ");
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
// src/components/StepperNav.tsx
|
|
1816
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1817
|
+
function StepperNav({ steps, currentStep, className }) {
|
|
1818
|
+
return /* @__PURE__ */ jsx19(Nav, { "aria-label": "Steps", className: classNames("mb-8", className), children: /* @__PURE__ */ jsx19(Ol, { className: "flex items-center gap-0", children: steps.map((step, i) => {
|
|
1819
|
+
const isComplete = step.number < currentStep;
|
|
1820
|
+
const isActive = step.number === currentStep;
|
|
1821
|
+
const isLast = i === steps.length - 1;
|
|
1822
|
+
return /* @__PURE__ */ jsxs16(Li, { className: "flex flex-1 items-center", children: [
|
|
1823
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-shrink-0 items-center gap-2", children: [
|
|
1824
|
+
/* @__PURE__ */ jsx19(
|
|
1825
|
+
"div",
|
|
1826
|
+
{
|
|
1827
|
+
className: classNames(
|
|
1828
|
+
"flex h-8 w-8 items-center justify-center rounded-full border-2 text-sm font-semibold transition-colors",
|
|
1829
|
+
isComplete ? "border-primary bg-primary text-white" : isActive ? "border-primary bg-transparent text-primary" : "border-zinc-300 text-zinc-500 dark:border-slate-700 dark:text-zinc-400"
|
|
1830
|
+
),
|
|
1831
|
+
children: isComplete ? /* @__PURE__ */ jsx19(
|
|
1832
|
+
"svg",
|
|
1833
|
+
{
|
|
1834
|
+
className: "h-4 w-4",
|
|
1835
|
+
fill: "none",
|
|
1836
|
+
viewBox: "0 0 24 24",
|
|
1837
|
+
stroke: "currentColor",
|
|
1838
|
+
"aria-hidden": "true",
|
|
1839
|
+
children: /* @__PURE__ */ jsx19(
|
|
1840
|
+
"path",
|
|
1841
|
+
{
|
|
1842
|
+
strokeLinecap: "round",
|
|
1843
|
+
strokeLinejoin: "round",
|
|
1844
|
+
strokeWidth: 2.5,
|
|
1845
|
+
d: "M5 13l4 4L19 7"
|
|
1846
|
+
}
|
|
1847
|
+
)
|
|
1848
|
+
}
|
|
1849
|
+
) : step.number
|
|
1850
|
+
}
|
|
1851
|
+
),
|
|
1852
|
+
/* @__PURE__ */ jsx19(
|
|
1853
|
+
Span,
|
|
1854
|
+
{
|
|
1855
|
+
className: classNames(
|
|
1856
|
+
"hidden text-sm font-medium sm:block",
|
|
1857
|
+
isActive ? "text-primary" : isComplete ? "text-zinc-900 dark:text-zinc-100" : "text-zinc-500 dark:text-zinc-400"
|
|
1858
|
+
),
|
|
1859
|
+
children: step.label
|
|
1860
|
+
}
|
|
1861
|
+
)
|
|
1862
|
+
] }),
|
|
1863
|
+
!isLast && /* @__PURE__ */ jsx19(
|
|
1864
|
+
"div",
|
|
1865
|
+
{
|
|
1866
|
+
className: classNames(
|
|
1867
|
+
"mx-3 h-0.5 flex-1 transition-colors",
|
|
1868
|
+
isComplete ? "bg-primary" : "bg-zinc-200 dark:bg-slate-700"
|
|
1869
|
+
)
|
|
1870
|
+
}
|
|
1871
|
+
)
|
|
1872
|
+
] }, step.number);
|
|
1873
|
+
}) }) });
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
// src/components/ViewToggle.tsx
|
|
1877
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1878
|
+
var ACTIVE = "bg-primary/5 text-primary ring-primary/30 dark:bg-primary/10";
|
|
1879
|
+
var INACTIVE = "text-zinc-500 ring-zinc-200 hover:bg-zinc-100 dark:text-zinc-400 dark:ring-slate-700 dark:hover:bg-slate-800";
|
|
1880
|
+
var DEFAULT_LABELS = {
|
|
1881
|
+
grid: "Grid view",
|
|
1882
|
+
list: "List view",
|
|
1883
|
+
toolbar: "View mode"
|
|
1884
|
+
};
|
|
1885
|
+
function ViewToggle({
|
|
1886
|
+
value,
|
|
1887
|
+
onChange,
|
|
1888
|
+
labels,
|
|
1889
|
+
className
|
|
1890
|
+
}) {
|
|
1891
|
+
const mergedLabels = __spreadValues(__spreadValues({}, DEFAULT_LABELS), labels);
|
|
1892
|
+
return /* @__PURE__ */ jsxs17(
|
|
1893
|
+
"div",
|
|
1894
|
+
{
|
|
1895
|
+
className: ["flex gap-1", className != null ? className : ""].join(" ").trim(),
|
|
1896
|
+
role: "toolbar",
|
|
1897
|
+
"aria-label": mergedLabels.toolbar,
|
|
1898
|
+
children: [
|
|
1899
|
+
/* @__PURE__ */ jsx20(
|
|
1900
|
+
Button,
|
|
1901
|
+
{
|
|
1902
|
+
type: "button",
|
|
1903
|
+
variant: "ghost",
|
|
1904
|
+
size: "sm",
|
|
1905
|
+
onClick: () => onChange("grid"),
|
|
1906
|
+
"aria-label": mergedLabels.grid,
|
|
1907
|
+
"aria-pressed": value === "grid",
|
|
1908
|
+
className: `flex items-center justify-center rounded-lg p-2 ring-1 transition-colors ${value === "grid" ? ACTIVE : INACTIVE}`,
|
|
1909
|
+
children: /* @__PURE__ */ jsx20(
|
|
1910
|
+
"svg",
|
|
1911
|
+
{
|
|
1912
|
+
className: "h-5 w-5",
|
|
1913
|
+
fill: "none",
|
|
1914
|
+
viewBox: "0 0 24 24",
|
|
1915
|
+
stroke: "currentColor",
|
|
1916
|
+
strokeWidth: 1.5,
|
|
1917
|
+
"aria-hidden": "true",
|
|
1918
|
+
children: /* @__PURE__ */ jsx20(
|
|
1919
|
+
"path",
|
|
1920
|
+
{
|
|
1921
|
+
strokeLinecap: "round",
|
|
1922
|
+
strokeLinejoin: "round",
|
|
1923
|
+
d: "M3.75 6A2.25 2.25 0 016 3.75h2.25A2.25 2.25 0 0110.5 6v2.25a2.25 2.25 0 01-2.25 2.25H6a2.25 2.25 0 01-2.25-2.25V6zM3.75 15.75A2.25 2.25 0 016 13.5h2.25a2.25 2.25 0 012.25 2.25V18a2.25 2.25 0 01-2.25 2.25H6A2.25 2.25 0 013.75 18v-2.25zM13.5 6a2.25 2.25 0 012.25-2.25H18A2.25 2.25 0 0120.25 6v2.25A2.25 2.25 0 0118 10.5h-2.25a2.25 2.25 0 01-2.25-2.25V6zM13.5 15.75a2.25 2.25 0 012.25-2.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-2.25A2.25 2.25 0 0113.5 18v-2.25z"
|
|
1924
|
+
}
|
|
1925
|
+
)
|
|
1926
|
+
}
|
|
1927
|
+
)
|
|
1928
|
+
}
|
|
1929
|
+
),
|
|
1930
|
+
/* @__PURE__ */ jsx20(
|
|
1931
|
+
Button,
|
|
1932
|
+
{
|
|
1933
|
+
type: "button",
|
|
1934
|
+
variant: "ghost",
|
|
1935
|
+
size: "sm",
|
|
1936
|
+
onClick: () => onChange("list"),
|
|
1937
|
+
"aria-label": mergedLabels.list,
|
|
1938
|
+
"aria-pressed": value === "list",
|
|
1939
|
+
className: `flex items-center justify-center rounded-lg p-2 ring-1 transition-colors ${value === "list" ? ACTIVE : INACTIVE}`,
|
|
1940
|
+
children: /* @__PURE__ */ jsx20(
|
|
1941
|
+
"svg",
|
|
1942
|
+
{
|
|
1943
|
+
className: "h-5 w-5",
|
|
1944
|
+
fill: "none",
|
|
1945
|
+
viewBox: "0 0 24 24",
|
|
1946
|
+
stroke: "currentColor",
|
|
1947
|
+
strokeWidth: 1.5,
|
|
1948
|
+
"aria-hidden": "true",
|
|
1949
|
+
children: /* @__PURE__ */ jsx20(
|
|
1950
|
+
"path",
|
|
1951
|
+
{
|
|
1952
|
+
strokeLinecap: "round",
|
|
1953
|
+
strokeLinejoin: "round",
|
|
1954
|
+
d: "M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm-.375 5.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
|
|
1955
|
+
}
|
|
1956
|
+
)
|
|
1957
|
+
}
|
|
1958
|
+
)
|
|
1959
|
+
}
|
|
1960
|
+
)
|
|
1961
|
+
]
|
|
1962
|
+
}
|
|
1963
|
+
);
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
// src/components/RatingDisplay.tsx
|
|
1967
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1968
|
+
var sizeClass = {
|
|
1969
|
+
sm: "h-4 w-4",
|
|
1970
|
+
md: "h-5 w-5",
|
|
1971
|
+
lg: "h-6 w-6"
|
|
1972
|
+
};
|
|
1973
|
+
function RatingDisplay({
|
|
1974
|
+
rating,
|
|
1975
|
+
maxRating = 5,
|
|
1976
|
+
size = "sm",
|
|
1977
|
+
showValue = false,
|
|
1978
|
+
className
|
|
1979
|
+
}) {
|
|
1980
|
+
const starSize = sizeClass[size];
|
|
1981
|
+
return /* @__PURE__ */ jsxs18("div", { className: classNames("flex items-center gap-1", className), children: [
|
|
1982
|
+
/* @__PURE__ */ jsx21("div", { className: "flex", children: Array.from({ length: maxRating }, (_, i) => i + 1).map((star) => /* @__PURE__ */ jsx21(
|
|
1983
|
+
"svg",
|
|
1984
|
+
{
|
|
1985
|
+
className: classNames(
|
|
1986
|
+
starSize,
|
|
1987
|
+
star <= rating ? "text-amber-400 dark:text-secondary-500" : "text-zinc-300 dark:text-zinc-700"
|
|
1988
|
+
),
|
|
1989
|
+
fill: "currentColor",
|
|
1990
|
+
viewBox: "0 0 20 20",
|
|
1991
|
+
"aria-hidden": "true",
|
|
1992
|
+
children: /* @__PURE__ */ jsx21("path", { d: "M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" })
|
|
1993
|
+
},
|
|
1994
|
+
star
|
|
1995
|
+
)) }),
|
|
1996
|
+
showValue && /* @__PURE__ */ jsx21(Span, { className: "text-sm font-medium text-zinc-700 dark:text-zinc-300", children: rating.toFixed(1) })
|
|
1997
|
+
] });
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
// src/components/PriceDisplay.tsx
|
|
2001
|
+
import { Fragment as Fragment2, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2002
|
+
function formatCurrency(amount, currency) {
|
|
2003
|
+
return new Intl.NumberFormat("en-IN", {
|
|
2004
|
+
style: "currency",
|
|
2005
|
+
currency,
|
|
2006
|
+
maximumFractionDigits: 2
|
|
2007
|
+
}).format(amount);
|
|
2008
|
+
}
|
|
2009
|
+
function formatPercent(value) {
|
|
2010
|
+
return `${Math.round(value * 100)}%`;
|
|
2011
|
+
}
|
|
2012
|
+
function PriceDisplay({
|
|
2013
|
+
amount,
|
|
2014
|
+
currency = "INR",
|
|
2015
|
+
originalAmount,
|
|
2016
|
+
variant = "compact",
|
|
2017
|
+
className
|
|
2018
|
+
}) {
|
|
2019
|
+
const hasDiscount = originalAmount !== void 0 && originalAmount > amount;
|
|
2020
|
+
const discountPct = hasDiscount ? (originalAmount - amount) / originalAmount : 0;
|
|
2021
|
+
const priceClass = variant === "detail" ? "text-xl font-bold text-primary" : "text-base font-bold text-primary";
|
|
2022
|
+
const originalClass = variant === "detail" ? "text-sm text-zinc-400 line-through dark:text-zinc-500" : "text-xs text-zinc-400 line-through dark:text-zinc-500";
|
|
2023
|
+
return /* @__PURE__ */ jsxs19("div", { className: classNames("flex flex-wrap items-baseline gap-1.5", className), children: [
|
|
2024
|
+
/* @__PURE__ */ jsx22(Span, { className: priceClass, children: formatCurrency(amount, currency) }),
|
|
2025
|
+
hasDiscount && /* @__PURE__ */ jsxs19(Fragment2, { children: [
|
|
2026
|
+
/* @__PURE__ */ jsx22(Span, { className: originalClass, children: formatCurrency(originalAmount, currency) }),
|
|
2027
|
+
/* @__PURE__ */ jsxs19(Span, { className: "rounded bg-emerald-100 px-1 py-0.5 text-xs font-semibold text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400", children: [
|
|
2028
|
+
"-",
|
|
2029
|
+
formatPercent(discountPct)
|
|
2030
|
+
] })
|
|
2031
|
+
] })
|
|
2032
|
+
] });
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
// src/components/StatsGrid.tsx
|
|
2036
|
+
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2037
|
+
var columnsClass = {
|
|
2038
|
+
2: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
2039
|
+
3: "grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3",
|
|
2040
|
+
4: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4"
|
|
2041
|
+
};
|
|
2042
|
+
function StatsGrid({ stats, columns = 3, className }) {
|
|
2043
|
+
return /* @__PURE__ */ jsx23("div", { className: classNames(columnsClass[columns], className), children: stats.map((stat, i) => {
|
|
2044
|
+
var _a;
|
|
2045
|
+
return /* @__PURE__ */ jsx23(
|
|
2046
|
+
"div",
|
|
2047
|
+
{
|
|
2048
|
+
className: "rounded-xl border border-zinc-200 bg-white p-4 dark:border-slate-700 dark:bg-slate-900",
|
|
2049
|
+
children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between", children: [
|
|
2050
|
+
/* @__PURE__ */ jsxs20("div", { children: [
|
|
2051
|
+
/* @__PURE__ */ jsx23(Text, { className: "text-sm font-medium text-zinc-500 dark:text-zinc-400", children: stat.label }),
|
|
2052
|
+
/* @__PURE__ */ jsx23(Text, { className: "mt-1 text-3xl font-bold", children: stat.value })
|
|
2053
|
+
] }),
|
|
2054
|
+
stat.icon && /* @__PURE__ */ jsx23(
|
|
2055
|
+
"div",
|
|
2056
|
+
{
|
|
2057
|
+
className: classNames(
|
|
2058
|
+
(_a = stat.colorClass) != null ? _a : "text-zinc-400 dark:text-zinc-500"
|
|
2059
|
+
),
|
|
2060
|
+
children: stat.icon
|
|
2061
|
+
}
|
|
2062
|
+
)
|
|
2063
|
+
] })
|
|
2064
|
+
},
|
|
2065
|
+
`${stat.label}-${i}`
|
|
2066
|
+
);
|
|
2067
|
+
}) });
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
// src/components/SummaryCard.tsx
|
|
2071
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2072
|
+
function SummaryCard({
|
|
2073
|
+
lines,
|
|
2074
|
+
total,
|
|
2075
|
+
action,
|
|
2076
|
+
className
|
|
2077
|
+
}) {
|
|
2078
|
+
return /* @__PURE__ */ jsxs21(
|
|
2079
|
+
"div",
|
|
2080
|
+
{
|
|
2081
|
+
className: classNames(
|
|
2082
|
+
"space-y-4 rounded-xl border border-zinc-200 bg-white p-5 dark:border-slate-700 dark:bg-slate-900",
|
|
2083
|
+
className
|
|
2084
|
+
),
|
|
2085
|
+
children: [
|
|
2086
|
+
/* @__PURE__ */ jsx24("div", { className: "space-y-2", children: lines.map((line, i) => /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2087
|
+
/* @__PURE__ */ jsx24(Span, { className: "text-zinc-500 dark:text-zinc-400", children: line.label }),
|
|
2088
|
+
/* @__PURE__ */ jsx24(
|
|
2089
|
+
Span,
|
|
2090
|
+
{
|
|
2091
|
+
className: line.muted ? "text-zinc-500 dark:text-zinc-400" : "text-zinc-900 dark:text-zinc-100",
|
|
2092
|
+
children: line.value
|
|
2093
|
+
}
|
|
2094
|
+
)
|
|
2095
|
+
] }, i)) }),
|
|
2096
|
+
/* @__PURE__ */ jsx24(Divider, {}),
|
|
2097
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between", children: [
|
|
2098
|
+
/* @__PURE__ */ jsx24(Span, { className: "font-bold text-zinc-900 dark:text-zinc-100", children: total.label }),
|
|
2099
|
+
/* @__PURE__ */ jsx24(Span, { className: "text-lg font-bold text-primary", children: total.value })
|
|
2100
|
+
] }),
|
|
2101
|
+
action && /* @__PURE__ */ jsx24("div", { children: action })
|
|
2102
|
+
]
|
|
2103
|
+
}
|
|
2104
|
+
);
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
// src/components/CountdownDisplay.tsx
|
|
2108
|
+
import { useEffect as useEffect5, useMemo, useState as useState5 } from "react";
|
|
2109
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2110
|
+
function getRemaining(targetDate) {
|
|
2111
|
+
const now = Date.now();
|
|
2112
|
+
const distance = targetDate.getTime() - now;
|
|
2113
|
+
if (distance <= 0) {
|
|
2114
|
+
return null;
|
|
2115
|
+
}
|
|
2116
|
+
const totalSeconds = Math.floor(distance / 1e3);
|
|
2117
|
+
const days = Math.floor(totalSeconds / 86400);
|
|
2118
|
+
const hours = Math.floor(totalSeconds % 86400 / 3600);
|
|
2119
|
+
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
2120
|
+
const seconds = totalSeconds % 60;
|
|
2121
|
+
return { days, hours, minutes, seconds };
|
|
2122
|
+
}
|
|
2123
|
+
function formatLabel(remaining, format) {
|
|
2124
|
+
const { days, hours, minutes, seconds } = remaining;
|
|
2125
|
+
if (format === "hms") {
|
|
2126
|
+
const totalHours = days * 24 + hours;
|
|
2127
|
+
return `${totalHours}h ${minutes}m ${seconds}s`;
|
|
2128
|
+
}
|
|
2129
|
+
if (format === "dhms") {
|
|
2130
|
+
return `${days}d ${hours}h ${minutes}m ${seconds}s`;
|
|
2131
|
+
}
|
|
2132
|
+
if (days > 0) {
|
|
2133
|
+
return `${days}d ${hours}h ${minutes}m`;
|
|
2134
|
+
}
|
|
2135
|
+
if (hours > 0) {
|
|
2136
|
+
return `${hours}h ${minutes}m ${seconds}s`;
|
|
2137
|
+
}
|
|
2138
|
+
return `${minutes}m ${seconds}s`;
|
|
2139
|
+
}
|
|
2140
|
+
function CountdownDisplay({
|
|
2141
|
+
targetDate,
|
|
2142
|
+
format = "auto",
|
|
2143
|
+
expiredLabel = "Ended",
|
|
2144
|
+
className
|
|
2145
|
+
}) {
|
|
2146
|
+
const [tick, setTick] = useState5(0);
|
|
2147
|
+
useEffect5(() => {
|
|
2148
|
+
const id = window.setInterval(() => {
|
|
2149
|
+
setTick((value) => value + 1);
|
|
2150
|
+
}, 1e3);
|
|
2151
|
+
return () => {
|
|
2152
|
+
window.clearInterval(id);
|
|
2153
|
+
};
|
|
2154
|
+
}, []);
|
|
2155
|
+
const remaining = useMemo(() => getRemaining(targetDate), [targetDate, tick]);
|
|
2156
|
+
const label = remaining ? formatLabel(remaining, format) : expiredLabel;
|
|
2157
|
+
return /* @__PURE__ */ jsx25(Span, { variant: "inherit", className: classNames("tabular-nums", className), children: label });
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
// src/components/ItemRow.tsx
|
|
2161
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2162
|
+
function ItemRow({
|
|
2163
|
+
thumbnail,
|
|
2164
|
+
title,
|
|
2165
|
+
subtitle,
|
|
2166
|
+
rightSlot,
|
|
2167
|
+
actions,
|
|
2168
|
+
className
|
|
2169
|
+
}) {
|
|
2170
|
+
return /* @__PURE__ */ jsxs22("div", { className: classNames("flex items-start gap-4", className), children: [
|
|
2171
|
+
thumbnail && /* @__PURE__ */ jsx26("div", { className: "flex-shrink-0", children: thumbnail }),
|
|
2172
|
+
/* @__PURE__ */ jsxs22("div", { className: "min-w-0 flex-1", children: [
|
|
2173
|
+
/* @__PURE__ */ jsx26(Text, { size: "sm", weight: "medium", className: "line-clamp-2", children: title }),
|
|
2174
|
+
subtitle && /* @__PURE__ */ jsx26(Caption, { className: "mt-0.5", children: subtitle }),
|
|
2175
|
+
actions && /* @__PURE__ */ jsx26("div", { className: "mt-2", children: actions })
|
|
2176
|
+
] }),
|
|
2177
|
+
rightSlot && /* @__PURE__ */ jsx26("div", { className: "flex-shrink-0", children: rightSlot })
|
|
2178
|
+
] });
|
|
2179
|
+
}
|
|
2180
|
+
|
|
1689
2181
|
// src/DataTable.tsx
|
|
1690
|
-
import { useState as
|
|
2182
|
+
import { useState as useState6, useMemo as useMemo2 } from "react";
|
|
1691
2183
|
|
|
1692
2184
|
// src/components/Layout.tsx
|
|
1693
|
-
import { jsx as
|
|
2185
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1694
2186
|
var GAP_MAP = {
|
|
1695
2187
|
none: "",
|
|
1696
2188
|
px: "gap-px",
|
|
@@ -1775,7 +2267,7 @@ function Container(_a) {
|
|
|
1775
2267
|
"children"
|
|
1776
2268
|
]);
|
|
1777
2269
|
const Tag = as != null ? as : "div";
|
|
1778
|
-
return /* @__PURE__ */
|
|
2270
|
+
return /* @__PURE__ */ jsx27(
|
|
1779
2271
|
Tag,
|
|
1780
2272
|
__spreadProps(__spreadValues({
|
|
1781
2273
|
className: [CONTAINER_MAP[size], className].filter(Boolean).join(" ")
|
|
@@ -1805,7 +2297,7 @@ function Stack(_a) {
|
|
|
1805
2297
|
align !== "stretch" ? ITEMS_MAP[align] : "",
|
|
1806
2298
|
className
|
|
1807
2299
|
].filter(Boolean).join(" ");
|
|
1808
|
-
return /* @__PURE__ */
|
|
2300
|
+
return /* @__PURE__ */ jsx27(Tag, __spreadProps(__spreadValues({ className: classes }, props), { children }));
|
|
1809
2301
|
}
|
|
1810
2302
|
function Row(_a) {
|
|
1811
2303
|
var _b = _a, {
|
|
@@ -1834,7 +2326,7 @@ function Row(_a) {
|
|
|
1834
2326
|
wrap ? "flex-wrap" : "",
|
|
1835
2327
|
className
|
|
1836
2328
|
].filter(Boolean).join(" ");
|
|
1837
|
-
return /* @__PURE__ */
|
|
2329
|
+
return /* @__PURE__ */ jsx27(Tag, __spreadProps(__spreadValues({ className: classes }, props), { children }));
|
|
1838
2330
|
}
|
|
1839
2331
|
function Grid(_a) {
|
|
1840
2332
|
var _b = _a, {
|
|
@@ -1853,12 +2345,12 @@ function Grid(_a) {
|
|
|
1853
2345
|
const Tag = as != null ? as : "div";
|
|
1854
2346
|
const baseClass = cols !== void 0 ? GRID_MAP[cols] : "grid";
|
|
1855
2347
|
const classes = [baseClass, GAP_MAP[gap], className].filter(Boolean).join(" ");
|
|
1856
|
-
return /* @__PURE__ */
|
|
2348
|
+
return /* @__PURE__ */ jsx27(Tag, __spreadProps(__spreadValues({ className: classes }, props), { children }));
|
|
1857
2349
|
}
|
|
1858
2350
|
|
|
1859
2351
|
// src/DataTable.tsx
|
|
1860
2352
|
import { mergeTableConfig, DEFAULT_PAGINATION_CONFIG as DEFAULT_PAGINATION_CONFIG2 } from "@mohasinac/contracts";
|
|
1861
|
-
import { Fragment as
|
|
2353
|
+
import { Fragment as Fragment3, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1862
2354
|
function DataTable({
|
|
1863
2355
|
data,
|
|
1864
2356
|
columns,
|
|
@@ -1897,10 +2389,10 @@ function DataTable({
|
|
|
1897
2389
|
const showViewToggle = showViewToggleProp != null ? showViewToggleProp : resolvedTable.showViewToggle;
|
|
1898
2390
|
const selectable = selectableProp != null ? selectableProp : resolvedTable.selectable;
|
|
1899
2391
|
const defaultViewMode = defaultViewModeProp != null ? defaultViewModeProp : resolvedTable.defaultViewMode;
|
|
1900
|
-
const [sortKey, setSortKey] =
|
|
1901
|
-
const [sortDirection, setSortDirection] =
|
|
1902
|
-
const [currentPage, setCurrentPage] =
|
|
1903
|
-
const [internalViewMode, setInternalViewMode] =
|
|
2392
|
+
const [sortKey, setSortKey] = useState6(null);
|
|
2393
|
+
const [sortDirection, setSortDirection] = useState6(null);
|
|
2394
|
+
const [currentPage, setCurrentPage] = useState6(1);
|
|
2395
|
+
const [internalViewMode, setInternalViewMode] = useState6(defaultViewMode);
|
|
1904
2396
|
const activeViewMode = controlledViewMode != null ? controlledViewMode : internalViewMode;
|
|
1905
2397
|
const {
|
|
1906
2398
|
loading: labelLoading = "Loading\u2026",
|
|
@@ -1929,7 +2421,7 @@ function DataTable({
|
|
|
1929
2421
|
setSortDirection("asc");
|
|
1930
2422
|
}
|
|
1931
2423
|
};
|
|
1932
|
-
const sortedData =
|
|
2424
|
+
const sortedData = useMemo2(() => {
|
|
1933
2425
|
const sorted = [...data];
|
|
1934
2426
|
if (sortKey && sortDirection) {
|
|
1935
2427
|
sorted.sort((a, b) => {
|
|
@@ -1947,19 +2439,19 @@ function DataTable({
|
|
|
1947
2439
|
}
|
|
1948
2440
|
return sorted;
|
|
1949
2441
|
}, [data, sortKey, sortDirection]);
|
|
1950
|
-
const paginatedData =
|
|
2442
|
+
const paginatedData = useMemo2(() => {
|
|
1951
2443
|
if (externalPagination) return sortedData;
|
|
1952
2444
|
const start = (currentPage - 1) * pageSize;
|
|
1953
2445
|
return sortedData.slice(start, start + pageSize);
|
|
1954
2446
|
}, [sortedData, currentPage, externalPagination, pageSize]);
|
|
1955
2447
|
const totalPages = Math.ceil(sortedData.length / pageSize);
|
|
1956
2448
|
if (loading) {
|
|
1957
|
-
return /* @__PURE__ */
|
|
2449
|
+
return /* @__PURE__ */ jsx28("div", { className: "rounded-2xl border border-zinc-200 dark:border-slate-700 overflow-hidden", children: /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ jsx28(Spinner, { size: "lg", label: labelLoading }) }) });
|
|
1958
2450
|
}
|
|
1959
2451
|
if (data.length === 0) {
|
|
1960
|
-
if (emptyState) return /* @__PURE__ */
|
|
1961
|
-
return /* @__PURE__ */
|
|
1962
|
-
emptyIcon != null ? emptyIcon : /* @__PURE__ */
|
|
2452
|
+
if (emptyState) return /* @__PURE__ */ jsx28(Fragment3, { children: emptyState });
|
|
2453
|
+
return /* @__PURE__ */ jsx28("div", { className: "rounded-2xl border border-zinc-200 dark:border-slate-700 overflow-hidden", children: /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ jsxs23("div", { className: "text-center px-4", children: [
|
|
2454
|
+
emptyIcon != null ? emptyIcon : /* @__PURE__ */ jsx28(
|
|
1963
2455
|
"svg",
|
|
1964
2456
|
{
|
|
1965
2457
|
className: "mx-auto h-12 w-12 text-zinc-400",
|
|
@@ -1967,7 +2459,7 @@ function DataTable({
|
|
|
1967
2459
|
viewBox: "0 0 24 24",
|
|
1968
2460
|
stroke: "currentColor",
|
|
1969
2461
|
"aria-hidden": "true",
|
|
1970
|
-
children: /* @__PURE__ */
|
|
2462
|
+
children: /* @__PURE__ */ jsx28(
|
|
1971
2463
|
"path",
|
|
1972
2464
|
{
|
|
1973
2465
|
strokeLinecap: "round",
|
|
@@ -1978,20 +2470,20 @@ function DataTable({
|
|
|
1978
2470
|
)
|
|
1979
2471
|
}
|
|
1980
2472
|
),
|
|
1981
|
-
/* @__PURE__ */
|
|
1982
|
-
/* @__PURE__ */
|
|
2473
|
+
/* @__PURE__ */ jsx28(Text, { size: "sm", weight: "semibold", className: "mt-4", children: emptyTitle != null ? emptyTitle : noDataTitle }),
|
|
2474
|
+
/* @__PURE__ */ jsx28(Text, { size: "sm", variant: "secondary", className: "mt-1", children: emptyMessage != null ? emptyMessage : noDataDescription })
|
|
1983
2475
|
] }) }) });
|
|
1984
2476
|
}
|
|
1985
2477
|
const renderViewToggle = () => {
|
|
1986
2478
|
if (!showViewToggle) return null;
|
|
1987
|
-
return /* @__PURE__ */
|
|
2479
|
+
return /* @__PURE__ */ jsxs23(
|
|
1988
2480
|
"div",
|
|
1989
2481
|
{
|
|
1990
2482
|
className: "flex justify-end gap-1",
|
|
1991
2483
|
role: "toolbar",
|
|
1992
2484
|
"aria-label": "View mode",
|
|
1993
2485
|
children: [
|
|
1994
|
-
showTableView && /* @__PURE__ */
|
|
2486
|
+
showTableView && /* @__PURE__ */ jsx28(
|
|
1995
2487
|
Button,
|
|
1996
2488
|
{
|
|
1997
2489
|
type: "button",
|
|
@@ -2001,7 +2493,7 @@ function DataTable({
|
|
|
2001
2493
|
"aria-label": tableView,
|
|
2002
2494
|
"aria-pressed": activeViewMode === "table",
|
|
2003
2495
|
className: `hidden sm:flex items-center justify-center p-2 rounded-lg ring-1 transition-colors ${activeViewMode === "table" ? "bg-primary/5 text-primary dark:bg-primary/10 ring-primary/30" : "text-zinc-500 dark:text-zinc-400 ring-zinc-200 dark:ring-slate-700 hover:bg-zinc-100 dark:hover:bg-slate-800"}`,
|
|
2004
|
-
children: /* @__PURE__ */
|
|
2496
|
+
children: /* @__PURE__ */ jsx28(
|
|
2005
2497
|
"svg",
|
|
2006
2498
|
{
|
|
2007
2499
|
className: "w-4 h-4",
|
|
@@ -2010,7 +2502,7 @@ function DataTable({
|
|
|
2010
2502
|
stroke: "currentColor",
|
|
2011
2503
|
strokeWidth: 1.5,
|
|
2012
2504
|
"aria-hidden": "true",
|
|
2013
|
-
children: /* @__PURE__ */
|
|
2505
|
+
children: /* @__PURE__ */ jsx28(
|
|
2014
2506
|
"path",
|
|
2015
2507
|
{
|
|
2016
2508
|
strokeLinecap: "round",
|
|
@@ -2022,7 +2514,7 @@ function DataTable({
|
|
|
2022
2514
|
)
|
|
2023
2515
|
}
|
|
2024
2516
|
),
|
|
2025
|
-
/* @__PURE__ */
|
|
2517
|
+
/* @__PURE__ */ jsx28(
|
|
2026
2518
|
Button,
|
|
2027
2519
|
{
|
|
2028
2520
|
type: "button",
|
|
@@ -2032,7 +2524,7 @@ function DataTable({
|
|
|
2032
2524
|
"aria-label": gridView,
|
|
2033
2525
|
"aria-pressed": activeViewMode === "grid",
|
|
2034
2526
|
className: `flex items-center justify-center p-2 rounded-lg ring-1 transition-colors ${activeViewMode === "grid" ? "bg-primary/5 text-primary dark:bg-primary/10 ring-primary/30" : "text-zinc-500 dark:text-zinc-400 ring-zinc-200 dark:ring-slate-700 hover:bg-zinc-100 dark:hover:bg-slate-800"}`,
|
|
2035
|
-
children: /* @__PURE__ */
|
|
2527
|
+
children: /* @__PURE__ */ jsx28(
|
|
2036
2528
|
"svg",
|
|
2037
2529
|
{
|
|
2038
2530
|
className: "w-4 h-4",
|
|
@@ -2041,7 +2533,7 @@ function DataTable({
|
|
|
2041
2533
|
stroke: "currentColor",
|
|
2042
2534
|
strokeWidth: 1.5,
|
|
2043
2535
|
"aria-hidden": "true",
|
|
2044
|
-
children: /* @__PURE__ */
|
|
2536
|
+
children: /* @__PURE__ */ jsx28(
|
|
2045
2537
|
"path",
|
|
2046
2538
|
{
|
|
2047
2539
|
strokeLinecap: "round",
|
|
@@ -2053,7 +2545,7 @@ function DataTable({
|
|
|
2053
2545
|
)
|
|
2054
2546
|
}
|
|
2055
2547
|
),
|
|
2056
|
-
/* @__PURE__ */
|
|
2548
|
+
/* @__PURE__ */ jsx28(
|
|
2057
2549
|
Button,
|
|
2058
2550
|
{
|
|
2059
2551
|
type: "button",
|
|
@@ -2063,7 +2555,7 @@ function DataTable({
|
|
|
2063
2555
|
"aria-label": listView,
|
|
2064
2556
|
"aria-pressed": activeViewMode === "list",
|
|
2065
2557
|
className: `flex items-center justify-center p-2 rounded-lg ring-1 transition-colors ${activeViewMode === "list" ? "bg-primary/5 text-primary dark:bg-primary/10 ring-primary/30" : "text-zinc-500 dark:text-zinc-400 ring-zinc-200 dark:ring-slate-700 hover:bg-zinc-100 dark:hover:bg-slate-800"}`,
|
|
2066
|
-
children: /* @__PURE__ */
|
|
2558
|
+
children: /* @__PURE__ */ jsx28(
|
|
2067
2559
|
"svg",
|
|
2068
2560
|
{
|
|
2069
2561
|
className: "w-4 h-4",
|
|
@@ -2072,7 +2564,7 @@ function DataTable({
|
|
|
2072
2564
|
stroke: "currentColor",
|
|
2073
2565
|
strokeWidth: 1.5,
|
|
2074
2566
|
"aria-hidden": "true",
|
|
2075
|
-
children: /* @__PURE__ */
|
|
2567
|
+
children: /* @__PURE__ */ jsx28(
|
|
2076
2568
|
"path",
|
|
2077
2569
|
{
|
|
2078
2570
|
strokeLinecap: "round",
|
|
@@ -2090,11 +2582,11 @@ function DataTable({
|
|
|
2090
2582
|
};
|
|
2091
2583
|
const renderCardGrid = (mode) => {
|
|
2092
2584
|
if (!mobileCardRender) return null;
|
|
2093
|
-
return /* @__PURE__ */
|
|
2585
|
+
return /* @__PURE__ */ jsx28(
|
|
2094
2586
|
"div",
|
|
2095
2587
|
{
|
|
2096
2588
|
className: mode === "grid" ? `${GRID_MAP[gridCols]} gap-6` : "flex flex-col gap-4",
|
|
2097
|
-
children: paginatedData.map((item) => /* @__PURE__ */
|
|
2589
|
+
children: paginatedData.map((item) => /* @__PURE__ */ jsx28(
|
|
2098
2590
|
SelectableCard,
|
|
2099
2591
|
{
|
|
2100
2592
|
id: keyExtractor(item),
|
|
@@ -2111,10 +2603,10 @@ function DataTable({
|
|
|
2111
2603
|
}
|
|
2112
2604
|
);
|
|
2113
2605
|
};
|
|
2114
|
-
return /* @__PURE__ */
|
|
2606
|
+
return /* @__PURE__ */ jsxs23("div", { className: "space-y-4", children: [
|
|
2115
2607
|
renderViewToggle(),
|
|
2116
2608
|
activeViewMode !== "table" && mobileCardRender && renderCardGrid(activeViewMode),
|
|
2117
|
-
activeViewMode === "table" && mobileCardRender && /* @__PURE__ */
|
|
2609
|
+
activeViewMode === "table" && mobileCardRender && /* @__PURE__ */ jsx28("div", { className: "md:hidden space-y-6", children: paginatedData.map((item) => /* @__PURE__ */ jsx28(
|
|
2118
2610
|
SelectableCard,
|
|
2119
2611
|
{
|
|
2120
2612
|
id: keyExtractor(item),
|
|
@@ -2127,17 +2619,17 @@ function DataTable({
|
|
|
2127
2619
|
},
|
|
2128
2620
|
keyExtractor(item)
|
|
2129
2621
|
)) }),
|
|
2130
|
-
activeViewMode === "table" && /* @__PURE__ */
|
|
2622
|
+
activeViewMode === "table" && /* @__PURE__ */ jsx28("div", { className: "rounded-2xl border border-zinc-200 dark:border-slate-700 overflow-hidden", children: /* @__PURE__ */ jsx28(
|
|
2131
2623
|
"div",
|
|
2132
2624
|
{
|
|
2133
2625
|
className: `overflow-x-auto ${stickyHeader ? "max-h-[600px] overflow-y-auto" : ""}`,
|
|
2134
|
-
children: /* @__PURE__ */
|
|
2135
|
-
/* @__PURE__ */
|
|
2626
|
+
children: /* @__PURE__ */ jsxs23("table", { className: "min-w-full divide-y divide-zinc-200 dark:divide-slate-700", children: [
|
|
2627
|
+
/* @__PURE__ */ jsx28(
|
|
2136
2628
|
"thead",
|
|
2137
2629
|
{
|
|
2138
2630
|
className: `bg-zinc-50 dark:bg-slate-800 ${stickyHeader ? "sticky top-0 z-10" : ""}`,
|
|
2139
|
-
children: /* @__PURE__ */
|
|
2140
|
-
selectable && /* @__PURE__ */
|
|
2631
|
+
children: /* @__PURE__ */ jsxs23("tr", { children: [
|
|
2632
|
+
selectable && /* @__PURE__ */ jsx28("th", { scope: "col", className: "px-4 py-3 w-8", children: /* @__PURE__ */ jsx28(
|
|
2141
2633
|
"input",
|
|
2142
2634
|
{
|
|
2143
2635
|
type: "checkbox",
|
|
@@ -2156,7 +2648,7 @@ function DataTable({
|
|
|
2156
2648
|
}
|
|
2157
2649
|
}
|
|
2158
2650
|
) }),
|
|
2159
|
-
columns.map((col) => /* @__PURE__ */
|
|
2651
|
+
columns.map((col) => /* @__PURE__ */ jsx28(
|
|
2160
2652
|
"th",
|
|
2161
2653
|
{
|
|
2162
2654
|
scope: "col",
|
|
@@ -2164,14 +2656,14 @@ function DataTable({
|
|
|
2164
2656
|
className: `px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider ${col.sortable ? "cursor-pointer select-none hover:bg-zinc-100 dark:hover:bg-slate-700" : ""}`,
|
|
2165
2657
|
style: { width: col.width },
|
|
2166
2658
|
onClick: () => col.sortable && handleSort(col.key),
|
|
2167
|
-
children: /* @__PURE__ */
|
|
2659
|
+
children: /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2", children: [
|
|
2168
2660
|
col.header,
|
|
2169
|
-
col.sortable && /* @__PURE__ */
|
|
2661
|
+
col.sortable && /* @__PURE__ */ jsx28("span", { className: "text-zinc-400", "aria-hidden": "true", children: sortKey === col.key ? sortDirection === "asc" ? "\u2191" : "\u2193" : /* @__PURE__ */ jsx28("span", { className: "opacity-30", children: "\u2195" }) })
|
|
2170
2662
|
] })
|
|
2171
2663
|
},
|
|
2172
2664
|
col.key
|
|
2173
2665
|
)),
|
|
2174
|
-
actions && /* @__PURE__ */
|
|
2666
|
+
actions && /* @__PURE__ */ jsx28(
|
|
2175
2667
|
"th",
|
|
2176
2668
|
{
|
|
2177
2669
|
scope: "col",
|
|
@@ -2182,7 +2674,7 @@ function DataTable({
|
|
|
2182
2674
|
] })
|
|
2183
2675
|
}
|
|
2184
2676
|
),
|
|
2185
|
-
/* @__PURE__ */
|
|
2677
|
+
/* @__PURE__ */ jsx28("tbody", { className: "bg-white dark:bg-slate-900 divide-y divide-zinc-200 dark:divide-slate-700", children: paginatedData.map((item, index) => /* @__PURE__ */ jsxs23(
|
|
2186
2678
|
"tr",
|
|
2187
2679
|
{
|
|
2188
2680
|
className: [
|
|
@@ -2192,12 +2684,12 @@ function DataTable({
|
|
|
2192
2684
|
].join(" "),
|
|
2193
2685
|
onClick: () => onRowClick == null ? void 0 : onRowClick(item),
|
|
2194
2686
|
children: [
|
|
2195
|
-
selectable && /* @__PURE__ */
|
|
2687
|
+
selectable && /* @__PURE__ */ jsx28(
|
|
2196
2688
|
"td",
|
|
2197
2689
|
{
|
|
2198
2690
|
className: "px-4 py-4 w-8",
|
|
2199
2691
|
onClick: (e) => e.stopPropagation(),
|
|
2200
|
-
children: /* @__PURE__ */
|
|
2692
|
+
children: /* @__PURE__ */ jsx28(
|
|
2201
2693
|
"input",
|
|
2202
2694
|
{
|
|
2203
2695
|
type: "checkbox",
|
|
@@ -2216,7 +2708,7 @@ function DataTable({
|
|
|
2216
2708
|
),
|
|
2217
2709
|
columns.map((col) => {
|
|
2218
2710
|
var _a;
|
|
2219
|
-
return /* @__PURE__ */
|
|
2711
|
+
return /* @__PURE__ */ jsx28(
|
|
2220
2712
|
"td",
|
|
2221
2713
|
{
|
|
2222
2714
|
className: "px-6 py-4 whitespace-nowrap text-sm text-zinc-900 dark:text-zinc-100",
|
|
@@ -2225,7 +2717,7 @@ function DataTable({
|
|
|
2225
2717
|
col.key
|
|
2226
2718
|
);
|
|
2227
2719
|
}),
|
|
2228
|
-
actions && /* @__PURE__ */
|
|
2720
|
+
actions && /* @__PURE__ */ jsx28(
|
|
2229
2721
|
"td",
|
|
2230
2722
|
{
|
|
2231
2723
|
className: "px-6 py-4 whitespace-nowrap text-right text-sm font-medium",
|
|
@@ -2240,7 +2732,7 @@ function DataTable({
|
|
|
2240
2732
|
] })
|
|
2241
2733
|
}
|
|
2242
2734
|
) }),
|
|
2243
|
-
!externalPagination && totalPages > 1 && /* @__PURE__ */
|
|
2735
|
+
!externalPagination && totalPages > 1 && /* @__PURE__ */ jsx28("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx28(
|
|
2244
2736
|
Pagination,
|
|
2245
2737
|
{
|
|
2246
2738
|
currentPage,
|
|
@@ -2262,9 +2754,9 @@ function SelectableCard({
|
|
|
2262
2754
|
children,
|
|
2263
2755
|
listMode = false
|
|
2264
2756
|
}) {
|
|
2265
|
-
if (!selectable) return /* @__PURE__ */
|
|
2266
|
-
return /* @__PURE__ */
|
|
2267
|
-
/* @__PURE__ */
|
|
2757
|
+
if (!selectable) return /* @__PURE__ */ jsx28("div", { className: "h-full", children });
|
|
2758
|
+
return /* @__PURE__ */ jsxs23("div", { className: "relative group h-full", children: [
|
|
2759
|
+
/* @__PURE__ */ jsx28(
|
|
2268
2760
|
"div",
|
|
2269
2761
|
{
|
|
2270
2762
|
className: [
|
|
@@ -2272,8 +2764,8 @@ function SelectableCard({
|
|
|
2272
2764
|
listMode ? "left-2 top-1/2 -translate-y-1/2" : "top-2 left-2"
|
|
2273
2765
|
].join(" "),
|
|
2274
2766
|
onClick: (e) => e.stopPropagation(),
|
|
2275
|
-
children: /* @__PURE__ */
|
|
2276
|
-
/* @__PURE__ */
|
|
2767
|
+
children: /* @__PURE__ */ jsx28("div", { className: "w-6 h-6 rounded-md bg-white/95 dark:bg-slate-800/95 shadow-md flex items-center justify-center", children: /* @__PURE__ */ jsxs23("div", { className: "relative flex items-center justify-center", children: [
|
|
2768
|
+
/* @__PURE__ */ jsx28(
|
|
2277
2769
|
"input",
|
|
2278
2770
|
{
|
|
2279
2771
|
type: "checkbox",
|
|
@@ -2286,7 +2778,7 @@ function SelectableCard({
|
|
|
2286
2778
|
"aria-label": "Select item"
|
|
2287
2779
|
}
|
|
2288
2780
|
),
|
|
2289
|
-
selected && /* @__PURE__ */
|
|
2781
|
+
selected && /* @__PURE__ */ jsx28(
|
|
2290
2782
|
"svg",
|
|
2291
2783
|
{
|
|
2292
2784
|
className: "absolute inset-0 m-auto w-2.5 h-2.5 text-white pointer-events-none",
|
|
@@ -2294,7 +2786,7 @@ function SelectableCard({
|
|
|
2294
2786
|
stroke: "currentColor",
|
|
2295
2787
|
viewBox: "0 0 24 24",
|
|
2296
2788
|
"aria-hidden": "true",
|
|
2297
|
-
children: /* @__PURE__ */
|
|
2789
|
+
children: /* @__PURE__ */ jsx28(
|
|
2298
2790
|
"path",
|
|
2299
2791
|
{
|
|
2300
2792
|
strokeLinecap: "round",
|
|
@@ -2308,7 +2800,7 @@ function SelectableCard({
|
|
|
2308
2800
|
] }) })
|
|
2309
2801
|
}
|
|
2310
2802
|
),
|
|
2311
|
-
selected && /* @__PURE__ */
|
|
2803
|
+
selected && /* @__PURE__ */ jsx28(
|
|
2312
2804
|
"div",
|
|
2313
2805
|
{
|
|
2314
2806
|
className: "absolute inset-0 z-[5] rounded-xl ring-2 ring-primary ring-offset-0 pointer-events-none",
|
|
@@ -2326,6 +2818,42 @@ import {
|
|
|
2326
2818
|
DEFAULT_STICKY_CONFIG,
|
|
2327
2819
|
mergeTableConfig as mergeTableConfig2
|
|
2328
2820
|
} from "@mohasinac/contracts";
|
|
2821
|
+
|
|
2822
|
+
// src/animation.helper.ts
|
|
2823
|
+
var easings = {
|
|
2824
|
+
linear: (t) => t,
|
|
2825
|
+
easeInQuad: (t) => t * t,
|
|
2826
|
+
easeOutQuad: (t) => t * (2 - t),
|
|
2827
|
+
easeInOutQuad: (t) => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t,
|
|
2828
|
+
easeInCubic: (t) => t * t * t,
|
|
2829
|
+
easeOutCubic: (t) => --t * t * t + 1,
|
|
2830
|
+
easeInOutCubic: (t) => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1,
|
|
2831
|
+
easeInQuart: (t) => t * t * t * t,
|
|
2832
|
+
easeOutQuart: (t) => 1 - --t * t * t * t,
|
|
2833
|
+
easeInOutQuart: (t) => t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t
|
|
2834
|
+
};
|
|
2835
|
+
|
|
2836
|
+
// src/color.helper.ts
|
|
2837
|
+
function hexToRgb(hex) {
|
|
2838
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
2839
|
+
return result ? {
|
|
2840
|
+
r: parseInt(result[1], 16),
|
|
2841
|
+
g: parseInt(result[2], 16),
|
|
2842
|
+
b: parseInt(result[3], 16)
|
|
2843
|
+
} : null;
|
|
2844
|
+
}
|
|
2845
|
+
function rgbToHex(r, g, b) {
|
|
2846
|
+
return "#" + [r, g, b].map((x) => {
|
|
2847
|
+
const hex = x.toString(16);
|
|
2848
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
2849
|
+
}).join("");
|
|
2850
|
+
}
|
|
2851
|
+
function getContrastColor(hex) {
|
|
2852
|
+
const rgb = hexToRgb(hex);
|
|
2853
|
+
if (!rgb) return "#000000";
|
|
2854
|
+
const luminance = (0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b) / 255;
|
|
2855
|
+
return luminance > 0.5 ? "#000000" : "#ffffff";
|
|
2856
|
+
}
|
|
2329
2857
|
export {
|
|
2330
2858
|
Alert,
|
|
2331
2859
|
Article,
|
|
@@ -2337,6 +2865,7 @@ export {
|
|
|
2337
2865
|
Button,
|
|
2338
2866
|
Caption,
|
|
2339
2867
|
Container,
|
|
2868
|
+
CountdownDisplay,
|
|
2340
2869
|
DEFAULT_PAGINATION_CONFIG3 as DEFAULT_PAGINATION_CONFIG,
|
|
2341
2870
|
DEFAULT_STICKY_CONFIG,
|
|
2342
2871
|
DEFAULT_TABLE_CONFIG,
|
|
@@ -2348,6 +2877,7 @@ export {
|
|
|
2348
2877
|
Heading,
|
|
2349
2878
|
ImageLightbox,
|
|
2350
2879
|
IndeterminateProgress,
|
|
2880
|
+
ItemRow,
|
|
2351
2881
|
Label,
|
|
2352
2882
|
Li,
|
|
2353
2883
|
Main,
|
|
@@ -2355,7 +2885,9 @@ export {
|
|
|
2355
2885
|
Nav,
|
|
2356
2886
|
Ol,
|
|
2357
2887
|
Pagination,
|
|
2888
|
+
PriceDisplay,
|
|
2358
2889
|
Progress,
|
|
2890
|
+
RatingDisplay,
|
|
2359
2891
|
Row,
|
|
2360
2892
|
Section,
|
|
2361
2893
|
Select,
|
|
@@ -2364,8 +2896,19 @@ export {
|
|
|
2364
2896
|
Spinner,
|
|
2365
2897
|
Stack,
|
|
2366
2898
|
StarRating,
|
|
2899
|
+
StatsGrid,
|
|
2367
2900
|
StatusBadge,
|
|
2901
|
+
StepperNav,
|
|
2902
|
+
SummaryCard,
|
|
2903
|
+
TagInput,
|
|
2368
2904
|
Text,
|
|
2369
2905
|
Ul,
|
|
2370
|
-
|
|
2906
|
+
ViewToggle,
|
|
2907
|
+
classNames,
|
|
2908
|
+
easings,
|
|
2909
|
+
getContrastColor,
|
|
2910
|
+
hexToRgb,
|
|
2911
|
+
mergeTableConfig2 as mergeTableConfig,
|
|
2912
|
+
mergeTailwindClasses,
|
|
2913
|
+
rgbToHex
|
|
2371
2914
|
};
|