@underverse-ui/underverse 0.1.5 → 0.1.7

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
  )
@@ -2522,7 +2522,7 @@ var Alert = ({ title, description, variant = "default", className, icon, dismiss
2522
2522
  var Alert_default = Alert;
2523
2523
 
2524
2524
  // ../../components/ui/GlobalLoading.tsx
2525
- import { useEffect as useEffect7, useState as useState14 } from "react";
2525
+ import React14, { useEffect as useEffect7, useState as useState14 } from "react";
2526
2526
  import { Activity as Activity2 } from "lucide-react";
2527
2527
 
2528
2528
  // ../../lib/utils/loading.ts
@@ -2641,21 +2641,24 @@ var ButtonLoading = ({
2641
2641
  disabled,
2642
2642
  loadingText
2643
2643
  }) => {
2644
+ const child = React14.isValidElement(children) ? React14.cloneElement(children, {
2645
+ disabled: (children.props?.disabled ?? false) || disabled || isLoading,
2646
+ "aria-busy": isLoading || void 0
2647
+ }) : children;
2644
2648
  return /* @__PURE__ */ jsxs17(
2645
- "button",
2649
+ "div",
2646
2650
  {
2647
2651
  className: cn(
2648
- "relative",
2652
+ "relative inline-block",
2649
2653
  isLoading && "cursor-not-allowed",
2650
2654
  className
2651
2655
  ),
2652
- disabled: disabled || isLoading,
2653
2656
  children: [
2654
- isLoading && /* @__PURE__ */ jsxs17("div", { className: "absolute inset-0 flex items-center justify-center", children: [
2657
+ isLoading && /* @__PURE__ */ jsxs17("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: [
2655
2658
  /* @__PURE__ */ jsx19(Activity2, { className: "w-4 h-4 animate-spin text-primary-foreground" }),
2656
2659
  loadingText && /* @__PURE__ */ jsx19("span", { className: "ml-2 text-sm", children: loadingText })
2657
2660
  ] }),
2658
- /* @__PURE__ */ jsx19("div", { className: cn(isLoading && "invisible"), children })
2661
+ /* @__PURE__ */ jsx19("div", { className: cn(isLoading && "opacity-50 pointer-events-none"), children: child })
2659
2662
  ]
2660
2663
  }
2661
2664
  );
@@ -3572,7 +3575,8 @@ var Pagination = ({
3572
3575
  pageSize,
3573
3576
  pageSizeOptions,
3574
3577
  onPageSizeChange,
3575
- totalItems
3578
+ totalItems,
3579
+ labels
3576
3580
  }) => {
3577
3581
  const t = useTranslations4("Pagination");
3578
3582
  const createPageArray = () => {
@@ -3626,8 +3630,8 @@ var Pagination = ({
3626
3630
  }
3627
3631
  };
3628
3632
  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 }) }),
3633
+ return /* @__PURE__ */ jsxs22("nav", { className: cn("flex flex-col gap-4", className), "aria-label": labels?.navigationLabel || t("navigationLabel"), children: [
3634
+ 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
3635
  /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-center gap-1", children: [
3632
3636
  showFirstLast && /* @__PURE__ */ jsx24(
3633
3637
  Button_default,
@@ -3638,8 +3642,8 @@ var Pagination = ({
3638
3642
  onClick: () => onChange(1),
3639
3643
  disabled: disabled || page === 1,
3640
3644
  className: "hidden sm:flex",
3641
- title: t("firstPage"),
3642
- "aria-label": t("firstPage"),
3645
+ title: labels?.firstPage || t("firstPage"),
3646
+ "aria-label": labels?.firstPage || t("firstPage"),
3643
3647
  "aria-disabled": disabled || page === 1
3644
3648
  }
3645
3649
  ),
@@ -3651,10 +3655,10 @@ var Pagination = ({
3651
3655
  icon: ChevronLeft,
3652
3656
  onClick: () => onChange(Math.max(1, page - 1)),
3653
3657
  disabled: disabled || page === 1,
3654
- title: t("previousPage"),
3655
- "aria-label": t("previousPage"),
3658
+ title: labels?.previousPage || t("previousPage"),
3659
+ "aria-label": labels?.previousPage || t("previousPage"),
3656
3660
  "aria-disabled": disabled || page === 1,
3657
- children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: t("previous") })
3661
+ children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: labels?.previous || t("previous") })
3658
3662
  }
3659
3663
  ),
3660
3664
  showPageNumbers && createPageArray().map((p, i) => {
@@ -3671,7 +3675,7 @@ var Pagination = ({
3671
3675
  onClick: () => onChange(pageNumber),
3672
3676
  disabled,
3673
3677
  className: cn("min-w-[2.5rem]", isActive && "font-semibold"),
3674
- "aria-label": t("pageNumber", { page: pageNumber }),
3678
+ "aria-label": labels?.pageNumber ? labels.pageNumber(pageNumber) : t("pageNumber", { page: pageNumber }),
3675
3679
  "aria-current": isActive ? "page" : void 0,
3676
3680
  children: pageNumber
3677
3681
  },
@@ -3686,10 +3690,10 @@ var Pagination = ({
3686
3690
  iconRight: ChevronRight2,
3687
3691
  onClick: () => onChange(Math.min(totalPages, page + 1)),
3688
3692
  disabled: disabled || page === totalPages,
3689
- title: t("nextPage"),
3690
- "aria-label": t("nextPage"),
3693
+ title: labels?.nextPage || t("nextPage"),
3694
+ "aria-label": labels?.nextPage || t("nextPage"),
3691
3695
  "aria-disabled": disabled || page === totalPages,
3692
- children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: t("next") })
3696
+ children: /* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: labels?.next || t("next") })
3693
3697
  }
3694
3698
  ),
3695
3699
  showFirstLast && /* @__PURE__ */ jsx24(
@@ -3701,15 +3705,15 @@ var Pagination = ({
3701
3705
  onClick: () => onChange(totalPages),
3702
3706
  disabled: disabled || page === totalPages,
3703
3707
  className: "hidden sm:flex",
3704
- title: t("lastPage"),
3705
- "aria-label": t("lastPage"),
3708
+ title: labels?.lastPage || t("lastPage"),
3709
+ "aria-label": labels?.lastPage || t("lastPage"),
3706
3710
  "aria-disabled": disabled || page === totalPages
3707
3711
  }
3708
3712
  )
3709
3713
  ] }),
3710
3714
  pageSizeOptions && onPageSizeChange && /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-center gap-2 text-sm", children: [
3711
3715
  /* @__PURE__ */ jsxs22("span", { className: "text-muted-foreground", children: [
3712
- t("itemsPerPage"),
3716
+ labels?.itemsPerPage || t("itemsPerPage"),
3713
3717
  ":"
3714
3718
  ] }),
3715
3719
  /* @__PURE__ */ jsx24("div", { className: "w-20", children: /* @__PURE__ */ jsx24(
@@ -3719,8 +3723,8 @@ var Pagination = ({
3719
3723
  value: pageSize?.toString() || "10",
3720
3724
  onChange: handlePageSizeChange,
3721
3725
  placeholder: "10",
3722
- searchPlaceholder: t("search"),
3723
- emptyText: t("noOptions"),
3726
+ searchPlaceholder: labels?.search || t("search"),
3727
+ emptyText: labels?.noOptions || t("noOptions"),
3724
3728
  disabled
3725
3729
  }
3726
3730
  ) })
@@ -3976,7 +3980,10 @@ var DatePicker = ({
3976
3980
  disabled = false,
3977
3981
  size = "md",
3978
3982
  label,
3979
- required
3983
+ required,
3984
+ todayLabel,
3985
+ clearLabel,
3986
+ weekdayLabels
3980
3987
  }) => {
3981
3988
  const t = useTranslations5("DatePicker");
3982
3989
  const locale = useLocale();
@@ -4117,10 +4124,10 @@ var DatePicker = ({
4117
4124
  children: [
4118
4125
  /* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between mb-4", children: [
4119
4126
  /* @__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" }) }),
4127
+ /* @__PURE__ */ jsx27("div", { className: "text-sm font-semibold", children: viewDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }) }),
4121
4128
  /* @__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
4129
  ] }),
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)) }),
4130
+ /* @__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
4131
  /* @__PURE__ */ jsx27("div", { className: "grid grid-cols-7 gap-1", children: renderCalendar() })
4125
4132
  ]
4126
4133
  }
@@ -5643,7 +5650,8 @@ function DataTable({
5643
5650
  enableDensityToggle = true,
5644
5651
  striped = true,
5645
5652
  // Mặc định bật màu nền sẽn kẽ cho các dòng
5646
- className
5653
+ className,
5654
+ labels
5647
5655
  }) {
5648
5656
  const t = useTranslations7("Common");
5649
5657
  const [visibleCols, setVisibleCols] = React29.useState(() => columns.filter((c) => c.visible !== false).map((c) => c.key));
@@ -5823,12 +5831,12 @@ function DataTable({
5823
5831
  {
5824
5832
  trigger: /* @__PURE__ */ jsxs32(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
5825
5833
  /* @__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")
5834
+ labels?.density || t("density")
5827
5835
  ] }),
5828
5836
  items: [
5829
- { label: t("compact"), onClick: () => setDensity("compact") },
5830
- { label: t("normal"), onClick: () => setDensity("normal") },
5831
- { label: t("comfortable"), onClick: () => setDensity("comfortable") }
5837
+ { label: labels?.compact || t("compact"), onClick: () => setDensity("compact") },
5838
+ { label: labels?.normal || t("normal"), onClick: () => setDensity("normal") },
5839
+ { label: labels?.comfortable || t("comfortable"), onClick: () => setDensity("comfortable") }
5832
5840
  ]
5833
5841
  }
5834
5842
  ),
@@ -5845,7 +5853,7 @@ function DataTable({
5845
5853
  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
5854
  }
5847
5855
  ) }),
5848
- t("columns")
5856
+ labels?.columns || t("columns")
5849
5857
  ] }),
5850
5858
  children: columns.map((c) => /* @__PURE__ */ jsxs32(
5851
5859
  DropdownMenuItem,
@@ -5925,7 +5933,7 @@ var DataTable_default = DataTable;
5925
5933
  import { ExternalLink } from "lucide-react";
5926
5934
  import { useTranslations as useTranslations8 } from "next-intl";
5927
5935
  import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
5928
- function NotificationModal({ isOpen, onClose, notification }) {
5936
+ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkText, closeText }) {
5929
5937
  const t = useTranslations8("Common");
5930
5938
  if (!notification) return null;
5931
5939
  const formatTime2 = (dateString) => {
@@ -5950,7 +5958,7 @@ function NotificationModal({ isOpen, onClose, notification }) {
5950
5958
  {
5951
5959
  isOpen,
5952
5960
  onClose,
5953
- title: t("notifications"),
5961
+ title: titleText || t("notifications"),
5954
5962
  size: "md",
5955
5963
  children: /* @__PURE__ */ jsxs33("div", { className: "space-y-4", children: [
5956
5964
  /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2 pb-2 border-b border-border", children: [
@@ -5973,7 +5981,7 @@ function NotificationModal({ isOpen, onClose, notification }) {
5973
5981
  className: "gap-2",
5974
5982
  children: [
5975
5983
  /* @__PURE__ */ jsx39(ExternalLink, { className: "w-4 h-4" }),
5976
- t("openLink")
5984
+ openLinkText || t("openLink")
5977
5985
  ]
5978
5986
  }
5979
5987
  ),
@@ -5983,7 +5991,7 @@ function NotificationModal({ isOpen, onClose, notification }) {
5983
5991
  variant: "ghost",
5984
5992
  size: "sm",
5985
5993
  onClick: onClose,
5986
- children: t("close")
5994
+ children: closeText || t("close")
5987
5995
  }
5988
5996
  )
5989
5997
  ] })