@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
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as i } from "react";
|
|
3
|
+
import { IconSprite as d } from "@payfit/unity-icons";
|
|
4
|
+
import { uyTv as l } from "@payfit/unity-themes";
|
|
5
|
+
const y = l({
|
|
5
6
|
variants: {
|
|
6
7
|
size: {
|
|
7
8
|
20: "uy:w-250 uy:h-250",
|
|
@@ -87,27 +88,30 @@ const l = d({
|
|
|
87
88
|
display: "block"
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
|
-
function
|
|
91
|
-
alt:
|
|
92
|
-
color:
|
|
93
|
-
size:
|
|
94
|
-
src:
|
|
95
|
-
role:
|
|
96
|
-
display:
|
|
97
|
-
...
|
|
91
|
+
function b({
|
|
92
|
+
alt: r,
|
|
93
|
+
color: t,
|
|
94
|
+
size: e,
|
|
95
|
+
src: a,
|
|
96
|
+
role: s = "img",
|
|
97
|
+
display: n = "block",
|
|
98
|
+
...o
|
|
98
99
|
}) {
|
|
99
|
-
const u =
|
|
100
|
-
|
|
100
|
+
const u = i(
|
|
101
|
+
() => y({ size: e, color: t, display: n }),
|
|
102
|
+
[e, t, n]
|
|
103
|
+
);
|
|
104
|
+
return /* @__PURE__ */ c(
|
|
101
105
|
"span",
|
|
102
106
|
{
|
|
103
107
|
"data-dd-privacy": "allow",
|
|
104
|
-
...
|
|
105
|
-
role:
|
|
106
|
-
"aria-label":
|
|
107
|
-
children: /* @__PURE__ */
|
|
108
|
+
...o,
|
|
109
|
+
role: s,
|
|
110
|
+
"aria-label": o["aria-labelledby"] ? void 0 : r,
|
|
111
|
+
children: /* @__PURE__ */ c(d, { className: u, src: a })
|
|
108
112
|
}
|
|
109
113
|
);
|
|
110
114
|
}
|
|
111
115
|
export {
|
|
112
|
-
|
|
116
|
+
b as Icon
|
|
113
117
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { VariantProps } from '@payfit/unity-themes';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
import { LinkProps as AriaLinkProps } from 'react-aria-components';
|
|
1
4
|
export declare const link: import('tailwind-variants').TVReturnType<{
|
|
2
5
|
variant: {
|
|
3
6
|
inline: {
|
|
@@ -164,3 +167,92 @@ export declare const link: import('tailwind-variants').TVReturnType<{
|
|
|
164
167
|
base: string[];
|
|
165
168
|
icon: string[];
|
|
166
169
|
}, undefined, unknown, unknown, undefined>>;
|
|
170
|
+
type LinkVariantProps = VariantProps<typeof link>;
|
|
171
|
+
export type RawLinkProps = Omit<AriaLinkProps, 'style' | 'className'> & {
|
|
172
|
+
/**
|
|
173
|
+
* The URL the link navigates to.
|
|
174
|
+
*/
|
|
175
|
+
href: HTMLAnchorElement['href'];
|
|
176
|
+
/**
|
|
177
|
+
* The link id
|
|
178
|
+
*/
|
|
179
|
+
id?: HTMLAttributes<HTMLAnchorElement>['id'];
|
|
180
|
+
/**
|
|
181
|
+
* The link's size.
|
|
182
|
+
* @default 'inherit'
|
|
183
|
+
*/
|
|
184
|
+
size?: LinkVariantProps['size'];
|
|
185
|
+
/**
|
|
186
|
+
* The link's display variant. Links can be inline with text or standalone (block).
|
|
187
|
+
* @default 'inline'
|
|
188
|
+
*/
|
|
189
|
+
variant?: LinkVariantProps['variant'];
|
|
190
|
+
/**
|
|
191
|
+
* The link's color.
|
|
192
|
+
* @default 'primary'
|
|
193
|
+
*/
|
|
194
|
+
color?: LinkVariantProps['color'];
|
|
195
|
+
/**
|
|
196
|
+
* Whether the link navigates to an external page. If true, the link will open in a new tab and display an indicator icon.
|
|
197
|
+
* @default false
|
|
198
|
+
*/
|
|
199
|
+
isExternal?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Whether the link marks the current section or page.
|
|
202
|
+
* @default false
|
|
203
|
+
*/
|
|
204
|
+
isCurrent?: Pick<HTMLAttributes<HTMLAnchorElement>, 'aria-current'> | undefined;
|
|
205
|
+
/**
|
|
206
|
+
* When true, the active state will only be applied if the location is matched exactly.
|
|
207
|
+
* @default false
|
|
208
|
+
*/
|
|
209
|
+
isExact?: boolean;
|
|
210
|
+
maxCharactersTruncation?: number;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Links allow users to navigate to different pages or sections.
|
|
214
|
+
*/
|
|
215
|
+
declare const RawLink: import('react').ForwardRefExoticComponent<Omit<AriaLinkProps, "className" | "style"> & {
|
|
216
|
+
/**
|
|
217
|
+
* The URL the link navigates to.
|
|
218
|
+
*/
|
|
219
|
+
href: HTMLAnchorElement["href"];
|
|
220
|
+
/**
|
|
221
|
+
* The link id
|
|
222
|
+
*/
|
|
223
|
+
id?: HTMLAttributes<HTMLAnchorElement>["id"];
|
|
224
|
+
/**
|
|
225
|
+
* The link's size.
|
|
226
|
+
* @default 'inherit'
|
|
227
|
+
*/
|
|
228
|
+
size?: LinkVariantProps["size"];
|
|
229
|
+
/**
|
|
230
|
+
* The link's display variant. Links can be inline with text or standalone (block).
|
|
231
|
+
* @default 'inline'
|
|
232
|
+
*/
|
|
233
|
+
variant?: LinkVariantProps["variant"];
|
|
234
|
+
/**
|
|
235
|
+
* The link's color.
|
|
236
|
+
* @default 'primary'
|
|
237
|
+
*/
|
|
238
|
+
color?: LinkVariantProps["color"];
|
|
239
|
+
/**
|
|
240
|
+
* Whether the link navigates to an external page. If true, the link will open in a new tab and display an indicator icon.
|
|
241
|
+
* @default false
|
|
242
|
+
*/
|
|
243
|
+
isExternal?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Whether the link marks the current section or page.
|
|
246
|
+
* @default false
|
|
247
|
+
*/
|
|
248
|
+
isCurrent?: Pick<HTMLAttributes<HTMLAnchorElement>, "aria-current"> | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* When true, the active state will only be applied if the location is matched exactly.
|
|
251
|
+
* @default false
|
|
252
|
+
*/
|
|
253
|
+
isExact?: boolean;
|
|
254
|
+
maxCharactersTruncation?: number;
|
|
255
|
+
} & {
|
|
256
|
+
children?: import('react').ReactNode | undefined;
|
|
257
|
+
} & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
258
|
+
export { RawLink };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { jsxs as g, jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as w } from "react";
|
|
3
|
+
import { IconSprite as k } from "@payfit/unity-icons";
|
|
4
|
+
import { uyTv as D } from "@payfit/unity-themes";
|
|
5
|
+
import { Link as A } from "react-aria-components";
|
|
6
|
+
import { useRouter as E } from "../../providers/router/RouterProvider.js";
|
|
7
|
+
import { isExternalUrl as L } from "./utils.js";
|
|
8
|
+
const N = D({
|
|
3
9
|
slots: {
|
|
4
10
|
base: [
|
|
5
11
|
"uy:rounded-50 uy:underline uy:transition-colors uy:underline-offset-3",
|
|
@@ -70,7 +76,67 @@ const a = e({
|
|
|
70
76
|
isDisabled: !1,
|
|
71
77
|
size: "inherit"
|
|
72
78
|
}
|
|
73
|
-
})
|
|
79
|
+
}), R = w(
|
|
80
|
+
({
|
|
81
|
+
href: a,
|
|
82
|
+
children: s,
|
|
83
|
+
variant: l = "inline",
|
|
84
|
+
color: u = "primary",
|
|
85
|
+
isDisabled: o = !1,
|
|
86
|
+
isExact: c = !1,
|
|
87
|
+
isCurrent: y = void 0,
|
|
88
|
+
isExternal: d,
|
|
89
|
+
maxCharactersTruncation: r,
|
|
90
|
+
size: b = "inherit",
|
|
91
|
+
...e
|
|
92
|
+
}, p) => {
|
|
93
|
+
const i = E(), t = d ?? L(a), n = !t && i ? i.isActive(a.toString(), c) : y, { base: m, icon: f } = N({
|
|
94
|
+
variant: l,
|
|
95
|
+
color: u,
|
|
96
|
+
isDisabled: o,
|
|
97
|
+
size: b,
|
|
98
|
+
isTruncated: !!r
|
|
99
|
+
}), v = !!r, x = i && {
|
|
100
|
+
...n !== void 0 && {
|
|
101
|
+
"data-current": n,
|
|
102
|
+
"aria-current": n ? "page" : void 0
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return /* @__PURE__ */ g(
|
|
106
|
+
A,
|
|
107
|
+
{
|
|
108
|
+
"data-dd-privacy": "allow",
|
|
109
|
+
...e,
|
|
110
|
+
href: a,
|
|
111
|
+
ref: p,
|
|
112
|
+
style: v ? {
|
|
113
|
+
"--uy-link-max-w": `${r}ch`
|
|
114
|
+
} : {},
|
|
115
|
+
className: m(),
|
|
116
|
+
isDisabled: o,
|
|
117
|
+
target: t ? "_blank" : e.target,
|
|
118
|
+
rel: t && !e.rel ? "noopener noreferrer" : e.rel,
|
|
119
|
+
...x,
|
|
120
|
+
children: [
|
|
121
|
+
s,
|
|
122
|
+
t && /* @__PURE__ */ h(
|
|
123
|
+
k,
|
|
124
|
+
{
|
|
125
|
+
src: "ArrowSquareOutOutlined",
|
|
126
|
+
color: "currentColor",
|
|
127
|
+
width: "1.45em",
|
|
128
|
+
height: "1.45em",
|
|
129
|
+
role: "presentation",
|
|
130
|
+
className: f()
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
R.displayName = "Link";
|
|
74
139
|
export {
|
|
75
|
-
|
|
140
|
+
R as RawLink,
|
|
141
|
+
N as link
|
|
76
142
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import { MenuItemProps as MenuItemAriaComponentProps } from 'react-aria-components';
|
|
3
3
|
import { DataAttributes } from '../../../types/DataAttributes.js';
|
|
4
|
-
interface MenuItemProps extends DataAttributes {
|
|
4
|
+
export interface MenuItemProps extends DataAttributes {
|
|
5
5
|
children?: MenuItemAriaComponentProps['children'];
|
|
6
6
|
href?: MenuItemAriaComponentProps['href'];
|
|
7
7
|
onAction?: MenuItemAriaComponentProps['onAction'];
|
|
8
8
|
prefix?: ReactNode;
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare function
|
|
12
|
-
export declare namespace
|
|
11
|
+
export declare function RawMenuItem({ prefix, children, href, onAction, className, ...dataAttributes }: PropsWithChildren<MenuItemProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare namespace RawMenuItem {
|
|
13
13
|
var displayName: string;
|
|
14
14
|
}
|
|
15
|
-
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { uyMerge as y } from "@payfit/unity-themes";
|
|
3
3
|
import { MenuItem as i } from "react-aria-components";
|
|
4
4
|
function l({
|
|
@@ -6,27 +6,27 @@ function l({
|
|
|
6
6
|
children: u,
|
|
7
7
|
href: t,
|
|
8
8
|
onAction: r,
|
|
9
|
-
className:
|
|
10
|
-
...
|
|
9
|
+
className: a,
|
|
10
|
+
...n
|
|
11
11
|
}) {
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ o(
|
|
13
13
|
i,
|
|
14
14
|
{
|
|
15
15
|
href: t,
|
|
16
16
|
onAction: r,
|
|
17
17
|
className: y(
|
|
18
18
|
"uy:cursor-pointer uy:flex uy:p-100 uy:items-start uy:gap-100 uy:rounded-25 uy:typography-body uy:text-content-neutral uy:hover:bg-surface-neutral-hover uy:data-[pressed]:bg-surface-neutral-pressed uy:focus-visible:outline-utility-focus-ring uy:active:bg-surface-neutral-active",
|
|
19
|
-
|
|
19
|
+
a
|
|
20
20
|
),
|
|
21
|
-
...
|
|
21
|
+
...n,
|
|
22
22
|
children: [
|
|
23
|
-
/* @__PURE__ */
|
|
23
|
+
/* @__PURE__ */ s("div", { className: "uy:text-content-neutral-low", children: e || null }),
|
|
24
24
|
u
|
|
25
25
|
]
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
l.displayName = "
|
|
29
|
+
l.displayName = "RawMenuItem";
|
|
30
30
|
export {
|
|
31
|
-
l as
|
|
31
|
+
l as RawMenuItem
|
|
32
32
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
2
|
import { DataAttributes } from '../../../types/DataAttributes.js';
|
|
3
|
-
import {
|
|
4
|
-
type NavGroupChildren = React.ReactElement<NavItemProps, typeof
|
|
3
|
+
import { NavItemProps, RawNavItem } from './RawNavItem.js';
|
|
4
|
+
type NavGroupChildren = React.ReactElement<NavItemProps, typeof RawNavItem>;
|
|
5
5
|
type NavGroupProps = {
|
|
6
|
-
/** The child elements to be rendered inside the NavGroup. They must be `<
|
|
6
|
+
/** The child elements to be rendered inside the NavGroup. They must be `<RawNavItem>` components. */
|
|
7
7
|
children: NavGroupChildren | NavGroupChildren[];
|
|
8
8
|
/** The label to show for the NavGroup. */
|
|
9
9
|
label: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import { Button as
|
|
5
|
-
import
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { navItemBase as
|
|
8
|
-
const
|
|
9
|
-
extend:
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import o, { useState as j, useCallback as B, useMemo as D } from "react";
|
|
3
|
+
import { uyTv as S } from "@payfit/unity-themes";
|
|
4
|
+
import { Button as _ } from "react-aria-components";
|
|
5
|
+
import $ from "../../../hooks/use-id.js";
|
|
6
|
+
import { Icon as k } from "../../icon/Icon.js";
|
|
7
|
+
import { navItemBase as z } from "./RawNavItem.js";
|
|
8
|
+
const H = S({
|
|
9
|
+
extend: z,
|
|
10
10
|
slots: {
|
|
11
11
|
caret: "uy:transition-transform uy:duration-150 uy:delay-25 uy:ease-linear motion-reduce:transition-none",
|
|
12
12
|
contentWrapper: "uy:transition-[max-height] uy:duration-200 uy:ease-linear motion-reduce:transition-none",
|
|
@@ -29,49 +29,60 @@ const z = B({
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
function
|
|
33
|
-
children:
|
|
32
|
+
function M({
|
|
33
|
+
children: d,
|
|
34
34
|
label: p,
|
|
35
|
-
prefix:
|
|
36
|
-
suffix:
|
|
35
|
+
prefix: l,
|
|
36
|
+
suffix: y,
|
|
37
37
|
defaultExpanded: f = !1,
|
|
38
|
-
isExpanded:
|
|
38
|
+
isExpanded: r,
|
|
39
39
|
onToggle: i,
|
|
40
|
-
...
|
|
40
|
+
...N
|
|
41
41
|
}) {
|
|
42
|
-
const u =
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
const u = $(), [x, b] = j(f), n = r !== void 0, a = n ? r : x, C = B(() => {
|
|
43
|
+
n || b((e) => !e), i?.(!a);
|
|
44
|
+
}, [n, a, i]), h = o.Children.map(d, (e) => o.isValidElement(e) ? o.cloneElement(e, { isDisabled: !a, level: 1 }) : e), c = `${u}-toggle`, m = `${u}-content`, {
|
|
45
|
+
baseClassName: v,
|
|
46
|
+
prefixClassName: g,
|
|
47
|
+
labelClassName: I,
|
|
48
|
+
suffixClassName: W,
|
|
49
|
+
contentClassName: E,
|
|
50
|
+
contentWrapperClassName: w,
|
|
51
|
+
caretClassName: G
|
|
52
|
+
} = D(() => {
|
|
53
|
+
const e = H({ level: 0, expanded: a });
|
|
54
|
+
return {
|
|
55
|
+
baseClassName: e.base({ className: "uy:w-full" }),
|
|
56
|
+
prefixClassName: e.prefix(),
|
|
57
|
+
suffixClassName: e.suffix(),
|
|
58
|
+
labelClassName: e.label(),
|
|
59
|
+
contentWrapperClassName: e.contentWrapper(),
|
|
60
|
+
contentClassName: e.content(),
|
|
61
|
+
caretClassName: e.caret()
|
|
62
|
+
};
|
|
63
|
+
}, [a]);
|
|
64
|
+
return /* @__PURE__ */ s("li", { className: "uy:flex uy:flex-col uy:gap-50", children: [
|
|
65
|
+
/* @__PURE__ */ s(
|
|
66
|
+
_,
|
|
56
67
|
{
|
|
57
68
|
id: c,
|
|
58
|
-
className:
|
|
59
|
-
onPress:
|
|
60
|
-
"aria-expanded":
|
|
61
|
-
"aria-controls":
|
|
62
|
-
...
|
|
69
|
+
className: v,
|
|
70
|
+
onPress: C,
|
|
71
|
+
"aria-expanded": a,
|
|
72
|
+
"aria-controls": m,
|
|
73
|
+
...N,
|
|
63
74
|
children: [
|
|
64
|
-
|
|
65
|
-
/* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
75
|
+
l && /* @__PURE__ */ t("span", { className: g, children: l({ isExpanded: a }) }),
|
|
76
|
+
/* @__PURE__ */ t("span", { className: I, children: p }),
|
|
77
|
+
/* @__PURE__ */ s("span", { className: W, role: "presentation", children: [
|
|
78
|
+
y,
|
|
79
|
+
/* @__PURE__ */ t(
|
|
80
|
+
k,
|
|
70
81
|
{
|
|
71
82
|
src: "CaretDownOutlined",
|
|
72
83
|
alt: "expand group",
|
|
73
84
|
size: 20,
|
|
74
|
-
className:
|
|
85
|
+
className: G,
|
|
75
86
|
color: "inherit"
|
|
76
87
|
}
|
|
77
88
|
)
|
|
@@ -79,26 +90,26 @@ function H({
|
|
|
79
90
|
]
|
|
80
91
|
}
|
|
81
92
|
),
|
|
82
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ t(
|
|
83
94
|
"div",
|
|
84
95
|
{
|
|
85
|
-
className:
|
|
86
|
-
style: { maxHeight:
|
|
87
|
-
children: /* @__PURE__ */
|
|
96
|
+
className: w,
|
|
97
|
+
style: { maxHeight: a ? 1e3 : 0 },
|
|
98
|
+
children: /* @__PURE__ */ t(
|
|
88
99
|
"ul",
|
|
89
100
|
{
|
|
90
|
-
id:
|
|
91
|
-
className:
|
|
101
|
+
id: m,
|
|
102
|
+
className: E,
|
|
92
103
|
"aria-labelledby": c,
|
|
93
|
-
"aria-hidden": !
|
|
94
|
-
children:
|
|
104
|
+
"aria-hidden": !a,
|
|
105
|
+
children: h
|
|
95
106
|
}
|
|
96
107
|
)
|
|
97
108
|
}
|
|
98
109
|
)
|
|
99
110
|
] });
|
|
100
111
|
}
|
|
101
|
-
|
|
112
|
+
M.displayName = "NavGroup";
|
|
102
113
|
export {
|
|
103
|
-
|
|
114
|
+
M as NavGroup
|
|
104
115
|
};
|
|
@@ -155,10 +155,107 @@ export type NavItemProps = Pick<VariantProps<typeof navItem>, 'level'> & PropsWi
|
|
|
155
155
|
isExact?: boolean;
|
|
156
156
|
}> & DataAttributes;
|
|
157
157
|
/**
|
|
158
|
-
* The `
|
|
158
|
+
* The `RawNavItem` component represents a single, fully accessible navigation item in a `Nav` component, with support for custom elements at the start or the end of the element. It can render a link or a button depending on the provided properties.
|
|
159
159
|
*/
|
|
160
|
-
export declare
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
export declare const RawNavItem: import('react').ForwardRefExoticComponent<Pick<VariantProps<import('tailwind-variants').TVReturnType<{
|
|
161
|
+
isActive: {
|
|
162
|
+
true: {
|
|
163
|
+
base: string;
|
|
164
|
+
prefix: string;
|
|
165
|
+
label: string;
|
|
166
|
+
};
|
|
167
|
+
false: {
|
|
168
|
+
base: string;
|
|
169
|
+
prefix: string;
|
|
170
|
+
label: string;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
}, undefined, undefined, {
|
|
174
|
+
level: {
|
|
175
|
+
0: string;
|
|
176
|
+
1: string;
|
|
177
|
+
};
|
|
178
|
+
isDisabled: {
|
|
179
|
+
true: {
|
|
180
|
+
base: string;
|
|
181
|
+
label: string;
|
|
182
|
+
};
|
|
183
|
+
false: string;
|
|
184
|
+
};
|
|
185
|
+
}, {
|
|
186
|
+
base: string[];
|
|
187
|
+
prefix: string;
|
|
188
|
+
suffix: string;
|
|
189
|
+
label: string[];
|
|
190
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
191
|
+
level: {
|
|
192
|
+
0: string;
|
|
193
|
+
1: string;
|
|
194
|
+
};
|
|
195
|
+
isDisabled: {
|
|
196
|
+
true: {
|
|
197
|
+
base: string;
|
|
198
|
+
label: string;
|
|
199
|
+
};
|
|
200
|
+
false: string;
|
|
201
|
+
};
|
|
202
|
+
}, {
|
|
203
|
+
base: string[];
|
|
204
|
+
prefix: string;
|
|
205
|
+
suffix: string;
|
|
206
|
+
label: string[];
|
|
207
|
+
}, undefined, {
|
|
208
|
+
level: {
|
|
209
|
+
0: string;
|
|
210
|
+
1: string;
|
|
211
|
+
};
|
|
212
|
+
isDisabled: {
|
|
213
|
+
true: {
|
|
214
|
+
base: string;
|
|
215
|
+
label: string;
|
|
216
|
+
};
|
|
217
|
+
false: string;
|
|
218
|
+
};
|
|
219
|
+
}, {
|
|
220
|
+
base: string[];
|
|
221
|
+
prefix: string;
|
|
222
|
+
suffix: string;
|
|
223
|
+
label: string[];
|
|
224
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
225
|
+
level: {
|
|
226
|
+
0: string;
|
|
227
|
+
1: string;
|
|
228
|
+
};
|
|
229
|
+
isDisabled: {
|
|
230
|
+
true: {
|
|
231
|
+
base: string;
|
|
232
|
+
label: string;
|
|
233
|
+
};
|
|
234
|
+
false: string;
|
|
235
|
+
};
|
|
236
|
+
}, {
|
|
237
|
+
base: string[];
|
|
238
|
+
prefix: string;
|
|
239
|
+
suffix: string;
|
|
240
|
+
label: string[];
|
|
241
|
+
}, undefined, unknown, unknown, undefined>>>>, "level"> & {
|
|
242
|
+
/** The prefix element to be displayed before the label. */
|
|
243
|
+
prefix?: ({ isCurrent }: {
|
|
244
|
+
isCurrent: boolean;
|
|
245
|
+
}) => ReactNode;
|
|
246
|
+
/** The suffix element to be displayed after the label. */
|
|
247
|
+
suffix?: ReactNode;
|
|
248
|
+
/** The click event handler for the nav item. Use it when the item executes an action that does not redirect to another page */
|
|
249
|
+
onPress?: AriaButtonProps["onPress"];
|
|
250
|
+
/** The URL to navigate to when the nav item is clicked. Use it when the item should trigger a navigation to another page */
|
|
251
|
+
href?: string;
|
|
252
|
+
/** Whether the nav item is currently active. */
|
|
253
|
+
isCurrent?: boolean;
|
|
254
|
+
/** Whether the nav item is disabled. */
|
|
255
|
+
isDisabled?: boolean;
|
|
256
|
+
/** Whether the nav item should exactly match the route's path. */
|
|
257
|
+
isExact?: boolean;
|
|
258
|
+
} & {
|
|
259
|
+
children?: ReactNode | undefined;
|
|
260
|
+
} & DataAttributes & import('react').RefAttributes<HTMLElement>>;
|
|
164
261
|
export {};
|