@yuno-payments/dashboard-design-system 2.0.12 → 2.0.16

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.
@@ -1,2 +1,3 @@
1
1
  export { Pagination, type PaginationProps } from './pagination';
2
+ export { getPaginationTranslations, type PaginationLanguage, type PaginationTranslations, } from './pagination-translations';
2
3
  export { Pagination as PaginationRoot, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, } from '../../../vendor/shadcn/pagination';
@@ -3,6 +3,8 @@ interface PageNumbersProps {
3
3
  totalPages?: number;
4
4
  maxVisiblePages: number;
5
5
  onPageClick?: (page: number) => void;
6
+ /** Screen reader label for ellipsis (default: "More pages") */
7
+ morePagesLabel?: string;
6
8
  }
7
- declare const PageNumbers: ({ currentPage, totalPages, maxVisiblePages, onPageClick, }: PageNumbersProps) => import("react/jsx-runtime").JSX.Element;
9
+ declare const PageNumbers: ({ currentPage, totalPages, maxVisiblePages, onPageClick, morePagesLabel, }: PageNumbersProps) => import("react/jsx-runtime").JSX.Element;
8
10
  export { PageNumbers, type PageNumbersProps };
@@ -1,23 +1,24 @@
1
1
  import { j as i } from "../../../_virtual/jsx-runtime.js";
2
2
  import { PaginationItem as e, PaginationLink as t, PaginationEllipsis as h } from "../../../vendor/shadcn/pagination.js";
