@gearbox-protocol/ui-kit 4.0.0-next.15 → 4.0.0-next.17
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/index.cjs +1 -1
- package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
- package/dist/cjs/components/base/position-assets/constants.cjs +1 -0
- package/dist/cjs/components/base/position-assets/index.cjs +1 -0
- package/dist/cjs/components/base/position-assets/position-assets.cjs +1 -0
- package/dist/cjs/components/base/stat-badge/constants.cjs +1 -1
- package/dist/cjs/components/base/stat-badge/stat-badge.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/tabber/tabber.cjs +1 -1
- package/dist/cjs/components/base/values/scalars.cjs +1 -1
- package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/cjs/utils/strategy-apy.cjs +1 -0
- package/dist/esm/components/base/index.js +112 -108
- package/dist/esm/components/base/info-list/info-list.js +7 -6
- package/dist/esm/components/base/position-assets/constants.js +8 -0
- package/dist/esm/components/base/position-assets/index.js +6 -0
- package/dist/esm/components/base/position-assets/position-assets.js +73 -0
- package/dist/esm/components/base/stat-badge/constants.js +1 -0
- package/dist/esm/components/base/stat-badge/stat-badge.js +87 -52
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +130 -110
- package/dist/esm/components/base/tabber/tabber.js +67 -64
- package/dist/esm/components/base/values/scalars.js +52 -33
- package/dist/esm/components/checkbox/checkbox-labeled.js +1 -1
- package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +1 -1
- package/dist/esm/components/index.js +662 -658
- package/dist/esm/components/with-copy/with-copy.js +1 -1
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +20 -19
- package/dist/esm/index.js +858 -850
- package/dist/esm/locale/en.json.js +2 -1
- package/dist/esm/utils/index.js +64 -60
- package/dist/esm/utils/strategy-apy.js +41 -0
- package/dist/types/components/base/index.d.ts +1 -0
- package/dist/types/components/base/position-assets/constants.d.ts +5 -0
- package/dist/types/components/base/position-assets/index.d.ts +2 -0
- package/dist/types/components/base/position-assets/position-assets.d.ts +49 -0
- package/dist/types/components/base/stat-badge/constants.d.ts +1 -0
- package/dist/types/components/base/stat-badge/stat-badge.d.ts +11 -1
- package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +12 -0
- package/dist/types/components/base/tabber/tabber.d.ts +2 -2
- package/dist/types/components/base/values/scalars.d.ts +4 -0
- package/dist/types/locale/en.json.d.ts +2 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/strategy-apy.d.ts +37 -0
- package/package.json +1 -1
|
@@ -1,174 +1,194 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { PointsIcon as
|
|
3
|
-
import { TokenIcon as
|
|
4
|
-
import { FormattedMessageTyped as
|
|
1
|
+
import { jsxs as u, jsx as l, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import { PointsIcon as $ } from "../../points-icon/points-icon.js";
|
|
3
|
+
import { TokenIcon as q } from "../../token-icon/token-icon.js";
|
|
4
|
+
import { FormattedMessageTyped as d } from "../../typed-intl/index.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import { positiveTokenRewardsOf as
|
|
6
|
+
import { positiveTokenRewardsOf as F, pointProgramsOf as T, totalApyOf as R } from "../../../utils/apy-breakdown.js";
|
|
7
7
|
import "@gearbox-protocol/sdk";
|
|
8
|
-
import { bpsToPercent as
|
|
8
|
+
import { bpsToPercent as j } from "../../../utils/bps.js";
|
|
9
9
|
import { cn as w } from "../../../utils/cn.js";
|
|
10
10
|
import "sonner";
|
|
11
|
-
import { formatLeverage as
|
|
12
|
-
import { formatCompactPercent as
|
|
13
|
-
import {
|
|
11
|
+
import { formatLeverage as s } from "../../../utils/format-leverage.js";
|
|
12
|
+
import { formatCompactPercent as S } from "../../../utils/format-money.js";
|
|
13
|
+
import { strategyApyPartsAtLeverage as O } from "../../../utils/strategy-apy.js";
|
|
14
14
|
import "@gearbox-protocol/sdk/common-utils";
|
|
15
15
|
import "luxon";
|
|
16
16
|
import "../../../utils/z-index.js";
|
|
17
|
-
import { StrategyApyBreakdownCardTest as
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
if (Math.abs(
|
|
22
|
-
const
|
|
23
|
-
return
|
|
17
|
+
import { StrategyApyBreakdownCardTest as h } from "./constants.js";
|
|
18
|
+
const i = "—";
|
|
19
|
+
function a(e) {
|
|
20
|
+
const r = j(e);
|
|
21
|
+
if (Math.abs(r) >= 1e3) {
|
|
22
|
+
const p = S(Math.abs(r));
|
|
23
|
+
return r < 0 ? `−${p}` : p;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
return
|
|
25
|
+
const m = Math.abs(r).toFixed(2);
|
|
26
|
+
return r < 0 ? `−${m}%` : `${m}%`;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function z(e) {
|
|
29
|
+
return e == null || e <= 0 ? "bg-muted text-muted-foreground" : "bg-success/20 text-success";
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
base:
|
|
33
|
-
leverage:
|
|
31
|
+
function g({
|
|
32
|
+
base: e,
|
|
33
|
+
leverage: r
|
|
34
34
|
}) {
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
|
|
35
|
+
return /* @__PURE__ */ l(
|
|
36
|
+
d,
|
|
37
37
|
{
|
|
38
38
|
messageId: "components.strategyApyBreakdownCard.formula",
|
|
39
|
-
values: { base:
|
|
39
|
+
values: { base: e, leverage: r }
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
data:
|
|
45
|
-
leverage:
|
|
43
|
+
function oe({
|
|
44
|
+
data: e,
|
|
45
|
+
leverage: r
|
|
46
46
|
}) {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
const t = r ?? (e.maxLeverage != null && e.maxLeverage > 0 ? e.maxLeverage : void 0), m = t != null ? s(t) : i, p = e.collateralApy ? F(e.collateralApy) : [], k = e.collateralApy ? T(e.collateralApy) : [], n = t != null ? O({
|
|
48
|
+
leverage: t,
|
|
49
|
+
maxLeverage: e.maxLeverage,
|
|
50
|
+
borrowApy: e.borrowApy,
|
|
51
|
+
additionalBorrowApy: e.additionalBorrowApy
|
|
52
|
+
}) : void 0, y = e.collateralApy?.organicApy, b = y != null && t != null ? y * t : void 0, f = p.map(
|
|
53
|
+
(o) => o.supplyApr != null && t != null ? o.supplyApr * t : void 0
|
|
54
|
+
), N = e.borrowApy != null && n != null ? -n.borrowCost : void 0, L = e.additionalBorrowApy, x = L != null && L !== 0, B = x && n != null ? n.quotaRate : void 0, C = x && n != null ? -n.quotaCost : void 0, I = b != null && n != null && f.every((o) => o != null) ? b + f.reduce((o, c) => o + (c ?? 0), 0) - n.totalCost : void 0, P = t != null && e.maxLeverage != null && e.maxLeverage > 0 && Math.abs(t - e.maxLeverage) < 1e-9, A = e.netApy != null ? R(e.netApy) : P && e.maxLeverageApy != null ? R(e.maxLeverageApy) : I;
|
|
55
|
+
return /* @__PURE__ */ u(
|
|
51
56
|
"div",
|
|
52
57
|
{
|
|
53
58
|
className: "flex w-full min-w-0 flex-col gap-4 rounded-xl border border-border bg-card p-4",
|
|
54
|
-
"data-testid":
|
|
59
|
+
"data-testid": h.root,
|
|
55
60
|
children: [
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
61
|
+
/* @__PURE__ */ u("div", { className: "flex h-6 items-center justify-between gap-3", children: [
|
|
62
|
+
/* @__PURE__ */ l("span", { className: "text-base font-semibold leading-4 text-foreground", children: /* @__PURE__ */ l(
|
|
63
|
+
d,
|
|
59
64
|
{
|
|
60
65
|
messageId: "components.strategyApyBreakdownCard.titleAtLeverage",
|
|
61
|
-
values: { leverage:
|
|
66
|
+
values: { leverage: m }
|
|
62
67
|
}
|
|
63
68
|
) }),
|
|
64
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ l(
|
|
65
70
|
"span",
|
|
66
71
|
{
|
|
67
72
|
className: w(
|
|
68
73
|
"rounded-md px-2 py-0.5 text-sm font-semibold tabular-nums",
|
|
69
|
-
|
|
74
|
+
z(A)
|
|
70
75
|
),
|
|
71
|
-
"data-testid":
|
|
72
|
-
children:
|
|
76
|
+
"data-testid": h.net,
|
|
77
|
+
children: A == null ? i : a(A)
|
|
73
78
|
}
|
|
74
79
|
)
|
|
75
80
|
] }),
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
81
|
+
/* @__PURE__ */ u("div", { className: "flex flex-col gap-3", children: [
|
|
82
|
+
/* @__PURE__ */ l(
|
|
83
|
+
v,
|
|
79
84
|
{
|
|
80
|
-
label: /* @__PURE__ */
|
|
81
|
-
value:
|
|
82
|
-
subtext:
|
|
83
|
-
|
|
85
|
+
label: /* @__PURE__ */ l(d, { messageId: "components.strategyApyBreakdownCard.collateralApy" }),
|
|
86
|
+
value: b == null ? i : a(b),
|
|
87
|
+
subtext: y != null && t != null ? /* @__PURE__ */ l(
|
|
88
|
+
g,
|
|
84
89
|
{
|
|
85
|
-
base:
|
|
86
|
-
leverage:
|
|
90
|
+
base: a(y),
|
|
91
|
+
leverage: s(t)
|
|
87
92
|
}
|
|
88
93
|
) : void 0
|
|
89
94
|
}
|
|
90
95
|
),
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
p.map((o, c) => /* @__PURE__ */ l(
|
|
97
|
+
v,
|
|
93
98
|
{
|
|
94
|
-
label: /* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
|
|
99
|
+
label: /* @__PURE__ */ u("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
100
|
+
/* @__PURE__ */ l("span", { children: /* @__PURE__ */ l(
|
|
101
|
+
d,
|
|
97
102
|
{
|
|
98
103
|
messageId: "components.apyParts.extraAPY",
|
|
99
|
-
values: { symbol:
|
|
104
|
+
values: { symbol: o.token.symbol }
|
|
100
105
|
}
|
|
101
106
|
) }),
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
|
|
107
|
+
/* @__PURE__ */ l(
|
|
108
|
+
q,
|
|
104
109
|
{
|
|
105
|
-
token:
|
|
106
|
-
symbol:
|
|
110
|
+
token: o.token,
|
|
111
|
+
symbol: o.token.symbol,
|
|
107
112
|
size: 16,
|
|
108
113
|
className: "shrink-0"
|
|
109
114
|
}
|
|
110
115
|
)
|
|
111
116
|
] }),
|
|
112
|
-
value: c
|
|
113
|
-
subtext:
|
|
114
|
-
|
|
117
|
+
value: f[c] == null ? i : a(f[c]),
|
|
118
|
+
subtext: o.supplyApr != null && t != null ? /* @__PURE__ */ l(
|
|
119
|
+
g,
|
|
115
120
|
{
|
|
116
|
-
base:
|
|
117
|
-
leverage:
|
|
121
|
+
base: a(o.supplyApr),
|
|
122
|
+
leverage: s(t)
|
|
118
123
|
}
|
|
119
124
|
) : void 0
|
|
120
125
|
},
|
|
121
|
-
`incentive-${
|
|
126
|
+
`incentive-${o.token.address}-${o.supplyApr ?? 0}`
|
|
122
127
|
)),
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
|
|
128
|
+
/* @__PURE__ */ l(
|
|
129
|
+
v,
|
|
125
130
|
{
|
|
126
131
|
muted: !0,
|
|
127
|
-
label: /* @__PURE__ */
|
|
128
|
-
value:
|
|
129
|
-
subtext:
|
|
130
|
-
|
|
132
|
+
label: /* @__PURE__ */ l(d, { messageId: "components.strategyApyBreakdownCard.borrowRate" }),
|
|
133
|
+
value: N == null ? i : a(N),
|
|
134
|
+
subtext: e.borrowApy != null && n != null ? /* @__PURE__ */ l(
|
|
135
|
+
g,
|
|
131
136
|
{
|
|
132
|
-
base:
|
|
133
|
-
leverage:
|
|
137
|
+
base: a(-e.borrowApy),
|
|
138
|
+
leverage: s(n.debtMultiplier)
|
|
134
139
|
}
|
|
135
140
|
) : void 0
|
|
136
141
|
}
|
|
137
142
|
),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
x ? /* @__PURE__ */ l(
|
|
144
|
+
v,
|
|
145
|
+
{
|
|
146
|
+
muted: !0,
|
|
147
|
+
label: /* @__PURE__ */ l(d, { messageId: "components.strategyApyBreakdownCard.quotaRate" }),
|
|
148
|
+
value: C == null ? i : a(C),
|
|
149
|
+
subtext: B != null && t != null ? /* @__PURE__ */ l(
|
|
150
|
+
g,
|
|
151
|
+
{
|
|
152
|
+
base: a(-B),
|
|
153
|
+
leverage: s(t)
|
|
154
|
+
}
|
|
155
|
+
) : void 0
|
|
156
|
+
}
|
|
157
|
+
) : null,
|
|
158
|
+
k.length > 0 ? /* @__PURE__ */ u(M, { children: [
|
|
159
|
+
/* @__PURE__ */ l("div", { className: "h-px w-full bg-divider" }),
|
|
160
|
+
k.map((o) => {
|
|
161
|
+
const c = o.multiplier != null && t != null ? o.multiplier * t : void 0;
|
|
162
|
+
return /* @__PURE__ */ l(
|
|
163
|
+
v,
|
|
144
164
|
{
|
|
145
|
-
label: /* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
|
|
165
|
+
label: /* @__PURE__ */ u("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
166
|
+
/* @__PURE__ */ l("span", { children: /* @__PURE__ */ l(
|
|
167
|
+
d,
|
|
148
168
|
{
|
|
149
169
|
messageId: "components.yieldBreakdown.programPoints",
|
|
150
|
-
values: { name:
|
|
170
|
+
values: { name: o.name }
|
|
151
171
|
}
|
|
152
172
|
) }),
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
|
|
173
|
+
/* @__PURE__ */ l(
|
|
174
|
+
$,
|
|
155
175
|
{
|
|
156
|
-
reward: { name:
|
|
176
|
+
reward: { name: o.name, type: o.id },
|
|
157
177
|
size: 16,
|
|
158
178
|
className: "shrink-0"
|
|
159
179
|
}
|
|
160
180
|
)
|
|
161
181
|
] }),
|
|
162
|
-
value:
|
|
163
|
-
subtext:
|
|
164
|
-
|
|
182
|
+
value: c != null ? `${s(c)}×` : i,
|
|
183
|
+
subtext: o.multiplier != null && t != null ? /* @__PURE__ */ l(
|
|
184
|
+
g,
|
|
165
185
|
{
|
|
166
|
-
base:
|
|
167
|
-
leverage:
|
|
186
|
+
base: s(o.multiplier),
|
|
187
|
+
leverage: s(t)
|
|
168
188
|
}
|
|
169
189
|
) : void 0
|
|
170
190
|
},
|
|
171
|
-
|
|
191
|
+
o.id
|
|
172
192
|
);
|
|
173
193
|
})
|
|
174
194
|
] }) : null
|
|
@@ -177,38 +197,38 @@ function Z({
|
|
|
177
197
|
}
|
|
178
198
|
);
|
|
179
199
|
}
|
|
180
|
-
function
|
|
181
|
-
label:
|
|
182
|
-
value:
|
|
183
|
-
subtext:
|
|
184
|
-
muted:
|
|
200
|
+
function v({
|
|
201
|
+
label: e,
|
|
202
|
+
value: r,
|
|
203
|
+
subtext: t,
|
|
204
|
+
muted: m = !1
|
|
185
205
|
}) {
|
|
186
|
-
const
|
|
187
|
-
return /* @__PURE__ */
|
|
206
|
+
const p = m ? "text-muted-foreground" : "text-foreground";
|
|
207
|
+
return /* @__PURE__ */ u(
|
|
188
208
|
"div",
|
|
189
209
|
{
|
|
190
210
|
className: "flex items-start justify-between gap-3",
|
|
191
|
-
"data-testid":
|
|
211
|
+
"data-testid": h.row,
|
|
192
212
|
children: [
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ l("span", { className: w("min-w-0 text-sm font-semibold leading-5", p), children: e }),
|
|
214
|
+
/* @__PURE__ */ u("span", { className: "flex shrink-0 flex-col items-end", children: [
|
|
215
|
+
/* @__PURE__ */ l(
|
|
196
216
|
"span",
|
|
197
217
|
{
|
|
198
218
|
className: w(
|
|
199
219
|
"text-sm font-semibold leading-5 tabular-nums",
|
|
200
|
-
|
|
220
|
+
r === i || m ? "text-muted-foreground" : "text-foreground"
|
|
201
221
|
),
|
|
202
|
-
children:
|
|
222
|
+
children: r
|
|
203
223
|
}
|
|
204
224
|
),
|
|
205
|
-
|
|
225
|
+
t != null ? /* @__PURE__ */ l("span", { className: "text-xs leading-4 text-muted-foreground", children: t }) : null
|
|
206
226
|
] })
|
|
207
227
|
]
|
|
208
228
|
}
|
|
209
229
|
);
|
|
210
230
|
}
|
|
211
231
|
export {
|
|
212
|
-
|
|
213
|
-
|
|
232
|
+
oe as StrategyApyBreakdownCard,
|
|
233
|
+
h as StrategyApyBreakdownCardTest
|
|
214
234
|
};
|
|
@@ -1,124 +1,127 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { SectionHeading as
|
|
4
|
-
import { Stack as
|
|
5
|
-
import { StickyBar as
|
|
6
|
-
import { useTitleText as
|
|
7
|
-
import { TabItem as
|
|
1
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as E, useContext as q, useMemo as d, Children as N, useRef as T, useEffect as D, isValidElement as R } from "react";
|
|
3
|
+
import { SectionHeading as F } from "../section-heading/section-heading.js";
|
|
4
|
+
import { Stack as u } from "../stack/stack.js";
|
|
5
|
+
import { StickyBar as M } from "../sticky-bar/sticky-bar.js";
|
|
6
|
+
import { useTitleText as j } from "../text/use-title-text.js";
|
|
7
|
+
import { TabItem as P, TabControl as V } from "../../tab-control/tab-control.js";
|
|
8
8
|
import { TabberTest as S } from "./constants.js";
|
|
9
|
-
import { useDetailScrollSpy as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
9
|
+
import { useDetailScrollSpy as W } from "./use-detail-scroll-spy.js";
|
|
10
|
+
const k = E({});
|
|
11
|
+
function A({
|
|
12
12
|
id: e,
|
|
13
13
|
title: o,
|
|
14
|
-
heading:
|
|
15
|
-
actions:
|
|
14
|
+
heading: s = o,
|
|
15
|
+
actions: c,
|
|
16
16
|
children: m,
|
|
17
|
-
hideHeading:
|
|
17
|
+
hideHeading: a = !1
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
19
|
+
const l = q(k), i = j(), n = !a;
|
|
20
20
|
return /* @__PURE__ */ r(
|
|
21
21
|
"section",
|
|
22
22
|
{
|
|
23
|
-
ref:
|
|
23
|
+
ref: l[e],
|
|
24
24
|
className: "scroll-mt-28",
|
|
25
25
|
"data-scroll-section": e,
|
|
26
26
|
"data-testid": S.section,
|
|
27
|
-
children: /* @__PURE__ */ u
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
children: /* @__PURE__ */ p(u, { gap: "md", children: [
|
|
28
|
+
n || c ? /* @__PURE__ */ p("div", { className: "flex items-center justify-between gap-3", children: [
|
|
29
|
+
n ? /* @__PURE__ */ r(F, { children: i(s) }) : /* @__PURE__ */ r("span", {}),
|
|
30
|
+
c
|
|
31
31
|
] }) : null,
|
|
32
32
|
m
|
|
33
33
|
] })
|
|
34
34
|
}
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
A.displayName = "TabberSection";
|
|
38
38
|
function g(e) {
|
|
39
|
-
return
|
|
39
|
+
return R(e) && e.type === A;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function z({
|
|
42
42
|
item: e,
|
|
43
43
|
...o
|
|
44
44
|
}) {
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */ r("div", { className: "min-w-0 basis-0 grow pb-px", children: /* @__PURE__ */ r(
|
|
45
|
+
return /* @__PURE__ */ p("div", { className: "flex items-stretch overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:h-0 [scrollbar-width:none]", children: [
|
|
46
|
+
/* @__PURE__ */ r("div", { className: "min-w-0 basis-0 grow pb-px", children: /* @__PURE__ */ r(V, { ...o, showBorder: !0 }) }),
|
|
47
47
|
e && /* @__PURE__ */ r("div", { className: "w-auto shrink-0 grow-0 basis-auto", children: e })
|
|
48
48
|
] });
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function G({
|
|
51
51
|
children: e,
|
|
52
52
|
observeKey: o,
|
|
53
|
-
initialSection:
|
|
54
|
-
testId:
|
|
53
|
+
initialSection: s,
|
|
54
|
+
testId: c,
|
|
55
55
|
mobileManagePane: m
|
|
56
56
|
}) {
|
|
57
|
-
const
|
|
58
|
-
() =>
|
|
57
|
+
const a = d(
|
|
58
|
+
() => N.toArray(e).filter(g),
|
|
59
59
|
[e]
|
|
60
|
-
),
|
|
60
|
+
), l = d(
|
|
61
|
+
() => a.filter((t) => t.props.beforeBar !== !0),
|
|
62
|
+
[a]
|
|
63
|
+
), i = l.map((t) => t.props.id).join("|"), n = d(
|
|
61
64
|
() => i === "" ? [] : i.split("|"),
|
|
62
65
|
[i]
|
|
63
|
-
),
|
|
66
|
+
), w = T({}), f = d(() => {
|
|
64
67
|
const t = {
|
|
65
|
-
...
|
|
68
|
+
...w.current
|
|
66
69
|
};
|
|
67
|
-
for (const
|
|
68
|
-
t[
|
|
69
|
-
return
|
|
70
|
-
}, [n]),
|
|
71
|
-
|
|
70
|
+
for (const B of n)
|
|
71
|
+
t[B] === void 0 && (t[B] = { current: null });
|
|
72
|
+
return w.current = t, t;
|
|
73
|
+
}, [n]), I = j(), { activeSection: b, scrollToSection: h } = W(
|
|
74
|
+
f,
|
|
72
75
|
n,
|
|
73
76
|
o
|
|
74
|
-
),
|
|
75
|
-
|
|
76
|
-
if (o !==
|
|
77
|
-
const t =
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
), x = T(!1), v = T(o);
|
|
78
|
+
D(() => {
|
|
79
|
+
if (o !== v.current && (v.current = o, x.current = !1), x.current || !o) return;
|
|
80
|
+
const t = s ?? n[0];
|
|
81
|
+
x.current = !0, !(t === void 0 || t === n[0]) && f[t] !== void 0 && requestAnimationFrame(() => {
|
|
82
|
+
h(t);
|
|
80
83
|
});
|
|
81
|
-
}, [o,
|
|
82
|
-
const
|
|
84
|
+
}, [o, s, h, n, f]);
|
|
85
|
+
const H = l.map((t) => ({
|
|
83
86
|
id: t.props.id,
|
|
84
87
|
item: /* @__PURE__ */ r(
|
|
85
|
-
|
|
88
|
+
P,
|
|
86
89
|
{
|
|
87
|
-
selected:
|
|
88
|
-
label:
|
|
90
|
+
selected: b === t.props.id,
|
|
91
|
+
label: I(t.props.title)
|
|
89
92
|
}
|
|
90
93
|
)
|
|
91
|
-
})), C =
|
|
94
|
+
})), C = N.toArray(e), y = C.filter(
|
|
92
95
|
(t) => g(t) && t.props.beforeBar === !0
|
|
93
|
-
),
|
|
96
|
+
), O = C.filter(
|
|
94
97
|
(t) => !(g(t) && t.props.beforeBar === !0)
|
|
95
98
|
);
|
|
96
|
-
return /* @__PURE__ */ r(
|
|
97
|
-
|
|
99
|
+
return /* @__PURE__ */ r(u, { gap: "lg", "data-testid": c ?? S.root, children: /* @__PURE__ */ p(k.Provider, { value: f, children: [
|
|
100
|
+
y.length > 0 ? /* @__PURE__ */ r(u, { gap: "xl", children: y }) : null,
|
|
98
101
|
m,
|
|
99
|
-
/* @__PURE__ */ r(
|
|
100
|
-
|
|
102
|
+
/* @__PURE__ */ r(M, { testId: S.bar, children: /* @__PURE__ */ r(
|
|
103
|
+
z,
|
|
101
104
|
{
|
|
102
105
|
state: {
|
|
103
|
-
id:
|
|
104
|
-
index: n.indexOf(
|
|
106
|
+
id: b,
|
|
107
|
+
index: n.indexOf(b),
|
|
105
108
|
handleTabChange: (t) => {
|
|
106
|
-
|
|
109
|
+
h(t);
|
|
107
110
|
}
|
|
108
111
|
},
|
|
109
|
-
tabs:
|
|
112
|
+
tabs: H,
|
|
110
113
|
item: null
|
|
111
114
|
}
|
|
112
115
|
) }),
|
|
113
|
-
/* @__PURE__ */ r(
|
|
116
|
+
/* @__PURE__ */ r(u, { gap: "xl", children: O })
|
|
114
117
|
] }) });
|
|
115
118
|
}
|
|
116
|
-
function
|
|
117
|
-
return
|
|
119
|
+
function K(e) {
|
|
120
|
+
return R(e) && e.type === G;
|
|
118
121
|
}
|
|
119
122
|
export {
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
G as Tabber,
|
|
124
|
+
A as TabberSection,
|
|
122
125
|
S as TabberTest,
|
|
123
|
-
|
|
126
|
+
K as isTabber
|
|
124
127
|
};
|