@payfit/unity-components 1.2.0 → 2.0.0

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.
Files changed (136) hide show
  1. package/dist/esm/components/action-bar/ActionBar.js +14 -14
  2. package/dist/esm/components/actionable/Actionable.js +31 -28
  3. package/dist/esm/components/app-layout/AppLayout.js +17 -17
  4. package/dist/esm/components/app-menu/parts/AppMenuHeader.d.ts +86 -4
  5. package/dist/esm/components/app-menu/parts/AppMenuHeader.js +25 -25
  6. package/dist/esm/components/breadcrumbs/Breadcrumbs.context.js +3 -3
  7. package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +19 -11
  8. package/dist/esm/components/breadcrumbs/Breadcrumbs.js +29 -18
  9. package/dist/esm/components/breadcrumbs/parts/Breadcrumb.d.ts +30 -5
  10. package/dist/esm/components/breadcrumbs/parts/Breadcrumb.js +35 -27
  11. package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.d.ts +37 -0
  12. package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.js +36 -0
  13. package/dist/esm/components/client-side-pagination/ClientSidePagination.d.ts +103 -0
  14. package/dist/esm/components/client-side-pagination/ClientSidePagination.js +177 -0
  15. package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.d.ts +11 -0
  16. package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.js +30 -0
  17. package/dist/esm/components/client-side-pagination/parts/PaginationJumpDialog.d.ts +8 -0
  18. package/dist/esm/components/{pagination/parts/PaginationLink.d.ts → client-side-pagination/parts/RawPaginationLink.d.ts} +2 -2
  19. package/dist/esm/components/{pagination/parts/PaginationLink.js → client-side-pagination/parts/RawPaginationLink.js} +2 -2
  20. package/dist/esm/components/client-side-pagination/utils/pagination-window.d.ts +8 -0
  21. package/dist/esm/components/client-side-pagination/utils/pagination-window.js +33 -0
  22. package/dist/esm/components/error-state/ErrorState.d.ts +13 -1
  23. package/dist/esm/components/error-state/ErrorState.js +133 -92
  24. package/dist/esm/components/error-state/initConfig.js +1 -1
  25. package/dist/esm/components/fieldset/Fieldset.d.ts +19 -0
  26. package/dist/esm/components/fieldset/Fieldset.js +32 -26
  27. package/dist/esm/components/flex/Flex.js +52 -37
  28. package/dist/esm/components/form-field/FormField.js +12 -12
  29. package/dist/esm/components/form-field/parts/{FormContextualLink.d.ts → RawFormContextualLink.d.ts} +2 -2
  30. package/dist/esm/components/form-field/parts/RawFormContextualLink.js +39 -0
  31. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
  32. package/dist/esm/components/icon/Icon.js +23 -19
  33. package/dist/esm/components/link/{Link.variants.d.ts → RawLink.d.ts} +92 -0
  34. package/dist/esm/components/link/{Link.variants.js → RawLink.js} +70 -4
  35. package/dist/esm/components/menu/parts/{MenuItem.d.ts → RawMenuItem.d.ts} +3 -4
  36. package/dist/esm/components/menu/parts/{MenuItem.js → RawMenuItem.js} +9 -9
  37. package/dist/esm/components/nav/parts/NavGroup.d.ts +3 -3
  38. package/dist/esm/components/nav/parts/NavGroup.js +62 -51
  39. package/dist/esm/components/nav/parts/{NavItem.d.ts → RawNavItem.d.ts} +102 -5
  40. package/dist/esm/components/nav/parts/RawNavItem.js +106 -0
  41. package/dist/esm/components/page/Page.js +1 -1
  42. package/dist/esm/components/page/parts/PageHeader.d.ts +79 -9
  43. package/dist/esm/components/page/parts/PageHeader.js +22 -20
  44. package/dist/esm/components/pagination/Pagination.d.ts +23 -44
  45. package/dist/esm/components/pagination/Pagination.js +89 -163
  46. package/dist/esm/components/pagination/PaginationContext.d.ts +11 -0
  47. package/dist/esm/components/pagination/PaginationContext.js +15 -0
  48. package/dist/esm/components/pagination/hooks/use-pagination-state.d.ts +63 -0
  49. package/dist/esm/components/pagination/hooks/use-pagination-state.js +27 -0
  50. package/dist/esm/components/pagination/hooks/use-pagination-window.d.ts +64 -0
  51. package/dist/esm/components/pagination/hooks/use-pagination-window.js +15 -0
  52. package/dist/esm/components/pagination/parts/PaginationContent.d.ts +30 -0
  53. package/dist/esm/components/pagination/parts/PaginationContent.js +37 -0
  54. package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +23 -4
  55. package/dist/esm/components/pagination/parts/PaginationEllipsis.js +20 -16
  56. package/dist/esm/components/pagination/parts/PaginationItem.d.ts +38 -0
  57. package/dist/esm/components/pagination/parts/PaginationItem.js +22 -0
  58. package/dist/esm/components/pagination/parts/RawPaginationLink.d.ts +11 -0
  59. package/dist/esm/components/pagination/parts/RawPaginationLink.js +60 -0
  60. package/dist/esm/components/pagination/parts/RawPaginationNext.d.ts +22 -0
  61. package/dist/esm/components/pagination/parts/RawPaginationNext.js +70 -0
  62. package/dist/esm/components/pagination/parts/RawPaginationPrevious.d.ts +22 -0
  63. package/dist/esm/components/pagination/parts/RawPaginationPrevious.js +67 -0
  64. package/dist/esm/components/pagination/utils/pagination-window.js +29 -20
  65. package/dist/esm/components/select/Select.js +63 -45
  66. package/dist/esm/components/select/parts/SelectOption.js +9 -9
  67. package/dist/esm/components/skip-links/SkipLinks.js +1 -1
  68. package/dist/esm/components/table/Table.d.ts +1 -0
  69. package/dist/esm/components/table/Table.js +82 -73
  70. package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +6 -6
  71. package/dist/esm/components/table/parts/TableCell.js +29 -26
  72. package/dist/esm/components/table/parts/TablePagination.d.ts +5 -5
  73. package/dist/esm/components/table/parts/TablePagination.js +10 -10
  74. package/dist/esm/components/table/parts/TableRow.js +21 -18
  75. package/dist/esm/components/tabs/parts/{Tab.d.ts → RawTab.d.ts} +2 -2
  76. package/dist/esm/components/tabs/parts/{Tab.js → RawTab.js} +6 -6
  77. package/dist/esm/components/task-menu/TaskMenu.d.ts +4 -4
  78. package/dist/esm/components/task-menu/parts/{SubTask.d.ts → RawSubTask.d.ts} +7 -7
  79. package/dist/esm/components/task-menu/parts/{SubTask.js → RawSubTask.js} +19 -19
  80. package/dist/esm/components/task-menu/parts/{Task.d.ts → RawTask.d.ts} +7 -7
  81. package/dist/esm/components/task-menu/parts/{Task.js → RawTask.js} +17 -17
  82. package/dist/esm/components/task-menu/parts/TaskGroup.d.ts +5 -5
  83. package/dist/esm/components/text/Text.js +30 -27
  84. package/dist/esm/hooks/use-container-query-level.d.ts +42 -0
  85. package/dist/esm/hooks/use-container-query-level.js +33 -0
  86. package/dist/esm/index.d.ts +21 -11
  87. package/dist/esm/index.js +424 -399
  88. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumb.d.ts +23 -0
  89. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.d.ts +38 -0
  90. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.js +7 -0
  91. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumbs.d.ts +23 -0
  92. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/use-route-breadcrumb.d.ts +53 -0
  93. package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.d.ts +40 -0
  94. package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.js +7 -0
  95. package/dist/esm/integrations/tanstack-router/components/link/Link.d.ts +33 -0
  96. package/dist/esm/integrations/tanstack-router/components/link/Link.js +7 -0
  97. package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.d.ts +49 -0
  98. package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.js +16 -0
  99. package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.d.ts +52 -0
  100. package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.js +29 -0
  101. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.d.ts +54 -0
  102. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.js +21 -0
  103. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.d.ts +52 -0
  104. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.js +22 -0
  105. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.d.ts +51 -0
  106. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.js +22 -0
  107. package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.d.ts +82 -0
  108. package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.js +41 -0
  109. package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.d.ts +52 -0
  110. package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.js +15 -0
  111. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabList.d.ts +5 -0
  112. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.d.ts +77 -0
  113. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.js +16 -0
  114. package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.d.ts +69 -0
  115. package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.js +14 -0
  116. package/dist/esm/integrations/tanstack-router/components/task-menu/Task.d.ts +64 -0
  117. package/dist/esm/integrations/tanstack-router/components/task-menu/Task.js +14 -0
  118. package/dist/esm/integrations/tanstack-router/index.d.ts +16 -0
  119. package/dist/esm/integrations/tanstack-router/utils/decorators.d.ts +23 -0
  120. package/dist/esm/integrations/tanstack-router.js +34 -0
  121. package/dist/esm/providers/router/RouterProvider.d.ts +7 -2
  122. package/dist/esm/providers/router/RouterProvider.js +14 -10
  123. package/dist/esm/types/DataAttributes.d.ts +1 -1
  124. package/i18n/en-GB.json +1 -0
  125. package/i18n/es-ES.json +1 -0
  126. package/i18n/fr-FR.json +1 -0
  127. package/package.json +47 -25
  128. package/dist/esm/components/form-field/parts/FormContextualLink.js +0 -37
  129. package/dist/esm/components/link/Link.d.ts +0 -93
  130. package/dist/esm/components/link/Link.js +0 -68
  131. package/dist/esm/components/nav/parts/NavItem.js +0 -95
  132. /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.d.ts +0 -0
  133. /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.js +0 -0
  134. /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationJumpDialog.js +0 -0
  135. /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.d.ts +0 -0
  136. /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.js +0 -0
