@marcoschwartz/lite-ui 0.18.1 → 0.19.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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +65 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -36
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1920,56 +1920,86 @@ var Tabs = ({
|
|
|
1920
1920
|
};
|
|
1921
1921
|
|
|
1922
1922
|
// src/components/Table.tsx
|
|
1923
|
-
import { jsx as jsx90, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1923
|
+
import { Fragment as Fragment14, jsx as jsx90, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1924
1924
|
function Table({
|
|
1925
1925
|
columns,
|
|
1926
1926
|
data,
|
|
1927
1927
|
keyField = "id",
|
|
1928
1928
|
striped = false,
|
|
1929
1929
|
hoverable = true,
|
|
1930
|
-
className = ""
|
|
1930
|
+
className = "",
|
|
1931
|
+
responsive = true
|
|
1931
1932
|
}) {
|
|
1932
1933
|
const { theme } = useTheme();
|
|
1933
|
-
return /* @__PURE__ */ jsxs18(
|
|
1934
|
-
/* @__PURE__ */ jsxs18("
|
|
1935
|
-
/* @__PURE__ */
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1934
|
+
return /* @__PURE__ */ jsxs18(Fragment14, { children: [
|
|
1935
|
+
/* @__PURE__ */ jsxs18("div", { className: `${responsive ? "hidden md:block" : ""} overflow-x-auto ${className}`, children: [
|
|
1936
|
+
/* @__PURE__ */ jsxs18("table", { className: "w-full text-left", children: [
|
|
1937
|
+
/* @__PURE__ */ jsx90("thead", { className: "bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ jsx90("tr", { children: columns.map((column, colIndex) => {
|
|
1938
|
+
const isLast = colIndex === columns.length - 1;
|
|
1939
|
+
return /* @__PURE__ */ jsx90(
|
|
1940
|
+
"th",
|
|
1941
|
+
{
|
|
1942
|
+
className: isLast ? "px-6 py-3 text-xs font-medium text-gray-700 dark:text-gray-300 uppercase tracking-wider relative" : "px-6 py-3 text-xs font-medium text-gray-700 dark:text-gray-300 uppercase tracking-wider",
|
|
1943
|
+
style: { width: column.width },
|
|
1944
|
+
children: column.title
|
|
1945
|
+
},
|
|
1946
|
+
column.key
|
|
1947
|
+
);
|
|
1948
|
+
}) }) }),
|
|
1949
|
+
/* @__PURE__ */ jsx90("tbody", { className: "bg-white dark:bg-gray-900 divide-y divide-gray-200 dark:divide-gray-700", children: data.map((row, rowIndex) => {
|
|
1950
|
+
const rowClasses = [
|
|
1951
|
+
striped && rowIndex % 2 === 1 ? "bg-gray-50 dark:bg-gray-800/50" : "",
|
|
1952
|
+
hoverable ? "hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors" : ""
|
|
1953
|
+
].filter(Boolean).join(" ");
|
|
1954
|
+
return /* @__PURE__ */ jsx90(
|
|
1955
|
+
"tr",
|
|
1956
|
+
{
|
|
1957
|
+
className: rowClasses,
|
|
1958
|
+
children: columns.map((column, colIndex) => {
|
|
1959
|
+
const isLast = colIndex === columns.length - 1;
|
|
1960
|
+
return /* @__PURE__ */ jsx90(
|
|
1961
|
+
"td",
|
|
1962
|
+
{
|
|
1963
|
+
className: isLast ? "px-6 py-4 text-sm text-gray-900 dark:text-gray-100 overflow-visible" : "px-6 py-4 text-sm text-gray-900 dark:text-gray-100",
|
|
1964
|
+
children: column.render ? column.render(row[column.key], row, rowIndex) : row[column.key]
|
|
1965
|
+
},
|
|
1966
|
+
column.key
|
|
1967
|
+
);
|
|
1968
|
+
})
|
|
1969
|
+
},
|
|
1970
|
+
row[keyField] || rowIndex
|
|
1971
|
+
);
|
|
1972
|
+
}) })
|
|
1973
|
+
] }),
|
|
1974
|
+
data.length === 0 && /* @__PURE__ */ jsx90("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: "No data available" })
|
|
1975
|
+
] }),
|
|
1976
|
+
responsive && /* @__PURE__ */ jsxs18("div", { className: `md:hidden space-y-4 ${className}`, children: [
|
|
1977
|
+
data.map((row, rowIndex) => {
|
|
1978
|
+
const cardClasses = [
|
|
1979
|
+
"bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg p-4 shadow-sm",
|
|
1980
|
+
hoverable ? "hover:shadow-md transition-shadow" : ""
|
|
1951
1981
|
].filter(Boolean).join(" ");
|
|
1952
1982
|
return /* @__PURE__ */ jsx90(
|
|
1953
|
-
"
|
|
1983
|
+
"div",
|
|
1954
1984
|
{
|
|
1955
|
-
className:
|
|
1956
|
-
children: columns.map((column
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
"
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
children: column.render ? column.render(row[column.key], row, rowIndex) : row[column.key]
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1985
|
+
className: cardClasses,
|
|
1986
|
+
children: columns.map((column) => /* @__PURE__ */ jsxs18(
|
|
1987
|
+
"div",
|
|
1988
|
+
{
|
|
1989
|
+
className: "flex justify-between items-start py-2 border-b border-gray-100 dark:border-gray-800 last:border-b-0",
|
|
1990
|
+
children: [
|
|
1991
|
+
/* @__PURE__ */ jsx90("span", { className: "text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider flex-shrink-0 mr-4", children: column.title }),
|
|
1992
|
+
/* @__PURE__ */ jsx90("span", { className: "text-sm text-gray-900 dark:text-gray-100 text-right", children: column.render ? column.render(row[column.key], row, rowIndex) : row[column.key] })
|
|
1993
|
+
]
|
|
1994
|
+
},
|
|
1995
|
+
column.key
|
|
1996
|
+
))
|
|
1967
1997
|
},
|
|
1968
1998
|
row[keyField] || rowIndex
|
|
1969
1999
|
);
|
|
1970
|
-
})
|
|
1971
|
-
|
|
1972
|
-
|
|
2000
|
+
}),
|
|
2001
|
+
data.length === 0 && /* @__PURE__ */ jsx90("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: "No data available" })
|
|
2002
|
+
] })
|
|
1973
2003
|
] });
|
|
1974
2004
|
}
|
|
1975
2005
|
|