@payfit/unity-components 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/esm/components/action-bar/ActionBar.js +14 -14
  2. package/dist/esm/components/actionable/Actionable.js +31 -28
  3. package/dist/esm/components/app-layout/AppLayout.js +17 -17
  4. package/dist/esm/components/app-menu/parts/AppMenuHeader.d.ts +86 -4
  5. package/dist/esm/components/app-menu/parts/AppMenuHeader.js +25 -25
  6. package/dist/esm/components/breadcrumbs/Breadcrumbs.context.js +3 -3
  7. package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +19 -11
  8. package/dist/esm/components/breadcrumbs/Breadcrumbs.js +29 -18
  9. package/dist/esm/components/breadcrumbs/parts/Breadcrumb.d.ts +30 -5
  10. package/dist/esm/components/breadcrumbs/parts/Breadcrumb.js +35 -27
  11. package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.d.ts +37 -0
  12. package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.js +36 -0
  13. package/dist/esm/components/client-side-pagination/ClientSidePagination.d.ts +103 -0
  14. package/dist/esm/components/client-side-pagination/ClientSidePagination.js +177 -0
  15. package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.d.ts +11 -0
  16. package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.js +30 -0
  17. package/dist/esm/components/client-side-pagination/parts/PaginationJumpDialog.d.ts +8 -0
  18. package/dist/esm/components/{pagination/parts/PaginationLink.d.ts → client-side-pagination/parts/RawPaginationLink.d.ts} +2 -2
  19. package/dist/esm/components/{pagination/parts/PaginationLink.js → client-side-pagination/parts/RawPaginationLink.js} +2 -2
  20. package/dist/esm/components/client-side-pagination/utils/pagination-window.d.ts +8 -0
  21. package/dist/esm/components/client-side-pagination/utils/pagination-window.js +33 -0
  22. package/dist/esm/components/error-state/ErrorState.d.ts +13 -1
  23. package/dist/esm/components/error-state/ErrorState.js +133 -92
  24. package/dist/esm/components/error-state/initConfig.js +1 -1
  25. package/dist/esm/components/fieldset/Fieldset.d.ts +19 -0
  26. package/dist/esm/components/fieldset/Fieldset.js +32 -26
  27. package/dist/esm/components/flex/Flex.js +52 -37
  28. package/dist/esm/components/form-field/FormField.js +12 -12
  29. package/dist/esm/components/form-field/parts/{FormContextualLink.d.ts → RawFormContextualLink.d.ts} +2 -2
  30. package/dist/esm/components/form-field/parts/RawFormContextualLink.js +39 -0
  31. package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
  32. package/dist/esm/components/icon/Icon.js +23 -19
  33. package/dist/esm/components/link/{Link.variants.d.ts → RawLink.d.ts} +92 -0
  34. package/dist/esm/components/link/{Link.variants.js → RawLink.js} +70 -4
  35. package/dist/esm/components/menu/parts/{MenuItem.d.ts → RawMenuItem.d.ts} +3 -4
  36. package/dist/esm/components/menu/parts/{MenuItem.js → RawMenuItem.js} +9 -9
  37. package/dist/esm/components/nav/parts/NavGroup.d.ts +3 -3
  38. package/dist/esm/components/nav/parts/NavGroup.js +62 -51
  39. package/dist/esm/components/nav/parts/{NavItem.d.ts → RawNavItem.d.ts} +102 -5
  40. package/dist/esm/components/nav/parts/RawNavItem.js +106 -0
  41. package/dist/esm/components/page/Page.js +1 -1
  42. package/dist/esm/components/page/parts/PageHeader.d.ts +79 -9
  43. package/dist/esm/components/page/parts/PageHeader.js +22 -20
  44. package/dist/esm/components/pagination/Pagination.d.ts +23 -44
  45. package/dist/esm/components/pagination/Pagination.js +89 -163
  46. package/dist/esm/components/pagination/PaginationContext.d.ts +11 -0
  47. package/dist/esm/components/pagination/PaginationContext.js +15 -0
  48. package/dist/esm/components/pagination/hooks/use-pagination-state.d.ts +63 -0
  49. package/dist/esm/components/pagination/hooks/use-pagination-state.js +27 -0
  50. package/dist/esm/components/pagination/hooks/use-pagination-window.d.ts +64 -0
  51. package/dist/esm/components/pagination/hooks/use-pagination-window.js +15 -0
  52. package/dist/esm/components/pagination/parts/PaginationContent.d.ts +30 -0
  53. package/dist/esm/components/pagination/parts/PaginationContent.js +37 -0
  54. package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +23 -4
  55. package/dist/esm/components/pagination/parts/PaginationEllipsis.js +20 -16
  56. package/dist/esm/components/pagination/parts/PaginationItem.d.ts +38 -0
  57. package/dist/esm/components/pagination/parts/PaginationItem.js +22 -0
  58. package/dist/esm/components/pagination/parts/RawPaginationLink.d.ts +11 -0
  59. package/dist/esm/components/pagination/parts/RawPaginationLink.js +60 -0
  60. package/dist/esm/components/pagination/parts/RawPaginationNext.d.ts +22 -0
  61. package/dist/esm/components/pagination/parts/RawPaginationNext.js +70 -0
  62. package/dist/esm/components/pagination/parts/RawPaginationPrevious.d.ts +22 -0
  63. package/dist/esm/components/pagination/parts/RawPaginationPrevious.js +67 -0
  64. package/dist/esm/components/pagination/utils/pagination-window.js +29 -20
  65. package/dist/esm/components/select/Select.js +63 -45
  66. package/dist/esm/components/select/parts/SelectOption.js +9 -9
  67. package/dist/esm/components/skip-links/SkipLinks.js +1 -1
  68. package/dist/esm/components/table/Table.d.ts +1 -0
  69. package/dist/esm/components/table/Table.js +82 -73
  70. package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +6 -6
  71. package/dist/esm/components/table/parts/TableCell.js +29 -26
  72. package/dist/esm/components/table/parts/TablePagination.d.ts +5 -5
  73. package/dist/esm/components/table/parts/TablePagination.js +10 -10
  74. package/dist/esm/components/table/parts/TableRow.js +21 -18
  75. package/dist/esm/components/tabs/parts/{Tab.d.ts → RawTab.d.ts} +2 -2
  76. package/dist/esm/components/tabs/parts/{Tab.js → RawTab.js} +6 -6
  77. package/dist/esm/components/task-menu/TaskMenu.d.ts +4 -4
  78. package/dist/esm/components/task-menu/parts/{SubTask.d.ts → RawSubTask.d.ts} +7 -7
  79. package/dist/esm/components/task-menu/parts/{SubTask.js → RawSubTask.js} +19 -19
  80. package/dist/esm/components/task-menu/parts/{Task.d.ts → RawTask.d.ts} +7 -7
  81. package/dist/esm/components/task-menu/parts/{Task.js → RawTask.js} +17 -17
  82. package/dist/esm/components/task-menu/parts/TaskGroup.d.ts +5 -5
  83. package/dist/esm/components/text/Text.js +30 -27
  84. package/dist/esm/hooks/use-container-query-level.d.ts +42 -0
  85. package/dist/esm/hooks/use-container-query-level.js +33 -0
  86. package/dist/esm/index.d.ts +21 -11
  87. package/dist/esm/index.js +424 -399
  88. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumb.d.ts +23 -0
  89. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.d.ts +38 -0
  90. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.js +7 -0
  91. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumbs.d.ts +23 -0
  92. package/dist/esm/integrations/tanstack-router/components/breadcrumbs/use-route-breadcrumb.d.ts +53 -0
  93. package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.d.ts +40 -0
  94. package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.js +7 -0
  95. package/dist/esm/integrations/tanstack-router/components/link/Link.d.ts +33 -0
  96. package/dist/esm/integrations/tanstack-router/components/link/Link.js +7 -0
  97. package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.d.ts +49 -0
  98. package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.js +16 -0
  99. package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.d.ts +52 -0
  100. package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.js +29 -0
  101. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.d.ts +54 -0
  102. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.js +21 -0
  103. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.d.ts +52 -0
  104. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.js +22 -0
  105. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.d.ts +51 -0
  106. package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.js +22 -0
  107. package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.d.ts +82 -0
  108. package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.js +41 -0
  109. package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.d.ts +52 -0
  110. package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.js +15 -0
  111. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabList.d.ts +5 -0
  112. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.d.ts +77 -0
  113. package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.js +16 -0
  114. package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.d.ts +69 -0
  115. package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.js +14 -0
  116. package/dist/esm/integrations/tanstack-router/components/task-menu/Task.d.ts +64 -0
  117. package/dist/esm/integrations/tanstack-router/components/task-menu/Task.js +14 -0
  118. package/dist/esm/integrations/tanstack-router/index.d.ts +16 -0
  119. package/dist/esm/integrations/tanstack-router/utils/decorators.d.ts +23 -0
  120. package/dist/esm/integrations/tanstack-router.js +34 -0
  121. package/dist/esm/providers/router/RouterProvider.d.ts +7 -2
  122. package/dist/esm/providers/router/RouterProvider.js +14 -10
  123. package/dist/esm/types/DataAttributes.d.ts +1 -1
  124. package/i18n/en-GB.json +1 -0
  125. package/i18n/es-ES.json +1 -0
  126. package/i18n/fr-FR.json +1 -0
  127. package/package.json +47 -25
  128. package/dist/esm/components/form-field/parts/FormContextualLink.js +0 -37
  129. package/dist/esm/components/link/Link.d.ts +0 -93
  130. package/dist/esm/components/link/Link.js +0 -68
  131. package/dist/esm/components/nav/parts/NavItem.js +0 -95
  132. /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.d.ts +0 -0
  133. /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.js +0 -0
  134. /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationJumpDialog.js +0 -0
  135. /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.d.ts +0 -0
  136. /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.js +0 -0
