@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,17 +1,17 @@
1
1
  import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
- import P, { forwardRef as T, useCallback as j, isValidElement as z } from "react";
3
- import { uyTv as D } from "@payfit/unity-themes";
4
- import { Toolbar as R, Group as y } from "react-aria-components";
2
+ import P, { forwardRef as T, useCallback as R, isValidElement as j } from "react";
3
+ import { uyTv as z } from "@payfit/unity-themes";
4
+ import { Toolbar as D, Group as y } from "react-aria-components";
5
5
  import { useIntl as S, FormattedMessage as l } from "react-intl";
6
6
  import { Button as _ } from "../button/Button.js";
7
7
  import { IconButton as E } from "../icon-button/IconButton.js";
8
8
  import { Icon as F } from "../icon/Icon.js";
9
9
  import { Menu as G } from "../menu/Menu.js";
10
10
  import { MenuContent as K } from "../menu/parts/MenuContent.js";
11
- import { MenuItem as L } from "../menu/parts/MenuItem.js";
12
- import { MenuTrigger as O } from "../menu/parts/MenuTrigger.js";
11
+ import { MenuTrigger as L } from "../menu/parts/MenuTrigger.js";
12
+ import { RawMenuItem as O } from "../menu/parts/RawMenuItem.js";
13
13
  import { ActionBarAction as U } from "./parts/ActionBarAction.js";