3
- import { calculateVisiblePages as a } from "./page-numbers.utils.js";
4
- const u = ({
3
+ import { calculateVisiblePages as d } from "./page-numbers.utils.js";
4
+ const b = ({
5
5
  currentPage: n,
6
6
  totalPages: l,
7
7
  maxVisiblePages: o,
8
- onPageClick: c
8
+ onPageClick: c,
9
+ morePagesLabel: m
9
10
  }) => {
10
11
  if (!l)
11
12
  return /* @__PURE__ */ i.jsx(e, { children: /* @__PURE__ */ i.jsx(t, { isActive: !0, children: n }) });
12
- const m = (s, r) => {
13
+ const x = (s, r) => {
13
14
  s.preventDefault(), r !== n && c?.(r);
14
- }, x = a(n, l, o);
15
- return /* @__PURE__ */ i.jsx(i.Fragment, { children: x.map(
16
- (s, r) => s === "ellipsis" ? /* @__PURE__ */ i.jsx(e, { children: /* @__PURE__ */ i.jsx(h, {}) }, `ellipsis-${r}`) : /* @__PURE__ */ i.jsx(e, { children: /* @__PURE__ */ i.jsx(
15
+ }, j = d(n, l, o);
16
+ return /* @__PURE__ */ i.jsx(i.Fragment, { children: j.map(
17
+ (s, r) => s === "ellipsis" ? /* @__PURE__ */ i.jsx(e, { children: /* @__PURE__ */ i.jsx(h, { srLabel: m }) }, `ellipsis-${r}`) : /* @__PURE__ */ i.jsx(e, { children: /* @__PURE__ */ i.jsx(
17
18
  t,
18
19
  {
19
20
  href: "#",
20
- onClick: (j) => m(j, s),
21
+ onClick: (a) => x(a, s),
21
22
  isActive: s === n,
22
23
  children: s
23
24
  }
@@ -25,5 +26,5 @@ const u = ({
25
26
  ) });
26
27
  };
27
28
  export {
28
- u as PageNumbers
29
+ b as PageNumbers
29
30
  };
@@ -0,0 +1,33 @@
1
+ import { SupportedLanguage } from '../../../lib/utils';
2
+ /**
3
+ * Supported languages for pagination translations
4
+ */
5
+ export type PaginationLanguage = SupportedLanguage;
6
+ /**
7
+ * Translation strings for Pagination component
8
+ */
9
+ export interface PaginationTranslations {
10
+ /** Text for "Previous" button */
11
+ previous?: string;
12
+ /** Text for "Next" button */
13
+ next?: string;
14
+ /** Screen reader text for ellipsis ("More pages") */
15
+ morePages?: string;
16
+ /** Aria-label for Previous button */
17
+ goToPreviousPage?: string;
18
+ /** Aria-label for Next button */
19
+ goToNextPage?: string;
20
+ }
21
+ /**
22
+ * All translations by language code
23
+ */
24
+ export declare const PAGINATION_TRANSLATIONS: Record<PaginationLanguage, Required<PaginationTranslations>>;
25
+ /**
26
+ * Default translations (English)
27
+ */
28
+ export declare const DEFAULT_PAGINATION_TRANSLATIONS: Required<PaginationTranslations>;
29
+ /**
30
+ * Get translations for a specific language
31
+ * Falls back to localStorage language, then to English if not found
32
+ */
33
+ export declare function getPaginationTranslations(lang?: PaginationLanguage): Required<PaginationTranslations>;
@@ -0,0 +1,82 @@
1
+ import { getDefaultLanguage as g } from "../../../lib/utils.js";
2
+ const e = {
3
+ previous: "Previous",
4
+ next: "Next",
5
+ morePages: "More pages",
6
+ goToPreviousPage: "Go to previous page",
7
+ goToNextPage: "Go to next page"
8
+ }, r = {
9
+ previous: "Anterior",
10
+ next: "Siguiente",
11
+ morePages: "Más páginas",
12
+ goToPreviousPage: "Ir a página anterior",
13
+ goToNextPage: "Ir a página siguiente"
14
+ }, t = {
15
+ previous: "前へ",
16
+ next: "次へ",
17
+ morePages: "その他のページ",
18
+ goToPreviousPage: "前のページへ",
19
+ goToNextPage: "次のページへ"
20
+ }, s = {
21
+ previous: "السابق",
22
+ next: "التالي",
23
+ morePages: "صفحات أخرى",
24
+ goToPreviousPage: "انتقل إلى الصفحة السابقة",
25
+ goToNextPage: "انتقل إلى الصفحة التالية"
26
+ }, i = {
27
+ previous: "Précédent",
28
+ next: "Suivant",
29
+ morePages: "Plus de pages",
30
+ goToPreviousPage: "Aller à la page précédente",
31
+ goToNextPage: "Aller à la page suivante"
32
+ }, n = {
33
+ previous: "Anterior",
34
+ next: "Próximo",
35
+ morePages: "Mais páginas",
36
+ goToPreviousPage: "Ir para página anterior",
37
+ goToNextPage: "Ir para próxima página"
38
+ }, T = {
39
+ previous: "Önceki",
40
+ next: "Sonraki",
41
+ morePages: "Daha fazla sayfa",
42
+ goToPreviousPage: "Önceki sayfaya git",
43
+ goToNextPage: "Sonraki sayfaya git"
44
+ }, P = {
45
+ previous: "Назад",
46
+ next: "Вперёд",
47
+ morePages: "Ещё страницы",
48
+ goToPreviousPage: "Перейти на предыдущую страницу",
49
+ goToNextPage: "Перейти на следующую страницу"
50
+ }, N = {
51
+ previous: "Zurück",
52
+ next: "Weiter",
53
+ morePages: "Weitere Seiten",
54
+ goToPreviousPage: "Zur vorherigen Seite",
55
+ goToNextPage: "Zur nächsten Seite"
56
+ }, u = {
57
+ previous: "上一页",
58
+ next: "下一页",
59
+ morePages: "更多页面",
60
+ goToPreviousPage: "转到上一页",
61
+ goToNextPage: "转到下一页"
62
+ }, A = {
63
+ en: e,
64
+ es: r,
65
+ ja: t,
66
+ ar: s,
67
+ fr: i,
68
+ pt: n,
69
+ tr: T,
70
+ ru: P,
71
+ de: N,
72
+ zh: u
73
+ }, S = e;
74
+ function v(o) {
75
+ const a = o ?? g();
76
+ return A[a] ?? S;
77
+ }
78
+ export {
79
+ S as DEFAULT_PAGINATION_TRANSLATIONS,
80
+ A as PAGINATION_TRANSLATIONS,
81
+ v as getPaginationTranslations
82
+ };
@@ -1,4 +1,5 @@
1
1
  import { ComponentProps } from 'react';
2
+ import { PaginationLanguage, PaginationTranslations } from './pagination-translations';
2
3
  /**
3
4
  * Props for the Pagination component
4
5
  */
@@ -43,6 +44,14 @@ interface PaginationProps extends ComponentProps<"nav"> {
43
44
  * @default 5
44
45
  */
45
46
  maxVisiblePages?: number;
47
+ /**
48
+ * Language for translations. Falls back to localStorage "yuno-lang", then "en".
49
+ */
50
+ lang?: PaginationLanguage;
51
+ /**
52
+ * Custom translations to override default language strings
53
+ */
54
+ translations?: Partial<PaginationTranslations>;
46
55
  }
47
56
  /**
48
57
  * Pagination component for navigating through multiple pages of content.
@@ -1,58 +1,66 @@
1
- import { j as i } from "../../../_virtual/jsx-runtime.js";
2
- import { forwardRef as D } from "react";
3
- import { PageNumbers as N } from "./page-numbers.js";
4
- import { Pagination as b, PaginationContent as g, PaginationItem as r, PaginationPrevious as v, PaginationNext as k } from "../../../vendor/shadcn/pagination.js";
5
- const l = "pointer-events-none opacity-50", S = D(
1
+ import { j as e } from "../../../_virtual/jsx-runtime.js";
2
+ import { forwardRef as C, useMemo as D } from "react";
3
+ import { PageNumbers as L } from "./page-numbers.js";
4
+ import { Pagination as k, PaginationContent as S, PaginationItem as m, PaginationPrevious as y, PaginationNext as A } from "../../../vendor/shadcn/pagination.js";
5
+ import { getPaginationTranslations as E } from "./pagination-translations.js";
6
+ const c = "pointer-events-none opacity-50", I = C(
6
7
  ({
7
8
  currentPage: n,
8
- totalPages: e,
9
- onPageClick: c,
10
- onClickNext: f,
11
- onClickPrev: d,
12
- disablePrevious: m = !1,
13
- disableNext: x = !1,
14
- showPreviousNext: o = !0,
15
- maxVisiblePages: p = 5,
16
- className: j,
17
- ...h
18
- }, u) => {
19
- const a = n === 1 || m, s = (e ? n >= e : !1) || x, P = (t) => {
20
- t.preventDefault(), !a && d?.();
21
- }, C = (t) => {
22
- t.preventDefault(), !s && f?.();
9
+ totalPages: o,
10
+ onPageClick: d,
11
+ onClickNext: x,
12
+ onClickPrev: p,
13
+ disablePrevious: P = !1,
14
+ disableNext: g = !1,
15
+ showPreviousNext: r = !0,
16
+ maxVisiblePages: u = 5,
17
+ lang: l,
18
+ translations: f,
19
+ className: b,
20
+ ...j
21
+ }, h) => {
22
+ const a = D(() => ({ ...E(l), ...f }), [l, f]), s = n === 1 || P, t = (o ? n >= o : !1) || g, v = (i) => {
23
+ i.preventDefault(), !s && p?.();
24
+ }, N = (i) => {
25
+ i.preventDefault(), !t && x?.();
23
26
  };
24
- return /* @__PURE__ */ i.jsx(b, { ref: u, className: j, ...h, children: /* @__PURE__ */ i.jsxs(g, { children: [
25
- o && /* @__PURE__ */ i.jsx(r, { children: /* @__PURE__ */ i.jsx(
26
- v,
27
+ return /* @__PURE__ */ e.jsx(k, { ref: h, className: b, ...j, children: /* @__PURE__ */ e.jsxs(S, { children: [
28
+ r && /* @__PURE__ */ e.jsx(m, { children: /* @__PURE__ */ e.jsx(
29
+ y,
27
30
  {
28
31
  href: "#",
29
- onClick: P,
30
- "aria-disabled": a,
31
- className: a ? l : ""
32
+ onClick: v,
33
+ "aria-disabled": s,
34
+ className: s ? c : "",
35
+ label: a.previous,
36
+ ariaLabel: a.goToPreviousPage
32
37
  }
33
38
  ) }),
34
- /* @__PURE__ */ i.jsx(
35
- N,
39
+ /* @__PURE__ */ e.jsx(
40
+ L,
36
41
  {
37
42
  currentPage: n,
38
- totalPages: e,
39
- maxVisiblePages: p,
40
- onPageClick: c
43
+ totalPages: o,
44
+ maxVisiblePages: u,
45
+ onPageClick: d,
46
+ morePagesLabel: a.morePages
41
47
  }
42
48
  ),
43
- o && /* @__PURE__ */ i.jsx(r, { children: /* @__PURE__ */ i.jsx(
44
- k,
49
+ r && /* @__PURE__ */ e.jsx(m, { children: /* @__PURE__ */ e.jsx(
50
+ A,
45
51
  {
46
52
  href: "#",
47
- onClick: C,
48
- "aria-disabled": s,
49
- className: s ? l : ""
53
+ onClick: N,
54
+ "aria-disabled": t,
55
+ className: t ? c : "",
56
+ label: a.next,
57
+ ariaLabel: a.goToNextPage
50
58
  }
51
59
  ) })
52
60
  ] }) });
53
61
  }
54
62
  );
55
- S.displayName = "Pagination";
63
+ I.displayName = "Pagination";
56
64
  export {
57
- S as Pagination
65
+ I as Pagination
58
66
  };