@@ -0,0 +1,37 @@
1
+ import { RawLinkProps } from '../../link/RawLink.js';
2
+ export declare const BREADCRUMB_CONTENT_MAX_LENGTH = 25;
3
+ export type RawBreadcrumbLinkProps = RawLinkProps;
4
+ /**
5
+ * A styled link component for breadcrumbs that enforces Unity design system styling.
6
+ * This component automatically truncates long text and displays a tooltip when the content exceeds 25 characters.
7
+ * @param props - Link props from RawLink {@see {@link RawLinkProps}}
8
+ * @example
9
+ * ```tsx
10
+ * import { RawBreadcrumbLink } from '@payfit/unity-components'
11
+ *
12
+ * function Example() {
13
+ * return (
14
+ * <RawBreadcrumbLink href="/dashboard">
15
+ * Dashboard
16
+ * </RawBreadcrumbLink>
17
+ * )
18
+ * }
19
+ * ```
20
+ * @remarks
21
+ * - The component enforces breadcrumb-specific styling that cannot be overridden
22
+ * - Text longer than 25 characters is automatically truncated with a tooltip
23
+ * - Uses the 'secondary' color variant for breadcrumb links
24
+ * @see {@link RawBreadcrumbLinkProps} for all available props
25
+ */
26
+ declare const RawBreadcrumbLink: import('react').ForwardRefExoticComponent<Omit<import('react-aria-components').LinkProps, "className" | "style"> & {
27
+ href: HTMLAnchorElement["href"];
28
+ id?: import('react').HTMLAttributes<HTMLAnchorElement>["id"];
29
+ size?: "default" | "small" | "inherit" | "large" | undefined;
30
+ variant?: "inline" | "standalone" | undefined;
31
+ color?: "inherit" | "primary" | "secondary" | undefined;
32
+ isExternal?: boolean;
33
+ isCurrent?: Pick<import('react').HTMLAttributes<HTMLAnchorElement>, "aria-current"> | undefined;
34
+ isExact?: boolean;
35
+ maxCharactersTruncation?: number;
36
+ } & import('react').RefAttributes<HTMLAnchorElement>>;
37
+ export { RawBreadcrumbLink };
@@ -0,0 +1,36 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
+ import { RawLink as e } from "../../link/RawLink.js";
4
+ import { Tooltip as m } from "../../tooltip/Tooltip.js";
5
+ const t = 25, u = i(
6
+ ({ children: o, href: a, ...n }, s) => {
7
+ const c = typeof o == "string" ? o : "";
8
+ return c.length > t ? /* @__PURE__ */ r(m, { title: c, children: /* @__PURE__ */ r(
9
+ e,
10
+ {
11
+ isExact: !0,
12
+ href: a,
13
+ color: "secondary",
14
+ maxCharactersTruncation: t,
15
+ ref: s,
16
+ ...n,
17
+ children: o
18
+ }
19
+ ) }) : /* @__PURE__ */ r(
20
+ e,
21
+ {
22
+ isExact: !0,
23
+ href: a,
24
+ color: "secondary",
25
+ maxCharactersTruncation: t,
26
+ ...n,
27
+ children: o
28
+ }
29
+ );
30
+ }
31
+ );
32
+ u.displayName = "BreadcrumbLink";
33
+ export {
34
+ t as BREADCRUMB_CONTENT_MAX_LENGTH,
35
+ u as RawBreadcrumbLink
36
+ };
@@ -0,0 +1,103 @@
1
+ import { VariantProps } from '@payfit/unity-themes';
2
+ import { ComponentType } from 'react';
3
+ import { PaginationLinkProps } from './parts/RawPaginationLink.js';
4
+ export declare const pagination: import('tailwind-variants').TVReturnType<{
5
+ [key: string]: {
6
+ [key: string]: import('tailwind-merge').ClassNameValue | {
7
+ base?: import('tailwind-merge').ClassNameValue;
8
+ pagesList?: import('tailwind-merge').ClassNameValue;
9
+ };
10
+ };
11
+ } | {
12
+ [x: string]: {
13
+ [x: string]: import('tailwind-merge').ClassNameValue | {
14
+ base?: import('tailwind-merge').ClassNameValue;
15
+ pagesList?: import('tailwind-merge').ClassNameValue;
16
+ };
17
+ };
18
+ } | {}, {
19
+ base: string;
20
+ pagesList: string;
21
+ }, undefined, {
22
+ [key: string]: {
23
+ [key: string]: import('tailwind-merge').ClassNameValue | {
24
+ base?: import('tailwind-merge').ClassNameValue;
25
+ pagesList?: import('tailwind-merge').ClassNameValue;
26
+ };
27
+ };
28
+ } | {}, {
29
+ base: string;
30
+ pagesList: string;
31
+ }, import('tailwind-variants').TVReturnType<unknown, {
32
+ base: string;
33
+ pagesList: string;
34
+ }, undefined, unknown, unknown, undefined>>;
35
+ export interface ClientSidePaginationProps extends VariantProps<typeof pagination> {
36
+ /**
37
+ * The total number of pages to display
38
+ */
39
+ pageCount: number;
40
+ /**
41
+ * The current page for controlled mode usage
42
+ */
43
+ currentPage?: number;
44
+ /**
45
+ * The initial page to display when in uncontrolled mode
46
+ */
47
+ defaultPage?: number;
48
+ /**
49
+ * Optional callback function that is triggered when a page hover event occurs.
50
+ * Can be used to handle logic or effects related to the hover action over a specific page.
51
+ * @param {number} page - The number of the page that is being hovered over.
52
+ */
53
+ onPageHover?: (page: number) => void;
54
+ /**
55
+ * Callback fired when the page changes
56
+ * @param page - The new page number
57
+ * @param previous - The previous page number
58
+ * @param direction - The direction of navigation (1 for forward, -1 for backward)
59
+ */
60
+ onPageChange?: (page: number, previous: number, direction: -1 | 1) => void;
61
+ /**
62
+ * Optional callback for the "next" button's press
63
+ */
64
+ onNextPress?: () => void;
65
+ /**
66
+ * Optional callback for previous button press
67
+ */
68
+ onPreviousPress?: () => void;
69
+ /**
70
+ * Component used to render the pagination links
71
+ * @default 'RawPaginationLink'
72
+ */
73
+ LinkComponent?: ComponentType<PaginationLinkProps>;
74
+ }
75
+ /**
76
+ * The ClientSidePagination component helps users navigate through multiple pages of content by providing intuitive controls for moving between pages.
77
+ *
78
+ * This component is designed for client-side pagination use cases where state is managed in React state rather than URL parameters.
79
+ * For URL-driven pagination, use the composition-based Pagination components instead.
80
+ *
81
+ * Pagination offers both controlled and uncontrolled usage, support for keyboard navigation, and automatic handling of page ranges with ellipsis for large numbers of pages.
82
+ * @param {ClientSidePaginationProps} props - Regular HTML div attributes plus pagination-specific properties
83
+ * @see {@link ClientSidePaginationProps} for all available props
84
+ * @example
85
+ * ```tsx
86
+ * import { ClientSidePagination } from '@payfit/unity-components'
87
+ *
88
+ * function Example() {
89
+ * const [currentPage, setCurrentPage] = useState(1)
90
+ * return (
91
+ * <ClientSidePagination
92
+ * pageCount={10}
93
+ * currentPage={currentPage}
94
+ * onPageChange={(page) => setCurrentPage(page)}
95
+ * />
96
+ * )
97
+ * }
98
+ * ```
99
+ * @remarks
100
+ * [API](https://unity-components.payfit.io/?path=/docs/navigation-pagination--docs) • [Demo](https://unity-components.payfit.io/?path=/docs/navigation-pagination--docs)
101
+ */
102
+ declare const ClientSidePagination: import('react').ForwardRefExoticComponent<ClientSidePaginationProps & import('react').RefAttributes<HTMLDivElement>>;
103
+ export { ClientSidePagination };
@@ -0,0 +1,177 @@
1
+ import { jsxs as x, jsx as n } from "react/jsx-runtime";
2
+ import { forwardRef as M, useRef as T, useMemo as q } from "react";
3
+ import { uyTv as R } from "@payfit/unity-themes";
4
+ import { useId as S } from "react-aria";
5
+ import { useIntl as E } from "react-intl";
6
+ import { useOverlayTriggerState as W } from "react-stately";
7
+ import { usePagination as $ } from "./hooks/use-pagination.js";
8
+ import { PaginationEllipsis as j } from "./parts/PaginationEllipsis.js";
9
+ import { PaginationJumpDialog as J } from "./parts/PaginationJumpDialog.js";
10
+ import { PaginationNavButton as y } from "./parts/PaginationNavButton.js";
11
+ import { RawPaginationLink as K } from "./parts/RawPaginationLink.js";
12
+ import { generatePaginationWithWindow as O } from "./utils/pagination-window.js";
13
+ const H = R({
14
+ slots: {
15
+ base: "uy:flex uy:gap-100 uy:relative",
16
+ pagesList: "uy:flex uy:gap-100 uy:list-none uy:m-0 uy:p-0"
17
+ }
18
+ }), _ = 7, z = M(
19
+ ({
20
+ pageCount: t,
21
+ defaultPage: c,
22
+ currentPage: u,
23
+ onPageHover: b,
24
+ onPageChange: f,
25
+ onNextPress: w,
26
+ onPreviousPress: P,
27
+ LinkComponent: D = K,
28
+ ...A
29
+ }, L) => {
30
+ const p = S(), l = E(), v = u !== void 0 && f !== void 0 && c === void 0, { currentPage: s, goToPage: i } = $({
31
+ pageCount: t,
32
+ initialPage: v ? u : c,
33
+ onPageChange: f,
34
+ isControlled: v
35
+ }), m = W({}), r = T(/* @__PURE__ */ new Map()), h = q(
36
+ () => O(
37
+ t,
38
+ s,
39
+ _
40
+ ),
41
+ [t, s]
42
+ ), k = new Intl.NumberFormat(l.locale, {
43
+ notation: "standard"
44
+ }), N = (e) => {
45
+ i(e), m.close(), requestAnimationFrame(() => {
46
+ const a = r.current.get(e);
47
+ a && a.focus();
48
+ });
49
+ }, d = (e, a) => {
50
+ switch (e.key) {
51
+ case "ArrowLeft":
52
+ case "ArrowUp":
53
+ e.preventDefault(), a > 1 && (i(a - 1), requestAnimationFrame(() => {
54
+ r.current.get(a - 1)?.focus();
55
+ }));
56
+ break;
57
+ case "ArrowRight":
58
+ case "ArrowDown":
59
+ e.preventDefault(), a < t && (i(a + 1), requestAnimationFrame(() => {
60
+ r.current.get(a + 1)?.focus();
61
+ }));
62
+ break;
63
+ case "Home":
64
+ e.preventDefault(), i(1), requestAnimationFrame(() => {
65
+ r.current.get(1)?.focus();
66
+ });
67
+ break;
68
+ case "End":
69
+ e.preventDefault(), i(t), requestAnimationFrame(() => {
70
+ r.current.get(t)?.focus();
71
+ });
72
+ break;
73
+ }
74
+ }, g = {
75
+ paginationLabel: l.formatMessage({
76
+ id: "unity:component:pagination:label",
77
+ defaultMessage: "Pagination"
78
+ }),
79
+ pageListLabel: l.formatMessage(
80
+ {
81
+ id: "unity:component:pagination:page-list:label",
82
+ defaultMessage: "Page {current} of {total}"
83
+ },
84
+ {
85
+ current: s,
86
+ total: t
87
+ }
88
+ )
89
+ }, { base: F, pagesList: I } = H();
90
+ return /* @__PURE__ */ x(
91
+ "nav",
92
+ {
93
+ "data-dd-privacy": "allow",
94
+ ...A,
95
+ ref: L,
96
+ className: F(),
97
+ "aria-labelledby": g.paginationLabel,
98
+ children: [
99
+ /* @__PURE__ */ n(
100
+ J,
101
+ {
102
+ pageCount: t,
103
+ onJumpToPage: N,
104
+ state: m
105
+ }
106
+ ),
107
+ /* @__PURE__ */ n(
108
+ y,
109
+ {
110
+ variant: "previous",
111
+ isDisabled: s === 1,
112
+ onClick: () => {
113
+ i("previous"), P?.();
114
+ }
115
+ }
116
+ ),
117
+ /* @__PURE__ */ n("ul", { className: I(), "aria-label": g.pageListLabel, children: h.map(
118
+ (e, a) => e.type === "page" ? /* @__PURE__ */ n(
119
+ "li",
120
+ {
121
+ "aria-setsize": t,
122
+ "aria-posinset": e.value,
123
+ children: /* @__PURE__ */ n(
124
+ D,
125
+ {
126
+ ref: (o) => {
127
+ o ? r.current.set(e.value, o) : r.current.delete(e.value);
128
+ },
129
+ onPress: () => {
130
+ i(e.value);
131
+ },
132
+ onHoverChange: (o) => {
133
+ o && b?.(e.value);
134
+ },
135
+ onKeyDown: (o) => {
136
+ d(o, e.value);
137
+ },
138
+ isActive: e.value === s,
139
+ value: e.value,
140
+ children: k.format(e.value)
141
+ }
142
+ )
143
+ },
144
+ `pagination-${p}-item-${a}`
145
+ ) : /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
146
+ j,
147
+ {
148
+ value: e.value,
149
+ onKeyDown: (o) => {
150
+ d(o, -1);
151
+ },
152
+ onPress: () => {
153
+ m.open();
154
+ }
155
+ }
156
+ ) }, `pagination-${p}-item-${a}`)
157
+ ) }),
158
+ /* @__PURE__ */ n(
159
+ y,
160
+ {
161
+ variant: "next",
162
+ isDisabled: s === t,
163
+ onClick: () => {
164
+ i("next"), w?.();
165
+ }
166
+ }
167
+ )
168
+ ]
169
+ }
170
+ );
171
+ }
172
+ );
173
+ z.displayName = "ClientSidePagination";
174
+ export {
175
+ z as ClientSidePagination,
176
+ H as pagination
177
+ };
@@ -0,0 +1,11 @@
1
+ import { VariantProps } from '@payfit/unity-themes';
2
+ import { ButtonProps } from 'react-aria-components';
3
+ import { paginationLink } from './RawPaginationLink.js';
4
+ export interface PaginationEllipsisProps extends Omit<ButtonProps, 'value' | 'children' | 'className' | 'style' | 'slot'>, VariantProps<typeof paginationLink> {
5
+ value: [number, number];
6
+ id?: string;
7
+ isDisabled?: boolean;
8
+ isActive?: boolean;
9
+ }
10
+ declare const PaginationEllipsis: import('react').ForwardRefExoticComponent<PaginationEllipsisProps & import('react').RefAttributes<HTMLButtonElement>>;
11
+ export { PaginationEllipsis };
@@ -0,0 +1,30 @@
1
+ import { jsxs as l, jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as r } from "react";
3
+ import { uyTv as a } from "@payfit/unity-themes";
4
+ import { Button as y } from "react-aria-components";
5
+ import { useIntl as p } from "react-intl";
6
+ const c = a({
7
+ base: [
8
+ "uy:min-w-300 uy:h-300 uy:p-25 uy:flex uy:justify-center uy:items-center uy:typography-action uy:rounded-pill uy:cursor-default",
9
+ "uy:focus-visible:outline-2 uy:focus-visible:outline-solid uy:focus-visible:outline-utility-focus-ring uy:focus-visible:outline-offset-2"
10
+ ]
11
+ }), f = r(({ value: s, ...e }, o) => {
12
+ const t = p(), [n, u] = s;
13
+ return /* @__PURE__ */ l(y, { ref: o, className: c(), ...e, children: [
14
+ /* @__PURE__ */ i("span", { "aria-hidden": !0, children: "…" }),
15
+ /* @__PURE__ */ i("span", { className: "uy:sr-only", children: t.formatMessage(
16
+ {
17
+ id: "unity:component:pagination:ellipsis:label",
18
+ defaultMessage: "More pages"
19
+ },
20
+ {
21
+ start: n,
22
+ end: u
23
+ }
24
+ ) })
25
+ ] });
26
+ });
27
+ f.displayName = "PaginationEllipsis";
28
+ export {
29
+ f as PaginationEllipsis
30
+ };
@@ -0,0 +1,8 @@
1
+ import { OverlayTriggerState } from 'react-stately';
2
+ interface PaginationJumpDialogProps {
3
+ pageCount: number;
4
+ onJumpToPage: (page: number) => void;
5
+ state: OverlayTriggerState;
6
+ }
7
+ export declare function PaginationJumpDialog({ pageCount, onJumpToPage, state, }: PaginationJumpDialogProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -22,5 +22,5 @@ export interface PaginationLinkProps extends LinkProps, VariantProps<typeof pagi
22
22
  isDisabled?: boolean;
23
23
  isActive?: boolean;
24
24
  }