14
- const V = D({
14
+ const V = z({
15
15
  slots: {
16
16
  base: [
17
17
  "uy:bg-surface-inverted uy:text-content-inverted",
@@ -46,14 +46,14 @@ const V = D({
46
46
  const { base: g, selectionArea: x, selectionCountText: A, actionArea: M } = V(), m = S(), s = a !== void 0 && typeof r == "function", k = i["aria-keyshortcuts"] !== void 0, B = p ?? m.formatMessage({
47
47
  id: "unity:component:action-bar:toolbar-label",
48
48
  defaultMessage: "Bulk actions toolbar"
49
- }), I = j(() => {
49
+ }), I = R(() => {
50
50
  if (s) {
51
51
  const e = r;
52
52
  return a.map((o, N) => e(o, N));
53
53
  }
54
54
  return r;
55
- }, [r, a, s]), C = !!r || "actions" in i && i.actions.length > 0, w = s ? a.filter((e) => e.variant !== "primary") : P.Children.map(r, (e) => {
56
- if (!z(e) || e.type !== U)
55
+ }, [r, a, s]), w = !!r || "actions" in i && i.actions.length > 0, C = s ? a.filter((e) => e.variant !== "primary") : P.Children.map(r, (e) => {
56
+ if (!j(e) || e.type !== U)
57
57
  return null;
58
58
  const o = e.props;
59
59
  return o.variant === "primary" ? null : {
@@ -66,7 +66,7 @@ const V = D({
66
66
  };
67
67
  })?.filter(Boolean);
68
68
  return /* @__PURE__ */ n(
69
- R,
69
+ D,
70
70
  {
71
71
  ...i,
72
72
  id: d,
@@ -126,7 +126,7 @@ const V = D({
126
126
  ]
127
127
  }
128
128
  ),
129
- C && /* @__PURE__ */ n(
129
+ w && /* @__PURE__ */ n(
130
130
  y,
131
131
  {
132
132
  className: M(),
@@ -135,7 +135,7 @@ const V = D({
135
135
  children: [
136
136
  I(),
137
137
  /* @__PURE__ */ t("div", { className: "uy:block uy:md:hidden", children: /* @__PURE__ */ n(G, { children: [
138
- /* @__PURE__ */ t(O, { asChild: !0, children: /* @__PURE__ */ t(
138
+ /* @__PURE__ */ t(L, { asChild: !0, children: /* @__PURE__ */ t(
139
139
  E,
140
140
  {
141
141
  icon: "DotsThreeOutlined",
@@ -144,8 +144,8 @@ const V = D({
144
144
  color: "inverted"
145
145
  }
146
146
  ) }),
147
- /* @__PURE__ */ t(K, { children: w.map((e) => /* @__PURE__ */ t(
148
- L,
147
+ /* @__PURE__ */ t(K, { children: C.map((e) => /* @__PURE__ */ t(
148
+ O,
149
149
  {
150
150
  onAction: () => {
151
151
  e.onPress?.({});
@@ -1,10 +1,10 @@
1
- import { jsx as C } from "react/jsx-runtime";
2
- import { forwardRef as H, useState as k } from "react";
3
- import { uyTv as F } from "@payfit/unity-themes";
4
- import { useFocusVisible as E, useHover as x, useFocus as N } from "@react-aria/interactions";
5
- import { useObjectRef as S, mergeProps as p } from "@react-aria/utils";
6
- import { useButton as U } from "react-aria";
7
- const V = F({
1
+ import { jsx as H } from "react/jsx-runtime";
2
+ import { forwardRef as k, useState as F, useMemo as E } from "react";
3
+ import { uyTv as N } from "@payfit/unity-themes";
4
+ import { useFocusVisible as x, useHover as S, useFocus as U } from "@react-aria/interactions";
5
+ import { useObjectRef as V, mergeProps as f } from "@react-aria/utils";
6
+ import { useButton as j } from "react-aria";
7
+ const w = N({
8
8
  base: "uy:group",
9
9
  variants: {
10
10
  isUnstyled: {
@@ -19,45 +19,48 @@ const V = F({
19
19
  defaultVariants: {
20
20
  isUnstyled: !1
21
21
  }
22
- }), j = H((f, e) => {
22
+ }), A = k((v, e) => {
23
23
  const {
24
24
  asElement: l = "div",
25
- isUnstyled: m = !1,
26
- className: v,
25
+ isUnstyled: d = !1,
26
+ className: c,
27
27
  children: o,
28
28
  ...s
29
- } = f;
30
- e = S(e);
31
- const { isFocusVisible: i } = E(), { isHovered: a, hoverProps: d } = x({
29
+ } = v;
30
+ e = V(e);
31
+ const { isFocusVisible: i } = x(), { isHovered: a, hoverProps: u } = S({
32
32
  onHoverStart: s.onHoverStart,
33
33
  onHoverEnd: s.onHoverEnd,
34
34
  onHoverChange: s.onHoverChange,
35
35
  isDisabled: s.isDisabled
36
- }), [t, D] = k(!1), { focusProps: c } = N({
36
+ }), [t, D] = F(!1), { focusProps: b } = U({
37
37
  onFocusChange: D,
38
38
  isDisabled: s.isDisabled
39
- }), { buttonProps: u, isPressed: r } = U(
39
+ }), { buttonProps: m, isPressed: n } = j(
40
40
  {
41
41
  ...s,
42
42
  isDisabled: s.isDisabled,
43
43
  elementType: l
44
44
  },
45
45
  e
46
- ), y = l, g = (n) => {
46
+ ), y = E(
47
+ () => w({ isUnstyled: d, className: c }),
48
+ [c, d]
49
+ ), g = l, C = (r) => {
47
50
  if (s.isDisabled) {
48
- n.preventDefault(), n.stopPropagation();
51
+ r.preventDefault(), r.stopPropagation();
49
52
  return;
50
53
  }
51
- const b = p(u, d, c);
52
- b.onClick && b.onClick(n);
53
- }, P = p(u, d, c), { onClick: w, ...h } = P;
54
- return /* @__PURE__ */ C(
55
- y,
54
+ const p = f(m, u, b);
55
+ p.onClick && p.onClick(r);
56
+ }, P = f(m, u, b), { onClick: M, ...h } = P;
57
+ return /* @__PURE__ */ H(
58
+ g,
56
59
  {
57
60
  ...h,
58
- onClick: g,
59
- className: V({ isUnstyled: m, className: v }),
60
- ...r && { "data-pressed": r },
61
+ onClick: C,
62
+ className: y,
63
+ ...n && { "data-pressed": n },
61
64
  ...t && { "data-focused": t },
62
65
  ...a && { "data-hovered": a },
63
66
  ...s.isDisabled && { "data-disabled": s.isDisabled },
@@ -65,7 +68,7 @@ const V = F({
65
68
  ref: e,
66
69
  children: typeof o == "function" ? o({
67
70
  isHovered: a,
68
- isPressed: r,
71
+ isPressed: n,
69
72
  isFocused: t,
70
73
  isDisabled: !!s.isDisabled,
71
74
  isFocusVisible: i,
@@ -75,7 +78,7 @@ const V = F({
75
78
  }
76
79
  );
77
80
  });
78
- j.displayName = "Actionable";
81
+ A.displayName = "Actionable";
79
82
  export {
80
- j as Actionable
83
+ A as Actionable
81
84
  };
@@ -37,36 +37,36 @@ const w = x({
37
37
  }
38
38
  });
39
39
  function R({
40
- children: y,
41
- menu: l,
42
- header: a,
40
+ children: l,
41
+ menu: a,
42
+ header: r,
43
43
  footer: u,
44
- withoutContentPadding: n = !1
44
+ withoutContentPadding: p = !1
45
45
  }) {
46
- const r = v(null), { height: o = 0 } = g({
47
- ref: r,
46
+ const o = v(null), { height: y = 0 } = g({
47
+ ref: o,
48
48
  box: "border-box"
49
- }), { body: p, header: s, menu: d, layoutWrapper: i, contentWrapper: c, content: f, footer: h } = w({
50
- withoutContentPadding: n
49
+ }), { body: s, header: n, menu: d, layoutWrapper: i, contentWrapper: c, content: f, footer: h } = w({
50
+ withoutContentPadding: p
51
51
  }), m = {
52
- "--uy-app-layout-menu-height": `calc(100dvh - ${o}px)`,
53
- "--uy-app-layout-header-sticky-offset": `${o}px`
52
+ "--uy-app-layout-menu-height": `calc(100dvh - ${y}px)`,
53
+ "--uy-app-layout-header-sticky-offset": `${y}px`
54
54
  };
55
- return /* @__PURE__ */ t("div", { className: p(), style: m, children: [
56
- a && /* @__PURE__ */ e(
55
+ return /* @__PURE__ */ t("div", { className: s(), style: m, children: [
56
+ r && /* @__PURE__ */ e(
57
57
  "div",
58
58
  {
59
- ref: r,
60
- className: s(),
59
+ ref: o,
60
+ className: n(),
61
61
  role: "alert",
62
62
  "aria-live": "assertive",
63
- children: a
63
+ children: r
64
64
  }
65
65
  ),
66
66
  /* @__PURE__ */ t("div", { className: i(), children: [
67
- /* @__PURE__ */ e("div", { className: d(), children: l }),
67
+ a && /* @__PURE__ */ e("div", { className: d(), children: a }),
68
68
  /* @__PURE__ */ t("div", { className: c(), children: [
69
- /* @__PURE__ */ e("div", { className: f(), children: y }),
69
+ /* @__PURE__ */ e("div", { className: f(), children: l }),
70
70
  u && /* @__PURE__ */ e("footer", { className: h(), children: u })
71
71
  ] })
72
72
  ] })
@@ -1,9 +1,91 @@
1
1
  import { ReactNode } from 'react';
2
- export interface AppMenuHeader {
2
+ export interface AppMenuHeaderProps {
3
+ /**
4
+ * The application environment. Determines which brand logo variant to display.
5
+ */
3
6
  environment: 'production' | 'working' | 'testing' | 'development' | 'local';
4
- linkHref: string;
5
- linkLabel: string;
7
+ /**
8
+ * Accessible label for the brand logo link.
9
+ */
10
+ brandLabel: string;
11
+ /**
12
+ * Optional notification component to display in the header.
13
+ */
6
14
  notificationsComponent?: ReactNode;
15
+ /**
16
+ * Optional search component to display in the header.
17
+ */
7
18
  searchComponent?: ReactNode;
19
+ /**
20
+ * Render function for the brand logo link. Enables integration with any routing library.
21
+ * Provides href and children (the logo component) for flexible link implementation.
22
+ * Defaults to React Aria's Link component, which works with Unity's RouterProvider for router-agnostic behavior.
23
+ * @example
24
+ * ```tsx
25
+ * // With Tanstack Router
26
+ * import { Link } from '@tanstack/react-router'
27
+ *
28
+ * <AppMenuHeader
29
+ * renderLink={({ href, children }) => (
30
+ * <Link to={href}>{children}</Link>
31
+ * )}
32
+ * />
33
+ *
34
+ * // With React Router v5/v6
35
+ * import { Link } from 'react-router-dom'
36
+ *
37
+ * <AppMenuHeader
38
+ * renderLink={({ href, children }) => (
39
+ * <Link to={href}>{children}</Link>
40
+ * )}
41
+ * />
42
+ *
43
+ * // With plain HTML link
44
+ * <AppMenuHeader
45
+ * renderLink={({ href, children }) => (
46
+ * <a href={href}>{children}</a>
47
+ * )}
48
+ * />
49
+ * ```
50
+ */
51
+ renderLink?: (props: {
52
+ children: ReactNode;
53
+ }) => ReactNode;
8
54
  }
9
- export declare const AppMenuHeader: ({ environment, linkHref, linkLabel, notificationsComponent, searchComponent, }: AppMenuHeader) => import("react/jsx-runtime").JSX.Element;
55
+ /**
56
+ * The header section of the AppMenu component, displaying the PayFit brand logo, search, and notifications.
57
+ * Provides a router-agnostic approach through a render prop pattern for the brand logo link.
58
+ * @param props - Component props
59
+ * @param props.environment - The application environment (determines brand logo variant)
60
+ * @param props.brandLabel - Accessible label for the brand logo link
61
+ * @param props.notificationsComponent - Optional notification component to display
62
+ * @param props.searchComponent - Optional search component to display
63
+ * @param props.renderLink - Optional render function for custom link implementation
64
+ * @example
65
+ * ```tsx
66
+ * import { AppMenuHeader } from '@payfit/unity-components'
67
+ *
68
+ * function AppShell() {
69
+ * return (
70
+ * <AppMenu>
71
+ * <AppMenuHeader
72
+ * environment="production"
73
+ * linkHref="/"
74
+ * linkLabel="PayFit Home"
75
+ * />
76
+ * </AppMenu>
77
+ * )
78
+ * }
79
+ * ```
80
+ * @remarks
81
+ * - The brand logo automatically adapts based on the environment prop (production displays standard logo, others display pre-production variants)
82
+ * - By default, uses React Aria's Link component which integrates with Unity's RouterProvider
83
+ * - For router-specific implementations, pass a custom `renderLink` function with your router's Link component
84
+ * - On mobile viewports, displays a menu toggle button; on desktop, displays the brand logo with optional search and notifications
85
+ * @see {@link AppMenuHeaderProps} for all available props
86
+ * @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/app-menu GitHub}
87
+ * @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
88
+ * @see Design docs in {@link https://www.payfit.design/ Payfit.design}
89
+ * @see Developer docs in {@link https://unity-components.payfit.io/?path=/ unity-components.payfit.io}
90
+ */
91
+ export declare const AppMenuHeader: ({ environment, brandLabel: linkLabel, notificationsComponent, searchComponent, renderLink, }: AppMenuHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,41 +1,41 @@
1
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
- import { useIntl as p } from "react-intl";
3
- import { Link as m } from "react-router-dom";
4
- import { IconButton as s } from "../../icon-button/IconButton.js";
5
- import { PayFitBrand as c } from "../../payfit-brand/PayFitBrand.js";
6
- import { PayFitBrandPreprod as y } from "../../payfit-brand/PayFitPreprod.js";
7
- import { useAppMenuContext as f } from "./AppMenu.context.js";
8
- const N = ({
1
+ import { jsxs as a, jsx as n } from "react/jsx-runtime";
2
+ import { Link as m } from "react-aria-components";
3
+ import { useIntl as s } from "react-intl";
4
+ import { IconButton as c } from "../../icon-button/IconButton.js";
5
+ import { PayFitBrand as y } from "../../payfit-brand/PayFitBrand.js";
6
+ import { PayFitBrandPreprod as f } from "../../payfit-brand/PayFitPreprod.js";
7
+ import { useAppMenuContext as h } from "./AppMenu.context.js";
8
+ const O = ({
9
9
  environment: o,
10
- linkHref: a,
11
- linkLabel: t,
12
- notificationsComponent: r,
13
- searchComponent: l
10
+ brandLabel: t,
11
+ notificationsComponent: i,
12
+ searchComponent: r,
13
+ renderLink: l = ({ children: e }) => /* @__PURE__ */ n(m, { href: "/", children: e })
14
14
  }) => {
15
- const { isMobileMenuOpen: n, toggleMobileMenu: u } = f(), d = p();
16
- return /* @__PURE__ */ i("header", { className: "uy:flex uy:flex-col uy:gap-y-200 uy:pl-25 uy:pr-25", children: [
17
- /* @__PURE__ */ e("div", { className: "uy:block uy:md:hidden", children: /* @__PURE__ */ e(
18
- s,
15
+ const { isMobileMenuOpen: e, toggleMobileMenu: u } = h(), d = s(), p = o === "production" ? /* @__PURE__ */ n(y, { label: t, width: 104 }) : /* @__PURE__ */ n(f, { label: t, env: o });
16
+ return /* @__PURE__ */ a("header", { className: "uy:flex uy:flex-col uy:gap-y-200 uy:pl-25 uy:pr-25", children: [
17
+ /* @__PURE__ */ n("div", { className: "uy:block uy:md:hidden", children: /* @__PURE__ */ n(
18
+ c,
19
19
  {
20
20
  variant: "ghost",
21
21
  color: "neutral",
22
- icon: n ? "CloseOutlined" : "ListOutlined",
22
+ icon: e ? "CloseOutlined" : "ListOutlined",
23
23
  label: d.formatMessage({
24
- id: n ? "unity:component:app-menu:header:menu-close" : "unity:component:app-menu:header:menu-open",
25
- defaultMessage: n ? "Close navigation" : "Open navigation"
24
+ id: e ? "unity:component:app-menu:header:menu-close" : "unity:component:app-menu:header:menu-open",
25
+ defaultMessage: e ? "Close navigation" : "Open navigation"
26
26
  }),
27
27
  onClick: u,
28
- "aria-expanded": n,
28
+ "aria-expanded": e,
29
29
  "aria-controls": "app-menu-nav-container app-menu-profile-button"
30
30
  }
31
31
  ) }),
32
- /* @__PURE__ */ i("div", { className: "uy:hidden uy:justify-between uy:items-center uy:md:flex", children: [
33
- /* @__PURE__ */ e(m, { to: a, children: o === "production" ? /* @__PURE__ */ e(c, { label: t, width: 104 }) : /* @__PURE__ */ e(y, { label: t, env: o }) }),
34
- r
32
+ /* @__PURE__ */ a("div", { className: "uy:hidden uy:justify-between uy:items-center uy:md:flex", children: [
33
+ l({ children: p }),
34
+ i
35
35
  ] }),
36
- /* @__PURE__ */ e("div", { className: "uy:hidden uy:md:flex", children: l })
36
+ /* @__PURE__ */ n("div", { className: "uy:hidden uy:md:flex", children: r })
37
37
  ] });
38
38
  };
39
39
  export {
40
- N as AppMenuHeader
40
+ O as AppMenuHeader
41
41
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
- import { createContext as i, useContext as u } from "react";
3
- const e = i({
2
+ import { useContext as i, createContext as u } from "react";
3
+ const e = u({
4
4
  wrap: "wrap",
5
5
  isMobile: !1,
6
6
  isStaticApi: !1
@@ -14,7 +14,7 @@ function m({
14
14
  return /* @__PURE__ */ s(e.Provider, { value: { wrap: t, isMobile: o, isStaticApi: n }, children: r });
15
15
  }
16
16
  function d() {
17
- const r = u(e);
17
+ const r = i(e);
18
18
  if (!r)
19
19
  throw new Error(
20
20
  "useBreadcrumbsContext must be used within an BreadcrumbsProvider"
@@ -1,33 +1,41 @@
1
1
  import { VariantProps } from '@payfit/unity-themes';
2
- import { ReactNode } from 'react';
2
+ import { ComponentPropsWithoutRef, ReactElement, ReactNode, Ref } from 'react';
3
3
  import { AriaBreadcrumbsProps as AriaAriaBreadcrumbsProps } from 'react-aria';
4
4
  import { BreadcrumbsProps as AriaBreadcrumbsProps } from 'react-aria-components';
5
- import { BreadcrumbProps } from './parts/Breadcrumb.js';
5
+ import { Breadcrumb } from './parts/Breadcrumb.js';
6
6
  import { breadcrumbsVariant } from './Breadcrumbs.variant.js';
7
- export interface BreadcrumbsProps extends AriaAriaBreadcrumbsProps, Pick<AriaBreadcrumbsProps<BreadcrumbsProps>, 'onAction'> {
7
+ export interface BreadcrumbsProps extends AriaAriaBreadcrumbsProps, Pick<AriaBreadcrumbsProps<never>, 'onAction'> {
8
8
  items?: never;
9
9
  /**
10
- * The breadcrumb list to render (static api)
10
+ * The breadcrumb list to render (static API)
11
11
  */
12
12
  children: ReactNode;
13
13
  /**
14
- * If the breadcrumbs should wrap or not
14
+ * Whether the breadcrumbs should wrap or not
15
15
  */
16
16
  wrap: VariantProps<typeof breadcrumbsVariant>['wrap'];
17
17
  }
18
- export interface BreadcrumbsWithItemProps extends AriaAriaBreadcrumbsProps, VariantProps<typeof breadcrumbsVariant>, Pick<AriaBreadcrumbsProps<BreadcrumbsProps>, 'onAction'> {
18
+ export interface BreadcrumbsWithItemProps<TItem extends {
19
+ label: string;
20
+ }> extends AriaAriaBreadcrumbsProps, VariantProps<typeof breadcrumbsVariant>, Pick<AriaBreadcrumbsProps<TItem>, 'onAction'> {
19
21
  /**
20
22
  * The list of items to render, when using the dynamic API.
21
23
  */
22
- items: BreadcrumbProps[];
24
+ items: TItem[];
23
25
  /**
24
- * The function renderer to render each part of the breadcrumbs (dynamic api)
26
+ * The render function for each breadcrumb item (dynamic API)
25
27
  */
26
- children: (item: BreadcrumbProps) => ReactNode;
28
+ children: (item: TItem) => ReactElement<ComponentPropsWithoutRef<typeof Breadcrumb>>;
27
29
  /**
28
- * If the breadcrumbs should wrap or not
30
+ * Whether the breadcrumbs should wrap or not
29
31
  */
30
32
  wrap: VariantProps<typeof breadcrumbsVariant>['wrap'];
31
33
  }
32
- declare const Breadcrumbs: import('react').ForwardRefExoticComponent<(BreadcrumbsProps | BreadcrumbsWithItemProps) & import('react').RefAttributes<HTMLOListElement>>;
34
+ declare const Breadcrumbs: (<TItem extends {
35
+ label: string;
36
+ }>(props: (BreadcrumbsProps | BreadcrumbsWithItemProps<TItem>) & {
37
+ ref?: Ref<HTMLOListElement>;
38
+ }) => ReactNode) & {
39
+ displayName: string;
40
+ };
33
41
  export { Breadcrumbs };
@@ -1,30 +1,41 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as m, Fragment as d } from "react";
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as d, Fragment as m } from "react";
3
3
  import { Breadcrumbs as p } from "react-aria-components";
4
4
  import { useBreakpointListener as u } from "../../hooks/use-breakpoint-listener.js";
5
- import { BreadcrumbsProvider as f } from "./Breadcrumbs.context.js";
6
- import { breadcrumbsVariant as l } from "./Breadcrumbs.variant.js";
7
- const b = (o, r, t) => o ? r.length === 0 ? null : t(r.at(r.length === 1 ? 0 : -2)) : r.map((a) => /* @__PURE__ */ e(d, { children: t(a) }, `${a.label}${a.href}`)), w = m(({ items: o, children: r, wrap: t = "nowrap", ...a }, i) => {
8
- const { base: c } = l({ wrap: t }), n = u(), s = n === "xs" || n === "sm";
9
- return /* @__PURE__ */ e(
10
- f,
5
+ import { BreadcrumbsProvider as l } from "./Breadcrumbs.context.js";
6
+ import { breadcrumbsVariant as f } from "./Breadcrumbs.variant.js";
7
+ const b = (a, o, n) => a ? o.length === 0 ? null : n(o.at(o.length === 1 ? 0 : -2)) : o.map((r, t) => {
8
+ const e = "id" in r && r.id && typeof r.id == "string" ? r.id : `${r.label}-${t}`;
9
+ return /* @__PURE__ */ s(m, { children: n(r) }, e);
10
+ });
11
+ function B({
12
+ items: a,
13
+ children: o,
14
+ wrap: n = "nowrap",
15
+ ...r
16
+ }, t) {
17
+ const { base: e } = f({ wrap: n }), i = u(), c = i === "xs" || i === "sm";
18
+ return /* @__PURE__ */ s(
19
+ l,
11
20
  {
12
- wrap: t,
13
- isMobile: s,
14
- isStaticApi: o === void 0,
15
- children: /* @__PURE__ */ e(
21
+ wrap: n,
22
+ isMobile: c,
23
+ isStaticApi: a === void 0,
24
+ children: /* @__PURE__ */ s(
16
25
  p,
17
26
  {
18
27
  "data-dd-privacy": "allow",
19
- ref: i,
20
- className: c(),
21
- ...a,
22
- children: o ? b(s, o, r) : r
28
+ ref: t,
29
+ className: e(),
30
+ ...r,
31
+ children: a ? b(c, a, o) : o
23
32
  }
24
33
  )
25
34
  }
26
35
  );
27
- });
36
+ }
37
+ const y = d(B);
38
+ y.displayName = "Breadcrumbs";
28
39
  export {
29
- w as Breadcrumbs
40
+ y as Breadcrumbs
30
41
  };
@@ -1,9 +1,34 @@
1
+ import { ComponentPropsWithoutRef, ReactElement } from 'react';
1
2
  import { BreadcrumbProps as AriaBreadcrumbProps } from 'react-aria-components';
2
- export interface BreadcrumbProps extends Omit<AriaBreadcrumbProps, 'children'> {
3
- /** The link of the breadcrumb */
4
- href: string;
5
- /** The text of the breadcrumb */
6
- label: string;
3
+ import { RawBreadcrumbLinkProps } from './RawBreadcrumbLink.js';
4
+ export interface BreadcrumbProps extends Omit<AriaBreadcrumbProps, 'children' | 'className' | 'style'> {
5
+ /**
6
+ * A single BreadcrumbLink child element
7
+ */
8
+ children: ReactElement<ComponentPropsWithoutRef<'a'> & RawBreadcrumbLinkProps>;
7
9
  }
10
+ /**
11
+ * A semantic wrapper component for breadcrumb items that displays navigation hierarchy.
12
+ * Accepts exactly one BreadcrumbLink as a child to maintain design system consistency.
13
+ * @param props - Breadcrumb props including the BreadcrumbLink child
14
+ * @example
15
+ * ```tsx
16
+ * import { Breadcrumb, BreadcrumbLink } from '@payfit/unity-components'
17
+ *
18
+ * function Example() {
19
+ * return (
20
+ * <Breadcrumb>
21
+ * <BreadcrumbLink href="/dashboard">Dashboard</BreadcrumbLink>
22
+ * </Breadcrumb>
23
+ * )
24
+ * }
25
+ * ```
26
+ * @remarks
27
+ * - Only accepts a single BreadcrumbLink component as a child
28
+ * - Automatically handles current page styling (disabled state)
29
+ * - Displays caret icons as separators between breadcrumb items
30
+ * - On mobile, displays a back arrow for the previous breadcrumb
31
+ * @see {@link BreadcrumbProps} for all available props
32
+ */
8
33
  declare const Breadcrumb: import('react').ForwardRefExoticComponent<BreadcrumbProps & import('react').RefAttributes<HTMLLIElement>>;
9
34
  export { Breadcrumb };
@@ -1,33 +1,41 @@
1
- import { jsxs as i, jsx as r, Fragment as h } from "react/jsx-runtime";
2
- import { forwardRef as x } from "react";
3
- import { Breadcrumb as s } from "react-aria-components";
4
- import { Icon as m } from "../../icon/Icon.js";
5
- import { Link as u } from "../../link/Link.js";
6
- import { Tooltip as g } from "../../tooltip/Tooltip.js";
7
- import { useBreadcrumbsContext as w } from "../Breadcrumbs.context.js";
8
- import { breadcrumbsVariant as B } from "../Breadcrumbs.variant.js";
9
- const C = 25, l = ({ children: t, href: e }) => t.length > C ? /* @__PURE__ */ r(g, { title: t, children: /* @__PURE__ */ r(u, { isExact: !0, href: e, color: "secondary", maxCharactersTruncation: 25, children: t }) }) : /* @__PURE__ */ r(u, { isExact: !0, href: e, color: "secondary", maxCharactersTruncation: 25, children: t }), R = x(
10
- (t, e) => {
11
- const { wrap: d, isMobile: f, isStaticApi: p } = w(), { breadcrumb: o } = B({ wrap: d });
12
- if (!t)
13
- return null;
14
- const { href: n, label: a, ...c } = t;
15
- return f && !p ? /* @__PURE__ */ i(s, { ref: e, ...c, className: o(), children: [
16
- /* @__PURE__ */ r(m, { src: "CaretLeftOutlined", "aria-hidden": "true" }),
17
- /* @__PURE__ */ r(l, { href: n, children: a })
18
- ] }) : /* @__PURE__ */ r(s, { ref: e, ...c, className: o(), children: ({ isCurrent: b }) => b ? /* @__PURE__ */ r("span", { className: "uy:text-nowrap uy:text-content-neutral-lowest", children: a }) : /* @__PURE__ */ i(h, { children: [
19
- /* @__PURE__ */ r(l, { href: n, children: a }),
20
- /* @__PURE__ */ r(
21
- m,
1
+ import { jsxs as i, jsx as e, Fragment as p } from "react/jsx-runtime";
2
+ import { forwardRef as b } from "react";
3
+ import { Breadcrumb as n } from "react-aria-components";
4
+ import { Icon as s } from "../../icon/Icon.js";
5
+ import { useBreadcrumbsContext as f } from "../Breadcrumbs.context.js";
6
+ import { breadcrumbsVariant as h } from "../Breadcrumbs.variant.js";
7
+ const x = b(
8
+ ({ children: r, ...t }, a) => {
9
+ const { wrap: c, isMobile: m, isStaticApi: u } = f(), { breadcrumb: o } = h({ wrap: c });
10
+ return m && !u ? /* @__PURE__ */ i(n, { ref: a, ...t, className: o(), children: [
11
+ /* @__PURE__ */ e(s, { src: "CaretLeftOutlined", "aria-hidden": "true" }),
12
+ r
13
+ ] }) : /* @__PURE__ */ e(n, { ref: a, ...t, className: o(), children: ({ isCurrent: d }) => {
14
+ const l = typeof r.props.children == "string" ? r.props.children : "";
15
+ return d ? /* @__PURE__ */ e(
16
+ "span",
22
17
  {
23
- src: "CaretRightOutlined",
24
- "aria-hidden": "true",
25
- color: "content.neutral.lowest"
18
+ className: "uy:text-nowrap uy:text-content-neutral-lowest",
19
+ role: "link",
20
+ "aria-disabled": "true",
21
+ "aria-current": "page",
22
+ children: l
26
23
  }
27
- )
28
- ] }) });
24
+ ) : /* @__PURE__ */ i(p, { children: [
25
+ r,
26
+ /* @__PURE__ */ e(
27
+ s,
28
+ {
29
+ src: "CaretRightOutlined",
30
+ "aria-hidden": "true",
31
+ color: "content.neutral.lowest"
32
+ }
33
+ )
34
+ ] });
35
+ } });
29
36
  }
30
37
  );
38
+ x.displayName = "Breadcrumb";
31
39
  export {
32
- R as Breadcrumb
40
+ x as Breadcrumb
33
41
  };