@underverse-ui/underverse 0.1.5 → 0.1.6
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 +37 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -3
- package/dist/index.d.ts +35 -3
- package/dist/index.js +37 -32
- package/dist/index.js.map +1 -1
- package/package.json +12 -1
package/dist/index.cjs
CHANGED
|
@@ -2588,7 +2588,7 @@ var variantIcons = {
|
|
|
2588
2588
|
warning: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(WarningIcon, { className: "h-4 w-4 text-warning" }),
|
|
2589
2589
|
error: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ErrorIcon, { className: "h-4 w-4 text-destructive" })
|
|
2590
2590
|
};
|
|
2591
|
-
var Alert = ({ title, description, variant = "default", className, icon, dismissible = false, onClose, actions }) => {
|
|
2591
|
+
var Alert = ({ title, description, variant = "default", className, icon, dismissible = false, onClose, actions, closeAriaLabel }) => {
|
|
2592
2592
|
const [open, setOpen] = (0, import_react7.useState)(true);
|
|
2593
2593
|
const t = (0, import_next_intl2.useTranslations)("Common");
|
|
2594
2594
|
if (!open) return null;
|
|
@@ -2614,7 +2614,7 @@ var Alert = ({ title, description, variant = "default", className, icon, dismiss
|
|
|
2614
2614
|
{
|
|
2615
2615
|
onClick: handleClose,
|
|
2616
2616
|
className: "rounded-md p-1 hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2617
|
-
"aria-label": t("closeAlert"),
|
|
2617
|
+
"aria-label": closeAriaLabel || t("closeAlert"),
|
|
2618
2618
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react9.X, { className: "h-4 w-4" })
|
|
2619
2619
|
}
|
|
2620
2620
|
)
|
|
@@ -3675,7 +3675,8 @@ var Pagination = ({
|
|
|
3675
3675
|
pageSize,
|
|
3676
3676
|
pageSizeOptions,
|
|
3677
3677
|
onPageSizeChange,
|
|
3678
|
-
totalItems
|
|
3678
|
+
totalItems,
|
|
3679
|
+
labels
|
|
3679
3680
|
}) => {
|
|
3680
3681
|
const t = (0, import_next_intl4.useTranslations)("Pagination");
|
|
3681
3682
|
const createPageArray = () => {
|
|
@@ -3729,8 +3730,8 @@ var Pagination = ({
|
|
|
3729
3730
|
}
|
|
3730
3731
|
};
|
|
3731
3732
|
if (totalPages <= 1) return null;
|
|
3732
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("nav", { className: cn("flex flex-col gap-4", className), "aria-label": t("navigationLabel"), children: [
|
|
3733
|
-
showInfo && totalItems && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-sm text-muted-foreground text-center", children: t("showingResults", { startItem: startItem || 0, endItem: endItem || 0, totalItems }) }),
|
|
3733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("nav", { className: cn("flex flex-col gap-4", className), "aria-label": labels?.navigationLabel || t("navigationLabel"), children: [
|
|
3734
|
+
showInfo && totalItems && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-sm text-muted-foreground text-center", children: labels?.showingResults ? labels.showingResults({ startItem: startItem || 0, endItem: endItem || 0, totalItems }) : t("showingResults", { startItem: startItem || 0, endItem: endItem || 0, totalItems }) }),
|
|
3734
3735
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-center gap-1", children: [
|
|
3735
3736
|
showFirstLast && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3736
3737
|
Button_default,
|
|
@@ -3741,8 +3742,8 @@ var Pagination = ({
|
|
|
3741
3742
|
onClick: () => onChange(1),
|
|
3742
3743
|
disabled: disabled || page === 1,
|
|
3743
3744
|
className: "hidden sm:flex",
|
|
3744
|
-
title: t("firstPage"),
|
|
3745
|
-
"aria-label": t("firstPage"),
|
|
3745
|
+
title: labels?.firstPage || t("firstPage"),
|
|
3746
|
+
"aria-label": labels?.firstPage || t("firstPage"),
|
|
3746
3747
|
"aria-disabled": disabled || page === 1
|
|
3747
3748
|
}
|
|
3748
3749
|
),
|
|
@@ -3754,10 +3755,10 @@ var Pagination = ({
|
|
|
3754
3755
|
icon: import_lucide_react13.ChevronLeft,
|
|
3755
3756
|
onClick: () => onChange(Math.max(1, page - 1)),
|
|
3756
3757
|
disabled: disabled || page === 1,
|
|
3757
|
-
title: t("previousPage"),
|
|
3758
|
-
"aria-label": t("previousPage"),
|
|
3758
|
+
title: labels?.previousPage || t("previousPage"),
|
|
3759
|
+
"aria-label": labels?.previousPage || t("previousPage"),
|
|
3759
3760
|
"aria-disabled": disabled || page === 1,
|
|
3760
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "hidden sm:inline", children: t("previous") })
|
|
3761
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "hidden sm:inline", children: labels?.previous || t("previous") })
|
|
3761
3762
|
}
|
|
3762
3763
|
),
|
|
3763
3764
|
showPageNumbers && createPageArray().map((p, i) => {
|
|
@@ -3774,7 +3775,7 @@ var Pagination = ({
|
|
|
3774
3775
|
onClick: () => onChange(pageNumber),
|
|
3775
3776
|
disabled,
|
|
3776
3777
|
className: cn("min-w-[2.5rem]", isActive && "font-semibold"),
|
|
3777
|
-
"aria-label": t("pageNumber", { page: pageNumber }),
|
|
3778
|
+
"aria-label": labels?.pageNumber ? labels.pageNumber(pageNumber) : t("pageNumber", { page: pageNumber }),
|
|
3778
3779
|
"aria-current": isActive ? "page" : void 0,
|
|
3779
3780
|
children: pageNumber
|
|
3780
3781
|
},
|
|
@@ -3789,10 +3790,10 @@ var Pagination = ({
|
|
|
3789
3790
|
iconRight: import_lucide_react13.ChevronRight,
|
|
3790
3791
|
onClick: () => onChange(Math.min(totalPages, page + 1)),
|
|
3791
3792
|
disabled: disabled || page === totalPages,
|
|
3792
|
-
title: t("nextPage"),
|
|
3793
|
-
"aria-label": t("nextPage"),
|
|
3793
|
+
title: labels?.nextPage || t("nextPage"),
|
|
3794
|
+
"aria-label": labels?.nextPage || t("nextPage"),
|
|
3794
3795
|
"aria-disabled": disabled || page === totalPages,
|
|
3795
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "hidden sm:inline", children: t("next") })
|
|
3796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "hidden sm:inline", children: labels?.next || t("next") })
|
|
3796
3797
|
}
|
|
3797
3798
|
),
|
|
3798
3799
|
showFirstLast && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -3804,15 +3805,15 @@ var Pagination = ({
|
|
|
3804
3805
|
onClick: () => onChange(totalPages),
|
|
3805
3806
|
disabled: disabled || page === totalPages,
|
|
3806
3807
|
className: "hidden sm:flex",
|
|
3807
|
-
title: t("lastPage"),
|
|
3808
|
-
"aria-label": t("lastPage"),
|
|
3808
|
+
title: labels?.lastPage || t("lastPage"),
|
|
3809
|
+
"aria-label": labels?.lastPage || t("lastPage"),
|
|
3809
3810
|
"aria-disabled": disabled || page === totalPages
|
|
3810
3811
|
}
|
|
3811
3812
|
)
|
|
3812
3813
|
] }),
|
|
3813
3814
|
pageSizeOptions && onPageSizeChange && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-center gap-2 text-sm", children: [
|
|
3814
3815
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
3815
|
-
t("itemsPerPage"),
|
|
3816
|
+
labels?.itemsPerPage || t("itemsPerPage"),
|
|
3816
3817
|
":"
|
|
3817
3818
|
] }),
|
|
3818
3819
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "w-20", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -3822,8 +3823,8 @@ var Pagination = ({
|
|
|
3822
3823
|
value: pageSize?.toString() || "10",
|
|
3823
3824
|
onChange: handlePageSizeChange,
|
|
3824
3825
|
placeholder: "10",
|
|
3825
|
-
searchPlaceholder: t("search"),
|
|
3826
|
-
emptyText: t("noOptions"),
|
|
3826
|
+
searchPlaceholder: labels?.search || t("search"),
|
|
3827
|
+
emptyText: labels?.noOptions || t("noOptions"),
|
|
3827
3828
|
disabled
|
|
3828
3829
|
}
|
|
3829
3830
|
) })
|
|
@@ -4079,7 +4080,10 @@ var DatePicker = ({
|
|
|
4079
4080
|
disabled = false,
|
|
4080
4081
|
size = "md",
|
|
4081
4082
|
label,
|
|
4082
|
-
required
|
|
4083
|
+
required,
|
|
4084
|
+
todayLabel,
|
|
4085
|
+
clearLabel,
|
|
4086
|
+
weekdayLabels
|
|
4083
4087
|
}) => {
|
|
4084
4088
|
const t = (0, import_next_intl5.useTranslations)("DatePicker");
|
|
4085
4089
|
const locale = (0, import_next_intl5.useLocale)();
|
|
@@ -4220,10 +4224,10 @@ var DatePicker = ({
|
|
|
4220
4224
|
children: [
|
|
4221
4225
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
|
|
4222
4226
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button_default, { variant: "ghost", size: "sm", onClick: () => navigateMonth("prev"), className: "p-1 h-auto", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.ChevronLeft, { className: "h-4 w-4" }) }),
|
|
4223
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-sm font-semibold", children: viewDate.toLocaleDateString(
|
|
4227
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-sm font-semibold", children: viewDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }) }),
|
|
4224
4228
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button_default, { variant: "ghost", size: "sm", onClick: () => navigateMonth("next"), className: "p-1 h-auto", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.ChevronRight, { className: "h-4 w-4" }) })
|
|
4225
4229
|
] }),
|
|
4226
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn("grid grid-cols-7 gap-1", size === "sm" ? "mb-1" : "mb-2"), children: (
|
|
4230
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn("grid grid-cols-7 gap-1", size === "sm" ? "mb-1" : "mb-2"), children: (weekdayLabels || ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]).map((day) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn("text-muted-foreground text-center font-medium", size === "sm" ? "text-[10px] py-0.5" : "text-xs py-1"), children: day }, day)) }),
|
|
4227
4231
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid grid-cols-7 gap-1", children: renderCalendar() })
|
|
4228
4232
|
]
|
|
4229
4233
|
}
|
|
@@ -5746,7 +5750,8 @@ function DataTable({
|
|
|
5746
5750
|
enableDensityToggle = true,
|
|
5747
5751
|
striped = true,
|
|
5748
5752
|
// Mặc định bật màu nền sẽn kẽ cho các dòng
|
|
5749
|
-
className
|
|
5753
|
+
className,
|
|
5754
|
+
labels
|
|
5750
5755
|
}) {
|
|
5751
5756
|
const t = (0, import_next_intl7.useTranslations)("Common");
|
|
5752
5757
|
const [visibleCols, setVisibleCols] = import_react20.default.useState(() => columns.filter((c) => c.visible !== false).map((c) => c.key));
|
|
@@ -5926,12 +5931,12 @@ function DataTable({
|
|
|
5926
5931
|
{
|
|
5927
5932
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
|
|
5928
5933
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 10h16M4 14h16M4 18h16" }) }),
|
|
5929
|
-
t("density")
|
|
5934
|
+
labels?.density || t("density")
|
|
5930
5935
|
] }),
|
|
5931
5936
|
items: [
|
|
5932
|
-
{ label: t("compact"), onClick: () => setDensity("compact") },
|
|
5933
|
-
{ label: t("normal"), onClick: () => setDensity("normal") },
|
|
5934
|
-
{ label: t("comfortable"), onClick: () => setDensity("comfortable") }
|
|
5937
|
+
{ label: labels?.compact || t("compact"), onClick: () => setDensity("compact") },
|
|
5938
|
+
{ label: labels?.normal || t("normal"), onClick: () => setDensity("normal") },
|
|
5939
|
+
{ label: labels?.comfortable || t("comfortable"), onClick: () => setDensity("comfortable") }
|
|
5935
5940
|
]
|
|
5936
5941
|
}
|
|
5937
5942
|
),
|
|
@@ -5948,7 +5953,7 @@ function DataTable({
|
|
|
5948
5953
|
d: "M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"
|
|
5949
5954
|
}
|
|
5950
5955
|
) }),
|
|
5951
|
-
t("columns")
|
|
5956
|
+
labels?.columns || t("columns")
|
|
5952
5957
|
] }),
|
|
5953
5958
|
children: columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
5954
5959
|
DropdownMenuItem,
|
|
@@ -6028,7 +6033,7 @@ var DataTable_default = DataTable;
|
|
|
6028
6033
|
var import_lucide_react21 = require("lucide-react");
|
|
6029
6034
|
var import_next_intl8 = require("next-intl");
|
|
6030
6035
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6031
|
-
function NotificationModal({ isOpen, onClose, notification }) {
|
|
6036
|
+
function NotificationModal({ isOpen, onClose, notification, titleText, openLinkText, closeText }) {
|
|
6032
6037
|
const t = (0, import_next_intl8.useTranslations)("Common");
|
|
6033
6038
|
if (!notification) return null;
|
|
6034
6039
|
const formatTime2 = (dateString) => {
|
|
@@ -6053,7 +6058,7 @@ function NotificationModal({ isOpen, onClose, notification }) {
|
|
|
6053
6058
|
{
|
|
6054
6059
|
isOpen,
|
|
6055
6060
|
onClose,
|
|
6056
|
-
title: t("notifications"),
|
|
6061
|
+
title: titleText || t("notifications"),
|
|
6057
6062
|
size: "md",
|
|
6058
6063
|
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "space-y-4", children: [
|
|
6059
6064
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-2 pb-2 border-b border-border", children: [
|
|
@@ -6076,7 +6081,7 @@ function NotificationModal({ isOpen, onClose, notification }) {
|
|
|
6076
6081
|
className: "gap-2",
|
|
6077
6082
|
children: [
|
|
6078
6083
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react21.ExternalLink, { className: "w-4 h-4" }),
|
|
6079
|
-
t("openLink")
|
|
6084
|
+
openLinkText || t("openLink")
|
|
6080
6085
|
]
|
|
6081
6086
|
}
|
|
6082
6087
|
),
|
|
@@ -6086,7 +6091,7 @@ function NotificationModal({ isOpen, onClose, notification }) {
|
|
|
6086
6091
|
variant: "ghost",
|
|
6087
6092
|
size: "sm",
|
|
6088
6093
|
onClick: onClose,
|
|
6089
|
-
children: t("close")
|
|
6094
|
+
children: closeText || t("close")
|
|
6090
6095
|
}
|
|
6091
6096
|
)
|
|
6092
6097
|
] })
|