@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.d.cts CHANGED
@@ -328,8 +328,9 @@ interface AlertProps {
328
328
  dismissible?: boolean;
329
329
  onClose?: () => void;
330
330
  actions?: ReactNode;
331
+ closeAriaLabel?: string;
331
332
  }
332
- declare const Alert: ({ title, description, variant, className, icon, dismissible, onClose, actions }: AlertProps) => react_jsx_runtime.JSX.Element | null;
333
+ declare const Alert: ({ title, description, variant, className, icon, dismissible, onClose, actions, closeAriaLabel }: AlertProps) => react_jsx_runtime.JSX.Element | null;
333
334
 
334
335
  interface GlobalLoadingProps {
335
336
  className?: string;
@@ -461,6 +462,24 @@ interface PaginationProps {
461
462
  pageSizeOptions?: number[];
462
463
  onPageSizeChange?: (size: number) => void;
463
464
  totalItems?: number;
465
+ labels?: {
466
+ navigationLabel?: string;
467
+ showingResults?: (ctx: {
468
+ startItem: number;
469
+ endItem: number;
470
+ totalItems?: number;
471
+ }) => string;
472
+ firstPage?: string;
473
+ previousPage?: string;
474
+ previous?: string;
475
+ nextPage?: string;
476
+ next?: string;
477
+ lastPage?: string;
478
+ itemsPerPage?: string;
479
+ search?: string;
480
+ noOptions?: string;
481
+ pageNumber?: (page: number) => string;
482
+ };
464
483
  }
465
484
  declare const Pagination: React$1.FC<PaginationProps>;
466
485
 
@@ -488,6 +507,9 @@ interface DatePickerProps {
488
507
  size?: "sm" | "md";
489
508
  label?: string;
490
509
  required?: boolean;
510
+ todayLabel?: string;
511
+ clearLabel?: string;
512
+ weekdayLabels?: string[];
491
513
  }
492
514
  declare const DatePicker: React$1.FC<DatePickerProps>;
493
515
 
@@ -716,9 +738,16 @@ interface DataTableProps<T> {
716
738
  enableDensityToggle?: boolean;
717
739
  striped?: boolean;
718
740
  className?: string;
741
+ labels?: {
742
+ density?: string;
743
+ columns?: string;
744
+ compact?: string;
745
+ normal?: string;
746
+ comfortable?: string;
747
+ };
719
748
  }
720
749
  declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, onQueryChange, caption, toolbar, enableColumnVisibilityToggle, enableDensityToggle, striped, // Mặc định bật màu nền sẽn kẽ cho các dòng
721
- className, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
750
+ className, labels, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
722
751
 
723
752
  interface TableProps extends React__default.HTMLAttributes<HTMLTableElement> {
724
753
  containerClassName?: string;
@@ -748,8 +777,11 @@ interface NotificationModalProps {
748
777
  isOpen: boolean;
749
778
  onClose: () => void;
750
779
  notification: NotificationItem | null;
780
+ titleText?: string;
781
+ openLinkText?: string;
782
+ closeText?: string;
751
783
  }
752
- declare function NotificationModal({ isOpen, onClose, notification }: NotificationModalProps): react_jsx_runtime.JSX.Element | null;
784
+ declare function NotificationModal({ isOpen, onClose, notification, titleText, openLinkText, closeText }: NotificationModalProps): react_jsx_runtime.JSX.Element | null;
753
785
 
754
786
  interface FloatingContactsProps {
755
787
  className?: string;
package/dist/index.d.ts CHANGED
@@ -328,8 +328,9 @@ interface AlertProps {
328
328
  dismissible?: boolean;
329
329
  onClose?: () => void;
330
330
  actions?: ReactNode;
331
+ closeAriaLabel?: string;
331
332
  }
332
- declare const Alert: ({ title, description, variant, className, icon, dismissible, onClose, actions }: AlertProps) => react_jsx_runtime.JSX.Element | null;
333
+ declare const Alert: ({ title, description, variant, className, icon, dismissible, onClose, actions, closeAriaLabel }: AlertProps) => react_jsx_runtime.JSX.Element | null;
333
334
 
334
335
  interface GlobalLoadingProps {
335
336
  className?: string;
@@ -461,6 +462,24 @@ interface PaginationProps {
461
462
  pageSizeOptions?: number[];
462
463
  onPageSizeChange?: (size: number) => void;
463
464
  totalItems?: number;
465
+ labels?: {
466
+ navigationLabel?: string;
467
+ showingResults?: (ctx: {
468
+ startItem: number;
469
+ endItem: number;
470
+ totalItems?: number;
471
+ }) => string;
472
+ firstPage?: string;
473
+ previousPage?: string;
474
+ previous?: string;
475
+ nextPage?: string;
476
+ next?: string;
477
+ lastPage?: string;
478
+ itemsPerPage?: string;
479
+ search?: string;
480
+ noOptions?: string;
481
+ pageNumber?: (page: number) => string;
482
+ };
464
483
  }
465
484
  declare const Pagination: React$1.FC<PaginationProps>;
466
485
 
@@ -488,6 +507,9 @@ interface DatePickerProps {
488
507
  size?: "sm" | "md";
489
508
  label?: string;
490
509
  required?: boolean;
510
+ todayLabel?: string;
511
+ clearLabel?: string;
512
+ weekdayLabels?: string[];
491
513
  }
492
514
  declare const DatePicker: React$1.FC<DatePickerProps>;
493
515
 
@@ -716,9 +738,16 @@ interface DataTableProps<T> {
716
738
  enableDensityToggle?: boolean;
717
739
  striped?: boolean;
718
740
  className?: string;
741
+ labels?: {
742
+ density?: string;
743
+ columns?: string;
744
+ compact?: string;
745
+ normal?: string;
746
+ comfortable?: string;
747
+ };
719
748
  }
720
749
  declare function DataTable<T extends Record<string, any>>({ columns, data, rowKey, loading, total, page, pageSize, onQueryChange, caption, toolbar, enableColumnVisibilityToggle, enableDensityToggle, striped, // Mặc định bật màu nền sẽn kẽ cho các dòng
721
- className, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
750
+ className, labels, }: DataTableProps<T>): react_jsx_runtime.JSX.Element;
722
751
 
723
752
  interface TableProps extends React__default.HTMLAttributes<HTMLTableElement> {
724
753
  containerClassName?: string;
@@ -748,8 +777,11 @@ interface NotificationModalProps {
748
777
  isOpen: boolean;
749
778
  onClose: () => void;
750
779
  notification: NotificationItem | null;
780
+ titleText?: string;
781
+ openLinkText?: string;
782
+ closeText?: string;
751
783
  }
752
- declare function NotificationModal({ isOpen, onClose, notification }: NotificationModalProps): react_jsx_runtime.JSX.Element | null;
784
+ declare function NotificationModal({ isOpen, onClose, notification, titleText, openLinkText, closeText }: NotificationModalProps): react_jsx_runtime.JSX.Element | null;
753
785
 
754
786
  interface FloatingContactsProps {
755
787
  className?: string;
package/dist/index.js CHANGED
@@ -2485,7 +2485,7 @@ var variantIcons = {
2485
2485
  warning: /* @__PURE__ */ jsx18(WarningIcon, { className: "h-4 w-4 text-warning" }),
2486
2486
  error: /* @__PURE__ */ jsx18(ErrorIcon, { className: "h-4 w-4 text-destructive" })
2487
2487
  };
2488
- var Alert = ({ title, description, variant = "default", className, icon, dismissible = false, onClose, actions }) => {
2488
+ var Alert = ({ title, description, variant = "default", className, icon, dismissible = false, onClose, actions, closeAriaLabel }) => {
2489
2489
  const [open, setOpen] = useState13(true);
2490
2490
  const t = useTranslations2("Common");
2491
2491
  if (!open) return null;
@@ -2511,7 +2511,7 @@ var Alert = ({ title, description, variant = "default", className, icon, dismiss
2511
2511
  {
2512
2512
  onClick: handleClose,
2513
2513
  className: "rounded-md p-1 hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2514
- "aria-label": t("closeAlert"),
2514
+ "aria-label": closeAriaLabel || t("closeAlert"),
2515
2515
  children: /* @__PURE__ */ jsx18(X6, { className: "h-4 w-4" })
2516
2516
  }
2517
2517
  )
@@ -3572,7 +3572,8 @@ var Pagination = ({
3572
3572
  pageSize,
3573
3573
  pageSizeOptions,
3574
3574
  onPageSizeChange,
3575
- totalItems
3575
+ totalItems,
3576
+ labels
3576
3577
  }) => {
3577
3578
  const t = useTranslations4("Pagination");
3578
3579
  const createPageArray = () => {
@@ -3626,8 +3627,8 @@ var Pagination = ({
3626
3627
  }
3627
3628
  };
3628
3629
  if (totalPages <= 1) return null;
3629
- return /* @__PURE__ */ jsxs22("nav", { className: cn("flex flex-col gap-4", className), "aria-label": t("navigationLabel"), children: [
3630
- showInfo && totalItems && /* @__PURE__ */ jsx24("div", { className: "text-sm text-muted-foreground text-center", children: t("showingResults", { startItem: startItem || 0, endItem: endItem || 0, totalItems }) }),
3630
+ return /* @__PURE__ */ jsxs22("nav", { className: cn("flex flex-col gap-4", className), "aria-label": labels?.navigationLabel || t("navigationLabel"), children: [
3631
+ showInfo && totalItems && /* @__PURE__ */ jsx24("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 }) }),
3631
3632
  /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-center gap-1", children: [
3632
3633
  showFirstLast && /* @__PURE__ */ jsx24(
3633
3634
  Button_default,
@@ -3638,8 +3639,8 @@ var Pagination = ({
3638
3639
  onClick: () => onChange(1),
3639
3640
  disabled: disabled || page === 1,
3640
3641
  className: "hidden sm:flex",
3641
- title: t("firstPage"),
3642
- "aria-label": t("firstPage"),
3642
+ title: labels?.firstPage || t("firstPage"),
3643
+ "aria-label": labels?.firstPage || t("firstPage"),
3643
3644
  "aria-disabled": disabled || page === 1
3644
3645
  }
3645
3646
  ),
@@ -3651,10 +3652,10 @@ var Pagination = ({
3651
3652
  icon: ChevronLeft,
3652
3653
  onClick: () => onChange(Math.max(1, page - 1)),
3653
3654
  disabled: disabled || page === 1,
3654
- title: t("previousPage"),
3655
- "aria-label": t("previousPage"),
3655
+ title: labels?.previousPage || t("previousPage"),
3656
+ "aria-label": labels?.previousPage || t("previousPage"),
3656
3657
  "aria-disabled": disabled || page === 1,
3657
- children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: t("previous") })
3658
+ children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: labels?.previous || t("previous") })
3658
3659
  }
3659
3660
  ),
3660
3661
  showPageNumbers && createPageArray().map((p, i) => {
@@ -3671,7 +3672,7 @@ var Pagination = ({
3671
3672
  onClick: () => onChange(pageNumber),
3672
3673
  disabled,
3673
3674
  className: cn("min-w-[2.5rem]", isActive && "font-semibold"),
3674
- "aria-label": t("pageNumber", { page: pageNumber }),
3675
+ "aria-label": labels?.pageNumber ? labels.pageNumber(pageNumber) : t("pageNumber", { page: pageNumber }),
3675
3676
  "aria-current": isActive ? "page" : void 0,
3676
3677
  children: pageNumber
3677
3678
  },
@@ -3686,10 +3687,10 @@ var Pagination = ({
3686
3687
  iconRight: ChevronRight2,
3687
3688
  onClick: () => onChange(Math.min(totalPages, page + 1)),
3688
3689
  disabled: disabled || page === totalPages,
3689
- title: t("nextPage"),
3690
- "aria-label": t("nextPage"),
3690
+ title: labels?.nextPage || t("nextPage"),
3691
+ "aria-label": labels?.nextPage || t("nextPage"),
3691
3692
  "aria-disabled": disabled || page === totalPages,
3692
- children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: t("next") })
3693
+ children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: labels?.next || t("next") })
3693
3694
  }
3694
3695
  ),
3695
3696
  showFirstLast && /* @__PURE__ */ jsx24(
@@ -3701,15 +3702,15 @@ var Pagination = ({
3701
3702
  onClick: () => onChange(totalPages),
3702
3703
  disabled: disabled || page === totalPages,
3703
3704
  className: "hidden sm:flex",
3704
- title: t("lastPage"),
3705
- "aria-label": t("lastPage"),
3705
+ title: labels?.lastPage || t("lastPage"),
3706
+ "aria-label": labels?.lastPage || t("lastPage"),
3706
3707
  "aria-disabled": disabled || page === totalPages
3707
3708
  }
3708
3709
  )
3709
3710
  ] }),
3710
3711
  pageSizeOptions && onPageSizeChange && /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-center gap-2 text-sm", children: [
3711
3712
  /* @__PURE__ */ jsxs22("span", { className: "text-muted-foreground", children: [
3712
- t("itemsPerPage"),
3713
+ labels?.itemsPerPage || t("itemsPerPage"),
3713
3714
  ":"
3714
3715
  ] }),
3715
3716
  /* @__PURE__ */ jsx24("div", { className: "w-20", children: /* @__PURE__ */ jsx24(
@@ -3719,8 +3720,8 @@ var Pagination = ({
3719
3720
  value: pageSize?.toString() || "10",
3720
3721
  onChange: handlePageSizeChange,
3721
3722
  placeholder: "10",
3722
- searchPlaceholder: t("search"),
3723
- emptyText: t("noOptions"),
3723
+ searchPlaceholder: labels?.search || t("search"),
3724
+ emptyText: labels?.noOptions || t("noOptions"),
3724
3725
  disabled
3725
3726
  }
3726
3727
  ) })
@@ -3976,7 +3977,10 @@ var DatePicker = ({
3976
3977
  disabled = false,
3977
3978
  size = "md",
3978
3979
  label,
3979
- required
3980
+ required,
3981
+ todayLabel,
3982
+ clearLabel,
3983
+ weekdayLabels
3980
3984
  }) => {
3981
3985
  const t = useTranslations5("DatePicker");
3982
3986
  const locale = useLocale();
@@ -4117,10 +4121,10 @@ var DatePicker = ({
4117
4121
  children: [
4118
4122
  /* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between mb-4", children: [
4119
4123
  /* @__PURE__ */ jsx27(Button_default, { variant: "ghost", size: "sm", onClick: () => navigateMonth("prev"), className: "p-1 h-auto", children: /* @__PURE__ */ jsx27(ChevronLeft2, { className: "h-4 w-4" }) }),
4120
- /* @__PURE__ */ jsx27("div", { className: "text-sm font-semibold", children: viewDate.toLocaleDateString(locale === "vi" /* VI */ ? "vi-VN" : "en-US", { month: "long", year: "numeric" }) }),
4124
+ /* @__PURE__ */ jsx27("div", { className: "text-sm font-semibold", children: viewDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }) }),
4121
4125
  /* @__PURE__ */ jsx27(Button_default, { variant: "ghost", size: "sm", onClick: () => navigateMonth("next"), className: "p-1 h-auto", children: /* @__PURE__ */ jsx27(ChevronRight3, { className: "h-4 w-4" }) })
4122
4126
  ] }),
4123
- /* @__PURE__ */ jsx27("div", { className: cn("grid grid-cols-7 gap-1", size === "sm" ? "mb-1" : "mb-2"), children: (locale === "vi" /* VI */ ? t("weekdays").split(",") : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]).map((day) => /* @__PURE__ */ jsx27("div", { className: cn("text-muted-foreground text-center font-medium", size === "sm" ? "text-[10px] py-0.5" : "text-xs py-1"), children: day }, day)) }),
4127
+ /* @__PURE__ */ jsx27("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__ */ jsx27("div", { className: cn("text-muted-foreground text-center font-medium", size === "sm" ? "text-[10px] py-0.5" : "text-xs py-1"), children: day }, day)) }),
4124
4128
  /* @__PURE__ */ jsx27("div", { className: "grid grid-cols-7 gap-1", children: renderCalendar() })
4125
4129
  ]
4126
4130
  }
@@ -5643,7 +5647,8 @@ function DataTable({
5643
5647
  enableDensityToggle = true,
5644
5648
  striped = true,
5645
5649
  // Mặc định bật màu nền sẽn kẽ cho các dòng
5646
- className
5650
+ className,
5651
+ labels
5647
5652
  }) {
5648
5653
  const t = useTranslations7("Common");
5649
5654
  const [visibleCols, setVisibleCols] = React29.useState(() => columns.filter((c) => c.visible !== false).map((c) => c.key));
@@ -5823,12 +5828,12 @@ function DataTable({
5823
5828
  {
5824
5829
  trigger: /* @__PURE__ */ jsxs32(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
5825
5830
  /* @__PURE__ */ jsx38("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx38("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 10h16M4 14h16M4 18h16" }) }),
5826
- t("density")
5831
+ labels?.density || t("density")
5827
5832
  ] }),
5828
5833
  items: [
5829
- { label: t("compact"), onClick: () => setDensity("compact") },
5830
- { label: t("normal"), onClick: () => setDensity("normal") },
5831
- { label: t("comfortable"), onClick: () => setDensity("comfortable") }
5834
+ { label: labels?.compact || t("compact"), onClick: () => setDensity("compact") },
5835
+ { label: labels?.normal || t("normal"), onClick: () => setDensity("normal") },
5836
+ { label: labels?.comfortable || t("comfortable"), onClick: () => setDensity("comfortable") }
5832
5837
  ]
5833
5838
  }
5834
5839
  ),
@@ -5845,7 +5850,7 @@ function DataTable({
5845
5850
  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"
5846
5851
  }
5847
5852
  ) }),
5848
- t("columns")
5853
+ labels?.columns || t("columns")
5849
5854
  ] }),
5850
5855
  children: columns.map((c) => /* @__PURE__ */ jsxs32(
5851
5856
  DropdownMenuItem,
@@ -5925,7 +5930,7 @@ var DataTable_default = DataTable;
5925
5930
  import { ExternalLink } from "lucide-react";
5926
5931
  import { useTranslations as useTranslations8 } from "next-intl";
5927
5932
  import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
5928
- function NotificationModal({ isOpen, onClose, notification }) {
5933
+ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkText, closeText }) {
5929
5934
  const t = useTranslations8("Common");
5930
5935
  if (!notification) return null;
5931
5936
  const formatTime2 = (dateString) => {
@@ -5950,7 +5955,7 @@ function NotificationModal({ isOpen, onClose, notification }) {
5950
5955
  {
5951
5956
  isOpen,
5952
5957
  onClose,
5953
- title: t("notifications"),
5958
+ title: titleText || t("notifications"),
5954
5959
  size: "md",
5955
5960
  children: /* @__PURE__ */ jsxs33("div", { className: "space-y-4", children: [
5956
5961
  /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2 pb-2 border-b border-border", children: [
@@ -5973,7 +5978,7 @@ function NotificationModal({ isOpen, onClose, notification }) {
5973
5978
  className: "gap-2",
5974
5979
  children: [
5975
5980
  /* @__PURE__ */ jsx39(ExternalLink, { className: "w-4 h-4" }),
5976
- t("openLink")
5981
+ openLinkText || t("openLink")
5977
5982
  ]
5978
5983
  }
5979
5984
  ),
@@ -5983,7 +5988,7 @@ function NotificationModal({ isOpen, onClose, notification }) {
5983
5988
  variant: "ghost",
5984
5989
  size: "sm",
5985
5990
  onClick: onClose,
5986
- children: t("close")
5991
+ children: closeText || t("close")
5987
5992
  }
5988
5993
  )
5989
5994
  ] })