@@ -0,0 +1,67 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as m } from "react";
3
+ import { uyTv as g } from "@payfit/unity-themes";
4
+ import { Link as v } from "react-aria-components";
5
+ import { useIntl as b } from "react-intl";
6
+ import { Icon as h } from "../../icon/Icon.js";
7
+ import { Tooltip as w } from "../../tooltip/Tooltip.js";
8
+ import { usePaginationContext as x } from "../PaginationContext.js";
9
+ const P = g({
10
+ base: [
11
+ "uy:min-w-300 uy:h-300 uy:p-25 uy:flex uy:justify-center uy:items-center uy:typography-action uy:rounded-circle uy:transition-colors",
12
+ "uy:text-content-neutral-lowest uy:enabled:bg-transparent uy:cursor-pointer",
13
+ "uy:hover:text-content-neutral-hover uy:hover:bg-surface-neutral-hover",
14
+ "uy:active:text-content-neutral-pressed uy:active:bg-surface-neutral-pressed",
15
+ "uy:data-[pressed]:text-content-neutral-pressed uy:data-[pressed]:bg-surface-neutral-pressed",
16
+ "uy:data-[disabled]:text-content-neutral-disabled uy:data-[disabled]:bg-transparent uy:data-[disabled]:cursor-not-allowed",
17
+ "uy:focus-visible:outline-2 uy:focus-visible:outline-solid uy:focus-visible:outline-utility-focus-ring uy:focus-visible:outline-offset-2"
18
+ ]
19
+ }), D = m(({ isDisabled: a, href: n, onPress: i, ...s }, u) => {
20
+ const r = b(), {
21
+ onKeyDown: l,
22
+ currentPage: e,
23
+ onPageChange: c
24
+ } = x(), t = r.formatMessage({
25
+ id: "unity:component:common:previous",
26
+ defaultMessage: "Previous"
27
+ }), y = r.formatMessage(
28
+ {
29
+ id: "unity:component:pagination:nav-button:description",
30
+ defaultMessage: "Go to previous page"
31
+ },
32
+ {
33
+ variant: t
34
+ }
35
+ ), d = (f) => {
36
+ l(f);
37
+ }, p = () => {
38
+ !n && e > 1 && c(e - 1, e, -1);
39
+ };
40
+ return /* @__PURE__ */ o(w, { title: t, children: /* @__PURE__ */ o(
41
+ v,
42
+ {
43
+ ref: u,
44
+ href: n,
45
+ className: P(),
46
+ isDisabled: a,
47
+ onPress: i ?? p,
48
+ "aria-label": t,
49
+ "aria-description": y,
50
+ onKeyDown: d,
51
+ ...s,
52
+ children: /* @__PURE__ */ o(
53
+ h,
54
+ {
55
+ src: "CaretLeftOutlined",
56
+ size: 20,
57
+ color: "inherit",
58
+ role: "presentation"
59
+ }
60
+ )
61
+ }
62
+ ) });
63
+ });
64
+ D.displayName = "RawPaginationPrevious";
65
+ export {
66
+ D as RawPaginationPrevious
67
+ };
@@ -1,33 +1,42 @@
1
- function o(e, i) {
2
- return Array.from({ length: i - e + 1 }, (t, h) => h + e).map(
3
- (t) => ({
1
+ function y(s, l) {
2
+ return Array.from({ length: l - s + 1 }, (p, t) => t + s).map(
3
+ (p) => ({
4
4
  type: "page",
5
- value: t
5
+ value: p
6
6
  })
7
7
  );
8
8
  }
9
9
  const n = 5;
10
- function a(e, i, t) {
11
- const h = Math.max(
10
+ function d(s, l, p) {
11
+ const t = Math.max(
12
12
  n,
13
- t
14
- ), p = h - 2;
15
- if (e <= h)
16
- return Array.from({ length: e }, (y, f) => ({
13
+ p % 2 === 0 ? p + 1 : p
14
+ ), h = t - 2;
15
+ if (s === -1) {
16
+ const e = [];
17
+ e.push({ type: "page", value: 1 });
18
+ const o = h - 1, u = Math.floor(o / 2);
19
+ return l <= 3 + u ? (e.push(...y(2, t - 1)), e.push({ type: "ellipsis", value: [t, 1 / 0] })) : (e.push({ type: "ellipsis", value: [2, l - u] }), e.push(...y(l - u + 1, l + u)), e.push({
20
+ type: "ellipsis",
21
+ value: [l + u + 1, 1 / 0]
22
+ })), e;
23
+ }
24
+ if (s <= t)
25
+ return Array.from({ length: s }, (e, o) => ({
17
26
  type: "page",
18
- value: f + 1
27
+ value: o + 1
19
28
  }));
20
- const s = [];
21
- s.push({ type: "page", value: 1 });
22
- const u = p - 2, l = Math.floor(u / 2);
23
- return i <= 3 + l ? (s.push(...o(2, p)), s.push({ type: "ellipsis", value: [p + 1, e - 1] })) : i >= e - (2 + l) ? (s.push({
29
+ const i = [];
30
+ i.push({ type: "page", value: 1 });
31
+ const v = h - 2, f = Math.floor(v / 2);
32
+ return l <= 3 + f ? (i.push(...y(2, h)), i.push({ type: "ellipsis", value: [h + 1, s - 1] })) : l >= s - (2 + f) ? (i.push({
24
33
  type: "ellipsis",
25
- value: [2, e - (p - 1) - 1]
26
- }), s.push(...o(e - (p - 1), e - 1))) : (s.push({ type: "ellipsis", value: [2, i - l - 1] }), s.push(...o(i - l, i + l)), s.push({
34
+ value: [2, s - (h - 1) - 1]
35
+ }), i.push(...y(s - (h - 1), s - 1))) : (i.push({ type: "ellipsis", value: [2, l - f - 1] }), i.push(...y(l - f, l + f)), i.push({
27
36
  type: "ellipsis",
28
- value: [i + l + 1, e - 1]
29
- })), s.push({ type: "page", value: e }), s;
37
+ value: [l + f + 1, s - 1]
38
+ })), i.push({ type: "page", value: s }), i;
30
39
  }
31
40
  export {
32
- a as generatePaginationWithWindow
41
+ d as generatePaginationWithWindow
33
42
  };
@@ -1,78 +1,96 @@
1
- import { jsxs as p, jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as P, useState as j } from "react";
3
- import { uyTv as B } from "@payfit/unity-themes";
4
- import { useFilter as F, Select as K, Popover as O, Autocomplete as A, ListBox as i } from "react-aria-components";
5
- import { SearchInput as I } from "./parts/SearchInput.js";
6
- import { SelectButton as L } from "./parts/SelectButton.js";
7
- const T = B({
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import { forwardRef as j, useState as B } from "react";
3
+ import { uyTv as C } from "@payfit/unity-themes";
4
+ import { useFilter as F, Select as z, Popover as A, Autocomplete as I, Virtualizer as p, ListLayout as d, ListBox as y } from "react-aria-components";
5
+ import { SearchInput as T } from "./parts/SearchInput.js";
6
+ import { SelectButton as U } from "./parts/SelectButton.js";
7
+ const V = C({
8
8
  slots: {
9
9
  base: "uy:flex uy:flex-col uy:gap-100 uy:w-full",
10
10
  popover: "uy:rounded-75 uy:border uy:border-solid uy:border-border-neutral uy:w-[var(--trigger-width)] uy:bg-surface-neutral",
11
- listbox: "uy:overflow-y-auto uy:max-h-[296px] uy:pt-100 uy:pb-100 uy:pl-100 uy:pr-100"
11
+ listbox: "uy:overflow-y-auto uy:max-h-[296px] uy:pt-100 uy:pb-100"
12
12
  }
13
- }), U = ({
13
+ }), $ = ({
14
14
  children: t,
15
15
  items: o,
16
16
  placeholder: r,
17
- name: d,
17
+ name: f,
18
18
  isDisabled: l,
19
19
  isInvalid: s,
20
- isReadOnly: c,
21
- value: n,
22
- defaultValue: y,
23
- onChange: u,
24
- isSearchable: f = !1,
25
- onBlur: m,
20
+ isReadOnly: n,
21
+ value: i,
22
+ defaultValue: m,
23
+ onChange: a,
24
+ isSearchable: b = !1,
25
+ onBlur: x,
26
26
  placement: S,
27
- ...b
28
- }, x) => {
29
- const [v, h] = j(!1), { contains: g } = F({ sensitivity: "base" }), { base: w, popover: N, listbox: a } = T(), C = n !== void 0 || u !== void 0 ? {
30
- selectedKey: n,
31
- onSelectionChange: u
32
- } : { defaultSelectedKey: y };
33
- return /* @__PURE__ */ p(
34
- K,
27
+ ...h
28
+ }, v) => {
29
+ const [g, w] = B(!1), { contains: N } = F({ sensitivity: "base" }), { base: O, popover: L, listbox: u } = V(), P = i !== void 0 || a !== void 0 ? {
30
+ value: i,
31
+ onChange: a
32
+ } : { defaultValue: m };
33
+ return /* @__PURE__ */ c(
34
+ z,
35
35
  {
36
- onOpenChange: h,
37
- ...b,
38
- ref: x,
39
- className: w(),
40
- name: d,
36
+ onOpenChange: w,
37
+ ...h,
38
+ ref: v,
39
+ className: O(),
40
+ name: f,
41
41
  placeholder: l ? void 0 : r,
42
- isDisabled: l || c,
42
+ isDisabled: l || n,
43
43
  isInvalid: s,
44
- onBlur: m,
45
- ...C,
44
+ onBlur: x,
45
+ ...P,
46
46
  children: [
47
47
  /* @__PURE__ */ e(
48
- L,
48
+ U,
49
49
  {
50
50
  isDisabled: l,
51
51
  isInvalid: s,
52
- isReadOnly: c,
53
- isOpen: v
52
+ isReadOnly: n,
53
+ isOpen: g
54
54
  }
55
55
  ),
56
56
  /* @__PURE__ */ e(
57
- O,
57
+ A,
58
58
  {
59
59
  offset: 1,
60
60
  containerPadding: 8,
61
- className: N(),
61
+ className: L(),
62
62
  placement: S,
63
- children: f ? /* @__PURE__ */ p(A, { filter: g, children: [
64
- /* @__PURE__ */ e(I, {}),
65
- /* @__PURE__ */ e(i, { items: o, className: a(), children: t })
66
- ] }) : /* @__PURE__ */ e(i, { items: o, className: a(), children: t })
63
+ children: b ? /* @__PURE__ */ c(I, { filter: N, children: [
64
+ /* @__PURE__ */ e(T, {}),
65
+ /* @__PURE__ */ e(
66
+ p,
67
+ {
68
+ layout: d,
69
+ layoutOptions: {
70
+ padding: 8
71
+ },
72
+ children: /* @__PURE__ */ e(y, { items: o, className: u(), children: t })
73
+ }
74
+ )
75
+ ] }) : /* @__PURE__ */ e(
76
+ p,
77
+ {
78
+ layout: d,
79
+ layoutOptions: {
80
+ padding: 8
81
+ },
82
+ children: /* @__PURE__ */ e(y, { items: o, className: u(), children: t })
83
+ }
84
+ )
67
85
  }
68
86
  )
69
87
  ]
70
88
  }
71
89
  );
72
- }, $ = P(function(o, r) {
73
- return U(o, r);
90
+ }, k = j(function(o, r) {
91
+ return $(o, r);
74
92
  });
75
- $.displayName = "Select";
93
+ k.displayName = "Select";
76
94
  export {
77
- $ as Select
95
+ k as Select
78
96
  };
@@ -1,11 +1,11 @@
1
- import { jsx as e, jsxs as d, Fragment as i } from "react/jsx-runtime";
2
- import { forwardRef as y } from "react";
1
+ import { jsx as e, jsxs as y, Fragment as i } from "react/jsx-runtime";
2
+ import { forwardRef as d } from "react";
3
3
  import { uyTv as f } from "@payfit/unity-themes";
4
- import { ListBoxItem as m } from "react-aria-components";
5
- import { Icon as p } from "../../icon/Icon.js";
4
+ import { ListBoxItem as p } from "react-aria-components";
5
+ import { Icon as m } from "../../icon/Icon.js";
6
6
  import { SelectOptionProvider as b } from "./SelectOption.context.js";
7
7
  const x = f({
8
- base: "uy:flex uy:flex-col uy:typography-body uy:rounded-50 uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:outline-none",
8
+ base: "uy:flex uy:flex-col uy:typography-body uy:rounded-50 uy:pt-100 uy:pb-100 uy:pl-150 uy:pr-150 uy:outline-none uy:cursor-pointer",
9
9
  variants: {
10
10
  isFocusVisible: {
11
11
  true: "uy:outline-offset-2 uy:outline-2 uy:outline-solid uy:outline-utility-focus-ring"
@@ -33,11 +33,11 @@ const x = f({
33
33
  class: "uy:bg-surface-neutral-enabled uy:text-content-neutral-enabled"
34
34
  }
35
35
  ]
36
- }), v = y(
36
+ }), v = d(
37
37
  (s, l) => {
38
38
  const { children: u, isDisabled: r, textValue: n } = s;
39
39
  return /* @__PURE__ */ e(
40
- m,
40
+ p,
41
41
  {
42
42
  ...s,
43
43
  ref: l,
@@ -50,9 +50,9 @@ const x = f({
50
50
  isSelected: c,
51
51
  isDisabled: r
52
52
  }),
53
- children: ({ isSelected: t }) => /* @__PURE__ */ e(b, { isDisabled: r, children: t ? /* @__PURE__ */ d("div", { className: "uy:flex uy:justify-between", children: [
53
+ children: ({ isSelected: t }) => /* @__PURE__ */ e(b, { isDisabled: r, children: t ? /* @__PURE__ */ y("div", { className: "uy:flex uy:justify-between", children: [
54
54
  /* @__PURE__ */ e("div", { className: "uy:flex uy:flex-col", children: /* @__PURE__ */ e(i, { children: u }) }),
55
- /* @__PURE__ */ e(p, { src: "CheckOutlined" })
55
+ /* @__PURE__ */ e(m, { src: "CheckOutlined" })
56
56
  ] }) : /* @__PURE__ */ e(i, { children: u }) })
57
57
  }
58
58
  );
@@ -3,7 +3,7 @@ import { forwardRef as l, useId as p } from "react";
3
3
  import { uyTv as f } from "@payfit/unity-themes";
4
4
  import { Link as m } from "react-aria-components";
5
5
  import { FormattedMessage as b } from "react-intl";
6
- import { link as k } from "../link/Link.variants.js";
6
+ import { link as k } from "../link/RawLink.js";
7
7
  const h = f({
8
8
  slots: {
9
9
  base: [
@@ -13,6 +13,7 @@ export interface TableRootProps extends PropsWithChildren {
13
13
  * @component
14
14
  * The `TableRoot` component serves as the container for the table and its pagination controls.
15
15
  * It provides styling and layout for the table, including min and max height constraints.
16
+ * The pagination remains fixed while the table content can scroll horizontally if needed.
16
17
  * @param {TableRootProps} props - The props for the `TableRoot` component
17
18
  * @param {number} [props.minRows=10] - The minimum number of rows to display, affecting the minimum height
18
19
  * @param {number} [props.maxRows=50] - The maximum number of rows to display, affecting the maximum height
@@ -1,5 +1,5 @@
1
- import { jsx as d, jsxs as x } from "react/jsx-runtime";
2
- import n, { forwardRef as C, useRef as N, useMemo as T, useImperativeHandle as z, useCallback as k } from "react";
1
+ import { jsx as f, jsxs as x } from "react/jsx-runtime";
2
+ import i, { forwardRef as T, useRef as N, useMemo as C, useImperativeHandle as z, useCallback as k } from "react";
3
3
  import { uyTv as R } from "@payfit/unity-themes";
4
4
  import { useResizeObserver as S } from "usehooks-ts";
5
5
  import { TableContextProvider as V, useTableContext as D } from "./Table.context.js";
@@ -8,23 +8,22 @@ const K = R({
8
8
  "uy:w-full uy:border uy:border-solid uy:border-border-neutral uy:rounded-100",
9
9
  "uy:relative uy:flex uy:flex-col",
10
10
  "uy:min-h-[var(--uy-table-min-rows)] uy:max-h-[var(--uy-table-max-rows)]",
11
- "uy:overflow-y-auto",
12
- // Handle vertical scrolling
13
- "uy:overflow-x-auto"
14
- // Handle horizontal scrolling too
11
+ "uy:overflow-y-auto"
12
+ // Handle vertical scrolling only
13
+ // Remove horizontal overflow - pagination should not scroll horizontally
15
14
  ]
16
- }), U = C(
17
- ({ minRows: i = 10, maxRows: s = 50, children: t }, o) => /* @__PURE__ */ d(
15
+ }), U = T(
16
+ ({ minRows: s = 10, maxRows: u = 50, children: o }, l) => /* @__PURE__ */ f(
18
17
  "div",
19
18
  {
20
- ref: o,
19
+ ref: l,
21
20
  className: K(),
22
21
  "data-unity-slot": "table-root",
23
22
  style: {
24
- "--uy-table-min-rows": `calc(var(--uy-spacing-600) * ${i})`,
25
- "--uy-table-max-rows": `calc(var(--uy-spacing-600) * ${s})`
23
+ "--uy-table-min-rows": `calc(var(--uy-spacing-600) * ${s})`,
24
+ "--uy-table-max-rows": `calc(var(--uy-spacing-600) * ${u})`
26
25
  },
27
- children: t
26
+ children: o
28
27
  }
29
28
  )
30
29
  );
@@ -33,8 +32,9 @@ const $ = R({
33
32
  slots: {
34
33
  wrapper: [
35
34
  "uy:flex-1 uy:bg-surface-neutral",
36
- "uy:w-full"
37
- // No overflow handling - parent TableRoot handles all scrolling
35
+ "uy:w-full",
36
+ // Handle horizontal scrolling in the wrapper, independent of pagination
37
+ "uy:overflow-x-auto"
38
38
  ],
39
39
  table: [
40
40
  "uy:min-w-full",
@@ -45,10 +45,12 @@ const $ = R({
45
45
  variants: {
46
46
  horizontalScroll: {
47
47
  true: {
48
- // Only apply horizontal scroll to the table itself, not wrapper
48
+ // Enable horizontal scrolling and allow table to exceed container width
49
49
  table: "uy:w-max"
50
50
  },
51
51
  false: {
52
+ // Disable horizontal scrolling
53
+ wrapper: "uy:overflow-x-hidden",
52
54
  table: "uy:w-fit"
53
55
  }
54
56
  }
@@ -56,85 +58,92 @@ const $ = R({
56
58
  defaultVariants: {
57
59
  horizontalScroll: !0
58
60
  }
59
- }), P = C((i, s) => {
61
+ }), P = T((s, u) => {
60
62
  const {
61
- children: t,
62
- label: o,
63
+ children: o,
64
+ label: l,
63
65
  description: m,
64
66
  isHorizontalScrollEnabled: g = !0,
65
67
  ...c
66
- } = i, u = N(null), { height: f = 0 } = S({
67
- ref: u,
68
+ } = s, y = N(null), { height: h = 0 } = S({
69
+ ref: y,
68
70
  box: "border-box"
69
- }), { rowCount: h, columnCount: p } = T(() => {
70
- let e = 0, l = 0;
71
- return n.Children.forEach(t, (w) => {
72
- if (!n.isValidElement(w)) return;
73
- const a = n.Children.toArray(
74
- w.props.children
75
- ).filter((r) => n.isValidElement(r));
76
- l += a.length, a.forEach((r) => {
77
- if (!n.isValidElement(r)) return;
78
- const v = n.Children.toArray(
79
- r.props.children
80
- ).filter((y) => n.isValidElement(y));
81
- e = Math.max(e, v.length);
71
+ }), { rowCount: p, columnCount: w } = C(() => {
72
+ let t = 0, r = 0;
73
+ return i.Children.forEach(o, (e) => {
74
+ if (!i.isValidElement(e)) return;
75
+ const a = i.Children.toArray(
76
+ e.props.children
77
+ ).filter((n) => i.isValidElement(n));
78
+ r += a.length, a.forEach((n) => {
79
+ if (!i.isValidElement(n)) return;
80
+ const v = i.Children.toArray(
81
+ n.props.children
82
+ ).filter((d) => i.isValidElement(d));
83
+ t = Math.max(t, v.length);
82
84
  });
83
- }), { rowCount: l, columnCount: e };
84
- }, [t]);
85
- return z(s, () => ({
85
+ }), { rowCount: r, columnCount: t };
86
+ }, [o]);
87
+ return z(u, () => ({
86
88
  scrollToTop: () => {
87
- const e = u.current, l = e?.closest(
89
+ const t = y.current, r = t?.closest(
88
90
  '[data-unity-slot="table-root"]'
89
91
  );
90
- l ? l.scrollTo({ top: 0, behavior: "smooth" }) : e && e.scrollTo({ top: 0, behavior: "smooth" });
92
+ let e;
93
+ if (r ? e = r : t && (e = t), !!e) {
94
+ if (typeof e.scrollTo == "function") {
95
+ e.scrollTo({ top: 0, behavior: "smooth" });
96
+ return;
97
+ }
98
+ e.scrollTop = 0;
99
+ }
91
100
  }
92
- })), /* @__PURE__ */ d(V, { rowCount: h, columnCount: p, children: /* @__PURE__ */ d(
101
+ })), /* @__PURE__ */ f(V, { rowCount: p, columnCount: w, children: /* @__PURE__ */ f(
93
102
  E,
94
103
  {
95
- scrollContainerRef: u,
96
- containerHeight: f,
97
- rowCount: h,
98
- columnCount: p,
99
- label: o,
104
+ scrollContainerRef: y,
105
+ containerHeight: h,
106
+ rowCount: p,
107
+ columnCount: w,
108
+ label: l,
100
109
  description: m,
101
110
  isHorizontalScrollEnabled: g,
102
111
  ...c,
103
- children: t
112
+ children: o
104
113
  }
105
114
  ) });
106
115
  });
107
116
  P.displayName = "Table";
108
- const E = (i) => {
117
+ const E = (s) => {
109
118
  const {
110
- children: s,
111
- label: t,
112
- description: o,
119
+ children: u,
120
+ label: o,
121
+ description: l,
113
122
  scrollContainerRef: m,
114
123
  containerHeight: g,
115
124
  rowCount: c,
116
- columnCount: u,
117
- onKeyDown: f,
118
- isHorizontalScrollEnabled: h = !0,
119
- ...p
120
- } = i, { wrapper: e, table: l } = $({
121
- horizontalScroll: h
122
- }), { keyboardNavigation: w } = D(), { tableRef: a, handleTableKeyDown: r } = w, v = k(
125
+ columnCount: y,
126
+ onKeyDown: h,
127
+ isHorizontalScrollEnabled: p = !0,
128
+ ...w
129
+ } = s, { wrapper: t, table: r } = $({
130
+ horizontalScroll: p
131
+ }), { keyboardNavigation: e } = D(), { tableRef: a, handleTableKeyDown: n } = e, v = k(
123
132
  (b) => {
124
- b.key !== "Tab" && (r(b), f?.(b));
133
+ b.key !== "Tab" && (n(b), h?.(b));
125
134
  },
126
- [r, f]
127
- ), y = m.current?.closest(
135
+ [n, h]
136
+ ), d = m.current?.closest(
128
137
  '[data-unity-slot="table-root"]'
129
- ), H = T(() => {
130
- if (!y || c === 0) return !1;
131
- const b = y.clientHeight;
138
+ ), H = C(() => {
139
+ if (!d || c === 0) return !1;
140
+ const b = d.clientHeight;
132
141
  return (a.current?.clientHeight ?? 0) / b < 0.9;
133
- }, [y, c]);
142
+ }, [d, c]);
134
143
  return /* @__PURE__ */ x(
135
144
  "div",
136
145
  {
137
- className: e(),
146
+ className: t(),
138
147
  ref: m,
139
148
  style: {
140
149
  "--uy-table-has-remaining-space": H ? "1" : "0"
@@ -144,28 +153,28 @@ const E = (i) => {
144
153
  "table",
145
154
  {
146
155
  ref: a,
147
- className: l(),
156
+ className: r(),
148
157
  role: "grid",
149
158
  "aria-rowcount": c,
150
- "aria-colcount": u,
151
- "aria-label": t,
152
- "aria-describedby": o ? `table-desc-${a.current?.id}` : void 0,
159
+ "aria-colcount": y,
160
+ "aria-label": o,
161
+ "aria-describedby": l ? `table-desc-${a.current?.id}` : void 0,
153
162
  onKeyDown: v,
154
- ...p,
163
+ ...w,
155
164
  children: [
156
- s,
157
- o && /* @__PURE__ */ d(
165
+ u,
166
+ l && /* @__PURE__ */ f(
158
167
  "caption",
159
168
  {
160
169
  id: `table-desc-${a.current?.id}`,
161
170
  className: "uy:sr-only",
162
- children: o
171
+ children: l
163
172
  }
164
173
  )
165
174
  ]
166
175
  }
167
176
  ),
168
- /* @__PURE__ */ d("div", { className: "uy:sr-only", "aria-live": "polite", children: "Table navigation: Use arrow keys to move between cells. Tab key exits the table. Home and End keys navigate to the first and last cell in a row. Page Up and Page Down move between rows." })
177
+ /* @__PURE__ */ f("div", { className: "uy:sr-only", "aria-live": "polite", children: "Table navigation: Use arrow keys to move between cells. Tab key exits the table. Home and End keys navigate to the first and last cell in a row. Page Up and Page Down move between rows." })
169
178
  ]
170
179
  }
171
180
  );
@@ -126,7 +126,7 @@ function O() {
126
126
  [l]
127
127
  ), x = i(
128
128
  (e) => {
129
- if (e.key === "Tab" || !a.current) return;
129
+ if (e.key === "RawTab" || !a.current) return;
130
130
  let t = e.currentTarget;
131
131
  const s = e.target;
132
132
  if (s !== t) {
@@ -173,19 +173,19 @@ function O() {
173
173
  break;
174
174
  case "PageUp":
175
175
  e.preventDefault();
176
- const f = Math.max(0, r - 5), p = n[f];
177
- if (!p) break;
178
- const R = Array.from(p.querySelectorAll("td, th")), E = Math.min(u, R.length - 1);
176
+ const f = Math.max(0, r - 5), w = n[f];
177
+ if (!w) break;
178
+ const R = Array.from(w.querySelectorAll("td, th")), E = Math.min(u, R.length - 1);
179
179
  l(f, E);
180
180
  break;
181
181
  case "PageDown":
182
182
  e.preventDefault();
183
- const w = Math.min(n.length - 1, r + 5), C = n[w];
183
+ const p = Math.min(n.length - 1, r + 5), C = n[p];
184
184
  if (!C) break;
185
185
  const T = Array.from(
186
186
  C.querySelectorAll("td, th")
187
187
  ), F = Math.min(u, T.length - 1);
188
- l(w, F);
188
+ l(p, F);
189
189
  break;
190
190
  }
191
191
  },