@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
@@ -1,7 +1,8 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { IconSprite as i } from "@payfit/unity-icons";
3
- import { uyTv as d } from "@payfit/unity-themes";
4
- const l = d({
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 f({
91
- alt: n,
92
- color: o,
93
- size: c,
94
- src: r,
95
- role: a = "img",
96
- display: s = "block",
97
- ...t
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 = l({ size: c, color: o, display: s });
100
- return /* @__PURE__ */ e(
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
- ...t,
105
- role: a,
106
- "aria-label": t["aria-labelledby"] ? void 0 : n,
107
- children: /* @__PURE__ */ e(i, { className: u, src: r })
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
- f as Icon
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 { uyTv as e } from "@payfit/unity-themes";
2
- const a = e({
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
- a as link
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 MenuItem({ prefix, children, href, onAction, className, ...dataAttributes }: PropsWithChildren<MenuItemProps>): import("react/jsx-runtime").JSX.Element;
12
- export declare namespace MenuItem {
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 s, jsx as o } from "react/jsx-runtime";
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: n,
10
- ...a
9
+ className: a,
10
+ ...n
11
11
  }) {
12
- return /* @__PURE__ */ s(
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
- n
19
+ a
20
20
  ),
21
- ...a,
21
+ ...n,
22
22
  children: [
23
- /* @__PURE__ */ o("div", { className: "uy:text-content-neutral-low", children: e || null }),
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 = "MenuItem";
29
+ l.displayName = "RawMenuItem";
30
30
  export {
31
- l as MenuItem
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 { NavItem, NavItemProps } from './NavItem.js';
4
- type NavGroupChildren = React.ReactElement<NavItemProps, typeof NavItem>;
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 `<NavItem>` components. */
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 o, jsx as n } from "react/jsx-runtime";
2
- import r, { useState as G, useCallback as j } from "react";
3
- import { uyTv as B } from "@payfit/unity-themes";
4
- import { Button as D } from "react-aria-components";
5
- import _ from "../../../hooks/use-id.js";
6
- import { Icon as $ } from "../../icon/Icon.js";
7
- import { navItemBase as k } from "./NavItem.js";
8
- const z = B({
9
- extend: k,
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 H({
33
- children: y,
32
+ function M({
33
+ children: d,
34
34
  label: p,
35
- prefix: s,
36
- suffix: m,
35
+ prefix: l,
36
+ suffix: y,
37
37
  defaultExpanded: f = !1,
38
- isExpanded: l,
38
+ isExpanded: r,
39
39
  onToggle: i,
40
- ...x
40
+ ...N
41
41
  }) {
42
- const u = _(), [h, b] = G(f), a = l !== void 0, e = a ? l : h, v = j(() => {
43
- a || b((t) => !t), i?.(!e);
44
- }, [a, e, i]), g = r.Children.map(y, (t) => r.isValidElement(t) ? r.cloneElement(t, { isDisabled: !e, level: 1 }) : t), c = `${u}-toggle`, d = `${u}-content`, {
45
- base: N,
46
- prefix: I,
47
- label: E,
48
- suffix: S,
49
- content: w,
50
- contentWrapper: C,
51
- caret: W
52
- } = z({ level: 0, expanded: e });
53
- return /* @__PURE__ */ o("li", { className: "uy:flex uy:flex-col uy:gap-50", children: [
54
- /* @__PURE__ */ o(
55
- D,
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: N({ className: "uy:w-full" }),
59
- onPress: v,
60
- "aria-expanded": e,
61
- "aria-controls": d,
62
- ...x,
69
+ className: v,
70
+ onPress: C,
71
+ "aria-expanded": a,
72
+ "aria-controls": m,
73
+ ...N,
63
74
  children: [
64
- s && /* @__PURE__ */ n("span", { className: I(), children: s({ isExpanded: e }) }),
65
- /* @__PURE__ */ n("span", { className: E(), children: p }),
66
- /* @__PURE__ */ o("span", { className: S(), role: "presentation", children: [
67
- m,
68
- /* @__PURE__ */ n(
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: W(),
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__ */ n(
93
+ /* @__PURE__ */ t(
83
94
  "div",
84
95
  {
85
- className: C(),
86
- style: { maxHeight: e ? 1e3 : 0 },
87
- children: /* @__PURE__ */ n(
96
+ className: w,
97
+ style: { maxHeight: a ? 1e3 : 0 },
98
+ children: /* @__PURE__ */ t(
88
99
  "ul",
89
100
  {
90
- id: d,
91
- className: w(),
101
+ id: m,
102
+ className: E,
92
103
  "aria-labelledby": c,
93
- "aria-hidden": !e,
94
- children: g
104
+ "aria-hidden": !a,
105
+ children: h
95
106
  }
96
107
  )
97
108
  }
98
109
  )
99
110
  ] });
100
111
  }
101
- H.displayName = "NavGroup";
112
+ M.displayName = "NavGroup";
102
113
  export {
103
- H as NavGroup
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 `NavItem` 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.
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 function NavItem({ children, level, prefix, suffix, onPress, href, isCurrent, isDisabled, isExact, ...dataAttributes }: NavItemProps): import("react/jsx-runtime").JSX.Element;
161
- export declare namespace NavItem {
162
- var displayName: string;
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 {};