@underverse-ui/underverse 0.2.8 → 0.2.10
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 +51 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +56 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1405,6 +1405,7 @@ interface DataTableProps<T> {
|
|
|
1405
1405
|
toolbar?: React__default.ReactNode;
|
|
1406
1406
|
enableColumnVisibilityToggle?: boolean;
|
|
1407
1407
|
enableDensityToggle?: boolean;
|
|
1408
|
+
enableHeaderAlignToggle?: boolean;
|
|
1408
1409
|
striped?: boolean;
|
|
1409
1410
|
/** Hiển thị đường kẻ dọc ngăn cách giữa các cột */
|
|
1410
1411
|
columnDividers?: boolean;
|
|
@@ -1415,9 +1416,13 @@ interface DataTableProps<T> {
|
|
|
1415
1416
|
compact?: string;
|
|
1416
1417
|
normal?: string;
|
|
1417
1418
|
comfortable?: string;
|
|
1419
|
+
headerAlign?: string;
|
|
1420
|
+
alignLeft?: string;
|
|
1421
|
+
alignCenter?: string;
|
|
1422
|
+
alignRight?: string;
|
|
1418
1423
|
};
|
|
1419
1424
|
}
|
|
1420
|
-
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, enableColumnVisibilityToggle, enableDensityToggle, striped, // Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
1425
|
+
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, enableColumnVisibilityToggle, enableDensityToggle, enableHeaderAlignToggle, striped, // Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
1421
1426
|
columnDividers, className, labels, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1422
1427
|
|
|
1423
1428
|
interface TableProps extends React__default.HTMLAttributes<HTMLTableElement> {
|
package/dist/index.d.ts
CHANGED
|
@@ -1405,6 +1405,7 @@ interface DataTableProps<T> {
|
|
|
1405
1405
|
toolbar?: React__default.ReactNode;
|
|
1406
1406
|
enableColumnVisibilityToggle?: boolean;
|
|
1407
1407
|
enableDensityToggle?: boolean;
|
|
1408
|
+
enableHeaderAlignToggle?: boolean;
|
|
1408
1409
|
striped?: boolean;
|
|
1409
1410
|
/** Hiển thị đường kẻ dọc ngăn cách giữa các cột */
|
|
1410
1411
|
columnDividers?: boolean;
|
|
@@ -1415,9 +1416,13 @@ interface DataTableProps<T> {
|
|
|
1415
1416
|
compact?: string;
|
|
1416
1417
|
normal?: string;
|
|
1417
1418
|
comfortable?: string;
|
|
1419
|
+
headerAlign?: string;
|
|
1420
|
+
alignLeft?: string;
|
|
1421
|
+
alignCenter?: string;
|
|
1422
|
+
alignRight?: string;
|
|
1418
1423
|
};
|
|
1419
1424
|
}
|
|
1420
|
-
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, enableColumnVisibilityToggle, enableDensityToggle, striped, // Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
1425
|
+
declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, pageSizeOptions, onQueryChange, caption, toolbar, enableColumnVisibilityToggle, enableDensityToggle, enableHeaderAlignToggle, striped, // Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
1421
1426
|
columnDividers, className, labels, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1422
1427
|
|
|
1423
1428
|
interface TableProps extends React__default.HTMLAttributes<HTMLTableElement> {
|
package/dist/index.js
CHANGED
|
@@ -2177,6 +2177,7 @@ var Modal = ({
|
|
|
2177
2177
|
if (!isMounted || !isOpen && !isVisible) {
|
|
2178
2178
|
return null;
|
|
2179
2179
|
}
|
|
2180
|
+
const maxWidthClass = width ? "max-w-none" : fullWidth ? "max-w-full" : sizeStyles3[size];
|
|
2180
2181
|
const modalContent = /* @__PURE__ */ jsxs11("div", { className: cn("fixed inset-0 z-[9999] flex items-center justify-center", overlayClassName), onClick: handleOverlayClick, children: [
|
|
2181
2182
|
/* @__PURE__ */ jsx13(
|
|
2182
2183
|
"div",
|
|
@@ -2191,9 +2192,9 @@ var Modal = ({
|
|
|
2191
2192
|
"div",
|
|
2192
2193
|
{
|
|
2193
2194
|
className: cn(
|
|
2194
|
-
"relative w-full rounded-lg
|
|
2195
|
+
"relative w-full rounded-lg bg-card text-card-foreground shadow-xl",
|
|
2195
2196
|
"transition-all duration-200 ease-out",
|
|
2196
|
-
|
|
2197
|
+
maxWidthClass,
|
|
2197
2198
|
fullWidth && "mx-0",
|
|
2198
2199
|
className
|
|
2199
2200
|
),
|
|
@@ -9879,7 +9880,7 @@ TableCaption.displayName = "TableCaption";
|
|
|
9879
9880
|
import { Filter as FilterIcon } from "lucide-react";
|
|
9880
9881
|
import React37 from "react";
|
|
9881
9882
|
import { useTranslations as useTranslations7 } from "next-intl";
|
|
9882
|
-
import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9883
|
+
import { Fragment as Fragment17, jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9883
9884
|
function useDebounced(value, delay = 300) {
|
|
9884
9885
|
const [debounced, setDebounced] = React37.useState(value);
|
|
9885
9886
|
React37.useEffect(() => {
|
|
@@ -9902,6 +9903,7 @@ function DataTable({
|
|
|
9902
9903
|
toolbar,
|
|
9903
9904
|
enableColumnVisibilityToggle = true,
|
|
9904
9905
|
enableDensityToggle = true,
|
|
9906
|
+
enableHeaderAlignToggle = false,
|
|
9905
9907
|
striped = true,
|
|
9906
9908
|
// Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
9907
9909
|
columnDividers = false,
|
|
@@ -9909,6 +9911,7 @@ function DataTable({
|
|
|
9909
9911
|
labels
|
|
9910
9912
|
}) {
|
|
9911
9913
|
const t = useTranslations7("Common");
|
|
9914
|
+
const [headerAlign, setHeaderAlign] = React37.useState("left");
|
|
9912
9915
|
const [visibleCols, setVisibleCols] = React37.useState(() => columns.filter((c) => c.visible !== false).map((c) => c.key));
|
|
9913
9916
|
const [filters, setFilters] = React37.useState({});
|
|
9914
9917
|
const [sort, setSort] = React37.useState(null);
|
|
@@ -9991,18 +9994,21 @@ function DataTable({
|
|
|
9991
9994
|
{
|
|
9992
9995
|
style: { width: col.width },
|
|
9993
9996
|
className: cn(
|
|
9994
|
-
|
|
9995
|
-
col.align === "
|
|
9997
|
+
// Use column-specific align if defined, otherwise use global headerAlign
|
|
9998
|
+
(col.align === "right" || !col.align && headerAlign === "right") && "text-right",
|
|
9999
|
+
(col.align === "center" || !col.align && headerAlign === "center") && "text-center",
|
|
9996
10000
|
columnDividers && colIdx > 0 && "border-l border-border/60"
|
|
9997
10001
|
),
|
|
9998
|
-
children:
|
|
9999
|
-
|
|
10002
|
+
children: (() => {
|
|
10003
|
+
const isRightAlign = col.align === "right" || !col.align && headerAlign === "right";
|
|
10004
|
+
const isCenterAlign = col.align === "center" || !col.align && headerAlign === "center";
|
|
10005
|
+
const titleContent = /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-1 min-w-0 flex-shrink", children: [
|
|
10000
10006
|
/* @__PURE__ */ jsx47("span", { className: "truncate font-medium text-sm", children: col.title }),
|
|
10001
10007
|
col.sortable && /* @__PURE__ */ jsx47(
|
|
10002
10008
|
"button",
|
|
10003
10009
|
{
|
|
10004
10010
|
className: cn(
|
|
10005
|
-
"
|
|
10011
|
+
"p-1 rounded-sm transition-all duration-200 hover:bg-accent",
|
|
10006
10012
|
sort?.key === col.key ? "opacity-100 bg-accent" : "opacity-60 hover:opacity-100"
|
|
10007
10013
|
),
|
|
10008
10014
|
onClick: () => {
|
|
@@ -10041,11 +10047,11 @@ function DataTable({
|
|
|
10041
10047
|
] })
|
|
10042
10048
|
}
|
|
10043
10049
|
)
|
|
10044
|
-
] })
|
|
10045
|
-
col.filter && /* @__PURE__ */ jsx47(
|
|
10050
|
+
] });
|
|
10051
|
+
const filterContent = col.filter && /* @__PURE__ */ jsx47(
|
|
10046
10052
|
Popover,
|
|
10047
10053
|
{
|
|
10048
|
-
placement: "bottom-start",
|
|
10054
|
+
placement: isRightAlign ? "bottom-end" : "bottom-start",
|
|
10049
10055
|
trigger: /* @__PURE__ */ jsx47(
|
|
10050
10056
|
"button",
|
|
10051
10057
|
{
|
|
@@ -10076,14 +10082,32 @@ function DataTable({
|
|
|
10076
10082
|
return newFilters;
|
|
10077
10083
|
});
|
|
10078
10084
|
},
|
|
10079
|
-
className: "text-xs text-
|
|
10085
|
+
className: "text-xs text-destructive hover:underline",
|
|
10080
10086
|
children: "Clear filter"
|
|
10081
10087
|
}
|
|
10082
10088
|
)
|
|
10083
10089
|
] })
|
|
10084
10090
|
}
|
|
10085
|
-
)
|
|
10086
|
-
|
|
10091
|
+
);
|
|
10092
|
+
return /* @__PURE__ */ jsx47(
|
|
10093
|
+
"div",
|
|
10094
|
+
{
|
|
10095
|
+
className: cn(
|
|
10096
|
+
"flex items-center gap-2 select-none min-h-[2.5rem]",
|
|
10097
|
+
isRightAlign && "justify-end",
|
|
10098
|
+
isCenterAlign && "justify-center",
|
|
10099
|
+
!isRightAlign && !isCenterAlign && "justify-between"
|
|
10100
|
+
),
|
|
10101
|
+
children: isRightAlign ? /* @__PURE__ */ jsxs41(Fragment17, { children: [
|
|
10102
|
+
filterContent,
|
|
10103
|
+
titleContent
|
|
10104
|
+
] }) : /* @__PURE__ */ jsxs41(Fragment17, { children: [
|
|
10105
|
+
titleContent,
|
|
10106
|
+
filterContent
|
|
10107
|
+
] })
|
|
10108
|
+
}
|
|
10109
|
+
);
|
|
10110
|
+
})()
|
|
10087
10111
|
},
|
|
10088
10112
|
col.key
|
|
10089
10113
|
)) });
|
|
@@ -10174,6 +10198,20 @@ function DataTable({
|
|
|
10174
10198
|
))
|
|
10175
10199
|
}
|
|
10176
10200
|
),
|
|
10201
|
+
enableHeaderAlignToggle && /* @__PURE__ */ jsx47(
|
|
10202
|
+
DropdownMenu_default,
|
|
10203
|
+
{
|
|
10204
|
+
trigger: /* @__PURE__ */ jsxs41(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
|
|
10205
|
+
/* @__PURE__ */ jsx47("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx47("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h10M4 18h16" }) }),
|
|
10206
|
+
labels?.headerAlign || t("headerAlign")
|
|
10207
|
+
] }),
|
|
10208
|
+
items: [
|
|
10209
|
+
{ label: labels?.alignLeft || t("alignLeft"), onClick: () => setHeaderAlign("left") },
|
|
10210
|
+
{ label: labels?.alignCenter || t("alignCenter"), onClick: () => setHeaderAlign("center") },
|
|
10211
|
+
{ label: labels?.alignRight || t("alignRight"), onClick: () => setHeaderAlign("right") }
|
|
10212
|
+
]
|
|
10213
|
+
}
|
|
10214
|
+
),
|
|
10177
10215
|
toolbar
|
|
10178
10216
|
] })
|
|
10179
10217
|
] }),
|
|
@@ -12490,7 +12528,7 @@ function AccessDenied({
|
|
|
12490
12528
|
import { Moon, Sun, Monitor } from "lucide-react";
|
|
12491
12529
|
import { useEffect as useEffect20, useRef as useRef12, useState as useState32 } from "react";
|
|
12492
12530
|
import { createPortal as createPortal10 } from "react-dom";
|
|
12493
|
-
import { Fragment as
|
|
12531
|
+
import { Fragment as Fragment18, jsx as jsx52, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
12494
12532
|
function ThemeToggleHeadless({
|
|
12495
12533
|
theme,
|
|
12496
12534
|
onChange,
|
|
@@ -12541,7 +12579,7 @@ function ThemeToggleHeadless({
|
|
|
12541
12579
|
children: /* @__PURE__ */ jsx52(CurrentIcon, { className: "h-5 w-5" })
|
|
12542
12580
|
}
|
|
12543
12581
|
),
|
|
12544
|
-
isOpen && /* @__PURE__ */ jsxs46(
|
|
12582
|
+
isOpen && /* @__PURE__ */ jsxs46(Fragment18, { children: [
|
|
12545
12583
|
typeof window !== "undefined" && createPortal10(/* @__PURE__ */ jsx52("div", { className: "fixed inset-0 z-[9998]", onClick: () => setIsOpen(false) }), document.body),
|
|
12546
12584
|
typeof window !== "undefined" && dropdownPosition && createPortal10(
|
|
12547
12585
|
/* @__PURE__ */ jsx52(
|
|
@@ -12593,7 +12631,7 @@ function ThemeToggleHeadless({
|
|
|
12593
12631
|
import { useRef as useRef13, useState as useState33 } from "react";
|
|
12594
12632
|
import { createPortal as createPortal11 } from "react-dom";
|
|
12595
12633
|
import { Globe } from "lucide-react";
|
|
12596
|
-
import { Fragment as
|
|
12634
|
+
import { Fragment as Fragment19, jsx as jsx53, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
12597
12635
|
function LanguageSwitcherHeadless({
|
|
12598
12636
|
locales,
|
|
12599
12637
|
currentLocale,
|
|
@@ -12638,7 +12676,7 @@ function LanguageSwitcherHeadless({
|
|
|
12638
12676
|
children: /* @__PURE__ */ jsx53(Globe, { className: "h-5 w-5" })
|
|
12639
12677
|
}
|
|
12640
12678
|
),
|
|
12641
|
-
isOpen && /* @__PURE__ */ jsxs47(
|
|
12679
|
+
isOpen && /* @__PURE__ */ jsxs47(Fragment19, { children: [
|
|
12642
12680
|
typeof window !== "undefined" && createPortal11(/* @__PURE__ */ jsx53("div", { className: "fixed inset-0 z-[9998]", onClick: () => setIsOpen(false) }), document.body),
|
|
12643
12681
|
typeof window !== "undefined" && dropdownPosition && createPortal11(
|
|
12644
12682
|
/* @__PURE__ */ jsx53(
|