@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.
- package/dist/esm/components/action-bar/ActionBar.js +14 -14
- package/dist/esm/components/actionable/Actionable.js +31 -28
- package/dist/esm/components/app-layout/AppLayout.js +17 -17
- package/dist/esm/components/app-menu/parts/AppMenuHeader.d.ts +86 -4
- package/dist/esm/components/app-menu/parts/AppMenuHeader.js +25 -25
- package/dist/esm/components/breadcrumbs/Breadcrumbs.context.js +3 -3
- package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +19 -11
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +29 -18
- package/dist/esm/components/breadcrumbs/parts/Breadcrumb.d.ts +30 -5
- package/dist/esm/components/breadcrumbs/parts/Breadcrumb.js +35 -27
- package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.d.ts +37 -0
- package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.js +36 -0
- package/dist/esm/components/client-side-pagination/ClientSidePagination.d.ts +103 -0
- package/dist/esm/components/client-side-pagination/ClientSidePagination.js +177 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.d.ts +11 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.js +30 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationJumpDialog.d.ts +8 -0
- package/dist/esm/components/{pagination/parts/PaginationLink.d.ts → client-side-pagination/parts/RawPaginationLink.d.ts} +2 -2
- package/dist/esm/components/{pagination/parts/PaginationLink.js → client-side-pagination/parts/RawPaginationLink.js} +2 -2
- package/dist/esm/components/client-side-pagination/utils/pagination-window.d.ts +8 -0
- package/dist/esm/components/client-side-pagination/utils/pagination-window.js +33 -0
- package/dist/esm/components/error-state/ErrorState.d.ts +13 -1
- package/dist/esm/components/error-state/ErrorState.js +133 -92
- package/dist/esm/components/error-state/initConfig.js +1 -1
- package/dist/esm/components/fieldset/Fieldset.d.ts +19 -0
- package/dist/esm/components/fieldset/Fieldset.js +32 -26
- package/dist/esm/components/flex/Flex.js +52 -37
- package/dist/esm/components/form-field/FormField.js +12 -12
- package/dist/esm/components/form-field/parts/{FormContextualLink.d.ts → RawFormContextualLink.d.ts} +2 -2
- package/dist/esm/components/form-field/parts/RawFormContextualLink.js +39 -0
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
- package/dist/esm/components/icon/Icon.js +23 -19
- package/dist/esm/components/link/{Link.variants.d.ts → RawLink.d.ts} +92 -0
- package/dist/esm/components/link/{Link.variants.js → RawLink.js} +70 -4
- package/dist/esm/components/menu/parts/{MenuItem.d.ts → RawMenuItem.d.ts} +3 -4
- package/dist/esm/components/menu/parts/{MenuItem.js → RawMenuItem.js} +9 -9
- package/dist/esm/components/nav/parts/NavGroup.d.ts +3 -3
- package/dist/esm/components/nav/parts/NavGroup.js +62 -51
- package/dist/esm/components/nav/parts/{NavItem.d.ts → RawNavItem.d.ts} +102 -5
- package/dist/esm/components/nav/parts/RawNavItem.js +106 -0
- package/dist/esm/components/page/Page.js +1 -1
- package/dist/esm/components/page/parts/PageHeader.d.ts +79 -9
- package/dist/esm/components/page/parts/PageHeader.js +22 -20
- package/dist/esm/components/pagination/Pagination.d.ts +23 -44
- package/dist/esm/components/pagination/Pagination.js +89 -163
- package/dist/esm/components/pagination/PaginationContext.d.ts +11 -0
- package/dist/esm/components/pagination/PaginationContext.js +15 -0
- package/dist/esm/components/pagination/hooks/use-pagination-state.d.ts +63 -0
- package/dist/esm/components/pagination/hooks/use-pagination-state.js +27 -0
- package/dist/esm/components/pagination/hooks/use-pagination-window.d.ts +64 -0
- package/dist/esm/components/pagination/hooks/use-pagination-window.js +15 -0
- package/dist/esm/components/pagination/parts/PaginationContent.d.ts +30 -0
- package/dist/esm/components/pagination/parts/PaginationContent.js +37 -0
- package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +23 -4
- package/dist/esm/components/pagination/parts/PaginationEllipsis.js +20 -16
- package/dist/esm/components/pagination/parts/PaginationItem.d.ts +38 -0
- package/dist/esm/components/pagination/parts/PaginationItem.js +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationLink.d.ts +11 -0
- package/dist/esm/components/pagination/parts/RawPaginationLink.js +60 -0
- package/dist/esm/components/pagination/parts/RawPaginationNext.d.ts +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationNext.js +70 -0
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.d.ts +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.js +67 -0
- package/dist/esm/components/pagination/utils/pagination-window.js +29 -20
- package/dist/esm/components/select/Select.js +63 -45
- package/dist/esm/components/select/parts/SelectOption.js +9 -9
- package/dist/esm/components/skip-links/SkipLinks.js +1 -1
- package/dist/esm/components/table/Table.d.ts +1 -0
- package/dist/esm/components/table/Table.js +82 -73
- package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +6 -6
- package/dist/esm/components/table/parts/TableCell.js +29 -26
- package/dist/esm/components/table/parts/TablePagination.d.ts +5 -5
- package/dist/esm/components/table/parts/TablePagination.js +10 -10
- package/dist/esm/components/table/parts/TableRow.js +21 -18
- package/dist/esm/components/tabs/parts/{Tab.d.ts → RawTab.d.ts} +2 -2
- package/dist/esm/components/tabs/parts/{Tab.js → RawTab.js} +6 -6
- package/dist/esm/components/task-menu/TaskMenu.d.ts +4 -4
- package/dist/esm/components/task-menu/parts/{SubTask.d.ts → RawSubTask.d.ts} +7 -7
- package/dist/esm/components/task-menu/parts/{SubTask.js → RawSubTask.js} +19 -19
- package/dist/esm/components/task-menu/parts/{Task.d.ts → RawTask.d.ts} +7 -7
- package/dist/esm/components/task-menu/parts/{Task.js → RawTask.js} +17 -17
- package/dist/esm/components/task-menu/parts/TaskGroup.d.ts +5 -5
- package/dist/esm/components/text/Text.js +30 -27
- package/dist/esm/hooks/use-container-query-level.d.ts +42 -0
- package/dist/esm/hooks/use-container-query-level.js +33 -0
- package/dist/esm/index.d.ts +21 -11
- package/dist/esm/index.js +424 -399
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumb.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.d.ts +38 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumbs.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/use-route-breadcrumb.d.ts +53 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.d.ts +40 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/link/Link.d.ts +33 -0
- package/dist/esm/integrations/tanstack-router/components/link/Link.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.d.ts +49 -0
- package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.js +16 -0
- package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.js +29 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.d.ts +54 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.js +21 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.js +22 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.d.ts +51 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.js +22 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.d.ts +82 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.js +41 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.js +15 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabList.d.ts +5 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.d.ts +77 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.js +16 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.d.ts +69 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.js +14 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/Task.d.ts +64 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/Task.js +14 -0
- package/dist/esm/integrations/tanstack-router/index.d.ts +16 -0
- package/dist/esm/integrations/tanstack-router/utils/decorators.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router.js +34 -0
- package/dist/esm/providers/router/RouterProvider.d.ts +7 -2
- package/dist/esm/providers/router/RouterProvider.js +14 -10
- package/dist/esm/types/DataAttributes.d.ts +1 -1
- package/i18n/en-GB.json +1 -0
- package/i18n/es-ES.json +1 -0
- package/i18n/fr-FR.json +1 -0
- package/package.json +47 -25
- package/dist/esm/components/form-field/parts/FormContextualLink.js +0 -37
- package/dist/esm/components/link/Link.d.ts +0 -93
- package/dist/esm/components/link/Link.js +0 -68
- package/dist/esm/components/nav/parts/NavItem.js +0 -95
- /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.d.ts +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.js +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationJumpDialog.js +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.d.ts +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.js +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as u, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as C, useMemo as I } from "react";
|
|
3
|
+
import { uyTv as i, uyMerge as j } from "@payfit/unity-themes";
|
|
4
|
+
import { Link as R, Button as A } from "react-aria-components";
|
|
5
|
+
import { useRouter as k } from "../../../providers/router/RouterProvider.js";
|
|
6
|
+
const B = i({
|
|
7
|
+
slots: {
|
|
8
|
+
base: [
|
|
9
|
+
"uy:group uy:cursor-pointer uy:grid uy:w-full uy:grid-cols-[auto_1fr_auto] uy:items-center uy:py-100 uy:px-150 uy:gap-100 uy:rounded-75 uy:outline-0 uy:transition-all",
|
|
10
|
+
"uy:hover:bg-surface-neutral-hover uy:active:bg-surface-neutral-active uy:data-[pressed]:bg-surface-neutral-pressed",
|
|
11
|
+
"uy:focus:outline-0 uy:data-[focus-visible]:outline-none uy:data-[focus-visible]:ring-2 uy:data-[focus-visible]:ring-utility-focus-ring uy:data-[focus-visible]:ring-offset-2"
|
|
12
|
+
],
|
|
13
|
+
prefix: "uy:p-25 uy:empty:hidden uy:text-content-neutral-low",
|
|
14
|
+
suffix: "uy:flex uy:gap-100 uy:items-center uy:text-content-neutral-low uy:justify-self-end uy:text-right uy:empty:hidden",
|
|
15
|
+
label: [
|
|
16
|
+
"uy:flex-1 uy:basis-full uy:text-left uy:truncate uy:overflow-hidden uy:whitespace-break-spaces uy:typography-body uy:text-content-neutral"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
variants: {
|
|
20
|
+
level: {
|
|
21
|
+
0: "uy:pl-150",
|
|
22
|
+
1: "uy:pl-600"
|
|
23
|
+
},
|
|
24
|
+
isDisabled: {
|
|
25
|
+
true: {
|
|
26
|
+
base: "uy:pointer-events-none",
|
|
27
|
+
label: "uy:text-content-neutral-disabled"
|
|
28
|
+
},
|
|
29
|
+
false: ""
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}), M = i({
|
|
33
|
+
extend: B,
|
|
34
|
+
variants: {
|
|
35
|
+
isActive: {
|
|
36
|
+
true: {
|
|
37
|
+
base: "uy:bg-surface-neutral-active",
|
|
38
|
+
prefix: "uy:text-content-neutral",
|
|
39
|
+
label: "uy:typography-body-strong"
|
|
40
|
+
},
|
|
41
|
+
false: {
|
|
42
|
+
base: "",
|
|
43
|
+
prefix: "uy:text-content-neutral-low",
|
|
44
|
+
label: "uy:typography-body"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}), _ = C(
|
|
49
|
+
({
|
|
50
|
+
children: y,
|
|
51
|
+
level: r = 0,
|
|
52
|
+
prefix: n,
|
|
53
|
+
suffix: l,
|
|
54
|
+
onPress: c,
|
|
55
|
+
href: t,
|
|
56
|
+
isCurrent: f,
|
|
57
|
+
isDisabled: s = !1,
|
|
58
|
+
isExact: p = !1,
|
|
59
|
+
...m
|
|
60
|
+
}, d) => {
|
|
61
|
+
const o = k(), b = t ? R : A, e = o && t ? o.isActive(t, p) : f, {
|
|
62
|
+
rawNavItemClassName: v,
|
|
63
|
+
labelClassName: x,
|
|
64
|
+
prefixClassName: g,
|
|
65
|
+
suffixClassName: N
|
|
66
|
+
} = I(() => {
|
|
67
|
+
const a = M({ level: r, isActive: e, isDisabled: s });
|
|
68
|
+
return {
|
|
69
|
+
rawNavItemClassName: j(a.base(), a.label()),
|
|
70
|
+
prefixClassName: a.prefix(),
|
|
71
|
+
suffixClassName: a.suffix(),
|
|
72
|
+
labelClassName: a.label()
|
|
73
|
+
};
|
|
74
|
+
}, [e, s, r]), w = Object.assign(
|
|
75
|
+
{},
|
|
76
|
+
e !== void 0 && {
|
|
77
|
+
"data-current": e,
|
|
78
|
+
"aria-current": e ? "page" : void 0
|
|
79
|
+
},
|
|
80
|
+
!t && { tabIndex: s ? -1 : void 0 }
|
|
81
|
+
);
|
|
82
|
+
return /* @__PURE__ */ u("li", { children: /* @__PURE__ */ h(
|
|
83
|
+
b,
|
|
84
|
+
{
|
|
85
|
+
...w,
|
|
86
|
+
...m,
|
|
87
|
+
ref: d,
|
|
88
|
+
className: v,
|
|
89
|
+
href: t,
|
|
90
|
+
onPress: c,
|
|
91
|
+
isDisabled: s,
|
|
92
|
+
"data-level": r,
|
|
93
|
+
children: [
|
|
94
|
+
n && /* @__PURE__ */ u("span", { className: g, children: n({ isCurrent: e ?? !1 }) }),
|
|
95
|
+
/* @__PURE__ */ u("span", { className: x, children: y }),
|
|
96
|
+
l && /* @__PURE__ */ u("span", { className: N, children: l })
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
) });
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
_.displayName = "RawNavItem";
|
|
103
|
+
export {
|
|
104
|
+
_ as RawNavItem,
|
|
105
|
+
B as navItemBase
|
|
106
|
+
};
|
|
@@ -6,7 +6,7 @@ const o = t({
|
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
8
|
default: [
|
|
9
|
-
"uy:px-200 uy:py-300 uy:md:p-300 uy:lg:p-
|
|
9
|
+
"uy:px-200 uy:py-300 uy:md:p-300 uy:lg:p-500",
|
|
10
10
|
// a tiny margin left so the shadow is visible
|
|
11
11
|
"uy:md:ml-100",
|
|
12
12
|
"uy:bg-surface-neutral uy:md:border uy:md:border-solid uy:md:border-border-neutral uy:border-r-0 uy:md:rounded-tl-400 uy:md:rounded-bl-400 uy:md:shadow-raising"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { VariantProps } from '@payfit/unity-themes';
|
|
2
2
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
-
import { BreadcrumbProps } from '../../breadcrumbs/parts/Breadcrumb.js';
|
|
4
3
|
export declare const pageHeader: import('tailwind-variants').TVReturnType<{
|
|
5
4
|
[key: string]: {
|
|
6
5
|
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
@@ -44,9 +43,62 @@ export declare const pageHeader: import('tailwind-variants').TVReturnType<{
|
|
|
44
43
|
titles: string;
|
|
45
44
|
actions: string;
|
|
46
45
|
}, undefined, unknown, unknown, undefined>>;
|
|
46
|
+
export interface BreadcrumbItem {
|
|
47
|
+
href: string;
|
|
48
|
+
label: string;
|
|
49
|
+
}
|
|
47
50
|
export interface PageHeaderProps extends PropsWithChildren<VariantProps<typeof pageHeader>> {
|
|
48
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Array of breadcrumb items to display in the page header.
|
|
53
|
+
* @deprecated Use renderBreadcrumbs prop for router integration support. Will be removed in v2.0.
|
|
54
|
+
*/
|
|
55
|
+
pagePath?: BreadcrumbItem[];
|
|
56
|
+
/**
|
|
57
|
+
* Custom render function for breadcrumbs. Receives pagePath items if provided.
|
|
58
|
+
* @param items - The breadcrumb items from pagePath prop, or undefined
|
|
59
|
+
* @default Renders Breadcrumbs with RawBreadcrumbLink components using pagePath data
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* // Custom rendering with Tanstack Router
|
|
63
|
+
* import { Breadcrumb, BreadcrumbLink, Breadcrumbs } from '@payfit/unity-components/integrations/tanstack-router'
|
|
64
|
+
*
|
|
65
|
+
* <PageHeader
|
|
66
|
+
* renderBreadcrumbs={() => (
|
|
67
|
+
* <Breadcrumbs wrap="nowrap">
|
|
68
|
+
* <Breadcrumb>
|
|
69
|
+
* <BreadcrumbLink to="/">Home</BreadcrumbLink>
|
|
70
|
+
* </Breadcrumb>
|
|
71
|
+
* </Breadcrumbs>
|
|
72
|
+
* )}
|
|
73
|
+
* >
|
|
74
|
+
* <PageHeading variant="title">My Page</PageHeading>
|
|
75
|
+
* </PageHeader>
|
|
76
|
+
* ```
|
|
77
|
+
* @example
|
|
78
|
+
* ```tsx
|
|
79
|
+
* // Using pagePath data with custom rendering
|
|
80
|
+
* <PageHeader
|
|
81
|
+
* pagePath={[{ href: '/', label: 'Home' }]}
|
|
82
|
+
* renderBreadcrumbs={(items) => (
|
|
83
|
+
* <Breadcrumbs wrap="nowrap" items={items}>
|
|
84
|
+
* {item => (
|
|
85
|
+
* <Breadcrumb key={item.href}>
|
|
86
|
+
* <BreadcrumbLink href={item.href}>{item.label}</BreadcrumbLink>
|
|
87
|
+
* </Breadcrumb>
|
|
88
|
+
* )}
|
|
89
|
+
* </Breadcrumbs>
|
|
90
|
+
* )}
|
|
91
|
+
* >
|
|
92
|
+
* <PageHeading variant="title">My Page</PageHeading>
|
|
93
|
+
* </PageHeader>
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
renderBreadcrumbs?: (items: BreadcrumbItem[] | undefined) => ReactNode;
|
|
49
97
|
actions?: ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated BreadcrumbComponent is no longer supported. Use renderBreadcrumbs instead.
|
|
100
|
+
*/
|
|
101
|
+
BreadcrumbComponent?: never;
|
|
50
102
|
}
|
|
51
103
|
/**
|
|
52
104
|
* The PageHeader component provides a consistent layout for page headers with title, subtitle, and actions support.
|
|
@@ -58,24 +110,42 @@ export interface PageHeaderProps extends PropsWithChildren<VariantProps<typeof p
|
|
|
58
110
|
* ```tsx
|
|
59
111
|
* import { PageHeader, PageHeading, Button } from '@payfit/unity-components'
|
|
60
112
|
*
|
|
113
|
+
* // Legacy API (deprecated)
|
|
61
114
|
* <PageHeader
|
|
62
115
|
* pagePath={[
|
|
63
116
|
* { href: '/dashboard', label: 'Dashboard' },
|
|
64
117
|
* { href: '/employees', label: 'Employees' }
|
|
65
118
|
* ]}
|
|
66
|
-
* actions={
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
119
|
+
* actions={<Button>Save</Button>}
|
|
120
|
+
* >
|
|
121
|
+
* <PageHeading variant="title">Employee List</PageHeading>
|
|
122
|
+
* </PageHeader>
|
|
123
|
+
* ```
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* import { PageHeader, PageHeading, Breadcrumbs, Breadcrumb, BreadcrumbLink } from '@payfit/unity-components'
|
|
127
|
+
*
|
|
128
|
+
* // New API with custom breadcrumbs
|
|
129
|
+
* <PageHeader
|
|
130
|
+
* renderBreadcrumbs={() => (
|
|
131
|
+
* <Breadcrumbs wrap="nowrap">
|
|
132
|
+
* <Breadcrumb>
|
|
133
|
+
* <BreadcrumbLink href="/dashboard">Dashboard</BreadcrumbLink>
|
|
134
|
+
* </Breadcrumb>
|
|
135
|
+
* <Breadcrumb>
|
|
136
|
+
* <BreadcrumbLink href="/employees">Employees</BreadcrumbLink>
|
|
137
|
+
* </Breadcrumb>
|
|
138
|
+
* </Breadcrumbs>
|
|
139
|
+
* )}
|
|
140
|
+
* actions={<Button>Save</Button>}
|
|
72
141
|
* >
|
|
73
142
|
* <PageHeading variant="title">Employee List</PageHeading>
|
|
74
|
-
* <PageHeading variant="subtitle">View and manage your employees</PageHeading>
|
|
75
143
|
* </PageHeader>
|
|
76
144
|
* ```
|
|
77
145
|
* @see {@link PageHeaderProps} for all available props
|
|
78
146
|
* @remarks
|
|
147
|
+
* - The `pagePath` prop is deprecated and will be removed in v2.0. Use `renderBreadcrumbs` for router integration support.
|
|
148
|
+
* - The `BreadcrumbComponent` prop is no longer supported. Use `renderBreadcrumbs` instead.
|
|
79
149
|
* [API](https://unity-components.payfit.io/?path=/docs/layout-page-pageheader--docs) • [Design docs](https://www.payfit.design/24f360409/p/202477-page-header)
|
|
80
150
|
*/
|
|
81
151
|
declare const PageHeader: import('react').ForwardRefExoticComponent<PageHeaderProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { Breadcrumbs as
|
|
5
|
-
import { Breadcrumb as
|
|
6
|
-
|
|
1
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as f } from "react";
|
|
3
|
+
import { uyTv as p } from "@payfit/unity-themes";
|
|
4
|
+
import { Breadcrumbs as y } from "../../breadcrumbs/Breadcrumbs.js";
|
|
5
|
+
import { Breadcrumb as b } from "../../breadcrumbs/parts/Breadcrumb.js";
|
|
6
|
+
import { RawBreadcrumbLink as x } from "../../breadcrumbs/parts/RawBreadcrumbLink.js";
|
|
7
|
+
const h = p({
|
|
7
8
|
slots: {
|
|
8
9
|
base: "uy:flex uy:flex-col uy:gap-400",
|
|
9
10
|
headingActionsWrapper: "uy:flex uy:flex-col uy:gap-400 uy:md:flex-row",
|
|
10
11
|
titles: "uy:flex uy:flex-col uy:gap-100 uy:flex-1",
|
|
11
12
|
actions: "uy:flex uy:flex-row uy:gap-100"
|
|
12
13
|
}
|
|
13
|
-
}), g =
|
|
14
|
-
|
|
14
|
+
}), g = (a) => a ? /* @__PURE__ */ r(y, { items: a, wrap: "nowrap", children: (e) => /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(x, { href: e.href, children: e.label }) }) }) : null, w = f(
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Internal usage for backward compatibility
|
|
16
|
+
({ children: a, actions: e, pagePath: o, renderBreadcrumbs: d, ...c }, n) => {
|
|
15
17
|
const {
|
|
16
|
-
base:
|
|
18
|
+
base: s,
|
|
17
19
|
titles: t,
|
|
18
|
-
headingActionsWrapper:
|
|
19
|
-
actions:
|
|
20
|
-
} =
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
20
|
+
headingActionsWrapper: u,
|
|
21
|
+
actions: i
|
|
22
|
+
} = h(), m = (d ?? g)(o);
|
|
23
|
+
return /* @__PURE__ */ l("header", { "data-dd-privacy": "allow", ...c, ref: n, className: s(), children: [
|
|
24
|
+
m,
|
|
25
|
+
/* @__PURE__ */ l("div", { className: u(), children: [
|
|
26
|
+
/* @__PURE__ */ r("div", { className: t(), children: a }),
|
|
27
|
+
e && /* @__PURE__ */ r("div", { className: i(), children: e })
|
|
26
28
|
] })
|
|
27
29
|
] });
|
|
28
30
|
}
|
|
29
31
|
);
|
|
30
|
-
|
|
32
|
+
w.displayName = "PageHeader";
|
|
31
33
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
w as PageHeader,
|
|
35
|
+
h as pageHeader
|
|
34
36
|
};
|
|
@@ -1,92 +1,71 @@
|
|
|
1
1
|
import { VariantProps } from '@payfit/unity-themes';
|
|
2
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
3
|
export declare const pagination: import('tailwind-variants').TVReturnType<{
|
|
3
4
|
[key: string]: {
|
|
4
5
|
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
5
6
|
base?: import('tailwind-merge').ClassNameValue;
|
|
6
|
-
pagesList?: import('tailwind-merge').ClassNameValue;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
9
|
} | {
|
|
10
10
|
[x: string]: {
|
|
11
11
|
[x: string]: import('tailwind-merge').ClassNameValue | {
|
|
12
12
|
base?: import('tailwind-merge').ClassNameValue;
|
|
13
|
-
pagesList?: import('tailwind-merge').ClassNameValue;
|
|
14
13
|
};
|
|
15
14
|
};
|
|
16
15
|
} | {}, {
|
|
17
16
|
base: string;
|
|
18
|
-
pagesList: string;
|
|
19
17
|
}, undefined, {
|
|
20
18
|
[key: string]: {
|
|
21
19
|
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
22
20
|
base?: import('tailwind-merge').ClassNameValue;
|
|
23
|
-
pagesList?: import('tailwind-merge').ClassNameValue;
|
|
24
21
|
};
|
|
25
22
|
};
|
|
26
23
|
} | {}, {
|
|
27
24
|
base: string;
|
|
28
|
-
pagesList: string;
|
|
29
25
|
}, import('tailwind-variants').TVReturnType<unknown, {
|
|
30
26
|
base: string;
|
|
31
|
-
pagesList: string;
|
|
32
27
|
}, undefined, unknown, unknown, undefined>>;
|
|
33
|
-
export interface PaginationProps extends VariantProps<typeof pagination> {
|
|
28
|
+
export interface PaginationProps extends VariantProps<typeof pagination>, ComponentPropsWithoutRef<'nav'> {
|
|
29
|
+
children: ReactNode;
|
|
34
30
|
/**
|
|
35
|
-
* The total number of pages
|
|
31
|
+
* The total number of pages.
|
|
32
|
+
* Use -1 to indicate an unknown page count (e.g., for server-paginated data where total pages are not known upfront).
|
|
33
|
+
* When -1, the End key is disabled and forward navigation has no upper limit.
|
|
36
34
|
*/
|
|
37
35
|
pageCount: number;
|
|
38
36
|
/**
|
|
39
|
-
* The current page
|
|
37
|
+
* The current page (1-based)
|
|
40
38
|
*/
|
|
41
|
-
currentPage
|
|
42
|
-
/**
|
|
43
|
-
* The initial page to display when in uncontrolled mode
|
|
44
|
-
*/
|
|
45
|
-
defaultPage?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Optional callback function that is triggered when a page hover event occurs.
|
|
48
|
-
* Can be used to handle logic or effects related to the hover action over a specific page.
|
|
49
|
-
* @param {number} page - The number of the page that is being hovered over.
|
|
50
|
-
*/
|
|
51
|
-
onPageHover?: (page: number) => void;
|
|
39
|
+
currentPage: number;
|
|
52
40
|
/**
|
|
53
41
|
* Callback fired when the page changes
|
|
54
42
|
* @param page - The new page number
|
|
55
43
|
* @param previous - The previous page number
|
|
56
44
|
* @param direction - The direction of navigation (1 for forward, -1 for backward)
|
|
57
45
|
*/
|
|
58
|
-
onPageChange
|
|
59
|
-
/**
|
|
60
|
-
* Optional callback for the "next" button's press
|
|
61
|
-
*/
|
|
62
|
-
onNextPress?: () => void;
|
|
63
|
-
/**
|
|
64
|
-
* Optional callback for previous button press
|
|
65
|
-
*/
|
|
66
|
-
onPreviousPress?: () => void;
|
|
46
|
+
onPageChange: (page: number, previous: number, direction: -1 | 1) => void;
|
|
67
47
|
}
|
|
68
48
|
/**
|
|
69
|
-
* The Pagination component
|
|
70
|
-
*
|
|
71
|
-
* Pagination offers both controlled and uncontrolled usage, support for keyboard navigation, and automatic handling of page ranges with ellipsis for large numbers of pages.
|
|
72
|
-
* @param {PaginationProps} props - Regular HTML div attributes plus pagination-specific properties
|
|
73
|
-
* @see {@link PaginationProps} for all available props
|
|
49
|
+
* The Pagination component provides a container for pagination controls with proper navigation semantics.
|
|
50
|
+
* This is the root component for composition-based pagination patterns.
|
|
74
51
|
* @example
|
|
75
52
|
* ```tsx
|
|
76
|
-
* import { Pagination } from '@payfit/unity-components'
|
|
53
|
+
* import { Pagination, PaginationContent, PaginationItem, RawPaginationLink } from '@payfit/unity-components'
|
|
77
54
|
*
|
|
78
|
-
* function
|
|
55
|
+
* function MyPagination() {
|
|
79
56
|
* return (
|
|
80
|
-
* <Pagination
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
57
|
+
* <Pagination>
|
|
58
|
+
* <PaginationContent>
|
|
59
|
+
* <PaginationItem>
|
|
60
|
+
* <RawPaginationLink href="/page/1" isActive>
|
|
61
|
+
* 1
|
|
62
|
+
* </RawPaginationLink>
|
|
63
|
+
* </PaginationItem>
|
|
64
|
+
* </PaginationContent>
|
|
65
|
+
* </Pagination>
|
|
85
66
|
* )
|
|
86
67
|
* }
|
|
87
68
|
* ```
|
|
88
|
-
* @remarks
|
|
89
|
-
* [API](https://unity-components.payfit.io/?path=/docs/navigation-pagination--docs) • [Demo](https://unity-components.payfit.io/?path=/docs/navigation-pagination--docs)
|
|
90
69
|
*/
|
|
91
|
-
declare const Pagination: import('react').ForwardRefExoticComponent<PaginationProps & import('react').RefAttributes<
|
|
70
|
+
declare const Pagination: import('react').ForwardRefExoticComponent<PaginationProps & import('react').RefAttributes<HTMLElement>>;
|
|
92
71
|
export { Pagination };
|
|
@@ -1,176 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { useId as
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import { useOverlayTriggerState as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import { PaginationLink as K } from "./parts/PaginationLink.js";
|
|
11
|
-
import { PaginationNavButton as y } from "./parts/PaginationNavButton.js";
|
|
12
|
-
import { generatePaginationWithWindow as O } from "./utils/pagination-window.js";
|
|
13
|
-
const S = q({
|
|
1
|
+
import { jsx as r, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as k, useRef as x, useCallback as f } from "react";
|
|
3
|
+
import { uyTv as D } from "@payfit/unity-themes";
|
|
4
|
+
import { useId as L } from "react-aria";
|
|
5
|
+
import { useIntl as A } from "react-intl";
|
|
6
|
+
import { useOverlayTriggerState as I } from "react-stately";
|
|
7
|
+
import { PaginationJumpDialog as T } from "../client-side-pagination/parts/PaginationJumpDialog.js";
|
|
8
|
+
import { PaginationContext as R } from "./PaginationContext.js";
|
|
9
|
+
const g = D({
|
|
14
10
|
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"
|
|
11
|
+
base: "uy:flex uy:gap-100 uy:relative"
|
|
17
12
|
}
|
|
18
|
-
}),
|
|
19
|
-
({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
currentPage: u,
|
|
23
|
-
onPageHover: b,
|
|
24
|
-
onPageChange: f,
|
|
25
|
-
onNextPress: P,
|
|
26
|
-
onPreviousPress: w,
|
|
27
|
-
...D
|
|
28
|
-
}, A) => {
|
|
29
|
-
const p = E(), l = R(), v = u !== void 0 && f !== void 0 && c === void 0, { currentPage: s, goToPage: i } = $({
|
|
30
|
-
pageCount: t,
|
|
31
|
-
initialPage: v ? u : c,
|
|
32
|
-
onPageChange: f,
|
|
33
|
-
isControlled: v
|
|
34
|
-
}), m = W({}), r = M(/* @__PURE__ */ new Map()), L = T(
|
|
35
|
-
() => O(
|
|
36
|
-
t,
|
|
37
|
-
s,
|
|
38
|
-
H
|
|
39
|
-
),
|
|
40
|
-
[t, s]
|
|
41
|
-
), h = new Intl.NumberFormat(l.locale, {
|
|
42
|
-
notation: "standard"
|
|
43
|
-
}), k = (e) => {
|
|
44
|
-
i(e), m.close(), requestAnimationFrame(() => {
|
|
45
|
-
const a = r.current.get(e);
|
|
46
|
-
a && a.focus();
|
|
47
|
-
});
|
|
48
|
-
}, d = (e, a) => {
|
|
49
|
-
switch (e.key) {
|
|
50
|
-
case "ArrowLeft":
|
|
51
|
-
case "ArrowUp":
|
|
52
|
-
e.preventDefault(), a > 1 && (i(a - 1), requestAnimationFrame(() => {
|
|
53
|
-
r.current.get(a - 1)?.focus();
|
|
54
|
-
}));
|
|
55
|
-
break;
|
|
56
|
-
case "ArrowRight":
|
|
57
|
-
case "ArrowDown":
|
|
58
|
-
e.preventDefault(), a < t && (i(a + 1), requestAnimationFrame(() => {
|
|
59
|
-
r.current.get(a + 1)?.focus();
|
|
60
|
-
}));
|
|
61
|
-
break;
|
|
62
|
-
case "Home":
|
|
63
|
-
e.preventDefault(), i(1), requestAnimationFrame(() => {
|
|
64
|
-
r.current.get(1)?.focus();
|
|
65
|
-
});
|
|
66
|
-
break;
|
|
67
|
-
case "End":
|
|
68
|
-
e.preventDefault(), i(t), requestAnimationFrame(() => {
|
|
69
|
-
r.current.get(t)?.focus();
|
|
70
|
-
});
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}, g = {
|
|
74
|
-
paginationLabel: l.formatMessage({
|
|
13
|
+
}), j = k(
|
|
14
|
+
({ children: c, pageCount: o, currentPage: i, onPageChange: s, ...p }, d) => {
|
|
15
|
+
const y = L(), b = A(), n = I({}), e = x(/* @__PURE__ */ new Map()), w = {
|
|
16
|
+
paginationLabel: b.formatMessage({
|
|
75
17
|
id: "unity:component:pagination:label",
|
|
76
18
|
defaultMessage: "Pagination"
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
19
|
+
})
|
|
20
|
+
}, l = {
|
|
21
|
+
paginationListId: `uy:pagination-${y}__list`
|
|
22
|
+
}, u = f(
|
|
23
|
+
(t) => {
|
|
24
|
+
s(t, i, Math.sign(t - i)), n.close(), requestAnimationFrame(() => {
|
|
25
|
+
const a = e.current.get(t);
|
|
26
|
+
a && a.focus();
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
[s, n, e, i]
|
|
30
|
+
), v = f(
|
|
31
|
+
(t) => {
|
|
32
|
+
t.preventDefault();
|
|
33
|
+
let a = i;
|
|
34
|
+
switch (t.key) {
|
|
35
|
+
case "ArrowLeft":
|
|
36
|
+
case "ArrowDown":
|
|
37
|
+
a = Math.max(1, i - 1);
|
|
38
|
+
break;
|
|
39
|
+
case "ArrowRight":
|
|
40
|
+
case "ArrowUp":
|
|
41
|
+
a = o === -1 ? i + 1 : Math.min(i + 1, o);
|
|
42
|
+
break;
|
|
43
|
+
case "Home":
|
|
44
|
+
a = 1;
|
|
45
|
+
break;
|
|
46
|
+
case "End":
|
|
47
|
+
o !== -1 && (a = o);
|
|
48
|
+
break;
|
|
86
49
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
50
|
+
a !== i && (s(
|
|
51
|
+
a,
|
|
52
|
+
i,
|
|
53
|
+
Math.sign(a - i)
|
|
54
|
+
), setTimeout(() => {
|
|
55
|
+
const m = e.current.get(a);
|
|
56
|
+
m && m.focus();
|
|
57
|
+
}, 0));
|
|
58
|
+
},
|
|
59
|
+
[o, i, s]
|
|
60
|
+
), { base: M } = g();
|
|
61
|
+
return /* @__PURE__ */ r(
|
|
62
|
+
R.Provider,
|
|
91
63
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
/* @__PURE__ */ n("ul", { className: F(), "aria-label": g.pageListLabel, children: L.map(
|
|
117
|
-
(e, a) => e.type === "page" ? /* @__PURE__ */ n(
|
|
118
|
-
"li",
|
|
119
|
-
{
|
|
120
|
-
"aria-setsize": t,
|
|
121
|
-
"aria-posinset": e.value,
|
|
122
|
-
children: /* @__PURE__ */ n(
|
|
123
|
-
K,
|
|
124
|
-
{
|
|
125
|
-
ref: (o) => {
|
|
126
|
-
o ? r.current.set(e.value, o) : r.current.delete(e.value);
|
|
127
|
-
},
|
|
128
|
-
onPress: () => {
|
|
129
|
-
i(e.value);
|
|
130
|
-
},
|
|
131
|
-
onHoverChange: (o) => {
|
|
132
|
-
o && b?.(e.value);
|
|
133
|
-
},
|
|
134
|
-
onKeyDown: (o) => {
|
|
135
|
-
d(o, e.value);
|
|
136
|
-
},
|
|
137
|
-
isActive: e.value === s,
|
|
138
|
-
value: e.value,
|
|
139
|
-
children: h.format(e.value)
|
|
140
|
-
}
|
|
141
|
-
)
|
|
142
|
-
},
|
|
143
|
-
`pagination-${p}-item-${a}`
|
|
144
|
-
) : /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
145
|
-
j,
|
|
146
|
-
{
|
|
147
|
-
value: e.value,
|
|
148
|
-
onKeyDown: (o) => {
|
|
149
|
-
d(o, -1);
|
|
150
|
-
},
|
|
151
|
-
onPress: () => {
|
|
152
|
-
m.open();
|
|
64
|
+
value: {
|
|
65
|
+
pageCount: o,
|
|
66
|
+
currentPage: i,
|
|
67
|
+
onPageChange: s,
|
|
68
|
+
a11yIds: l,
|
|
69
|
+
pageRefs: e,
|
|
70
|
+
onKeyDown: v
|
|
71
|
+
},
|
|
72
|
+
children: /* @__PURE__ */ h(
|
|
73
|
+
"nav",
|
|
74
|
+
{
|
|
75
|
+
"data-dd-privacy": "allow",
|
|
76
|
+
...p,
|
|
77
|
+
ref: d,
|
|
78
|
+
className: M(),
|
|
79
|
+
"aria-label": w.paginationLabel,
|
|
80
|
+
"aria-describedby": l.paginationListId,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ r(
|
|
83
|
+
T,
|
|
84
|
+
{
|
|
85
|
+
pageCount: o,
|
|
86
|
+
onJumpToPage: u,
|
|
87
|
+
state: n
|
|
153
88
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
{
|
|
160
|
-
variant: "next",
|
|
161
|
-
isDisabled: s === t,
|
|
162
|
-
onClick: () => {
|
|
163
|
-
i("next"), P?.();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
]
|
|
89
|
+
),
|
|
90
|
+
c
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
168
94
|
}
|
|
169
95
|
);
|
|
170
96
|
}
|
|
171
97
|
);
|
|
172
|
-
|
|
98
|
+
j.displayName = "Pagination";
|
|
173
99
|
export {
|
|
174
|
-
|
|
175
|
-
|
|
100
|
+
j as Pagination,
|
|
101
|
+
g as pagination
|
|
176
102
|
};
|