25
- declare const PaginationLink: import('react').ForwardRefExoticComponent<PaginationLinkProps & import('react').RefAttributes<HTMLAnchorElement>>;
26
- export { PaginationLink };
25
+ declare const RawPaginationLink: import('react').ForwardRefExoticComponent<PaginationLinkProps & import('react').RefAttributes<HTMLAnchorElement>>;
26
+ export { RawPaginationLink };
@@ -42,8 +42,8 @@ const d = s({
42
42
  );
43
43
  }
44
44
  );
45
- y.displayName = "PaginationLink";
45
+ y.displayName = "RawPaginationLink";
46
46
  export {
47
- y as PaginationLink,
47
+ y as RawPaginationLink,
48
48
  d as paginationLink
49
49
  };
@@ -0,0 +1,8 @@
1
+ export type PageItem = {
2
+ type: 'page';
3
+ value: number;
4
+ } | {
5
+ type: 'ellipsis';
6
+ value: [number, number];
7
+ };
8
+ export declare function generatePaginationWithWindow(pageCount: number, currentPage: number, maxWindowSize: number): PageItem[];
@@ -0,0 +1,33 @@
1
+ function o(e, i) {
2
+ return Array.from({ length: i - e + 1 }, (t, h) => h + e).map(
3
+ (t) => ({
4
+ type: "page",
5
+ value: t
6
+ })
7
+ );
8
+ }
9
+ const n = 5;
10
+ function a(e, i, t) {
11
+ const h = Math.max(
12
+ n,
13
+ t
14
+ ), p = h - 2;
15
+ if (e <= h)
16
+ return Array.from({ length: e }, (y, f) => ({
17
+ type: "page",
18
+ value: f + 1
19
+ }));
20
+ const s = [];
21
+ s.push({ type: "page", value: 1 });
22
+ const u = p - 2, l = Math.floor(u / 2);
23
+ return i <= 3 + l ? (s.push(...o(2, p)), s.push({ type: "ellipsis", value: [p + 1, e - 1] })) : i >= e - (2 + l) ? (s.push({
24
+ type: "ellipsis",
25
+ value: [2, e - (p - 1) - 1]
26
+ }), s.push(...o(e - (p - 1), e - 1))) : (s.push({ type: "ellipsis", value: [2, i - l - 1] }), s.push(...o(i - l, i + l)), s.push({
27
+ type: "ellipsis",
28
+ value: [i + l + 1, e - 1]
29
+ })), s.push({ type: "page", value: e }), s;
30
+ }
31
+ export {
32
+ a as generatePaginationWithWindow
33
+ };
@@ -8,9 +8,11 @@ export declare const errorState: import('tailwind-variants').TVReturnType<{
8
8
  h2?: import('tailwind-merge').ClassNameValue;
9
9
  h3?: import('tailwind-merge').ClassNameValue;
10
10
  h4?: import('tailwind-merge').ClassNameValue;
11
+ container?: import('tailwind-merge').ClassNameValue;
11
12
  base?: import('tailwind-merge').ClassNameValue;
12
13
  icon?: import('tailwind-merge').ClassNameValue;
13
14
  description?: import('tailwind-merge').ClassNameValue;
15
+ wrapper?: import('tailwind-merge').ClassNameValue;
14
16
  illustration?: import('tailwind-merge').ClassNameValue;
15
17
  informationContainer?: import('tailwind-merge').ClassNameValue;
16
18
  information?: import('tailwind-merge').ClassNameValue;
@@ -24,9 +26,11 @@ export declare const errorState: import('tailwind-variants').TVReturnType<{
24
26
  h2?: import('tailwind-merge').ClassNameValue;
25
27
  h3?: import('tailwind-merge').ClassNameValue;
26
28
  h4?: import('tailwind-merge').ClassNameValue;
29
+ container?: import('tailwind-merge').ClassNameValue;
27
30
  base?: import('tailwind-merge').ClassNameValue;
28
31
  icon?: import('tailwind-merge').ClassNameValue;
29
32
  description?: import('tailwind-merge').ClassNameValue;
33
+ wrapper?: import('tailwind-merge').ClassNameValue;
30
34
  illustration?: import('tailwind-merge').ClassNameValue;
31
35
  informationContainer?: import('tailwind-merge').ClassNameValue;
32
36
  information?: import('tailwind-merge').ClassNameValue;
@@ -34,6 +38,8 @@ export declare const errorState: import('tailwind-variants').TVReturnType<{
34
38
  };
35
39
  };
36
40
  } | {}, {
41
+ container: string[];
42
+ wrapper: string[];
37
43
  base: string[];
38
44
  illustration: string[];
39
45
  icon: string[];
@@ -52,9 +58,11 @@ export declare const errorState: import('tailwind-variants').TVReturnType<{
52
58
  h2?: import('tailwind-merge').ClassNameValue;
53
59
  h3?: import('tailwind-merge').ClassNameValue;
54
60
  h4?: import('tailwind-merge').ClassNameValue;
61
+ container?: import('tailwind-merge').ClassNameValue;
55
62
  base?: import('tailwind-merge').ClassNameValue;
56
63
  icon?: import('tailwind-merge').ClassNameValue;
57
64
  description?: import('tailwind-merge').ClassNameValue;
65
+ wrapper?: import('tailwind-merge').ClassNameValue;
58
66
  illustration?: import('tailwind-merge').ClassNameValue;
59
67
  informationContainer?: import('tailwind-merge').ClassNameValue;
60
68
  information?: import('tailwind-merge').ClassNameValue;
@@ -62,6 +70,8 @@ export declare const errorState: import('tailwind-variants').TVReturnType<{
62
70
  };
63
71
  };
64
72
  } | {}, {
73
+ container: string[];
74
+ wrapper: string[];
65
75
  base: string[];
66
76
  illustration: string[];
67
77
  icon: string[];
@@ -74,6 +84,8 @@ export declare const errorState: import('tailwind-variants').TVReturnType<{
74
84
  h4: string[];
75
85
  description: string[];
76
86
  }, import('tailwind-variants').TVReturnType<unknown, {
87
+ container: string[];
88
+ wrapper: string[];
77
89
  base: string[];
78
90
  illustration: string[];
79
91
  icon: string[];
@@ -163,7 +175,7 @@ interface _404ErrorStateProps extends ErrorStateBaseProps {
163
175
  /**
164
176
  * No error object needed for 404 states.
165
177
  */
166
- error: never;
178
+ error?: never;
167
179
  }
168
180
  export type ErrorStateProps = KnownErrorStateProps | UnknownErrorStateProps | _404ErrorStateProps;
169
181
  /**