@gearbox-protocol/ui-kit 4.2.1 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/base/details-view/details-view.cjs +1 -1
- package/dist/cjs/components/base/details-view/index.cjs +1 -1
- package/dist/cjs/components/base/index.cjs +1 -1
- package/dist/cjs/components/base/manage-pane/manage-pane.cjs +1 -1
- package/dist/cjs/components/base/tabber/tabber.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/base/details-view/details-view.js +40 -56
- package/dist/esm/components/base/details-view/index.js +8 -7
- package/dist/esm/components/base/index.js +127 -126
- package/dist/esm/components/base/manage-pane/manage-pane.js +89 -85
- package/dist/esm/components/base/tabber/tabber.js +85 -95
- package/dist/esm/components/index.js +413 -412
- package/dist/esm/index.js +459 -458
- package/dist/globals.css +1 -1
- package/dist/types/components/base/details-view/details-view.d.ts +6 -5
- package/dist/types/components/base/tabber/tabber.d.ts +1 -8
- package/package.json +1 -1
- package/dist/cjs/components/base/tabber/is-tabber.cjs +0 -1
- package/dist/esm/components/base/tabber/is-tabber.js +0 -8
- package/dist/types/components/base/tabber/is-tabber.d.ts +0 -6
|
@@ -1,136 +1,126 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { SectionHeading as
|
|
4
|
-
import { Stack as
|
|
5
|
-
import { useTitleText as
|
|
6
|
-
import { TabControl as
|
|
7
|
-
import { TabItem as
|
|
8
|
-
import { TabberTest as
|
|
9
|
-
import { useDetailScrollSpy as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
id:
|
|
13
|
-
title:
|
|
14
|
-
heading:
|
|
15
|
-
actions:
|
|
16
|
-
children:
|
|
17
|
-
hideHeading:
|
|
1
|
+
import { jsx as o, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as y, useContext as R, useMemo as b, Children as j, useRef as h, useEffect as I, isValidElement as H } from "react";
|
|
3
|
+
import { SectionHeading as O } from "../section-heading/section-heading.js";
|
|
4
|
+
import { Stack as x } from "../stack/stack.js";
|
|
5
|
+
import { useTitleText as w } from "../text/use-title-text.js";
|
|
6
|
+
import { TabControl as A } from "../../tab-control/tab-control.js";
|
|
7
|
+
import { TabItem as B } from "../../tab-control/tab-item.js";
|
|
8
|
+
import { TabberTest as T } from "./constants.js";
|
|
9
|
+
import { useDetailScrollSpy as E } from "./use-detail-scroll-spy.js";
|
|
10
|
+
const v = y({});
|
|
11
|
+
function k({
|
|
12
|
+
id: e,
|
|
13
|
+
title: r,
|
|
14
|
+
heading: c = r,
|
|
15
|
+
actions: a,
|
|
16
|
+
children: l,
|
|
17
|
+
hideHeading: s = !1
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
20
|
-
return /* @__PURE__ */
|
|
19
|
+
const n = R(v), d = w(), i = !s;
|
|
20
|
+
return /* @__PURE__ */ o(
|
|
21
21
|
"section",
|
|
22
22
|
{
|
|
23
|
-
ref:
|
|
23
|
+
ref: n[e],
|
|
24
24
|
className: "scroll-mt-28",
|
|
25
|
-
"data-scroll-section":
|
|
26
|
-
"data-testid":
|
|
27
|
-
children: /* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
"data-scroll-section": e,
|
|
26
|
+
"data-testid": T.section,
|
|
27
|
+
children: /* @__PURE__ */ u(x, { gap: "md", children: [
|
|
28
|
+
i || a ? /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-3", children: [
|
|
29
|
+
i ? /* @__PURE__ */ o(O, { children: d(c) }) : /* @__PURE__ */ o("span", {}),
|
|
30
|
+
a
|
|
31
31
|
] }) : null,
|
|
32
|
-
|
|
32
|
+
l
|
|
33
33
|
] })
|
|
34
34
|
}
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
return
|
|
37
|
+
k.displayName = "TabberSection";
|
|
38
|
+
function q(e) {
|
|
39
|
+
return H(e) && e.type === k;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
item:
|
|
43
|
-
...
|
|
41
|
+
function z({
|
|
42
|
+
item: e,
|
|
43
|
+
...r
|
|
44
44
|
}) {
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
45
|
+
return /* @__PURE__ */ u("div", { className: "flex items-stretch overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:h-0 [scrollbar-width:none]", children: [
|
|
46
|
+
/* @__PURE__ */ o("div", { className: "min-w-0 basis-0 grow pb-px", children: /* @__PURE__ */ o(A, { ...r, showBorder: !0 }) }),
|
|
47
|
+
e && /* @__PURE__ */ o("div", { className: "w-auto shrink-0 grow-0 basis-auto", children: e })
|
|
48
48
|
] });
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
children:
|
|
52
|
-
observeKey:
|
|
53
|
-
initialSection:
|
|
54
|
-
testId:
|
|
55
|
-
mobileManagePane: m
|
|
50
|
+
function U({
|
|
51
|
+
children: e,
|
|
52
|
+
observeKey: r,
|
|
53
|
+
initialSection: c,
|
|
54
|
+
testId: a
|
|
56
55
|
}) {
|
|
57
|
-
const
|
|
58
|
-
() =>
|
|
59
|
-
[
|
|
60
|
-
), l =
|
|
61
|
-
() =>
|
|
62
|
-
[
|
|
63
|
-
),
|
|
64
|
-
() => i === "" ? [] : i.split("|"),
|
|
65
|
-
[i]
|
|
66
|
-
), w = g({}), d = f(() => {
|
|
56
|
+
const l = b(
|
|
57
|
+
() => j.toArray(e).filter(q),
|
|
58
|
+
[e]
|
|
59
|
+
), s = l.map((t) => t.props.id).join("|"), n = b(
|
|
60
|
+
() => s === "" ? [] : s.split("|"),
|
|
61
|
+
[s]
|
|
62
|
+
), d = h({}), i = b(() => {
|
|
67
63
|
const t = {
|
|
68
|
-
...
|
|
64
|
+
...d.current
|
|
69
65
|
};
|
|
70
|
-
for (const
|
|
71
|
-
t[
|
|
72
|
-
return
|
|
73
|
-
}, [n]),
|
|
74
|
-
|
|
66
|
+
for (const S of n)
|
|
67
|
+
t[S] === void 0 && (t[S] = { current: null });
|
|
68
|
+
return d.current = t, t;
|
|
69
|
+
}, [n]), C = w(), { activeSection: m, scrollToSection: f } = E(
|
|
70
|
+
i,
|
|
75
71
|
n,
|
|
76
|
-
|
|
77
|
-
),
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
const t =
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
r
|
|
73
|
+
), p = h(!1), g = h(r);
|
|
74
|
+
I(() => {
|
|
75
|
+
if (r !== g.current && (g.current = r, p.current = !1), p.current || !r) return;
|
|
76
|
+
const t = c ?? n[0];
|
|
77
|
+
p.current = !0, !(t === void 0 || t === n[0]) && i[t] !== void 0 && requestAnimationFrame(() => {
|
|
78
|
+
f(t);
|
|
83
79
|
});
|
|
84
|
-
}, [
|
|
85
|
-
const
|
|
80
|
+
}, [r, c, f, n, i]);
|
|
81
|
+
const N = l.map((t) => ({
|
|
86
82
|
id: t.props.id,
|
|
87
|
-
item: /* @__PURE__ */
|
|
88
|
-
|
|
83
|
+
item: /* @__PURE__ */ o(
|
|
84
|
+
B,
|
|
89
85
|
{
|
|
90
|
-
selected:
|
|
91
|
-
label:
|
|
86
|
+
selected: m === t.props.id,
|
|
87
|
+
label: C(t.props.title)
|
|
92
88
|
}
|
|
93
89
|
)
|
|
94
|
-
}))
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
);
|
|
99
|
-
return /* @__PURE__ */ e(u, { gap: "lg", "data-testid": c ?? S.root, children: /* @__PURE__ */ p(R.Provider, { value: d, children: [
|
|
100
|
-
k.length > 0 ? /* @__PURE__ */ e(u, { gap: "xl", children: k }) : null,
|
|
101
|
-
m,
|
|
102
|
-
/* @__PURE__ */ e(W, { testId: S.bar, children: /* @__PURE__ */ e(
|
|
103
|
-
V,
|
|
90
|
+
}));
|
|
91
|
+
return /* @__PURE__ */ o(x, { gap: "lg", "data-testid": a ?? T.root, children: /* @__PURE__ */ u(v.Provider, { value: i, children: [
|
|
92
|
+
/* @__PURE__ */ o(D, { testId: T.bar, children: /* @__PURE__ */ o(
|
|
93
|
+
z,
|
|
104
94
|
{
|
|
105
95
|
state: {
|
|
106
|
-
id:
|
|
107
|
-
index: n.indexOf(
|
|
96
|
+
id: m,
|
|
97
|
+
index: n.indexOf(m),
|
|
108
98
|
handleTabChange: (t) => {
|
|
109
|
-
|
|
99
|
+
f(t);
|
|
110
100
|
}
|
|
111
101
|
},
|
|
112
|
-
tabs:
|
|
102
|
+
tabs: N,
|
|
113
103
|
item: null
|
|
114
104
|
}
|
|
115
105
|
) }),
|
|
116
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ o(x, { gap: "xl", children: e })
|
|
117
107
|
] }) });
|
|
118
108
|
}
|
|
119
|
-
function
|
|
120
|
-
children:
|
|
121
|
-
testId:
|
|
109
|
+
function D({
|
|
110
|
+
children: e,
|
|
111
|
+
testId: r
|
|
122
112
|
}) {
|
|
123
|
-
return /* @__PURE__ */
|
|
113
|
+
return /* @__PURE__ */ o(
|
|
124
114
|
"div",
|
|
125
115
|
{
|
|
126
116
|
className: "sticky top-0 z-20 -mx-1 px-1 pt-3 sm:pt-4 bg-background/75 backdrop-blur-md backdrop-saturate-150",
|
|
127
|
-
"data-testid":
|
|
128
|
-
children:
|
|
117
|
+
"data-testid": r,
|
|
118
|
+
children: e
|
|
129
119
|
}
|
|
130
120
|
);
|
|
131
121
|
}
|
|
132
122
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
123
|
+
U as Tabber,
|
|
124
|
+
k as TabberSection,
|
|
125
|
+
T as TabberTest
|
|
136
126
|
};
|