@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,23 @@
1
+ /**
2
+ * Re-export of the base Breadcrumb component for Tanstack Router integration.
3
+ * Use with BreadcrumbLink to create router-aware breadcrumb navigation.
4
+ * @example
5
+ * ```tsx
6
+ * import { Breadcrumb, BreadcrumbLink, Breadcrumbs } from '@payfit/unity-components/integrations/tanstack-router'
7
+ *
8
+ * function Navigation() {
9
+ * return (
10
+ * <Breadcrumbs wrap="nowrap">
11
+ * <Breadcrumb>
12
+ * <BreadcrumbLink to="/">Home</BreadcrumbLink>
13
+ * </Breadcrumb>
14
+ * <Breadcrumb>
15
+ * <BreadcrumbLink to="/dashboard">Dashboard</BreadcrumbLink>
16
+ * </Breadcrumb>
17
+ * </Breadcrumbs>
18
+ * )
19
+ * }
20
+ * ```
21
+ * @see {@link Breadcrumb} from base components for full API documentation
22
+ */
23
+ export { Breadcrumb } from '../../../../components/breadcrumbs/parts/Breadcrumb.js';
@@ -0,0 +1,38 @@
1
+ import { LinkComponent } from '@tanstack/react-router';
2
+ import { RawBreadcrumbLink } from '../../../../components/breadcrumbs/parts/RawBreadcrumbLink.js';
3
+ /**
4
+ * A breadcrumb link component that integrates with Tanstack Router for type-safe navigation.
5
+ * This component wraps the base RawBreadcrumbLink with Tanstack Router's navigation capabilities.
6
+ * @example
7
+ * ```tsx
8
+ * import { Breadcrumb, BreadcrumbLink, Breadcrumbs } from '@payfit/unity-components/integrations/tanstack-router'
9
+ *
10
+ * function Navigation() {
11
+ * return (
12
+ * <Breadcrumbs wrap="nowrap">
13
+ * <Breadcrumb>
14
+ * <BreadcrumbLink to="/">Home</BreadcrumbLink>
15
+ * </Breadcrumb>
16
+ * <Breadcrumb>
17
+ * <BreadcrumbLink to="/dashboard" search={{ tab: 'overview' }}>
18
+ * Dashboard
19
+ * </BreadcrumbLink>
20
+ * </Breadcrumb>
21
+ * </Breadcrumbs>
22
+ * )
23
+ * }
24
+ * ```
25
+ * @remarks
26
+ * - Supports all Tanstack Router link props (to, search, params, etc.)
27
+ * - Maintains breadcrumb-specific styling and truncation behavior
28
+ * - Automatically handles long text with tooltips
29
+ * - Inherits type safety from Tanstack Router for route definitions
30
+ * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/integrations/tanstack-router/components/breadcrumbs GitHub}
31
+ * @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
32
+ * @see Design docs in {@link https://www.payfit.design/ Payfit.design}
33
+ * @see Developer docs in {@link https://unity-components.payfit.io/?path=/ unity-components.payfit.io}
34
+ */
35
+ declare const BreadcrumbLink: LinkComponent<typeof RawBreadcrumbLink> & {
36
+ displayName: string;
37
+ };
38
+ export { BreadcrumbLink };
@@ -0,0 +1,7 @@
1
+ import { createLink as r } from "@tanstack/react-router";
2
+ import { RawBreadcrumbLink as m } from "../../../../components/breadcrumbs/parts/RawBreadcrumbLink.js";
3
+ const a = r(m);
4
+ a.displayName = "BreadcrumbLink";
5
+ export {
6
+ a as BreadcrumbLink
7
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Re-export of the base Breadcrumbs component for Tanstack Router integration.
3
+ * Container component that displays hierarchical navigation using breadcrumb items with router-aware links.
4
+ * @example
5
+ * ```tsx
6
+ * import { Breadcrumb, BreadcrumbLink, Breadcrumbs } from '@payfit/unity-components/integrations/tanstack-router'
7
+ *
8
+ * function Navigation() {
9
+ * return (
10
+ * <Breadcrumbs wrap="nowrap">
11
+ * <Breadcrumb>
12
+ * <BreadcrumbLink to="/">Home</BreadcrumbLink>
13
+ * </Breadcrumb>
14
+ * <Breadcrumb>
15
+ * <BreadcrumbLink to="/dashboard">Dashboard</BreadcrumbLink>
16
+ * </Breadcrumb>
17
+ * </Breadcrumbs>
18
+ * )
19
+ * }
20
+ * ```
21
+ * @see {@link Breadcrumbs} from base components for full API documentation
22
+ */
23
+ export { Breadcrumbs } from '../../../../components/breadcrumbs/Breadcrumbs.js';
@@ -0,0 +1,53 @@
1
+ import { AnyRouteMatch, LinkOptions } from '@tanstack/react-router';
2
+ export interface BreadcrumbItem extends LinkOptions {
3
+ id: string;
4
+ label: string;
5
+ }
6
+ export interface UseRouteBreadcrumbsOptions {
7
+ /**
8
+ * Predicate function to filter out routes that should not be included in the breadcrumbs.
9
+ * @param match - The current route match in the list of matches.
10
+ * @returns True if the route should be included, false otherwise.
11
+ */
12
+ filterMatches?: (match: AnyRouteMatch) => boolean;
13
+ /**
14
+ * Function to customize the label for each breadcrumb item.
15
+ * @param match - The current route match in the list of matches.
16
+ * @returns The label for the breadcrumb item.
17
+ */
18
+ getLabel?: (match: AnyRouteMatch) => string;
19
+ }
20
+ /**
21
+ * Hook that generates breadcrumb items from the current route matches in Tanstack Router.
22
+ * Returns an array of breadcrumb items that can be used with the Breadcrumbs dynamic API.
23
+ * @param options - Configuration options for filtering and labeling breadcrumbs
24
+ * @returns Array of breadcrumb items with label and Tanstack Router link props
25
+ * @example
26
+ * ```tsx
27
+ * import { Breadcrumb, BreadcrumbLink, Breadcrumbs, useRouteBreadcrumbs } from '@payfit/unity-components/integrations/tanstack-router'
28
+ *
29
+ * function Navigation() {
30
+ * const breadcrumbs = useRouteBreadcrumbs({
31
+ * getLabel: (match) => match.context?.title ?? match.id
32
+ * })
33
+ *
34
+ * return (
35
+ * <Breadcrumbs items={breadcrumbs} wrap="nowrap">
36
+ * {item => (
37
+ * <Breadcrumb>
38
+ * <BreadcrumbLink to={item.to} search={item.search} params={item.params}>
39
+ * {item.label}
40
+ * </BreadcrumbLink>
41
+ * </Breadcrumb>
42
+ * )}
43
+ * </Breadcrumbs>
44
+ * )
45
+ * }
46
+ * ```
47
+ * @remarks
48
+ * - Automatically filters out the root route
49
+ * - Can be customized with filterMatches to control which routes appear
50
+ * - Can be customized with getLabel to control breadcrumb text
51
+ * - This hook only works for hierarchical routes, with an explicit parent-child relationship.
52
+ */
53
+ export declare function useRouteBreadcrumbs(options?: UseRouteBreadcrumbsOptions): BreadcrumbItem[];
@@ -0,0 +1,40 @@
1
+ import { LinkComponent } from '@tanstack/react-router';
2
+ import { RawFormContextualLink } from '../../../../components/form-field/parts/RawFormContextualLink.js';
3
+ /**
4
+ * Unity's FormContextualLink that integrates with Tanstack Router for seamless client-side navigation within form fields.
5
+ * Enables declarative routing with type-safe route parameters, search params, and automatic preloading capabilities while maintaining form field context.
6
+ * @example
7
+ * ```tsx
8
+ * import { FormContextualLink } from '@payfit/unity-components/integrations/tanstack-router'
9
+ *
10
+ * function MyForm() {
11
+ * const { Form, FormField } = useUnityForm(schema)
12
+ * return (
13
+ * <Form>
14
+ * <FormField name="email">
15
+ * <FormContextualLink to="/help">
16
+ * Need help?
17
+ * </FormContextualLink>
18
+ * </FormField>
19
+ * </Form>
20
+ * )
21
+ * }
22
+ * ```
23
+ * @remarks
24
+ * - Must be used inside a FormField component to maintain proper form context
25
+ * - Supports type-safe navigation with route parameters and search params
26
+ * - Provides automatic route preloading on hover or mount via the `preload` prop
27
+ * - Handles relative and absolute paths with `from` and `to` props for flexible routing
28
+ * - Integrates seamlessly with Tanstack Router's navigation system and loader functions
29
+ * - Maintains all accessibility features from the underlying RawFormContextualLink component
30
+ * - Automatically detects external URLs and applies appropriate security attributes (target="_blank", rel="noopener noreferrer")
31
+ * - Inherits the "small" size and "secondary" color styling appropriate for form contextual links
32
+ * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/integrations/tanstack-router/components/form-contextual-link GitHub}
33
+ * @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
34
+ * @see Design docs in {@link https://www.payfit.design/ Payfit.design}
35
+ * @see Developer docs in {@link https://unity-components.payfit.io/?path=/ unity-components.payfit.io}
36
+ */
37
+ declare const FormContextualLink: LinkComponent<typeof RawFormContextualLink> & {
38
+ displayName: string;
39
+ };
40
+ export { FormContextualLink };
@@ -0,0 +1,7 @@
1
+ import { createLink as o } from "@tanstack/react-router";
2
+ import { RawFormContextualLink as t } from "../../../../components/form-field/parts/RawFormContextualLink.js";
3
+ const r = o(t);
4
+ r.displayName = "FormContextualLink";
5
+ export {
6
+ r as FormContextualLink
7
+ };
@@ -0,0 +1,33 @@
1
+ import { LinkComponent } from '@tanstack/react-router';
2
+ import { RawLink } from '../../../../components/link/RawLink.js';
3
+ /**
4
+ * Unity's link that integrates with Tanstack Router for seamless client-side navigation.
5
+ * Enables declarative routing with type-safe route parameters, search params, and automatic preloading capabilities.
6
+ * @example
7
+ * ```tsx
8
+ * import { Link } from '@payfit/unity-components/integrations/tanstack-router'
9
+ *
10
+ * function Navigation() {
11
+ * return (
12
+ * <Link to="/dashboard">
13
+ * Dashboard
14
+ * </Link>
15
+ * )
16
+ * }
17
+ * ```
18
+ * @remarks
19
+ * - Supports type-safe navigation with route parameters and search params
20
+ * - Provides automatic route preloading on hover or mount via the `preload` prop
21
+ * - Handles relative and absolute paths with `from` and `to` props for flexible routing
22
+ * - Integrates seamlessly with Tanstack Router's navigation system and loader functions
23
+ * - Maintains all accessibility features and styling options from the underlying RawLink component
24
+ * - Automatically detects external URLs and applies appropriate security attributes (target="_blank", rel="noopener noreferrer")
25
+ * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/integrations/tanstack-router/components/link GitHub}
26
+ * @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
27
+ * @see Design docs in {@link https://www.payfit.design/ Payfit.design}
28
+ * @see Developer docs in {@link https://unity-components.payfit.io/?path=/ unity-components.payfit.io}
29
+ */
30
+ declare const Link: LinkComponent<typeof RawLink> & {
31
+ displayName: string;
32
+ };
33
+ export { Link };
@@ -0,0 +1,7 @@
1
+ import { createLink as i } from "@tanstack/react-router";
2
+ import { RawLink as o } from "../../../../components/link/RawLink.js";
3
+ const r = i(o);
4
+ r.displayName = "Link";
5
+ export {
6
+ r as Link
7
+ };
@@ -0,0 +1,49 @@
1
+ import { RegisteredRouter, ValidateLinkOptions } from '@tanstack/react-router';
2
+ import { ReactNode } from 'react';
3
+ import { MenuItemProps as RawMenuItemProps, RawMenuItem } from '../../../../components/menu/parts/RawMenuItem.js';
4
+ type MenuItemRouterProps<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string> = Omit<RawMenuItemProps, 'onAction' | 'children' | 'prefix'> & ValidateLinkOptions<TRouter, TOptions, TDefaultFrom, typeof RawMenuItem> & {
5
+ children?: ReactNode;
6
+ prefixElement?: RawMenuItemProps['prefix'];
7
+ };
8
+ type MenuItemButtonProps = Omit<RawMenuItemProps, 'href' | 'children'> & {
9
+ onAction: NonNullable<RawMenuItemProps['onAction']>;
10
+ children?: ReactNode;
11
+ };
12
+ export type MenuItemProps<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string> = MenuItemRouterProps<TRouter, TOptions, TDefaultFrom> | MenuItemButtonProps;
13
+ /**
14
+ * A menu item component that integrates with Tanstack Router for navigation.
15
+ * Provides seamless routing capabilities for menu items in context menus, dropdown menus, and other menu-based interfaces.
16
+ * @param props - Either router-based props (with 'to') or button-based props (with 'onAction')
17
+ * @example
18
+ * ```tsx
19
+ * import { MenuItem } from '@payfit/unity-components/integrations/tanstack-router'
20
+ *
21
+ * function ContextMenu() {
22
+ * return (
23
+ * <Menu>
24
+ * <MenuItem to="/dashboard" prefixElement={<Icon src="DashboardOutlined" />}>
25
+ * Dashboard
26
+ * </MenuItem>
27
+ * <MenuItem onAction={() => alert('Action triggered')}>
28
+ * Perform Action
29
+ * </MenuItem>
30
+ * </Menu>
31
+ * )
32
+ * }
33
+ * ```
34
+ * @remarks
35
+ * - When 'to' prop is provided, the component renders as a router link
36
+ * - When 'onAction' prop is provided (without 'to'), it renders as a button
37
+ * - Supports all Tanstack Router link features like preloading, search params, and route params
38
+ * - Maintains accessibility features from the underlying RawMenuItem component
39
+ * @see {@link MenuItemProps} for all available props
40
+ * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/integrations/tanstack-router/components/menu-item GitHub}
41
+ * @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
42
+ * @see Design docs in {@link https://www.payfit.design/ Payfit.design}
43
+ * @see Developer docs in {@link https://unity-components.payfit.io/?path=/ unity-components.payfit.io}
44
+ */
45
+ declare function MenuItem<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown>(props: MenuItemProps<TRouter, TOptions>): import("react/jsx-runtime").JSX.Element;
46
+ declare namespace MenuItem {
47
+ var displayName: string;
48
+ }
49
+ export { MenuItem };
@@ -0,0 +1,16 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { createLink as r } from "@tanstack/react-router";
3
+ import { RawMenuItem as o } from "../../../../components/menu/parts/RawMenuItem.js";
4
+ const i = r(o);
5
+ function m(e) {
6
+ if ("to" in e || "href" in e)
7
+ return /* @__PURE__ */ n(i, { ...e });
8
+ {
9
+ const t = e;
10
+ return /* @__PURE__ */ n(o, { ...t, children: t.children });
11
+ }
12
+ }
13
+ m.displayName = "MenuItem";
14
+ export {
15
+ m as MenuItem
16
+ };
@@ -0,0 +1,52 @@
1
+ import { RegisteredRouter, ValidateLinkOptions } from '@tanstack/react-router';
2
+ import { NavItemProps as RawNavItemProps } from '../../../../components/nav/parts/RawNavItem.js';
3
+ type NavItemRouterProps<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown> = Omit<RawNavItemProps, 'prefix' | 'suffix' | 'href' | 'onPress'> & ValidateLinkOptions<TRouter, TOptions> & {
4
+ prefixElement?: RawNavItemProps['prefix'];
5
+ suffixElement?: RawNavItemProps['suffix'];
6
+ };
7
+ type NavItemButtonProps = Omit<RawNavItemProps, 'prefix' | 'suffix' | 'href'> & {
8
+ prefixElement?: RawNavItemProps['prefix'];
9
+ suffixElement?: RawNavItemProps['suffix'];
10
+ onPress: NonNullable<RawNavItemProps['onPress']>;
11
+ };
12
+ export type NavItemProps<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown> = NavItemRouterProps<TRouter, TOptions> | NavItemButtonProps;
13
+ /**
14
+ * A navigation item component that integrates with Tanstack Router for seamless navigation.
15
+ * Provides both link-based routing and button-based actions within navigation menus, automatically adapting based on the props provided.
16
+ * @param {NavItemProps} props - Either router-based props (with 'to') or button-based props (with 'onPress')
17
+ * @example
18
+ * ```tsx
19
+ * import { NavItem } from '@payfit/unity-components/integrations/tanstack-router'
20
+ * import { Nav } from '@payfit/unity-components'
21
+ *
22
+ * function Navigation() {
23
+ * return (
24
+ * <Nav title="Main navigation">
25
+ * <NavItem to="/dashboard" prefixElement={<Icon src="DashboardOutlined" />}>
26
+ * Dashboard
27
+ * </NavItem>
28
+ * <NavItem onPress={() => console.log('Action')}>
29
+ * Action
30
+ * </NavItem>
31
+ * </Nav>
32
+ * )
33
+ * }
34
+ * ```
35
+ * @remarks
36
+ * - Automatically renders as a link when 'to' prop is provided, or as a button when 'onPress' is provided
37
+ * - Supports type-safe route parameters, search params, and relative navigation with Tanstack Router
38
+ * - Integrates with Nav component for consistent navigation UI patterns
39
+ * - Provides automatic active state styling based on current route
40
+ * - Supports icon prefixes and suffixes via prefixElement and suffixElement props
41
+ * - Maintains all accessibility features from the underlying RawNavItem component
42
+ * @see {@link NavItemProps} for all available props
43
+ * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/integrations/tanstack-router/components/nav-item GitHub}
44
+ * @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
45
+ * @see Design docs in {@link https://www.payfit.design/ Payfit.design}
46
+ * @see Developer docs in {@link https://unity-components.payfit.io/?path=/ unity-components.payfit.io}
47
+ */
48
+ declare function NavItem<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown>({ prefixElement, suffixElement, ...rest }: NavItemProps<TRouter, TOptions>): import("react/jsx-runtime").JSX.Element;
49
+ declare namespace NavItem {
50
+ var displayName: string;
51
+ }
52
+ export { NavItem };
@@ -0,0 +1,29 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { createLink as a } from "@tanstack/react-router";
3
+ import { RawNavItem as e } from "../../../../components/nav/parts/RawNavItem.js";
4
+ const n = a(e);
5
+ function p({ prefixElement: r, suffixElement: i, ...o }) {
6
+ return "to" in o || "href" in o ? (
7
+ // @ts-expect-error - Complex type intersection between router props and component props
8
+ /* @__PURE__ */ t(
9
+ n,
10
+ {
11
+ ...o,
12
+ activeProps: { isCurrent: !0 },
13
+ prefix: r,
14
+ suffix: i
15
+ }
16
+ )
17
+ ) : /* @__PURE__ */ t(
18
+ e,
19
+ {
20
+ ...o,
21
+ prefix: r,
22
+ suffix: i
23
+ }
24
+ );
25
+ }
26
+ p.displayName = "NavItem";
27
+ export {
28
+ p as NavItem
29
+ };
@@ -0,0 +1,54 @@
1
+ import { RegisteredRouter, ValidateLinkOptions } from '@tanstack/react-router';
2
+ import { PaginationLinkProps as RawPaginationLinkProps } from '../../../../components/pagination/parts/RawPaginationLink.js';
3
+ type PaginationLinkRouterProps<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown> = Omit<RawPaginationLinkProps, 'href' | 'onPress'> & ValidateLinkOptions<TRouter, TOptions>;
4
+ export type PaginationLinkProps<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown> = PaginationLinkRouterProps<TRouter, TOptions>;
5
+ /**
6
+ * A pagination link component that integrates with Tanstack Router for seamless navigation.
7
+ * Provides type-safe, URL-driven pagination with support for preloading and active states.
8
+ * @param {PaginationLinkProps} props - Router-based props including 'to', 'search', and pagination-specific props
9
+ * @example
10
+ * ```tsx
11
+ * import { PaginationLink } from '@payfit/unity-components/integrations/tanstack-router'
12
+ * import { Pagination, PaginationContent, PaginationItem } from '@payfit/unity-components'
13
+ *
14
+ * function ProductPagination() {
15
+ * const search = useSearch({ from: '/products' })
16
+ * const currentPage = search.page || 1
17
+ *
18
+ * return (
19
+ * <Pagination pageCount={10} currentPage={currentPage} onPageChange={handlePageChange}>
20
+ * <PaginationContent>
21
+ * <PaginationItem>
22
+ * <PaginationLink
23
+ * to="/products"
24
+ * search={{ ...search, page: 1 }}
25
+ * value={1}
26
+ * isCurrent={currentPage === 1}
27
+ * preload="intent"
28
+ * >
29
+ * 1
30
+ * </PaginationLink>
31
+ * </PaginationItem>
32
+ * </PaginationContent>
33
+ * </Pagination>
34
+ * )
35
+ * }
36
+ * ```
37
+ * @remarks
38
+ * - Automatically applies active styling when isCurrent is true
39
+ * - Supports type-safe route parameters and search params with Tanstack Router
40
+ * - Enables preload="intent" for data loading before navigation
41
+ * - Maintains accessibility with aria-current="page" for current page
42
+ * - Works with Pagination context for keyboard navigation support
43
+ * - Uses the 'value' prop to identify the page number for the link
44
+ * @see {@link PaginationLinkProps} for all available props
45
+ * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/integrations/tanstack-router/components/pagination GitHub}
46
+ * @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
47
+ * @see Design docs in {@link https://www.payfit.design/ Payfit.design}
48
+ * @see Developer docs in {@link https://unity-components.payfit.io/?path=/ unity-components.payfit.io}
49
+ */
50
+ declare function PaginationLink<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown>(props: PaginationLinkProps<TRouter, TOptions>): import("react/jsx-runtime").JSX.Element;
51
+ declare namespace PaginationLink {
52
+ var displayName: string;
53
+ }
54
+ export { PaginationLink };
@@ -0,0 +1,21 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { createLink as t } from "@tanstack/react-router";
3
+ import { RawPaginationLink as r } from "../../../../components/pagination/parts/RawPaginationLink.js";
4
+ const a = t(r);
5
+ function o(i) {
6
+ return (
7
+ // @ts-expect-error - Complex type intersection between router props and component props
8
+ /* @__PURE__ */ n(
9
+ a,
10
+ {
11
+ activeOptions: { exact: !0, includeSearch: !0 },
12
+ ...i,
13
+ activeProps: { isCurrent: !0 }
14
+ }
15
+ )
16
+ );
17
+ }
18
+ o.displayName = "PaginationLink";
19
+ export {
20
+ o as PaginationLink
21
+ };
@@ -0,0 +1,52 @@
1
+ import { RegisteredRouter, ValidateLinkOptions } from '@tanstack/react-router';
2
+ import { RawPaginationNextProps } from '../../../../components/pagination/parts/RawPaginationNext.js';
3
+ type PaginationNextRouterProps<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown> = Omit<RawPaginationNextProps, 'href' | 'onPress'> & ValidateLinkOptions<TRouter, TOptions>;
4
+ export type PaginationNextProps<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown> = PaginationNextRouterProps<TRouter, TOptions>;
5
+ /**
6
+ * A pagination next button component that integrates with Tanstack Router for seamless navigation.
7
+ * Provides type-safe navigation to the next page with support for preloading.
8
+ * @param {PaginationNextProps} props - Router-based props including 'to', 'search', and 'isDisabled'
9
+ * @example
10
+ * ```tsx
11
+ * import { PaginationNext } from '@payfit/unity-components/integrations/tanstack-router'
12
+ * import { Pagination, PaginationContent, PaginationItem } from '@payfit/unity-components'
13
+ *
14
+ * function ProductPagination() {
15
+ * const search = useSearch({ from: '/products' })
16
+ * const currentPage = search.page || 1
17
+ * const pageCount = 10
18
+ *
19
+ * return (
20
+ * <Pagination pageCount={pageCount} currentPage={currentPage} onPageChange={handlePageChange}>
21
+ * <PaginationContent>
22
+ * <PaginationItem>
23
+ * <PaginationNext
24
+ * to="/products"
25
+ * search={{ ...search, page: currentPage + 1 }}
26
+ * isDisabled={currentPage === pageCount}
27
+ * preload="intent"
28
+ * />
29
+ * </PaginationItem>
30
+ * </PaginationContent>
31
+ * </Pagination>
32
+ * )
33
+ * }
34
+ * ```
35
+ * @remarks
36
+ * - Automatically renders as a disabled button when isDisabled is true
37
+ * - Supports type-safe route parameters and search params with Tanstack Router
38
+ * - Enables preload="intent" for data loading before navigation
39
+ * - Includes tooltip with "Next" label for accessibility
40
+ * - Works with Pagination context for keyboard navigation support
41
+ * - Renders a right-facing caret icon
42
+ * @see {@link PaginationNextProps} for all available props
43
+ * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/integrations/tanstack-router/components/pagination GitHub}
44
+ * @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
45
+ * @see Design docs in {@link https://www.payfit.design/ Payfit.design}
46
+ * @see Developer docs in {@link https://unity-components.payfit.io/?path=/ unity-components.payfit.io}
47
+ */
48
+ declare function PaginationNext<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown>(props: PaginationNextProps<TRouter, TOptions>): import("react/jsx-runtime").JSX.Element;
49
+ declare namespace PaginationNext {
50
+ var displayName: string;
51
+ }
52
+ export { PaginationNext };
@@ -0,0 +1,22 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { createLink as a } from "@tanstack/react-router";
3
+ import { RawPaginationNext as e } from "../../../../components/pagination/parts/RawPaginationNext.js";
4
+ const n = a(e);
5
+ function o(t) {
6
+ return (
7
+ // @ts-expect-error - Complex type intersection between router props and component props
8
+ /* @__PURE__ */ i(
9
+ n,
10
+ {
11
+ activeOptions: { exact: !0, includeSearch: !0 },
12
+ ...t,
13
+ activeProps: {},
14
+ inactiveProps: {}
15
+ }
16
+ )
17
+ );
18
+ }
19
+ o.displayName = "PaginationNext";
20
+ export {
21
+ o as PaginationNext
22
+ };
@@ -0,0 +1,51 @@
1
+ import { RegisteredRouter, ValidateLinkOptions } from '@tanstack/react-router';
2
+ import { RawPaginationPreviousProps } from '../../../../components/pagination/parts/RawPaginationPrevious.js';
3
+ type PaginationPreviousRouterProps<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown> = Omit<RawPaginationPreviousProps, 'href' | 'onPress'> & ValidateLinkOptions<TRouter, TOptions>;
4
+ export type PaginationPreviousProps<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown> = PaginationPreviousRouterProps<TRouter, TOptions>;
5
+ /**
6
+ * A pagination previous button component that integrates with Tanstack Router for seamless navigation.
7
+ * Provides type-safe navigation to the previous page with support for preloading.
8
+ * @param {PaginationPreviousProps} props - Router-based props including 'to', 'search', and 'isDisabled'
9
+ * @example
10
+ * ```tsx
11
+ * import { PaginationPrevious } from '@payfit/unity-components/integrations/tanstack-router'
12
+ * import { Pagination, PaginationContent, PaginationItem } from '@payfit/unity-components'
13
+ *
14
+ * function ProductPagination() {
15
+ * const search = useSearch({ from: '/products' })
16
+ * const currentPage = search.page || 1
17
+ *
18
+ * return (
19
+ * <Pagination pageCount={10} currentPage={currentPage} onPageChange={handlePageChange}>
20
+ * <PaginationContent>
21
+ * <PaginationItem>
22
+ * <PaginationPrevious
23
+ * to="/products"
24
+ * search={{ ...search, page: currentPage - 1 }}
25
+ * isDisabled={currentPage === 1}
26
+ * preload="intent"
27
+ * />
28
+ * </PaginationItem>
29
+ * </PaginationContent>
30
+ * </Pagination>
31
+ * )
32
+ * }
33
+ * ```
34
+ * @remarks
35
+ * - Automatically renders as a disabled button when isDisabled is true
36
+ * - Supports type-safe route parameters and search params with Tanstack Router
37
+ * - Enables preload="intent" for data loading before navigation
38
+ * - Includes tooltip with "Previous" label for accessibility
39
+ * - Works with Pagination context for keyboard navigation support
40
+ * - Renders a left-facing caret icon
41
+ * @see {@link PaginationPreviousProps} for all available props
42
+ * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/integrations/tanstack-router/components/pagination GitHub}
43
+ * @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
44
+ * @see Design docs in {@link https://www.payfit.design/ Payfit.design}
45
+ * @see Developer docs in {@link https://unity-components.payfit.io/?path=/ unity-components.payfit.io}
46
+ */
47
+ declare function PaginationPrevious<TRouter extends RegisteredRouter = RegisteredRouter, TOptions = unknown>(props: PaginationPreviousProps<TRouter, TOptions>): import("react/jsx-runtime").JSX.Element;
48
+ declare namespace PaginationPrevious {
49
+ var displayName: string;
50
+ }
51
+ export { PaginationPrevious };
@@ -0,0 +1,22 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { createLink as r } from "@tanstack/react-router";
3
+ import { RawPaginationPrevious as t } from "../../../../components/pagination/parts/RawPaginationPrevious.js";
4
+ const a = r(t);
5
+ function e(i) {
6
+ return (
7
+ // @ts-expect-error - Complex type intersection between router props and component props
8
+ /* @__PURE__ */ o(
9
+ a,
10
+ {
11
+ activeOptions: { exact: !0, includeSearch: !0 },
12
+ ...i,
13
+ activeProps: {},
14
+ inactiveProps: {}
15
+ }
16
+ )
17
+ );
18
+ }
19
+ e.displayName = "PaginationPrevious";
20
+ export {
21
+ e as PaginationPrevious
22
+ };