@payfit/unity-components 2.29.6 → 2.29.8

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.
@@ -1,41 +1,71 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useLocation as f, useNavigate as p, useChildMatches as I } from "@tanstack/react-router";
3
- import { RouterProvider as v } from "react-aria-components";
4
- import { Tabs as R } from "../../../../components/tabs/Tabs.js";
5
- function S({
6
- children: a,
7
- selectedKey: u,
8
- onSelectionChange: c,
9
- routeMatch: d = "fuzzy",
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { Children as I, isValidElement as R } from "react";
3
+ import { useLocation as b, useNavigate as v, useRouter as K, useChildMatches as C } from "@tanstack/react-router";
4
+ import { RouterProvider as N } from "react-aria-components";
5
+ import { Tabs as T } from "../../../../components/tabs/Tabs.js";
6
+ function j(t) {
7
+ return typeof t == "object" && t !== null;
8
+ }
9
+ function x(t) {
10
+ return typeof t == "string" || typeof t == "number";
11
+ }
12
+ function h(t, c, a) {
13
+ let o;
14
+ return I.forEach(t, (s) => {
15
+ if (o || !R(s)) return;
16
+ const e = s.props;
17
+ if (j(e)) {
18
+ if ("search" in e && ("to" in e || "href" in e))
19
+ try {
20
+ const u = c.buildLocation(e);
21
+ if (u.href === a) {
22
+ o = x(e.id) ? e.id : u.href;
23
+ return;
24
+ }
25
+ } catch {
26
+ }
27
+ "children" in e && (o = h(
28
+ e.children,
29
+ c,
30
+ a
31
+ ));
32
+ }
33
+ }), o;
34
+ }
35
+ function $({
36
+ children: t,
37
+ selectedKey: c,
38
+ onSelectionChange: a,
39
+ routeMatch: o = "fuzzy",
10
40
  ...s
11
41
  }) {
12
- const g = f(), l = p(), r = I({
13
- select: (e) => {
14
- if (e.length !== 0)
15
- return d === "exact" ? e.reduce((t, o) => {
16
- const n = String(t.routeId);
17
- return String(o.routeId).length > n.length ? o : t;
18
- }) : e.reduce((t, o) => {
19
- const n = String(t.routeId);
20
- return String(o.routeId).length < n.length ? o : t;
42
+ const e = b(), u = v(), p = K(), f = C({
43
+ select: (n) => {
44
+ if (n.length !== 0)
45
+ return o === "exact" ? n.reduce((r, i) => {
46
+ const d = String(r.routeId);
47
+ return String(i.routeId).length > d.length ? i : r;
48
+ }) : n.reduce((r, i) => {
49
+ const d = String(r.routeId);
50
+ return String(i.routeId).length < d.length ? i : r;
21
51
  });
22
52
  }
23
- }), h = u ?? (r ? r.pathname : void 0) ?? g.pathname;
24
- return /* @__PURE__ */ i(v, { navigate: (e) => {
25
- l({ to: e });
26
- }, children: /* @__PURE__ */ i(
27
- R,
53
+ }), g = `${e.pathname}${e.searchStr}`, m = typeof t == "function" ? void 0 : h(t, p, g), y = (f ? f.pathname : void 0) ?? e.pathname;
54
+ return /* @__PURE__ */ l(N, { navigate: (n) => {
55
+ u({ href: n });
56
+ }, children: /* @__PURE__ */ l(
57
+ T,
28
58
  {
29
59
  ...s,
30
- selectedKey: h,
31
- onSelectionChange: (e) => {
32
- c?.(e);
60
+ selectedKey: c ?? m ?? y,
61
+ onSelectionChange: (n) => {
62
+ a?.(n);
33
63
  },
34
- children: a
64
+ children: t
35
65
  }
36
66
  ) });
37
67
  }
38
- S.displayName = "Tabs";
68
+ $.displayName = "Tabs";
39
69
  export {
40
- S as Tabs
70
+ $ as Tabs
41
71
  };
@@ -1,23 +1,23 @@
1
- import { createElement as s } from "react";
2
- import { useLinkProps as a, createLink as f } from "@tanstack/react-router";
1
+ import { createElement as c } from "react";
2
+ import { useLinkProps as p, createLink as f } from "@tanstack/react-router";
3
3
  import { RawTab as m } from "../../../../../components/tabs/parts/RawTab.js";
4
- const p = f(m);
5
- function c(e) {
6
- const { suffixElement: t, id: i, ...o } = e, n = a(o), r = i ?? n.href ?? o.to;
4
+ const l = f(m);
5
+ function h(e) {
6
+ const { suffixElement: s, id: i, ...o } = e, t = p(o).href, n = t ? t.split("?")[0] : void 0, a = "search" in o ? t : n, r = i ?? a ?? o.to;
7
7
  return (
8
8
  // @ts-expect-error - Complex type intersection between router props and component props
9
- /* @__PURE__ */ s(
10
- p,
9
+ /* @__PURE__ */ c(
10
+ l,
11
11
  {
12
12
  ...o,
13
13
  key: r,
14
- suffix: t,
14
+ suffix: s,
15
15
  id: r
16
16
  }
17
17
  )
18
18
  );
19
19
  }
20
- c.displayName = "Tab";
20
+ h.displayName = "Tab";
21
21
  export {
22
- c as Tab
22
+ h as Tab
23
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payfit/unity-components",
3
- "version": "2.29.6",
3
+ "version": "2.29.8",
4
4
  "module": "./dist/esm/index.js",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -42,7 +42,7 @@
42
42
  "@hookform/devtools": "4.4.0",
43
43
  "@hookform/resolvers": "5.2.1",
44
44
  "@internationalized/date": "3.12.1",
45
- "@payfit/unity-illustrations": "2.29.6",
45
+ "@payfit/unity-illustrations": "2.29.8",
46
46
  "@radix-ui/react-avatar": "1.1.11",
47
47
  "@radix-ui/react-slot": "1.2.4",
48
48
  "@react-aria/interactions": "3.28.0",
@@ -74,8 +74,8 @@
74
74
  },
75
75
  "peerDependencies": {
76
76
  "@hookform/devtools": "^4",
77
- "@payfit/unity-icons": "2.29.6",
78
- "@payfit/unity-themes": "2.29.6",
77
+ "@payfit/unity-icons": "2.29.8",
78
+ "@payfit/unity-themes": "2.29.8",
79
79
  "@storybook/react-vite": "^10.3.2",
80
80
  "@tanstack/react-query": "^5",
81
81
  "@tanstack/react-router": "^1.131",
@@ -89,9 +89,9 @@
89
89
  "@figma/code-connect": "1.4.3",
90
90
  "@hookform/devtools": "4.4.0",
91
91
  "@internationalized/date": "3.12.1",
92
- "@payfit/unity-icons": "2.29.6",
93
- "@payfit/unity-illustrations": "2.29.6",
94
- "@payfit/unity-themes": "2.29.6",
92
+ "@payfit/unity-icons": "2.29.8",
93
+ "@payfit/unity-illustrations": "2.29.8",
94
+ "@payfit/unity-themes": "2.29.8",
95
95
  "@storybook/addon-a11y": "10.3.5",
96
96
  "@storybook/addon-designs": "11.1.3",
97
97
  "@storybook/addon-docs": "10.3.5",